/* =====================================================================
   Roman for Mayor of Stewart: shared styles for every page.
   Tokens, type, the header, the valley backdrop, buttons, fields, pop-up cards and
   the footer. Page-specific layers sit on top: survey.css, about.css (home and
   roads), roads.css, admin.css.
   ===================================================================== */

/* ---------- Fonts: Helvetica Neue LT Pro, subset to Latin (fonts/web/) ---------- */
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-Th.woff2') format('woff2'); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-ThIt.woff2') format('woff2'); font-weight: 100; font-style: italic; font-display: swap; }
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-UltLt.woff2') format('woff2'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-UltLtIt.woff2') format('woff2'); font-weight: 200; font-style: italic; font-display: swap; }
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-Lt.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-LtIt.woff2') format('woff2'); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-Roman.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-It.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-Md.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-MdIt.woff2') format('woff2'); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-Bd.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Site Helvetica Neue'; src: url('../fonts/web/HelveticaNeueLTPro-BdIt.woff2') format('woff2'); font-weight: 700; font-style: italic; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  accent-color: var(--ink);

  --bg: #fbfcfc;
  --surface: #ffffff;
  --ink: #231f20;
  --muted: #474e54;          /* small text over the photo */
  --line: #e1e4e6;
  --wash: #f2f5f6;
  --accent: #a30b3f;         /* deep cherry, the one red: logo, emphasis, buttons */
  --accent-ink: var(--accent);  /* was a darker cherry for small text; deep cherry is dark enough */
  --accent-deep: var(--accent); /* the same red; the name stays so the rules that use it don't change */
  --burgundy: #680126;       /* dark burgundy: the name on hover */
  --graphite: #5b6166;
  --alert: #b3261e;

  --sans: 'Site Helvetica Neue', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.3, 0.7, 0.2, 1);

  --measure: 58rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --mh: 7rem;                /* header height, set from JS */

  /* iPhone Safari paints the strips behind the Dynamic Island and its toolbar in one
     flat colour: these are the photo's own colours at its top and bottom. */
  --edge-top: #f3f6f8;
  --edge-bottom: #a3c2d9;

  /* Glass: frosted tiles and fields over the valley */
  --glass: linear-gradient(180deg, rgb(255 255 255 / 0.7), rgb(255 255 255 / 0.56));
  --glass-blur: blur(14px) saturate(1.35);
  /* The frosted band at the foot of the window on phones and tablets (the survey's
     button band, the letter's bottom fade): its tint (as RGB numbers) and its blur */
  --band-tint: 226 235 243;
  --band-blur: 24px;
  --field-bg: rgb(255 255 255 / 0.62);
  --field-edge: 0 0 0 1px rgb(27 43 58 / 0.14), 0 1px 2px rgb(20 40 60 / 0.05);
  --field-edge-hover: 0 0 0 1px rgb(27 43 58 / 0.28), 0 6px 16px -12px rgb(20 40 60 / 0.3);
  --field-focus: 0 0 0 2px var(--ink), 0 8px 22px -14px rgb(20 40 60 / 0.5);
  --field-h: 58px;           /* a field with its label inside */
}

/* Wide-gamut screens (recent iPhones, Macs, most flagship Android phones) get the
   fuller deep cherry and a richer dark burgundy (about 15% more chroma, the same
   lightness, so text contrast is unchanged). */
@media (color-gamut: p3) {
  :root { --accent: color(display-p3 0.614 0.017 0.236); --burgundy: color(display-p3 0.387 0.005 0.143); }
}

/* The valley photo behind every page. HDR screens get stewart-backdrop-hdr.jpg: the
   same faded photo as the WebP (identical on ordinary screens), plus a gain map that
   lifts the glacier, the cloud edges and the sky above page white. Everyone else keeps
   the lighter WebP. */
:root { --backdrop-photo: url('../img/stewart-backdrop.webp'); }
@media (dynamic-range: high) {
  :root { --backdrop-photo: url('../img/stewart-backdrop-hdr.jpg'); }
}

/* ---------- Reset and type ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--mh) + 1rem); background-color: var(--edge-bottom); }
/* No double-tap zoom (the viewport meta also turns off pinch zoom where the browser allows it) */
html { touch-action: manipulation; }
/* No grey tap flash on phones: it drew a square box over the rounded answers (the tap
   lands on the answer's invisible input). Every button and answer shows its own pressed
   or chosen state. */
html { -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  isolation: isolate;
  background-color: var(--edge-bottom);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.5;
  font-size-adjust: from-font;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
h1:focus, h2:focus { outline: none; }

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important; clip-path: inset(50%) !important; overflow: hidden !important;
  width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important;
  border: 0 !important; white-space: nowrap !important;
}
.skip-link { position: fixed; inset-block-start: 0.5rem; inset-inline-start: 0.5rem; z-index: 100; padding: 0.75rem 1rem; background: var(--ink); color: var(--surface); }
.skip-link:not(:focus) { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }

.lede { margin: 1rem 0 0; font-size: 1.15rem; max-width: 40em; }
.meta { margin: 0.75rem 0 0; font-size: 0.92rem; color: var(--muted); }
.fine { margin: 1.25rem 0 0; font-size: 0.88rem; color: var(--muted); }

/* ---------- The valley backdrop ---------- */
/* A fixed layer behind everything: the photo under a light veil, fading at the very
   bottom into the blue Safari uses for the strip behind its toolbar. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgb(163 194 217 / 0) calc(100% - 52px), rgb(163 194 217 / 0.35) calc(100% - 28px), var(--edge-bottom) 100%),
    linear-gradient(to bottom, rgb(251 252 252 / 0.9) 0%, rgb(251 252 252 / 0.72) 45%, rgb(251 252 252 / 0.35) 100%),
    var(--backdrop-photo) center 70% / cover no-repeat;
}
@supports not (background-image: url('x.webp')) {
  body::before { background-image: linear-gradient(to bottom, rgb(251 252 252 / 0.9), rgb(251 252 252 / 0.35)), url('../img/stewart-backdrop.jpg'); }
}
/* Upright windows (phones, tablets): the veil and the photo are sized to 100vh and hang
   from the top (the same crop as covering the window), so they stay still while Safari's
   toolbar grows and shrinks. The window's height changes then; 100vh doesn't. Only the
   blue at the foot follows the window's bottom edge. */
@media (max-aspect-ratio: 13159/10000) {
  body::before {
    background-size: 100% 100%, 100% 100vh, max(100%, calc(100vh * 1.3159)) auto;
    background-position: 0 0, 0 0, center top;
  }
}
/* Content scrolling behind Safari's toolbar is covered in the same blue: a sticky,
   zero-height layer whose shadow is page content, which Safari does draw there. */
body::after {
  content: '';
  display: block;
  position: sticky;
  bottom: 0;
  height: 0;
  flex: none;
  box-shadow: 0 130px 0 130px var(--edge-bottom);
  z-index: 40;
  pointer-events: none;
}

/* ---------- Header: "Roman" centred, the tagline to its right ---------- */
.masthead {
  --logo: 3.5rem;
  --head-pad: 3.2rem;
  position: sticky;
  top: 0;
  z-index: 20;
  background: transparent;
  box-shadow: 0 -120px 0 0 var(--edge-top); /* carries the pale colour up behind the Dynamic Island */
}
.masthead-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-block-start: var(--head-pad);
  padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px));
}
.survey-name {
  margin: 0;
  align-self: center;
  font-size: calc(var(--logo) * 0.36);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-box: trim-both cap alphabetic;
}
.brand {
  display: grid;
  justify-items: center;
  color: inherit;
  text-decoration: none;
  line-height: 1;
}
.brand:hover { color: inherit; }
.brand-title {
  font-weight: 700;
  font-size: var(--logo);
  line-height: 0.8;
  letter-spacing: -0.05em;
  color: var(--accent-deep);
  text-box: trim-both cap alphabetic;
  transition: color 0.25s ease;
}
.brand:hover .brand-title, .brand:focus-visible .brand-title { color: var(--burgundy); }

/* The name, where it is set letter by letter (.bl): hovering turns it burgundy one
   letter after another, and on a first visit the letters come into focus
   (js/logo-intro.js sets .logo-intro). */
.brand-title .bl { color: var(--accent-deep); transition: color 0.4s ease; }
.brand-title .bl:nth-child(2) { transition-delay: 60ms; }
.brand-title .bl:nth-child(3) { transition-delay: 120ms; }
.brand-title .bl:nth-child(4) { transition-delay: 180ms; }
.brand-title .bl:nth-child(5) { transition-delay: 240ms; }
.brand:is(:hover, :focus-visible) .brand-title .bl { color: var(--burgundy); }
.logo-intro .brand-title .bl { animation: logo-focus 1.1s cubic-bezier(.2, .7, .2, 1) both; animation-delay: 0.2s; }
.logo-intro .brand-title .bl:nth-child(2) { animation-delay: 0.275s; }
.logo-intro .brand-title .bl:nth-child(3) { animation-delay: 0.35s; }
.logo-intro .brand-title .bl:nth-child(4) { animation-delay: 0.425s; }
.logo-intro .brand-title .bl:nth-child(5) { animation-delay: 0.5s; }
@keyframes logo-focus { from { opacity: 0; filter: blur(16px); } to { opacity: 1; filter: blur(0); } }
@media (prefers-reduced-motion: reduce) { .logo-intro .brand-title .bl { animation: none; } }
.brand .brand-sub-stacked { display: none; }
.brand-tag {
  grid-column: 3;
  justify-self: end;
  align-self: center;
  margin: 0;
  font-size: calc(var(--logo) * 0.414);
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.015em;
  color: var(--ink);          /* the page's text colour (navy on the letter and the survey) */
  white-space: nowrap;
  text-box: trim-both cap alphabetic;
}
.save-status { margin: 0; font-size: 0.78rem; color: var(--muted); text-align: end; }

@media (min-width: 64rem) {
  .masthead-inner { max-width: calc(78.5rem + 2 * var(--gutter)); }
}
@media (min-width: 64rem) and (max-height: 820px) { .masthead { --logo: 3rem; --head-pad: 2rem; } }
@media (max-height: 780px) { .masthead { --logo: 2.6rem; } }
/* Phones: the name, a little larger, and the tagline in two lines to its right */
@media (max-width: 34rem) {
  .masthead { --logo: 2.2rem; --head-pad: 1.7rem; }
  .survey-name { display: none; }
  .brand { grid-column: 2; }
  .brand-title { font-size: calc(var(--logo) * 1.1); }
  .brand-tag {
    grid-row: 1;
    max-width: 5.3em;
    font-size: calc(var(--logo) * 0.5);
    line-height: 1.12;
    letter-spacing: -0.01em;
    text-align: end;
    white-space: normal;
    text-wrap: balance;
    text-box: none;
  }
}
@media (max-width: 34rem) and (max-height: 780px) { .masthead { --logo: 1.85rem; --head-pad: 1.1rem; } }

/* ---------- Buttons ---------- */
/* The one action style: a black pill with a white arrow disc. */
.btn-go {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  min-height: 56px;
  padding: 0.4rem 0.4rem 0.4rem 1.6rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s;
}
a.btn-go, a.btn-go:hover, a.btn-go:focus-visible { color: #fff; text-decoration: none; }
.btn-go[disabled] { opacity: 0.6; cursor: progress; }
.btn-go .disc { width: 44px; height: 44px; background: #fff; color: var(--ink); }
/* On hover the white circle slides 4px forward and the pill grows 4px to the right
   with it, so the circle keeps even spacing inside the pill. The pill's colour is a
   layer behind the content (::before), so it grows without moving anything else on
   the page, whichever way the button is aligned. */
.btn-go { position: relative; isolation: isolate; background: transparent; }
.btn-go::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--ink);
  transition: right 0.25s cubic-bezier(0.3, 1.4, 0.5, 1), background-color 0.2s;
}
@media (hover: hover) {
  .btn-go:hover::before { right: -4px; background: var(--accent); }
  .btn-go:hover .disc { translate: 4px 0; color: var(--accent); }
}
.disc {
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: translate 0.25s cubic-bezier(0.3, 1.4, 0.5, 1), background-color 0.2s, color 0.2s, border-color 0.2s;
}
.disc svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* Centre the letters, not the line box (LT Pro's deep descender space) */
.btn-label { line-height: 1; text-box: trim-both cap alphabetic; }
@supports not (text-box: trim-both cap alphabetic) { .btn-label { translate: 0 0.12em; } }

.btn-primary, .btn-secondary, .btn-quiet {
  min-height: 52px;
  padding: 0.7rem 1.5rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary, .btn-secondary { border-radius: 999px; }
.btn-primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
@media (hover: hover) { .btn-primary:hover { background: var(--accent); border-color: var(--accent); } }
.btn-primary[disabled] { opacity: 0.6; cursor: progress; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--ink); }
@media (hover: hover) { .btn-secondary:hover { background: var(--ink); color: var(--surface); } }
.btn-quiet {
  padding-inline: 0.2rem;
  background: none;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.btn-quiet:hover { color: var(--accent); }
.btn-small { min-height: 44px; padding: 0.4rem 1.1rem; font-size: 0.95rem; }

@media (max-width: 34rem) {
  .btn-go { min-height: 50px; font-size: 1rem; padding-inline-start: 1.3rem; }
  .btn-go .disc { width: 40px; height: 40px; }
}
@media (max-width: 34rem) and (max-height: 780px) {
  .btn-go { min-height: 44px; }
  .btn-go .disc { width: 36px; height: 36px; }
}

/* ---------- Fields: rounded boxes with the label inside ----------
   Frosted white with a navy hairline. The label sits small at the top left inside the box
   and the answer below it; an empty field shows its label large in the middle, like a
   placeholder, until it is focused (inputs marked placeholder=" "). Focus: white and a
   2px navy ring. See DESIGN.md, Text fields. */
input[type='text'], input[type='email'], input[type='tel'], select, textarea {
  width: 100%;
  min-height: 54px;
  padding: 0.85rem 1.1rem;
  font: inherit;
  font-size: max(1rem, 1em);
  color: var(--ink);
  background-color: var(--field-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 0;
  border-radius: 16px;
  box-shadow: var(--field-edge);
  transition: box-shadow 0.2s, background-color 0.2s;
}
:is(input[type='text'], input[type='email'], input[type='tel'], select, textarea):hover { box-shadow: var(--field-edge-hover); }
:is(input[type='text'], input[type='email'], input[type='tel'], select, textarea):focus { outline: none; background-color: #fff; box-shadow: var(--field-focus); }
:is(input, textarea):user-invalid { background-color: rgb(253 241 240 / 0.9); box-shadow: 0 0 0 1.5px var(--alert); }
::placeholder { color: rgb(56 74 92 / 0.62); opacity: 1; }
select {
  appearance: none;
  padding-inline-end: 2.8rem;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 1.5rem center, right 1.15rem center;
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  background-repeat: no-repeat;
}
textarea {
  min-height: 0;
  min-block-size: 6lh;
  max-block-size: 16lh;
  padding: 1rem 1.1rem;
  line-height: 1.45;
  field-sizing: content;
  resize: vertical;
}
textarea.short { min-block-size: 3lh; }

/* The label inside: a .field whose label comes straight before its input */
.field:has(> label:not(.visually-hidden) + :is(input, select, textarea)) { position: relative; }
.field > label:not(.visually-hidden):has(+ :is(input, select, textarea)) {
  position: absolute;
  z-index: 1;
  top: 0.62rem;
  left: 1.1rem;
  right: 0.75rem;
  margin: 0;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  transition: top 0.18s var(--ease), font-size 0.18s var(--ease), translate 0.18s var(--ease), color 0.18s;
}
.field > label:not(.visually-hidden):has(+ :is(input, select, textarea)) .hint { font-weight: 400; }
.field > label:not(.visually-hidden) + :is(input, select) { min-height: var(--field-h); padding-block: 1.5rem 0.4rem; }
.field > label:not(.visually-hidden):has(+ select) { right: 2.5rem; }
.field > label:not(.visually-hidden) + select { background-position: right 1.5rem calc(50% + 0.5rem), right 1.15rem calc(50% + 0.5rem); }
.field > label:not(.visually-hidden) + textarea { padding-top: 1.75rem; }
/* empty and not focused: the label rests in the middle at full size */
.field > label:not(.visually-hidden):has(+ input[placeholder=' ']:placeholder-shown:not(:focus)) {
  top: calc(var(--field-h) / 2);
  translate: 0 -50%;
  font-size: 1rem;
  font-weight: 400;
  color: rgb(56 74 92 / 0.8);
}
.field > label:has(+ :focus) { color: var(--ink); }
@media (max-width: 34rem) {
  :root { --field-h: 54px; }
  input[type='text'], input[type='email'], input[type='tel'], select { min-height: 50px; }
  input[type='text'], input[type='email'], input[type='tel'], select, textarea { border-radius: 14px; }
  textarea { min-block-size: 4.5lh; }
}
@media (prefers-reduced-motion: reduce) { .field > label { transition: none; } }

.relink { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.relink input { flex: 1 1 14rem; min-height: 48px; }

/* ---------- Pop-up cards (welcome back, sign-in notices, the home page's updates ask) ---------- */
dialog.notice {
  width: min(30rem, calc(100vw - 2 * var(--gutter)));
  max-width: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: #fbfcfc;
  box-shadow: inset 1.5px 1.5px 0 #fff, 0 0 0 1px rgb(35 31 32 / 0.08), 0 30px 70px -30px rgb(20 40 60 / 0.55);
  color: var(--ink);
  overflow: visible;
}
dialog.notice::backdrop { background: rgb(35 45 55 / 0.34); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog.notice .banner-box { position: relative; padding: 1.8rem 1.8rem 1.6rem; }
dialog.notice h2 { margin: 0; font-weight: 300; font-size: 2rem; letter-spacing: -0.025em; line-height: 1.1; }
dialog.notice p { margin: 0.8rem 0 0; font-size: 1.02rem; line-height: 1.5; color: #3b3f43; }
dialog.notice p strong { color: var(--ink); font-weight: 500; }
dialog.notice .relink { margin-top: 1rem; }
.notice-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.4rem; margin-top: 1.5rem; }
.notice-actions .btn-quiet { min-height: 44px; padding: 0; color: var(--muted); }
.notice-actions .btn-quiet:hover { color: var(--ink); }
.notice-actions .btn-quiet[data-armed='true'] { color: var(--alert); }
.notice-x { position: absolute; top: 0.9rem; right: 0.9rem; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgb(35 31 32 / 0.06); color: var(--ink); font: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.notice-x:hover { background: rgb(35 31 32 / 0.1); }
@media (prefers-reduced-motion: no-preference) {
  dialog.notice { transition: opacity 0.3s ease, translate 0.35s var(--ease), display 0.35s allow-discrete, overlay 0.35s allow-discrete; }
  dialog.notice::backdrop { transition: opacity 0.3s ease, display 0.3s allow-discrete, overlay 0.3s allow-discrete; }
  dialog.notice:not([open]), dialog.notice:not([open])::backdrop { opacity: 0; }
  dialog.notice:not([open]) { translate: 0 10px; }
  @starting-style {
    dialog.notice[open], dialog.notice[open]::backdrop { opacity: 0; }
    dialog.notice[open] { translate: 0 10px; }
  }
}
@media (max-width: 34rem) {
  dialog.notice .banner-box { padding: 1.5rem 1.35rem 1.35rem; }
  dialog.notice h2 { font-size: 1.7rem; }
  .notice-actions { justify-content: center; }
  .notice-actions .btn-go { width: 100%; justify-content: space-between; }
}

/* ---------- Plain pages (Sources, Privacy) ---------- */
main {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding: 2.25rem var(--gutter) 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}
main:focus { outline: none; }
.screen-head { margin-block-end: 2rem; }
.screen-head h1 { font-weight: 300; font-size: clamp(2.5rem, 7vw + 0.6rem, 4.4rem); line-height: 1; letter-spacing: -0.02em; }
.doc h2 { font-weight: 300; font-size: 1.8rem; margin: 2.25rem 0 0.6rem; }
.doc ul { padding-inline-start: 1.2rem; }
.doc li + li { margin-block-start: 0.4rem; }
@media (max-width: 34rem) { main { padding-block: 1.75rem 0.5rem; } }

/* ---------- Footer: text and links, nothing behind them ---------- */
.site-footer {
  padding: 0.6rem var(--gutter) max(0.8rem, calc(env(safe-area-inset-bottom, 0px) + 0.4rem));
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}
.site-footer p { display: inline; margin: 0 0.4rem; }
.site-footer a { margin-inline: 0.35rem; color: var(--muted); }
@media (max-width: 34rem) {
  .site-footer { padding-block: 0.1rem max(0.45rem, env(safe-area-inset-bottom, 0px)); font-size: 0.75rem; line-height: 1.4; letter-spacing: -0.005em; }
  .site-footer p { display: block; margin: 0; }
  .site-footer p + p { margin-top: 0.15rem; }
  /* the authorization line wraps on narrow phones (the phone number stays on one line, js/footer.js) */
  .site-footer p:first-child { text-wrap: balance; }
  .site-footer a { white-space: nowrap; }
}

/* ---------- Moving between pages: a soft cross-fade ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.45s; animation-timing-function: ease; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Letter page to survey: "Your town, your call" ----------
   Clicking through to the survey from the letter fades in a frosted view of the
   valley over the page and raises the survey's name in large type, word by word
   (js/intro-transition.js). The frost is opaque, so the page change underneath
   never shows: the survey opens under the identical frost and words, waits until
   its first question has drawn, then the words fly up into its header label while
   the frost fades and the survey rises in (js/intro-arrive.js). Skipped for
   reduced motion. */
.intro-veil {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-content: center;
  justify-items: center;
  padding: var(--gutter);
  overflow: hidden;
  pointer-events: none;
}
.intro-leave .intro-veil,
.intro-arrive .intro-veil { display: grid; }
/* The frost: the valley photo, blurred, under a white wash with a little of the blue
   from the foot of the page. It is drawn from a 64-pixel copy of the photo built into
   this file (under 1 KB): blurred this much it looks the same as the full photo, and
   it is on screen the instant a page paints, so the frost does not flash white while
   the full-size photo decodes after the page change. */
.intro-veil::before,
.intro-veil::after { content: ''; position: absolute; transition: opacity 0.6s ease; }
.intro-veil::before {
  inset: -48px;
  background: url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5Ojf/2wBDAQoKCg0MDRoPDxo3JR8lNzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzf/wAARCAAxAEADASIAAhEBAxEB/8QAGgAAAwEBAQEAAAAAAAAAAAAAAAIEAwUBB//EADIQAAEDAQUHAQYHAAAAAAAAAAEAAhEDBBIhMUETIjIzUWFxBRQ0QoGRoVJzsdHh8PH/xAAXAQADAQAAAAAAAAAAAAAAAAAAAQID/8QAGhEBAQEBAAMAAAAAAAAAAAAAAAEREiFBQv/aAAwDAQACEQMRAD8A+k3Kb+Fxk6FK6gRofoue2rUpwA6RlDlRSt1RohwvCeHX5LeWsbjU0+yXZqijUpV+Bwn8JzWmz7KtqfCLZo2atFLsmFEalHVGRDs03s7ugHkq65RbqJWFotVnocRF7oMSjqnkS2mziq11SgGhsBzR1GqkIOBGcA4J2vc1pukxqJwQKhiBos5V0pJdvHOcwrbP6gWtDKovaXv3URIB3RA6FF2TOXlVqcdN9tIGDBPlS1rdVcCA4NHYLEF+TX3o0iQvHuL3ukXYGohGwYxfWJ+JTvcFQRiQac4xN1eGm5oJfRPyIKfRY1g6L2J/1LfMxK0s0vrtbgcdVk0Fx4MBpnKSmbRMC8Y8z9lY1rXvEOxiccytTTA/lT0eOcHvGFzeBwg5jukqPc5/KluRaHEAldPZsneAJ7rOqQxzTGBIExknKWIQKh4ad0Z3QNfqtH36zHsfSxiQYie3VVBoxHX7pXtcBg/HQQnoxzfiVHp/vCEIEU23kU/7oqm8pvhCFPzD9sn8xqWvymfmN/VCEQFfwr2twjyhCcFf/9k=") center top / max(100%, calc(100vh * 1.3159)) auto no-repeat, #bfcad4;
  filter: blur(22px) saturate(1.2);
}
.intro-veil::after {
  inset: 0;
  background: linear-gradient(to top, rgb(40 150 220 / 0.16), rgb(40 150 220 / 0) 45%), rgb(251 252 252 / 0.72);
}
.intro-words {
  position: relative;
  z-index: 1;
  margin: 0;
  font-weight: 300;
  font-size: clamp(3.1rem, 9.6vw, 8.8rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: #1b2b3a;
  text-align: center;
  text-wrap: balance;
}
.intro-words .w { display: inline-block; overflow: hidden; vertical-align: top; padding-block-end: 0.1em; margin-block-end: -0.1em; }
.intro-words .w > span { display: inline-block; }

/* Leaving the letter */
.intro-leave .intro-veil { animation: intro-fade-in 0.5s ease both; }
.intro-leave .intro-words .w > span { animation: intro-rise 0.8s var(--ease) both; }
.intro-leave .intro-words .w:nth-child(1) > span { animation-delay: 0.15s; }
.intro-leave .intro-words .w:nth-child(2) > span { animation-delay: 0.23s; }
.intro-leave .intro-words .w:nth-child(3) > span { animation-delay: 0.35s; }
.intro-leave .intro-words .w:nth-child(4) > span { animation-delay: 0.43s; }
@keyframes intro-fade-in { from { opacity: 0; } }
@keyframes intro-rise { from { translate: 0 105%; filter: blur(6px); opacity: 0; } }

/* Arriving at the survey: the label the words fly into waits for them; then the
   frost clears and the page rises in underneath */
.intro-arrive .masthead .survey-name { opacity: 0; }
.intro-out .intro-veil::before,
.intro-out .intro-veil::after { opacity: 0; transition-delay: 0.4s; }
.intro-out #screen,
.intro-out .steps { animation: intro-page-in 0.8s var(--ease) 0.45s both; }
@keyframes intro-page-in { from { opacity: 0; translate: 0 14px; } }

/* On an iPhone the frost stops at the top of Safari's bottom bar: Safari fills the strip
   behind the bar with the page's own colour (html's background, our toolbar blue). While
   the frost is up, that colour is the frost's foot (#d4e2ec, measured on an iPhone), so
   the frost runs to the bottom of the screen. It fades in and out with the frost. */
html.intro-leave { background-color: #d4e2ec; transition: background-color 0.5s ease; }
html.intro-arrive { background-color: #d4e2ec; }
html.intro-arrive.intro-out { background-color: var(--edge-bottom); transition: background-color 0.6s ease 0.4s; }

/* ---------- Behind the iPhone's status bar ----------
   Safari 26 on iPhone no longer reads theme-color. It fills the strip behind the status
   bar with the colour of a fixed, full-width element at the very top of the page (at
   least 6px tall), and otherwise with the body's colour (our toolbar blue). .top-tint is
   that element: 6px of the colour of the valley at the top of each page, above the
   header's empty top edge, so the status bar and the page meet without a pale bar.
   theme-color, for older iPhones and Android, is the same colour on each page.
   iOS only: the feature query matches Safari on iPhone and iPad. */
:root { --top-tint: #f3f6f9; }
.home { --top-tint: #e9eff5; }
.survey-page { --top-tint: #d9e4ef; }
/* HDR screens get the brighter HDR photo, so a lighter tint (#e2ebf7 measured on an iPhone Pro Max) */
@media (dynamic-range: high) {
  :root { --top-tint: #f9fbfd; }
  .survey-page { --top-tint: #e2ebf7; }
}
.top-tint { display: none; }
@supports (-webkit-touch-callout: none) {
  .top-tint {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: max(6px, env(safe-area-inset-top, 0px));
    z-index: 21;
    pointer-events: none;
    background-color: var(--top-tint);
  }
}

/* Unsubscribed page (unsubscribed.html): #unknown shows only when the link didn't match */
.unsub #unknown:not(:target) { display: none; }
.unsub #unknown:target ~ .unsub-done { display: none; }
