/* Fog City Daily — "ink on International Orange".
 *
 * One idea: the engraved bridge in black ink on a field of the bridge's own colour, with the interface
 * floating over it as glass, and the day's information rising over that as a white sheet.
 *
 * Rules this file keeps:
 * - Glass is for controls and navigation only (tab bar, sheet, chips over media, the sign-in card).
 *   Content stays solid. Glass in the content layer is the classic mistake.
 * - Orange appears SATURATED or not at all. A faint orange wash over white is peach, which is a warm
 *   off-white, which is banned here. Surfaces are pure white and neutral graphite.
 * - One coloured control per screen. Colour elsewhere only where it carries meaning: numbered pins,
 *   the SHOOT chip, the 911 button.
 * - No edge rails or partial strokes on cards. Shapes are whole.
 * - The accent leans brighter than the bridge's true #c0362c on purpose: that red is nearly the 911 red,
 *   and an accent that reads as "danger" is a semantic bug. The deep red lives only inside the hero.
 */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  /* A script reads as a script in Courier. Apple's Courier has the weight to hold up outdoors; Courier New is a last resort. */
  --font-script: "Courier Prime", Courier, "Courier New", ui-monospace, monospace;

  --fs-caption: 0.8125rem;  /* 13 */
  --fs-body: 1.0625rem;     /* 17 */
  --fs-headline: 1.375rem;  /* 22 */
  --fs-title: 2.375rem;     /* 38 */

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-6: 1.5rem; --space-8: 2rem; --space-12: 3rem;

  --radius-sm: 0.5rem; --radius-md: 0.875rem; --radius-lg: 1.375rem; --radius-sheet: 1.75rem; --radius-pill: 9999px;

  /* surfaces: neutral, always */
  --bg: #ffffff;
  --bg-subtle: #f4f4f5;
  --surface: #ffffff;
  --border: #e4e4e7;
  --text: #0a0a0a;
  --text-2: #52525b;
  --text-3: #71717a;
  --danger: #c81e1e;

  /* the bridge */
  --accent: #c2410c;            /* text-safe on white (5.2:1) */
  --accent-vivid: #f04a00;
  --hero-a: #b93a12; --hero-b: #d1441a; --hero-c: #8f2718; --hero-glow: #ff5a1f;
  --on-hero: #ffffff;
  --on-hero-2: rgba(255, 255, 255, 0.94);
  --art-blend: multiply; --art-filter: none; --art-opacity: 0.5;

  /* glass */
  --glass: rgba(255, 255, 255, 0.74);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 10px 34px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
  --lens: rgba(0, 0, 0, 0.06);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.06), 0 6px 18px rgba(0, 0, 0, 0.08);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.06), 0 16px 40px rgba(0, 0, 0, 0.14);
  --sheet-lift: 0 -14px 34px rgba(60, 14, 4, 0.28);

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --tabbar-h: 3.75rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --bg-subtle: #242426;
    --surface: #2a2a2d;
    --border: #3a3a3e;
    --text: #f4f4f5;
    --text-2: #a1a1aa;
    --text-3: #8e8e93;
    --danger: #ff5a52;

    --accent: #ff7a45;
    --hero-a: #8a2a12; --hero-b: #6f1f12; --hero-c: #2a1210; --hero-glow: #f2571c;
    /* The ink stays BLACK in dark mode. Inverting it suited the bridge's fine lines but turned the
       generated scenes, which are mostly solid masses, into pale photographic negatives with a ghost for
       a figure. Instead the ember glow behind the art is stronger, and the silhouettes read against it. */
    --art-blend: multiply; --art-filter: none; --art-opacity: 0.78; --glow-size: 130% 115%; --glow-at: 86% 48%;

    --glass: rgba(40, 40, 43, 0.72);
    --glass-strong: rgba(42, 42, 45, 0.84);
    --glass-edge: rgba(255, 255, 255, 0.14);
    --glass-shadow: 0 10px 34px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
    --lens: rgba(255, 255, 255, 0.1);

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.55);
    --sheet-lift: 0 -14px 34px rgba(0, 0, 0, 0.55);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--hero-a); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs-body)/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
#view:focus { outline: none; }

@media (prefers-reduced-transparency: reduce) {
  .tabbar nav, dialog.sheet, .mapframe .hint, .login-card { background: var(--surface) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .mapframe .hint { color: var(--text); }
}

/* ---------- shell ---------- */
.app { max-width: 40rem; margin: 0 auto; min-height: 100dvh; background: var(--bg); }

.hero {
  position: relative; overflow: hidden; color: var(--on-hero);
  padding: calc(env(safe-area-inset-top) + var(--space-4)) var(--space-4) calc(var(--radius-sheet) + var(--space-6));
  /* a lit field, not a flat fill: a glow behind the tower, deepening toward the water */
  background:
    /* a scrim across the top: the small status line and the phone's own clock sit here, over the
       brightest part of the glow, where white on orange is only about 3:1 without it */
    linear-gradient(180deg, rgba(48, 10, 2, 0.78) 0%, rgba(48, 10, 2, 0.5) 26%, rgba(48, 10, 2, 0) 58%),
    radial-gradient(var(--glow-size, 120% 95%) at var(--glow-at, 88% 38%), var(--hero-glow) 0%, transparent 58%),
    linear-gradient(168deg, var(--hero-a) 0%, var(--hero-b) 42%, var(--hero-c) 100%);
}
/* Two layers, because there are two different things to stay clear of.
   The OUTER layer spans the banner: it blends the art into the orange and keeps it out of the masthead
   band, where the small status text and the phone's own clock sit.
   The INNER layer is the artwork's own box, anchored bottom-right. Its fade is tied to the ARTWORK'S left
   edge, not the banner's, so the engraving dissolves instead of stopping dead where the file ends,
   on a phone, an iPad or a Mac alike. test/tools/hero-contrast.mjs measures the text over it. */
.hero-art {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  mix-blend-mode: var(--art-blend); opacity: var(--art-opacity);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, transparent calc(env(safe-area-inset-top) + 3rem), #000 calc(env(safe-area-inset-top) + 6rem));
  mask-image: linear-gradient(180deg, transparent 0, transparent calc(env(safe-area-inset-top) + 3rem), #000 calc(env(safe-area-inset-top) + 6rem));
}
.hero-art::before {
  content: ""; position: absolute; right: -4.5rem; bottom: 0.5rem; height: 150%; aspect-ratio: 1100 / 961;
  background: var(--hero-image, none) center / 100% 100% no-repeat; filter: var(--art-filter);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, rgba(0, 0, 0, 0.1) 30%, #000 68%);
  mask-image: linear-gradient(90deg, transparent 0, rgba(0, 0, 0, 0.1) 30%, #000 68%);
}
/* A location's own scene is composed for this banner (subject right, empty left), so it sits flush. */
/* Generated scenes begin their subject with a straight vertical cut a third of the way in. The fade stays
   fully clear until past that cut, or the cut shows through as a faint hard edge. */
.hero-art[data-scene="true"]::before {
  right: 0; bottom: 0; height: 100%; aspect-ratio: 3 / 2;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, transparent 36%, #000 74%);
  mask-image: linear-gradient(90deg, transparent 0, transparent 36%, #000 74%);
}
.hero > :not(.hero-art) { position: relative; }
.masthead { display: flex; align-items: center; justify-content: flex-start; gap: var(--space-3); margin-bottom: var(--space-6); }
/* The identity, standing directly on the orange (docs/identity.md): the Painted Ladies logo at the top right, the
   horizontal FOG CITY at the top left with the "Updated" line under it. No crop, no recolouring, no blend, no
   cover-fit; the page's title keeps clear of the logo. */
.lockup { position: absolute !important; top: calc(env(safe-area-inset-top) + var(--space-3)); right: var(--space-3); width: 9.5rem; height: auto; display: block; filter: drop-shadow(0 6px 14px rgba(40, 10, 2, 0.35)); }
.wordmark { display: block; width: 10.75rem; height: auto; filter: drop-shadow(0 2px 6px rgba(40, 10, 2, 0.35)); }
.hero { min-height: calc(env(safe-area-inset-top) + 11.75rem); }
.masthead { flex-direction: column; align-items: flex-start; gap: var(--space-1); padding-right: 10rem; min-height: 1.25rem; }
/* No logo at the upper right (withdrawn, 20 September 2026): the masthead and the title get back the room they kept clear
   for it. Written against the page, so it needs no change if the logo returns. */
.hero:not(:has(.lockup)) .masthead { padding-right: 0; }
.hero-art[data-scene="true"] ~ .lockup { width: 6.5rem; } /* a location's own artwork has the banner: the lockup steps back */
.status { font-size: var(--fs-caption); color: var(--on-hero-2); text-align: left; font-variant-numeric: tabular-nums; }
.status[data-offline="true"] { color: var(--on-hero); font-weight: 700; }

.pagehead { max-width: 100%; text-shadow: 0 1px 12px rgba(80, 20, 6, 0.35); }
.kicker { font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-hero-2); }
.title { font-family: var(--font-display); font-size: var(--fs-title); line-height: 1.04; font-weight: 800; letter-spacing: -0.025em; margin-top: var(--space-1); overflow-wrap: anywhere; }
.title-sub { color: var(--on-hero-2); margin-top: var(--space-2); font-size: var(--fs-caption); font-weight: 600; }
.backlink { display: inline-block; color: var(--on-hero-2); font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.02em; text-transform: none; text-decoration: none; padding: var(--space-2) 0; min-height: 2.75rem; }

/* the day's information rises over the hero */
.sheetbody {
  position: relative; background: var(--bg);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; margin-top: calc(-1 * var(--radius-sheet));
  box-shadow: var(--sheet-lift);
  padding: var(--space-6) var(--space-4) calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--space-12));
  min-height: 60dvh;
}
.sheetbody.enter > * { animation: rise-in 520ms var(--spring) both; }
.sheetbody.enter > :nth-child(1) { animation-delay: 30ms; } .sheetbody.enter > :nth-child(2) { animation-delay: 70ms; }
.sheetbody.enter > :nth-child(3) { animation-delay: 110ms; } .sheetbody.enter > :nth-child(4) { animation-delay: 150ms; }
.sheetbody.enter > :nth-child(n+5) { animation-delay: 190ms; }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.group-label { font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); margin: var(--space-8) 0 var(--space-3); }
.sheetbody > .group-label:first-child, .sheetbody > .notice:first-child + .group-label { margin-top: var(--space-2); }
.empty { color: var(--text-2); padding: var(--space-8) 0; }

/* ---------- location block ---------- */
.location + .location { margin-top: var(--space-12); }
.mapframe {
  display: block; position: relative; aspect-ratio: 16 / 9; overflow: hidden; text-decoration: none;
  border-radius: var(--radius-lg); background: var(--bg-subtle); box-shadow: var(--shadow-2);
  transition: transform 260ms var(--spring);
}
.mapframe::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5); pointer-events: none; }
.mapframe:active { transform: scale(0.985); }
.mapframe img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* clear glass over media, with the dimming Apple asks for so the label holds on a bright map */
.mapframe .hint {
  position: absolute; right: var(--space-3); bottom: var(--space-3);
  font-size: var(--fs-caption); font-weight: 700; padding: var(--space-2) var(--space-3); border-radius: var(--radius-pill); color: #ffffff;
  background: rgba(20, 20, 22, 0.42); border: 1px solid rgba(255, 255, 255, 0.34);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.mapframe .fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: var(--space-4); text-align: center; color: var(--text-2); font-size: var(--fs-caption); }

.location-head { margin: var(--space-4) 0; }
/* On a location's own page the heading lives in the hero, so the list needs its own air under the map. */
.mapframe + .rows, .mapframe + .empty { margin-top: var(--space-6); }
.location-name { font-family: var(--font-display); font-size: 1.625rem; line-height: 1.12; font-weight: 800; letter-spacing: -0.02em; }
.location-name a { text-decoration: none; }
.location-sub { color: var(--text-2); margin-top: var(--space-1); }
.location-when { font-size: var(--fs-caption); font-weight: 600; color: var(--text); margin-top: var(--space-2); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.chip { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.3rem 0.7rem; border-radius: var(--radius-pill); color: var(--text-2); border: 1px solid var(--border); background: var(--surface); }
/* shooting is the production's main event: the one chip given the bridge's colour, solid, never a tint */
.chip[data-phase="shoot"] { color: #ffffff; border-color: transparent; background: linear-gradient(180deg, #d94e12, #b93a12); box-shadow: 0 1px 2px rgba(120, 40, 8, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.notice { background: var(--bg-subtle); color: var(--text-2); font-size: var(--fs-caption); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); margin: var(--space-3) 0; }

/* ---------- rows ---------- */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.rows > li { border-bottom: 1px solid var(--border); }
.row {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 3.75rem;
  padding: var(--space-2) 0; background: none; border: 0; text-align: left; text-decoration: none; cursor: pointer;
  transition: opacity 160ms var(--ease);
}
.row:active { opacity: 0.55; }
/* an enamel pin: a lit top edge and a little weight underneath */
.badge {
  flex: none; width: 2rem; height: 2rem; border-radius: var(--radius-pill); display: grid; place-items: center;
  font-size: 0.875rem; font-weight: 800; color: #ffffff; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 55%), var(--pin, var(--text-3));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 3px 8px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
/* The set is ink: black on white, white on graphite. */
.badge[data-category="set"] { background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 55%), var(--text); color: var(--bg); }
.badge[data-empty="true"] { background: transparent; color: var(--text-3); border: 1px dashed var(--border); box-shadow: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 650; }
.row-sub { display: block; color: var(--text-2); font-size: var(--fs-caption); margin-top: 1px; overflow-wrap: anywhere; }
.chev { flex: none; color: var(--text-3); font-size: 1.25rem; }

.kv { margin: var(--space-8) 0 0; }
.kv h3 { font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); margin-bottom: var(--space-2); }
.kv p { color: var(--text); }
.kv p + p { margin-top: var(--space-1); }

/* ---------- the scout day ---------- */
/* A timetable, not a decorated timeline: the time in one column, the stop in the other, a hairline between
   stops. "Now" is said with the one solid chip, never with a coloured rail down the side. */
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.stop { display: grid; grid-template-columns: 4.75rem minmax(0, 1fr); column-gap: var(--space-3); padding: var(--space-4) 0; border-bottom: 1px solid var(--border); }
.stop-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: var(--fs-caption); line-height: 1.5; padding-top: 0.2rem; }
.stop-time span { display: block; white-space: nowrap; }
.stop-time .until { font-weight: 500; color: var(--text-2); }
.stop-main > .chip { display: inline-block; margin-bottom: var(--space-2); }
.stop-main > .chip[hidden] { display: none; }
.refused .note-body { margin: var(--space-2) 0; color: var(--text); }
.stop-name { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.15; font-weight: 800; letter-spacing: -0.015em; }
.stop-name a { text-decoration: none; display: inline-flex; align-items: center; min-height: 2.75rem; }
.stop-sub { color: var(--text-2); font-size: var(--fs-caption); margin-top: 2px; }
.stop-scenes { margin-top: var(--space-2); font-weight: 650; }
.stop-scenes a { text-decoration: none; color: var(--accent); display: inline-flex; align-items: center; min-height: 2.75rem; }
.stop-actions { margin-top: var(--space-1); }
.leg { margin-top: var(--space-3); color: var(--text-2); font-size: var(--fs-caption); }
.leg[data-tight="true"] { color: var(--danger); font-weight: 650; }
.stop[data-now="true"] .stop-time { color: var(--accent); }
.fine { color: var(--text-3); font-size: var(--fs-caption); margin-top: var(--space-4); }

/* the day on one map: square, because the day runs thirty kilometres north to south */
.daymap { aspect-ratio: 1 / 1; max-width: 34rem; }
/* The day's map carries our own pins: a dot exactly on the place, and beside it a label with the stop's number
   and name. Ink on the map in daylight, paper on it at night, like every set pin. views/scout.js places them. */
.daymap { cursor: default; }
.daymap:active, .daymap:hover { transform: none; }
.daymap[data-bare="true"] { background: var(--bg-subtle); }
.mapdot { position: absolute; width: 0.625rem; height: 0.625rem; margin: -0.3125rem 0 0 -0.3125rem; border-radius: var(--radius-pill); background: var(--text); border: 2px solid var(--bg); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.mappin {
  position: absolute; visibility: hidden; /* until it has been placed */
  display: inline-flex; align-items: center; gap: 0.375rem; height: 1.75rem; padding: 0 0.5rem 0 0.25rem; white-space: nowrap;
  border: 0; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); cursor: pointer;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.22);
}
/* a little more to aim at than can be seen, without reaching into the neighbour's label */
.mappin::after { content: ""; position: absolute; inset: -0.25rem; }
.mappin-n { display: grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 0.25rem; border-radius: 0.3125rem; background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; font-weight: 800; }
.mappin:active { opacity: 0.7; }
.undermap { display: flex; justify-content: flex-end; margin-top: var(--space-1); }
.undermap .linkish { color: var(--text); font-weight: 650; text-decoration: none; }
/* a stop scrolled to must clear whatever floats over the page: nothing on a phone, the tab bar on an iPad or a Mac */
.stop { scroll-margin-top: var(--space-3); }
.day-totals { margin: var(--space-4) 0 var(--space-2); font-weight: 650; }
/* the office and lunch: on the timetable, nothing shot there, so one quiet line */
.stop-plain { padding: var(--space-3) 0; }
.stop-plain-name { color: var(--text-2); }
.stop-plain-name a { color: var(--text); display: inline-flex; align-items: center; min-height: 2.75rem; }
.stop-name { display: flex; align-items: center; gap: var(--space-3); }
.stop-name .badge { width: 1.75rem; height: 1.75rem; font-size: 0.8125rem; }
.stop-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.stop-actions .btn + .btn { margin-top: 0; }

/* what has to be shot at a location */
.outline { margin-top: var(--space-4); }
.outline h3 { font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
.outline-totals { font-weight: 650; margin-top: 2px; }
.outline-scenes { list-style: none; margin: var(--space-2) 0 0; padding: 0; border-top: 1px solid var(--border); }
.outline-scenes > li { border-bottom: 1px solid var(--border); }
.outline-scenes a { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) 0; min-height: 2.75rem; text-decoration: none; }
.outline-scenes .sceneno { margin-top: 1px; }
.outline-main { flex: 1; min-width: 0; }
.outline-main > span { display: block; overflow-wrap: anywhere; }
.outline-slug { font-weight: 650; font-size: 0.9375rem; line-height: 1.3; }
.outline-what { color: var(--text-2); font-size: var(--fs-caption); margin-top: 1px; }
.outline-who { color: var(--text-3); font-size: var(--fs-caption); }
.outline-note, .outline-none { color: var(--text-2); font-size: var(--fs-caption); margin-top: var(--space-2); }

/* ---------- scenes ---------- */
.scenes > p { color: var(--text-2); }
.setgroup { border-bottom: 1px solid var(--border); }
.scenes .setgroup:first-of-type, .group-label + .setgroup { border-top: 1px solid var(--border); }
.scenes .setgroup:first-of-type { margin-top: var(--space-3); }
.setgroup summary { display: flex; align-items: baseline; gap: var(--space-3); min-height: 3.25rem; padding: var(--space-3) 0; cursor: pointer; list-style: none; }
.setgroup summary::-webkit-details-marker { display: none; }
.setgroup summary::after { content: "›"; flex: none; color: var(--text-3); font-size: 1.25rem; transition: transform 220ms var(--ease); }
.setgroup[open] summary::after { transform: rotate(90deg); }
.setname { flex: 1; min-width: 0; font-weight: 700; font-size: var(--fs-caption); letter-spacing: 0.04em; text-transform: uppercase; overflow-wrap: anywhere; }
.setmeta { flex: none; color: var(--text-2); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.setgroup .rows { border-top: 1px solid var(--border); margin-bottom: var(--space-2); }
.setgroup .rows > li:last-child { border-bottom: 0; }
/* a scene number is a label, not a pin: ink outline, no colour */
.sceneno { flex: none; min-width: 3rem; padding: 0.25rem 0.4rem; border-radius: var(--radius-sm); border: 1px solid var(--border); text-align: center; font-size: 0.8125rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); background: var(--bg-subtle); }

.oneline { margin-top: var(--space-4); padding: var(--space-4); border-radius: var(--radius-md); background: var(--bg-subtle); }
.oneline p:empty { display: none; }
.oneline .fine { margin-top: var(--space-2); }
.scene-meta { color: var(--text-2); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; margin-top: var(--space-3); max-width: 38rem; }
/* The scene's page, as the script prints it. */
.screenplay { font-family: var(--font-script); font-size: 0.9375rem; line-height: 1.45; margin-top: var(--space-6); max-width: 38rem; }
.screenplay p { margin: 0; overflow-wrap: anywhere; }
.screenplay .sp-a, .screenplay .sp-c, .screenplay .sp-t { margin-top: 1em; }
.sp-c { padding-left: 36%; }
.sp-p { padding-left: 24%; padding-right: 20%; }
.sp-d { padding-left: 14%; padding-right: 10%; }
.screenplay .sp-a + .sp-d, .screenplay .sp-t + .sp-d { margin-top: 1em; } /* an insert with no speaker */
.sp-t { text-align: right; }
/* the running header: which revision this page is, in its paper colour, and the page number at the edge */
.screenplay .sp-pagehead { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); margin: 1.25em 0 0.5em; padding-top: 0.75em; border-top: 1px dashed var(--border); color: var(--text-2); font-size: 0.8125rem; }
.screenplay > .sp-pagehead:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.revdot { flex: none; width: 0.875rem; height: 0.875rem; border-radius: 3px; background: var(--rev); border: 1px solid rgba(0, 0, 0, 0.45); }
.sp-pageno { min-width: 3.5ch; text-align: right; font-weight: 700; color: var(--text); }
/* the heading, with the scene number in both margins */
.screenplay .sp-h { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr) 3.25rem; align-items: baseline; margin-top: 1.25em; } /* no text-transform: 63aA and 63AA are different scenes */
.sp-no { font-weight: 800; } .sp-h .sp-no:last-child { text-align: right; }
.sp-scene { padding: 0.25em 0 0.75em; }
/* the neighbours: there to be glanced at, not read */
.sp-context { color: var(--text-3); opacity: 0.72; font-size: 0.875rem; }
.sp-context .sp-no { font-weight: 700; }
.sp-elide { text-align: center; letter-spacing: 0.4em; }
.screenplay .sp-none { color: var(--text-2); }
/* navigation on a scene: back to the list, back to the day, and the scene either side: top and bottom */
.scene-nav { max-width: 38rem; } .scene-nav + .mmscene, .scene-nav + .screenplay { margin-top: var(--space-4); }
.scene-back { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.scene-back .btn + .btn { margin-top: 0; }
.scene-steps { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-3); }
.scene-steps .btn + .btn { margin-top: 0; }
.notespanel + .scene-nav { margin-top: var(--space-12); }

/* ---------- the One Line, as Movie Magic prints it ----------
   The colours are the production's, read out of their PDF: they are the point, so that an AD knows a night
   exterior from a day interior before reading a word. They stay the same in dark mode, as paper would. Optima is
   Movie Magic's face and is on every Apple device. */
.mmday { --mm-line: rgba(0, 0, 0, 0.78); margin-top: var(--space-3); border: 1px solid var(--mm-line); border-radius: var(--radius-sm); overflow: hidden; font-family: Optima, Candara, "Segoe UI", var(--font); color: #000000; container-type: inline-size; }
.mmstrip {
  display: grid; grid-template-columns: 4.25rem minmax(0, 1fr) 2.75rem; grid-template-areas: "no main pgs" "no cast bg" "notes notes notes";
  background: var(--strip); color: #000000; text-decoration: none; border-bottom: 1px solid var(--mm-line); font-size: 0.75rem; line-height: 1.25;
}
.mmstrip[data-ink="light"], .mmbanner[data-ink="light"] { color: #ffffff; }
.mmstrip > span { padding: 0.25rem 0.375rem; min-width: 0; }
.mmstrip i { display: block; font-size: 0.625rem; font-style: italic; font-weight: 700; }
.mm-no { grid-area: no; border-right: 1px solid var(--mm-line); display: flex; flex-direction: column; }
.mm-no b { margin: auto; font-size: 0.875rem; font-weight: 800; text-align: center; overflow-wrap: anywhere; }
.mm-main { grid-area: main; }
.mm-slug { display: flex; gap: var(--space-2); justify-content: space-between; align-items: baseline; }
.mm-slug b { font-weight: 800; white-space: pre-wrap; overflow-wrap: anywhere; }
.mm-slug em { flex: none; font-weight: 800; }
.mm-syn { display: block; font-style: italic; margin-top: 0.125rem; overflow-wrap: anywhere; }
.mm-pgs { grid-area: pgs; border-left: 1px solid var(--mm-line); text-align: center; }
.mm-pgs b, .mm-bg b { font-weight: 800; }
.mm-cast { grid-area: cast; font-weight: 800; border-top: 1px solid var(--mm-line); overflow-wrap: anywhere; }
.mm-bg { grid-area: bg; border-left: 1px solid var(--mm-line); border-top: 1px solid var(--mm-line); text-align: center; }
.mm-bg i { display: inline; margin-right: 0.25rem; }
.mm-notes { grid-area: notes; border-top: 1px solid var(--mm-line); font-weight: 800; }
.mm-notes:empty { display: none; } /* stacked (a phone): an empty note is not a row */
.mmstrip:active { filter: brightness(0.93); }
/* Movie Magic's single row, when the BLOCK has the room for six cells. Asked of the block and not of the screen: on an
   iPad in portrait a location's strips stand in a column a phone's width wide, where the six cells left the slug no
   room at all and it broke one letter to a line. */
@container (min-width: 40rem) {
  /* The notes column belongs to the BLOCK: every strip of a day that has a note anywhere gets the cell (blank for most), so
     Pgs., cast and BG stand in line down the block, as Movie Magic prints them. A block with no notes does without it. */
  .mmstrip { grid-template-columns: 5rem minmax(0, 1fr) 3.25rem 9.5rem 3.25rem; grid-template-areas: "no main pgs cast bg"; font-size: 0.8125rem; }
  .mmday[data-notes] .mmstrip { grid-template-columns: 5rem minmax(0, 1fr) 3.25rem 9.5rem 3.25rem 8.5rem; grid-template-areas: "no main pgs cast bg notes"; }
  .mmday[data-notes] .mm-notes:empty { display: block; }
  .mm-cast, .mm-bg, .mm-notes { border-top: 0; } .mm-cast, .mm-notes { border-left: 1px solid var(--mm-line); text-align: center; }
  .mm-bg i { display: block; margin: 0; }
}
/* The rest of a day the company spends in more than one place: the strips shot before or after the move, washed out
   towards paper but still their colour, so a night exterior is still blue. The ink stays dark enough to read. */
.mmstrip[data-also] { opacity: 0.62; }
@supports (background: color-mix(in srgb, red 50%, white)) {
  .mmstrip[data-also], .mmstrip[data-also][data-ink="light"] { opacity: 1; background: color-mix(in srgb, var(--strip) 38%, #ffffff); color: rgba(0, 0, 0, 0.66); }
}
.mm-also { display: block; font-size: 0.625rem; font-weight: 800; font-style: italic; letter-spacing: 0.04em; text-transform: uppercase; }
/* Banners and the day break are paragraphs, and a location's page styles paragraphs (.kv p): these keep their own. */
.mmday > .mmbanner, .mmday > .mmbreak { margin: 0; }
.mmday > .mmbreak { color: #ffffff; }
.mmday > .mmbanner[data-ink="light"] { color: #ffffff; } .mmday > .mmbanner[data-ink="dark"] { color: #000000; }
.mmbanner { margin: 0; padding: 0.375rem 0.5rem; background: var(--strip); text-align: center; font-weight: 800; font-style: italic; font-size: 0.875rem; border-bottom: 1px solid rgba(255, 255, 255, 0.35); }
.mmbreak { margin: 0; padding: 0.4375rem 0.5rem; background: #000000; color: #ffffff; text-align: center; font-weight: 800; font-size: 0.8125rem; }
.mmoutline .outline-totals { margin-bottom: var(--space-1); }
/* On a phone a strip needs the whole width of the screen, not the timetable's right-hand column: six cells do not fit
   in 270 points. The block steps out to the left edge, under the time. */
.stop-main .mmday { margin-left: calc(-4.75rem - var(--space-3)); }
.mmscene { margin-top: var(--space-4); max-width: 46rem; } .mmscene > .mmday:first-child { margin-top: 0; }
/* The boneyard, at the foot of All: what the script has and the One Line does not place. */
.boneyard { max-width: 56rem; }
.boneyard-lede { font-weight: 650; }
.boneyard-group > .fine { margin: 0 0 var(--space-2); }
.boneyard-group > .mmday:last-child { margin-bottom: var(--space-4); }
.mmlegend { columns: 2 12rem; font-size: var(--fs-caption); padding: var(--space-2) 0 var(--space-4); }
.mmlegend span { display: block; break-inside: avoid; }

/* ---------- scratch pad ---------- */
.notespanel h3 .notes-count { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-3); }
.field { display: block; width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04); }
textarea.field { resize: vertical; min-height: 4.5rem; line-height: 1.35; }
.composer .segmented { margin-bottom: var(--space-2); }
.composer .segmented button { padding: 0 var(--space-4); }
.name-row { margin-top: var(--space-2); }
.composer-foot { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-2); }
.notes-kind { font-size: var(--fs-caption); font-weight: 700; color: var(--text-2); margin: var(--space-6) 0 var(--space-1); }
.notes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.note { display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.note-main { flex: 1; min-width: 0; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.note[data-done="true"] > .note-main > .note-body { color: var(--text-2); }
.note-meta { color: var(--text-3); font-size: var(--fs-caption); margin-top: 2px; }
.note-meta .unsent { color: var(--text); font-weight: 650; }
/* a link inside a line of small print still has to take a thumb */
.note-meta a { display: inline-flex; align-items: center; min-height: 2.75rem; }
a.linkish { display: inline-flex; align-items: center; }
.note-actions { display: flex; gap: var(--space-4); }
.note .linkish { padding: var(--space-2) 0; min-height: 2.75rem; }
.answer { margin-top: var(--space-2); padding: var(--space-3); border-radius: var(--radius-md); background: var(--bg-subtle); }
.answer-form { margin-top: var(--space-2); }
.answer-form .btn { margin-top: var(--space-2); }
/* a tick box big enough for a thumb in a moving van */
.tick { flex: none; width: 2.75rem; height: 2.75rem; border-radius: var(--radius-md); border: 1.5px solid var(--text-3); background: var(--surface); font-size: 1.25rem; font-weight: 800; line-height: 1; cursor: pointer; }
.tick[aria-checked="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.stop-notes { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: var(--fs-caption); font-weight: 650; color: var(--text); }
.stop-notes[hidden] { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2); width: 100%; min-height: 3.25rem;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 650; text-decoration: none; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: transform 200ms var(--spring), opacity 160ms var(--ease);
}
.btn + .btn { margin-top: var(--space-2); }
.btn-small { display: inline-flex; width: auto; min-height: 2.75rem; padding: var(--space-2) var(--space-4); font-size: var(--fs-caption); }
.btn:active { transform: scale(0.98); opacity: 0.85; }
/* the one coloured control on a screen */
.btn-primary {
  color: #ffffff; border-color: transparent;
  background: linear-gradient(180deg, #d94e12 0%, #b93a12 100%);
  box-shadow: 0 8px 22px rgba(185, 58, 18, 0.34), 0 2px 4px rgba(120, 40, 8, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
@media (prefers-color-scheme: dark) { .btn-primary { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.22); } }
.btn-danger {
  color: #ffffff; border-color: transparent; min-height: 4rem; font-size: var(--fs-headline); font-weight: 800;
  background: linear-gradient(180deg, #e02424, #b91c1c);
  box-shadow: 0 10px 26px rgba(185, 28, 28, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.signout { margin-top: var(--space-12); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.appversion { color: var(--text-3); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.linkish { background: none; border: 0; padding: var(--space-3) 0; min-height: 2.75rem; color: var(--text-2); text-decoration: underline; cursor: pointer; font-size: var(--fs-caption); }

/* ---------- sheet: regular glass ---------- */
dialog.sheet {
  width: 100%; max-width: 40rem; margin: auto auto 0; color: var(--text);
  padding: var(--space-3) var(--space-4) calc(env(safe-area-inset-bottom) + var(--space-6));
  border: 1px solid var(--glass-edge); border-bottom: 0; border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--glass-strong);
  -webkit-backdrop-filter: saturate(190%) blur(30px); backdrop-filter: saturate(190%) blur(30px);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.3), inset 0 1px 0 var(--glass-edge);
}
dialog.sheet::before { content: ""; display: block; width: 2.5rem; height: 0.3125rem; border-radius: var(--radius-pill); background: var(--text-3); opacity: 0.45; margin: 0 auto var(--space-4); }
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.38); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.sheet[open] { animation: sheet-up 420ms var(--spring); }
dialog.sheet[open]::backdrop { animation: fade 300ms var(--ease); }
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-title { font-family: var(--font-display); font-size: 1.625rem; font-weight: 800; line-height: 1.12; letter-spacing: -0.02em; }
.sheet-sub { color: var(--text-2); margin-top: var(--space-1); }
.sheet-actions { margin-top: var(--space-6); }
.w3w { font-variant-numeric: tabular-nums; }

/* ---------- SOS ---------- */
.sos-address { font-family: var(--font-display); font-size: 1.875rem; line-height: 1.12; font-weight: 800; letter-spacing: -0.02em; margin: var(--space-2) 0; overflow-wrap: anywhere; }
.sos-street { font-size: var(--fs-headline); line-height: 1.25; margin-bottom: var(--space-1); overflow-wrap: anywhere; }
.sos-coords { color: var(--text-2); font-variant-numeric: tabular-nums; margin-bottom: var(--space-6); }
.hospital { padding: var(--space-4) 0; border-top: 1px solid var(--border); }
.hospital h3 { font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
.hospital .name { font-size: var(--fs-headline); font-weight: 750; margin-top: var(--space-1); }
.hospital .meta { color: var(--text-2); margin: var(--space-1) 0 var(--space-3); }
.flag { display: inline-block; font-size: var(--fs-caption); font-weight: 600; padding: 2px var(--space-2); border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text-2); margin-top: var(--space-2); }
select.picker { width: 100%; min-height: 3.25rem; font: inherit; font-weight: 600; padding: 0 var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); color: var(--text); margin-bottom: var(--space-6); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }

/* ---------- live map ---------- */
.livemap { position: relative; height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom) - 17rem); min-height: 20rem; border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-subtle); box-shadow: var(--shadow-2); }
.livemap .fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: var(--space-6); text-align: center; color: var(--text-2); }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--radius-pill); background: var(--bg-subtle); margin: 0 0 var(--space-3); }
.segmented button { min-height: 2.75rem; padding: 0 var(--space-6); border: 0; border-radius: var(--radius-pill); background: transparent; font-size: var(--fs-caption); font-weight: 700; cursor: pointer; transition: background 220ms var(--ease); }
.segmented button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16); }

/* ---------- tab bar: a floating capsule of glass ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; pointer-events: none; padding: 0 var(--space-3) max(var(--space-3), env(safe-area-inset-bottom)); }
.tabbar nav {
  pointer-events: auto; display: flex; gap: 2px; width: 100%; max-width: 26rem; padding: 5px; border-radius: var(--radius-pill);
  background: var(--glass); border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: saturate(190%) blur(32px); backdrop-filter: saturate(190%) blur(32px);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-edge), inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}
.tabbar a {
  flex: 1; min-height: calc(var(--tabbar-h) - 10px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: var(--radius-pill); font-size: 0.6875rem; font-weight: 600; text-decoration: none; color: var(--text-2);
  transition: background 260ms var(--spring), color 200ms var(--ease);
}
.tabbar a[hidden] { display: none; }
.tabbar svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[data-tab="sos"] { color: var(--danger); }
/* Selection is a shape and a weight as well as a colour: the lens under the chosen tab. */
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 800; background: var(--lens); box-shadow: inset 0 1px 0 var(--glass-edge); }
.tabbar a[aria-current="page"][data-tab="sos"] { color: var(--danger); }
.tabbar a[aria-current="page"] svg { stroke-width: 2.3; }

/* ---------- sign-in: the poster, with a card of glass over it ---------- */
.login {
  position: relative; min-height: 100dvh; display: grid; align-content: end; justify-items: center; overflow: hidden; color: var(--on-hero);
  padding: calc(env(safe-area-inset-top) + var(--space-6)) var(--space-4) calc(env(safe-area-inset-bottom) + var(--space-6));
  background:
    radial-gradient(110% 60% at 70% 24%, var(--hero-glow) 0%, transparent 60%),
    linear-gradient(172deg, var(--hero-a) 0%, var(--hero-b) 38%, var(--hero-c) 100%);
}
/* The lettering is twice as wide as it is tall, so it is sized by its width everywhere, and sits a little way down the
   poster rather than against its top edge. */
.login-art { position: absolute; top: calc(env(safe-area-inset-top) + 11dvh); left: 50%; transform: translateX(-50%); height: auto; width: min(88vw, 28rem); pointer-events: none; filter: drop-shadow(0 14px 30px rgba(40, 10, 2, 0.4)); }
.login picture { display: contents; } /* the <picture> is only there to choose the still file: the image is the grid's item */
.login picture source { display: none; } /* as a grid's child a <source> becomes a block and takes a column of its own (it did) */
.login .fogrow { margin: var(--space-2) 0 0; }
.login .fogrow .linkish { color: rgba(255, 255, 255, 0.8); padding: var(--space-2) 0; }
/* Smoked, not white: white glass over saturated orange turns salmon, which is a warm-tinted surface.
   Apple's own rule for glass over bright content is a dark dimming layer. */
.login-card {
  position: relative; width: 100%; max-width: 24rem; padding: var(--space-6); border-radius: var(--radius-sheet); color: #ffffff;
  background: rgba(28, 10, 6, 0.46); border: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: saturate(160%) blur(28px); backdrop-filter: saturate(160%) blur(28px);
  box-shadow: 0 24px 60px rgba(30, 8, 2, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  animation: rise-in 700ms var(--spring) both 120ms;
}
.login label { display: block; font-size: var(--fs-caption); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 255, 255, 0.86); margin: 0 0 var(--space-2); }
.login input {
  width: 100%; min-height: 3.25rem; padding: 0 var(--space-4); font: inherit; border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.3); background: #ffffff; color: #0a0a0a; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}
/* On smoked glass over orange, an orange button would sink. White is the one bright control here. */
.login .btn { margin-top: var(--space-3); color: #0a0a0a; background: #ffffff; border-color: transparent; box-shadow: 0 8px 22px rgba(30, 8, 2, 0.35), inset 0 -1px 0 rgba(0, 0, 0, 0.08); }
.login .error { min-height: 1.25rem; margin-top: var(--space-3); color: #ffffff; font-size: var(--fs-caption); font-weight: 700; }
.login .install { margin-top: var(--space-2); color: rgba(255, 255, 255, 0.8); font-size: var(--fs-caption); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

/* =====================================================================================================
   iPad and Mac. The phone layout above is the base; everything here only adds room.
   ===================================================================================================== */

/* A pointer can hover; a finger cannot. These never fire on touch, so nothing "sticks" on an iPhone. */
@media (hover: hover) and (pointer: fine) {
  .row { border-radius: var(--radius-md); transition: background 160ms var(--ease), opacity 160ms var(--ease); }
  .row:hover { background: var(--bg-subtle); }
  .rows > li { border-bottom-color: var(--border); }
  .mapframe:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08), 0 22px 50px rgba(0, 0, 0, 0.2); }
  .btn:hover { filter: brightness(1.04); }
  .tabbar a:hover { background: var(--lens); }
  .backlink:hover, .linkish:hover { color: var(--on-hero); text-decoration: underline; }
  .linkish:hover { color: var(--text); }
  .location-name a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
}

@media (min-width: 48rem) {
  :root { --fs-title: 3.25rem; --gutter: clamp(1.75rem, 5vw, 4.5rem); --tabbar-h: 3.5rem; }
  .app { max-width: none; }

  .hero { padding: calc(env(safe-area-inset-top) + var(--space-6)) var(--gutter) calc(var(--radius-sheet) + var(--space-8)); min-height: 17rem; }
  .hero-art::before { right: 3%; bottom: 0; height: 165%; }
  .hero-art[data-scene="true"]::before { right: 0; height: 100%; }
  .masthead { margin-bottom: var(--space-8); }
  .lockup { width: 17rem; top: calc(env(safe-area-inset-top) + 4.75rem); right: var(--gutter); }
  .wordmark { width: 13.3rem; }
  .hero { min-height: 17.5rem; }
  .masthead { padding-right: 0; }
  .pagehead { max-width: min(46rem, calc(100% - 19rem)); }
  .hero:not(:has(.lockup)) .pagehead { max-width: 46rem; }
  .title-sub { font-size: var(--fs-body); }

  .sheetbody { padding: var(--space-8) var(--gutter) var(--space-12); }
  /* Each screen's content keeps a comfortable measure inside the wide sheet. */
  .sheetbody > * { max-width: 84rem; margin-left: auto; margin-right: auto; }
  .sheetbody[data-route="sos"] > * { max-width: 44rem; }
  .sheetbody[data-route="scout"] > *, .sheetbody[data-route="scene"] > *, .sheetbody[data-route="script"] > *, .sheetbody[data-route="notes"] > * { max-width: 46rem; }
  .stop { grid-template-columns: 7rem minmax(0, 1fr); scroll-margin-top: 5.5rem; }
  .stop-main .mmday { margin-left: 0; }
  .sheetbody[data-route="oneline"] > * { max-width: 56rem; }
  .screenplay { font-size: 1.0625rem; }
  .sheetbody > .notice { max-width: 84rem; }

  /* Today: locations side by side. */
  .location-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr)); gap: var(--space-12) clamp(2rem, 4vw, 4rem); align-items: start; }
  .location-grid > .location + .location { margin-top: 0; }
  /* One location alone should not stretch a 16:9 map across a whole Mac display. */
  .location-grid > .location:only-child { max-width: 46rem; }

  /* A location's own page on an iPad in portrait: one column, as on the phone, at a comfortable measure. Two columns
     there left the guide, the strips and the scratch pad a phone's width each beside a small map. */
  .location.solo { max-width: 46rem; }

  /* All: two columns of locations. */
  .rows-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(2rem, 4vw, 4rem); border-top: 0; }
  .rows-grid > li { border-top: 1px solid var(--border); border-bottom: 0; }

  .livemap { height: calc(100dvh - 24rem); min-height: 26rem; }

  /* The tab bar moves to the top centre, as iPadOS does. It floats over the orange hero there, and white
     glass over saturated orange turns salmon, so it is smoked glass: the same material as the sign-in card. */
  .tabbar { top: 0; bottom: auto; padding: calc(env(safe-area-inset-top) + var(--space-4)) var(--space-4) 0; }
  .tabbar nav {
    width: auto; max-width: none; gap: 4px;
    background: rgba(30, 12, 8, 0.5); border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(20, 6, 2, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.26);
  }
  .tabbar a { flex: none; flex-direction: row; gap: var(--space-2); min-height: 2.75rem; padding: 0 var(--space-4); font-size: var(--fs-caption); color: rgba(255, 255, 255, 0.82); }
  .tabbar svg { width: 1.25rem; height: 1.25rem; }
  .tabbar a[data-tab="sos"] { color: #ff8f88; }
  .tabbar a[aria-current="page"] { color: #ffffff; background: rgba(255, 255, 255, 0.2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); }
  .tabbar a[aria-current="page"][data-tab="sos"] { color: #ffffff; background: rgba(224, 36, 36, 0.85); }
  .masthead { padding-right: 0; }
  .status { position: relative; z-index: 11; }

  /* The place sheet becomes a centred card rather than something that slides up from the bottom edge. */
  dialog.sheet { margin: auto; max-width: 30rem; border-radius: var(--radius-sheet); border-bottom: 1px solid var(--glass-edge); padding: var(--space-6); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), inset 0 1px 0 var(--glass-edge); }
  dialog.sheet::before { display: none; }
  dialog.sheet[open] { animation: card-in 360ms var(--spring); }
  @keyframes card-in { from { transform: translateY(16px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

  .sos-address { font-size: 2.5rem; }
}

/* Landscape iPad and the Mac. A location's own page: the map stands beside the guide and stays put while the guide scrolls. */
@media (min-width: 64rem) {
  .location.solo { max-width: 84rem; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: clamp(2rem, 4vw, 4.5rem); align-items: start; }
  .location.solo > * { grid-column: 2; }
  .location.solo > .mapframe { grid-column: 1; grid-row: 1 / span 12; position: sticky; top: calc(env(safe-area-inset-top) + 5.5rem); aspect-ratio: 4 / 3; }
  .location.solo > .mapframe + .rows, .location.solo > .mapframe + .empty { margin-top: 0; }
}

/* Landscape iPad and the Mac: the sign-in poster stands beside its card instead of above it. */
@media (min-width: 60rem) and (min-aspect-ratio: 1/1) {
  .login { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-content: center; align-items: center; column-gap: clamp(2rem, 6vw, 6rem); padding-left: var(--gutter, 4rem); padding-right: var(--gutter, 4rem); }
  .login-art { position: relative; top: auto; left: auto; transform: none; width: min(100%, 40rem); height: auto; justify-self: end; }
  .login-card { justify-self: start; }
}
/* A tall, narrow iPad in portrait keeps the phone's stacked sign-in, with a larger poster. */
@media (min-width: 48rem) and (max-aspect-ratio: 1/1) {
  .login-art { width: min(76vw, 40rem); top: calc(env(safe-area-inset-top) + 14dvh); }
  .login-card { margin-bottom: 6dvh; }
}

/* =====================================================================================================
   Paper. "Print the day sheet" on the Scout screen: the map, the itinerary and what shoots where, in
   black on white, with nothing that only makes sense on a screen.
   ===================================================================================================== */
@media print {
  :root { --bg: #ffffff; --bg-subtle: #ffffff; --surface: #ffffff; --text: #000000; --text-2: #222222; --text-3: #444444; --border: #999999; --accent: #000000; --danger: #000000; }
  html, body { background: #ffffff; }
  .tabbar, .signout, .no-print, .notespanel, .stop-actions, .stop-notes, .status, .hero-art, .mapframe .hint, .now-chip, dialog { display: none !important; }
  .app { max-width: none; }
  .hero { background: none; color: #000000; padding: 0 0 8pt; }
  .lockup { position: static !important; width: 0.9in; filter: none; float: right; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .masthead { margin-bottom: 6pt; }
  .pagehead { max-width: none; text-shadow: none; }
  .kicker, .title-sub { color: #000000; }
  .title { font-size: 22pt; }
  .sheetbody { margin: 0; padding: 0; border-radius: 0; box-shadow: none; min-height: 0; }
  .sheetbody.enter > * { animation: none; }
  .sheetbody > * { max-width: none !important; }
  .sheetbody > .daymap { max-width: 4in !important; margin: 0 auto 8pt; box-shadow: none; border: 1px solid #999999; border-radius: 0; }
  .mapframe::after { display: none; }
  body { font-size: 10pt; line-height: 1.3; }
  .stop { grid-template-columns: 0.9in minmax(0, 1fr); padding: 6pt 0; break-inside: avoid; }
  .stop-name { font-size: 12pt; }
  .stop-name a, .outline-scenes a { color: #000000; text-decoration: none; min-height: 0; }
  .outline-scenes a { padding: 3pt 0; }
  .badge { box-shadow: none; background: #000000 !important; color: #ffffff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .mmstrip, .mmbanner, .mmbreak { -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
  .mappin, .mapdot, .mappin-n { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none; }
  .mappin { background: #000000; color: #ffffff; } .mappin-n { background: #ffffff; color: #000000; } .mapdot { background: #000000; border-color: #ffffff; }
  .leg[data-tight="true"] { font-weight: 800; text-decoration: underline; }
  .fine { font-size: 8pt; }
}
