/* ============================================================
   Typefaces — self-hosted, deliberately

   Lora and Manrope are both SIL Open Font License 1.1, which permits
   redistribution provided the licence and copyright notice ship with the
   files: see assets/fonts/Lora-OFL.txt and Manrope-OFL.txt.

   They are served from this origin rather than from Google's CDN because
   a third-party font request hands every visitor's IP address and
   User-Agent to that third party on every page load. The learner did not
   agree to that, and nothing here needs it. Self-hosting also leaves the
   site with no remote dependency at all, so it works offline and cannot
   be broken by someone else's outage.

   Subsets: latin, latin-ext (Turkish ı İ ş ğ ç ö ü) and cyrillic,
   cyrillic-ext (the Russian track). Variable weight 400-700 in one file
   per subset, which is why there are eight files and not thirty.

   Do not replace these with a CDN <link>. tools/check-safety.mjs fails
   the build if a remote resource reappears.
   ============================================================ */
/* Lora — cyrillic-ext */
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/Lora-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
  }
/* Lora — cyrillic */
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/Lora-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
  }
/* Lora — latin-ext */
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/Lora-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }
/* Lora — latin */
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/Lora-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }
/* Manrope — cyrillic-ext */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/Manrope-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
  }
/* Manrope — cyrillic */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/Manrope-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
  }
/* Manrope — latin-ext */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/Manrope-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }
/* Manrope — latin */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/Manrope-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }

/* ============================================================
   Design tokens

   Two accents, two jobs — they must not be swapped:
     sage  = the interface (structure, controls, navigation)  -> calm
     honey = progress and achievement (bars, badges, next step) -> momentum
   Keeping them apart is what lets the page feel restful while
   still pulling the learner forward. All pairs below are checked
   to WCAG AA (4.5:1 text, 3:1 graphics) in both themes.
   ============================================================ */
:root {
  --bg: #f6f5f0;
  --bg-elevated: #fdfcfa;
  --bg-sunken: #f0eee6;
  --ink: #242a24;
  --ink-soft: #4d564c;
  --muted: #646c62;
  --border: #e4e2d8;
  --border-strong: #cecbbe;

  /* calm accent — sage */
  --accent: #55705f;
  --accent-hover: #445b4d;
  --accent-ink: #ffffff;
  --accent-soft: #e7eee9;
  --accent-soft-ink: #3a5144;

  /* momentum accent — honey */
  --gold: #ac7530;          /* fills and graphics only */
  --gold-strong: #9c6829;   /* solid buttons carrying white text */
  --gold-ink: #ffffff;
  --gold-text: #7d5420;     /* honey-coloured text */
  --gold-soft: #f7efe1;

  /* Answer feedback — a family of its own, NOT a third accent. These may
     only ever colour a checked quiz answer; they never touch ordinary UI.
     AA-checked against bg / bg-elevated / bg-sunken in both themes. */
  --ok: #3f7d52;
  --ok-soft: #e6f0e8;
  --ok-text: #2f6b41;
  --no: #8f4430;
  --no-soft: #f9ebe5;
  --no-text: #8f4430;

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  /* deliberately shallow — deep shadows read as urgency */
  --shadow-sm: 0 1px 2px rgba(45, 50, 40, 0.04);
  --shadow-md: 0 8px 24px -14px rgba(45, 50, 40, 0.16), 0 2px 6px -3px rgba(45, 50, 40, 0.06);
  --glow-gold: 0 8px 26px -14px rgba(172, 117, 48, 0.55);

  --font-body: "Manrope", "Segoe UI", -apple-system, system-ui, Roboto, Arial, sans-serif;
  --font-display: "Lora", Georgia, "Times New Roman", serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151815;
    --bg-elevated: #1c211d;
    --bg-sunken: #101310;
    --ink: #edefe9;
    --ink-soft: #c2c9bf;
    --muted: #8d9489;
    --border: #2b322c;
    --border-strong: #3c443d;

    --accent: #8fb69c;
    --accent-hover: #a6c9b1;
    --accent-ink: #14201a;
    --accent-soft: #232d26;
    --accent-soft-ink: #a8cab4;

    --gold: #ddaa68;
    --gold-strong: #ddaa68;
    --gold-ink: #241a0c;
    --gold-text: #e3bb84;
    --gold-soft: #2e2519;

    --ok: #6fbd86;
    --ok-soft: #1d2a20;
    --ok-text: #6fbd86;
    --no: #e39b80;
    --no-soft: #2e211c;
    --no-text: #e39b80;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px -14px rgba(0, 0, 0, 0.5), 0 2px 6px -3px rgba(0, 0, 0, 0.3);
    --glow-gold: 0 8px 26px -14px rgba(221, 170, 104, 0.4);
  }
}
:root[data-theme="dark"] {
  --bg: #151815;
  --bg-elevated: #1c211d;
  --bg-sunken: #101310;
  --ink: #edefe9;
  --ink-soft: #c2c9bf;
  --muted: #8d9489;
  --border: #2b322c;
  --border-strong: #3c443d;

  --accent: #8fb69c;
  --accent-hover: #a6c9b1;
  --accent-ink: #14201a;
  --accent-soft: #232d26;
  --accent-soft-ink: #a8cab4;

  --gold: #ddaa68;
  --gold-strong: #ddaa68;
  --gold-ink: #241a0c;
  --gold-text: #e3bb84;
  --gold-soft: #2e2519;

  --ok: #6fbd86;
  --ok-soft: #1d2a20;
  --ok-text: #6fbd86;
  --no: #e39b80;
  --no-soft: #2e211c;
  --no-text: #e39b80;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px -14px rgba(0, 0, 0, 0.5), 0 2px 6px -3px rgba(0, 0, 0, 0.3);
  --glow-gold: 0 8px 26px -14px rgba(221, 170, 104, 0.4);
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }
/* Layout rules below set display on .translation etc., which would otherwise
   win over the UA [hidden] rule and leave hidden content visible. */
[hidden] { display: none !important; }
html { color-scheme: light dark; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
a { color: var(--accent); text-underline-offset: 3px; }
::selection { background: var(--accent-soft); color: var(--accent-soft-ink); }

/* The old design had no visible focus style at all. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   Reading-progress bar

   Sage on the left warming to honey on the right: the gradient is
   pinned to the viewport, so the bar literally grows warmer as the
   learner moves down the lesson rather than just getting longer.
   ============================================================ */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background-image: linear-gradient(90deg, var(--accent), var(--gold));
  background-size: 100vw 100%;
  background-repeat: no-repeat;
  z-index: 100;
  transition: width 0.15s linear;
}

/* ============================================================
   Header (shared by course index + lesson pages)
   ============================================================ */
header.lesson-header {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 24px 34px;
  background: transparent;
}
header.lesson-header .crumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 14px;
}
header.lesson-header .crumbs a { color: var(--muted); text-decoration: none; }
header.lesson-header .crumbs a:hover { color: var(--accent); text-decoration: underline; }
header.lesson-header h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.45rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
  color: var(--ink);
}
header.lesson-header p.subtitle {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 1.02rem;
  max-width: 58ch;
}
header.lesson-header p.meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  max-width: var(--measure);
}
.source-link { font-size: 0.83rem; color: var(--muted); margin-top: 4px; }
.source-link a { color: var(--muted); }

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* A hairline rule instead of a filled panel — quieter separation. */
header.lesson-header::after {
  content: "";
  display: block;
  height: 1px;
  background: var(--border);
  margin-top: 30px;
}

/* ============================================================
   Course hero (index page)
   ============================================================ */
.course-hero { max-width: 940px; }
.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.hero-top .header-controls { margin-top: 0; }

/* ---- main page: the host's greeting at the door ---- */
.welcome {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
header.lesson-header .welcome h1 {
  margin: 0;
  font-size: clamp(2.1rem, 1.4rem + 3vw, 3.2rem);
}
.welcome h1 .tr { font-weight: 600; letter-spacing: -0.01em; }
/* a tulip-shaped tea glass (ince belli bardak) on its saucer */
.welcome-glass {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.welcome-glass .tea { fill: var(--gold-strong); stroke: none; opacity: 0.8; }
.welcome-glass .steam { stroke: var(--muted); }
.welcome-reply {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: -6px 0 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.welcome-reply .tr { font-size: 1.05rem; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-soft-ink);
  background: var(--accent-soft);
  padding: 7px 15px;
  border-radius: var(--radius-pill);
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 28px;
}
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  padding: 9px 15px;
  border-radius: var(--radius-pill);
}

/* ---- course progress: the main "keep going" signal ---- */
.progress-block {
  margin: 4px 0 8px;
  max-width: 460px;
}
.progress-block .progress-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gold-text);
  margin: 0 0 10px;
}
.progress-bar-track {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--gold-strong), var(--gold));
  box-shadow: var(--glow-gold);
  transition: width 1s var(--ease);
  width: 0%;
}

/* ============================================================
   Language + theme toggles
   ============================================================ */
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-sunken);
  padding: 3px;
  gap: 2px;
}
.lang-toggle button,
.lang-toggle a {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-pill);
  min-height: 34px;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.lang-toggle button:hover,
.lang-toggle a:hover { color: var(--ink); }
.lang-toggle button.active,
.lang-toggle a.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  color: var(--ink);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.theme-toggle:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ============================================================
   Layout
   ============================================================ */
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 34px 24px 24px;
}
/* course index: wide enough for a three-column lesson grid */
main.course-body { max-width: 940px; }

/* ---- lesson grid (course index) ---- */
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 18px;
}

/* ---- course cards (main page): two tiles, same card, more words ---- */
.course-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.lesson-card p {
  margin: 0 0 18px;
  font-size: 0.93rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.lesson-card p.course-meta {
  margin: -6px 0 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
/* course index: a lesson whose topics are not written up yet */
.lesson-card p.topics-tbd { flex: 1; font-size: 0.86rem; color: var(--muted); }

/* ============================================================
   Course intro ("why learn Turkish")

   Selectors are scoped with .intro so they outrank `section.block p`,
   which is (0,1,2) and would otherwise win on margin and max-width.
   ============================================================ */
.intro .intro-lead {
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--ink);
  max-width: 62ch;
  margin-bottom: 4px;
}

/* Four reasons, so a 2x2 block reads better than three-plus-one orphan. */
.reason-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 28px 40px;
  margin: 30px 0 4px;
}
.reason { display: flex; flex-direction: column; }
.reason-num {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 8px;
}
.reason h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}
.intro .reason p { margin: 0 0 16px; font-size: 0.95rem; max-width: none; }

/* Hearing Turkish before lesson one is the point of the whole course, so
   every reason carries a phrase the reader can play right away. Pinned to
   the bottom of its cell so the demos line up across a row instead of
   floating at whatever height the paragraph above happens to end. */
.intro .reason-demo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: auto 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.reason-demo .tr { font-size: 0.98rem; }

.proverb {
  margin: 36px 0 28px;
  padding: 20px 24px;
  background: var(--bg-sunken);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.intro .proverb-tr {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.proverb-tr .tr {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  font-style: italic;
}
.proverb figcaption {
  font-size: 0.92rem;
  color: var(--muted);
  max-width: 62ch;
}

.intro .intro-close { max-width: 62ch; color: var(--ink-soft); }

/* The one genuine "move forward" action on this page, so it takes honey. */
.start-cta {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin-top: 10px;
  padding: 13px 24px;
  border-radius: var(--radius-pill);
  background: var(--gold-strong);
  color: var(--gold-ink);
  font-weight: 700;
  font-size: 0.93rem;
  text-decoration: none;
  box-shadow: var(--glow-gold);
  transition: filter 0.25s var(--ease);
}
.start-cta:hover { filter: brightness(1.08); }

.section-heading {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin: 38px 0 18px;
}

/* ============================================================
   Cards
   ============================================================ */
section.block, .lesson-card {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s var(--ease), border-color 0.3s var(--ease), opacity 0.3s var(--ease);
}
.lesson-card {
  margin-bottom: 0;
  padding: 24px 24px 22px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
/* Honey top edge marks the cards you can actually start — the eye
   lands on the next step rather than on 26 identical tiles. */
.lesson-card[data-available="true"]::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-strong), var(--gold));
}
.lesson-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.lesson-card[data-available="true"]:hover { border-color: var(--gold); }
.lesson-card:not([data-available="true"]) { opacity: 0.72; }
.lesson-card:not([data-available="true"]):hover { opacity: 0.95; }

/* Main page and course index: a card whose title is a link opens as a
   whole. The link's ::after covers the card; the "+ N more" toggle sits
   above that layer so it still expands the topics instead of navigating. */
.card-link { color: inherit; text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card-link:focus-visible { outline: none; }
.lesson-card:has(.card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.lesson-card:has(.card-link) .more-toggle { position: relative; z-index: 2; }
.lesson-grid .lesson-card > :last-child { margin-bottom: 0; padding-bottom: 0; }

.card-status {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.lesson-card:not([data-available="true"]) .card-status {
  background: var(--bg-sunken);
  color: var(--muted);
  border: 1px solid var(--border);
}

section.block h2, .lesson-card h2 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.lesson-card h2 { font-size: 1.05rem; margin-bottom: 14px; }

/* Flat sage discs — no gradient, no drop shadow. A numbered step
   should feel like a quiet waypoint, not a notification badge. */
.step-num, .lesson-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2em;
  height: 2em;
  flex: 0 0 auto;
  font-family: var(--font-body);
  color: var(--accent-soft-ink);
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
}

section.block p {
  margin: 0 0 14px;
  font-size: 1rem;
  color: var(--ink-soft);
  max-width: var(--measure);
}
section.block ul, section.block ol { margin: 0 0 14px; padding-left: 1.35em; }
section.block li {
  margin: 8px 0;
  font-size: 1rem;
  color: var(--ink-soft);
  max-width: var(--measure);
}
section.block li::marker { color: var(--muted); }

.lesson-card ul {
  margin: 0 0 16px;
  padding-left: 1.2em;
  flex: 1;
}
.lesson-card li {
  margin: 6px 0;
  font-size: 0.89rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.more-toggle {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 0 0 16px;
  margin: -8px 0 0;
}
.more-toggle:hover { text-decoration: underline; }

/* ============================================================
   Turkish text
   ============================================================ */
.tr {
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.005em;
}

/* ============================================================
   Phrase / vocab rows
   ============================================================ */
.phrase {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.phrase:last-child { border-bottom: none; padding-bottom: 0; }
.phrase:first-of-type { padding-top: 4px; }
.phrase .tr { font-size: 1.08rem; }
.phrase .gloss {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}
.phrase-controls {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

/* ============================================================
   Buttons
   ============================================================ */
button.speak-btn, button.reveal-btn {
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  min-height: 38px;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}

/* A lesson repeats this control on every line. Bordered pills stacked
   thirteen deep read as clutter and pull attention off the Turkish, so
   the resting state is a plain coloured label; the pill appears on
   hover/focus, and stays while the item is open. */
button.reveal-btn {
  background: transparent;
  color: var(--accent);
  padding: 8px 12px;
}
button.reveal-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}
button.reveal-btn[aria-expanded="true"] {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}

button.speak-btn {
  color: var(--accent-soft-ink);
  background: var(--accent-soft);
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
button.speak-btn:hover { background: var(--accent); color: var(--accent-ink); }
button.speak-btn:disabled { opacity: 0.4; cursor: not-allowed; }
button.speak-btn:disabled:hover { background: var(--accent-soft); color: var(--accent-soft-ink); }

/* ============================================================
   Revealed translation
   ============================================================ */
.translation {
  width: 100%;
  margin-top: 10px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.95rem;
  color: var(--accent-soft-ink);
  animation: translation-in 0.3s var(--ease);
}
@keyframes translation-in {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   Dialogue
   ============================================================ */
.dialogue-line {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.dialogue-line .speaker {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--accent-soft-ink);
  background: var(--accent-soft);
  min-width: 2.3em;
  text-align: center;
  border-radius: var(--radius-sm);
  padding: 5px 0;
  font-size: 0.82rem;
}
.dialogue-line .content {
  flex: 1 1 240px;
  min-width: 200px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.dialogue-line .content .tr { flex: 1 1 auto; }

/* ============================================================
   Grammar example
   ============================================================ */
.example {
  margin: 12px 0;
  padding: 10px 0 10px 18px;
  border-left: 2px solid var(--border-strong);
  font-size: 0.98rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* ============================================================
   Homework — framed in honey: it is the step forward, not a chore
   ============================================================ */
.homework-box {
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 20px 24px;
  background: var(--bg-sunken);
}
.homework-box ol { margin: 0; }
.homework-box li { color: var(--ink-soft); }
.homework-box li::marker { color: var(--gold-text); font-weight: 700; }

/* ============================================================
   Footer
   ============================================================ */
footer.lesson-footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 24px 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}
footer.lesson-footer a {
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  background: var(--bg-elevated);
  font-weight: 600;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease), background-color 0.25s var(--ease);
}
footer.lesson-footer a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
/* The licence line takes a row of its own under the navigation. Muted and
   small: it is small print, and must never read as a next step. */
footer.lesson-footer .licence {
  flex-basis: 100%;
  margin: 8px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ============================================================
   Illustrations

   All lesson artwork is original inline SVG line-art held in a
   hidden sprite at the top of the page and instanced with <use>.
   It is stroke-based on `currentColor`, so it themes with the page
   for free and stays crisp at any size — no raster assets, nothing
   to download, and the captions still take part in the RU/EN swap.
   ============================================================ */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.illus {
  display: block;
  margin: 0 auto 4px;
  color: var(--accent);
}

/* Interface glyphs (sound, play, stop, theme, stat chips). The sprite
   they instance is injected by app.js, so no page repeats it.

   Sized in em so one class serves a 0.82rem speak button and a 0.95rem
   theme toggle; stroked here rather than on the symbols so every UI
   glyph is governed from one place. All these properties inherit, which
   is what lets them reach the <use> shadow content. */
.ui-icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A wide scene sitting under a section lead. */
figure.scene {
  margin: 4px 0 22px;
  padding: 18px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
}
figure.scene svg {
  width: 100%;
  max-width: 340px;
  height: auto;
  color: var(--accent);
}
figure.scene figcaption {
  margin-top: 10px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ============================================================
   Illustrated vocabulary — picture carries the meaning, so the
   learner links the Turkish word to the thing, not to a gloss.
   ============================================================ */
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 14px;
  margin: 20px 0 4px;
}
.vocab-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px 12px;
  text-align: center;
  transition: border-color 0.25s var(--ease);
}
.vocab-card:hover { border-color: var(--border-strong); }
.vocab-card svg {
  width: 52px;
  height: 52px;
  color: var(--accent);
}
.vocab-card .tr { display: block; margin-top: 8px; font-size: 1rem; }
.vocab-card .plural {
  display: block;
  margin-top: 2px;
  font-size: 0.9rem;
  color: var(--accent-soft-ink);
  font-weight: 600;
}
.vocab-card .gloss {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}
.vocab-card .speak-btn { margin-top: 8px; }

/* ============================================================
   Interactive alphabet — every letter is playable, which is the
   whole point: Turkish spelling is phonetic, so hearing the letter
   IS learning the rule.
   ============================================================ */
.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 8px;
  margin: 18px 0 8px;
}
.letter-btn {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 12px 4px 10px;
  background: var(--bg-elevated);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  line-height: 1.25;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.letter-btn .hint {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}
.letter-btn:hover,
.letter-btn.speaking {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}
.letter-btn:hover .hint,
.letter-btn.speaking .hint { color: var(--accent-soft-ink); }
.letter-btn.special { border-color: var(--border-strong); background: var(--bg-sunken); }
.letter-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ============================================================
   Vowel-harmony diagram — the single most useful picture in the
   course, so it gets a real layout rather than a table.
   ============================================================ */
.harmony {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 20px 0 8px;
}
/* Four-way harmony (mı/mi/mu/mü, -da/-de/-ta/-te) reads as 2x2; at three
   across the fourth card is orphaned. min() collapses it on a phone. */
.harmony.quad { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.harmony-group {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.harmony-group h3 {
  margin: 0 0 4px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.harmony-vowels {
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.14em;
}
.harmony-arrow {
  display: block;
  margin: 8px 0 6px;
  color: var(--accent);
  font-size: 1.1rem;
}
.harmony-suffix {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-soft-ink);
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
  padding: 4px 16px;
}
.harmony-note {
  margin-top: 10px;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ============================================================
   Dialogue player — plays the whole conversation through so the
   learner hears it as speech, not as a list of separate buttons.
   ============================================================ */
.dialogue-player {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 18px;
}
.play-dialogue-btn {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  cursor: pointer;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.play-dialogue-btn:hover {
  background: var(--accent);
  color: var(--accent-ink);
}
.play-dialogue-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.dialogue-status {
  font-size: 0.85rem;
  color: var(--muted);
}

/* The line currently being spoken. Colour + a sage rule only —
   no movement, per the motion rule. */
.dialogue-line.speaking {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  box-shadow: inset 3px 0 0 var(--accent);
}
.dialogue-line { transition: background-color 0.3s var(--ease); }

/* ============================================================
   Quizzes — active recall with immediate feedback.

   Feedback colours come from the --ok / --no family, never from
   the sage or honey accents: a right answer is not "progress
   chrome", it is a distinct signal and needs to stay legible as one.
   ============================================================ */
.quiz-item {
  padding: 18px 0 4px;
  border-top: 1px solid var(--border);
}
.quiz-item:first-of-type { border-top: 0; padding-top: 6px; }

.quiz-q {
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.quiz-q .q-num {
  flex: none;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.quiz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}
.quiz-option {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.quiz-option:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-soft-ink); background: var(--accent-soft); }
.quiz-option:disabled { cursor: default; }
.quiz-option.correct {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok-text);
  font-weight: 700;
}
.quiz-option.wrong {
  border-color: var(--no);
  background: var(--no-soft);
  color: var(--no-text);
}
.quiz-option.muted:disabled { opacity: 0.5; }

.quiz-feedback {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 8px 0 2px;
  min-height: 1.2em;
}
.quiz-feedback.ok { color: var(--ok-text); }
.quiz-feedback.no { color: var(--no-text); }

/* Score line — honey, because finishing a quiz IS progress. */
.quiz-score {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
  color: var(--gold-text);
  font-weight: 600;
  font-size: 0.95rem;
}
.quiz-score[hidden] { display: none !important; }

.quiz-reset {
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  margin-top: 14px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.quiz-reset:hover { border-color: var(--accent); color: var(--accent); }

/* --- Picture-match: tap a picture, then tap its word --- */
.match-pics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 12px;
  margin: 14px 0;
  padding: 0;
  list-style: none;
}
.match-pic {
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.match-pic svg { width: 44px; height: 44px; color: var(--accent); }
.match-pic:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.match-pic.selected { border-color: var(--accent); background: var(--accent-soft); border-width: 2px; }
.match-pic.solved {
  border-color: var(--ok);
  background: var(--ok-soft);
  cursor: default;
}
.match-pic.solved svg { color: var(--ok); }
.match-pic .match-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ok-text);
  min-height: 1.1em;
}
.match-pic:disabled { cursor: default; }

.match-words { margin-top: 4px; }

/* --- Fill in the blank --- */
.blank-sentence {
  font-size: 1.05rem;
  margin: 0 0 12px;
  color: var(--ink);
}
.blank-slot {
  display: inline-block;
  min-width: 68px;
  text-align: center;
  padding: 1px 10px;
  border-bottom: 2px dashed var(--border-strong);
  font-weight: 700;
  color: var(--accent-soft-ink);
}
.blank-slot.filled { border-bottom-style: solid; border-bottom-color: var(--accent); }
.blank-slot.filled.is-ok { color: var(--ok-text); border-bottom-color: var(--ok); }
.blank-slot.filled.is-no { color: var(--no-text); border-bottom-color: var(--no); }

/* ============================================================
   "No Turkish voice here" notice

   Informational, not an error: the lesson still works. Sage rather
   than the --no feedback colour, which is reserved for a wrong answer,
   and it must not read as alarm.
   ============================================================ */
.voice-notice {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 0 0 24px;
}
.voice-notice p {
  margin: 0;
  max-width: none;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--accent-soft-ink);
}


/* ============================================================
   Reading passage

   One sentence per line, which at this level is how the text is
   actually parsed — and it gives every sentence somewhere to hang
   its own listen and reveal controls. Paragraph grouping carries the
   shape of the story so it still reads as prose, not as a list.
   ============================================================ */
.reading {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin: 18px 0 10px;
}
.reading-title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 3px;
}
.reading-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 16px;
}
.reading-para { margin: 0 0 15px; }
.reading-para:last-child { margin-bottom: 0; }

.reading-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 5px 8px;
  margin-left: -8px;
  border-radius: var(--radius-sm);
  transition: background-color 0.3s var(--ease);
}
.reading-line .tr {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1.02rem;
}
.reading-line .translation { flex-basis: 100%; margin-top: 6px; }
.reading-line.speaking {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
/* Lines of speech inside the story, indented like a script. */
.reading-line.said { padding-left: 20px; }
.reading-line.said .tr { color: var(--ink-soft); }

/* ============================================================
   New words — a glossary for the passage, not a vocab drill, so
   the meaning shows inline rather than hiding behind a toggle.
   ============================================================ */
.reading-vocab { margin-top: 20px; }
.reading-vocab h3 {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.word-grid li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  margin: 0;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
}
.word-grid li::marker { content: none; }
.word-grid .tr { font-weight: 600; }
.word-grid .gloss { color: var(--muted); margin-left: auto; text-align: right; }

/* ============================================================
   Culture corner
   ============================================================ */
.culture-figure {
  float: right;
  width: 132px;
  margin: 0 0 14px 20px;
  text-align: center;
}
.culture-figure svg { width: 100%; height: auto; color: var(--accent); }
.culture-figure figcaption {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}


/* ============================================================
   Ornament — Turkish geometric motifs

   Original constructions in the tradition of Anatolian geometric
   and Iznik floral work: an eight-point star lattice, a stylised
   tulip (lale), and a kilim border band. Drawn from maths rather
   than traced from anyone's artwork (rule 1).

   They are used as **masks**, never as images: the colour comes
   from a token via background-color, so one definition themes
   itself in dark mode and cannot introduce an off-palette colour.

   The rule that keeps them from wrecking the calm: ornament goes
   behind *chrome* — headers, hero, footer, a culture aside — and
   never behind text the learner has to read. Opacity stays low
   enough that it reads as paper texture, not as decoration.
   ============================================================ */
:root {
  --ornament: var(--accent);
  --ornament-alpha: 0.055;
  /* Hard ceiling: 1.4. Above it, --muted text sitting on an ornament
     stroke drops below 4.5:1 in light mode (measured, both themes).
     Any ornament that text can overlap must stay at or under this. */
  --ornament-max: 1.4;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ornament-alpha: 0.075; }
}
:root[data-theme="dark"] { --ornament-alpha: 0.075; }

.ornament-layer,
header.lesson-header::before,
.course-hero::before,
footer.lesson-footer::before,
section.block.culture::before {
  content: "";
  position: absolute;
  pointer-events: none;
  background-color: var(--ornament);
  opacity: var(--ornament-alpha);
  mask-repeat: repeat;
  -webkit-mask-repeat: repeat;
}

/* Header + hero: star lattice, faded out downward so it never reaches
   the body copy. Two masks composited — pattern intersected with a
   fade; where mask-composite is unsupported the pattern simply does
   not fade, which is a cosmetic loss, not a broken layout. */
header.lesson-header,
.course-hero,
footer.lesson-footer,
section.block.culture { position: relative; }
header.lesson-header > *,
.course-hero > *,
footer.lesson-footer > *,
section.block.culture > * { position: relative; z-index: 1; }

header.lesson-header::before,
.course-hero::before {
  inset: 0 0 auto 0;
  height: 100%;
  mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2280%22%20height%3D%2280%22%20viewBox%3D%220%200%2080%2080%22%3E%3Cpath%20d%3D%22M40.00%2020.00L43.17%2032.35L54.14%2025.86L47.65%2036.83L60.00%2040.00L47.65%2043.17L54.14%2054.14L43.17%2047.65L40.00%2060.00L36.83%2047.65L25.86%2054.14L32.35%2043.17L20.00%2040.00L32.35%2036.83L25.86%2025.86L36.83%2032.35ZM0.00%20-20.00L3.17%20-7.65L14.14%20-14.14L7.65%20-3.17L20.00%20-0.00L7.65%203.17L14.14%2014.14L3.17%207.65L0.00%2020.00L-3.17%207.65L-14.14%2014.14L-7.65%203.17L-20.00%200.00L-7.65%20-3.17L-14.14%20-14.14L-3.17%20-7.65ZM80.00%20-20.00L83.17%20-7.65L94.14%20-14.14L87.65%20-3.17L100.00%20-0.00L87.65%203.17L94.14%2014.14L83.17%207.65L80.00%2020.00L76.83%207.65L65.86%2014.14L72.35%203.17L60.00%200.00L72.35%20-3.17L65.86%20-14.14L76.83%20-7.65ZM0.00%2060.00L3.17%2072.35L14.14%2065.86L7.65%2076.83L20.00%2080.00L7.65%2083.17L14.14%2094.14L3.17%2087.65L0.00%20100.00L-3.17%2087.65L-14.14%2094.14L-7.65%2083.17L-20.00%2080.00L-7.65%2076.83L-14.14%2065.86L-3.17%2072.35ZM80.00%2060.00L83.17%2072.35L94.14%2065.86L87.65%2076.83L100.00%2080.00L87.65%2083.17L94.14%2094.14L83.17%2087.65L80.00%20100.00L76.83%2087.65L65.86%2094.14L72.35%2083.17L60.00%2080.00L72.35%2076.83L65.86%2065.86L76.83%2072.35ZM40.0%20-7.5L47.5%200L40.0%207.5L32.5%200ZM40.0%2072.5L47.5%2080L40.0%2087.5L32.5%2080ZM0%2032.5L7.5%2040.0L0%2047.5L-7.5%2040.0ZM80%2032.5L87.5%2040.0L80%2047.5L72.5%2040.0Z%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.4%22%2F%3E%3C%2Fsvg%3E"), linear-gradient(to bottom, #000 0%, #000 35%, transparent 92%);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2280%22%20height%3D%2280%22%20viewBox%3D%220%200%2080%2080%22%3E%3Cpath%20d%3D%22M40.00%2020.00L43.17%2032.35L54.14%2025.86L47.65%2036.83L60.00%2040.00L47.65%2043.17L54.14%2054.14L43.17%2047.65L40.00%2060.00L36.83%2047.65L25.86%2054.14L32.35%2043.17L20.00%2040.00L32.35%2036.83L25.86%2025.86L36.83%2032.35ZM0.00%20-20.00L3.17%20-7.65L14.14%20-14.14L7.65%20-3.17L20.00%20-0.00L7.65%203.17L14.14%2014.14L3.17%207.65L0.00%2020.00L-3.17%207.65L-14.14%2014.14L-7.65%203.17L-20.00%200.00L-7.65%20-3.17L-14.14%20-14.14L-3.17%20-7.65ZM80.00%20-20.00L83.17%20-7.65L94.14%20-14.14L87.65%20-3.17L100.00%20-0.00L87.65%203.17L94.14%2014.14L83.17%207.65L80.00%2020.00L76.83%207.65L65.86%2014.14L72.35%203.17L60.00%200.00L72.35%20-3.17L65.86%20-14.14L76.83%20-7.65ZM0.00%2060.00L3.17%2072.35L14.14%2065.86L7.65%2076.83L20.00%2080.00L7.65%2083.17L14.14%2094.14L3.17%2087.65L0.00%20100.00L-3.17%2087.65L-14.14%2094.14L-7.65%2083.17L-20.00%2080.00L-7.65%2076.83L-14.14%2065.86L-3.17%2072.35ZM80.00%2060.00L83.17%2072.35L94.14%2065.86L87.65%2076.83L100.00%2080.00L87.65%2083.17L94.14%2094.14L83.17%2087.65L80.00%20100.00L76.83%2087.65L65.86%2094.14L72.35%2083.17L60.00%2080.00L72.35%2076.83L65.86%2065.86L76.83%2072.35ZM40.0%20-7.5L47.5%200L40.0%207.5L32.5%200ZM40.0%2072.5L47.5%2080L40.0%2087.5L32.5%2080ZM0%2032.5L7.5%2040.0L0%2047.5L-7.5%2040.0ZM80%2032.5L87.5%2040.0L80%2047.5L72.5%2040.0Z%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.4%22%2F%3E%3C%2Fsvg%3E"), linear-gradient(to bottom, #000 0%, #000 35%, transparent 92%);
  mask-composite: intersect;
  -webkit-mask-composite: source-in;
  mask-size: 80px 80px, 100% 100%;
  -webkit-mask-size: 80px 80px, 100% 100%;
}

/* Footer: a kilim band along the top edge, like the end of a rug. */
footer.lesson-footer::before {
  inset: 0 0 auto 0;
  height: 16px;
  mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2248%22%20height%3D%2216%22%20viewBox%3D%220%200%2048%2016%22%3E%3Cpath%20d%3D%22M0%2012L12%202L24%2012L36%202L48%2012M12%2012l3-3-3-3-3%203Z%20M36%2012l3-3-3-3-3%203Z%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.4%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2248%22%20height%3D%2216%22%20viewBox%3D%220%200%2048%2016%22%3E%3Cpath%20d%3D%22M0%2012L12%202L24%2012L36%202L48%2012M12%2012l3-3-3-3-3%203Z%20M36%2012l3-3-3-3-3%203Z%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.4%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E");
  mask-size: 48px 16px;
  -webkit-mask-size: 48px 16px;
  opacity: calc(var(--ornament-alpha) * 1.4);
}

/* Culture corner: tulips, scattered in the top-right where the
   section earns them. Bounded to a corner so the prose stays clean. */
section.block.culture::before {
  inset: 0 0 auto auto;
  width: 300px;
  height: 260px;
  border-radius: 0 var(--radius-lg) 0 0;
  mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2296%22%20height%3D%2296%22%20viewBox%3D%220%200%2096%2096%22%3E%3Cpath%20d%3D%22m24%2030c-7%200-12-6-12-14%200-5%201-9%203-13%201%204%203%206%204%206%201%200%202-2%202-6%200-4%201-7%203-9c2%202%203%205%203%209%200%204%201%206%202%206%201%200%203-2%204-6%202%204%203%208%203%2013%200%208-5%2014-12%2014Zm0%200v12m0-4c-4%200-8-3-10-8%205%200%209%202%2010%208Zm0-2c4%200%208-3%2010-8-5%200-9%202-10%208Zm72%2078c-7%200-12-6-12-14%200-5%201-9%203-13%201%204%203%206%204%206%201%200%202-2%202-6%200-4%201-7%203-9c2%202%203%205%203%209%200%204%201%206%202%206%201%200%203-2%204-6%202%204%203%208%203%2013%200%208-5%2014-12%2014Zm0%200v12m0-4c-4%200-8-3-10-8%205%200%209%202%2010%208Zm0-2c4%200%208-3%2010-8-5%200-9%202-10%208Z%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E"), radial-gradient(ellipse at top right, #000 0%, #000 30%, transparent 85%);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2296%22%20height%3D%2296%22%20viewBox%3D%220%200%2096%2096%22%3E%3Cpath%20d%3D%22m24%2030c-7%200-12-6-12-14%200-5%201-9%203-13%201%204%203%206%204%206%201%200%202-2%202-6%200-4%201-7%203-9c2%202%203%205%203%209%200%204%201%206%202%206%201%200%203-2%204-6%202%204%203%208%203%2013%200%208-5%2014-12%2014Zm0%200v12m0-4c-4%200-8-3-10-8%205%200%209%202%2010%208Zm0-2c4%200%208-3%2010-8-5%200-9%202-10%208Zm72%2078c-7%200-12-6-12-14%200-5%201-9%203-13%201%204%203%206%204%206%201%200%202-2%202-6%200-4%201-7%203-9c2%202%203%205%203%209%200%204%201%206%202%206%201%200%203-2%204-6%202%204%203%208%203%2013%200%208-5%2014-12%2014Zm0%200v12m0-4c-4%200-8-3-10-8%205%200%209%202%2010%208Zm0-2c4%200%208-3%2010-8-5%200-9%202-10%208Z%22%20fill%3D%22none%22%20stroke%3D%22%23000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E"), radial-gradient(ellipse at top right, #000 0%, #000 30%, transparent 85%);
  mask-composite: intersect;
  -webkit-mask-composite: source-in;
  mask-size: 96px 96px, 100% 100%;
  -webkit-mask-size: 96px 96px, 100% 100%;
  opacity: calc(var(--ornament-alpha) * 1.4);
}

/* Ornament is decoration. Anyone who has asked for more contrast, or
   whose browser cannot composite the masks reliably, loses nothing by
   not having it. */
@media (prefers-contrast: more) {
  header.lesson-header::before,
  .course-hero::before,
  footer.lesson-footer::before,
  section.block.culture::before { display: none; }
}
@supports not (mask-composite: intersect) {
  header.lesson-header::before,
  .course-hero::before,
  section.block.culture::before { display: none; }
}

@media (max-width: 480px) {
  section.block.culture::before { width: 176px; height: 156px; }
}


/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 700px) {
  header.lesson-header { padding: 32px 20px 24px; }
  main { padding: 26px 20px 20px; }
  section.block { padding: 22px 22px; }
  .culture-figure { width: 112px; margin-left: 16px; }
}

@media (max-width: 480px) {
  body { line-height: 1.65; }
  header.lesson-header { padding: 26px 16px 20px; }
  header.lesson-header::after { margin-top: 22px; }
  main, footer.lesson-footer { padding-left: 16px; padding-right: 16px; }
  section.block, .lesson-card { padding: 20px 18px; border-radius: var(--radius-md); }
  section.block h2 { font-size: 1.1rem; }
  .phrase-controls { margin-left: 0; width: 100%; }
  .hero-top { flex-direction: column; align-items: flex-start; }
  .lesson-grid { grid-template-columns: 1fr; }
  .progress-block { max-width: none; }
  .intro-lead { font-size: 1.02rem; }
  .reason-grid { gap: 22px; margin-top: 24px; }
  .proverb { padding: 16px 18px; }
  .start-cta { width: 100%; justify-content: center; }
  .section-heading { font-size: 1.15rem; margin-top: 30px; }
  footer.lesson-footer { justify-content: flex-start; }

  /* Lesson media + exercises. The grids below all use auto-fit with a
     minmax floor, so the only thing that actually needs pinning at
     360px is the floor itself — left alone, a 128px card plus gutters
     overflows a 360px viewport by a few pixels. */
  .vocab-grid { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; }
  .vocab-card { padding: 13px 8px 10px; }
  .vocab-card svg { width: 44px; height: 44px; }
  .alphabet-grid { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
  .letter-btn { font-size: 0.98rem; padding: 10px 2px 8px; }
  .harmony { grid-template-columns: 1fr; }
  .match-pics { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 9px; }
  .match-pic svg { width: 38px; height: 38px; }
  .quiz-option { padding: 9px 15px; font-size: 0.92rem; }
  figure.scene { padding: 14px; }

  /* A floated 112px figure leaves too narrow a column for prose here. */
  .culture-figure { float: none; width: 128px; margin: 0 auto 14px; }
  .reading { padding: 18px 16px; }
  .reading-line { padding-left: 6px; margin-left: -6px; }
  .reading-line.said { padding-left: 14px; }
  .word-grid { grid-template-columns: 1fr; gap: 0 14px; }
}
