/* 막차편: Skillry "Airy Flight Booking" 시각 체계(버스편과 같은 계열)를 막차 시간표로 옮긴 것.
   accent는 밤 시간대에 맞춰 버스편보다 어두운 남색이다.
   1 토큰  2 바탕·셸  3 머리·꼬리  4 글자  5 홈 히어로·검색  6 지역별 역  7 시간표 카드  8 심야버스·FAQ  9 모션 */

/* 1. 토큰 */
:root {
  --ground: #cddbe8;
  --shell: #ffffff;
  --paper: #f6f8fb;
  --sky-50: #f1f5fa;
  --sky-100: #e4ecf5;
  --sky-200: #cfdcea;
  --ink: #0d1726;
  --ink-2: #2c3a4d;
  --muted: #546478;
  --faint: #8a97a8;
  --line: rgba(13, 30, 60, .10);
  --line-strong: rgba(13, 30, 60, .18);
  --accent: #1d4f7c;
  --accent-ink: #143a5c;
  --accent-soft: #e3ebf4;

  --font: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --fs-display: clamp(2rem, 4.2vw, 3.5rem);
  --fs-h1: clamp(1.75rem, 3.2vw, 2.75rem);
  --fs-h2: clamp(1.375rem, 2.2vw, 2rem);
  --fs-lead: clamp(1.0625rem, 1.25vw, 1.1875rem);

  --r-sm: 12px;
  --r: 20px;
  --r-xl: 36px;

  --shadow-sm: 0 1px 2px rgba(16, 35, 66, .06), 0 1px 1px rgba(16, 35, 66, .03);
  --shadow: 0 1px 2px rgba(16, 35, 66, .05), 0 12px 24px -12px rgba(16, 35, 66, .18);

  --container: 1120px;
  --gutter: clamp(16px, 4vw, 48px);
  --shell-gap: clamp(0px, 1.3vw, 20px);
  --head-h: 64px;
}

/* 2. 바탕·셸: html이 바닥, body가 흰 둥근 셸이다. html overflow를 visible이 아닌 값으로 둬야 스크롤이 막히지 않는다. */
*, *::before, *::after { box-sizing: border-box; }
html { overflow: auto; background: var(--ground); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  min-height: calc(100vh - var(--shell-gap) * 2);
  margin: var(--shell-gap) auto;
  background: var(--shell);
  border-radius: clamp(0px, 2.4vw, var(--r-xl));
  overflow: clip;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7), 0 40px 90px -50px rgba(18, 45, 90, .45);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 768px) { body { width: calc(100% - var(--shell-gap) * 2); } }

::selection { background: var(--sky-200); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
svg { display: block; }
a { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: rgba(20, 58, 92, .35); text-underline-offset: 3px; }
a:hover { color: var(--ink); text-decoration-color: currentColor; }

.wrap { flex: 1 0 auto; width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter) 96px; }
.preview-note { padding: 8px var(--gutter); background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; text-align: center; }

/* 3. 머리·꼬리 */
.site-head { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .9); -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px); border-bottom: 1px solid var(--line); }
.head-in { display: flex; align-items: center; height: var(--head-h); max-width: calc(var(--container) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand .mark { flex: none; width: 32px; height: 32px; color: var(--accent); }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.brand-tag { padding-left: 12px; border-left: 1px solid var(--line-strong); color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { .brand-tag { display: none; } }

.site-foot { margin-top: auto; background: var(--paper); border-top: 1px solid var(--line); }
.foot-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px 48px; max-width: calc(var(--container) + var(--gutter) * 2); margin: 0 auto; padding: 48px var(--gutter) 40px; }
.foot-brand b { font-size: 16px; }
.foot-brand p { max-width: 60ch; margin: 12px 0 0; color: var(--ink-2); font-size: 14px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 0; font-size: 14px; }
.foot-links a { color: var(--ink-2); text-decoration: none; }
.foot-links a:hover { color: var(--ink); }
@media (max-width: 720px) { .foot-in { grid-template-columns: 1fr; align-items: start; } }

/* 4. 글자 */
h1, h2, h3 { margin: 0; font-weight: 650; line-height: 1.2; letter-spacing: -.02em; text-wrap: balance; }
h1 { margin: 12px 0 16px; font-size: var(--fs-h1); line-height: 1.15; }
h2 { margin: 64px 0 16px; font-size: var(--fs-h2); }
h3 { margin: 24px 0 8px; font-size: 18px; font-weight: 600; }
p { max-width: 65ch; margin: 0 0 12px; text-wrap: pretty; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 32px; color: var(--muted); font-size: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs > span:last-child { color: var(--ink); font-weight: 500; }
.lead { max-width: 62ch; margin: 0 0 32px; color: var(--ink-2); font-size: var(--fs-lead); line-height: 1.7; }
.basis, .sub { color: var(--muted); font-size: 14px; }
.lead .basis { display: block; margin-top: 8px; }
.note { margin-top: 48px; color: var(--muted); font-size: 14px; }
.prose { max-width: 65ch; }
.prose h2 { margin-top: 40px; }

/* 5. 홈 히어로·검색: 기준 날짜 배지 → 두 줄 제목 → 전동차 선화 → 검색 카드 */
.hero { display: flex; flex-direction: column; align-items: center; padding: 48px 0 16px; text-align: center; }
.kicker { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 600; }
.hero h1 { margin: 20px 0 0; font-size: min(9vw, var(--fs-display)); font-weight: 700; line-height: 1.12; letter-spacing: -.035em; }
.hero h1 span { display: block; }
.hero .train { width: min(100%, 440px); height: auto; margin: 32px auto 0; color: var(--ink-2); }
.hero .lead { margin: 24px auto 0; text-align: center; }
.search { width: min(100%, 560px); margin: 32px auto 0; padding: 8px; background: var(--shell); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--shadow); text-align: left; }
.search label { display: block; padding: 8px 12px 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.search input { width: 100%; height: 48px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); font: inherit; font-size: 18px; }
.search input:focus { outline: none; background: var(--sky-50); }
.search:focus-within { border-color: var(--accent); }
.no-match { margin-top: 24px; color: var(--muted); text-align: center; }

/* 6. 지역별 역: 지역마다 하늘색 띠 머리 + 역 이름 격자 */
.region { margin-top: 48px; }
.region h2 { display: flex; align-items: baseline; gap: 12px; margin: 0 0 12px; padding: 12px 16px; border-radius: var(--r-sm); background: var(--sky-50); font-size: 20px; }
.stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0 24px; margin: 0; padding: 0 16px; list-style: none; }
.stations li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.stations a { color: var(--ink); font-weight: 600; text-decoration: none; }
.stations a:hover { color: var(--accent); }
.stations .sub { display: block; font-size: 12px; }

/* 7. 시간표 카드: 노선·방향 줄 × 평일·토요일·일요일 칸. 시각이 가장 크고 행선지는 작게 */
.table-wrap { margin: 16px 0 24px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
caption { padding: 12px 16px; background: var(--sky-50); border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 14px; font-weight: 600; text-align: left; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tr:last-child > * { border-bottom: 0; }
thead th { color: var(--muted); font-size: 12px; font-weight: 600; }
tbody th { font-weight: 600; font-size: 14px; }
tbody th .sub { display: block; font-weight: 400; }
td b { font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.last td b { color: var(--accent-ink); }
@media (max-width: 560px) {
  th, td { padding: 12px 8px; }
  th:first-child { padding-left: 12px; }
  td b { font-size: 16px; }
  td .sub { display: block; font-size: 12px; }
  /* "다대포해수욕장행"처럼 긴 행선지가 keep-all 때문에 칸을 밀어내지 않게 글자 단위로 끊는다. */
  td .sub, tbody th { word-break: break-all; }
}
.ends { margin: 0 0 24px; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.ends li { padding: 12px 0; border-bottom: 1px solid var(--line); }

/* 8. 심야버스·FAQ */
.night { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
.night li { display: flex; flex-direction: column; min-width: 96px; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
.night b { font-size: 20px; font-weight: 700; color: var(--accent-ink); }
.faq { margin-top: 64px; border-top: 1px solid var(--line-strong); }
.faq h2 { margin-top: 32px; }
.faq h3 { margin: 24px 0 8px; font-size: 16px; }
.faq p { color: var(--ink-2); }

/* 9. 모션: 움직임은 검색 카드 포커스 테두리 정도만 쓴다. */
.search { transition: border-color 160ms ease; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
