/* ==========================================================================
   DESIGN TOKENS
   ========================================================================== */
:root {
  /* base palette */
  --paper: #F6F8FB;
  --card: #FFFFFF;
  --ink: #1F2A44;
  --ink-soft: #5B6478;
  --line: #E3E8F0;

  /* accents — each colour is tied to a meaning, used consistently */
  --sun: #FF9F40;     /* interactive controls, primary actions   */
  --sun-dark: #E8832A;
  --leaf: #34B37B;    /* success / o'clock                       */
  --leaf-light: #E4F7EE;
  --sky: #219EB0;     /* minute hand, informational               */
  --sky-light: #E3F5F7;
  --berry: #E23F87;   /* hour hand, highlights                    */
  --berry-light: #FCE7F1;
  --grape: #7A5FD8;   /* quarter markers, secondary accent         */
  --grape-light: #EFEAFC;
  --danger: #E14B4B;
  --danger-light: #FDECEC;

  --rainbow: linear-gradient(90deg, var(--leaf), var(--sky), var(--sun), var(--berry), var(--grape));

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(31, 42, 68, 0.06);
  --shadow-md: 0 10px 30px rgba(31, 42, 68, 0.10);
  --shadow-lg: 0 20px 48px rgba(31, 42, 68, 0.14);

  --font-display: "Baloo 2", "Segoe UI Rounded", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;

  --container: 1120px;
}

@media (prefers-color-scheme: dark) {
  /* Intentionally not auto-switching to a dark theme: the brief calls for
     a bright, low-fatigue surface for children reading small type. */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-weight: 700;
}

h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.05rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; color: var(--ink-soft); max-width: 66ch; }

a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

button { font-family: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.rainbow-rule {
  height: 4px;
  background: var(--rainbow);
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 248, 251, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  max-width: var(--container);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
}

.brand-mark {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--rainbow);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0; padding: 0;
}

.nav-links a {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
}
.nav-links a:hover { background: var(--card); color: var(--ink); text-decoration: none; }
.nav-links a[aria-current="page"] {
  color: var(--ink);
  background: var(--card);
  box-shadow: inset 0 -2px 0 0 var(--sun);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-sm);
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }

@media (max-width: 780px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: var(--card);
    padding: 10px;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    display: none;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { display: block; }
}

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  text-align: center;
  padding: 56px 20px 20px;
  max-width: 780px;
  margin: 0 auto;
}
.hero p { margin: 0 auto; }

/* ==========================================================================
   CLOCK STATION
   ========================================================================== */
.clock-station {
  display: grid;
  grid-template-columns: minmax(280px, 460px) 1fr;
  gap: 32px;
  align-items: start;
  padding: 32px 20px 8px;
  max-width: var(--container);
  margin: 0 auto;
}

@media (max-width: 900px) {
  .clock-station { grid-template-columns: 1fr; }
}

.analog-panel {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.clock-svg-wrap {
  width: 100%;
  max-width: 380px;
  touch-action: none;
}

.clock-hint {
  font-size: 0.88rem;
  color: var(--ink-soft);
  text-align: center;
  margin: 0;
}

.hand-grip {
  cursor: grab;
}
.hand-grip:active { cursor: grabbing; }

/* Every analog clock gets a guaranteed, self-contained size — it never
   relies on a wrapper resolving "auto" width correctly. */
svg.analog-clock {
  width: 100%;
  height: auto;
  display: block;
}

/* right column: digital + english + turkish + presets */
.readout-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
}

/* Digital clock */
.digital-clock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.digit-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.digit-badge .value {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  width: 96px;
  text-align: center;
  border-radius: var(--radius-md);
  padding: 10px 0;
  color: #fff;
}
.digit-badge.hour .value { background: linear-gradient(160deg, var(--berry), #c72c6f); }
.digit-badge.minute .value { background: linear-gradient(160deg, var(--sky), #187887); }

.digit-badge .caption {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stepper button {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}
.stepper button:hover { background: var(--line); }
.stepper button:active { transform: scale(0.92); }

.digital-colon {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink-soft);
  padding-bottom: 34px;
}

.format-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.ampm-tag {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  background: var(--sun);
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
}

.segmented {
  display: inline-flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 3px;
}
.segmented button {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}

/* English / Turkish sentence card */
.sentence-card {
  background: linear-gradient(150deg, var(--card), var(--sky-light));
  border: 1px solid var(--line);
}
.sentence-card .label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sky);
  margin-bottom: 6px;
}
.sentence-card .english {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 12px;
}
.sentence-card .turkish {
  font-size: 1rem;
  color: var(--ink-soft);
  font-style: italic;
  margin: 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.sentence-card .turkish .tag {
  font-style: normal;
  font-weight: 700;
  color: var(--grape);
  margin-right: 6px;
}

/* Presets */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--card);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.chip:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.chip:active { transform: translateY(0); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.chip.random { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.random .dot { background: var(--sun); }

/* ==========================================================================
   SETTINGS TRAY
   ========================================================================== */
.settings {
  max-width: var(--container);
  margin: 8px auto 0;
  padding: 0 20px;
}
.settings > summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  padding: 14px 20px;
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings > summary::-webkit-details-marker { display: none; }
.settings > summary .chevron { margin-left: auto; transition: transform 160ms ease; }
.settings[open] > summary .chevron { transform: rotate(180deg); }

.settings-body {
  background: var(--card);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 20px;
  margin-top: -8px;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.settings-group h4 {
  font-size: 0.9rem;
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-weight: 700;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.92rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--line);
  border-radius: var(--radius-pill);
  transition: background 160ms ease;
}
.switch .track::before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 160ms ease;
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: var(--leaf); }
.switch input:checked + .track::before { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--sky); outline-offset: 2px; }

.difficulty-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.difficulty-group button {
  flex: 1;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  color: var(--ink-soft);
}
.difficulty-group button[aria-pressed="true"] {
  background: var(--grape);
  border-color: var(--grape);
  color: #fff;
}

/* ==========================================================================
   SECTIONS (shared)
   ========================================================================== */
.section {
  max-width: var(--container);
  margin: 0 auto;
  padding: 64px 20px;
}
.section-head {
  max-width: 640px;
  margin: 0 0 32px;
}
.section-head.center { margin: 0 auto 32px; text-align: center; }

/* ==========================================================================
   LEARNING MODE (quiz)
   ========================================================================== */
.quiz-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: center;
}
@media (max-width: 720px) {
  .quiz-card { grid-template-columns: 1fr; }
}

.quiz-clock-wrap { width: 100%; max-width: 220px; justify-self: center; }

.quiz-question {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0 0 16px;
}

.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) { .answer-grid { grid-template-columns: 1fr; } }

.answer-btn {
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--paper);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
.answer-btn:hover { border-color: var(--sky); }
.answer-btn[data-state="correct"] { border-color: var(--leaf); background: var(--leaf-light); }
.answer-btn[data-state="incorrect"] { border-color: var(--danger); background: var(--danger-light); }
.answer-btn:disabled { cursor: default; }

.feedback {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  display: none;
}
.feedback[data-visible="true"] { display: block; }
.feedback.correct { background: var(--leaf-light); color: #1c7a52; }
.feedback.incorrect { background: var(--danger-light); color: #a92b2b; }

.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  gap: 10px;
  flex-wrap: wrap;
}
.score-tag {
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--sun);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.btn:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }

/* ==========================================================================
   PRACTICE MODE
   ========================================================================== */
.practice-card {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 28px;
  align-items: center;
}
@media (max-width: 720px) { .practice-card { grid-template-columns: 1fr; } }

.practice-instruction {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 8px;
}
.practice-target {
  color: var(--grape);
  font-weight: 700;
}
.practice-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ==========================================================================
   SEO / EDUCATIONAL CONTENT
   ========================================================================== */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}
.concept-card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--sky);
}
.concept-card:nth-child(2n) { border-top-color: var(--berry); }
.concept-card:nth-child(3n) { border-top-color: var(--sun); }
.concept-card:nth-child(4n) { border-top-color: var(--leaf); }
.concept-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.concept-card .example {
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.92rem;
  margin-top: 10px;
}
.concept-card .example .en { font-weight: 700; color: var(--ink); }
.concept-card .example .tr { color: var(--ink-soft); font-style: italic; }

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
}
.faq-item > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  padding: 14px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::before {
  content: "+";
  font-family: var(--font-display);
  color: var(--sun);
  font-size: 1.2rem;
  width: 22px;
}
.faq-item[open] > summary::before { content: "–"; }
.faq-item p { padding: 0 4px 16px 32px; margin: 0; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  background: var(--ink);
  color: #C7CDE0;
  padding: 40px 20px 28px;
  margin-top: 40px;
}
.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.footer-links a { color: #C7CDE0; font-weight: 600; font-size: 0.92rem; }
.footer-links a:hover { color: #fff; }
.footer-note { font-size: 0.85rem; color: #8B93AC; margin: 0; max-width: 60ch; }

/* live-region toast used for time-change announcements */
.sr-announce { position: absolute; left: -9999px; }
