/*
 * The generated pages (src/pages/build.ts): the cities, FAQ, credits, privacy and 404. The shell
 * (top bar, section nav, intro, footer) comes from shell.css; this adds what these text pages
 * hold: sections as cards, the call to action, tags, source lists and city links.
 *//*
 * The frame every page outside the map shares, drawn by src/pages/shell.ts: tokens, the top bar
 * with its theme switch, the "On this page" nav, the intro and the footer. The insights sheet and
 * the generated pages' sheet import it; /mcp, a Pages Function with a nonce-only policy, links
 * the copy the build writes to dist/shell.css. Page sheets add their own parts on top and never
 * restyle these.
 *//* The theme switch (src/ui/themeToggle.ts), shared by the map and the page shell. It reads only
   the tokens both pages define: --panel, --panel-2, --line, --ink, --ink-2. */
.theme-toggle {
  flex: none;
  /* Holds its place before the script fills it, so nothing in the bar shifts. */
  width: 58px;
  height: 32px;
}

.theme-switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 58px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--ink-2);
  cursor: pointer;
}

.theme-switch:hover {
  color: var(--ink);
}

.theme-switch:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.theme-switch svg {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The knob sits under the active icon, so the state shows in position, not color alone. */
.theme-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
  transition: transform 0.18s ease;
}

.theme-switch[aria-checked='true'] .theme-knob {
  transform: translateX(26px);
}

.theme-switch[aria-checked='false'] .theme-sun,
.theme-switch[aria-checked='true'] .theme-moon {
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .theme-knob {
    transition: none;
  }
}

/* A phone's top bar has no room for the track: the switch becomes one round button showing the
   mode in effect, the size the other bar buttons are. Same breakpoint as the map's phone layout. */
@media (max-width: 900px), (max-height: 520px) {
  .theme-toggle,
  .theme-switch {
    width: 36px;
    height: 36px;
  }

  .theme-switch {
    justify-content: center;
    padding: 0;
    border-radius: 50%;
  }

  .theme-knob,
  .theme-switch[aria-checked='true'] .theme-sun,
  .theme-switch[aria-checked='false'] .theme-moon {
    display: none;
  }

  .theme-switch svg {
    width: 16px;
    height: 16px;
  }
}

@media print {
  .theme-toggle {
    display: none;
  }
}

:root {
  --ground: #e6e9ee;
  --panel: #ffffff;
  --panel-2: #f3f5f8;
  --line: rgb(20 30 50 / 0.09);
  --ink: #1b2230;
  --ink-2: #4f5a6d;
  /* Dark enough for 4.5:1 on white and on the ground. */
  --ink-3: #5f697c;
  /* Text on an ink fill (buttons, tags); ink flips light in dark mode, so this flips dark. */
  --on-ink: #ffffff;
  --ink-hover: #2c3547;
  --underline: rgb(20 30 50 / 0.3);
  --radius: 14px;
  --shadow: 0 1px 2px rgb(20 30 50 / 0.06), 0 10px 28px rgb(20 30 50 / 0.08);
  --display: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --body: 'Barlow', system-ui, sans-serif;
  color-scheme: light;
}

/* Dark mode, set by public/theme.js before the first paint, with the map's values (src/style.css).
   Screen only, so print stays light (docs/dark-mode.md). */
@media screen {
  :root[data-theme='dark'] {
    --ground: #14181e;
    --panel: #1d222a;
    --panel-2: #272d37;
    --line: rgb(255 255 255 / 0.1);
    --ink: #e7eaef;
    --ink-2: #b0b8c5;
    --ink-3: #959fae;
    --on-ink: #14181e;
    --ink-hover: #ffffff;
    --underline: rgb(255 255 255 / 0.3);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ground);
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 500 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

a {
  color: var(--ink);
  text-decoration-color: var(--underline);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: currentColor;
}

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

[hidden] {
  display: none !important;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 3;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
}

.skip:focus {
  top: 8px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font: 800 20px var(--display);
  text-decoration: none;
}

/* A strip of locator paint, as on the map. */
.mark {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(
    90deg,
    #e3262b 0 20%,
    #f2c200 20% 40%,
    #f47c20 40% 60%,
    #1f6fd1 60% 80%,
    #2e9a48 80%
  );
}

.site-nav {
  display: flex;
  gap: 4px;
  min-width: 0;
  margin-left: auto;
}

.site-nav a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--ink);
  background: var(--panel-2);
}

/* The page you're on, in ink on a tint with a rule under it, so it doesn't rest on color alone. */
.site-nav a[aria-current='page'] {
  color: var(--ink);
  background: var(--panel-2);
  box-shadow: inset 0 -2px 0 var(--ink);
}

/* The section nav on the left, one readable column beside it. The column keeps its place on a
   page without the nav, so every page's text starts at the same spot. */
.layout {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  gap: 0 48px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 24px 48px;
}

.side {
  position: sticky;
  top: 88px;
  grid-row: 1 / span 2;
  align-self: start;
}

.side p {
  margin: 0 0 8px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.side ol {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.side a {
  display: block;
  padding: 6px 10px;
  border-left: 3px solid transparent;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}

.side a:hover {
  background: var(--panel);
  color: var(--ink);
}

.side a[aria-current='true'] {
  border-left-color: var(--ink);
  background: var(--panel);
  color: var(--ink);
}

.page {
  grid-column: 2;
  min-width: 0;
  max-width: 820px;
}

.intro {
  margin: 0 0 36px;
}

.kicker {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
}

h1 {
  margin: 2px 0 10px;
  font: 800 52px/1 var(--display);
  letter-spacing: -0.01em;
}

.lede {
  margin: 0;
  max-width: 34em;
  color: var(--ink-2);
  font-size: 19px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.chip svg {
  display: block;
  flex: none;
  width: 15px;
  height: 15px;
}

.site-foot {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  max-width: 820px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
}

.site-foot a {
  color: var(--ink-2);
}

.site-foot a:hover {
  color: var(--ink);
}

/* Under 960px the section nav becomes a row of links that sticks under the top bar. */
@media (max-width: 960px) {
  html {
    scroll-padding-top: 116px;
  }

  .layout {
    display: block;
    padding: 28px 16px 40px;
  }

  .side {
    position: sticky;
    top: 56px;
    z-index: 1;
    margin: -28px -16px 24px;
    padding: 8px 16px;
    background: var(--ground);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .side::-webkit-scrollbar {
    display: none;
  }

  .side p {
    display: none;
  }

  .side ol {
    display: flex;
    gap: 4px;
    width: max-content;
  }

  .side a {
    padding: 6px 10px;
    border-left: 0;
    white-space: nowrap;
  }

  .side a[aria-current='true'] {
    box-shadow: inset 0 -2px 0 var(--ink);
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 10px;
  }

  h1 {
    font-size: 42px;
  }

  .lede {
    font-size: 17px;
  }

  /* If the links still don't fit, they scroll rather than slide under the theme switch. */
  .site-nav {
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav a {
    padding: 6px;
    font-size: 14px;
  }

  /* The brand mark is the way back to the map, so the bar keeps the other links. */
  .site-nav a[href='/'] {
    display: none;
  }
}

@media (max-width: 440px) {
  /* The brand's word goes first, so every link still fits beside the mark. */
  .brand span:last-child {
    display: none;
  }
}

@media print {
  .topbar,
  .side,
  .skip {
    display: none;
  }
}

:root {
  --hivis: #ffd60a;
}

.intro .lede + .cta,
.intro .lede + .intro-note {
  margin-top: 22px;
}

.intro-note {
  margin: 0;
  max-width: 40em;
  color: var(--ink-2);
}

.cta {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 22px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--on-ink);
  font: 700 18px var(--body);
  text-decoration: none;
}

.cta:hover {
  background: var(--ink-hover);
}

.cta:focus-visible {
  outline-offset: 3px;
}

/* Each section is a panel on the ground, as the insights and /mcp cards are. */
.block {
  margin: 0 0 16px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 17px;
}

.block > h2 {
  margin: 0 0 8px;
  font: 800 32px/1.05 var(--display);
}

.block > p,
.block > ul {
  max-width: 42em;
}

.block > p {
  margin: 0 0 12px;
}

.block > :last-child {
  margin-bottom: 0;
}

.faq-q {
  margin: 20px 0 6px;
  font: 700 19px/1.3 var(--body);
}

.block > h2 + .faq-q {
  margin-top: 12px;
}

b {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.warn {
  border-left: 4px solid var(--hivis);
}

.beta {
  margin: 0 0 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink-2);
}

.beta strong {
  color: var(--ink);
}

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.kicker .tag {
  margin-left: 6px;
}

.note {
  color: var(--ink-3);
  font-size: 15px;
}

/* A line of fine print between the cards. */
.page > .note {
  margin: 0 0 16px;
}

.sources {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.sources li {
  display: grid;
  gap: 1px;
}

.sources span {
  color: var(--ink-3);
  font-size: 15px;
}

.city-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.city-list a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-weight: 600;
  text-decoration: none;
}

.city-list a:hover {
  border-color: var(--underline);
}

.city-list .tag {
  margin-left: 4px;
}

.plain-list {
  margin: 0 0 12px;
  padding-left: 20px;
}

.plain-list li + li {
  margin-top: 8px;
}

@media (max-width: 560px) {
  .block {
    padding: 16px;
  }

  .block > h2 {
    font-size: 27px;
  }
}

/* The maker's LinkedIn and GitHub on /about, as icons in the sentence, each with room to tap. */
.maker-links {
  display: inline-flex;
  gap: 2px;
  margin: 0 2px 0 6px;
  vertical-align: -5px;
}

.maker-links a {
  display: inline-flex;
  padding: 3px;
  border-radius: 6px;
  color: var(--ink-2);
}

.maker-links a:hover {
  color: var(--ink);
  background: var(--panel-2);
}

.maker-links svg {
  width: 19px;
  height: 19px;
}
