@charset "UTF-8";
/* ==========================================================================
   Hääpäivä — app.css   (theme lane E)
   Plain CSS, no build step, no webfonts, no remote assets.

   "White wedding": ivory ground, thin warm-grey rules, ONE champagne gold
   accent, serif for anything read aloud. The venue is dim and the phone is at
   arm's length, so legibility always beats prettiness.

   1 tokens · 2 reset · 3 page · 4 nav · 5 type · 6 clock+drift · 7 cards
   8 bar · 9 script · 10 chips · 11 list · 12 times · 13 buttons · 14 controls
   15 pills · 16 banners · 17 forms · 18 tasklist · 19 details · 20 utilities
   21 laptop (>=720px) · 22 reduced motion · 23 colour scheme
   ========================================================================== */

/* --- 1. Design tokens — SPEC.md §7 --------------------------------------- */

:root {
  /* Colour */
  --bg:          #FDFCF9;   /* ivory page */
  --surface:     #FFFFFF;
  --surface-alt: #FAF7F1;
  --ink:         #23201C;
  --ink-soft:    #6B6357;
  --ink-faint:   #9C948A;   /* 2.9:1 — NON-TEXT only: hairlines, strike colour */
  --rule:        #E7E1D8;   /* thin warm grey */
  --gold:        #C8A96B;   /* the one accent */
  --gold-deep:   #A5842F;   /* large text, borders, focus rings */
  --gold-soft:   #F5EEDD;
  --ok:          #3F6B4C;
  --ok-soft:     #EAF1EA;
  --warn:        #9A6510;
  --warn-soft:   #FBF1DD;
  --bad:         #9E3226;
  --bad-soft:    #FAE9E6;
  --shadow:      0 1px 2px rgba(35,32,28,.05), 0 6px 20px rgba(35,32,28,.05);

  /* Derived text tones. --gold-deep is 3.5:1 on white and --warn is 4.4:1 on
     --warn-soft: fine for large text, borders and icons, short of 4.5:1 for
     body copy. These two darker siblings carry the accent at small sizes. */
  --gold-ink:   #856823;    /* 5.25:1 on white, 4.54:1 on --gold-soft */
  --warn-ink:   #85560D;    /* 6.14:1 on --bg, 5.62:1 on --warn-soft */
  --gold-press: #BC9A57;    /* .btn--primary :active, 6.1:1 with --ink */

  /* Person palette — pale fill, darker border, dark text. The name is ALWAYS
     printed inside the chip; colour is never the only signal. */
  --p-sage-fill:#E4EEE4;       --p-sage-border:#5F8465;       --p-sage-text:#28402D;
  --p-rose-fill:#F6E5E7;       --p-rose-border:#A26873;       --p-rose-text:#48262C;
  --p-periwinkle-fill:#E5E9F7; --p-periwinkle-border:#6874A4; --p-periwinkle-text:#28304E;
  --p-champagne-fill:#F6EEDA;  --p-champagne-border:#A0854A;  --p-champagne-text:#453718;
  --p-lavender-fill:#EEE7F4;   --p-lavender-border:#7D6A9C;   --p-lavender-text:#372A46;
  --p-terracotta-fill:#F8E6DC; --p-terracotta-border:#A26547; --p-terracotta-text:#4A2819;
  --p-teal-fill:#DFEEEE;       --p-teal-border:#487F7F;       --p-teal-text:#1C3A3A;
  /* Added for the wider circle the xlsx brings in: the couple and the parents.
     Same recipe as above — very pale fill, darker border, dark text — so every
     one of them clears AA against its own fill. Hues are spread as far apart as
     thirteen pale tones allow; the person's NAME is always printed in the chip,
     so colour never has to carry the meaning alone. */
  --p-plum-fill:#F1E6EE;       --p-plum-border:#8B6182;       --p-plum-text:#3D2438;
  --p-mist-fill:#E4EBEF;       --p-mist-border:#5C7A8A;       --p-mist-text:#22343D;
  --p-moss-fill:#E9EDE1;       --p-moss-border:#6A7C4F;       --p-moss-text:#2D3820;
  --p-honey-fill:#F9EBD8;      --p-honey-border:#A2763B;      --p-honey-text:#452F12;
  --p-dove-fill:#E9E8E6;       --p-dove-border:#767068;       --p-dove-text:#2F2B26;
  --p-indigo-fill:#E3E4F2;     --p-indigo-border:#5A5F96;     --p-indigo-text:#242747;
  --p-pine-fill:#E1EBE6;       --p-pine-border:#4C7A69;       --p-pine-text:#1D392F;

  /* Type — system stacks only */
  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", Times, serif;
  --font-ui:    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Spacing and shape */
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px; --s7:48px;
  --r:10px; --r-pill:999px;

  /* Layout + motion */
  --page-max: 560px;        /* widened in the laptop layer */
  --page-pad: var(--s4);
  --measure:  32em;         /* reading measure for the spoken lines */
  --t: 120ms;               /* single motion knob, zeroed by §22 */

  color-scheme: light;      /* see §23 */
}

/* --- 2. Reset and base --------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-ui);
  /* Long Finnish compounds must never open a horizontal scrollbar at 375px. */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

/* Nothing may be wider than its container. */
img, svg, video, table { max-width: 100%; }
img, svg { height: auto; }
pre, code { max-width: 100%; overflow-x: auto; }
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s5) 0; }
a { color: var(--gold-ink); }

/* One focus ring for the whole app. --gold-deep rather than --gold because the
   ring itself must clear 3:1 on ivory (3.45:1 vs 2.19:1). */
:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--gold-soft); color: var(--ink); }

/* --- 3. Page layout ------------------------------------------------------ */

.page {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--page-pad);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
/* Inline content in the head is centred (clock, drift, title, nav); block
   children keep their own width. */
.page__head {
  padding: var(--s5) 0 var(--s4);
  margin-bottom: var(--s5);
  border-bottom: 1px solid var(--rule);
  text-align: center;
}

/* The navigation bar is pinned: on a phone you are usually scrolled deep into
   a 37-row day, and the time, how late you are running, and the way back to
   another view all have to stay one glance away. Kept deliberately short —
   every pixel it takes is a pixel of run sheet. */
.page__head--bar {
  position: sticky;
  top: 0;
  z-index: 40;
  margin-bottom: var(--s4);
  padding: 0 var(--page-pad);
  background: var(--bg);
  box-shadow: 0 1px 0 var(--rule);
  /* Notched phones in landscape. */
  padding-left: max(var(--page-pad), env(safe-area-inset-left));
  padding-right: max(var(--page-pad), env(safe-area-inset-right));
}
/* Four links plus a clock is a lot for 360px, so the bar is trimmed hard and
   allowed to wrap as a last resort. Wrapping to two short rows is ugly;
   overflowing the viewport is broken. */
.page__head--bar .nav {
  justify-content: flex-start;
  gap: 2px;
  flex-wrap: wrap;
  row-gap: 0;
}
.page__head--bar { padding-inline: var(--s2); }
.page__head--bar .nav__link { min-height: 44px; padding: 0 6px; font-size: 15px; }

/* Compact clock inside the pinned bar. Allowed to shrink before anything wraps. */
.nav__now {
  display: inline-flex; align-items: baseline; gap: var(--s1);
  margin-left: auto; white-space: nowrap; min-width: 0;
}
.nav__clock {
  font-family: var(--font-serif); font-size: 18px; font-variant-numeric: tabular-nums;
  color: var(--ink); letter-spacing: .01em; flex: 0 0 auto;
}
/* Tighter than a normal drift pill — it is riding in a 44px bar, and a wild
   number ("+569 min" while rehearsing) must not push the links onto a second row. */
.nav__drift {
  font-size: 12px; padding: 0 5px; border-width: 1px;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; max-width: 11ch;
}

/* On a small phone the admin's four links plus the clock are a tight fit, so
   the bar tightens rather than wrapping to a second row and stealing 40px of
   run sheet. */
@media (max-width: 400px) {
  .page__head--bar .nav__link { font-size: 14px; padding: 0 4px; }
  .nav__clock { font-size: 17px; }
  .nav__drift { max-width: 9ch; }
}

/* Anchor jumps (Roolit -> a timetable row) must not land under the pinned bar. */
html { scroll-padding-top: 64px; }
.page__body { flex: 1 1 auto; min-width: 0; text-align: left; padding-bottom: var(--s5); }
.page__foot { margin-top: auto; padding-inline: 0; }  /* .controls bleeds, see §14 */
.page__head .banner, .page__head .card, .page__head .list { text-align: left; }

/* --- 4. Nav — "Ajo · Muokkaa · Roolit" ----------------------------------- */

.nav {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: var(--s1); margin: 0; padding: 0; list-style: none;
  font-family: var(--font-ui); color: var(--ink-faint);
}
.nav__link {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 var(--s3);
  color: var(--ink-soft); font-size: 16px; text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color var(--t) linear, border-color var(--t) linear;
}
.nav__link--active { color: var(--ink); font-weight: 600; border-bottom-color: var(--gold); }
.nav__link:active { color: var(--ink); }
@media (hover: hover) { .nav__link:hover { color: var(--ink); } }

/* --- 5. Typography ------------------------------------------------------- */

h1, h2, h3, h4 {
  margin: 0 0 var(--s3);
  font-family: var(--font-serif); font-weight: 400; line-height: 1.2;
  color: var(--ink); overflow-wrap: break-word;
}
h1 { font-size: 26px; letter-spacing: .005em; }
h2 { font-size: 20px; }
h3 { font-size: 19px; }          /* event title */
h4 { font-size: 17px; }
p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }
small, .meta { font-family: var(--font-ui); font-size: 14px; line-height: 1.45; color: var(--ink-soft); }

/* Small all-caps label: "Sanottavaa", "Vastuuhenkilöt", "Muistiinpanot".
   14px is this app's floor, so tracking does the work, not size. */
.label, .script > h2, .script > h3, .script > h4 {
  margin: 0 0 var(--s2);
  font-family: var(--font-ui); font-size: 14px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft);
}
.tnum, .num { font-variant-numeric: tabular-nums; }

/* --- 6. Clock and drift — the hero --------------------------------------- */

.clock {
  display: block; text-align: center; margin: 0 0 var(--s3);
  font-family: var(--font-serif); line-height: 1;
  /* Scales with the viewport instead of a fixed 64px: fills a 430px phone,
     and stops a 320px one from wrapping the time onto two lines. */
  font-size: clamp(46px, 17vw, 64px);
  letter-spacing: -.015em; color: var(--ink);
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
.clock__hm { font-size: 1em; font-variant-numeric: tabular-nums; }
/* Seconds are along for the ride, not the message. */
.clock__s {
  font-size: .40em; color: var(--ink-soft); letter-spacing: 0;
  margin-left: .1em; font-variant-numeric: tabular-nums;
}
.drift {
  display: inline-flex; align-items: center; gap: var(--s2);
  max-width: 100%; padding: 5px var(--s3);
  border: 1px solid var(--rule); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink-soft);
  font-family: var(--font-ui); font-size: 16px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.drift--ok { color: var(--ink-soft); border-color: var(--rule); background: var(--surface); }
.drift--behind { color: var(--warn-ink); border-color: var(--warn); background: var(--warn-soft); font-weight: 600; }
.drift--ahead { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }

/* --- 7. Cards ------------------------------------------------------------ */

.card {
  margin: 0 0 var(--s4); padding: var(--s4);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  min-width: 0; overflow-wrap: break-word;
}
.card > :last-child { margin-bottom: 0; }
.card h2, .card h3 { font-family: var(--font-serif); }

/* "Nyt käynnissä" — the one card allowed to shout, quietly. */
.card--now {
  padding: var(--s5) var(--s4);
  border-color: var(--rule); border-top: 3px solid var(--gold);
  box-shadow: var(--shadow);
}
.card--now h2 { font-size: 22px; }

/* "Seuraavaksi" — present but recessive. */
.card--next { background: var(--surface-alt); border-color: var(--rule); box-shadow: none; }

/* Anchor buffer notice — compact, gold rule, no fill by default. */
.card--anchor {
  padding: var(--s3) var(--s4);
  background: var(--surface-alt); border-left: 4px solid var(--gold-deep);
  font-family: var(--font-ui); font-size: 16px;
}
/* Tolerant level modifiers (buffer running out / anchor already late). */
.card--warn, .card--anchor.is-warn {
  background: var(--warn-soft); border-color: var(--warn);
  border-left-color: var(--warn); color: var(--ink);
}
.card--bad, .card--anchor.is-late {
  background: var(--bad-soft); border-color: var(--bad);
  border-left-color: var(--bad); color: var(--ink);
}

/* --- 8. Progress bar — .bar__fill width is set inline by the markup ------- */

.bar {
  position: relative; display: block; width: 100%; height: 10px;
  margin: var(--s3) 0; border-radius: var(--r-pill);
  background: var(--surface-alt); box-shadow: inset 0 0 0 1px var(--rule);
  overflow: hidden;              /* an uncapped percent > 100 simply clips */
}
/* No width declared here: the inline style owns it. max-width stops an
   overrun bar from ever widening the layout. */
.bar__fill {
  display: block; height: 100%; max-width: 100%;
  border-radius: inherit; background: var(--gold);
  transition: width var(--t) linear, background-color var(--t) linear;
}
/* Level lives on the block per BEM; tolerate it on the fill too. */
.bar--ok .bar__fill,   .bar__fill.bar--ok   { background: var(--gold); }
.bar--warn .bar__fill, .bar__fill.bar--warn { background: var(--warn); }
.bar--over .bar__fill, .bar__fill.bar--over { background: var(--bad); }
.bar--over { box-shadow: inset 0 0 0 1px var(--bad); }

/* --- 9. Script — the spoken lines. Second hero. -------------------------- */

.script {
  margin: var(--s4) 0; padding-left: var(--s4); min-width: 0;
  border-left: 2px solid var(--gold);   /* gold = "say this out loud" */
}
.script:last-child { margin-bottom: 0; }
.script__line {
  margin: 0 0 var(--s3); max-width: var(--measure);
  font-family: var(--font-serif); font-size: 20px; line-height: 1.45;
  color: var(--ink); overflow-wrap: break-word;
}
.script__line:last-child { margin-bottom: 0; }
.card--next .script__line { color: var(--ink); }
.list__item .script__line { font-size: 18px; }   /* one notch down inside a row */

/* --- 10. Chips — person palette. Name always visible. -------------------- */

.chip {
  display: inline-flex; align-items: center; gap: var(--s2);
  max-width: 100%; padding: 3px var(--s3);
  border: 1px solid var(--rule); border-radius: var(--r-pill);
  background: var(--surface-alt); color: var(--ink);
  font-family: var(--font-ui); font-size: 14px; line-height: 1.4; font-weight: 600;
  white-space: nowrap;            /* never break a name across lines */
  vertical-align: middle; text-decoration: none;
}
.chip__dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: .85; }
/* Ellipsis is the last-resort guard against horizontal overflow. */
.chip__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Optional container; chips also space themselves without it. */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.chip + .chip { margin-left: var(--s2); }
.chips .chip + .chip { margin-left: 0; }

.chip--sage       { background: var(--p-sage-fill);       border-color: var(--p-sage-border);       color: var(--p-sage-text); }
.chip--rose       { background: var(--p-rose-fill);       border-color: var(--p-rose-border);       color: var(--p-rose-text); }
.chip--periwinkle { background: var(--p-periwinkle-fill); border-color: var(--p-periwinkle-border); color: var(--p-periwinkle-text); }
.chip--champagne  { background: var(--p-champagne-fill);  border-color: var(--p-champagne-border);  color: var(--p-champagne-text); }
.chip--lavender   { background: var(--p-lavender-fill);   border-color: var(--p-lavender-border);   color: var(--p-lavender-text); }
.chip--terracotta { background: var(--p-terracotta-fill); border-color: var(--p-terracotta-border); color: var(--p-terracotta-text); }
.chip--teal       { background: var(--p-teal-fill);       border-color: var(--p-teal-border);       color: var(--p-teal-text); }
.chip--plum       { background: var(--p-plum-fill);       border-color: var(--p-plum-border);       color: var(--p-plum-text); }
.chip--mist       { background: var(--p-mist-fill);       border-color: var(--p-mist-border);       color: var(--p-mist-text); }
.chip--moss       { background: var(--p-moss-fill);       border-color: var(--p-moss-border);       color: var(--p-moss-text); }
.chip--honey      { background: var(--p-honey-fill);      border-color: var(--p-honey-border);      color: var(--p-honey-text); }
.chip--dove       { background: var(--p-dove-fill);       border-color: var(--p-dove-border);       color: var(--p-dove-text); }
.chip--indigo     { background: var(--p-indigo-fill);     border-color: var(--p-indigo-border);     color: var(--p-indigo-text); }
.chip--pine       { background: var(--p-pine-fill);       border-color: var(--p-pine-border);       color: var(--p-pine-text); }

/* The dot takes the border tone so it stays visible on the pale fill. */
.chip--sage .chip__dot       { background: var(--p-sage-border); }
.chip--rose .chip__dot       { background: var(--p-rose-border); }
.chip--periwinkle .chip__dot { background: var(--p-periwinkle-border); }
.chip--champagne .chip__dot  { background: var(--p-champagne-border); }
.chip--lavender .chip__dot   { background: var(--p-lavender-border); }
.chip--terracotta .chip__dot { background: var(--p-terracotta-border); }
.chip--teal .chip__dot       { background: var(--p-teal-border); }
.chip--plum .chip__dot       { background: var(--p-plum-border); }
.chip--mist .chip__dot       { background: var(--p-mist-border); }
.chip--moss .chip__dot       { background: var(--p-moss-border); }
.chip--honey .chip__dot      { background: var(--p-honey-border); }
.chip--dove .chip__dot       { background: var(--p-dove-border); }
.chip--indigo .chip__dot     { background: var(--p-indigo-border); }
.chip--pine .chip__dot       { background: var(--p-pine-border); }

/* Person section headers on roles.php reuse the palette at block size. */
.chip--block {
  display: flex; border-radius: var(--r); padding: var(--s3) var(--s4);
  font-family: var(--font-serif); font-size: 20px; font-weight: 400; white-space: normal;
}

/* --- 11. Timetable list -------------------------------------------------- */

.list { margin: 0 0 var(--s5); padding: 0; list-style: none; }
.list__item {
  position: relative; padding: var(--s3) var(--s2);
  border-top: 1px solid var(--rule);
  border-left: 4px solid transparent;   /* reserved so --running never shifts */
  min-width: 0; overflow-wrap: break-word;
}
.list__item:first-child { border-top: 0; }
.list__item h3, .list__item h4 { margin-bottom: var(--s1); }

/* Running: gold left rule plus the faintest champagne wash. */
.list__item--running { border-left-color: var(--gold); background: var(--gold-soft); }
.list__item--running h3, .list__item--running h4 { font-weight: 700; }

/* Done: receded but never light-grey-on-white — --ink-soft is 5.8:1. */
.list__item--done { color: var(--ink-soft); background: transparent; }
.list__item--done h3, .list__item--done h4,
.list__item--done .time, .list__item--done .time--projected {
  color: var(--ink-soft); font-weight: 400;
}

/* Skipped: struck through. .chip/.btn/.pill/.time/.badge are atomic inline
   boxes (inline-flex / inline-block), so the line does not run through them. */
.list__item--skipped {
  color: var(--ink-soft);
  text-decoration: line-through; text-decoration-thickness: 1px;
  text-decoration-color: var(--ink-faint);
}
.list__item--skipped h3, .list__item--skipped h4 { color: var(--ink-soft); }

/* Anchored: the planned time IS the promise, so it carries the accent even
   when the markup omits a separate badge element. */
.list__item--anchored .time--planned { color: var(--gold-ink); font-weight: 700; }

/* Calle's juonto moments. A gold left rule and a warm ground so they can be
   found by thumb-scrolling a 37-row day without reading a single word. */
.list__item--hosting {
  background: var(--gold-soft);
  border-left: 4px solid var(--gold-deep);
  padding-left: var(--s3);
  border-radius: var(--r);
}
.list__item--hosting .list__title { font-weight: 700; }

/* Reference rows — the church, the couple's photography. Present and readable
   all evening, but visibly not part of what the ceremony master is driving.
   Receded with a dashed rule rather than pale text, which a dim room would eat. */
.list__item--reference {
  border-left: 2px dashed var(--rule);
  padding-left: var(--s3);
}
.list__item--reference .list__title { font-family: var(--font-ui); font-size: 16px; }
/* A reference row is never "next up", so its projection column is noise. */
.list__item--reference .time--projected,
.list__item--reference .time--delta { display: none; }

/* "kiinteä" badge */
.badge {
  display: inline-flex; align-items: center; gap: var(--s1);
  padding: 2px var(--s2);
  border: 1px solid var(--rule); border-radius: var(--r-pill);
  background: var(--surface-alt); color: var(--ink-soft);
  font-family: var(--font-ui); font-size: 14px; font-weight: 600;
  letter-spacing: .02em; white-space: nowrap; vertical-align: middle;
}
.badge--anchor, .list__item--anchored .badge {
  background: var(--gold-soft); border-color: var(--gold-deep); color: var(--gold-ink);
}

/* --- 12. Times ----------------------------------------------------------- */

.time {
  display: inline-block;        /* atomic box: survives the --skipped strike */
  font-family: var(--font-ui); font-size: 16px;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  color: var(--ink); white-space: nowrap;
}
.time + .time { margin-left: var(--s2); }
/* Planned is the plan; projected is what will actually happen, so projected
   carries the weight. */
.time--planned { color: var(--ink-soft); font-weight: 400; }
.time--projected { color: var(--ink); font-weight: 700; }
.time--delta { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.time--delta.is-behind { color: var(--warn-ink); }   /* optional sign tints */
.time--delta.is-ahead  { color: var(--ok); }

/* --- 13. Buttons — must work with no hover at all ------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 48px; min-width: 48px; padding: var(--s2) var(--s4);
  border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font-family: var(--font-ui); font-size: 16px; font-weight: 600; line-height: 1.2;
  text-align: center; text-decoration: none;
  cursor: pointer; user-select: none; appearance: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: background-color var(--t) linear, border-color var(--t) linear, transform var(--t) linear;
}
.btn:active { background: var(--surface-alt); border-color: var(--gold-deep); transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; box-shadow: 0 0 0 5px var(--gold-soft); }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--surface-alt); border-color: var(--rule);
  color: var(--ink-soft);        /* 5.5:1 — a disabled control stays readable */
  cursor: default; transform: none; box-shadow: none;
}

/* Aloita / Seuraava — the single thumb target that matters. */
.btn--primary {
  min-height: 64px; padding: var(--s3) var(--s5);
  background: var(--gold); border-color: var(--gold-deep);
  color: var(--ink);             /* 7.2:1 — dark ink on champagne, never white */
  font-size: 20px; font-weight: 700; letter-spacing: .01em;
  box-shadow: var(--shadow);
}
.btn--primary:active { background: var(--gold-press); border-color: var(--gold-deep); box-shadow: none; }
.btn--primary:disabled, .btn--primary[aria-disabled="true"] {
  background: var(--surface-alt); border-color: var(--rule); color: var(--ink-soft);
}
.btn--ghost { background: transparent; border-color: var(--rule); color: var(--ink); font-weight: 600; }
.btn--ghost:active { background: var(--surface-alt); }
.btn--danger { background: var(--surface); border-color: var(--bad); color: var(--bad); }  /* 7.0:1 */
.btn--danger:active { background: var(--bad-soft); border-color: var(--bad); }
/* Smaller type and padding — the 48px tap target never shrinks. */
.btn--small { min-height: 48px; padding: var(--s1) var(--s3); font-size: 14px; border-radius: var(--r); }
.btn--icon { width: 48px; min-width: 48px; padding: 0; flex: 0 0 auto; font-size: 18px; }

/* Hover is decoration only; everything above already works without it. */
@media (hover: hover) {
  .btn:hover { border-color: var(--gold-deep); }
  .btn--primary:hover { background: var(--gold-press); }
  .btn--danger:hover { background: var(--bad-soft); }
  .btn:disabled:hover, .btn[aria-disabled="true"]:hover { border-color: var(--rule); }
}

/* --- 14. Controls — sticky bottom bar, opaque, clears the home indicator -- */

.controls {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; flex-direction: column; gap: var(--s2);
  background: var(--surface);            /* opaque: the list scrolls under it */
  border-top: 1px solid var(--rule);
  padding: var(--s3) var(--page-pad);
  padding-bottom: max(var(--s4), env(safe-area-inset-bottom));
  box-shadow: 0 -6px 20px rgba(35,32,28,.05);
}
/* Bleed to the page edge. Scoped to .page so a stray .controls elsewhere can
   never pull past the viewport and create a horizontal scrollbar. */
.page > .controls, .page__foot .controls, .page__body .controls {
  margin-inline: calc(-1 * var(--page-pad));
}
/* If the markup wraps the controls in the foot, pin the wrapper too so the bar
   stays on screen for the whole scroll. Progressive enhancement only.
   The wrapper must be opaque: the run view puts the connection pill in this
   strip above the buttons, and on a transparent strip the pill would hover over
   the script line scrolling underneath it. */
.page__foot:has(.controls) {
  position: sticky;
  bottom: 0;
  z-index: 30;
  background: var(--surface);
  box-shadow: 0 -1px 0 var(--rule);
}
/* The pill sits alone above the buttons — give it the same page padding the
   controls bleed past, so it lines up with the content instead of the edge. */
.page__foot:has(.controls) > .pill {
  margin: var(--s2) var(--page-pad) 0;
}

/* Auto-fit grid rather than flex-wrap: every button in the row gets the same
   width, and a button pushed onto a second line stays that width instead of
   stretching across the whole bar. A row holding a single button still fills
   the bar, because auto-fit collapses the empty tracks. */
.controls__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: var(--s2);
  align-items: stretch;
}
.controls__row .btn { min-width: 0; padding-inline: var(--s2); font-size: 15px; }
.controls__row .btn--primary { grid-column: 1 / -1; font-size: 20px; padding-inline: var(--s4); }
.controls .pill { align-self: center; }

/* --- 15. Pills — connection / save status. Small, unobtrusive. ----------- */

.pill {
  display: inline-flex; align-items: center; gap: var(--s2);
  max-width: 100%; padding: 3px var(--s3);
  border: 1px solid var(--rule); border-radius: var(--r-pill);
  background: var(--surface-alt); color: var(--ink-soft);
  font-family: var(--font-ui); font-size: 14px; line-height: 1.4; font-weight: 500;
  letter-spacing: .01em; vertical-align: middle; overflow-wrap: break-word;
}
.pill__dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill--offline { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-ink); }  /* 5.6:1 */
.pill--saving  { background: var(--surface-alt); border-color: var(--rule); color: var(--ink-soft); } /* 5.5:1 */
.pill--ok      { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }             /* 5.3:1 */
.pill--anchor  { background: var(--gold-soft); border-color: var(--gold-deep); color: var(--gold-ink); }

/* "juonto" — Calle is on. The single loudest marker in the app, because these
   are the moments the whole run sheet exists to catch. Gold fill, dark ink. */
.pill--hosting {
  background: var(--gold); border-color: var(--gold-deep); color: var(--ink);
  font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 13px;
}
/* "taustatieto" — on the timetable for reference, never driven from the app. */
.pill--reference { background: var(--surface-alt); border-color: var(--rule); color: var(--ink-soft); }
/* "oma" — a to-do line somebody added themselves. */
.pill--custom { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }

/* --- 15b. Host block — who is speaking, and what they announce next ------ */

.host { margin: var(--s3) 0 0; }
.host__who { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: 0 0 var(--s2); }
/* The handoff is the sentence Calle actually has to say, so it gets the gold
   ground and the serif — it is read aloud, like the script lines. */
.host__next {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2);
  margin: 0; padding: var(--s3);
  background: var(--gold-soft); border-left: 4px solid var(--gold-deep); border-radius: var(--r);
}
.host__label {
  font-family: var(--font-ui); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--gold-ink);
}
.host__title { font-family: var(--font-serif); font-size: 19px; color: var(--ink); }
.host__people { font-family: var(--font-ui); font-size: 15px; color: var(--ink-soft); }

/* Your own section in Roolit, floated to the top of the page. */
.card--mine { border-color: var(--gold-deep); box-shadow: var(--shadow), inset 3px 0 0 var(--gold); }

/* --- 15c. Timetable detail: sections, tasks, notes ----------------------- */

/* "Kirkko", "Vastaanotto", "Juhlasali", "Ilta" — a rule across the list so a
   36-row day reads as four short chapters instead of one long scroll. */
.list__section {
  list-style: none;
  margin: var(--s5) 0 var(--s2);
  padding: 0 0 var(--s1);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-ui); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft);
}
.list__section:first-child { margin-top: 0; }

/* The tasks that belong to a moment, so the timeline answers "who does what"
   without a trip to Roolit. */
.list__tasks { margin: var(--s2) 0 0; padding: 0; list-style: none; }
.list__task {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  padding: var(--s1) 0 var(--s1) var(--s3);
  border-left: 2px solid var(--rule);
  font-size: 15px; line-height: 1.4;
}
.list__task-text { min-width: 0; }
.list__task--done .list__task-text { text-decoration: line-through; color: var(--ink-soft); }

.list__notes {
  margin: var(--s2) 0 0;
  font-size: 14px; line-height: 1.45; color: var(--ink-soft);
}

/* The spoken lines, inline on a hosting row. */
.list__script { margin: var(--s3) 0 0; }
.list__script .script__line { font-size: 17px; }

/* The handoff repeated inside a list row: same meaning, quieter than the card. */
.host__next--inline { margin-top: var(--s2); padding: var(--s2) var(--s3); }
.host__next--inline .host__title { font-size: 17px; }

/* --- 16. Banners — full-width notices ------------------------------------ */

.banner {
  display: block; width: 100%; margin: 0 0 var(--s4); padding: var(--s3) var(--s4);
  border: 1px solid var(--rule); border-left-width: 4px; border-radius: var(--r);
  background: var(--surface-alt); color: var(--ink);
  font-family: var(--font-ui); font-size: 16px; line-height: 1.45;
  overflow-wrap: break-word;
}
.banner > :last-child { margin-bottom: 0; }
.banner__title, .banner strong { font-weight: 700; color: var(--ink); }
/* Body copy stays --ink (14:1 on the soft fills); the tone is carried by the
   fill and the left rule, so nothing depends on a 4.4:1 amber. */
.banner--warn { background: var(--warn-soft); border-color: var(--warn); color: var(--ink); }
.banner--bad  { background: var(--bad-soft);  border-color: var(--bad);  color: var(--ink); }
.banner--ok   { background: var(--ok-soft);   border-color: var(--ok);   color: var(--ink); }

/* --- 17. Forms ----------------------------------------------------------- */

.field { display: block; margin: 0 0 var(--s4); min-width: 0; }
.field__label {
  display: block; margin-bottom: var(--s1);
  font-family: var(--font-ui); font-size: 14px; font-weight: 700;
  letter-spacing: .04em; color: var(--ink-soft);
}
.field__input,
.field input[type="text"], .field input[type="time"], .field input[type="number"],
.field input[type="password"], .field input[type="tel"],
.field select, .field textarea {
  display: block; width: 100%; min-height: 48px; padding: var(--s2) var(--s3);
  border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;               /* 16px stops iOS zooming the page on focus */
  line-height: 1.4; appearance: none; -webkit-appearance: none;
}
.field select, select.field__input { appearance: auto; -webkit-appearance: auto; padding-right: var(--s2); }
textarea.field__input, .field textarea { min-height: 96px; line-height: 1.5; resize: vertical; }
.field__input:focus-visible, .field input:focus-visible,
.field select:focus-visible, .field textarea:focus-visible {
  outline: 2px solid var(--gold-deep); outline-offset: 1px;
  border-color: var(--gold-deep); box-shadow: 0 0 0 4px var(--gold-soft);
}
.field__input::placeholder { color: var(--ink-soft); opacity: 1; }
.field__input:disabled, .field__input[readonly] { background: var(--surface-alt); color: var(--ink-soft); }
.field__input[aria-invalid="true"] { border-color: var(--bad); }
.field__row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3); margin: 0 0 var(--s4); }
.field__row .field { flex: 1 1 150px; min-width: 0; margin-bottom: 0; }
.field__hint { display: block; margin-top: var(--s1); font-size: 14px; color: var(--ink-soft); }

/* --- accounts, task times ------------------------------------------------ */

/* A login code has to be readable out loud across a noisy room, so it is the
   largest thing on its card after the name. Tabular figures keep the digits
   from dancing when a code is regenerated. */
.code {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 30px;
  letter-spacing: .14em;
  font-variant-numeric: tabular-nums;
  color: var(--gold-ink);
  background: var(--gold-soft);
  border: 1px solid var(--gold-deep);
  border-radius: var(--r);
  padding: var(--s1) var(--s3);
  margin-right: var(--s3);
  user-select: all;              /* one tap selects the whole code */
}

/* "Expected done by" on a task. Quiet — it is a hint, not a deadline. */
.time--due {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* The signed-in person's own rows, the only ones they can tick. */
.tasklist__item--mine { background: var(--surface-alt); border-radius: var(--r); }
.tasklist__item input:disabled + label { color: var(--ink-soft); }

/* Admin task editor, collapsed inside each task row. */
.task-edit { flex-basis: 100%; margin-top: var(--s2); }
.task-edit > summary { display: inline-flex; width: auto; cursor: pointer; list-style: none; }
.task-edit > summary::-webkit-details-marker { display: none; }
.task-edit[open] > summary { margin-bottom: var(--s2); }
.field--check { display: flex; align-items: center; gap: var(--s3); min-height: 48px; }
.field--check .field__input, .field--check input[type="checkbox"] {
  width: 26px; height: 26px; min-height: 0; flex: 0 0 auto; accent-color: var(--gold-deep);
}
.field--check .field__label { margin: 0; }
fieldset { margin: 0 0 var(--s5); padding: var(--s4); border: 1px solid var(--rule); border-radius: var(--r); min-width: 0; }
legend { padding: 0 var(--s2); font-family: var(--font-ui); font-size: 14px; font-weight: 700; letter-spacing: .04em; color: var(--ink-soft); }

/* --- 18. Task list — roles view ------------------------------------------ */

.tasklist { margin: 0 0 var(--s5); padding: 0; list-style: none; }
/* Two columns: the checkbox, then everything else stacked beside it. A flat
   flex row squeezed the task text into a sliver next to a long event-link
   button and broke Finnish words mid-syllable ("Saipp / uakup / lien"). */
.tasklist__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--s2) var(--s3);
  min-height: 48px; padding: var(--s3) 0;
  border-top: 1px solid var(--rule);
  color: var(--ink); font-size: 16px; line-height: 1.45;
  cursor: pointer; min-width: 0; overflow-wrap: break-word;
}
.tasklist__item:first-child { border-top: 0; }
/* The label owns the first line; badges, times and links flow underneath it. */
.tasklist__item > label { grid-column: 2; min-width: 0; cursor: pointer; }
.tasklist__item > :not(.tasklist__check):not(label):not(input) {
  grid-column: 2;
  justify-self: start;
  max-width: 100%;
}
/* The linked event is a jump target, not a headline: one quiet line. */
.tasklist__item > .btn--small {
  font-size: 13px; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tasklist__check, .tasklist__item input[type="checkbox"] {
  grid-column: 1; grid-row: 1;
  flex: 0 0 auto; width: 26px; height: 26px; margin: 0;
  accent-color: var(--gold-deep); cursor: pointer;
}
.tasklist__check:focus-visible, .tasklist__item input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--gold-deep); outline-offset: 2px;
}
/* Done tasks recede without becoming unreadable. */
.tasklist__item:has(:checked), .tasklist__item--done { color: var(--ink-soft); }
.tasklist__item:has(:checked) label, .tasklist__item--done label {
  text-decoration: line-through; text-decoration-color: var(--ink-faint);
}

/* --- 19. Details / disclosure — "Menneet" -------------------------------- */

details { margin: 0 0 var(--s4); border-top: 1px solid var(--rule); }
summary {
  display: flex; align-items: center; gap: var(--s2);
  min-height: 48px; padding: var(--s2) 0;
  font-family: var(--font-ui); font-size: 16px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer; list-style-position: inside;
}
summary::marker { color: var(--gold-deep); }
summary:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }

/* --- 20. Utilities ------------------------------------------------------- */

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
/* Skip links and other focusable visually-hidden controls come back on focus. */
.sr-only--focusable:focus, .sr-only--focusable:focus-visible {
  position: static !important;
  width: auto; height: auto; margin: 0;
  overflow: visible; clip: auto; clip-path: none; white-space: normal;
}
.stack > * + * { margin-top: var(--s4); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }

/* --- 21. Laptop layer — >= 720px ----------------------------------------- */

/* --- 20b. Phone tuning ---------------------------------------------------
   The pinned bar and the pinned controls both eat vertical space, so the run
   sheet between them has to earn every pixel. These only apply below the
   laptop breakpoint. */
@media (max-width: 719px) {
  /* The clock block sits directly under the pinned bar; it needs no extra air. */
  .page > .page__head { padding-top: var(--s3); margin-bottom: var(--s4); }

  /* Tighter timetable rows: 37 of them have to be thumb-scrollable. */
  .list__item { padding-block: var(--s3); }
  .list__title { font-size: 17px; }
  .list__meta { font-size: 14px; }

  /* Cards lose their side padding to the page edge — on a narrow screen the
     content matters more than the frame. */
  .card { padding: var(--s4) var(--s3); }

  /* Long Finnish compounds ("tervetulotoivotus") must never force a scrollbar. */
  .list__title, .card__event, .script__line { hyphens: auto; }

  /* Keep the last row clear of the pinned control bar. */
  .page__body { padding-bottom: var(--s6); }
}

@media (min-width: 720px) {
  :root { --page-max: 860px; --page-pad: var(--s6); }
  .page__head { padding: var(--s6) 0 var(--s5); }
  .clock { font-size: 76px; }
  h1 { font-size: 32px; }
  h2 { font-size: 22px; }

  /* Nyt / Seuraavaksi side by side; everything else spans the full width. If
     the cards sit deeper than .page__body the grid simply leaves them full
     width — a fine layout, never a broken one. */
  .page__body {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s5); align-items: start;
  }
  .page__body > * { grid-column: 1 / -1; margin-bottom: 0; }
  .page__body > .card--now, .page__body > .card--next { grid-column: span 1; }

  /* Explicit opt-in wrapper for the same effect. */
  .cards {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s5); align-items: start; grid-column: 1 / -1;
  }
  .cards > .card { margin-bottom: 0; }

  /* On a laptop the controls are a toolbar, not a thumb bar. */
  .controls {
    position: static; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: var(--s3); margin-block: var(--s4);
    border: 1px solid var(--rule); border-radius: var(--r);
    padding: var(--s3) var(--s4); padding-bottom: var(--s3);
    box-shadow: none;
  }
  .page > .controls, .page__foot .controls, .page__body .controls { margin-inline: 0; }
  /* On a laptop the bar is not pinned, so it needs neither the opaque backing
     nor the lip that separates it from content scrolling underneath. */
  .page__foot:has(.controls) { position: static; background: none; box-shadow: none; }
  .page__foot:has(.controls) > .pill { margin-inline: 0; }
  /* Toolbar, so buttons drop back to their natural widths. */
  .controls__row { display: flex; flex-wrap: wrap; flex: 1 1 auto; gap: var(--s3); }
  .controls__row .btn { flex: 0 1 auto; font-size: 16px; padding-inline: var(--s4); }
  .controls__row .btn--primary { flex: 0 1 auto; min-width: 220px; }

  .script__line { font-size: 21px; }
  .list__item { padding-inline: var(--s3); }
}

/* --- 22. Reduced motion -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important; transition-delay: 0s !important;
    animation-duration: 0.01ms !important; animation-delay: 0s !important;
    animation-iteration-count: 1 !important; scroll-behavior: auto !important;
  }
  .btn:active { transform: none; }
}

/* --- 23. Colour scheme — deliberately light-only -------------------------
   No dark theme. The room is dim, the phone is at arm's length and the screen
   is the light source: an ivory page at full brightness is the most readable
   surface available. Inverted, the white-wedding identity (ivory ground, warm
   grey hairlines, champagne gold, seven pale person fills) turns to muddy
   browns and loses the 9:1+ text-on-fill headroom the chips depend on. So the
   app stays light and warm in every scheme.
   ------------------------------------------------------------------------ */

@media (prefers-color-scheme: dark) {
  :root { color-scheme: light; }
}
