/* Riwaq foundation. All semantic text/ground pairs are opaque; see docs/redesign/tokens.md.
   The deliberate exceptions all carry no text, and every one of them is a light or a shadow
   rather than a ground: the elevation levels --rw-shadow-rest, --rw-shadow-lift and
   --rw-shadow-float (and --rw-shadow, only an alias of rest), --rw-well-shade (the same cast
   shadow drawn inward under a recess's top edge), --rw-shadow-cta (the light under a public brass
   pill, drawn on a pseudo-element), --rw-ground-glow, the two --rw-mesh-* lamplights behind the
   auth panel, and --rw-press-inset (Task 7F). Every shadow list keeps one shape in both themes.

   --rw-edge and --rw-portico-edge are NOT exceptions: each is a translucent edge flattened onto
   its ground so the token stays opaque, like --rw-line-accent. Both are decorative only: never
   text, never the boundary of a control (controls keep --rw-control-border), and --rw-edge is
   spent only on a surface that also casts a shadow.

   The interaction grounds Task 7F adds — the four *-hover tones and the two *-press tones — are
   NOT exceptions and must never become them: a hover tint sits underneath text, so a translucent
   one would make its pair depend on whatever happens to be behind the control that day. Every one
   is opaque and every pair it carries is measured in
   .superpowers/sdd/BUILD-PLAN/task-7f-report.md and guarded by DesignTokenTests, in both
   themes. */
:root {
    color-scheme: light;
    --rw-ground: #F2EBDD;
    --rw-ground-2: #E8DFCF;
    --rw-surface: #FFFCF6;
    --rw-ink: #2B2620;
    --rw-ink-muted: #62594C;
    --rw-green: #1E4638;
    /* The green a NUMBER is written in, which is not the green a panel is filled with. By day
       the two happen to coincide; after dark they cannot, because the fill lifts toward the
       ground it sits on while ink has to move the other way. Keeping one token for both is what
       put a 44px figure at 2.09:1 on the class record. 10.31:1 on surface here. */
    --rw-green-ink: #1E4638;
    --rw-portico: #12261F;
    --rw-on-green: #F2EBDD;
    /* Deep-panel vocabulary (the mihrab niche and the auth brand panel). Every pair is
       measured on the ground it names: accent-on-green 4.65:1 on --rw-green, and on the
       portico the three inks run 12.46 / 7.07 / 9.08 — the concept's literal colours,
       kept because they already clear AA. */
    --rw-accent-on-green: #C9A85C;
    --rw-on-green-muted: #D8CBA9;
    --rw-on-portico: #EDE3CE;
    --rw-on-portico-muted: #CFC3A6;
    --rw-accent-on-portico: #CDA85B;
    /* The rail's active item ink: the concept paints it green by day and brass-lift by
       night, so it is its own pair rather than a borrowed one. 10.0:1 on parchment. */
    --rw-nav-active-ink: #1E4638;
    --rw-accent-fill: #AC8437;
    --rw-accent-ink: #241C09;
    --rw-accent-text: #765517;
    --rw-accent-border: #866324;
    --rw-line: #D7CDBC;
    /* The brass hairline — the concept's "column": rgba(172,132,55,.42) flattened onto
       limestone so the token stays opaque like every other pair. Decorative separation
       only (rails, section rules, arch strokes); it is never a text colour and never the
       sole boundary of a control, so it carries no AA obligation. */
    --rw-line-accent: #D5C097;
    --rw-control-border: #807463;
    --rw-success-fg: #1E4638;
    --rw-success-bg: #DCEBDD;
    --rw-warning-fg: #674509;
    --rw-warning-bg: #F6E5B9;
    --rw-danger-fg: #842F32;
    --rw-danger-bg: #F8E1DB;
    --rw-info-fg: #254D60;
    --rw-info-bg: #DDECF0;
    /* THE STATE INKS (B1 fix round, B-6). A `-fg` is ink ON ITS OWN `-bg` and nothing else: the
       night values above are pale tints written for a deep status ground, and spent on the page's
       own grounds they are near-white — a destructive outline button, an invalid field's border and
       a failed row's stripe all lost their tone after dark while measuring 10:1. These four are the
       same status tone as ink or stroke on --rw-ground, --rw-ground-2 and --rw-surface. By day they
       are the `-fg` values, which already measure there; after dark they lift into the 7–10 band
       --rw-green-ink occupies, so a status carries the same weight in either theme.
       Measured (day / night) on surface · ground · ground-2:
         --rw-danger-ink   8.43 · 7.27 · 6.53  /  6.21 · 7.93 · 9.09
         --rw-warning-ink  8.43 · 7.28 · 6.53  /  6.31 · 8.06 · 9.24
         --rw-success-ink 10.31 · 8.90 · 7.99  /  6.18 · 7.89 · 9.04
         --rw-info-ink     8.88 · 7.67 · 6.88  /  7.03 · 8.97 · 10.28
       StateInkTests refuses a `-fg` spent as ink or stroke on anything but its own `-bg`. */
    --rw-success-ink: #1E4638;
    --rw-warning-ink: #674509;
    --rw-danger-ink: #842F32;
    --rw-info-ink: #254D60;
    /* Tenant identity only: never consumed by status or action rules. */
    --rw-org-clay: #7B4D3A;
    --rw-org-green: #385B3E;
    --rw-org-indigo: #3E4278;
    --rw-org-plum: #6D395F;
    --rw-org-slate: #46515C;
    --rw-org-teal: #245B62;
    --rw-on-org-clay: #FFFCF6;
    --rw-on-org-green: #FFFCF6;
    --rw-on-org-indigo: #FFFCF6;
    --rw-on-org-plum: #FFFCF6;
    --rw-on-org-slate: #FFFCF6;
    --rw-on-org-teal: #FFFCF6;
    --rw-focus-dark: #12261F;
    --rw-focus-light: #FFFCF6;
    /* Native controls (checkbox, radio, range, progress). The browser draws the glyph on
       this fill and picks its own contrasting glyph colour, so the fill only has to sit
       clearly off the surfaces it rests on: deep green does on limestone and parchment.
       The light value IS the product green — referenced, not respelled, so the two can
       never drift apart; the dark side deliberately breaks the tie (brass) below. */
    --rw-control-accent: var(--rw-green);

    /* unicode-range already limits Marcellus and Mulish to Latin and Amiri to Arabic, so each
       glyph finds its own face: Arabic inside a display or body rule lands in Amiri instead of
       Times, and Latin names, emails and Western digits inside Arabic or Urdu UI land in Mulish. */
    --rw-font-body: "Mulish", "Amiri", system-ui, sans-serif;
    --rw-font-display: "Marcellus", "Amiri", Georgia, serif;
    --rw-font-arabic: "Amiri", "Mulish", "Noto Naskh Arabic", "Traditional Arabic", serif;
    /* Scripture keeps today's stack, frozen. Mulish in the UI stack becomes the first available
       font (space glyph, strut), and the reader's line breaks must not move with it. */
    --rw-font-quran: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", serif;
    --rw-text-small: .875rem;
    --rw-text-body: 1rem;
    --rw-text-lead: 1.25rem;
    --rw-text-arabic-heading: 2.5rem;
    --rw-text-reader: clamp(1.75rem, 1.25rem + 2vw, 2.25rem);
    --rw-leading-reader: 2.2;
    --rw-reader-measure: 52rem;
    --rw-icon-size: 1.25rem;
    --rw-lockup-width: 9.5rem;
    --rw-arch-rise: 8rem;
    --rw-public-niche-height: 22rem;
    --rw-public-niche-mobile-height: 12rem;
    --rw-public-mark-size: 12rem;
    --rw-text-heading: clamp(1.75rem, 1.3rem + 2vw, 2.75rem);
    /* The region step between the 28–44px h1 and the 20px card label. */
    --rw-text-title: clamp(1.375rem, 1.2rem + .6vw, 1.625rem);
    --rw-leading-body: 1.6;
    --rw-leading-display: 1.25;
    --rw-leading-arabic: 1.9;
    /* Display titles written at 1.04–1.25 for Latin take this in Arabic script, so marked Amiri
       clears the line above when it wraps. */
    --rw-leading-arabic-display: 1.6;
    --rw-space-1: .25rem;
    --rw-space-2: .5rem;
    --rw-space-3: .75rem;
    --rw-space-4: 1rem;
    --rw-space-6: 1.5rem;
    --rw-space-8: 2rem;
    --rw-space-12: 3rem;
    --rw-page-gutter: clamp(1rem, 4vw, 3rem);
    /* THE SECTION RHYTHM (design-authority §4: roughly 84px between sections).
       The page wrappers stacked their regions at --rw-space-6, 24px. Measured on the reports card
       grid: 18px between two rows INSIDE one grid and 26px between that grid and a differently
       named region — eight pixels to tell "these are two rows of one set" from "this is a
       different part of the page". The redesign's whole strategy is MORE named regions ("two
       regions, not one", "its own region", "each age is its own panel"), and at 24px a reader
       cannot see any of those boundaries: a screen with six named regions reads as one
       undifferentiated scroll. A structure the spacing hides is a structure nobody can act on.
       It clamps rather than sitting at 84px flat, because a phone spends its height on content:
       40px at 320, about 50px at 768, 83px at 1280, 84px above that. Whitespace is content, and
       this is the one place the product says what a boundary between regions is worth. */
    /* Refined 2026-09-23: at 84px a working page read as islands with sea between them. */
    --rw-section-gap: clamp(2rem, 4.5vw, 3.5rem);
    --rw-panel-inset: clamp(1rem, 2.5vw, 2rem);
    --rw-field-stack: 1.5rem;
    --rw-label-gap: .5rem;
    --rw-row-padding-block: .75rem;
    --rw-row-padding-inline: 1rem;
    --rw-form-measure: 42rem;
    --rw-field-measure: 32rem;
    --rw-short-field-measure: 12rem;
    --rw-reading-measure: 65ch;
    --rw-page-measure: 90rem;
    /* The public landing's wrap. Narrower than the application's working width on purpose: a
       marketing page keeps its margins, an operations screen spends them on data. */
    --rw-land-measure: 70rem;
    --rw-target-min: 3rem;
    /* The concept's radii: 12px controls, 16px panels, 20px framing cards, full pills for
       actions. The control and panel tokens were 6px/12px — the concept's skeleton without
       its roundness — and the owner's 2026-09-06 rejection named the finish, so the values
       moved to the concept's own. Consumers keep their token names. */
    --rw-radius-control: .75rem;
    --rw-radius-panel: 1rem;
    --rw-radius-frame: 1.25rem;
    --rw-radius-pill: 999px;
    /* Three elevation levels and one well. Every list has the same shape in both themes: outer
       entries first, one inset last. By day the inset is transparent; at night it is the cream
       rim that lifts a plane by light. The shape match lets the .rw-theming crossfade
       interpolate instead of snapping. */
    --rw-shadow-rest: 0 1px 2px rgb(43 38 32 / 6%), 0 10px 28px -18px rgb(43 38 32 / 28%), inset 0 1px 0 transparent;
    --rw-shadow-lift: 0 1px 2px rgb(43 38 32 / 6%), 0 6px 14px -8px rgb(43 38 32 / 14%), 0 24px 48px -28px rgb(43 38 32 / 42%), inset 0 1px 0 transparent;
    --rw-shadow-float: 0 2px 6px rgb(43 38 32 / 8%), 0 18px 40px -16px rgb(43 38 32 / 32%), inset 0 1px 0 transparent;
    /* The concept's name, kept as an alias so all fourteen existing consumers keep working and
       render byte-identical by day. It carries no night value of its own; see the dark block. */
    --rw-shadow: var(--rw-shadow-rest);
    /* The light under a public brass pill. Only ever drawn on a pseudo-element, never on the pill. */
    --rw-shadow-cta: 0 1px 2px rgb(118 85 23 / 20%), 0 10px 20px -10px rgb(118 85 23 / 55%);
    /* A recess's one cue beyond the ground step: a faint shade under its top edge. */
    --rw-well-shade: inset 0 1px 2px rgb(43 38 32 / 7%);
    /* The soft card hairline: --rw-line at 80% flattened onto parchment (1.41:1 on surface,
       1.21:1 on ground). Decorative only, and only on a surface that also casts a shadow. */
    --rw-edge: #DFD6C8;
    /* The door-band's outer ring. By day it is the panel's own colour, so it is invisible. */
    --rw-portico-edge: var(--rw-portico);
    /* The focus ring's cream halo as one value, for composites. The base rule keeps its literal. */
    --rw-focus-bands: 0 0 0 2px var(--rw-focus-light), 0 0 0 6px var(--rw-focus-light);
    /* The whisper of light into the courtyard: the warm radial the concept paints on the
       body ground. A colour token so the gradient itself can stay theme-blind. */
    --rw-ground-glow: rgb(172 132 55 / 5%);
    /* The auth brand panel's blurred light-mesh — brass lamplight and green tile-glow.
       Non-text atmosphere, like the shadow; the panel's text pairs are the opaque
       on-portico set and stay measured against the flat portico ground. */
    --rw-mesh-brass: rgb(205 168 91 / 40%);
    --rw-mesh-green: rgb(47 106 84 / 60%);
    --rw-focus-clearance: .375rem;
    --rw-sticky-clearance: 6rem;
    --rw-motion-fast: 140ms;

    /* ── THE HAND (Task 7F) ────────────────────────────────────────────────────────────────
       Six grounds, so that every control state can be drawn from the control's OWN family and
       no hover ever borrows another variant's pair. Parchment warms one step for the secondary
       and quiet controls; the recessed ground deepens one step for the rail; brass brightens;
       the danger ground deepens. Measured (day / night):
         --rw-ink on surface-hover        13.21 / 8.48     --rw-ink on surface-press  11.97 / 11.16
         --rw-ink on ground-2-hover       10.30 / 13.32
         --rw-accent-ink on accent-fill-hover  6.00 / 9.06
         --rw-danger-fg on danger-bg-hover      6.24 / 6.67 */
    --rw-surface-hover: #F6F0E4;
    --rw-surface-press: #EDE5D5;
    /* BRASS BRIGHTENS UNDER THE HAND rather than deepening, which is the conventional move and
       the concept's own instinct. Deepening it one step measures 3.97:1 against the pill's
       near-black ink and fails AA — the resting pair is only 4.91:1 to begin with, so the dark
       ink is what forces the light up rather than down. It is the better metaphor anyway: brass
       under a lamp catches more light, it does not go out. */
    --rw-accent-fill-hover: #BC9448;
    --rw-danger-bg-hover: #F2D5CD;
    --rw-ground-2-hover: #DFD5C2;
    /* The press: a cast shadow drawn inward, which is why it is a translucency like --rw-shadow
       and unlike the grounds above. It carries no colour of its own, so no variant's measured
       pair can be broken by being pressed — the destructive control included. */
    --rw-press-inset: inset 0 2px 4px -1px rgb(18 38 31 / 28%);

    /* Motion. --rw-motion-fast above already existed and is unchanged; these are named so that
       no screen invents its own. LEAVING IS FASTER THAN ARRIVING, always: by the time a thing
       leaves, the reader has already decided. */
    --rw-motion-enter: 180ms;
    --rw-motion-exit: 120ms;
    --rw-motion-theme: 220ms;
    --rw-ease-enter: cubic-bezier(.2, 0, 0, 1);
    --rw-ease-exit: cubic-bezier(.4, 0, 1, 1);
    /* THE HAND: every hover, press and tint on a control. Deliberately without box-shadow and
       outline, so a focus ring or a press never fades in, and without color, so a chosen option
       can never pass through a light-on-light frame. */
    --rw-transition-hand: background-color var(--rw-motion-fast) var(--rw-ease-enter),
                          border-color var(--rw-motion-fast) var(--rw-ease-enter),
                          translate var(--rw-motion-fast) var(--rw-ease-enter);
}
html[data-theme="dark"] {
    color-scheme: dark;
    /* GREEN AS MEANING, NOT AS MATERIAL (owner, 2026-09-24: "why is light mode so much superior";
       version B "Lifted" of six drawn on the real screens). Light mode builds its depth from warm
       neutrals and spends green only where it means something — the arch, the next class, an
       avatar, "active". Night had made green the material of everything, so the page, the rail,
       the cards, the hairlines and the secondary buttons were all green and the green that meant
       something vanished into them: the success pill measured 1.04:1 against its card, the
       avatar 1.57:1. The grounds are now a muted green-grey that steps by LIGHT — rail below
       page below card — and the saturated green and the brass are left to stand on them.
       The brand green itself (the arch, the portico, the app icon) is unchanged, as it is in
       daylight, where it sits on cream. Every pair is measured in DesignTokenTests' night table. */
    --rw-ground: #1D2A25;
    /* THE NIGHT SEPARATES BY LIGHT, NOT BY GREEN. Ground-2 was #19372C and surface #214536 —
       both lighter and more saturated than the ground, so every card read as a mid-green block
       on a dark-green page and the whole screen went flat: green on green. The concept lifts a
       surface barely off its ground (#111F19 → #182D25) and lets the shadow and the hairline do
       the separating. Recessed ground-2 now recedes instead of rising, which is what "recessed"
       means on both sides of the theme. Light ink gains contrast against both. */
    --rw-ground-2: #141E1A;
    --rw-surface: #2B3C35;
    /* And the filled green LIFTS at night rather than holding its daylight value. #1E4638 was
       written for limestone; against the night ground it sat a few points above it, so the
       focus card — the one thing on the screen a teacher is meant to see first — read as one
       more panel. The concept brightens the same green after dark for exactly this reason. */
    --rw-green: #2F6A54;
    /* Ink moves away from the ground while the fill moves toward it. 6.69:1 on --rw-surface,
       8.54 on --rw-ground, 9.79 on --rw-ground-2 — the same 8–10 band the daylight figure
       occupies, so a number carries the same weight in either theme. */
    --rw-green-ink: #8AD3B2;
    --rw-ink: #F2EBDD;
    --rw-ink-muted: #C3C0B2;
    --rw-accent-fill: #CDA957;
    --rw-accent-text: #E2BD71;
    --rw-accent-border: #CDA957;
    --rw-line: #4A5F55;
    /* Brass-lift at half strength flattened onto the night ground, the same flattening as
       the light side's hairline. */
    --rw-line-accent: #635937;
    --rw-control-border: #8C9A92;
    /* Night-side deep panels: the niche and portico ride the night ground itself, so their
       inks brighten with the accent scale.

       "THE PAIRS STAY THE MEASURED ONES" WAS NOT TRUE HERE, and Task 7F's browser matrix is what
       said so — 16 axe color-contrast failures on the entrance, every language, every width, dark
       only. Nothing had ever measured this side of the theme: the guard read :root and stopped.
       When --rw-green lifted to #2F6A54 (2026-09-07, so the focus card would stop reading as one
       more panel) these two inks kept the values written for the darker green underneath them.
       Measured on #2F6A54: the brass was 3.92:1 and the muted ink 3.94:1, both below 4.5.

       Raised to the nearest values that clear AA on the lifted green — the same adaptation the
       eyebrow already carries on limestone, where the concept's raw brass measures 2.90:1
       (task-6a-report.md). 4.67:1 and 4.68:1 now. The look follows the concept; the numbers
       follow the standard.

       AND THE REAL FINDING IS UNDERNEATH BOTH: at #2F6A54 the brightest cream on this ground is
       only 5.35:1, so the card's three ink levels compress to 4.67 / 4.68 / 5.35 and the "muted"
       ink is barely muted. The durable answer is to re-decide the night green rather than to keep
       brightening its inks — #295C49 restores brass to 4.77 and cream to 6.51 while still lifting
       2.06:1 off the night ground. That is a brand decision with a plate to check it against, so
       it is recorded in task-7f-report.md §7 for the owner rather than taken here. */
    --rw-accent-on-green: #F5DB96;
    --rw-on-green-muted: #E6DDC4;
    --rw-on-portico: #EFE6D2;
    --rw-on-portico-muted: #CFC3A6;
    --rw-accent-on-portico: #E4C982;
    --rw-nav-active-ink: #E2BD71;
    /* Night separates by light: each level keeps the concept's dark cast and adds a cream top rim,
       because a black shadow disappears on #1D2A25. */
    --rw-shadow-rest: 0 1px 2px rgb(0 0 0 / 35%), 0 14px 34px -20px rgb(0 0 0 / 70%), inset 0 1px 0 rgb(242 235 221 / 6%);
    --rw-shadow-lift: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 18px -10px rgb(0 0 0 / 55%), 0 28px 56px -28px rgb(0 0 0 / 80%), inset 0 1px 0 rgb(242 235 221 / 7%);
    --rw-shadow-float: 0 2px 6px rgb(0 0 0 / 45%), 0 22px 44px -14px rgb(0 0 0 / 80%), inset 0 1px 0 rgb(242 235 221 / 8%);
    /* Brass catches more light under the hand: at night the light under the pill is lamplight. */
    --rw-shadow-cta: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 22px -8px rgb(205 169 87 / 42%);
    --rw-well-shade: inset 0 1px 2px rgb(0 0 0 / 30%);
    /* Cream at 12% flattened onto the night surface: 1.40:1 on surface, 1.78:1 on ground. */
    --rw-edge: #435149;
    /* The portico is 1.07:1 against the night ground. The line ring is 2.17:1 against the ground
       and 2.31:1 against the portico. */
    --rw-portico-edge: var(--rw-line);
    /* The glow cools to lamplight. */
    --rw-ground-glow: rgb(205 168 91 / 4%);
    --rw-success-fg: #DCEBDD;
    --rw-success-bg: #2B6349;
    --rw-warning-fg: #F6E5B9;
    --rw-warning-bg: #634A19;
    --rw-danger-fg: #F8E1DB;
    --rw-danger-bg: #6E3235;
    --rw-info-fg: #DDECF0;
    --rw-info-bg: #2E5466;
    /* The state inks after dark: the same tone lifted off the night grounds, measured in the
       night table of DesignTokenTests. Success is --rw-green-ink itself. */
    --rw-success-ink: #7FCCAA;
    --rw-warning-ink: #F0B455;
    --rw-danger-ink: #F4ABA1;
    --rw-info-ink: #8FD3E8;
    /* Deep green disappears against night-green surfaces; brass is the fill that stands off them. */
    --rw-control-accent: #CDA957;

    /* ── THE HAND, after dark (Task 7F) ────────────────────────────────────────────────────
       The same six moves, each one taken within the night's own scale: parchment lifts one step
       off the night surface, the recessed ground sinks one step further, brass brightens again.
       Every pair is measured in the night table of DesignTokenTests, not inferred from the day. */
    --rw-surface-hover: #33463E;
    --rw-surface-press: #24332D;
    --rw-accent-fill-hover: #DCBA6C;
    --rw-danger-bg-hover: #7B3A3D;
    --rw-ground-2-hover: #1A2520;
    /* A near-black inset is invisible on a night ground, so the press shadow deepens after dark
       exactly as --rw-shadow does. Without this the press would be a state one theme has and the
       other does not. */
    --rw-press-inset: inset 0 2px 5px -1px rgb(0 0 0 / 55%);
}
