/* ============================================================
   台東轉運站 — redesigned stylesheet
   Warm, editorial, information-dense transit aesthetic
   ============================================================ */

:root {
  /* neutrals — cool paper, subtly blue-toned */
  --bg:      #eef2f4;  /* cool paper */
  --bg-2:    #e2e8ec;  /* deeper cool card */
  --surface: #f5f8fa;
  --ink:     #0f1a22;  /* near-black, cool */
  --ink-2:   #3d4c57;
  --ink-3:   #5f6d79;  /* darkened from #7a8893 for WCAG AA contrast on --bg-2 */
  --line:    rgba(15,26,34,0.14);
  --line-2:  rgba(15,26,34,0.07);

  /* single accent — 台東藍 (Taitung Blue, Pacific ocean) */
  --acc:     oklch(0.62 0.13 230);   /* deep ocean blue */
  --acc-ink: oklch(0.42 0.12 232);
  --acc-bg:  oklch(0.93 0.04 230);

  /* semantic */
  --ok:   oklch(0.62 0.13 155);
  --warn: oklch(0.72 0.16 80);

  --font-serif: "Noto Serif TC", "Source Han Serif TC", Georgia, serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "PingFang TC", "Microsoft JhengHei", "微軟正黑體", "Heiti TC", "Noto Sans TC", sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 18px;

  --w: 1240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt" 1;
}

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 700; letter-spacing: -0.01em; margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--acc-ink); }
button { font: inherit; color: inherit; cursor: pointer; }
kbd { font-family: var(--font-mono); font-size: 11px; background: var(--bg-2); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--ink-2);}

/* ======================= NAV ======================= */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg), white 30%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  max-width: var(--w);
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}
.brand__mark {
  width: 34px; height: 34px;
  display: inline-flex;
  color: var(--acc-ink);
}
.brand__mark svg { width: 100%; height: 100%; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1;}
.brand__zh { font-family: var(--font-serif); font-size: 18px; font-weight: 900; }
.brand__en { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.02em; }

.nav__links { display: flex; gap: 26px; margin-left: auto; }
.nav__links a { font-size: 14px; color: var(--ink-2); }
.nav__links a:hover { color: var(--ink); }

.nav__search-btn {
  display: inline-flex;
  align-items: center; gap: 6px;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.nav__search-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.nav__search-btn svg { color: inherit; }
.nav__search-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

/* 離島轉運 gateway pill — 跳出 nav__links 的 SPA 錨點序列，做成獨立 CTA。
   跟 .nav__meta 同為 pill 形、同視覺權重，靠 serif + bold + 箭頭做區分
   （.nav__meta 是 mono 資訊，這個是 serif 行動）。
   /plan/* 對側用 --return 修飾詞反轉箭頭位置。*/
.nav__plan-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-family: var(--font-serif); font-size: 13.5px; font-weight: 700;
  letter-spacing: 0.01em; text-decoration: none; white-space: nowrap;
  transition: transform 180ms cubic-bezier(.22,.61,.36,1), background 180ms, border-color 180ms;
}
.nav__plan-cta:hover { background: var(--bg-2); border-color: var(--ink-3); transform: translateX(2px); }
.nav__plan-cta--return:hover { transform: translateX(-2px); }
.nav__plan-cta__arrow { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }

/* Language switcher — subtle text-only link.
   Per "離島轉運 hero CTA 不可被搶戲" memo, this stays understated:
   no border, no pill background, mono font, low-contrast ink-3 colour.
   Position is right of the plan-cta pill (or right of return-cta on /plan/).
   Hover lifts colour to --ink for affordance, no transform/glow.
*/
.nav__lang {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-decoration: none;
  padding: 6px 4px;
  margin-left: 4px;
  transition: color 0.15s;
}
.nav__lang:hover, .nav__lang:focus-visible { color: var(--ink); }

.nav__meta {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2);
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 100px; background: var(--surface);
}
/* Auto-refresh toggle (live status dot doubles as button) */
.nav__meta .dot {
  appearance: none;
  -webkit-appearance: none;
  width: 7px; height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ok), transparent 80%);
  cursor: pointer;
  position: relative;
  transition: background .15s, box-shadow .15s;
}
/* Invisible hit target ~27×27px without inflating visual size */
.nav__meta .dot::before {
  content: '';
  position: absolute;
  inset: -10px;
}
.nav__meta .dot[aria-pressed="false"] {
  background: var(--ink-3);
  box-shadow: none;
}
.nav__meta .dot:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 4px;
}
.nav__meta-sep { opacity: 0.4;}

/* ======================= HERO ======================= */

.hero {
  position: relative;
  max-width: var(--w);
  margin: 0 auto;
  padding: 72px 32px 40px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
}
.hero__col--text { padding-top: 24px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.eyebrow__tag {
  background: var(--ink); color: var(--bg);
  padding: 3px 8px; border-radius: 3px; font-size: 10px;
}
.eyebrow__sep { width: 24px; height: 1px; background: var(--ink-3);}

.hero__title {
  font-size: clamp(56px, 8vw, 104px);
  line-height: 0.96;
  margin: 22px 0 28px;
  letter-spacing: -0.03em;
  font-weight: 900;
}
.hero__title-accent {
  color: var(--acc-ink);
  font-weight: 500;
}

.hero__lede {
  font-size: 17px;
  color: var(--ink-2);
  max-width: 46ch;
  line-height: 1.65;
  margin: 0 0 32px;
}

.hero__actions { display: flex; gap: 12px; margin-bottom: 48px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px;
  border-radius: 100px;
  font-weight: 500;
  font-size: 14px;
  border: 1px solid transparent;
  transition: transform .15s, background .15s;
}
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: var(--acc-ink); color: white;}
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink);}
.btn--ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--ink-3);}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin: 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
  max-width: 520px;
}
.hero__stats > div { display: flex; flex-direction: column; gap: 4px;}
.hero__stats dt { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; color: var(--ink-3); letter-spacing: 0.05em;}
.hero__stats dd { margin: 0; font-family: var(--font-serif); font-weight: 700; font-size: 28px; color: var(--ink); display: flex; align-items: baseline; gap: 4px;}
.hero__stats dd > span:last-child { font-family: var(--font-sans); font-size: 12px; color: var(--ink-3); font-weight: 400;}

/* hero live card */
.hero__col--card { display: flex; align-items: flex-start;}

.livecard {
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  box-shadow: 0 40px 80px -30px rgba(29,26,20,0.5), 0 1px 0 rgba(255,255,255,0.05) inset;
  position: relative;
}

.livecard__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,0.1);}
.livecard__badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.08);
  padding: 5px 10px; border-radius: 100px;
  font-family: var(--font-mono); font-size: 11px;
  color: color-mix(in oklab, var(--acc), white 20%);
  letter-spacing: 0.05em;
}
.livecard__station { font-family: var(--font-serif); font-weight: 700; font-size: 16px; text-align: right;}
.livecard__station span { display: block; font-family: var(--font-mono); font-size: 10.5px; color: rgba(255,255,255,0.4); letter-spacing: 0.05em; margin-top: 2px;}

.livecard__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px;}
.live-route {
  font-family: var(--font-mono); font-weight: 700; font-size: 15px;
  text-align: center;
  padding: 4px 0;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  color: white;
}
.live-route.r-101 { background: color-mix(in oklab, var(--acc), black 10%); color: white;}
.live-route.r-201 { background: #0c4a6e; color: white;}
.live-route.r-202 { background: #0c4a6e; color: white; border: 1px solid rgba(255,255,255,0.3);}
.live-route.r-203 { background: #0f766e; color: white;}
.live-route.r-8101 { background: #1e40af; color: white;}
.live-route.r-8168 { background: #155e75; color: white;}
.live-route.r-east    { background: #334155; color: white;}
.live-route.r-xing    { background: #0e7490; color: white;}
.live-route.r-default { background: #475569; color: white;}
.live-dest { font-size: 14px; line-height: 1.3; }
.live-dest span { display: block; font-family: var(--font-mono); font-size: 10.5px; color: rgba(255,255,255,0.45); margin-top: 2px;}

.live-eta { text-align: right; font-family: var(--font-mono);}
.live-eta strong { font-size: 22px; font-weight: 700; color: white; }
/* Scheduled HH:MM on dark card — smaller + dimmed so it reads as context, not headline. */
.live-eta strong.is-time { font-size: 18px; color: rgba(255,255,255,0.78); }
.live-eta small { display: block; font-size: 10.5px; color: rgba(255,255,255,0.45); margin-top: 2px; letter-spacing: 0.04em;}
.live-eta .pending-tag {
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5);
  font-size: 11px;
}

.livecard__foot {
  display: flex; justify-content: space-between; padding-top: 16px; margin-top: 12px; border-top: 1px solid rgba(255,255,255,0.1);
  font-family: var(--font-mono); font-size: 10.5px; color: rgba(255,255,255,0.4);
}

.hero__texture {
  position: absolute;
  top: 0; right: 0; bottom: 0; width: 50%;
  background:
    radial-gradient(circle at 85% 30%, color-mix(in oklab, var(--acc), transparent 85%), transparent 50%),
    radial-gradient(circle at 95% 90%, color-mix(in oklab, var(--acc), transparent 90%), transparent 40%);
  pointer-events: none;
  z-index: -1;
}

/* ======================= ROUTES INDEX ======================= */
/* Used by homepage section 02 + /routes/ hub. Mobile-first row layout. */

.routes-index {
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
@media (min-width: 768px) { .routes-index { gap: 32px; } }

.routes-index__group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.routes-index__group-title {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 18px;
  color: var(--ink);
  line-height: 1.2;
}
@media (min-width: 768px) {
  .routes-index__group-title { font-size: 22px; }
}
.routes-index__group-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.routes-index__group-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  line-height: 1.5;
  margin-bottom: 10px;
}
@media (min-width: 768px) {
  .routes-index__group-meta { font-size: 12px; }
}

.routes-index__items {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}
@media (min-width: 768px) {
  .routes-index__items { grid-template-columns: 1fr 1fr; column-gap: 24px; }
}

.routes-index__item {
  display: grid;
  grid-template-columns: 58px 1fr 20px;
  gap: 14px;
  align-items: center;
  min-height: 48px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.15s;
}
.routes-index__item:active,
.routes-index__item:hover { color: var(--ink); }

.routes-index__item code {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--bg-2);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.routes-index__item-name { font-size: 14px; line-height: 1.4; }
.routes-index__item-arrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-3);
  text-align: right;
}

/* ---- Hero livecard list items (replaces old arrivals-style rows) ---- */

.livecard__empty {
  padding: 18px 0;
  text-align: center;
  color: color-mix(in oklab, white, transparent 60%);
  font-size: 13px;
}
.livecard__item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 13px 12px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
  transition: background .1s;
}
.livecard__item:hover { background: rgba(255,255,255,0.04); }

/* ======================= SECTION ======================= */

.section {
  max-width: var(--w);
  margin: 0 auto;
  padding: 80px 32px;
}
.section--alt {
  background: var(--bg-2);
  max-width: none;
  padding: 80px 0;
}
.section--alt > .section__head,
.section--alt > .routes,
.section--alt > .tips {
  max-width: var(--w);
  margin-left: auto; margin-right: auto;
  padding-left: 32px; padding-right: 32px;
}

.section__head { margin-bottom: 44px; max-width: 720px; }
.section__label { font-family: var(--font-mono); font-size: 11.5px; color: var(--acc-ink); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 14px;}
.section__title { font-size: clamp(36px, 4.5vw, 52px); line-height: 1.05; margin-bottom: 16px;}
.section__desc { color: var(--ink-2); font-size: 16px; max-width: 60ch; line-height: 1.7;}


.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px;
  padding: 7px 13px;
  border-radius: 100px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
  transition: all .15s;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3);}
.chip.is-active {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}


.route-tag {
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  padding: 4px 9px;
  border: 0; /* neutralise <button> default chrome */
  border-radius: 4px;
  cursor: pointer;
  color: white;
  background: #475569; /* slate-600 default for any uncategorised route */
  transition: transform .12s;
}
.route-tag:hover { transform: translateY(-1px);}
.route-tag.r-101 { background: color-mix(in oklab, var(--acc), black 10%); }
.route-tag.r-201 { background: #0c4a6e; }
.route-tag.r-202 { background: #0c4a6e; border: 1px solid rgba(255,255,255,0.4);}
.route-tag.r-203 { background: #0f766e; }
.route-tag.r-8101 { background: #1e40af; }
.route-tag.r-8168 { background: #155e75; }
/* operator-level fallbacks — cool neutrals so curated brand colours stay dominant */
.route-tag.r-east    { background: #334155; }  /* slate-700 — 東台灣客運 (山/縱谷/南迴) */
.route-tag.r-xing    { background: #0e7490; }  /* cyan-700 — 興東客運 (海線家族，承 8168 cyan 系) */
.route-tag.r-default { background: #475569; }  /* slate-600 — discover fallback */
.route-tag.is-active { outline: 2px solid var(--ink); outline-offset: 2px;}


.arr-route { display: flex; align-items: center; gap: 10px;}
.arr-route .route-tag { cursor: default;}
.arr-dest { font-size: 13.5px; color: var(--ink-2);}
.arr-plate { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); letter-spacing: 0.03em;}
.arr-distance { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12.5px; font-family: var(--font-mono);}
.arr-distance .distance-bar { flex: 1; max-width: 260px; height: 4px; background: var(--line-2); border-radius: 2px; overflow: hidden; position: relative;}
.arr-distance .distance-bar i { display: block; height: 100%; background: var(--ink); border-radius: 2px; transition: width .8s cubic-bezier(.2,.8,.2,1);}
.arr-distance .distance-bar.soon i { background: var(--acc);}

/* ======================= ROUTES / SCHEDULE ======================= */

.routes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: flex-start;
}
.routes__picker { position: sticky; top: 72px; z-index: 4; }

.route-picker {
  width: 100%;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 1px 0 var(--line-2);
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.route-picker:hover { border-color: var(--ink-2); box-shadow: 0 6px 18px -12px rgba(15,26,34,0.28);}
.route-picker:active { transform: translateY(1px);}
.route-picker__tag {
  flex-shrink: 0;
  font-size: 13px;
  padding: 5px 12px;
  cursor: inherit;
}
.route-picker__text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.route-picker__text strong {
  font-family: var(--font-serif); font-weight: 700; font-size: 17px;
  color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.route-picker__text small {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3);
  letter-spacing: 0.04em;
}
.route-picker__hint {
  flex-shrink: 0;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.route-picker__chevron { color: var(--ink-3); flex-shrink: 0;}

/* ---- Route dialog ---- */
.route-dialog {
  padding: 0; margin: auto;
  width: min(640px, 92vw);
  max-height: 82vh;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px -16px rgba(15,26,34,0.4);
  overflow: hidden;
}
.route-dialog::backdrop {
  background: rgba(15,26,34,0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.rdlg__head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 2;
}
.rdlg__search {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.rdlg__search:focus-within { border-color: var(--acc); background: var(--surface); }
.rdlg__search svg { color: var(--ink-3); flex-shrink: 0; }
.rdlg__search input {
  flex: 1; border: 0; background: transparent; outline: none; min-width: 0;
  font-family: var(--font-sans); font-size: 14px; color: var(--ink);
}
.rdlg__close {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: transparent; border: 0; border-radius: var(--radius);
  color: var(--ink-3);
  transition: background .15s, color .15s;
}
.rdlg__close:hover { background: var(--bg); color: var(--ink); }

.rdlg__body {
  overflow-y: auto;
  max-height: calc(82vh - 112px);
  padding: 4px 0 12px;
}
.rdlg__body:focus { outline: none; }

.rdlg-group { padding: 12px 16px 6px; }
.rdlg-group + .rdlg-group { border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 14px; }
.rdlg-group__title {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin: 0 0 6px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.rdlg-group__count { color: var(--ink-3); font-weight: 400;}
.rdlg-group ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1px; }

.rdlg-item {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: transparent; border: 0; border-radius: 8px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: background .12s;
}
.rdlg-item:hover { background: var(--bg); }
.rdlg-item:focus-visible { outline: 2px solid var(--acc); outline-offset: 0; }
.rdlg-item.is-active { background: var(--acc-bg); }
.rdlg-item.is-active .rdlg-item__name { color: var(--acc-ink); font-weight: 700; }
.rdlg-item__tag { flex-shrink: 0; padding: 4px 10px; font-size: 12px; cursor: inherit; }
.rdlg-item__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rdlg-item__name {
  font-family: var(--font-serif); font-size: 14.5px; color: var(--ink); font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rdlg-item__dest {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  letter-spacing: 0.03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.rdlg__empty { padding: 40px 20px; text-align: center; color: var(--ink-3); font-size: 13px; }

.rdlg__foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.06em;
}
.rdlg__foot kbd { font-size: 10px; padding: 1px 5px; }

.routes__body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.routeheader { border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 24px;}
.routeheader__id { font-family: var(--font-mono); font-size: 11.5px; color: var(--acc-ink); letter-spacing: 0.05em;}
.routeheader h3 { font-size: 30px; margin: 8px 0 6px;}
.routeheader__sub { color: var(--ink-3); font-size: 13px; font-family: var(--font-mono);}

.routepath {
  background: var(--bg-2);
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.9;
  margin-bottom: 28px;
  color: var(--ink-2);
}
.routepath strong { color: var(--ink);}
.routepath .arrow { color: var(--ink-3); margin: 0 4px;}
.routepath__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.03em;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

/* ---- routeschedule (homepage section 01) ----
   Mobile: 直堆 livestrip + dirblock(out) + dirblock(back)
   Desktop ≥720px: livestrip 跨欄 + dirblock 兩欄並排
   每個 .dirblock = head + slot grid + stops list（班次貼著對應站序） */
.routeschedule { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 720px) {
  .routeschedule {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "live live"
      "out  back";
    gap: 20px 28px;
  }
  .routeschedule > .livestrip-host > .livestrip { grid-area: live; }
  .routeschedule > .dirblock[data-dir="out"]  { grid-area: out;  }
  .routeschedule > .dirblock[data-dir="back"] { grid-area: back; }
}

/* livestrip-host wraps the .livestrip in a stable element so renderSchedulePanel
   can update livestrip via host.innerHTML without wiping siblings (avoids
   the height-collapse jump when clicking slots). display:contents removes
   the host from layout — .livestrip itself becomes the flex/grid item. */
.livestrip-host { display: contents; }

.dirblock { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dirblock__head { display: flex; flex-direction: column; gap: 4px; }
.dirblock__title { font-size: 15px; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dirblock__title .pill {
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--bg-2); padding: 3px 8px; border-radius: 3px; color: var(--ink-3);
}
.dirblock__sub { font-size: 12px; color: var(--ink-3); font-family: var(--font-mono); }

.dirblock__stops { padding-top: 16px; border-top: 1px solid var(--line); }
.dirblock__stops-meta {
  font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.dirblock__stops-meta strong { color: var(--ink); font-family: var(--font-mono); }
.dirblock__stops-empty,
.dirblock__stops-loading,
.dirblock__stops-error {
  font-size: 12.5px; color: var(--ink-3); font-family: var(--font-mono);
  padding: 12px 0;
}
.dirblock__cancel {
  font: inherit; font-size: 11.5px;
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 10px; cursor: pointer;
}
.dirblock__cancel:hover { border-color: var(--ink-2); color: var(--ink); }

.routetimes { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 28px; row-gap: 20px;}
@media (max-width: 720px) { .routetimes { grid-template-columns: 1fr;}}

/* livestrip — real-time "coating" painted on top of the static timetable.
   Scheduled times are the skeleton; this strip tells the rider whether
   any bus is actually tracked right now, without leaving the schedule. */
.livestrip {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left-width: 2px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-2);
}
.livestrip__label { font-weight: 700; color: var(--ink); letter-spacing: 0.02em; }
.livestrip__meta  { color: var(--ink-3); }
.livestrip.is-tracking {
  border-left-color: #16a34a;
  background: color-mix(in oklab, #16a34a 7%, var(--bg));
}
.livestrip.is-tracking .livestrip__label { color: #15803d; }
.livestrip.is-idle { border-left-color: var(--ink-3); background: var(--bg); }
.livestrip__pulse {
  width: 9px; height: 9px; border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
  animation: livestrip-pulse 1.8s ease-out infinite;
  flex-shrink: 0;
}
@keyframes livestrip-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(22, 163, 74, 0.5); }
  80%  { box-shadow: 0 0 0 10px rgba(22, 163, 74, 0);   }
  100% { box-shadow: 0 0 0 0   rgba(22, 163, 74, 0);   }
}
.livestrip__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-3); opacity: 0.4;
  flex-shrink: 0;
}
@media (prefers-reduced-motion: reduce) {
  .livestrip__pulse { animation: none; }
}

.timecol h4 { font-size: 15px; margin-bottom: 4px; display: flex; align-items: center; gap: 10px;}
.timecol h4 .pill { font-family: var(--font-mono); font-size: 10.5px; background: var(--bg-2); padding: 3px 8px; border-radius: 3px; color: var(--ink-3);}
.timecol__sub { font-size: 12px; color: var(--ink-3); margin-bottom: 14px; font-family: var(--font-mono);}

.timegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 6px;
}
.timegrid .slot {
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
  padding: 9px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink-2);
  cursor: pointer;
  /* button reset：避免 UA defaults 破版 */
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: 1.2;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
}
.timegrid .slot[disabled] { cursor: default; }
.timegrid .slot:not([disabled]):hover {
  background: var(--bg-2);
  border-color: var(--ink-3);
}
.timegrid .slot.is-selected {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  /* 不用 box-shadow / glow / gradient */
}
.timegrid__empty {
  font-size: 12px; color: var(--ink-3); font-family: var(--font-mono);
  padding: 8px 0; grid-column: 1 / -1;
}
.timegrid .slot.is-next {
  background: var(--acc-bg);
  border-color: var(--acc);
  color: var(--acc-ink);
  font-weight: 700;
  position: relative;
}
.timegrid .slot.is-next::before {
  content: 'NEXT'; position: absolute; top: -8px; right: 50%; transform: translateX(50%);
  background: var(--acc); color: white; font-size: 9px; padding: 1px 5px; border-radius: 3px;
}
.timegrid .slot.is-past { color: var(--ink-3); text-decoration: line-through; opacity: 0.55;}

/* is-live — a tracked bus is currently expected for this departure slot.
   Renders a small pulsing dot in the top-right corner. Stacks with is-next
   (the nearest upcoming slot that is also tracked gets both treatments). */
.timegrid .slot.is-live {
  border-color: #16a34a;
  box-shadow: inset 0 0 0 1px #16a34a;
}
.timegrid .slot.is-live::after {
  content: '';
  position: absolute;
  top: 4px; right: 4px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 6px rgba(22, 163, 74, 0.65);
  animation: slot-live-pulse 1.8s ease-out infinite;
}
@keyframes slot-live-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .timegrid .slot.is-live::after { animation: none; }
}

/* ---- routestops — penghub-style §B per-stop ETA list ---- */
.routestops { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.routestops__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.routestops__head h4 {
  font-size: 16px; margin: 0; display: flex; align-items: center; gap: 10px;
}
.routestops__head h4 .pill {
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--bg-2); padding: 3px 8px; border-radius: 3px; color: var(--ink-3);
}
.routestops__meta {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3);
  display: flex; align-items: center; gap: 8px;
}
.routestops__stale {
  background: var(--bg-2); color: var(--ink-3); padding: 2px 7px; border-radius: 3px;
  font-size: 10.5px; letter-spacing: 0.05em;
}
.routestops__empty { font-size: 12.5px; color: var(--ink-3); font-family: var(--font-mono); }

.routestops__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 40px; }
@media (max-width: 720px) { .routestops__grid { grid-template-columns: 1fr; gap: 28px; } }

.routestops__col { min-width: 0; }
.routestops__dir {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; padding-bottom: 10px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.routestops__dir-label { font-weight: 700; font-size: 14px; color: var(--ink);}
.routestops__dir-path { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }

.routestops__list { list-style: none; padding: 0; margin: 0; }
.rstop {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: baseline;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.rstop:last-child { border-bottom: none; }
.rstop__seq { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.rstop__name { color: var(--ink); font-weight: 500; }
.rstop__eta {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.01em;
  white-space: nowrap;
}

.rstop.is-countdown    .rstop__eta { color: var(--acc-ink); font-weight: 700; }
.rstop.is-arriving     .rstop__eta { color: #b45309; font-weight: 700; animation: rstop-arriving 1.6s ease-out infinite; }
/* scheduled-arrival: same palette as live countdown but softer — medium
   weight, no pulse. Reader can tell live apart from timetabled at a glance. */
.rstop.is-scheduled     .rstop__eta { color: var(--acc-ink); font-weight: 500; }
.rstop.is-scheduled-far .rstop__eta { color: var(--ink-2); font-weight: 500; letter-spacing: 0.02em; }
.rstop.is-passed       .rstop__eta { color: var(--ink-3); }
.rstop.is-passed       .rstop__name { color: var(--ink-3); }
.rstop.is-idle         .rstop__eta { color: var(--ink-3); }
.rstop.is-idle         .rstop__name { color: var(--ink-2); }
.rstop.is-blank        .rstop__eta { color: color-mix(in oklab, var(--ink-3) 60%, transparent); }

/* is-mystop — the rider's currently-selected hub stop. Accent left-border
   + tag so they can track "their" stop's ETA in a 62-row list without
   hunting. Stacks safely over any status tier. */
.rstop.is-mystop {
  margin-left: -10px;
  padding-left: 10px;
  border-left: 2px solid var(--acc);
  background: color-mix(in oklab, var(--acc) 5%, transparent);
}
.rstop__mytag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  background: var(--acc);
  color: #fff;
  padding: 1px 5px;
  border-radius: 2px;
  margin-right: 8px;
  vertical-align: 1px;
}

/* is-bus — a live-tracked plate's current position on the line. One plate,
   one row: the 🚌 pill moves along with the bus as ETAs refresh. Stacks
   over all status kinds; boarding (≤120s) pulses. */
.rstop.is-bus {
  background: color-mix(in oklab, var(--acc) 8%, transparent);
}
.rstop__bus {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  background: var(--acc);
  color: var(--ink);
  padding: 2px 7px;
  border-radius: 100px;
  margin-right: 8px;
  vertical-align: 1px;
  white-space: nowrap;
}
.rstop.is-boarding .rstop__bus {
  animation: rstop-boarding-pulse 1.5s infinite;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--acc), transparent 75%);
}
@keyframes rstop-boarding-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in oklab, var(--acc), transparent 75%); }
  50%      { box-shadow: 0 0 0 6px color-mix(in oklab, var(--acc), transparent 88%); }
}
.routestops__mystop-hint {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  padding-right: 10px;
  margin-right: 2px;
  border-right: 1px solid var(--line);
}
.routestops__mystop-hint strong {
  color: var(--acc-ink);
  font-weight: 700;
}

@keyframes rstop-arriving {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .rstop.is-arriving .rstop__eta { animation: none; }
}

.routefoot { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); font-family: var(--font-mono); display: flex; gap: 24px; flex-wrap: wrap;}

/* ======================= NETWORK ======================= */
/*
 * Section 03 路網。Build-time 從 scripts/_data/network-corridors.mjs
 * 產出 SVG（桌機）+ 堆疊 list（手機）。
 * Highlight 邏輯：JS 切 [data-corridor-active] / [data-node-active] attr，
 * CSS 處理 dim / 強調。
 */

.network {
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 32px;
}

/* ── 桌機 SVG ───────────────────────────────────────── */

.network__svg-wrap {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.network__svg {
  width: 100%;
  height: auto;
  display: block;
  font-family: var(--font-sans, "Noto Sans TC", sans-serif);
}

/* spatial cues */
.network__cue {
  font-family: var(--font-serif);
  font-size: 11px;
  font-style: italic;
  fill: var(--ink-3);
  opacity: 0.35;
  letter-spacing: 4px;
}

/* corridor */
.network__corridor-line {
  stroke: var(--ink);
  stroke-width: 3.5;
  stroke-linecap: round;
  fill: none;
  transition: opacity 120ms;
}
.network__corridor-label {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink);
  letter-spacing: 2px;
}
.network__corridor-sublabel {
  font-family: var(--font-serif);
  font-size: 10px;
  fill: var(--ink-3);
  letter-spacing: 1px;
}
.network__corridor-routes {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--ink-3);
  letter-spacing: 0.5px;
}

/* node */
.network__node-dot {
  fill: var(--ink);
  transition: r 120ms;
}
.network__node-label {
  font-family: var(--font-sans, "Noto Sans TC", sans-serif);
  font-size: 12px;
  fill: var(--ink);
}
/* 跨縣支線節點：淡灰 + 較細，視覺上「離主路網一步之遙」。 */
.network__node-dot--cross {
  fill: var(--surface);
  stroke: var(--ink-3);
  stroke-width: 1.5;
  stroke-dasharray: 2 1.5;
}
.network__node-label--cross {
  fill: var(--ink-3);
  font-size: 11px;
  font-style: italic;
}
/* 跨縣段主線：虛線（跟離島 ferry-line 區分；ferry 用 accent，跨縣段保持 ink）。 */
.network__corridor-line--cross {
  stroke: var(--ink-3);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

/* hub */
.network__hub {
  fill: var(--surface);
  stroke: var(--ink);
  stroke-width: 3.5;
}
.network__hub-label {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink);
}

/* ferry (accent) */
.network__ferry-line {
  stroke: var(--acc);
  stroke-width: 1.5;
  stroke-dasharray: 3 5;
  fill: none;
}
.network__ferry-node {
  fill: var(--surface);
  stroke: var(--acc);
  stroke-width: 2;
  stroke-dasharray: 2 2;
}
.network__ferry-label {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  fill: var(--acc-ink);
}
.network__ferry-meta {
  font-family: var(--font-sans, "Noto Sans TC", sans-serif);
  font-size: 10px;
  fill: var(--acc-ink);
  opacity: 0.85;
}

/* keyboard focus */
.network__svg [tabindex="0"]:focus { outline: none; }
.network__svg [tabindex="0"]:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── highlight / dim states (driven by JS data-attrs) ──────── */
/* When SVG has [data-network-active], non-active corridors and nodes dim */
.network__svg[data-network-active] [data-network-corridor]:not([data-active]) .network__corridor-line,
.network__svg[data-network-active] [data-network-corridor]:not([data-active]) .network__corridor-label,
.network__svg[data-network-active] [data-network-corridor]:not([data-active]) .network__corridor-sublabel,
.network__svg[data-network-active] [data-network-corridor]:not([data-active]) .network__corridor-routes,
.network__svg[data-network-active] [data-network-node]:not([data-active]) .network__node-dot,
.network__svg[data-network-active] [data-network-node]:not([data-active]) .network__node-label {
  opacity: 0.3;
}
.network__svg [data-network-node][data-active] .network__node-dot {
  r: 7px;
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .network__corridor-line,
  .network__node-dot {
    transition: none;
  }
}

/* high contrast */
@media (prefers-contrast: more) {
  .network__svg[data-network-active] [data-network-corridor]:not([data-active]) .network__corridor-line,
  .network__svg[data-network-active] [data-network-node]:not([data-active]) .network__node-dot {
    opacity: 0.5;
  }
  .network__corridor-line { stroke-width: 3; }
}

/* ── 手機堆疊 list (default hidden, shown < 769px) ────────── */

.network__list { display: none; }

.network__list-hub {
  padding: 14px 0 18px;
  display: flex;
  gap: 10px;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
}
.network__list-hub-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-3);
}
.network__list-hub-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.network__corridor-block {
  padding: 18px 0;
  border-bottom: 1px solid var(--line-2);
}
.network__corridor-block:last-child { border-bottom: none; }
.network__corridor-block-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.network__corridor-block-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 1px;
}
.network__corridor-block-sub {
  font-family: var(--font-serif);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 1px;
}

.network__chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.network__chip-row[data-kind="routes"] { margin-bottom: 6px; }
.network__chip-row[data-kind="stops"]  { margin-top: 6px; }

.network__chip-sep {
  height: 1px;
  background: var(--line-2);
  margin: 8px 0;
}

.network__chip {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-height: 36px;
  font-family: var(--font-sans, "Noto Sans TC", sans-serif);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.network__chip--route {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  letter-spacing: 0.5px;
}
.network__chip--ferry { color: var(--acc-ink); border-color: color-mix(in oklab, var(--acc), transparent 70%); }
.network__chip--ferry small { color: var(--acc-ink); opacity: 0.75; font-family: var(--font-mono); font-size: 10px; }
.network__chip:hover,
.network__chip:focus-visible {
  background: var(--surface);
  border-color: var(--ink-3);
  outline: none;
}
.network__corridor-block--ferry { background: color-mix(in oklab, var(--acc), transparent 96%); border-radius: var(--radius); padding: 18px 14px; }

/* ── viewport switch ───────────────────────────────────── */

@media (max-width: 768px) {
  .network__svg-wrap { display: none; }
  .network__list     { display: block; }
}

/* screen-reader only helper */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ======================= TIPS ======================= */

.tips {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.tips article { background: var(--surface); padding: 28px;}
.tips h3 { font-size: 16px; margin-bottom: 10px; color: var(--acc-ink);}
.tips p { font-size: 14px; color: var(--ink-2); line-height: 1.7; margin: 0;}

/* ======================= FERRY ======================= */

.ferry { max-width: var(--w); margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px;}
.ferry__card {
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: transform .2s, border-color .2s;
}
.ferry__card:hover { transform: translateY(-2px); border-color: var(--ink-2);}
.ferry__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px;}
.ferry__head span { font-family: var(--font-serif); font-weight: 900; font-size: 30px;}
.ferry__head em { font-family: var(--font-mono); font-size: 12px; font-style: normal; color: var(--ink-3); letter-spacing: 0.05em;}
.ferry__port { font-size: 14px; color: var(--ink-2); margin-bottom: 8px;}
.ferry__times { font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); margin-bottom: 18px;}
.ferry__fare { display: inline-block; background: var(--bg-2); padding: 6px 12px; border-radius: 4px; font-family: var(--font-mono); font-size: 13px; color: var(--ink);}

/* ======================= FOOTER ======================= */

.foot {
  background: var(--ink);
  color: color-mix(in oklab, var(--bg), var(--ink) 40%);
  padding: 72px 0 28px;
  margin-top: 60px;
}
.foot__inner {
  max-width: var(--w); margin: 0 auto; padding: 0 32px;
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.foot__brand .brand__zh { color: var(--bg); font-size: 22px; margin-bottom: 12px;}
.foot__brand p { font-size: 13.5px; line-height: 1.7; max-width: 32ch; color: rgba(246,241,232,0.6);}
.foot__col h4 { font-family: var(--font-mono); font-size: 11px; color: rgba(246,241,232,0.5); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 14px;}
.foot__col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px;}
.foot__col li { font-size: 13px; color: rgba(246,241,232,0.75);}
.foot__col a:hover { color: var(--acc);}
.foot__mail { display: inline-block; vertical-align: middle; }
.foot__bottom {
  max-width: var(--w); margin: 24px auto 0; padding: 0 32px;
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 11.5px; color: rgba(246,241,232,0.4);
}

/* ======================= RESPONSIVE ======================= */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 48px;}
  .tips { grid-template-columns: 1fr 1fr;}
  .foot__inner { grid-template-columns: 1fr 1fr; gap: 32px;}
  .ferry { grid-template-columns: 1fr;}
  .nav__links { display: none;}
  .nav__meta { display: none; }
  .nav__search-hint { display: none; }
  .nav__search-btn { padding: 6px 8px; }
  /* plan/* return CTA：nav__links 隱藏後失去 auto-push，由 CTA 自己接管推到右側。
     不動 home 的非-return CTA——它要緊貼 .nav__search-btn（commit 0c681b2 的脈絡）。 */
  .nav__plan-cta--return { margin-left: auto; }
}
/* ====== Mobile ≤ 720 — live board priority ====== */
@media (max-width: 720px) {
  /* NAV — keep essentials, hide the mono clock widget on very narrow */
  .nav__inner { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .brand__text { min-width: 0; }
  .brand__zh { font-size: 16px; }
  .brand__en { display: none; }
  .nav__meta { padding: 4px 9px; font-size: 11px; }
  .nav__plan-cta { padding: 5px 12px; font-size: 13px; }
  .nav__meta-sep, #navDate { display: none; }

  /* HERO — single column, compressed, live card FIRST for mobile users */
  .hero {
    padding: 28px 18px 24px;
    gap: 28px;
    grid-template-columns: 1fr;
  }
  .hero__col--text { padding-top: 0; order: 2; }
  .hero__col--card { order: 1; }
  .hero__title {
    font-size: 44px;
    line-height: 1.02;
    margin: 16px 0 20px;
    word-break: keep-all;
    text-wrap: balance;
  }
  .hero__title br { display: none; }           /* let it wrap naturally */
  .hero__title-accent { display: inline; }
  .hero__lede { font-size: 15px; margin-bottom: 24px; }
  .hero__actions { gap: 10px; margin-bottom: 28px; }
  .btn { padding: 11px 18px; font-size: 13.5px; }
  .hero__stats { grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 18px; }
  .hero__stats dt { font-size: 10px; }
  .hero__stats dd { font-size: 20px; white-space: nowrap; }
  .hero__stats dd > span:last-child { display: none; }      /* drop the descriptive caption on mobile; the count span stays */

  /* LIVE CARD — tighter grid, single line station label */
  .livecard { padding: 18px; border-radius: 14px; }
  .livecard__head {
    flex-direction: column; align-items: flex-start; gap: 12px;
    padding-bottom: 14px; margin-bottom: 14px;
  }
  .livecard__station { text-align: left; font-size: 15px; }
  .livecard__station span { font-size: 10px; }
  .livecard__item {
    grid-template-columns: 52px 1fr auto;
    gap: 10px; padding: 11px 4px;
  }
  .live-route { font-size: 13px; padding: 3px 0; }
  .live-dest { font-size: 13px; }
  .live-dest span { font-size: 10px; }
  .live-eta strong { font-size: 19px; }
  .livecard__foot { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 10px; }

  /* SECTION chrome */
  .section {
    padding-top: 48px; padding-bottom: 48px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .section--alt { padding: 48px 0; }
  .section--alt > .section__head,
  .section--alt > .routes,
  .section--alt > .tips { padding-left: 16px; padding-right: 16px; }
  .section__head { margin-bottom: 28px; }
  .section__title { font-size: 30px; }
  .section__desc { font-size: 14.5px; }

  /* BOARD — mobile layout (only base border-radius; toolbar/grid/arrivals removed) */
  .board { border-radius: 12px; }
  .chip { padding: 6px 11px; font-size: 12px; }

  /* SCHEDULE — picker as bottom-sheet on mobile */
  .routes { gap: 14px; }
  .routes__picker { top: 56px; }
  .route-picker { padding: 12px 14px; gap: 12px; }
  .route-picker__tag { font-size: 12px; padding: 5px 10px; }
  .route-picker__text strong { font-size: 15px; }
  .route-picker__text small { font-size: 10.5px; }
  .route-picker__hint { display: none; }

  .route-dialog {
    width: 100vw; max-width: 100vw;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: 0;
  }
  .rdlg__body { max-height: calc(92vh - 112px); }
  .rdlg-item { padding: 12px 10px; min-height: 52px; }
  .rdlg-item__name { font-size: 14.5px; }
  .rdlg-item__dest { font-size: 11px; }

  .routes__body { padding: 18px; border-radius: 12px; }
  .routeheader h3 { font-size: 22px; }
  .routeheader__sub { font-size: 11.5px; }
  .routepath { font-size: 12.5px; padding: 12px 14px; line-height: 1.8; }
  .routetimes { grid-template-columns: 1fr; gap: 22px; }
  .timegrid { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 5px; }
  .timegrid .slot { font-size: 12px; padding: 8px 2px; }
  .routefoot { flex-direction: column; gap: 8px; font-size: 11.5px; }

  /* TIPS, FERRY */
  .tips { grid-template-columns: 1fr; }
  .tips article { padding: 22px; }
  .ferry { grid-template-columns: 1fr; padding: 0 16px; gap: 14px; }
  .ferry__card { padding: 22px; }
  .ferry__head span { font-size: 26px; }

  /* FOOT */
  .foot { padding: 48px 0 20px; }
  .foot__inner { grid-template-columns: 1fr; gap: 28px; padding: 0 20px 32px; }
  .foot__bottom { flex-direction: column; gap: 6px; padding: 20px 20px 0; }
}

/* ≤ 380 — very narrow phones */
@media (max-width: 380px) {
  .hero__title { font-size: 38px; }
  .section__title { font-size: 26px; }
  .livecard__item { grid-template-columns: 48px 1fr auto; gap: 8px; }
  .hero__stats { gap: 8px; }
  .hero__stats dd { font-size: 18px; }
}

/* ============================================================
   Mobile interactions: pull-to-refresh, sticky toolbar,
   near-me button, thumb-zone, reduced-motion
   ============================================================ */


/* ---- Focus-visible rings (a11y quick win) ---- */
.chip:focus-visible,
.route-tag:focus-visible,
.btn:focus-visible,
.route-picker:focus-visible,
#stopSearch:focus-visible,
.search-result:focus-visible,
#nearMeBtn:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
.search-result {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: background .12s;
}
.search-result:hover,
.search-result[aria-selected="true"] {
  background: var(--bg-2);
}
.search-result__kind {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 4px 6px;
  border-radius: 4px;
  text-align: center;
  grid-row: span 2;
  align-self: center;
}
.search-result__title {
  font-size: 14px;
  font-weight: 500;
  grid-column: 2;
}
.search-result__sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  grid-column: 2;
}

/* ---- Thumb-zone ≥ 44px on touch devices ---- */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
    padding: 12px 20px;
  }
  .chip {
    min-height: 40px;
    padding: 10px 14px;
    font-size: 13px;
  }
  .nav__links a {
    display: inline-block;
    padding: 10px 0;
  }
  .route-tag {
    padding: 7px 12px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
  }
  .ferry__card { padding: 24px; }
  .timegrid .slot { min-height: 40px; display: flex; align-items: center; justify-content: center; }
}

/* ====== /en/ mobile：nav 藏 search ======
   桌機 en 維持 zh 同款 nav（search + plan + 中）—— en search-index Phase A
   已補齊，palette 在 /en/ 走 /search-index.en.json。
   Mobile en 寬度擠不下 search + plan + 中（iPhone 寬度下「中」字會 wrap），
   把 search 藏起來、讓 plan-cta 接手 margin-left: auto 維持「brand 靠左 /
   plan + 中 靠右」的對稱布局；mobile 沒鍵盤改靠 .hero__cta-search 補入口。 */
@media (max-width: 720px) {
  html[lang="en"] .nav__search-btn { display: none; }
  html[lang="en"] .nav__plan-cta { margin-left: auto; }
}

/* hero search trigger — mobile en only。 桌機 en 仍靠 ⌘K 鍵盤捷徑進
   palette（沒鍵盤的 mobile 才需要顯式按鈕）；mobile en 因為 nav search
   藏掉、又沒鍵盤，hero「往離島」chip 跟 nav 同 CTA 重複，正好把它換成
   search。zh 全平台、桌機 en 都維持原本「查看時刻表 + 往離島」配置。 */
.hero__cta-search { display: none; align-items: center; gap: 8px; }
.hero__cta-search svg { color: inherit; flex-shrink: 0; }
@media (max-width: 720px) {
  html[lang="en"] .hero__cta-plan { display: none; }
  html[lang="en"] .hero__cta-search { display: inline-flex; }
}

/* ---- Safe-area insets for notched devices ----
   Only chrome elements (nav, foot) need the inset on every viewport.
   .section padding uses different desktop / mobile defaults; the
   notch fallback is folded into the mobile breakpoint where it
   belongs (see @media (max-width: 720px) above). */
@supports (padding: env(safe-area-inset-left)) {
  .nav__inner { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .foot__inner { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
}

/* ---- prefers-reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .live-eta .arriving-tag,
  .rstop.is-boarding .rstop__bus {
    animation: none !important;
  }
  .route-tag:hover,
  .ferry__card:hover,
  .btn:hover {
    transform: none !important;
  }
}

/* ---- HTML `hidden` attribute must always hide element ---- */
/* Some elements set explicit `display: flex` which would override the
   UA `display: none` from the [hidden] attribute. This rule restores the
   contract that `hidden` always wins. */
[hidden] {
  display: none !important;
}

/* schedule-only row — non-realtime 路線的排定時刻標籤 */
.sched-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--bg-2);
}
