/* ============================================================================
   Genaya's Hub — shell stylesheet
   CP2 (the Today shell). Static: no backend, no auth, sample data in-page.

   POINT OF VIEW (blueprint §12, green-lit 2026-07-26):
   "A calm white page that answers 'what now?' in one glance — and opens into a
   real workbench only when she's actually working."
   Calm beats complete on Today. Function beats calm inside Bakes.

   ⚠ TOKENS ARE THE ONLY PLACE A RAW HEX MAY APPEAR IN THIS FILE.
     Everything below the token block resolves through var(). The CP2 gate is a
     hex grep proving exactly that — if you add a colour anywhere else, the gate
     fails and it deserves to.

   ⚠ NIGHT MODE IS BLACK AND WHITE (Sami's ruling, 2026-07-26). It supersedes
     the proposed warm charcoal. The honest trade is stated rather than absorbed:
     PINK LARGELY DISAPPEARS AT NIGHT. It is kept for exactly two jobs that
     nothing else can carry — the primary action, and "the hub wrote this."
     Do not reintroduce pink to night surfaces, borders, or labels.
   ========================================================================= */

/* ---------------------------------------------------------------- fonts -- */
/* Self-hosted. No CDN: these pages must open by double-clicking the file, and
   a CDN link is dead there. Verified 2026-07-26 that @font-face on a relative
   path DOES load under file:// (document.fonts.check true, width differs from
   the serif control). Fallback stack is still real, not decorative. */
@font-face {
  font-family: "Work Sans";
  src: url("../fonts/WorkSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("../fonts/WorkSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------- tokens -- */
:root {
  /* Type — one family, six sizes. Display is one ROLE that grows at desktop. */
  --font: "Work Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --t-xs: 13px;
  --t-sm: 15px;
  --t-md: 16px;
  --t-lg: 20px;
  --t-xl: 26px;
  --t-display: 30px;

  /* Space — 4/8 scale. Proximity law: intra-group space < inter-group space. */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* Corners — one soft language. */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;

  /* Motion — restrained, and now ONLY feedback. The page's earned moment is
     the sentence CHANGING to "That's everything." — language, not movement.
     (`--dur-settle` lived here until 2026-07-27; the settle it drove was cut
     because an opacity:0 entrance on the sentence read as a page reload.) */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-micro: 120ms;

  --measure: 680px;
  --tap: 44px; /* minimum touch target */
}

/* DAY — warm paper, pink-tinted grays. A dead #888 gray is the amateur tell,
   so every neutral below carries a trace of the brand hue. */
:root,
:root[data-mode="day"] {
  --paper: #fbf8f6;
  --surface: #ffffff;
  --surface-sunk: #f5efec;
  --ink-900: #241c1f;
  --ink-700: #4b3f44;
  --ink-500: #7c6d73;
  --ink-400: #9a8b91;
  --ink-300: #c0b2b7;
  --line: #ece2e5;
  --line-strong: #dfd1d6;

  --accent: #c2416f;        /* dusty rose — 4.64:1 on paper */
  --accent-ink: #ffffff;    /* text ON the accent — 4.91:1 */
  --accent-quiet: #f7e8ee;  /* accent wash, never a text colour */

  --focus: #c2416f;
  --shadow-card: 0 1px 2px rgba(36, 28, 31, 0.05), 0 4px 16px rgba(36, 28, 31, 0.05);
}

/* NIGHT — near-black NEUTRAL, not #000 (pure black haloes against off-white
   text). Greys are genuinely neutral here: this mode is a legibility surface,
   not an expressive one. */
:root[data-mode="night"] {
  --paper: #141414;
  --surface: #202020;       /* cards read as a lighter surface, not a shadow */
  --surface-sunk: #171717;
  --ink-900: #ededed;       /* not pure #fff — halation */
  --ink-700: #c6c6c6;
  --ink-500: #9a9a9a;
  --ink-400: #7e7e7e;
  --ink-300: #5e5e5e;
  --line: #2f2f2f;
  --line-strong: #3d3d3d;

  --accent: #e48bab;        /* desaturated — high chroma vibrates on dark */
  --accent-ink: #141414;    /* dark text on the light accent */
  --accent-quiet: #2b2126;

  --focus: #e48bab;
  /* Elevation on dark is a LIGHTER SURFACE, not a bigger shadow. */
  --shadow-card: none;
}

/* ----------------------------------------------------------------- base -- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-900);
  font: 400 var(--t-md)/1.5 var(--font);
  letter-spacing: 0.005em;
  min-height: 100vh;
  padding-bottom: calc(var(--tap) + var(--s-6));  /* room for the fixed tab bar */
}

h1, h2, h3, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }

a { color: inherit; }

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

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--s-4);
}

/* --------------------------------------------------------------- topbar -- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-5);
  padding-bottom: var(--s-5);
}

.wordmark {
  font-size: var(--t-sm);
  color: var(--ink-500);
  letter-spacing: 0.02em;
}

.mode-btn {
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-700);
  cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease),
              color var(--dur-micro) var(--ease);
}
.mode-btn:hover { border-color: var(--ink-400); color: var(--ink-900); }
.mode-btn svg { width: 18px; height: 18px; display: block; }

/* One icon per mode; CSS decides which is real. */
:root[data-mode="day"] .mode-btn .icon-day { display: none; }
:root[data-mode="night"] .mode-btn .icon-night { display: none; }

/* ------------------------------------------------------- the day header -- */
.eyebrow {
  font-size: var(--t-xs);
  color: var(--ink-500);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* THE SIGNATURE ASSET. A sentence, never a stat-tile grid.
   It must survive zero data — that is the whole point of it (§15). */
.sentence {
  font-size: var(--t-display);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink-900);
  margin-top: var(--s-2);
  text-wrap: balance;
}

/* The sentence is built from two parts so a narrow screen breaks it where the
   MEANING breaks — the day, then the answer. Left to wrap on its own it split
   as "Sunday. Four / things due.", which balances the line lengths and severs
   the phrase. At desktop there is room for one line and it closes back up. */
.sentence-day,
.sentence-rest { display: block; }

.sentence-sub {
  margin-top: var(--s-3);
  font-size: var(--t-md);
  color: var(--ink-500);
  max-width: 34ch;
}

/* ------------------------------------------------------------- actions -- */
.actions {
  margin-top: var(--s-5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

.btn-primary,
.btn-secondary {
  font: 400 var(--t-sm)/1 var(--font);
  min-height: var(--tap);
  padding: 0 var(--s-4);
  border-radius: var(--r-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  text-decoration: none;
  transition: transform var(--dur-micro) var(--ease),
              background-color var(--dur-micro) var(--ease),
              border-color var(--dur-micro) var(--ease);
}

/* Pink's first job: the one primary action. Survives night mode by design. */
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
}
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink-700);
  border: 1px solid var(--line-strong);
}
.btn-secondary:hover { border-color: var(--ink-400); color: var(--ink-900); }

/* Honest note for a control whose destination does not exist yet.
   Never a dead end, never a lie about what happened. */
.action-note {
  margin-top: var(--s-3);
  font-size: var(--t-xs);
  color: var(--ink-500);
  max-width: 42ch;
}
.action-note[hidden] { display: none; }

/* ------------------------------------------------------------ day list -- */
.day { margin-top: var(--s-6); }

.group + .group { margin-top: var(--s-5); }   /* inter-group > intra-group */

.group-label {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-400);
  padding: 0 var(--s-4) var(--s-2);
}

.rows {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Top-aligned, not centred. A deadline title long enough to wrap is ordinary
   content here, and centring floats the tick and the due-time into the middle
   of the paragraph instead of attaching them to the thing they belong to.
   Row height comes from padding rather than a min-height so a one-line row and
   a four-line row are the same component. */
.row {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 0 var(--s-4);
}
.row + .row { border-top: 1px solid var(--line); }

.row-label {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
  padding: var(--s-4) 0;
}

.row-check {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  margin-top: 1px;          /* optical centre on the FIRST line, not the block */
  border: 1.5px solid var(--ink-300);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color var(--dur-micro) var(--ease),
              background-color var(--dur-micro) var(--ease);
}
/* A tick, not a filled dot. The dot version read as a radio/record button —
   ambiguous is a defect on a control whose whole job is "done / not done". */
.row-check::after {
  content: "";
  width: 5px;
  height: 9px;
  margin-top: -2px;
  border: solid var(--surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform var(--dur-micro) var(--ease);
}
.row-check:checked {
  background: var(--ink-700);
  border-color: var(--ink-700);
}
.row-check:checked::after { transform: rotate(45deg) scale(1); }

.row-text {
  font-size: var(--t-sm);
  color: var(--ink-900);
  transition: color var(--dur-micro) var(--ease);
  overflow-wrap: anywhere;
}

/* The routine check is QUIET. Nothing slides, nothing bounces — the ink just
   settles back. THIS IS THE HALF OF THE MOTION DESIGN THAT WORKED and it stays:
   it says "your tap registered," which is feedback rather than celebration. */
.row-check:checked ~ .row-text {
  color: var(--ink-400);
  text-decoration: line-through;
  text-decoration-color: var(--ink-300);
}

.row-meta {
  flex: 0 0 auto;
  font-size: var(--t-xs);
  color: var(--ink-500);
  white-space: nowrap;
  padding: var(--s-4) 0;
  margin-top: 2px;          /* sits on the first line's baseline */
}

/* An informational row — real content, nothing to check. */
.row-note { padding: var(--s-4); }
.row-note .row-meta { padding: 0; margin-top: 0; }
.row-note .row-text { color: var(--ink-700); }

/* PINK'S SECOND JOB, and the only other place it survives night mode:
   "the hub wrote this." Established here so it is already consistent when the
   calendar lands and this dot starts meaning "we put this in your iCloud." */
.row-mark {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: var(--s-1);
}

.group-foot {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-4) 0;
  font-size: var(--t-xs);
  color: var(--ink-500);
}
.group-foot .row-mark { margin-left: 0; }

/* ------------------------------------------------------- empty states --- */
/* A quiet filled panel, not a dashed outline. Dashes read as a drop-zone or an
   unfinished placeholder; this state is finished, it just has nothing in it. */
.empty-note {
  margin-top: var(--s-6);
  padding: var(--s-5);
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  color: var(--ink-500);
  max-width: 46ch;
}
.empty-note[hidden] { display: none; }

/* ---------------------------------------------------------- stub pages -- */
.stub { padding-top: var(--s-6); }
.stub-title {
  font-size: var(--t-xl);
  font-weight: 400;
  letter-spacing: -0.01em;
}
.stub-lead {
  margin-top: var(--s-3);
  font-size: var(--t-md);
  color: var(--ink-700);
  max-width: 40ch;
}
.stub-status {
  margin-top: var(--s-5);
  display: inline-block;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  font-size: var(--t-xs);
  color: var(--ink-500);
}
.stub-actions { margin-top: var(--s-6); }

/* ------------------------------------------------------------ tab bar --- */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab {
  flex: 1 1 0;
  min-height: var(--tap);
  display: grid;
  place-items: center;
  padding: var(--s-2) var(--s-1);
  font-size: var(--t-xs);
  color: var(--ink-500);
  text-decoration: none;
  transition: color var(--dur-micro) var(--ease);
}
.tab:hover { color: var(--ink-900); }

.tab[aria-current="page"] {
  color: var(--ink-900);
  font-weight: 700;
  box-shadow: inset 0 2px 0 0 var(--ink-900);
}

/* ------------------------------------------------------------ desktop --- */
@media (min-width: 720px) {
  :root { --t-display: 38px; }

  body { padding-bottom: var(--s-8); }

  .sentence-day,
  .sentence-rest { display: inline; }

  .topbar { padding-top: var(--s-6); }

  /* Same DOM, different home: the bar leaves the bottom and joins the header
     column. It is a reflow, not a second nav. */
  .tabs {
    position: static;
    max-width: var(--measure);
    margin: 0 auto var(--s-7);
    padding: 0 var(--s-4);
    background: transparent;
    border-top: 0;
    border-bottom: 1px solid var(--line);
    gap: var(--s-5);
  }
  .tab {
    flex: 0 0 auto;
    place-items: start;
    padding: 0 0 var(--s-3);
    font-size: var(--t-sm);
  }
  .tab[aria-current="page"] {
    box-shadow: inset 0 -2px 0 0 var(--ink-900);
  }

  .day { margin-top: var(--s-7); }
}

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