/* Chester — the house language, in one place.
 *
 * Taken from wonder.hereandmore.com/chester and already worn by mail: a
 * paper-white ground, a reading face for anything read at length, sans for the
 * chrome, hairlines instead of boxes, one small radius, and colour held back to
 * small accents. mail.css lifted these values by hand in July; this file exists
 * so the next surface does not have to lift them again, and so a change to the
 * language happens once rather than five times.
 *
 * HOW A SURFACE ADOPTS IT. Every surface here already names its own tokens
 * (--bg, --ink, --line, --tint …) and every rule is written against those names.
 * So a surface links this file and then maps its own names onto these values in
 * its own :root. Nothing else changes: no rule is rewritten, and a surface can
 * be reverted by deleting its map block.
 *
 * CONTRAST IS MEASURED, NOT ASSUMED. tests/audit_rooms_design.py holds text to
 * 4.5:1 and hairlines to 1.2:1, computed from the declared tokens. Chester's own
 * --muted #a3a3a3 is 2.52:1 on white -- fine for his decoration, illegal for our
 * data -- which is why --ch-body is the floor for anything a person must read.
 * Ratios on --ch-bg #ffffff:
 *   --ch-ink   #171717  15.9:1     --ch-ink-2 #262626  13.2:1
 *   --ch-body  #737373   4.74:1    --ch-muted #a3a3a3   2.52:1  decoration ONLY
 *   --ch-line  #e5e5e5   1.27:1    hairline, above the 1.2 floor
 */
/* NIGHT IS THE HOUSE DEFAULT (2026-07-31). The estate wears night on every
 * device — the OS preference no longer chooses the ground. The paper set
 * survives intact in :root[data-theme="light"], reachable only by an explicit
 * act, and print still forces paper (X6). Ratios on the night ground #0f0f10:
 *   --ch-ink 16.4:1   --ch-ink-2 13.1:1   --ch-body 5.1:1   --ch-line 1.31:1 */
:root{
  /* ground */
  --ch-bg:#0f0f10; --ch-soft:#161618; --ch-soft-2:#1c1c1f; --ch-card:#161618;
  /* ink */
  --ch-ink:#ededed; --ch-ink-2:#d4d4d4; --ch-body:#9a9a9a; --ch-muted:#6f6f6f;
  /* line */
  --ch-line:#2a2a2d; --ch-line-2:#3a3a3e;
  /* one radius, and a larger one for sheets */
  --ch-radius:10px; --ch-radius-lg:14px; --ch-radius-pill:999px;
  /* motion — the same curves the rest of the estate already uses */
  --ch-ease:cubic-bezier(.22,1,.36,1); --ch-ease-out:cubic-bezier(.16,1,.3,1);
  /* type: a reading face for prose, sans for chrome, mono for numbers */
  --ch-serif:"Iowan Old Style","Palatino Linotype",Palatino,"Times New Roman",Georgia,serif;
  --ch-read:Optima,Seravek,"Avenir Next","Segoe UI",system-ui,sans-serif;
  --ch-sans:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Helvetica,Arial,sans-serif;
  --ch-mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  /* his link decorations — accents, never surfaces */
  --ch-orange:#fb923c; --ch-sky:#38bdf8; --ch-rose:#fb7185; --ch-lime:#a3e635;
  --ch-purple:#c084fc; --ch-fuchsia:#e879f9; --ch-teal:#2dd4bf; --ch-amber:#fbbf24;

  /* A wash carries the accent as a GROUND, at the alpha where every ink still
     clears its floor on it -- not just the accent's own ink. Badges were mixing
     their own rgba by hand, each a slightly different hue from the ink sitting
     on it, and none of them measured. .12 is the measured ceiling: sky at .14
     puts --ch-body at 4.38 on --ch-soft-2 at night, and amber at .14 puts it at
     4.28. Same colours as the ramp above, so the ink and its ground agree. */
  --ch-wash-sky:rgba(56,189,248,.12);
  --ch-wash-lime:rgba(163,230,53,.12);
  --ch-wash-amber:rgba(251,191,36,.12);
  /* states: light-on-dark twins; the darkened-for-paper ramp lives in the
     day toggle below */
  --ch-ok:#4ade80; --ch-warn:#fbbf24; --ch-bad:#f87171;
}

/* ── night ──────────────────────────────────────────────────────────────────
 * Chester's own page is light only. It also does not run at 2am on someone's
 * phone, which HERE does. mail already shipped a dark theme; when the other
 * surfaces adopted this file they lost theirs, so a member opening HERE in bed
 * got a full-screen white flash. This restores it in ONE place: every surface
 * maps its own names onto these tokens, so inverting them here inverts all of
 * them, and nothing needs a second dark stylesheet.
 *
 * The language does not change at night -- reading face, hairlines, one radius,
 * colour held back. Only the ground and the ink trade places.
 * Measured on --ch-bg #0f0f10: --ch-ink 16.4:1, --ch-ink-2 13.1:1,
 * --ch-body 5.1:1, --ch-line 1.31:1 (above the 1.2 hairline floor).
 *
 * TINTS ARE TOKENS, not literals, for the same reason: a tint lifts a surface
 * off its ground, so it must flip with the ground. Ink alpha on paper, white
 * alpha at night.
 */
:root{
  --ch-tint:rgba(255,255,255,.06); --ch-tint-2:rgba(255,255,255,.10); --ch-tint-3:rgba(255,255,255,.16); --ch-tint-hi:rgba(255,255,255,.09);

  /* A GROUND at alpha, not a tint. Chrome that floats over scrolling content --
     the bottom bar, a sticky header -- needs the page's own ground held back a
     little so a blur reads through it. --ch-tint cannot serve that: it is ink
     alpha meant to LIFT a surface off its ground, and at 6% a bar is a window.
     So the veil flips with the ground, for the same reason the tints do.
     MEASURED 2026-08-13 with ops/contrast_sweep.js on the signed-in door: the
     bar carried a hardcoded rgba(255,255,255,.92) while its labels resolved to
     the night ink, so the active label sat at 1.01:1 and simply was not there. */
  --ch-veil:rgba(15,15,16,.92);
  /* The LNK signature mark is a pure-white PNG (measured: every ink pixel 255).
     White ink reads on a dark ground and vanishes on a light one, so its polarity
     is a property of the GROUND and belongs here beside the grounds — not in four
     surfaces that disagreed with each other. Two were wrong in opposite directions
     at once: welcome.html's footer mark was inverted to black and sat at 1.04:1 on
     the night ground it is actually served on. */
  --ch-sig-invert:none;
  /* the focus ring is a UI boundary: 3:1 minimum against its own ground */
  --ch-focus:#7cc4f0;
}
@media (prefers-color-scheme:dark){
  :root{
    --ch-bg:#0f0f10; --ch-soft:#161618; --ch-soft-2:#1c1c1f; --ch-card:#161618;
    --ch-ink:#ededed; --ch-ink-2:#d4d4d4; --ch-body:#9a9a9a; --ch-muted:#6f6f6f;
    --ch-line:#2a2a2d; --ch-line-2:#3a3a3e;
    --ch-tint:rgba(255,255,255,.06); --ch-tint-2:rgba(255,255,255,.10); --ch-tint-3:rgba(255,255,255,.16); --ch-tint-hi:rgba(255,255,255,.09);
    --ch-veil:rgba(15,15,16,.92);
    --ch-sig-invert:none;
    /* his decorations lift a little off a dark ground; the states are the
       light-on-dark twins of the darkened ramp above */
    --ch-ok:#4ade80; --ch-warn:#fbbf24; --ch-bad:#f87171;
    --ch-focus:#7cc4f0;   /* 8.0:1 on the night ground; #0369a1 is 2.2:1 there */
  }
}

/* ── the viewer's own choice ────────────────────────────────────────────────
 * mail lets a person pick light or dark and stamps data-theme on the root
 * (surface/mail/theme.js). A token file that only answers the OS cannot serve
 * that: choosing light inside mail would still hand back the OS's night. So the
 * attribute wins over the media query, in both directions, and an unset
 * attribute falls back to the OS exactly as before.
 */
:root[data-theme="dark"]{
  --ch-bg:#0f0f10; --ch-soft:#161618; --ch-soft-2:#1c1c1f; --ch-card:#161618;
  --ch-ink:#ededed; --ch-ink-2:#d4d4d4; --ch-body:#9a9a9a; --ch-muted:#6f6f6f;
  --ch-line:#2a2a2d; --ch-line-2:#3a3a3e;
  --ch-tint:rgba(255,255,255,.06); --ch-tint-2:rgba(255,255,255,.10); --ch-tint-3:rgba(255,255,255,.16); --ch-tint-hi:rgba(255,255,255,.09);
  --ch-veil:rgba(15,15,16,.92);
  --ch-sig-invert:none;
  --ch-ok:#4ade80; --ch-warn:#fbbf24; --ch-bad:#f87171; --ch-focus:#7cc4f0;
}
:root[data-theme="light"]{
  --ch-bg:#ffffff; --ch-soft:#fafafa; --ch-soft-2:#f5f5f5; --ch-card:#fafafa;
  --ch-ink:#171717; --ch-ink-2:#262626; --ch-body:#676767; --ch-muted:#a3a3a3;
  --ch-line:#e5e5e5; --ch-line-2:#d4d4d4;
  --ch-tint:rgba(23,23,23,.05); --ch-tint-2:rgba(23,23,23,.09); --ch-tint-3:rgba(23,23,23,.14); --ch-tint-hi:rgba(23,23,23,.07);
  --ch-veil:rgba(255,255,255,.92);
  --ch-sig-invert:invert(1);
  --ch-ok:#166534; --ch-warn:#92400e; --ch-bad:#b91c1c; --ch-focus:#0369a1;
}

/* ── X1: the first paint ────────────────────────────────────────────────────
 * The theme lives in this stylesheet, which arrives after the HTML, so until it
 * lands the browser paints its own default canvas -- white. At night that is a
 * flashbulb on every navigation. color-scheme tells the browser which canvas to
 * use BEFORE any of our CSS is parsed, so the first paint is already right.
 * The surfaces also carry <meta name="color-scheme"> for the same reason one
 * step earlier: the meta is read during head parsing, before this file returns.
 */
:root{ color-scheme: dark; }
:root[data-theme="dark"]{ color-scheme: dark; }
:root[data-theme="light"]{ color-scheme: light; }

/* ── X4: an act you cannot undo must not look like one you do daily ─────────
 * Ink is the primary, which is right -- but it had become the shape of every
 * committing action, so revoking a password wore the same black pill as
 * claiming an address. Weight still marks the ordinary primary; colour marks
 * the irreversible one, and it keeps the outline so it never reads as the
 * obvious next step.
 */
.ch-destructive{
  background:none; color:var(--ch-bad); border:1px solid var(--ch-line-2);
  border-radius:var(--ch-radius); font-weight:600; cursor:pointer;
  transition:border-color .15s var(--ch-ease),background .15s var(--ch-ease);
}
.ch-destructive:hover{ border-color:var(--ch-bad); background:var(--ch-tint); }
.ch-destructive:focus-visible{ outline:2px solid var(--ch-focus); outline-offset:2px; }

/* ── X3: figures you compare must line up ───────────────────────────────────
 * Proportional digits have different widths, so a column of them wanders.
 * Anything scanned or compared takes mono with tabular figures; the unit steps
 * back so the figure leads.
 */
.ch-num{ font-family:var(--ch-mono); font-variant-numeric:tabular-nums; }
.ch-num .unit,.ch-unit{ color:var(--ch-muted); font-family:var(--ch-sans); font-size:.82em; margin-left:3px; }

/* ── X6: paper is paper ─────────────────────────────────────────────────────
 * No surface declared a print style, so printing or saving a PDF at night
 * produced white text on a black page -- unreadable, and a cartridge of ink.
 * Print forces the paper ground whatever the screen wears, drops the chrome
 * that means nothing on paper, and keeps the hairlines that carry structure.
 */
@media print{
  :root{
    color-scheme: light;
    --ch-bg:#ffffff; --ch-soft:#ffffff; --ch-soft-2:#ffffff; --ch-card:#ffffff;
    --ch-ink:#000000; --ch-ink-2:#1a1a1a; --ch-body:#333333; --ch-muted:#555555;
    --ch-line:#cccccc; --ch-line-2:#999999;
    /* the states must come back to the paper ramp: night defaults would print
       1.7:1 green on white */
    --ch-ok:#166534; --ch-warn:#92400e; --ch-bad:#b91c1c; --ch-focus:#0369a1;
    --ch-tint:rgba(0,0,0,.04); --ch-tint-2:rgba(0,0,0,.07); --ch-tint-3:rgba(0,0,0,.11); --ch-tint-hi:rgba(0,0,0,.06);
    --ch-veil:rgba(255,255,255,1);
    --ch-sig-invert:invert(1);
  }
  body{ background:#fff !important; color:#000 !important; }
  /* chrome has no meaning on a sheet of paper. .hfullbtn earns its place here by
     measurement, not by category: ops/contrast_sweep.js on the print ground put the
     ⤢ at 2.07:1 (--ch-body #333333 over its hardcoded rgba(30,30,36,.7), which
     composites to rgb(98,98,102) on white). The literal is the real defect and lives
     in assets/igni-chat-*.css; a button that cannot be pressed on paper should not
     print either way, so this fixes the ground a member can actually reach.
     .ask joins it for a plainer reason: #ask matches nothing on any surface that
     LOADS this file. That consumer set is account/auth/git/privacy/terms/welcome
     here, plus rule_core/pages.py and ops/cafe/registry_entry.py in the rule repo,
     and not one of them carries an id="ask". glass/app_surface.py:210 DOES — a
     venue composer — but it never loads this file, so the selector is inert there.
     Stated that way on purpose: an absence is only true of a named set, and the
     first version of this comment scoped it to "the tree", which was false.
     The composer this list was aiming at is div.ask, a CLASS, built by
     igni-chat-*.js and styled inline in welcome.html, so the entry meant for it
     has never fired and every printout has carried a text input and its
     placeholder. #ask stays anyway: nothing depends on it, and deleting a selector
     is a claim about every consumer at once. glass/ also emits class="ask" in four
     places that load nothing from here — they inherit this rule, correctly, the day
     any of them adopts chester. Measured 0 failures either side of the change: the
     composer was contrast-clean on paper, so this is hygiene, not legibility. */
  .tabbar,#tabbar,.fab,.hfullbtn,.aurora,.grain,.pet,#pet,#ask,.ask,.sheetbk,nav.rail .mk{ display:none !important; }
  a{ text-decoration:underline }
  /* a card should not cost a border-box of toner */
  .card,.mc,.herecard{ box-shadow:none !important; break-inside:avoid }
}

/* ── V5: a scale, so the sixth size has an answer before anyone asks ────────
 * The sizes in use arrived one decision at a time -- 32, 27, 17, 13, 15 across
 * three faces, with no relationship between neighbouring steps. Each was chosen
 * carefully, which is why it reads well, but nothing held it together. These
 * steps sit on ~1.28, in the reading face for anything read and sans for chrome.
 */
:root{
  --ch-t1:28px;   /* the page's own name        */
  --ch-t2:21px;   /* a section that owns a card */
  --ch-t3:17px;   /* a heading inside one       */
  --ch-t4:13px;   /* a label                    */
  --ch-body-size:15px;
}

/* ── V3: copying an address should look like part of the page ───────────────
 * Selection was the operating system's blue -- a colour belonging to no one's
 * design, and loud on the night ground. An address is copied far more often
 * than it is read, so the highlight is quiet and ours.
 */
::selection{ background:var(--ch-soft-2); color:var(--ch-ink); }
::-moz-selection{ background:var(--ch-soft-2); color:var(--ch-ink); }

/* ── V4: say you are leaving before the click, not after ────────────────────
 * These surfaces span several origins and one of them signs you in, so an
 * outbound link should not look identical to an in-page one. The mark is on the
 * link, not a tooltip: it is readable, it copies, and it survives a screenshot.
 * Same-family hosts (mail., everything.) are not marked -- they are still us.
 */
a[href^="http"]:not([href*="hereandmore.com"]):not(.ch-nomark)::after{
  content:" \2197"; color:var(--ch-muted); font-size:.85em; text-decoration:none;
}
a[href^="http"]:not([href*="hereandmore.com"]):hover{ text-decoration-color:var(--ch-ink); }

/* ── V1: press-blocked must never look like paint-broken ────────────────────
 * A primary faded to 35% composites to grey-on-grey at night and reads as a
 * rendering fault. A disabled control gets its OWN quiet treatment, at full
 * opacity, so it looks deliberate -- and it should be accompanied by a line
 * saying what would enable it.
 */
.ch-disabled,button:disabled.ch-btn{
  opacity:1; background:var(--ch-soft-2); color:var(--ch-muted);
  border:1px solid var(--ch-line); cursor:not-allowed;
}
.ch-hint{ font:400 12.5px/1.5 var(--ch-read); color:var(--ch-body); margin-top:7px; }
