/* ----------------------------------------------------------------------------
 * ParentChill design system.
 *
 * Paul, 8 October 2026: "it looks like, as a simile, old pre-digital TV
 * standard picture. What I need it to be is modern 50fps ultra HD, smooth,
 * professional, crisp and clear."
 *
 * ⚠ THAT WAS A DIAGNOSIS, NOT A MOOD, and the stylesheet measured as follows
 * before this file existed:
 *
 *     22 distinct font sizes     including .85, .86, .87 and .88rem
 *     22 distinct spacing values essentially every number from 1 to 40
 *     11 border radii
 *      0 transitions             nothing on the screen moved, ever
 *
 * Four font sizes within 0.03rem of each other are not a type scale. They are
 * what happens when every value is nudged until that one element looks right in
 * isolation, and the result reads as amateur for a reason nobody can point at:
 * nothing lines up because nothing shares a rhythm.
 *
 * ⚠ NO BUILD STEP AND NO FRAMEWORK, by the rule in reference-parent-hub-commands
 * that has paid for itself repeatedly. So the scale is written rather than
 * installed. More work once, less work forever.
 * -------------------------------------------------------------------------- */

:root {
  /* --- Type -----------------------------------------------------------------
   * A modular scale on 1.125 (a major second), base 16px. Chosen rather than
   * 1.25 because a parent app is dense with short lines: a bigger ratio makes
   * the gap between a label and its value theatrical.
   *
   * ⚠ SEVEN STEPS, AND SEVEN ONLY. If a new size seems needed, the layout is
   * wrong, not the scale.
   */
  --t-xs:   0.79rem;   /* 12.6px  timestamps, legal small print          */
  --t-sm:   0.889rem;  /* 14.2px  secondary text, meta                   */
  --t-base: 1rem;      /* 16px    body. ⚠ never smaller: iOS zooms on
                                   focus below 16px in a form field      */
  --t-md:   1.125rem;  /* 18px    a card's own heading                   */
  --t-lg:   1.266rem;  /* 20.3px  section heading                        */
  --t-xl:   1.424rem;  /* 22.8px  screen heading                         */
  --t-2xl:  1.802rem;  /* 28.8px  ⚠ the briefing, read at arm's length   */

  /* ⚠ TWO MORE STEPS, FOR THE LANDING PAGE'S HEADLINE ONLY.
   *
   * They continue the same 1.125 ladder, so they are not an exception to the
   * scale — they are the next two rungs of it. They exist because a page whose
   * job is to make a stranger read one sentence is doing a different job from a
   * screen a parent uses every morning, and 28.8px is not a headline.
   *
   * ⚠ The app must not use them. Nothing inside the product needs type this
   * big, and reaching for one here is the same mistake as inventing a size. */
  --t-display:    2.281rem;  /* 36.5px  the landing headline on a phone     */
  --t-display-lg: 2.566rem;  /* 41px    the landing headline where there is
                                         room for it                        */

  /* Line heights. Tight for headings, open for anything read while doing
   * something else, which is the whole briefing. */
  --lh-tight: 1.2;
  --lh-snug:  1.35;
  --lh-body:  1.55;

  --w-normal: 400;
  --w-medium: 500;
  --w-semi:   600;
  --w-bold:   700;

  /* --- Space ----------------------------------------------------------------
   * One unit: 4px. Every gap is a multiple, so things line up without anybody
   * aligning them.
   */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* ⚠ The side gutter, as one token. A phone screen with different left and
   * right padding on different cards is the single most visible symptom of
   * the old stylesheet. */
  --gutter: var(--s-4);

  /* --- Shape ----------------------------------------------------------------
   * Three radii. Eleven was never a decision anybody made.
   */
  --r-sm:   8px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-full: 999px;

  /* --- Depth ----------------------------------------------------------------
   * ⚠ Shadows that imitate real light: tight and dark close to the surface,
   * wide and faint further out. One big soft shadow is what makes an interface
   * look like a 2014 template.
   */
  --e-1: 0 1px 2px rgb(27 36 32 / 0.06), 0 1px 1px rgb(27 36 32 / 0.04);
  --e-2: 0 2px 4px rgb(27 36 32 / 0.06), 0 4px 12px rgb(27 36 32 / 0.06);
  --e-3: 0 4px 8px rgb(27 36 32 / 0.07), 0 12px 28px rgb(27 36 32 / 0.09);

  /* --- Motion ---------------------------------------------------------------
   * ⚠ "50fps" is not a frame rate we set, it is the absence of jank. These
   * durations are short enough that nothing feels like waiting, and the easing
   * is asymmetric — quick to start, slow to settle — because that is how
   * physical things move and anything linear reads as mechanical.
   */
  --d-instant: 90ms;
  --d-quick:   160ms;
  --d-calm:    240ms;
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* ⚠ A tap must answer within 100ms whatever the server does. This is the
   * token every optimistic interaction uses. */
  --d-tap: var(--d-instant);
}

/* ⚠ Honour the system setting. A parent with vestibular sensitivity should not
 * have to put up with our transitions, and this is one line. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --d-instant: 1ms;
    --d-quick: 1ms;
    --d-calm: 1ms;
    --d-tap: 1ms;
  }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Crispness --------------------------------------------------------------
 * ⚠ "Ultra HD" in the things that actually make text sharp on a retina screen.
 */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  /* Antialiasing: the default on macOS renders light-on-dark text noticeably
   * heavier, which is what makes a dark theme look muddy. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* ⚠ Kerning and ligatures on. Off by default in some engines, and the
   * difference in a heading is the difference between set and typed. */
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  /* Tabular figures wherever numbers sit above one another, so a column of
   * times does not jitter. */
  font-feature-settings: 'kern' 1;
}

/* ⚠ A hairline that is actually a hairline. 1px on a 3x screen is three device
 * pixels and reads as a heavy rule; this gives a true one-device-pixel line. */
@media (min-resolution: 2dppx) {
  .hairline { border-width: 0.5px; }
}

/* --- Motion primitives ------------------------------------------------------ */

/* ⚠ Content arrives into a reserved place rather than pushing the page down.
 * Layout shift as data loads is the single biggest cause of the "janky" feeling
 * Paul described, and it is not a frame-rate problem. */
.skeleton {
  background: linear-gradient(90deg, var(--line) 25%, var(--bg) 37%, var(--line) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* A tap that answers immediately, whatever the network is doing. */
.tappable {
  transition: transform var(--d-tap) var(--ease-out),
              background-color var(--d-quick) var(--ease-out);
}
.tappable:active { transform: scale(0.97); }

/* ⚠ Only the properties the compositor can animate on its own thread. Animating
 * height, top or margin forces layout on every frame, which is exactly the
 * stutter being complained about. */
.fade-in {
  animation: fade-in var(--d-calm) var(--ease-out) both;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ⚠ A struck-through done item settles rather than snapping, because it stays
 * on the list until midnight and a parent watches it change. */
.settles {
  transition: opacity var(--d-calm) var(--ease-out),
              text-decoration-color var(--d-calm) var(--ease-out);
}

/* --- Focus ------------------------------------------------------------------
 * ⚠ One focus ring, visible on every surface including the brand green, and
 * only for keyboard users. Removing the outline is the most common
 * accessibility failure on the web and it is usually done for looks.
 */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* --- Reading ---------------------------------------------------------------- */
.prose { font-size: var(--t-base); line-height: var(--lh-body); color: var(--ink); }
.meta  { font-size: var(--t-sm);   line-height: var(--lh-snug); color: var(--ink-2); }
.fine  { font-size: var(--t-xs);   line-height: var(--lh-snug); color: var(--ink-3); }

/* ⚠ Numbers that line up in a column. A timetable of times where the digits are
 * different widths is the kind of thing nobody names and everybody feels. */
.tabular { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------------------
 * THE ONE-SCROLL HOME SCREEN
 *
 * Paul's layout, 7 October 2026: "the screen is one scroll down screen so top of
 * page is daily briefing, then timetable, then calendar, then to do list with
 * links to jump to wherever at top of page."
 * -------------------------------------------------------------------------- */

.jumpbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  /* ⚠ Measured, not guessed: at --s-2 the four chips came to 364px against a
   * 343px bar on a 375px phone, so "To do" sat half off the edge. It still
   * scrolls if a parent's font size pushes it over again. */
  gap: var(--s-1);
  padding: var(--s-2) var(--gutter);
  /* ⚠ Out through .wrap's own gutter, so the bar reaches the edges of the
   * column. Measured at 16px short on each side: a translucent sticky bar with
   * a 16px gap either side has content scrolling past it uncovered, which is
   * the one thing the blur exists to prevent. */
  margin-left: calc(var(--gutter) * -1);
  margin-right: calc(var(--gutter) * -1);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  /* ⚠ The blur is what stops text colliding with text as it scrolls under.
   * Without it a sticky bar over a scrolling list is unreadable for the half
   * second the two overlap. */
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
  /* ⚠ Scrollable sideways rather than wrapping. Four chips wrap to two lines on
   * a small phone, and a two-line sticky bar eats the screen it is helping you
   * navigate. */
  overflow-x: auto;
  scrollbar-width: none;
}
.jumpbar::-webkit-scrollbar { display: none; }

.jumpbar a {
  flex: 0 0 auto;
  padding: var(--s-1) var(--s-2);
  border-radius: var(--r-full);
  font-size: var(--t-sm);
  font-weight: var(--w-medium);
  color: var(--ink-2);
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  transition: color var(--d-quick) var(--ease-out),
              background-color var(--d-quick) var(--ease-out),
              border-color var(--d-quick) var(--ease-out);
}
.jumpbar a[aria-current='true'] {
  color: var(--on-brand);
  background: var(--brand);
  border-color: var(--brand);
}

/* ⚠ scroll-margin on the SECTION, not on its heading. The jump links target
 * the section's id, so a margin on the h2 inside it is never consulted and the
 * heading lands underneath the sticky bar. Found by tapping the links.
 * ⚠ 56px because the bar MEASURES 49 on a 375px phone — --s-7 alone left the
 * heading a pixel under it. */
/* ⚠ NO HORIZONTAL PADDING. The bands sit inside .wrap, which already supplies
 * the gutter, and adding a second one indented every line by 32px on a 375px
 * phone — 17% of the screen, on the one surface that is meant to be legible at
 * arm's length. Measured, not noticed. */
.band {
  padding: var(--s-5) 0 var(--s-2);
  scroll-margin-top: calc(var(--s-7) + var(--s-2));
}

.band > h2 {
  margin: 0 0 var(--s-3);
  font-size: var(--t-lg);
  line-height: var(--lh-tight);
  font-weight: var(--w-bold);
  color: var(--ink);
  letter-spacing: -0.01em;
}
.band + .band { border-top: 1px solid var(--line); }

/* --- The briefing ----------------------------------------------------------
 * ⚠ Read at 7am while doing something else, so it is the only part of the app
 * set at display size. Everything here is about being legible at arm's length.
 */
.briefing { padding-top: var(--s-4); }
.briefing-head {
  font-size: var(--t-2xl);
  line-height: var(--lh-tight);
  font-weight: var(--w-bold);
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-1);
}
.briefing-when {
  font-size: var(--t-sm);
  font-weight: var(--w-semi);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-ink);
  margin: 0 0 var(--s-4);
}

.brief-item {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line);
}
.brief-item:last-child { border-bottom: 0; }

/* ⚠ 44px, which is the smallest reliable touch target, and it is a real
 * checkbox rather than a styled div so it works with a screen reader and a
 * keyboard without anything extra. */
.brief-tick {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  /* ⚠ The negative left margin pulls the TAP AREA out past the text column so
   * the BOX lines up with the headings above it. Without it the padding that
   * makes the target 44px also indents the square by 8px, and it is the only
   * thing on the band that does not start on the gutter. */
  margin: calc(var(--s-1) * -1) 0 0 calc(var(--s-2) * -1);
  accent-color: var(--brand);
  /* The tap area is bigger than the box. */
  padding: var(--s-2);
  box-sizing: content-box;
}
.brief-text {
  font-size: var(--t-md);
  line-height: var(--lh-snug);
  color: var(--ink);
  padding-top: var(--s-1);
}
.brief-who {
  display: block;
  font-size: var(--t-sm);
  font-weight: var(--w-semi);
  color: var(--brand-ink);
}

/* ⚠ Done, and still there. Paul: "not removed from list until the switch over
 * at midnight." It settles rather than snapping, because a parent watches it. */
.brief-item.done .brief-text {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: var(--ink-3);
}
/* ⚠ Not the child's name. A name is not a task, and crossing out "Alice"
 * because the PE kit is packed reads very differently from what was meant. */
.brief-item.done .brief-who { text-decoration: none; }
.brief-item.done { opacity: 0.62; }

/* --- An honest empty state -------------------------------------------------
 * ⚠ Never a cheerful "all done!". An empty list a parent cannot tell apart from
 * a broken one is the failure the briefing's caveats exist to prevent.
 */
.band-empty {
  font-size: var(--t-base);
  line-height: var(--lh-body);
  color: var(--ink-2);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: var(--r-md);
  padding: var(--s-4);
  margin: 0;
}
.band-caveat {
  font-size: var(--t-sm);
  line-height: var(--lh-snug);
  color: var(--ink-2);
  margin: var(--s-3) 0 0;
  padding-left: var(--s-3);
  border-left: 2px solid var(--week-line);
}

/* ⚠ "Today" and "For tomorrow" inside the briefing. Paul's shape for it is
 * "always what you need now whats next", so both halves are on screen and
 * these two words are the whole difference between them. */
.brief-group {
  font-size: var(--t-sm);
  font-weight: var(--w-semi);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: var(--s-5) 0 var(--s-1);
}
.brief-group:first-of-type { margin-top: var(--s-2); }

/* ⚠ The strike-through settles rather than snapping on. A parent watches this
 * one happen — it is the only thing they tap on this screen — and an instant
 * change reads as a page reload rather than as their tap being understood. */
.brief-item {
  transition: opacity var(--d-calm) var(--ease-out);
}
.brief-item .brief-text {
  transition: color var(--d-calm) var(--ease-out),
              text-decoration-color var(--d-calm) var(--ease-out);
}

/* ⚠ Smooth only where the browser is allowed to animate: the reduced-motion
 * block above forces this back to auto. Needed because the jump links are plain
 * anchors — the browser does the scrolling, so this is the only place to ask. */
html { scroll-behavior: smooth; }

/* --- The ones whose date has gone ------------------------------------------
 * Paul, 8 Oct 2026, after reading it on his phone: "can we move the expired
 * things to do off the list as when you scroll down it still displays
 * everything even for dates past."
 *
 * ⚠ Folded away rather than deleted, and it reads as an aside: quieter than the
 * list above it, so a thumb on its way down the page is not stopped by it.
 */
.passed {
  margin-top: var(--s-6);
  border-top: 1px solid var(--line);
  padding-top: var(--s-4);
}
.passed > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) 0;
  font-size: var(--t-sm);
  font-weight: var(--w-semi);
  color: var(--ink-3);
}
.passed > summary::-webkit-details-marker { display: none; }
/* ⚠ A triangle that turns, because a summary with no affordance reads as a
 * heading and nobody presses it. */
.passed > summary::after {
  content: "\25b8";
  transition: transform var(--d-quick) var(--ease-out);
}
.passed[open] > summary::after { transform: rotate(90deg); }
.passed[open] > summary { color: var(--ink-2); }

/* --- The device-key fingerprint ---------------------------------------------
 * ⚠ Eight words a parent reads aloud while looking at their child's screen.
 * Set in a monospace, because the only thing that matters here is that two
 * strings are compared character by character, and proportional type with
 * ligatures is actively unhelpful for that.
 */
.fprint > summary {
  list-style: none;
  cursor: pointer;
  font-size: var(--t-sm);
  font-weight: var(--w-semi);
  color: var(--brand-ink);
  padding: var(--s-2) 0;
}
.fprint > summary::-webkit-details-marker { display: none; }
.fprint > summary::after {
  content: "\25b8";
  margin-left: var(--s-2);
  display: inline-block;
  transition: transform var(--d-quick) var(--ease-out);
}
.fprint[open] > summary::after { transform: rotate(90deg); }
.fprint-words {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--t-md);
  line-height: var(--lh-body);
  /* ⚠ Wide word spacing. Eight short words run together are read as four long
   * ones, and the whole exercise is reading them one at a time. */
  word-spacing: 0.35em;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: var(--r-sm);
  padding: var(--s-3);
  margin: 0;
  /* Selectable, so a parent can copy it if they want to compare two screens. */
  user-select: all;
}

/* --- Choosing how often the briefing arrives -------------------------------- */
.brief-opt {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: var(--s-2);
  cursor: pointer;
  transition: border-color var(--d-quick) var(--ease-out),
              background-color var(--d-quick) var(--ease-out);
}
.brief-opt:last-child { margin-bottom: 0; }
.brief-opt.is-on { border-color: var(--brand); background: var(--brand-soft); }
.brief-opt input { margin: 2px 0 0; accent-color: var(--brand); flex: 0 0 auto; }

/* --- the demo banner ------------------------------------------------------
 *
 * ⚠ IT MUST BE IMPOSSIBLE TO MISS. The demo renders the real app against made
 * up children, and a parent who mistakes Alice and Ben for their own is the
 * one outcome that is worse than having no demo. The first version had no
 * styling at all and came out 0px wide inside the layout, which is exactly
 * the failure that matters: an unlabelled demo that looks like the product.
 *
 * ⚠ Sticky, not fixed. Fixed would float over the scrolling list and cover a
 * to-do item on a short phone screen.
 */
#demoBanner {
  position: sticky;
  top: 0;
  z-index: 60;              /* above the jump bar, which sits at 20 */
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: var(--s-2) var(--gutter);
  background: var(--brand);
  color: #fff;
  font-size: var(--t-sm);
  line-height: var(--lh-snug);
  text-align: center;
}

#demoBanner a {
  color: #fff;
  font-weight: var(--w-semi);
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: var(--s-1);
}

/* --- the demo's "nothing is saved" note ----------------------------------
 *
 * ⚠ A button that looks like it worked and changed nothing is what made the
 * first demo feel broken: a visitor cannot tell our demo from our bug. This
 * says which, for anything that would have saved.
 */
#demoNote {
  position: fixed;
  left: 50%;
  bottom: var(--s-5);
  transform: translateX(-50%) translateY(var(--s-3));
  z-index: 70;                  /* above the demo banner at 60 */
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-full);
  background: var(--ink);
  color: #fff;
  font-size: var(--t-sm);
  box-shadow: var(--e-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-quick, 160ms) ease,
              transform var(--motion-quick, 160ms) ease;
}

#demoNote.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
