/* GONOM — train journeys from the driver's seat */
:root {
  --paper: #e8edf0;
  --surface: #f7f9fa;
  --ink: #16324a;
  --ink-soft: #4a5f70;
  --line: #c9d3da;
  --signal: #f2b01e;
  --signal-ink: #2a1f00;
  --rail: #2f7a57;
  --frame: #1d2a35;
  --display: 'Barlow Condensed', 'Arial Narrow', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --text: 'Barlow', 'Helvetica Neue', Arial, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  --measure: 68ch;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1b25;
    --surface: #152431;
    --ink: #e3eaef;
    --ink-soft: #9fb1bf;
    --line: #2a3d4c;
    --signal: #f5bb36;
    --rail: #4fae82;
    --frame: #050b10;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.6;
}
:lang(ko) { word-break: keep-all; overflow-wrap: anywhere; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.08; margin: 0; letter-spacing: 0.005em; }
.skip { position: absolute; left: -999px; top: 0; background: var(--signal); color: var(--signal-ink); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px var(--gutter);
  max-width: 1320px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-mark circle { fill: var(--ink); }
.brand-mark path { fill: none; stroke: var(--signal); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.55rem; letter-spacing: 0.06em; }
.brand-tag { color: var(--ink-soft); font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-nav { display: flex; gap: 22px; font-weight: 500; }
.site-nav a { text-decoration: none; padding: 4px 0; }
.site-nav a:hover { text-decoration: underline; }
.lang-switch { color: var(--ink-soft); }
@media (max-width: 760px) {
  .brand-tag { display: none; }
  .site-nav { gap: 16px; font-size: 0.95rem; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 1.05rem/1 var(--text);
  padding: 14px 22px; border-radius: 999px; border: 0; cursor: pointer; text-decoration: none;
}
.btn-signal { background: var(--signal); color: var(--signal-ink); }
.btn-signal:hover { filter: brightness(1.06); }

/* Hero */
.hero {
  max-width: 1320px; margin: 0 auto;
  padding: clamp(24px, 5vw, 64px) var(--gutter) clamp(40px, 6vw, 80px);
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 4vw, 64px); align-items: center;
}
.hero h1 { font-size: clamp(2.8rem, 6.4vw, 5.6rem); font-weight: 700; max-width: 10ch; }
.hero-text p { max-width: 38ch; color: var(--ink-soft); font-size: 1.15rem; margin: 20px 0 28px; }
.hero-feature { text-decoration: none; display: block; }
/* The cab window: the one bold element */
.window {
  background: var(--frame);
  padding: clamp(10px, 1.6vw, 18px);
  clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%);
  border-radius: 6px;
}
.window img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  clip-path: polygon(5.3% 0, 94.7% 0, 100% 100%, 0 100%);
  transition: transform 0.6s ease;
}
.hero-feature:hover .window img { transform: scale(1.02); }
.hero-feature-meta { display: flex; align-items: baseline; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.departing {
  margin: 0; font-weight: 600; font-size: 0.95rem;
  display: inline-flex; align-items: center; gap: 8px;
}
.departing::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--rail); box-shadow: 0 0 0 4px color-mix(in srgb, var(--rail) 25%, transparent); }
.hero-feature-name { margin: 0; font-family: var(--display); font-size: 1.6rem; font-weight: 600; }
.hero-feature-name span { font-family: var(--text); font-size: 1rem; font-weight: 400; color: var(--ink-soft); margin-left: 6px; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero h1 { max-width: none; }
}

/* Route list */
.routes { max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter) 80px; }
.routes-head { display: flex; align-items: baseline; justify-content: space-between; border-top: 3px solid var(--ink); padding-top: 18px; }
.routes-head h2 { font-size: clamp(2rem, 3.6vw, 2.8rem); }
.count { margin: 0; color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 30px; }
.chip {
  font: 500 0.95rem/1 var(--text); color: var(--ink);
  background: transparent; border: 1.5px solid var(--line); border-radius: 999px; padding: 9px 15px; cursor: pointer;
}
.chip[aria-pressed='true'] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 36px 28px; }
.card a { text-decoration: none; display: block; }
.card[hidden] { display: none; }
.card-media { position: relative; border-radius: 6px; overflow: hidden; background: var(--frame); }
.card-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card-time {
  position: absolute; right: 8px; bottom: 8px; background: rgba(10, 18, 26, 0.82); color: #fff;
  font-size: 0.82rem; font-weight: 600; padding: 3px 7px; border-radius: 4px;
}
.card-body { padding-top: 12px; }
.card-country { margin: 0; font-size: 0.92rem; color: var(--ink-soft); }
.card h3 { font-size: 1.55rem; margin: 2px 0 8px; }
.card a:hover h3 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.15em; }
.card-ends { margin: 4px 0 0; font-size: 0.95rem; color: var(--ink-soft); }

/* Line diagram */
.strip { width: 100%; height: auto; display: block; overflow: visible; }
.strip .rail { stroke: var(--rail); stroke-width: 6; stroke-linecap: round; }
.strip .st { fill: var(--surface); stroke: var(--rail); stroke-width: 3.5; }
.strip .st-end { fill: var(--ink); stroke: var(--rail); stroke-width: 4; }
.strip text { fill: var(--ink); font: 500 15px var(--text); }
.strip-compact { max-width: 300px; }
.strip-compact .rail { stroke-width: 4; }
.strip-compact .st { stroke-width: 2.5; }
.strip-compact .st-end { stroke-width: 2.5; }

/* Route page */
.route { max-width: 1180px; margin: 0 auto; padding: clamp(16px, 3vw, 40px) var(--gutter) 80px; }
.route-head h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); font-weight: 700; }
.route-country { margin: 0 0 6px; color: var(--ink-soft); font-weight: 500; }
.route-ends { margin: 6px 0 26px; font-size: 1.2rem; color: var(--ink-soft); }
.player {
  position: relative; aspect-ratio: 16 / 9; background: var(--frame); border-radius: 8px; overflow: hidden;
  box-shadow: 0 0 0 clamp(6px, 1vw, 12px) var(--frame);
}
.player-start { all: unset; cursor: pointer; position: absolute; inset: 0; display: block; }
.player-start img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }
.player-start:hover img { opacity: 1; }
.player-start:focus-visible { outline: 3px solid var(--signal); outline-offset: -6px; }
.player-cta {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--signal); color: var(--signal-ink); font: 600 1.15rem/1 var(--text);
  padding: 16px 26px 16px 20px; border-radius: 999px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.player-cta svg { width: 24px; height: 24px; fill: currentColor; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.credit { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 22px; font-size: 0.95rem; color: var(--ink-soft); }
.credit p { margin: 0; }
.license { font-size: 0.9rem; color: var(--ink-soft); margin: 4px 0 0; }
.strip-wrap { margin: 40px 0 8px; overflow-x: auto; padding: 4px 0 6px; }
.strip-wrap .strip { min-width: 720px; }
@media (max-width: 640px) { .strip-wrap { display: none; } }

.route-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(28px, 5vw, 72px); margin-top: 28px; }
@media (max-width: 920px) { .route-body { grid-template-columns: 1fr; } }
.prose { max-width: var(--measure); }
.prose h2 { font-size: 1.9rem; margin: 40px 0 10px; }
.prose p { margin: 0 0 1em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }
.lede { font-size: 1.3rem; line-height: 1.5; }
.video-note, .updated { font-size: 0.92rem; color: var(--ink-soft); }
.route-side { align-self: start; }
.facts { margin: 0; border-top: 3px solid var(--ink); }
.facts div { display: grid; grid-template-columns: 9.5em 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--ink-soft); font-size: 0.95rem; }
.facts dd { margin: 0; font-weight: 500; }
.side-title { font-size: 1.4rem; margin: 32px 0 12px; }
.map { aspect-ratio: 4 / 3; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.station-list { margin: 0; padding: 0; list-style: none; position: relative; }
.station-list li { position: relative; padding: 6px 0 6px 30px; }
.station-list li::before {
  content: ''; position: absolute; left: 4px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--rail); z-index: 1;
}
.station-list li::after { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 4px; margin-left: -1px; background: var(--rail); }
.station-list li:first-child::after { top: 50%; }
.station-list li:last-child::after { bottom: 50%; }
.station-list li:first-child::before, .station-list li:last-child::before { background: var(--ink); }

.next {
  display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: center;
  margin-top: 64px; padding: 18px; border-radius: 10px; background: var(--ink); color: var(--paper); text-decoration: none;
}
.next img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.next-text { display: flex; flex-direction: column; gap: 4px; }
.next-label { font-weight: 600; color: var(--signal); }
.next-name { font-family: var(--display); font-size: clamp(1.8rem, 3.4vw, 2.6rem); font-weight: 600; line-height: 1.05; }
.next-sub { opacity: 0.8; }
.next:hover .next-name { text-decoration: underline; text-decoration-thickness: 2px; }
@media (max-width: 600px) { .next { grid-template-columns: 1fr; } }
.sources { margin-top: 48px; font-size: 0.92rem; color: var(--ink-soft); }
.sources h2 { font-size: 1.2rem; margin-bottom: 6px; color: var(--ink); }
.sources ul { padding-left: 1.1em; margin: 0; }
.sources a { word-break: break-word; }

/* Text pages */
.page { max-width: calc(var(--measure) + var(--gutter) * 2); margin: 0 auto; padding: clamp(24px, 5vw, 56px) var(--gutter) 80px; }
.page h1 { font-size: clamp(2.6rem, 6vw, 4rem); font-weight: 700; margin-bottom: 24px; }
.notfound p { color: var(--ink-soft); }

/* Footer */
.site-footer { background: var(--ink); color: var(--paper); }
.footer-inner { max-width: 1320px; margin: 0 auto; padding: 40px var(--gutter); display: grid; gap: 16px; }
.footer-about { margin: 0; max-width: 60ch; opacity: 0.85; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; font-weight: 500; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-copy { margin: 0; font-size: 0.9rem; opacity: 0.6; }

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