/* Source: _sources/ku1aecmal102/chapter.css */
/* ===================================================================================
   Learn · style.css
   Design system merged in original cascade order:
     1 tokens  2 base  3 components  4 decorations  5 site shell
   (was: /assets/css/tokens.css base.css components.css decorations.css site.css)
   =================================================================================== */
/* ======== tokens.css ======== */
/* ==========================================================================
   LEARN · DESIGN TOKENS  (layer 1 of 5)
   Course : KU1AECMAL102 — ഭാഷാ-സാഹിത്യപരിചയം
   Campus : Kannur University · AEC Malayalam · Semester 1
   --------------------------------------------------------------------------
   Cascade order:  tokens → base → components → decorations → design-system
   Rule of the system: values live HERE and nowhere else.
   Components may only reference the custom properties declared below.
   ========================================================================== */

:root {
  /* ── 1 · PALETTE — environment green (the "world" outside the page) ────── */
  --green-950: #0B211F;
  --green-900: #102C29;
  --green-800: #143531;
  --green-700: #173F3A;   /* primary environment colour */
  --green-600: #1D4C45;
  --green-500: #24584F;
  --green-400: #2F6A60;
  --green-300: #3E7D72;

  /* ── 2 · PALETTE — terracotta (secondary accent) ──────────────────────── */
  --terra-800: #7A3729;
  --terra-700: #8A4234;
  --terra-600: #A34E3E;
  --terra-500: #B85C4A;   /* primary accent */
  --terra-300: #D79380;
  --terra-100: #F7E5E0;

  /* ── 3 · PALETTE — warm gold (small accent, never large areas) ─────────── */
  --gold-700: #8F6B2E;
  --gold-600: #A8813C;
  --gold-500: #C9A45C;    /* primary gold */
  --gold-300: #E0C68E;
  --gold-100: #F8EFDC;

  /* ── 4 · PALETTE — soft natural green (occasional accent) ─────────────── */
  --leaf-700: #4C6B51;
  --leaf-600: #5E7D62;
  --leaf-500: #718C73;    /* primary soft green */
  --leaf-400: #8AA68B;
  --leaf-100: #E9F1E8;

  /* ── 5 · PALETTE — reading surface & ink ─────────────────────────────── */
  --paper-000: #FFFFFF;
  --paper-050: #FFFBF5;   /* primary reading surface */
  --paper-100: #FCF6EC;
  --paper-200: #F4EBDD;
  --paper-300: #E9DCC8;

  --ink-900: #16181A;
  --ink-800: #202124;     /* primary body text */
  --ink-700: #2C3533;
  --ink-600: #444E4B;
  --ink-500: #66706B;     /* secondary text  (4.9:1 on surface) */
  --ink-400: #8A938E;     /* non-text only: glyphs, ornament strokes */

  /* ── 6 · LINES & TINTS (only ever placed on the reading surface) ──────── */
  --line-1: #EDE3D3;
  --line-2: #E0D4C0;
  --line-ink: rgba(23, 63, 58, 0.10);
  --tint-important: #FDF7EA;   /* warm gold panel */
  --tint-example: #EFF5EF;     /* soft green panel */
  --tint-note: #FBEFEB;        /* terracotta panel */

  /* ── 7 · SEMANTIC ALIASES — components use THESE, not the palette ─────── */
  --bg-env: var(--green-700);
  --bg-surface: var(--paper-050);
  --bg-surface-alt: var(--paper-100);

  --text-body: var(--ink-800);
  --text-strong: var(--ink-900);
  --text-muted: var(--ink-500);
  --text-quiet: var(--ink-600);
  --text-invert: #F4F7F5;
  --text-invert-muted: rgba(244, 247, 245, 0.74);
  --text-on-dark-accent: var(--gold-300);

  --accent: var(--terra-500);
  --accent-ink: var(--terra-700);
  --accent-gold: var(--gold-500);
  --accent-gold-ink: var(--gold-700);
  --accent-leaf: var(--leaf-500);
  --accent-leaf-ink: var(--leaf-700);
  --accent-green: var(--green-700);
  /* Green is the environment colour, so anything that puts it on the reading
     surface goes through these two instead of naming the palette directly —
     that is what lets the dark theme keep the environment dark. */
  --accent-green-ink: var(--green-800);   /* green text on the paper   */
  --bg-green-solid: var(--green-700);     /* solid green panel on paper */

  --link: var(--terra-700);          /* 7.0:1 on surface */
  --link-hover: #6F3227;
  --link-invert: var(--gold-300);

  --border-soft: var(--line-1);
  --border-strong: var(--line-2);
  --border-hair: var(--line-ink);
  --border-invert: rgba(244, 247, 245, 0.16);

  --focus-inner: var(--green-950);
  --focus-outer: rgba(201, 164, 92, 0.60);

  /* ── 8 · TYPOGRAPHY — families ────────────────────────────────────────── */
  /* Body: Noto Sans Malayalam. Display: Noto Serif Malayalam (literary).
     UI: Inter (Latin interface only). Local Malayalam faces as fallback. */
  --font-ml: "Noto Sans Malayalam", "Manjari", "Rachana", "AnjaliOldLipi",
             system-ui, "Segoe UI", sans-serif;
  --font-ml-display: "Noto Serif Malayalam", "Noto Sans Malayalam", "Manjari",
                     Georgia, serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* ── 9 · TYPOGRAPHY — scale (16px root) ──────────────────────────────── */
  --fs-label: 0.75rem;                                    /* 12px caps label */
  --fs-small: 0.875rem;                                   /* 14px meta       */
  --fs-ui: 0.9375rem;                                     /* 15px UI text    */
  --fs-body-sm: 1.0625rem;                                /* 17px mobile body*/
  --fs-body: 1.125rem;                                    /* 18px body       */
  --fs-lead: 1.3125rem;                                   /* 21px intro      */
  --fs-h3: 1.25rem;                                       /* 20px            */
  --fs-h2: clamp(1.4375rem, 1.2rem + 0.85vw, 1.75rem);    /* 23 → 28px       */
  --fs-h1: clamp(1.75rem, 1.25rem + 1.9vw, 2.5rem);       /* 28 → 40px       */
  --fs-display: clamp(2rem, 1.4rem + 2.6vw, 3rem);        /* hub hero        */
  --fs-quote: clamp(1.1875rem, 1rem + 0.75vw, 1.5rem);    /* pull quote      */
  --fs-panel-title: 1.0625rem;
  --fs-marks: 0.9375rem;                                  /* "ഘടകം 01" badge  */

  --lh-body: 1.9;                /* Malayalam needs generous leading */
  --lh-lead: 1.82;
  --lh-heading: 1.5;             /* stacked vowel signs need air     */
  --lh-title: 1.42;
  --lh-tight: 1.3;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* ── 10 · SPACING — 4px base, 12 steps ──────────────────────────────── */
  --sp-1: 0.25rem;   /*  4 */
  --sp-2: 0.5rem;    /*  8 */
  --sp-3: 0.75rem;   /* 12 */
  --sp-4: 1rem;      /* 16 */
  --sp-5: 1.25rem;   /* 20 */
  --sp-6: 1.5rem;    /* 24 */
  --sp-7: 2rem;      /* 32 */
  --sp-8: 2.5rem;    /* 40 */
  --sp-9: 3rem;      /* 48 */
  --sp-10: 4rem;     /* 64 */
  --sp-11: 5rem;     /* 80 */
  --sp-12: 6.5rem;   /* 104 */

  /* ── 11 · RADIUS — modern, never bubble-like ─────────────────────────── */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* ── 12 · ELEVATION ─────────────────────────────────────────────────── */
  --shadow-surface:
    0 1px 2px rgba(9, 26, 24, 0.30),
    0 28px 60px -26px rgba(6, 20, 18, 0.70);
  --shadow-surface-mobile:
    0 1px 2px rgba(9, 26, 24, 0.28),
    0 14px 32px -18px rgba(6, 20, 18, 0.60);
  --shadow-header: 0 1px 0 rgba(255, 255, 255, 0.06),
                   0 12px 28px -20px rgba(4, 16, 15, 0.85);

  /* ── 13 · CONTENT WIDTHS (the readability contract) ─────────────────── */
  --w-surface: 1024px;       /* reading surface, desktop */
  --w-prose: 760px;          /* Malayalam text measure   */
  --w-prose-wide: 880px;     /* tables / timelines       */
  --w-ui: 1180px;            /* header + footer inner    */

  /* ── 14 · LAYOUT ─────────────────────────────────────────────────────── */
  --header-h: 62px;
  --gutter: var(--sp-7);
  --pad-surface: clamp(1.5rem, 1rem + 3.2vw, 4.25rem);
  --pad-main-top: var(--sp-9);
  --scroll-pad: calc(var(--header-h) + var(--sp-6));

  /* ── 15 · DECORATIVE OPACITY LEVELS (decoration must stay quiet) ────── */
  --op-deco-xl: 0.055;      /* huge clipped glyphs          */
  --op-deco-lg: 0.085;      /* large characters             */
  --op-deco-md: 0.13;       /* small words                  */
  --op-deco-sm: 0.20;       /* abstract marks / dots        */
  --op-ornament: 0.28;      /* in-surface ornaments         */
  --op-ghost: 0.055;        /* ghost numerals on the surface*/

  /* ── 16 · MOTION ────────────────────────────────────────────────────── */
  --dur-fast: 140ms;
  --dur: 240ms;
  --dur-slow: 900ms;
  --ease: cubic-bezier(0.32, 0.72, 0.28, 1);

  /* ── 17 · Z-INDEX ───────────────────────────────────────────────────── */
  --z-env: 0;
  --z-content: 1;
  --z-header: 50;
  --z-modal: 80;
}

/* ── TRUE DARK MODE ─────────────────────────────────────────────────────────
   The environment (deep green page, header, footer) is dark in both themes;
   this block flips only the reading surface and its ink, so late-night reading
   is easy on the eyes without losing the site's identity. Chosen by the header
   toggle, which writes data-theme="dark" onto <html> and remembers the choice.
   ────────────────────────────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  color-scheme: dark;

  /* paper → ink: the ramp now runs dark → light (paper-000 is the top step) */
  --paper-000: #20282B;   /* raised: cards, hover, active rows      */
  --paper-050: #12171A;   /* the reading surface itself              */
  --paper-100: #171D1E;   /* quiet panels: contents, tinted blocks   */
  --paper-200: #2A3335;
  --paper-300: #374244;

  /* ink → paper */
  --ink-900: #F2F5F3;
  --ink-800: #E4E9E6;     /* primary body text                      */
  --ink-700: #D2D9D5;
  --ink-600: #B0BAB5;
  --ink-500: #94A09A;     /* secondary text (7:1 on the surface)    */
  --ink-400: #6C7772;     /* ornament strokes, non-text             */

  /* lines & tints */
  --line-1: #262E2C;
  --line-2: #333C39;
  --line-ink: rgba(233, 240, 236, 0.12);
  --tint-important: #2A2415;   /* warm gold panel  */
  --tint-example: #1A2620;     /* soft green panel */
  --tint-note: #2B1F1C;        /* terracotta panel */
  --gold-100: #2A2417;         /* the soft gold chip background */

  /* accent inks, lightened so they stay legible on the dark surface */
  --terra-700: #E9A497;
  --gold-700: #E3C98F;
  --leaf-700: #A6C3A9;
  --accent-green-ink: #9CCBB2;
  --bg-green-solid: #24584F;

  /* focus ring must read on a dark surface too */
  --focus-inner: #E3C98F;
  --focus-outer: rgba(227, 201, 143, 0.55);

  --shadow-surface:
    0 1px 2px rgba(0, 0, 0, 0.55),
    0 28px 60px -26px rgba(0, 0, 0, 0.85);
  --shadow-surface-mobile:
    0 1px 2px rgba(0, 0, 0, 0.50),
    0 14px 32px -18px rgba(0, 0, 0, 0.75);

  --op-ghost: 0.07;            /* the ghost numeral needs a little more ink */
}

/* ── tabular figures for question numbers, table cells, progress ───────── */
.is-num,
.prose .questions > ol > li,
.table td,
.revision__item,
.progress__bar { font-variant-numeric: tabular-nums; }



/* ======== base.css ======== */
/* ==========================================================================
   LEARN · BASE  (layer 2 of 5)
   Reset, page shell, the reading surface, and Malayalam prose defaults.
   Nothing decorative here — see decorations.css.
   ========================================================================== */

/* ── minimal, opinionated reset ─────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--scroll-pad);
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg-env);
  color: var(--text-body);
  font-family: var(--font-ml);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p, figure, blockquote, dl, dd, ol, ul { margin: 0; }
ul, ol { padding: 0; }

::selection {
  background: var(--gold-100);
  color: var(--ink-900);
}

/* Dual-tone focus ring: readable on ivory AND on the dark green header. */
:focus-visible {
  outline: 2px solid var(--focus-inner);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--focus-outer);
  border-radius: var(--radius-xs);
}
.site-footer :focus-visible,
.site-header :focus-visible,
.revision :focus-visible,
.env :focus-visible { outline-color: var(--gold-300); }

/* ── links inside the reading surface ───────────────────────────────────── */
.prose a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 0.075em;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
  border-radius: 2px;
  transition: color var(--dur-fast) var(--ease);
}
.prose a:hover { color: var(--link-hover); text-decoration-color: currentColor; }

/* ── page shell: environment (z0) → surface (z1) ────────────────────────── */
.page {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  isolation: isolate;          /* keeps decorative layers away from page paint */
}

.page__main {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  width: 100%;
  max-width: calc(var(--w-surface) + (2 * var(--gutter)));
  margin-inline: auto;
  padding: var(--pad-main-top) var(--gutter) var(--sp-11);
}

/* ── THE READING SURFACE — calm, light, maximally readable ─────────────── */
.surface {
  position: relative;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hair);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-surface);
  overflow: clip;               /* contains the accent spine + ghost numerals */
}

/* 4px identity spine — the only colour band allowed on the surface edge */
.surface::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--green-700) 0%,
    var(--leaf-500) 34%,
    var(--gold-500) 64%,
    var(--terra-500) 100%
  );
}

.surface__inner {
  padding: var(--pad-surface);
}

/* ── text column: never wider than comfortable Malayalam measure ───────── */
.prose { max-width: 100%; }

.prose > * {
  max-width: var(--w-prose);
  margin-inline: auto;
}

/* elements that may legitimately use a little more of the surface */
.prose > .is-wide { max-width: var(--w-prose-wide); }

.prose p { margin-bottom: var(--sp-4); }

.prose p:last-child { margin-bottom: 0; }

/* first paragraph after the hero reads as an intro */
.prose p.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  color: var(--text-quiet);
  margin-bottom: var(--sp-6);
}

.prose strong, .prose b { font-weight: var(--fw-semibold); color: var(--text-strong); }
.prose em, .prose i { font-style: italic; }

/* Malayalam is never letter-spaced and never justified. */
[lang="ml"], .is-ml { letter-spacing: normal; text-align: left; hyphens: none; }

/* Latin UI runs */
.is-ui, [lang="en"] { font-family: var(--font-ui); letter-spacing: 0.01em; }

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

/* ── heading defaults inside the surface ───────────────────────────────── */
.prose h1 { font-family: var(--font-ml-display); font-size: var(--fs-h1);
  line-height: var(--lh-title); font-weight: var(--fw-semibold);
  color: var(--text-strong); }

.prose h2 { font-family: var(--font-ml-display); font-size: var(--fs-h2);
  line-height: var(--lh-heading); font-weight: var(--fw-semibold);
  color: var(--text-strong); }

.prose h3 { font-family: var(--font-ml); font-size: var(--fs-h3);
  line-height: var(--lh-heading); font-weight: var(--fw-semibold);
  color: var(--ink-700); }

.prose h4 { font-family: var(--font-ui); font-size: var(--fs-label);
  font-weight: var(--fw-semibold); letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--accent-gold-ink); }

/* ── headings that arrive inside the JSON content read as subsections ──── */
.prose .section > h2 {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-3);
  font-family: var(--font-ml);
  font-size: var(--fs-lead);
  line-height: var(--lh-heading);
  font-weight: var(--fw-semibold);
  color: var(--ink-700);
}

.prose .section > h2::before {
  content: "";
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-leaf);
  flex: 0 0 auto;
}

.prose .section > h2:first-of-type { margin-top: var(--sp-4); }

.prose .section > h3 {
  margin-top: var(--sp-5);
  margin-bottom: var(--sp-3);
  font-family: var(--font-ml);
  font-size: var(--fs-body);
  line-height: var(--lh-heading);
  font-weight: var(--fw-semibold);
  color: var(--ink-700);
}

/* ── default list styling in prose (restrained) ─────────────────────────── */
.prose ul, .prose ol { display: grid; gap: var(--sp-3); }

.prose li { padding-left: var(--sp-1); }

/* ── tables: hairline, no zebra, academic ──────────────────────────────── */
.prose table { width: 100%; border-collapse: collapse; font-size: var(--fs-body-sm); }

.prose caption { caption-side: top; text-align: left; font-family: var(--font-ui);
  font-size: var(--fs-label); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-gold-ink); padding-bottom: var(--sp-3); }

.prose th, .prose td { text-align: left; padding: var(--sp-3) var(--sp-4); }

.prose thead th { font-family: var(--font-ui); font-size: var(--fs-small);
  font-weight: var(--fw-semibold); color: var(--accent-green-ink);
  background: var(--tint-example); border-bottom: 1px solid var(--border-strong); }

.prose tbody th { font-weight: var(--fw-semibold); color: var(--ink-700); }

.prose tbody tr + tr th, .prose tbody tr + tr td { border-top: 1px solid var(--border-soft); }

.prose tbody td { color: var(--text-body); }

/* ── blockquote reset (styling lives in components.css) ────────────────── */
.prose blockquote { font-style: normal; }

/* ── utilities ─────────────────────────────────────────────────────────── */
.visually-hidden:not(:focus):not(:active) {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute; left: var(--sp-4); top: -200px; z-index: var(--z-modal);
  padding: var(--sp-3) var(--sp-5);
  background: var(--paper-050); color: var(--accent-green-ink);
  font-family: var(--font-ui); font-size: var(--fs-ui); font-weight: var(--fw-semibold);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-surface-mobile);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--sp-4); }

.is-hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.no-wrap { white-space: nowrap; }

/* ── responsive shell ──────────────────────────────────────────────────── */
@media (max-width: 1120px) {
  :root { --pad-main-top: var(--sp-7); --gutter: var(--sp-5); }
}

@media (max-width: 820px) {
  :root {
    --fs-body: var(--fs-body-sm);
    --fs-lead: 1.1875rem;
    --lh-body: 1.82;
    --gutter: var(--sp-3);
    --pad-surface: clamp(1.25rem, 0.6rem + 3vw, 2.25rem);
    --pad-main-top: var(--sp-5);
  }
  .surface { border-radius: var(--radius-md); }
  .surface::before { height: 3px; }
}

/* ── print: the reading surface only, no environment ──────────────────── */
@media print {
  :root { --fs-body: 11.5pt; --lh-body: 1.65; --pad-surface: 0; }
  html, body { background: #fff !important; }
  .env, .site-header, .progress, .pager, .site-footer, .skip-link,
  .toc, .section__anchor, .hero-actions, .listen { display: none !important; }
  .page__main { max-width: none; padding: 0; }
  .surface { border: 0; border-radius: 0; box-shadow: none; }
  .surface::before { height: 2pt; }
  .prose > * { max-width: none; }
  .panel, .revision, .quote, .table-wrap { break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}


/* ======== components.css ======== */
/* ==========================================================================
   LEARN · COMPONENTS  (layer 3 of 5)
   1 Header · 2 Breadcrumb · 3 Badges · 4 Chapter hero · 5 Sections
   6 Panels · 7 Key terms · 8 Quotes · 9 Lists · 10 Tables · 11 Questions
   12 Quick revision · 13 Pager · 14 Footer · 15 Course hub · 16 Helpers
   ========================================================================== */

/* ── 1 · SITE HEADER — present but never dominant ──────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--green-900);                                   /* fallback */
  background: color-mix(in srgb, var(--green-900) 90%, transparent);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border-invert);
  color: var(--text-invert);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  max-width: var(--w-ui);
  min-height: var(--header-h);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header.is-scrolled { box-shadow: var(--shadow-header); }

/* brand ------------------------------------------------------------------ */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  color: inherit;
  text-decoration: none;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--gold-500) 55%, transparent);
  background: rgba(244, 247, 245, 0.05);
  color: var(--gold-300);
  font-family: var(--font-ml-display);
  font-size: 1.25rem;
  line-height: 1;
  padding-top: 0.15em;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.brand:hover .brand__mark {
  background: rgba(244, 247, 245, 0.1);
  border-color: var(--gold-300);
}

.brand__text { display: grid; line-height: 1.15; }

.brand__name {
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.01em;
}

.brand__sub {
  font-family: var(--font-ml);
  font-size: 0.75rem;
  color: var(--text-invert-muted);
}

/* ── 2 · BREADCRUMB ────────────────────────────────────────────────────── */
.crumbs { min-width: 0; }

.crumbs__list {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  color: var(--text-invert-muted);
  overflow: hidden;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 100%);
}

.crumbs__item { display: inline-flex; align-items: center; gap: var(--sp-2); }

.crumbs__item + .crumbs__item::before {
  content: "›";
  color: rgba(244, 247, 245, 0.4);
  font-size: 1.05em;
}

.crumbs__link {
  color: var(--text-invert-muted);
  text-decoration: none;
  padding: 0.25rem 0;
  border-radius: 4px;
  border-bottom: 1px solid transparent;
}

.crumbs__link:hover { color: var(--gold-300); border-bottom-color: var(--gold-300); }

.crumbs__current { color: var(--text-invert); font-weight: var(--fw-medium); }

.crumbs__code { font-size: 0.8125rem; letter-spacing: 0.02em; }

/* ── 1b · HEADER ACTIONS, SEARCH, BUTTONS, PROGRESS ───────────────────── */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-left: auto;
  flex: 0 0 auto;
}

.search { position: relative; }

.search__input {
  width: 205px;
  height: 38px;
  padding: 0 2.35rem 0 var(--sp-4);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-invert);
  background: rgba(244, 247, 245, 0.06);
  color: var(--text-invert);
  font-family: var(--font-ml);
  font-size: var(--fs-ui);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
              width var(--dur) var(--ease);
}

.search__input::placeholder { color: rgba(244, 247, 245, 0.55); }

.search__input:focus {
  width: 248px;
  border-color: color-mix(in srgb, var(--gold-300) 70%, transparent);
  background: rgba(244, 247, 245, 0.1);
}

.search__btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-invert-muted);
  cursor: pointer;
}
.search__btn:hover { color: var(--gold-300); background: rgba(244, 247, 245, 0.08); }
.search__btn svg { width: 16px; height: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  font-weight: var(--fw-medium);
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn--ghost { color: var(--text-invert-muted); border-color: var(--border-invert); }
.btn--ghost:hover {
  color: var(--text-invert);
  background: rgba(244, 247, 245, 0.09);
  border-color: rgba(244, 247, 245, 0.3);
}
.btn--gold { background: var(--gold-500); color: var(--green-950); }
.btn--gold:hover { background: var(--gold-300); }
.btn--outline {
  color: var(--accent-green-ink);
  border-color: var(--border-strong);
  background: var(--paper-000);
}
.btn--outline:hover { background: var(--paper-100); border-color: var(--gold-500); }
.btn:active { transform: translateY(1px); }

/* reading-theme toggle — sun in light mode, moon in dark, always reachable */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-invert);
  background: transparent;
  color: var(--text-invert-muted);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}

.theme-toggle:hover {
  color: var(--gold-300);
  background: rgba(244, 247, 245, 0.09);
  border-color: rgba(244, 247, 245, 0.3);
}

.theme-toggle__icon { width: 19px; height: 19px; grid-area: 1 / 1; }
.theme-toggle__icon--moon { display: none; }

/* in dark mode the button offers the way back to light */
:root[data-theme="dark"] .theme-toggle__icon--sun { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--moon { display: block; }
.btn__kbd {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  border: 1px solid currentColor;
  opacity: 0.6;
}

/* chapter switcher — a native <details>, so it also works without JS ------ */
.chapter-switch { position: relative; }

.chapter-switch__summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.chapter-switch__summary::-webkit-details-marker { display: none; }
.chapter-switch__summary::marker { content: ""; }

.chapter-switch__caret {
  width: 14px;
  height: 14px;
  transition: transform var(--dur) var(--ease);
}

.chapter-switch[open] > .chapter-switch__summary {
  color: var(--text-invert);
  background: rgba(244, 247, 245, 0.09);
  border-color: rgba(244, 247, 245, 0.3);
}

.chapter-switch[open] .chapter-switch__caret { transform: rotate(180deg); }

.chapter-switch__menu {
  position: absolute;
  top: calc(100% + var(--sp-2));
  right: 0;
  z-index: var(--z-modal);
  width: min(23rem, calc(100vw - (2 * var(--sp-4))));
  max-height: min(26rem, 70vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sp-2);
  border: 1px solid var(--border-invert);
  border-radius: var(--radius-md);
  background: var(--green-900);
  box-shadow: 0 22px 40px -24px rgba(4, 16, 15, 0.9);
}

.chapter-switch__list { list-style: none; display: grid; gap: 2px; }

.chapter-switch__link {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  align-items: baseline;
  gap: var(--sp-1) var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-invert);
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease);
}

.chapter-switch__link:hover { background: rgba(244, 247, 245, 0.08); }
.chapter-switch__link[aria-current="true"] { background: rgba(244, 247, 245, 0.12); }

.chapter-switch__num {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  color: var(--gold-300);
}

.chapter-switch__name {
  font-family: var(--font-ml);
  font-size: var(--fs-ui);
  line-height: 1.5;
}

.chapter-switch__link[aria-current="true"] .chapter-switch__name { color: var(--gold-300); }

/* mobile nav toggle ------------------------------------------------------ */
.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-invert);
  background: transparent;
  color: var(--text-invert);
  cursor: pointer;
  place-items: center;
}
.nav-toggle:hover { background: rgba(244, 247, 245, 0.08); }
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle[aria-expanded="true"] { background: rgba(244, 247, 245, 0.1); }

.mobile-nav {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  z-index: var(--z-header);
  background: var(--green-900);
  border-bottom: 1px solid var(--border-invert);
  padding: var(--sp-4) var(--gutter) var(--sp-5);
  box-shadow: 0 22px 40px -24px rgba(4, 16, 15, 0.9);
}

.mobile-nav__list { list-style: none; display: grid; gap: var(--sp-1); }

.mobile-nav__link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-invert);
  font-family: var(--font-ml);
  font-size: 1rem;
  text-decoration: none;
}
.mobile-nav__link:hover,
.mobile-nav__link[aria-current="page"] { background: rgba(244, 247, 245, 0.08); }

.mobile-nav__meta {
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-invert-muted);
}

.mobile-nav__num {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  color: var(--gold-300);
  flex: 0 0 auto;
  min-width: 1.5rem;
}

.mobile-nav__name { min-width: 0; }

/* reading progress ------------------------------------------------------- */
.progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 3px;
  background: rgba(244, 247, 245, 0.1);
}
.progress__bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--leaf-500), var(--gold-500) 55%, var(--terra-500));
  transition: width 120ms linear;
}

/* ── responsive header ─────────────────────────────────────────────────── */
@media (max-width: 1120px) { .crumbs { display: none; } }

@media (max-width: 900px) {
  .search__input { width: 140px; }
  .search__input:focus { width: 172px; }
}

@media (max-width: 720px) {
  :root { --header-h: 56px; }
  .brand__sub { display: none; }
  .search { display: none; }
  .nav-toggle { display: grid; }
  .mobile-nav { display: block; }
  .site-header__actions .btn--ghost { display: none; }
}

/* ── 3 · BADGES — small, quiet identity markers ────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.34em 0.75em;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: var(--fs-marks);
  font-weight: var(--fw-medium);
  line-height: 1.55;
  white-space: nowrap;
}

.badge--course {
  background: var(--tint-example);
  border-color: color-mix(in srgb, var(--leaf-500) 34%, transparent);
  color: var(--accent-leaf-ink);
}

.badge--chapter {
  background: var(--bg-green-solid);
  color: var(--text-invert);
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.badge--soft {
  background: var(--gold-100);
  border-color: color-mix(in srgb, var(--gold-500) 42%, transparent);
  color: var(--accent-gold-ink);
}

.badge--outline { border-color: var(--border-strong); color: var(--text-quiet); }

.badge__dot {
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.badge[lang="en"] { font-family: var(--font-ui); letter-spacing: 0.06em; }

/* ── 4 · CHAPTER HERO ──────────────────────────────────────────────────── */
.chapter-hero {
  position: relative;
  padding-bottom: var(--sp-6);
  margin-bottom: var(--sp-8);
  border-bottom: 1px solid var(--border-soft);
}

/* course context: a compact strip, never a second masthead ---------------- */
.course-masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-4);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border-soft);
}

.course-masthead__title {
  font-family: var(--font-ml-display);
  font-size: 1.0625rem;
  line-height: 1.5;
  font-weight: var(--fw-semibold);
  color: var(--accent-green-ink);
}

.course-masthead__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-1) var(--sp-3);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  color: var(--text-muted);
}

.course-masthead__item { display: inline-flex; align-items: baseline; }

/* hairline dot between context items */
.course-masthead__item + .course-masthead__item::before {
  content: "";
  width: 3px;
  height: 3px;
  margin-right: var(--sp-3);
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  transform: translateY(-0.2em);
}

.course-masthead__item--code {
  font-weight: var(--fw-semibold);
  letter-spacing: 0.1em;
  color: var(--accent-gold-ink);
}

/* chapter indicator ------------------------------------------------------ */
.chapter-hero__eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.chapter-hero__title {
  font-family: var(--font-ml-display);
  font-size: var(--fs-h1);
  line-height: var(--lh-title);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  text-wrap: balance;
}

/* the one English line under the title — what these notes are, for which course.
   It is the only paragraph in the hero now, so it carries the intro. */
.chapter-hero__intro {
  max-width: var(--w-prose);
  margin-top: var(--sp-5);
  font-family: var(--font-ui);
  font-size: var(--fs-body-sm);
  line-height: 1.75;
  color: var(--text-quiet);
}

.chapter-hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  margin-top: var(--sp-6);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.chapter-hero__fact { display: inline-flex; align-items: center; gap: var(--sp-2); }
.chapter-hero__fact b { color: var(--ink-700); font-weight: var(--fw-semibold); }
.chapter-hero__fact svg { width: 15px; height: 15px; color: var(--accent-gold); flex: 0 0 auto; }

/* oversized chapter numeral, printed on the paper, never behind text ----- */
.chapter-hero__ghost {
  position: absolute;
  top: -0.35em;
  right: -0.1em;
  font-family: var(--font-ui);
  font-size: clamp(6rem, 5rem + 6vw, 11rem);
  font-weight: var(--fw-bold);
  line-height: 1;
  color: var(--accent-gold);
  opacity: var(--op-ghost);
  pointer-events: none;
  user-select: none;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

.hero-actions:empty { display: none; }

/* ── 4b · ON-THIS-PAGE (contents) ──────────────────────────────────────── */
.toc {
  margin-top: var(--sp-7);
  padding: var(--sp-5) var(--sp-6);
  background: var(--paper-100);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}

/* the label is Malayalam, so no letter-spacing and no uppercase */
.toc__title {
  margin-bottom: var(--sp-4);
  font-family: var(--font-ml);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent-gold-ink);
}

/* the contents list sits inside .prose, which has opinions about every ol/li */
.prose .toc__list { list-style: none; display: grid; gap: 2px; padding: 0; }
.prose .toc__item { max-width: none; padding-left: 0; }

.toc__link {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-left: 2px solid transparent;
  border-radius: var(--radius-xs);
  color: var(--ink-700);
  font-size: var(--fs-body-sm);
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.toc__link:hover { background: var(--paper-000); color: var(--accent-green-ink); }

.toc__link[aria-current="true"] {
  background: var(--paper-000);
  border-left-color: var(--gold-500);
  color: var(--accent-green-ink);
  font-weight: var(--fw-medium);
}

.toc__num {
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  color: var(--accent-gold-ink);
  min-width: 1.35em;
}

.toc__text { min-width: 0; }

/* headings that arrive inside the JSON content, nested under the summary */
.prose .toc__item--sub .toc__link {
  padding-left: var(--sp-6);
  font-size: var(--fs-small);
  color: var(--text-quiet);
}

.prose .toc__item--sub .toc__link::before {
  content: "";
  flex: 0 0 auto;
  width: 1.35em;                     /* the number column, so both row kinds align */
  height: 2px;
  border-radius: 2px;
  background: var(--accent-leaf);
  opacity: 0.8;
}

/* ── 4c · NARRATION PLAYER (TTS) ──────────────────────────────────────────── */
.listen {
  margin-top: var(--sp-6);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--paper-100);
}

.listen__label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  color: var(--text-quiet);
}

.listen__label svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--accent-gold); }

.listen__length {
  font-family: var(--font-ui);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.listen__audio { width: 100%; height: 40px; }

.listen__rates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.listen__rates-label {
  margin-right: var(--sp-1);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.listen__rate {
  min-width: 3.15rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  background: var(--paper-000);
  color: var(--text-quiet);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}

.listen__rate:hover { border-color: var(--gold-500); color: var(--accent-gold-ink); }

.listen__rate.is-active {
  background: var(--bg-green-solid);
  border-color: var(--bg-green-solid);
  color: var(--text-invert);
  font-weight: var(--fw-semibold);
}

@media (max-width: 620px) {
  .listen { padding: var(--sp-4); }
  .listen__rate { min-width: 2.9rem; padding-inline: 0.4rem; }
}

@media (max-width: 820px) {
  .chapter-hero__ghost { font-size: 5.5rem; top: -0.2em; }
  .toc { padding: var(--sp-4) var(--sp-4); }
}

/* ── 5 · SECTIONS & HEADINGS ───────────────────────────────────────────── */
.section {
  padding-top: var(--sp-7);
  margin-top: var(--sp-9);
  border-top: 1px solid var(--border-soft);
  scroll-margin-top: var(--scroll-pad);
}

.section:first-of-type { margin-top: var(--sp-8); }

.section__head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.section__num {
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
  color: var(--accent-gold);
  letter-spacing: 0.06em;
  flex: 0 0 auto;
  padding-top: 0.15em;
}

.section__heading {
  font-family: var(--font-ml-display);
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  position: relative;
}

/* anchor link appears on hover / keyboard focus only */
.section__anchor {
  margin-left: var(--sp-2);
  font-family: var(--font-ui);
  font-size: 0.7em;
  color: var(--accent-gold);
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.section__heading:hover .section__anchor,
.section__anchor:focus-visible { opacity: 1; }

.section__kicker {
  margin-bottom: var(--sp-3);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-gold-ink);
}

.subsection {
  margin-top: var(--sp-7);
  scroll-margin-top: var(--scroll-pad);
}

.subsection__heading {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  font-family: var(--font-ml);
  font-size: var(--fs-h3);
  line-height: var(--lh-heading);
  font-weight: var(--fw-semibold);
  color: var(--ink-700);
}

.subsection__heading::before {
  content: "";
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-leaf);
  flex: 0 0 auto;
}

/* ornamental section divider — literary, quiet */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  margin: var(--sp-9) auto;
  max-width: var(--w-prose);
  color: var(--accent-gold);
  opacity: 0.75;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1 1 auto;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

.divider__glyph {
  font-family: var(--font-ml-display);
  font-size: 1rem;
  line-height: 1;
  color: var(--accent-gold);
  padding: 0 var(--sp-1);
}

/* ── 6 · PANELS — important points, examples, notes ────────────────────── */
.panel {
  margin-block: var(--sp-7);
  padding: var(--sp-6) var(--sp-6) var(--sp-6) var(--sp-7);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent-leaf);
  background: var(--tint-example);
  scroll-margin-top: var(--scroll-pad);
}

.panel__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  font-family: var(--font-ml);
  font-size: var(--fs-panel-title);
  font-weight: var(--fw-semibold);
  color: var(--ink-700);
}

.panel__title svg { width: 18px; height: 18px; flex: 0 0 auto; }

.panel__tag {
  display: inline-block;
  margin-right: var(--sp-2);
  padding: 0.1em 0.55em;
  border-radius: var(--radius-xs);
  background: var(--paper-000);
  border: 1px solid var(--border-soft);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-leaf-ink);
}

/* important points — warm gold tint, the strongest quiet signal */
.panel--important {
  background: var(--tint-important);
  border-color: color-mix(in srgb, var(--gold-500) 26%, transparent);
  border-left-color: var(--accent-gold);
}
.panel--important .panel__title { color: var(--gold-700); }
.panel--important .panel__tag { color: var(--accent-gold-ink); }

/* examples — soft green tint */
.panel--example { background: var(--tint-example); border-left-color: var(--accent-leaf); }

/* caution / exam notes — terracotta tint, used sparingly */
.panel--note {
  background: var(--tint-note);
  border-color: color-mix(in srgb, var(--terra-500) 22%, transparent);
  border-left-color: var(--accent);
}
.panel--note .panel__title { color: var(--terra-700); }
.panel--note .panel__tag { color: var(--terra-700); }

/* plain variant: definition box for the chapter overview */
.panel--plain {
  background: var(--paper-000);
  border-color: var(--border-soft);
  border-left-color: var(--border-strong);
}
.panel--plain .panel__title { color: var(--accent-green-ink); }

.panel > :last-child { margin-bottom: 0; }

@media (max-width: 820px) {
  .panel { padding: var(--sp-5) var(--sp-5) var(--sp-5) var(--sp-5); }
  .divider { margin: var(--sp-8) auto; }
}

/* ── 7 · KEY TERMS ─────────────────────────────────────────────────────── */
/* inline term inside a paragraph */
.keyterm {
  font-style: normal;
  font-weight: var(--fw-semibold);
  color: var(--accent-green-ink);
  background: color-mix(in srgb, var(--gold-100) 70%, transparent);
  border-bottom: 1.5px dotted color-mix(in srgb, var(--terra-500) 60%, transparent);
  padding: 0.05em 0.22em;
  border-radius: var(--radius-xs);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* term list: definition rows, not cards */
.keyterms { list-style: none; display: grid; gap: 0; margin-block: var(--sp-5); }

.keyterms__item {
  display: grid;
  grid-template-columns: minmax(130px, 190px) 1fr;
  gap: var(--sp-2) var(--sp-5);
  padding-block: var(--sp-4);
  border-top: 1px solid var(--border-soft);
}

.keyterms__item:first-child { border-top: 0; padding-top: 0; }
.keyterms__item:last-child { padding-bottom: 0; }

.keyterms__term {
  font-family: var(--font-ml-display);
  font-size: 1.0625rem;
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  color: var(--accent-green-ink);
}

.keyterms__term span {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.keyterms__def { color: var(--text-quiet); font-size: var(--fs-body-sm); }
.keyterms__def p { margin-bottom: var(--sp-2); }

@media (max-width: 620px) {
  .keyterms__item { grid-template-columns: 1fr; gap: var(--sp-1); }
}

/* ── 8 · QUOTES / LITERARY EXCERPTS ────────────────────────────────────── */
.quote {
  position: relative;
  margin-block: var(--sp-8);
  padding: var(--sp-2) 0 var(--sp-2) var(--sp-7);
  border-left: 3px solid var(--accent);
}

.quote__mark {
  position: absolute;
  left: 0.18em;
  top: -0.42em;
  font-family: var(--font-ml-display);
  font-size: 4.25rem;
  line-height: 1;
  color: var(--accent-gold);
  opacity: var(--op-ornament);
  pointer-events: none;
  user-select: none;
}

.quote__text {
  font-family: var(--font-ml-display);
  font-size: var(--fs-quote);
  font-weight: var(--fw-medium);
  line-height: 1.78;
  color: var(--accent-green-ink);
}

.quote__text p { margin-bottom: var(--sp-3); }
.quote__text p:last-child { margin-bottom: 0; }

.quote__cite {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  font-style: normal;
  color: var(--text-muted);
}

.quote__cite::before {
  content: "";
  width: 20px;
  height: 1px;
  background: var(--accent-gold);
  flex: 0 0 auto;
}

/* proverb / short traditional line */
.quote--proverb { border-left-color: var(--accent-gold); }
.quote--proverb .quote__text { font-size: calc(var(--fs-quote) * 0.94); }
.quote--proverb .quote__mark { color: var(--accent-leaf); }

/* ── 9 · LISTS ─────────────────────────────────────────────────────────── */
.list { list-style: none; display: grid; gap: var(--sp-3); margin-block: var(--sp-5); }

.list > li { position: relative; padding-left: var(--sp-7); }

.list--ticks > li::before,
.list--bullets > li::before {
  content: "";
  position: absolute;
  top: 0.78em;
}

.list--ticks > li::before {
  left: 0.2em;
  width: 7px;
  height: 7px;
  background: var(--accent-leaf);
  border-radius: 2px;
  rotate: 45deg;
}

.list--bullets > li::before {
  left: 0.4em;
  width: 6px;
  height: 6px;
  background: var(--accent-gold);
  border-radius: 50%;
}

.list--numbered { counter-reset: item; }
.list--numbered > li { padding-left: var(--sp-8); }

.list--numbered > li::before {
  counter-increment: item;
  content: counter(item) ".";
  position: absolute;
  left: 0;
  top: 0;
  padding-top: 0.28em;
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
  color: var(--accent-gold-ink);
}

.list--steps { counter-reset: step; gap: var(--sp-4); }
.list--steps > li { padding-left: var(--sp-9); }

.list--steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.25em;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper-000);
  border: 1px solid var(--border-strong);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: var(--fw-semibold);
  color: var(--accent-green-ink);
}

.list__label { font-weight: var(--fw-semibold); color: var(--ink-700); }

/* ── 10 · TABLES ───────────────────────────────────────────────────────── */
.table-wrap {
  margin-block: var(--sp-7);
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--paper-000);
}

.table-wrap .table { min-width: 540px; }

.table th,
.table td { vertical-align: top; }

.table th:first-child,
.table td:first-child { padding-left: var(--sp-5); }

.table th:last-child,
.table td:last-child { padding-right: var(--sp-5); }

.table__hint {
  margin-top: var(--sp-3);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  color: var(--text-muted);
}

/* two-column comparison block (poetry vs prose, etc.) */
.compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-6);
  margin-block: var(--sp-6);
}

.compare__col { padding-left: var(--sp-5); border-left: 2px solid var(--border-soft); }
.compare__col:first-child { border-left-color: var(--accent-gold); }

.compare__title {
  margin-bottom: var(--sp-3);
  font-family: var(--font-ml);
  font-size: 1.0625rem;
  font-weight: var(--fw-semibold);
  color: var(--accent-green-ink);
}

.compare ul { list-style: none; display: grid; gap: var(--sp-3); }
.compare li { position: relative; padding-left: var(--sp-5); font-size: var(--fs-body-sm); }
.compare li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.8em;
  width: 6px;
  height: 1px;
  background: var(--accent-gold);
}

@media (max-width: 720px) {
  .compare { grid-template-columns: 1fr; gap: var(--sp-5); }
}

/* ── 11 · QUESTIONS FOR REVISION ───────────────────────────────────────── */
.questions { margin-block: var(--sp-5); }

/* the chapter JSON supplies a plain <ol>; the numbering is styled here ----- */
.prose .questions > ol {
  list-style: none;
  counter-reset: q;
  display: grid;
  gap: 0;
}

.prose .questions > ol > li {
  counter-increment: q;
  position: relative;
  padding: var(--sp-4) 0 var(--sp-4) 2.25rem;
  border-top: 1px solid var(--border-soft);
  color: var(--text-body);
}

.prose .questions > ol > li:first-child { border-top: 0; padding-top: 0; }
.prose .questions > ol > li:last-child { padding-bottom: 0; }

.prose .questions > ol > li::before {
  content: counter(q);
  position: absolute;
  left: 0;
  top: calc(var(--sp-4) + 0.2em);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-green-solid);
  color: var(--text-invert);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: var(--fw-semibold);
}

.prose .questions > ol > li:first-child::before { top: 0.2em; }

/* nested lists inside a question stay tight */
.prose .questions > ol > li ul,
.prose .questions > ol > li ol { gap: var(--sp-2); margin-top: var(--sp-2); }

.q-marks {
  display: inline-block;
  margin-left: var(--sp-2);
  padding: 0.05em 0.5em;
  border-radius: var(--radius-pill);
  background: var(--gold-100);
  border: 1px solid color-mix(in srgb, var(--gold-500) 40%, transparent);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  color: var(--accent-gold-ink);
  white-space: nowrap;
  vertical-align: 0.1em;
}

.q-hint {
  margin-top: var(--sp-2);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  color: var(--text-muted);
}

/* ── 12 · QUICK REVISION — the one dark, distinctive block ─────────────── */
.revision {
  position: relative;
  margin-block: var(--sp-9);
  padding: var(--sp-7);
  border-radius: var(--radius-md);
  color: var(--text-invert);
  background-color: var(--accent-green-ink);
  background-image:
    radial-gradient(120% 130% at 100% 0%, color-mix(in srgb, var(--leaf-500) 45%, transparent) 0%, transparent 58%),
    radial-gradient(90% 100% at 0% 100%, color-mix(in srgb, var(--green-500) 55%, transparent) 0%, transparent 55%);
  overflow: hidden;
}

.revision__label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-on-dark-accent);
}

.revision__label::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: color-mix(in srgb, var(--gold-500) 45%, transparent);
}

.revision__title {
  margin-bottom: var(--sp-2);
  font-family: var(--font-ml-display);
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.5rem);
  line-height: var(--lh-heading);
  font-weight: var(--fw-semibold);
  color: #FFFFFF;
}

.revision__list { list-style: none; counter-reset: r; display: grid; gap: var(--sp-3); margin-top: var(--sp-5); }

.revision__item {
  counter-increment: r;
  position: relative;
  padding-left: var(--sp-8);
  color: var(--text-invert-muted);
  font-size: var(--fs-body-sm);
}

.revision__item::before {
  content: counter(r);
  position: absolute;
  left: 0;
  top: 0;
  padding-top: 0.35em;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
  color: var(--text-on-dark-accent);
}

.revision__item b { color: var(--text-invert); font-weight: var(--fw-semibold); }

.revision__tip {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border-invert);
  font-size: var(--fs-body-sm);
  color: var(--text-invert-muted);
}

.revision__tip svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--text-on-dark-accent); margin-top: 0.35em; }

@media (max-width: 820px) {
  .revision { padding: var(--sp-6) var(--sp-5); }
  .prose .questions > ol > li { padding-left: 2rem; }
}

@media print {
  .revision { background: #fff !important; color: #000 !important; border: 1px solid #bbb; }
  .revision__title, .revision__item, .revision__tip { color: #000 !important; }
  .revision__label, .revision__item::before { color: #6b4d17 !important; }
}

/* compact previous / next row, placed right after the summary ------------- */
.chapter-jump {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--sp-3);
  max-width: var(--w-prose);
  margin-inline: auto;
  margin-top: var(--sp-7);
}

.chapter-jump__link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--paper-100);
  color: var(--ink-700);
  font-size: var(--fs-body-sm);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.chapter-jump__link:hover { border-color: var(--accent-gold); background: var(--paper-000); }

.chapter-jump__link svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--accent-gold);
}

.chapter-jump__label {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.chapter-jump__num {
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--accent-gold-ink);
  flex: 0 0 auto;
}

.chapter-jump__title {
  font-family: var(--font-ml);
  font-weight: var(--fw-medium);
  color: var(--accent-green-ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .chapter-jump { grid-template-columns: 1fr; }
  .chapter-jump__title { white-space: normal; }
}

/* ── 13 · PREVIOUS / NEXT CHAPTER NAVIGATION ───────────────────────────── */
.pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-10);
  padding-top: var(--sp-7);
  border-top: 1px solid var(--border-soft);
}

.pager__link {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-5);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--paper-000);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}

.pager__link:hover {
  border-color: var(--accent-gold);
  background: var(--paper-100);
  transform: translateY(-2px);
}

.pager__dir {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pager__dir svg { width: 14px; height: 14px; }

.pager__title {
  font-family: var(--font-ml-display);
  font-size: 1.125rem;
  line-height: var(--lh-heading);
  font-weight: var(--fw-semibold);
  color: var(--accent-green-ink);
}

.pager__meta {
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.pager__link--next { text-align: right; }
.pager__link--next .pager__dir { justify-content: flex-end; }

.pager__link--index { border-style: dashed; }

@media (max-width: 620px) {
  .pager { grid-template-columns: 1fr; }
  .pager__link--next { text-align: left; }
  .pager__link--next .pager__dir { justify-content: flex-start; }
}

/* ── 14 · FOOTER — lives on the environment, not on the paper ──────────── */
.site-footer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: calc(var(--w-surface) + (2 * var(--gutter)));
  margin-inline: auto;
  padding: var(--sp-8) var(--gutter) var(--sp-10);
  color: var(--text-invert-muted);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-6) var(--sp-7);
  align-items: flex-start;
  justify-content: space-between;
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border-invert);
}

.site-footer__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text-invert);
}

.site-footer__brand-name {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: var(--fw-semibold);
}

.site-footer__brand-note {
  display: block;
  font-family: var(--font-ml);
  font-size: 0.8125rem;
  color: var(--text-invert-muted);
}

.site-footer__links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
  font-size: var(--fs-small);
}

.site-footer__links a {
  color: var(--text-invert-muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 247, 245, 0.22);
  padding-bottom: 1px;
}

.site-footer__links a:hover { color: var(--gold-300); border-bottom-color: var(--gold-300); }

.site-footer__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  margin-top: var(--sp-6);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  color: rgba(244, 247, 245, 0.6);
}

.site-footer__meta span { display: inline-flex; align-items: center; gap: var(--sp-2); }

/* ── 15 · COURSE HUB (index page) ──────────────────────────────────────── */
.hub-hero {
  position: relative;
  padding-bottom: var(--sp-7);
  margin-bottom: var(--sp-8);
  border-bottom: 1px solid var(--border-soft);
}

.hub-hero__title {
  font-family: var(--font-ml-display);
  font-size: var(--fs-display);
  line-height: var(--lh-title);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  text-wrap: balance;
}

.hub-hero__lede {
  max-width: 64ch;
  margin-top: var(--sp-5);
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  color: var(--text-quiet);
}

.hub-hero__chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-6); }

.hub-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-7); }

.chapter-list { margin-top: var(--sp-6); border-top: 1px solid var(--border-soft); }

.chapter-row {
  display: grid;
  grid-template-columns: 3.25rem 1fr auto;
  gap: var(--sp-4) var(--sp-5);
  align-items: start;
  padding: var(--sp-6) var(--sp-4) var(--sp-6) var(--sp-2);
  border-bottom: 1px solid var(--border-soft);
  color: inherit;
  text-decoration: none;
  transition: background var(--dur) var(--ease), padding var(--dur) var(--ease);
}

.chapter-row:hover { background: linear-gradient(90deg, var(--paper-100), transparent 85%); }

.chapter-row__num {
  font-family: var(--font-ui);
  font-size: 1.75rem;
  font-weight: var(--fw-bold);
  line-height: 1;
  color: var(--accent-gold);
  opacity: 0.6;
  padding-top: 0.1em;
}

.chapter-row__title {
  margin-bottom: var(--sp-2);
  font-family: var(--font-ml-display);
  font-size: 1.3125rem;
  line-height: var(--lh-heading);
  font-weight: var(--fw-semibold);
  color: var(--accent-green-ink);
}

.chapter-row__desc {
  max-width: 62ch;
  font-size: var(--fs-body-sm);
  color: var(--text-quiet);
}

.chapter-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-3);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  color: var(--text-muted);
}

.chapter-row__go {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--accent-green-ink);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}

.chapter-row__go svg { width: 16px; height: 16px; }

.chapter-row:hover .chapter-row__go {
  background: var(--bg-green-solid);
  border-color: var(--accent-green-ink);
  color: var(--text-invert);
}

.chapter-row[hidden] { display: none; }

.hub-empty {
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-body-sm);
}

.hub-note {
  margin-top: var(--sp-6);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  color: var(--text-muted);
}

/* ── 16 · SMALL HELPERS ────────────────────────────────────────────────── */
[hidden] { display: none !important; }

.link-quiet {
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.2em;
}

.link-quiet:hover { color: var(--link); }

.chip-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--paper-000);
  color: var(--text-quiet);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  text-decoration: none;
}

.chip:hover { border-color: var(--accent-gold); color: var(--accent-green-ink); }

.rule-soft { height: 1px; margin-block: var(--sp-8); background: var(--border-soft); }

/* ── responsive fine-tuning for components ─────────────────────────────── */
@media (max-width: 820px) {
  .chapter-row { grid-template-columns: 2.5rem 1fr; padding-inline: 0; }
  .chapter-row__go { display: none; }
  .chapter-row__title { font-size: 1.1875rem; }
  .site-footer__inner { flex-direction: column; }
  .site-footer { padding-bottom: var(--sp-9); }
}

/* ── heading specificity guard ──────────────────────────────────────────── */
/* base.css styles bare `.prose h2/h3` (specificity 0,1,1). Component heading
   classes are re-stated here so a component always wins inside the surface. */
.prose .section__heading {
  font-family: var(--font-ml-display);
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
}

.prose .subsection__heading {
  font-family: var(--font-ml);
  font-size: var(--fs-h3);
  line-height: var(--lh-heading);
  font-weight: var(--fw-semibold);
  color: var(--ink-700);
}

.revision .revision__title {
  font-family: var(--font-ml-display);
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.5rem);
  line-height: var(--lh-heading);
  font-weight: var(--fw-semibold);
  color: #FFFFFF;
}

.prose .chapter-hero__title {
  font-size: var(--fs-h1);
  line-height: var(--lh-title);
}

@media (max-width: 480px) {
  .badge { font-size: 0.8125rem; }
  .q-marks { margin-left: var(--sp-1); }
  .section__head { gap: var(--sp-2); }
}












/* ======== decorations.css ======== */
/* ==========================================================================
   LEARN · DECORATIVE ENVIRONMENT  (layer 4 of 5)
   The Malayalam literary "world" around the reading surface.

   Design rules
   ├─ Markup is IDENTICAL on every chapter page (same node list, same order).
   ├─ Position / size / rotation / opacity are set ONLY from CSS, via
   │  [data-decor="a"|"b"|"c"]  → decoration variants can never move content.
   ├─ Everything is sized in `em` off `.env { font-size }`, so the whole system
   │  scales: full page, tablet, mobile and the design-system previews.
   └─ .env is aria-hidden + pointer-events:none + z-index below content.
   ========================================================================== */

.env {
  position: fixed;
  inset: 0;
  z-index: var(--z-env);
  overflow: hidden;
  pointer-events: none;
  font-size: clamp(5px, 1.28vw, 17px);   /* master scale for all decoration */
  color: var(--text-invert);
  background-color: var(--bg-env);
  background-image:
    radial-gradient(120% 80% at 50% -20%, rgba(64, 128, 112, 0.30) 0%, transparent 60%),
    linear-gradient(180deg, var(--green-800) 0%, var(--green-700) 42%, var(--green-900) 100%);
}

/* ── soft coloured light pools (set per variant via --gx/--gy/--gt) ────── */
.env__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(6em);
  opacity: 0.55;
  animation: env-drift 38s var(--ease) infinite alternate;
}

.env__glow--1 {
  inset: auto;
  left: var(--g1x, -14%);
  top: var(--g1y, -18%);
  width: var(--g1s, 62em);
  height: var(--g1s, 62em);
  background: radial-gradient(circle,
    color-mix(in srgb, var(--g1t, var(--green-400)) 62%, transparent) 0%,
    transparent 68%);
}

.env__glow--2 {
  inset: auto;
  right: var(--g2x, -18%);
  bottom: var(--g2y, -22%);
  width: var(--g2s, 54em);
  height: var(--g2s, 54em);
  background: radial-gradient(circle,
    color-mix(in srgb, var(--g2t, var(--green-500)) 55%, transparent) 0%,
    transparent 70%);
  animation-delay: -12s;
}

@keyframes env-drift {
  from { translate: 0 0; }
  to   { translate: 2.5em 1.75em; }
}

/* ── fine paper grain: keeps large flat greens from banding ────────────── */
.env__grain {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.22'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

/* ── abstract letterform motifs (SVG strokes, no cultural clichés) ─────── */
.env__motif {
  position: absolute;
  color: var(--gold-300);
  opacity: var(--op-deco-sm);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linecap: round;
}

.env__motif--curve { width: 34em; height: 34em; }
.env__motif--arc   { width: 22em; height: 22em; color: var(--terra-300); }

/* a single ink rule, like the baseline of a manuscript page */
.env__rule {
  position: absolute;
  height: 1px;
  width: 42em;
  background: linear-gradient(90deg, transparent,
    color-mix(in srgb, var(--gold-500) 60%, transparent), transparent);
  opacity: var(--op-deco-md);
}

/* ── Malayalam letterforms ────────────────────────────────────────────── */
.env__glyphs,
.env__words,
.env__marks {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.env__glyphs > li {
  position: absolute;
  font-family: var(--font-ml-display);
  font-weight: var(--fw-semibold);
  line-height: 1;
  user-select: none;
  color: #EAF2ED;
}

.env__words > li {
  position: absolute;
  font-family: var(--font-ml);
  font-weight: var(--fw-medium);
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  color: var(--gold-300);
}

/* dots and short strokes derived from Malayalam letter joins */
.env__marks > li {
  position: absolute;
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  background: currentColor;
  color: var(--terra-300);
}
.env__marks > li:nth-child(2n) {
  width: 2.6em;
  height: 1px;
  border-radius: 2px;
  background: linear-gradient(90deg, currentColor, transparent);
}
.env__marks > li:nth-child(3n) {
  width: 1.5em;
  height: 0.9em;
  border-radius: 0.9em 0.9em 0.15em 0.15em;
  background: color-mix(in srgb, var(--gold-500) 70%, transparent);
}

/* ==========================================================================
   VARIANT A — "അ upper-left · ക mid-left · ഭാഷ at the base"
   Calm, corner-weighted: two big letterforms, one word low-left.
   ========================================================================== */
[data-decor="a"] {
  --g1x: -14%; --g1y: -20%; --g1s: 58em; --g1t: var(--green-400);
  --g2x: -18%; --g2y: -24%; --g2s: 50em; --g2t: var(--green-500);
}

[data-decor="a"] .env__glyphs > li:nth-child(1)  { left: 1.5%;  top: 6%;   font-size: 24em; opacity: var(--op-deco-lg); rotate: -7deg; }
[data-decor="a"] .env__glyphs > li:nth-child(2)  { right: -4%;  top: -3%;  font-size: 30em; opacity: var(--op-deco-xl); rotate: 6deg; }
[data-decor="a"] .env__glyphs > li:nth-child(3)  { right: 3%;   top: 36%;  font-size: 11em; opacity: var(--op-deco-md); rotate: -10deg; }
[data-decor="a"] .env__glyphs > li:nth-child(4)  { left: 2%;    top: 44%;  font-size: 18em; opacity: var(--op-deco-lg); rotate: 5deg; }
[data-decor="a"] .env__glyphs > li:nth-child(5)  { left: -5%;   top: 72%;  font-size: 20em; opacity: var(--op-deco-xl); rotate: -4deg; }
[data-decor="a"] .env__glyphs > li:nth-child(6)  { right: -6%;  top: 70%;  font-size: 22em; opacity: var(--op-deco-xl); rotate: 9deg; }
[data-decor="a"] .env__glyphs > li:nth-child(7)  { right: 8%;   top: 87%;  font-size: 12em; opacity: var(--op-deco-md); rotate: 2deg; }
[data-decor="a"] .env__glyphs > li:nth-child(8)  { left: 9%;    top: 88%;  font-size: 9em;  opacity: var(--op-deco-md); rotate: -12deg; }
[data-decor="a"] .env__glyphs > li:nth-child(9)  { left: 11%;   top: 5.4%; font-size: 6em;  opacity: var(--op-deco-xl); rotate: 16deg; }
[data-decor="a"] .env__glyphs > li:nth-child(10) { right: 14%;  top: 6%;   font-size: 7em;  opacity: var(--op-deco-xl); rotate: -14deg; }

[data-decor="a"] .env__words > li:nth-child(1) { left: 2.5%; top: 63%; font-size: 3.2em; opacity: var(--op-deco-md); rotate: -2deg; }
[data-decor="a"] .env__words > li:nth-child(2) { right: 2%;  top: 51%; font-size: 2.6em; opacity: var(--op-deco-md); rotate: 3deg; }
[data-decor="a"] .env__words > li:nth-child(3) { right: 6%;  top: 13%; font-size: 2em;   opacity: var(--op-deco-md); rotate: 0deg; }
[data-decor="a"] .env__words > li:nth-child(4) { left: 6%;   top: 95%; font-size: 2.2em; opacity: var(--op-deco-md); rotate: -6deg; }

[data-decor="a"] .env__marks > li:nth-child(1) { left: 4%;  top: 32%; opacity: var(--op-deco-sm); }
[data-decor="a"] .env__marks > li:nth-child(2) { right: 6%; top: 27%; opacity: var(--op-deco-sm); }
[data-decor="a"] .env__marks > li:nth-child(3) { left: 8%;  top: 56%; opacity: var(--op-deco-md); }
[data-decor="a"] .env__marks > li:nth-child(4) { right: 4%; top: 63%; opacity: var(--op-deco-sm); }
[data-decor="a"] .env__marks > li:nth-child(5) { left: 3%;  top: 82%; opacity: var(--op-deco-sm); }
[data-decor="a"] .env__marks > li:nth-child(6) { right: 9%; top: 79%; opacity: var(--op-deco-sm); }

[data-decor="a"] .env__motif--curve { left: -7%;  top: 54%; rotate: -16deg; }
[data-decor="a"] .env__motif--arc   { right: 2%;  top: 17%; rotate: 12deg; }
[data-decor="a"] .env__rule         { left: 0;    top: 9.4%; width: 21em; rotate: -2deg; }

/* ==========================================================================
   VARIANT B — "മ on the left · ഭാഷ near the right · curve motif at the top"
   Balanced, poster-like: one dominant letterform, a curved stroke overhead.
   ========================================================================== */
[data-decor="b"] {
  --g1x: -12%; --g1y: -24%; --g1s: 66em; --g1t: var(--leaf-600);
  --g2x: -20%; --g2y: -20%; --g2s: 46em; --g2t: var(--green-300);
}

[data-decor="b"] .env__glyphs > li:nth-child(1)  { right: -5%;  top: -2%;  font-size: 26em; opacity: var(--op-deco-xl); rotate: 8deg; }
[data-decor="b"] .env__glyphs > li:nth-child(2)  { left: -3%;   top: 38%;  font-size: 28em; opacity: var(--op-deco-xl); rotate: -6deg; }
[data-decor="b"] .env__glyphs > li:nth-child(3)  { left: 4%;    top: 74%;  font-size: 14em; opacity: var(--op-deco-md); rotate: 12deg; }
[data-decor="b"] .env__glyphs > li:nth-child(4)  { left: 3%;    top: 8%;   font-size: 16em; opacity: var(--op-deco-lg); rotate: -9deg; }
[data-decor="b"] .env__glyphs > li:nth-child(5)  { right: 5%;   top: 44%;  font-size: 13em; opacity: var(--op-deco-md); rotate: 5deg; }
[data-decor="b"] .env__glyphs > li:nth-child(6)  { right: -7%;  top: 78%;  font-size: 24em; opacity: var(--op-deco-xl); rotate: -8deg; }
[data-decor="b"] .env__glyphs > li:nth-child(7)  { left: 0.5%;  top: 16%;  font-size: 26em; opacity: var(--op-deco-lg); rotate: -3deg; }
[data-decor="b"] .env__glyphs > li:nth-child(8)  { left: 6%;    top: 86%;  font-size: 11em; opacity: var(--op-deco-md); rotate: 7deg; }
[data-decor="b"] .env__glyphs > li:nth-child(9)  { left: 22%;   top: 5.6%; font-size: 6.5em; opacity: var(--op-deco-xl); rotate: -12deg; }
[data-decor="b"] .env__glyphs > li:nth-child(10) { right: 10%;  top: 6.2%; font-size: 8em;  opacity: var(--op-deco-xl); rotate: 10deg; }

[data-decor="b"] .env__words > li:nth-child(1) { right: 1.5%; top: 26%; font-size: 3.4em; opacity: var(--op-deco-md); rotate: 4deg; }
[data-decor="b"] .env__words > li:nth-child(2) { left: 2%;   top: 66%; font-size: 2.8em; opacity: var(--op-deco-md); rotate: -3deg; }
[data-decor="b"] .env__words > li:nth-child(3) { right: 4%;  top: 90%; font-size: 2em;   opacity: var(--op-deco-md); rotate: 0deg; }
[data-decor="b"] .env__words > li:nth-child(4) { left: 3%;   top: 11%; font-size: 1.9em; opacity: var(--op-deco-md); rotate: -5deg; }

[data-decor="b"] .env__marks > li:nth-child(1) { right: 3%;  top: 14%; opacity: var(--op-deco-md); }
[data-decor="b"] .env__marks > li:nth-child(2) { left: 5%;   top: 30%; opacity: var(--op-deco-sm); }
[data-decor="b"] .env__marks > li:nth-child(3) { right: 8%;  top: 56%; opacity: var(--op-deco-sm); }
[data-decor="b"] .env__marks > li:nth-child(4) { left: 2%;   top: 60%; opacity: var(--op-deco-md); }
[data-decor="b"] .env__marks > li:nth-child(5) { right: 4%;  top: 84%; opacity: var(--op-deco-sm); }
[data-decor="b"] .env__marks > li:nth-child(6) { left: 7%;   top: 92%; opacity: var(--op-deco-sm); }

[data-decor="b"] .env__motif--curve { left: -4%;  top: 1%;  rotate: 10deg; }
[data-decor="b"] .env__motif--arc   { right: 3%;  top: 62%; rotate: -14deg; }
[data-decor="b"] .env__rule         { right: 0;   top: 9%;  width: 24em; rotate: 2deg; }

/* ==========================================================================
   VARIANT C — "ക upper-right · സാഹിത്യം lower-left · tiny letterforms"
   Airy and typographic: many small marks, light at the centre.
   ========================================================================== */
[data-decor="c"] {
  --g1x: 24%; --g1y: -26%; --g1s: 50em; --g1t: var(--green-300);
  --g2x: -14%; --g2y: -18%; --g2s: 62em; --g2t: var(--leaf-600);
}

[data-decor="c"] .env__glyphs > li:nth-child(1)  { left: 4%;    top: 30%;  font-size: 10em; opacity: var(--op-deco-md); rotate: -8deg; }
[data-decor="c"] .env__glyphs > li:nth-child(2)  { right: -4%;  top: 80%;  font-size: 26em; opacity: var(--op-deco-xl); rotate: 7deg; }
[data-decor="c"] .env__glyphs > li:nth-child(3)  { left: 2%;    top: 9%;   font-size: 8em;  opacity: var(--op-deco-xl); rotate: 14deg; }
[data-decor="c"] .env__glyphs > li:nth-child(4)  { right: 1%;   top: 10%;  font-size: 24em; opacity: var(--op-deco-lg); rotate: 5deg; }
[data-decor="c"] .env__glyphs > li:nth-child(5)  { left: -6%;   top: 66%;  font-size: 18em; opacity: var(--op-deco-xl); rotate: -5deg; }
[data-decor="c"] .env__glyphs > li:nth-child(6)  { right: 7%;   top: 40%;  font-size: 9em;  opacity: var(--op-deco-md); rotate: -11deg; }
[data-decor="c"] .env__glyphs > li:nth-child(7)  { right: 3%;   top: 62%;  font-size: 12em; opacity: var(--op-deco-md); rotate: 3deg; }
[data-decor="c"] .env__glyphs > li:nth-child(8)  { left: 7%;    top: 48%;  font-size: 11em; opacity: var(--op-deco-md); rotate: 9deg; }
[data-decor="c"] .env__glyphs > li:nth-child(9)  { left: 30%;   top: 6%;   font-size: 5.5em; opacity: var(--op-deco-xl); rotate: -16deg; }
[data-decor="c"] .env__glyphs > li:nth-child(10) { right: 16%;  top: 92%;  font-size: 7em;  opacity: var(--op-deco-xl); rotate: 12deg; }

[data-decor="c"] .env__words > li:nth-child(1) { left: 1%;   top: 80%; font-size: 3.4em; opacity: var(--op-deco-md); rotate: -3deg; }
[data-decor="c"] .env__words > li:nth-child(2) { right: 12%; top: 22%; font-size: 2.2em; opacity: var(--op-deco-md); rotate: 4deg; }
[data-decor="c"] .env__words > li:nth-child(3) { left: 2.5%; top: 22%; font-size: 2em;   opacity: var(--op-deco-md); rotate: -6deg; }
[data-decor="c"] .env__words > li:nth-child(4) { right: 5%;  top: 70%; font-size: 1.9em; opacity: var(--op-deco-md); rotate: 2deg; }

[data-decor="c"] .env__marks > li:nth-child(1) { right: 6%;  top: 8%;  opacity: var(--op-deco-md); }
[data-decor="c"] .env__marks > li:nth-child(2) { left: 9%;   top: 16%; opacity: var(--op-deco-sm); }
[data-decor="c"] .env__marks > li:nth-child(3) { right: 2%;  top: 34%; opacity: var(--op-deco-sm); }
[data-decor="c"] .env__marks > li:nth-child(4) { left: 3%;   top: 44%; opacity: var(--op-deco-sm); }
[data-decor="c"] .env__marks > li:nth-child(5) { right: 10%; top: 74%; opacity: var(--op-deco-md); }
[data-decor="c"] .env__marks > li:nth-child(6) { left: 5%;   top: 94%; opacity: var(--op-deco-sm); }

[data-decor="c"] .env__motif--curve { left: -8%;  top: 74%; rotate: 22deg; }
[data-decor="c"] .env__motif--arc   { right: -2%; top: 30%; rotate: -8deg; }
[data-decor="c"] .env__rule         { right: 1.5%; top: 26%; width: 30em; rotate: 90deg; }

/* ══ RESPONSIVE REDUCTION — decoration steps back on smaller screens ════ */
@media (max-width: 1440px) {
  .env { font-size: clamp(5px, 1.05vw, 15px); }
  .env__glyphs > li:nth-child(9),
  .env__glyphs > li:nth-child(10) { display: none; }
}

@media (max-width: 1180px) {
  .env__words > li:nth-child(3) { display: none; }
  .env__marks > li:nth-child(6) { display: none; }
}

/* tablet: fewer, quieter, smaller */
@media (max-width: 980px) {
  .env { font-size: clamp(4.5px, 1vw, 11px); }
  .env__glyphs > li:nth-child(3),
  .env__glyphs > li:nth-child(5),
  .env__glyphs > li:nth-child(6),
  .env__glyphs > li:nth-child(8) { display: none; }
  .env__words > li:nth-child(4) { display: none; }
  .env__marks > li:nth-child(2),
  .env__marks > li:nth-child(4) { display: none; }
  .env__motif--arc { display: none; }
  .env__rule { opacity: 0.14; }
}

/* mobile: identity kept to three quiet forms, never competing with text */
@media (max-width: 720px) {
  .env { font-size: 9px; }
  .env__grain { opacity: 0.34; }
  .env__glow { filter: blur(8em); opacity: 0.42; }
  .env__glyphs > li:nth-child(2),
  .env__glyphs > li:nth-child(4),
  .env__glyphs > li:nth-child(6),
  .env__glyphs > li:nth-child(7) { display: none; }
  .env__glyphs > li:nth-child(1) { left: 4%; top: 7%; font-size: 7em; opacity: var(--op-deco-md); }
  .env__glyphs > li:nth-child(5) { left: 6%; top: 91%; font-size: 11em; opacity: var(--op-deco-xl); }
  .env__glyphs > li:nth-child(3) { left: auto; right: 5%; top: 92%; font-size: 8em; rotate: -9deg; opacity: var(--op-deco-lg); }
  .env__words > li:nth-child(1) { left: 5%; top: 95.5%; font-size: 1.9em; }
  .env__words > li:nth-child(2),
  .env__words > li:nth-child(3),
  .env__words > li:nth-child(4) { display: none; }
  .env__marks > li:nth-child(1),
  .env__marks > li:nth-child(3),
  .env__marks > li:nth-child(5) { display: none; }
  .env__motif--curve { display: none; }
  .env__rule { display: none; }
}





/* ======== site.css ======== */
/* ==========================================================================
   Learn · Astro shell additions  (layer 6 — deliberately tiny)
   --------------------------------------------------------------------------
   The five design-system layers (tokens → base → components → decorations →
   design-system) are reused byte-for-byte from the HTML prototype and must
   stay in sync with it. Only additions the Astro shell genuinely needs live
   here — and nothing here may re-implement an existing component rule.
   ========================================================================== */

/* brand mark: the real logo icon (learn-icon.svg) inside the existing frame.
   The mark's top padding exists to optically centre a Malayalam glyph; it is
   not wanted for an image. */
.brand__mark--logo {
  padding-top: 0;
}

.brand__logo {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: inherit;
}

/* Full horizontal logo in the course masthead is no longer used: the logo
   already lives in the site header, so the reading surface repeats no
   branding. The rules were removed with the compact course-context strip. */


/* -- 4d - READING RAIL: the contents list sits in a quiet left column ------
   The reading column keeps exactly the measure it had before, so the text
   line breaks are unchanged; only the index moves out of the flow. */
.prose > .reading {
  display: grid;
  grid-template-columns: minmax(0, 13.5rem) minmax(0, 1fr);
  align-items: start;
  gap: var(--sp-8);
  max-width: var(--w-prose-wide);
}

.reading__rail {
  position: sticky;
  top: var(--scroll-pad);
  min-width: 0;
}

/* a chapter with no headings and no questions has no rail at all — the body
   then takes the full width instead of sitting in the second grid column */
.prose > .reading > .reading__body:only-child { grid-column: 1 / -1; }

.prose .reading__body > * { max-width: var(--w-prose); margin-inline: 0; }
.prose .reading__body > .section:first-of-type { margin-top: 0; }

/* an index, not a panel: no card, no fill, smaller type than the body copy */
.prose .reading__rail .toc {
  margin-top: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}
.prose .reading__rail .toc__title {
  margin-bottom: var(--sp-3);
  padding-left: var(--sp-2);
  font-size: var(--fs-small);
}
.prose .reading__rail .toc__link {
  gap: var(--sp-2);
  padding: 3px var(--sp-2);
  font-size: var(--fs-label);
  line-height: 1.5;
}
.prose .reading__rail .toc__num {
  min-width: 1.1em;
  font-size: 0.6875rem;
}
.prose .reading__rail .toc__item--sub .toc__link { padding-left: var(--sp-5); }
.prose .reading__rail .toc__item--sub .toc__link::before { display: none; }

/* one column: the rail folds back to a compact card above the first section */
@media (max-width: 1080px) {
  .prose > .reading {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-7);
    max-width: var(--w-prose);
  }
  .reading__rail { position: static; }
  .prose .reading__rail .toc {
    padding: var(--sp-4) var(--sp-5);
    background: var(--paper-100);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
  }
  .prose .reading__rail .toc__link { font-size: var(--fs-small); }
}

/* Source: _sources/ku1aecmal102/directory.css */
/* ==========================================================================
   COURSE DIRECTORY — KU1AECMAL102
   --------------------------------------------------------------------------
   The only new CSS on the site. Everything here is layered on top of the
   shared stylesheet (../../../style.css) and reuses its design tokens:
   the same paper/ink ramps, borders, radii, spacing scale and font stacks,
   so the directory reads as part of the same pages as the chapter summaries.
   Dark mode comes for free: it only swaps the token values.
   ========================================================================== */

/* a short note under a section heading */
.section__note {
  margin-top: calc(-1 * var(--sp-3));
  margin-bottom: var(--sp-5);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  color: var(--text-muted);
}

/* ── 01 · COURSE INFORMATION ───────────────────────────────────────────────── */
/* Border-collapse-by-grid: no empty cell can ever show through at the end of
   a row, which a gap-plus-background grid would. */
.dir-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--border-soft);
  border-left: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.dir-facts__item {
  display: grid;
  gap: 0.15rem;
  padding: var(--sp-4) var(--sp-5);
  background: var(--paper-000);
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.dir-facts__label {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dir-facts__value {
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

/* ── 02 · COURSE DESCRIPTION ──────────────────────────────────────────────── */
.dir-block { margin-bottom: var(--sp-5); }
.dir-block:last-child { margin-bottom: 0; }

.dir-block__label {
  display: block;
  margin-bottom: var(--sp-2);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold-ink);
}

.dir-block__text { color: var(--text-body); }

/* ── 03 · COURSE OUTCOMES ────────────────────────────────────────────────── */
.dir-outcomes {
  list-style: none;
  display: grid;
  gap: var(--sp-3);
  padding: 0;
  margin: 0;
}

.dir-outcome {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: baseline;
  padding: var(--sp-4);
  background: var(--paper-000);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.dir-outcome__id {
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
  letter-spacing: 0.06em;
  color: var(--accent-green-ink);
}

.dir-outcome__domains {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-2);
  margin-top: var(--sp-2);
}

.dir-domain {
  padding: 0.05em 0.5em;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  background: var(--paper-100);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  color: var(--text-muted);
}

/* ── 04 · MARK DISTRIBUTION ───────────────────────────────────────────────── */
.dir-marks__summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.dir-marks__cell {
  padding: var(--sp-4);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--paper-000);
  text-align: center;
}

.dir-marks__cell--total { background: var(--bg-surface-alt); }

.dir-marks__label {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dir-marks__value {
  display: block;
  margin-top: 0.1rem;
  font-family: var(--font-ui);
  font-size: 1.375rem;
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.dir-marks__note { font-size: var(--fs-small); color: var(--text-quiet); }

.dir-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-body-sm);
}

.dir-table th,
.dir-table td {
  padding: var(--sp-3) var(--sp-2);
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}

.dir-table th {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dir-table td:last-child,
.dir-table th:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dir-table tr:last-child td {
  border-bottom: 0;
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
}

.dir-table__caption {
  margin-bottom: var(--sp-2);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  text-align: left;
  color: var(--text-strong);
}

.dir-mapping td:last-child,
.dir-mapping th:last-child {
  text-align: left;
  white-space: normal;
}

/* the reading lists collapse — they are reference, not reading material */
.dir-block summary {
  cursor: pointer;
  list-style: none;
  transition: color var(--dur-fast) var(--ease);
}

.dir-block summary::-webkit-details-marker { display: none; }

.dir-block summary::after {
  content: " ▾";
  display: inline-block;
  font-size: 0.8em;
  opacity: 0.7;
  transition: transform var(--dur-fast) var(--ease);
}

.dir-block[open] summary::after { transform: rotate(180deg); }
.dir-block summary:hover { color: var(--text-strong); }
.dir-block[open] summary { margin-bottom: var(--sp-2); }

/* ── 05 · DIRECTORY TOOLBAR ───────────────────────────────────────────────── */
.dir-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--paper-100);
}

.dir-search { display: grid; gap: var(--sp-2); flex: 1 1 16rem; min-width: 0; }

.dir-search__label {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold-ink);
}

.dir-search__input {
  width: 100%;
  min-height: 44px;                 /* touch friendly */
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--paper-000);
  color: var(--text-body);
  font-family: var(--font-ml);
  font-size: var(--fs-body-sm);
  transition: border-color var(--dur-fast) var(--ease);
}

.dir-search__input::placeholder { color: var(--text-muted); }
.dir-search__input:focus { border-color: var(--gold-500); }

.dir-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.dir-filter {
  min-height: 44px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--paper-000);
  color: var(--text-quiet);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}

.dir-filter:hover { border-color: var(--gold-500); color: var(--accent-gold-ink); }

.dir-filter.is-active {
  background: var(--bg-green-solid);
  border-color: var(--bg-green-solid);
  color: var(--text-invert);
  font-weight: var(--fw-semibold);
}

.dir-stats {
  margin: var(--sp-4) 0 0;
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.dir-stats b { color: var(--text-strong); font-variant-numeric: tabular-nums; }

.dir-status,
.dir-empty {
  margin-top: var(--sp-5);
  padding: var(--sp-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  color: var(--text-muted);
  text-align: center;
}

/* ── 06 · MODULES ─────────────────────────────────────────────────────────── */
/* .prose sets margins on every p and styles h3, so these two rules need the
   extra specificity to win against it. */
.prose .dir-module__num,
.prose .dir-module__meta,
.prose .dir-module__desc,
.prose .dir-stats,
.prose .dir-status,
.prose .dir-empty,
.prose .dir-marks__note { margin: 0; }

.prose .dir-module__meta { margin-left: auto; }

.dir-module { margin-top: var(--sp-7); }
.dir-module:first-child { margin-top: var(--sp-5); }

.dir-module__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border-strong);
}

.dir-module__num {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: var(--fw-bold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-gold-ink);
  white-space: nowrap;
}

.dir-module__title {
  font-family: var(--font-ml-display);
  font-size: var(--fs-lead);
  line-height: var(--lh-heading);
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

.prose .dir-module__title {
  font-family: var(--font-ml-display);
  font-size: var(--fs-lead);
  color: var(--text-strong);
}

.dir-chapter__body { min-width: 0; }

.dir-module__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.dir-module__desc {
  margin-top: var(--sp-3);
  font-size: var(--fs-body-sm);
  color: var(--text-quiet);
}

.dir-module__directions {
  margin: var(--sp-3) 0 0;
  padding-left: var(--sp-6);
  font-size: var(--fs-small);
  color: var(--text-quiet);
}

.dir-module__directions li { margin-bottom: var(--sp-1); }
.dir-module__directions li:last-child { margin-bottom: 0; }

/* ── 07 · CHAPTER LIST ────────────────────────────────────────────────────── */
.dir-chapters { list-style: none; padding: 0; margin: 0; }

.dir-chapter {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  gap: var(--sp-1) var(--sp-4);
  align-items: baseline;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border-soft);
}

.dir-chapters > .dir-chapter:last-child { border-bottom: 0; }

.dir-chapter__num {
  padding-top: 0.2em;
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  color: var(--accent-green-ink);
  font-variant-numeric: tabular-nums;
}

.dir-chapter__title {
  font-family: var(--font-ml-display);
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--text-strong);
  overflow-wrap: anywhere;           /* long Malayalam titles must not overflow */
}

.dir-chapter__title-en {
  display: block;
  margin-top: 2px;
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.dir-chapter__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--sp-3);
  margin-top: var(--sp-2);
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.dir-chapter__meta > span + span::before {
  content: "·";
  margin-right: var(--sp-3);
  opacity: 0.5;
}

.prose .dir-chapter__description {
  margin: var(--sp-2) 0 0;
  color: var(--text-quiet);
  font-size: var(--fs-small);
}

.dir-chapter__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-2);
}

/* availability is carried by the words, the tint only reinforces it */
.dir-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.15em 0.65em;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  background: var(--paper-100);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  white-space: nowrap;
  color: var(--text-quiet);
}

.dir-pill--ready {
  border-color: color-mix(in srgb, var(--accent-green-ink) 38%, transparent);
  background: color-mix(in srgb, var(--accent-green-ink) 12%, transparent);
  color: var(--accent-green-ink);
  font-weight: var(--fw-semibold);
}

.dir-pill__dot {
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.dir-action {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--paper-000);
  color: var(--accent-green-ink);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.dir-action:hover { background: var(--paper-100); border-color: var(--gold-500); }
.dir-action svg { width: 14px; height: 14px; flex: 0 0 auto; }

/* ── 08 · RESPONSIVE — the directory is read on phones first ──────────────── */
@media (max-width: 620px) {
  .dir-chapter { grid-template-columns: 1.9rem minmax(0, 1fr); }

  .dir-chapter__aside {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--sp-3);
  }

  .dir-module__meta { margin-left: 0; width: 100%; }
  .dir-toolbar { padding: var(--sp-3); }
  .dir-filter { flex: 1 1 auto; }
  .dir-facts__item { padding: var(--sp-3) var(--sp-4); }
}

@media (max-width: 380px) {
  .dir-chapter { grid-template-columns: minmax(0, 1fr); }
  .dir-chapter__num { padding-top: 0; }
  .dir-chapter__aside { grid-column: 1; }
}

@media (max-width: 420px) {
  .dir-filters { gap: var(--sp-1); }
  .dir-filter { padding: 0 var(--sp-3); }
  .dir-action { width: 100%; justify-content: center; }
}

/* ── 09 · PRINT — drop the controls, keep the syllabus ────────────────────── */
@media print {
  .dir-toolbar,
  .dir-stats,
  .dir-status,
  .dir-empty { display: none !important; }

  .dir-chapter,
  .dir-outcome,
  .dir-marks__cell { break-inside: avoid; }
}
