/* Styles for the static /city/<slug> pages.
 *
 * These pages never load the React bundle, so they cannot use App.css. The
 * token names and values are copied from it deliberately: the two stylesheets
 * are independent, and a visitor arriving from Google should not be able to
 * tell that this page and the game were built differently.
 *
 * Lives in public/ so Vite copies it as-is. No build step needs to know about it.
 */

:root {
  --bg: #e7ebf1;
  --surface: #ffffff;
  --surface-2: #f3f6fa;
  --ink: #0d1b2a;
  --ink-2: #3d4d61;
  --ink-3: #5f7086;
  --border: #d2dae4;
  --border-strong: #b0bbc9;
  --primary: #0d1b2a;
  --on-primary: #ffffff;
  --accent: #b8460e;
  --accent-soft: #fdf0e7;
  --focus-ring: rgba(13, 27, 42, 0.28);
  --shadow-sm: 0 1px 2px rgba(13, 27, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(13, 27, 42, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --font-display: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
    "Twemoji Mozilla", sans-serif;
  color-scheme: light dark;
}

/* The inline theme script sets data-theme before first paint. The media query
 * covers the case where it never runs, which is every crawler with JS off. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070d15;
    --surface: #0f1a27;
    --surface-2: #152332;
    --ink: #e9eff7;
    --ink-2: #aebdcf;
    --ink-3: #8394aa;
    --border: #23374c;
    --border-strong: #354c65;
    --primary: #ffb020;
    --on-primary: #0a121c;
    --accent: #ffb020;
    --accent-soft: rgba(255, 176, 32, 0.14);
    --focus-ring: rgba(255, 176, 32, 0.42);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  --bg: #070d15;
  --surface: #0f1a27;
  --surface-2: #152332;
  --ink: #e9eff7;
  --ink-2: #aebdcf;
  --ink-3: #8394aa;
  --border: #23374c;
  --border-strong: #354c65;
  --primary: #ffb020;
  --on-primary: #0a121c;
  --accent: #ffb020;
  --accent-soft: rgba(255, 176, 32, 0.14);
  --focus-ring: rgba(255, 176, 32, 0.42);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 20rem;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
dl,
dd,
figure {
  margin: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.wrap {
  width: min(100% - 2rem, 46rem);
  margin-inline: auto;
  padding-block: 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ---------------------------------------------------------------- crumbs -- */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-3);
}

.crumbs span[aria-hidden="true"] {
  color: var(--border-strong);
}

.crumbs [aria-current="page"] {
  color: var(--ink-2);
}

/* ---------------------------------------------------------------- header -- */
.city-header {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.kicker a {
  color: inherit;
}

.city-header h1 {
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.country {
  font-size: 1.05rem;
  color: var(--ink-3);
}

.clue-strip {
  font-family: var(--font-emoji);
  font-size: clamp(1.9rem, 8vw, 2.75rem);
  line-height: 1.3;
  letter-spacing: 0.12em;
  padding: 0.75rem 1rem;
  margin-block-start: 0.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.summary {
  color: var(--ink-2);
  max-width: 62ch;
}

/* ----------------------------------------------------------------- panel -- */
.panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.panel h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-lead {
  font-size: 0.92rem;
  color: var(--ink-3);
  max-width: 60ch;
}

/* ----------------------------------------------------------------- notes -- */
.notes {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.note {
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  gap: 0.85rem;
  align-items: start;
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: var(--radius-md);
}

.note dt {
  display: flex;
  justify-content: center;
}

.note-emoji {
  font-family: var(--font-emoji);
  font-size: 1.6rem;
  line-height: 1.2;
}

.note dd {
  color: var(--ink-2);
}

/* ----------------------------------------------------------------- facts -- */
.facts {
  display: grid;
  gap: 0.75rem;
}

.fact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-block-end: 0.75rem;
  border-block-end: 1px solid var(--border);
}

.fact:last-child {
  padding-block-end: 0;
  border-block-end: none;
}

.fact dt {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.fact dd {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}

.numeric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ------------------------------------------------------------ near table -- */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

table.near {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 22rem;
}

table.near th,
table.near td {
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-block-end: 1px solid var(--border);
}

table.near thead th {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  background: var(--surface-2);
  white-space: nowrap;
}

table.near tbody tr:last-child th,
table.near tbody tr:last-child td {
  border-block-end: none;
}

table.near tbody th {
  font-weight: 600;
}

.near-country {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink-3);
}

table.near td:last-child {
  font-family: var(--font-emoji);
  font-size: 1.1rem;
}

/* ------------------------------------------------------ also read (links) -- */
.also {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-block-start: 0.5rem;
}

.also h3 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.also-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.5rem;
}

.also-list a {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  height: 100%;
  padding: 0.65rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 150ms ease;
}

.also-list a:hover {
  border-color: var(--border-strong);
}

.also-emoji {
  font-family: var(--font-emoji);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.also-name {
  font-weight: 700;
}

.also-distance {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-3);
}

/* ------------------------------------------------------------- city grid -- */
.city-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem;
}

.city-grid a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  height: 100%;
  padding: 0.9rem;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 150ms ease, transform 150ms ease;
}

.city-grid a:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.city-grid-emoji {
  font-family: var(--font-emoji);
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  margin-block-end: 0.2rem;
}

.city-grid-name {
  font-weight: 700;
}

.city-grid-country {
  font-size: 0.8rem;
  color: var(--ink-3);
}

/* ------------------------------------------------- prose page furniture -- */
.panel p {
  color: var(--ink-2);
  max-width: 66ch;
}

.page-list,
.page-steps {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  color: var(--ink-2);
  max-width: 66ch;
}

.page-list ::marker,
.page-steps ::marker {
  color: var(--ink-3);
}

/* Stays a list-item. Making it a flex container drops the ::marker, which took
   the step numbers off a section whose whole point is that it is three steps. */
.page-steps li {
  display: list-item;
}

.page-steps strong {
  display: block;
  color: var(--ink);
  font-weight: 700;
}

.page-faq {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.page-faq-item dt {
  font-weight: 700;
  color: var(--ink);
  margin-block-end: 0.15rem;
}

.page-faq-item dd {
  margin: 0;
  color: var(--ink-2);
  max-width: 66ch;
}

/* The privacy block is the one a school forwards to someone else, so it gets
   a visible edge rather than sitting in the run of panels. */
.privacy {
  border-left: 3px solid var(--accent);
}

.level {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--ink-3);
  white-space: nowrap;
}

tr.is-self {
  background: var(--accent-soft);
}

tr.is-self th {
  color: var(--ink);
}

/* ------------------------------------------------------------------- cta -- */
.cta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.cta h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.cta p {
  color: var(--ink-2);
  max-width: 56ch;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-block-start: 0.25rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.6rem 1.25rem;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.button-quiet {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
  box-shadow: none;
}

/* ---------------------------------------------------------------- footer -- */
.page-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-block-start: 0.5rem;
  font-size: 0.9rem;
  color: var(--ink-3);
}

.page-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

@media (min-width: 40rem) {
  .wrap {
    padding-block: 2.5rem 4rem;
    gap: 1.5rem;
  }

  .city-header,
  .panel,
  .cta {
    padding: 2rem;
  }

  .facts {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }

  .button:hover,
  .city-grid a:hover {
    transform: none;
  }
}
