/*
 * Shared brand layer for the server-rendered station, route, guide and review pages.
 * Loaded after each template's inline styles so it can restyle them without
 * touching page structure. Tokens mirror public/index.html.
 */

@font-face {
  font-family: "Space Grotesk";
  src: url("/assets/fonts/space-grotesk-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("/assets/fonts/space-grotesk-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --ink: #1c1b17;
  --muted: #4f4c43;
  --subtle: #6b675b;
  --paper: #f9f6f0;
  --surface: #fffdf9;
  --line: #e4dfd2;
  --line-strong: #cac6b9;
  --rail: #1a6b5a;
  --rail-dark: #0d5c4d;
  --rail-soft: #d8f2e9;
  --signal: #b07c0c;
  --signal-soft: #ffecc9;
  --signal-ink: #7a5200;
  --amber: #ffc266;
  --on-night: #f4fffb;
  --on-night-muted: rgb(227 245 239 / 0.78);
  --shadow: 0 1px 2px rgb(26 23 20 / 0.05), 0 18px 40px -22px rgb(26 23 20 / 0.28);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .09 0 0 0 0 .08 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background: var(--paper);
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece9e0;
    --muted: #cac6b9;
    --subtle: #a9a497;
    --paper: #1a1714;
    --surface: #23201a;
    --line: #36322a;
    --line-strong: #4b483e;
    --rail: #7ad4bf;
    --rail-dark: #a0f2dc;
    --rail-soft: #14372f;
    --signal: #e3a53c;
    --signal-soft: #3a2b10;
    --signal-ink: #ffcf85;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 18px 40px -22px rgb(0 0 0 / 0.7);
  }
}

body {
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

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

.page {
  background:
    radial-gradient(48rem 30rem at 92% -6%, rgb(37 181 152 / 0.16), transparent 64%),
    radial-gradient(36rem 26rem at 100% 0%, rgb(255 194 102 / 0.14), transparent 60%),
    var(--grain),
    var(--paper);
}

.shell {
  width: min(1120px, 100% - 32px);
}

/* Header */

.nav {
  padding: 18px 0;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand img {
  width: 36px;
  height: 36px;
}

.nav-link {
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  transition: transform 180ms var(--ease);
}

.nav-link:hover {
  transform: translateY(-1px);
}

/* Intro */

.station-hero,
.route-hero,
.guide-hero {
  min-height: 0;
  padding: clamp(40px, 7vw, 88px) 0 clamp(64px, 9vw, 112px);
}

.eyebrow {
  gap: 12px;
  color: var(--rail);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.16em;
}

.eyebrow::before {
  width: 28px;
  border-radius: 2px;
  background: var(--signal);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 1.4rem + 5vw, 5.6rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 40rem;
  color: var(--muted);
  font-size: clamp(1.06rem, 1rem + 0.35vw, 1.22rem);
  line-height: 1.6;
}

.status-row span {
  padding: 6px 12px;
  border: 0;
  background: var(--rail-soft);
  color: var(--rail-dark);
  font-weight: 700;
}

/* Buttons */

.button {
  min-height: 54px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: #0b0b0b;
  color: #fff;
  font-weight: 700;
  transition:
    transform 220ms var(--ease),
    box-shadow 220ms var(--ease),
    border-color 220ms var(--ease);
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -18px rgb(0 0 0 / 0.7);
}

.button.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.button.secondary:hover {
  border-color: var(--rail);
  box-shadow: var(--shadow);
}

@media (prefers-color-scheme: dark) {
  .button:not(.secondary) {
    border-color: rgb(255 255 255 / 0.16);
  }
}

.text-link {
  color: var(--rail);
  font-weight: 700;
}

/* Panels and content cards */

.panel {
  padding: clamp(20px, 2.6vw, 28px);
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel h2 {
  font-size: 1.3rem;
}

.panel-heading {
  flex-wrap: wrap;
  align-items: baseline;
}

.panel-heading p {
  color: var(--subtle);
  font-size: 0.95rem;
}

.station-layout,
.route-layout {
  margin-top: clamp(40px, 6vw, 64px);
}

.content-grid {
  gap: 14px;
}

.content-grid .panel h2 {
  font-size: 1.12rem;
}

/* Departures */

.departure-list {
  gap: 6px;
}

.departure-row {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.departure-row time {
  color: var(--rail-dark);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.departure-row small {
  color: var(--subtle);
  font-weight: 600;
}

.departure-row em {
  background: var(--signal-soft);
  color: var(--signal-ink);
  font-weight: 700;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--paper);
}

.detail-list div {
  border-bottom-color: var(--line);
}

.detail-list dt {
  color: var(--subtle);
  font-weight: 700;
}

.detail-list dd {
  font-family: var(--font-display);
  font-weight: 700;
}

/* Station links */

.station-links {
  gap: 8px;
}

.station-link {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.station-link:hover {
  border-color: var(--rail);
}

.station-link small {
  color: var(--subtle);
  font-weight: 600;
}

.station-link em {
  border-radius: 8px;
  background: var(--rail-soft);
  color: var(--rail-dark);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* App strip */

.app-strip {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(28px, 4vw, 44px);
  border: 0;
  border-radius: 28px;
  color: var(--on-night);
  background:
    radial-gradient(30rem 20rem at 100% 120%, rgb(255 194 102 / 0.3), transparent 62%),
    linear-gradient(150deg, #0d5c4d, #0b3f40 50%, #122a33);
}

.app-strip h2 {
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.app-strip p {
  color: var(--on-night-muted);
}

.app-strip .button {
  border-color: rgb(255 255 255 / 0.2);
  background: #0b0b0b;
  color: #fff;
}

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

@media (max-width: 560px) {
  .shell {
    width: min(100% - 32px, 1120px);
  }

  .nav-link {
    display: inline-flex;
    padding: 8px 14px;
    font-size: 0.9rem;
  }

  .panel {
    border-radius: 18px;
  }
}

/* Breadcrumbs */

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  color: var(--subtle);
  font-size: 0.92rem;
  font-weight: 600;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 6px;
  color: var(--line-strong);
}

.breadcrumbs a {
  color: var(--rail);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

h1 .h1-sub {
  display: block;
  margin-top: 0.12em;
  color: var(--rail);
  font-size: 0.42em;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Timetable summaries and full timetables */

/* The hero sections are grids; let their children shrink so wide tables scroll inside
   .table-scroll instead of widening the page. */
.station-hero > *,
.route-hero > *,
.guide-hero > * {
  min-width: 0;
}

.section-block {
  margin-top: clamp(32px, 5vw, 48px);
}

.panel .section-note {
  margin: 0 0 16px;
  color: var(--subtle);
  font-size: 0.95rem;
  line-height: 1.5;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  color: var(--subtle);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.data-table tbody th {
  font-weight: 700;
}

.data-table td {
  white-space: nowrap;
}

.data-table th small,
.data-table td small {
  display: block;
  color: var(--subtle);
  font-weight: 600;
}

.timetable-days {
  display: grid;
  gap: 10px;
}

.timetable-days details {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.timetable-days summary {
  padding: 14px 16px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
}

.timetable-days .table-scroll {
  padding: 0 16px 12px;
}

/* Route cards */

.trip-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trip-link {
  display: grid;
  gap: 2px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 180ms var(--ease), transform 180ms var(--ease);
}

.trip-link:hover {
  border-color: var(--rail);
  transform: translateY(-2px);
}

.trip-link strong {
  font-family: var(--font-display);
}

.trip-link small {
  color: var(--subtle);
  font-weight: 600;
}

/* Questions */

.faq-list {
  display: grid;
  gap: 18px;
  margin: 0;
}

.faq-list dt {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
}

.faq-list dd {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
