/* SW Railtours & ECS — public site. Values from docs/design/handoff-README.md (high fidelity). */
:root {
  --green: #1F4D3A;
  --ink: #141A17;
  --yellow: #FFCC00;
  --yellow-hover: #FFD83A;
  --page: #EEF1EC;
  --card: #fff;
  --panel: #F6F8F5;
  --border: #D8DED6;
  --rule: #C9D1C7;
  --muted: #5B6660;
  --hero-muted: #CFDDD4;
  --st-confirmed-bg: #DCEBE1; --st-confirmed-fg: #1F4D3A;
  --st-provisional-bg: #FFF3C4; --st-provisional-fg: #6E4E08;
  --st-cancelled-bg: #F8D9D2; --st-cancelled-fg: #8E2F1F;
  --st-run-bg: #E6E9E4; --st-run-fg: #5B6660;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--green); }
a:hover { color: var(--ink); }
input, button, select, textarea { font-family: inherit; }
button { color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.hdr :focus-visible, .evt:focus-visible, .code:focus-visible { outline-color: var(--yellow); }
.page { min-height: 100vh; display: flex; flex-direction: column; }
.noscript { max-width: 1320px; margin: 24px auto; padding: 0 24px; }

/* Header */
.hdr { background: var(--green); color: #fff; position: sticky; top: 0; z-index: 5; }
.hdr-inner { max-width: 1320px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark { width: 12px; height: 12px; background: var(--yellow); border-radius: 2px; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; }
.tab { border: 0; cursor: pointer; padding: 9px 14px; border-radius: 4px; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; background: transparent; color: #fff; }
.tab .badge { font: 600 11px var(--mono); padding: 2px 6px; border-radius: 3px; background: rgba(255, 255, 255, .15); }
.tab[aria-selected="true"] { background: #fff; color: var(--green); }
.tab[aria-selected="true"] .badge { background: var(--page); }
.nav-admin { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .7); text-decoration: none; padding: 9px 4px; }
.nav-admin:hover { color: #fff; }

/* Hero */
.hero { position: relative; background: var(--ink); color: #fff; min-height: 340px; display: flex; align-items: flex-end; overflow: hidden; }
.hero-photo { position: absolute; inset: 0; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 26, 23, .05) 30%, rgba(20, 26, 23, .9)); pointer-events: none; }
.hero-inner { position: relative; width: 100%; max-width: 1320px; margin: 0 auto; padding: 48px 24px 28px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; pointer-events: none; }
.hero-text { display: flex; flex-direction: column; gap: 8px; }
.hero-eyebrow { font: 600 12px var(--mono); letter-spacing: .14em; color: var(--yellow); }
.hero h1 { margin: 0; font-weight: 700; font-size: clamp(34px, 4.5vw, 60px); line-height: 1; letter-spacing: -.03em; }
.stats { display: flex; gap: 24px; font-size: 14px; color: var(--hero-muted); flex-wrap: wrap; }
.stats strong { color: #fff; font-size: 22px; font-family: var(--mono); font-weight: 700; }

/* Layout */
.main { max-width: 1320px; margin: 0 auto; padding: 24px; width: 100%; display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 1 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 12px; outline: none; }
.col-main > div { display: flex; flex-direction: column; gap: 12px; }
.col-main > div[hidden] { display: none; }
.side { flex: 1 1 300px; max-width: 380px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 76px; }
.skeleton { background: #E6E9E4; border-radius: 8px; min-height: 160px; }

/* Toolbar */
.toolbar { background: var(--card); border-radius: 8px; padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border: 1px solid var(--border); }
.search { flex: 1 1 220px; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; background: var(--panel); color: var(--ink); }
.year { height: 40px; padding: 0 32px 0 12px; border: 1px solid var(--border); border-radius: 6px; font: 600 13px var(--sans); background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235B6660' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--ink); appearance: none; -webkit-appearance: none; cursor: pointer; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { cursor: pointer; padding: 9px 12px; border-radius: 6px; font-weight: 600; font-size: 13px; border: 1px solid var(--border); background: var(--panel); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.toolbar--all h2 { margin: 0 auto 0 4px; font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.search--sm { flex: 1 1 180px; max-width: 280px; }

/* Day groups + cards */
.day { display: flex; flex-direction: column; gap: 8px; }
.day-head { display: flex; align-items: center; gap: 12px; padding: 10px 4px 2px; }
.day-head > span:first-child { font-weight: 700; font-size: 16px; }
.day-rule { height: 1px; flex: 1; background: var(--rule); }
.day-count { font: 600 12px var(--mono); color: var(--muted); }
.card { cursor: pointer; display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px; border-left: 6px solid var(--green); }
.card--ecs { border-left-color: var(--yellow); }
.card:hover { border-color: var(--green); border-left-color: var(--green); }
.card--ecs:hover { border-left-color: var(--yellow); }
.card.is-selected { background: var(--panel); border-color: var(--green); }
.card--ecs.is-selected { border-left-color: var(--yellow); }
.card-time { display: flex; flex-direction: column; gap: 2px; }
.card-time .dep { font: 700 22px var(--mono); letter-spacing: -.02em; }
.card-time .arr { font: 500 12px var(--mono); color: var(--muted); }
.card-body { display: flex; gap: 14px; align-items: center; min-width: 0; }
.card-text { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-title { font-weight: 700; font-size: 17px; }
.route { font-size: 14px; }
.meta { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.has-video { color: var(--green); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.ico { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: middle; }
.ico--yt { color: #FF0000; }
.ico--play { color: var(--green); }
.link-btn--video .ico { width: 22px; height: 22px; }

/* Photos: empty box shows the brand mark */
.photo { position: relative; background: var(--page); overflow: hidden; }
.photo::before { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--yellow); border-radius: 2px; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb { flex: none; width: 120px; height: 76px; border-radius: 6px; }

/* Codes + pills */
.code { font: 700 13px var(--mono); padding: 2px 7px; border-radius: 4px; background: var(--green); color: #fff; white-space: nowrap; }
.code--ecs { background: var(--yellow); color: var(--ink); }
.code--sm { font-size: 12px; padding: 2px 6px; }
.pill { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 5px 9px; border-radius: 4px; white-space: nowrap; }
.pill--sm { font-size: 11px; padding: 4px 8px; }
.st-confirmed { background: var(--st-confirmed-bg); color: var(--st-confirmed-fg); }
.st-provisional { background: var(--st-provisional-bg); color: var(--st-provisional-fg); }
.st-cancelled { background: var(--st-cancelled-bg); color: var(--st-cancelled-fg); }
.st-run { background: var(--st-run-bg); color: var(--st-run-fg); }
.empty { margin: 0; padding: 32px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--rule); border-radius: 8px; }

/* Calendar */
.cal-head { background: var(--card); border-radius: 8px; padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; border: 1px solid var(--border); }
.cal-head h2 { margin: 0; font-weight: 700; font-size: 22px; letter-spacing: -.02em; }
.cal-tools { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.legend { display: flex; gap: 12px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw--tour { background: var(--green); }
.sw--ecs { background: var(--yellow); }
.cal-nav { display: flex; gap: 4px; }
.cal-btn { width: 40px; height: 40px; border: 1px solid var(--border); background: var(--panel); border-radius: 6px; cursor: pointer; font-size: 16px; }
.cal-btn:hover { background: var(--page); }
.cal-grid { background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd { padding: 10px 8px; font: 600 11px var(--mono); letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--panel); }
.cal-cell { min-height: 100px; padding: 6px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--page); border-bottom: 1px solid var(--page); min-width: 0; }
.cal-cell.is-out { opacity: .35; }
.cal-day { font-weight: 600; font-size: 13px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal-day.is-today { background: var(--green); color: #fff; }
.evt { display: block; width: 100%; text-align: left; border: 0; border-radius: 3px; padding: 3px 5px; font: 600 11px/1.3 var(--mono); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--green); color: #fff; }
.evt--ecs { background: var(--yellow); color: var(--ink); }

/* All timings table */
.tbl-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 680px; }
.tbl thead tr { text-align: left; font: 600 11px var(--mono); letter-spacing: .08em; color: var(--muted); background: var(--panel); }
.tbl th { padding: 10px 12px; font-weight: 600; }
.tbl td { padding: 11px 12px; border-top: 1px solid var(--page); }
.row { cursor: pointer; }
.row:hover { background: var(--page); }
.row.is-selected { background: var(--panel); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.b { font-weight: 700; }
.muted { color: var(--muted); }
.svc { font-weight: 600; }
.sub { color: var(--muted); font-size: 13px; }

/* Sidebar detail */
.detail { background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.detail-photo { aspect-ratio: 16 / 10; }
.detail-photo .pill { position: absolute; top: 10px; left: 10px; pointer-events: none; }
.detail-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.detail-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kind { font: 600 11px var(--mono); letter-spacing: .12em; color: var(--muted); }
.detail h3 { margin: 0; font-weight: 700; font-size: 20px; letter-spacing: -.02em; line-height: 1.15; }
.detail-body > span { font-size: 14px; }
.calls-head { display: grid; grid-template-columns: 14px minmax(0, 1fr) 46px 46px 30px; gap: 0 10px; font: 600 10px var(--mono); letter-spacing: .08em; color: var(--muted); padding: 8px 0 4px; border-top: 1px solid var(--page); }
.calls-head span:nth-child(n+3) { text-align: right; }
.calls { display: flex; flex-direction: column; font-size: 14px; }
.call { display: grid; grid-template-columns: 14px minmax(0, 1fr) 46px 46px 30px; gap: 0 10px; align-items: center; min-height: 32px; }
.call.is-end .loc { font-weight: 700; }
.tl { align-self: stretch; position: relative; display: flex; justify-content: center; }
.tl-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--green); }
.tl-line.tl-first { top: 50%; }
.tl-line.tl-last { bottom: 50%; }
.tl-dot { position: relative; align-self: center; width: 8px; height: 8px; border-radius: 50%; background: #fff; border: 2px solid var(--green); }
.detail--ecs .tl-line, .detail--ecs .tl-dot { background-color: var(--yellow); border-color: var(--yellow); }
.detail--ecs .tl-dot { background: #fff; }
.call .t { text-align: right; font: 500 13px var(--mono); color: var(--muted); }
.call .dep { font-weight: 600; color: var(--ink); }
.call .plt { font-size: 12px; }
.link-btn { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px dashed var(--rule); background: var(--panel); border-radius: 6px; padding: 10px 12px; font-size: 13px; cursor: pointer; color: var(--ink); text-align: left; width: 100%; }
.link-btn:hover { background: var(--page); }
a.link-btn { text-decoration: none; }
.link-btn--video { border-style: solid; border-color: var(--green); }
.link-btn .b { font: 700 12px var(--mono); white-space: nowrap; }
.notice { background: var(--yellow); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.notice[hidden] { display: none; }
.notice-label { font: 600 11px var(--mono); letter-spacing: .12em; }
.notice-text { font-weight: 600; font-size: 15px; line-height: 1.4; }

/* Footer */
.foot { margin-top: auto; }
.foot-inner { max-width: 1320px; margin: 0 auto; padding: 16px 24px; font-size: 13px; color: var(--muted); }

/* Small screens */
@media (max-width: 600px) {
  .tab, .chip, .link-btn, .cal-btn { min-height: 44px; }
  .evt { min-height: 24px; }
  .card { grid-template-columns: 72px minmax(0, 1fr); }
  .card > .pill { grid-column: 1 / -1; justify-self: start; }
  .thumb { width: 84px; height: 56px; }
  .side { position: static; max-width: none; }
}
