/* TFLEx site styles
   Layout: transit-signage header, single reading column with a wide
   "departures board" on Home and a route-line diagram for the Calendar.
   Event types are coloured like transit lines: Forum = blue, SIG = green,
   Workshop = amber. */
:root {
  --bg: #f4f7fa;
  --surface: #ffffff;
  --ink: #0e1b2c;
  --muted: #526173;
  --rule: #d6dee7;
  --brand: #12355b;
  --brand-ink: #ffffff;
  --link: #1a5aa6;
  --forum: #1f6fd1;
  --sig: #13875f;
  --workshop: #c97a12;
  --past: #9aa7b5;

  --f-display: "Overpass", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Public Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --f-mono: "Overpass Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.15rem;
  --step-4: clamp(2.2rem, 5vw, 3.4rem);
  --wrap: 72rem;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1420; --surface: #111d2c; --ink: #e5ecf4; --muted: #95a5b7; --rule: #233548;
    --brand: #0f2a48; --brand-ink: #e5ecf4; --link: #84b6ef;
    --forum: #5ea2f0; --sig: #3dbd8e; --workshop: #f0ad4a; --past: #5d6d7f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1420; --surface: #111d2c; --ink: #e5ecf4; --muted: #95a5b7; --rule: #233548;
  --brand: #0f2a48; --brand-ink: #e5ecf4; --link: #84b6ef;
  --forum: #5ea2f0; --sig: #3dbd8e; --workshop: #f0ad4a; --past: #5d6d7f;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--forum); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: var(--step-4); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: var(--step-3); font-weight: 800; }
h3 { font-size: var(--step-1); font-weight: 700; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; z-index: 10; }

/* ---------- Header (signage band) ---------- */
.site-head { background: var(--brand); color: var(--brand-ink); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .9rem; }
.mark { display: flex; align-items: center; gap: .75rem; color: inherit; text-decoration: none; }
.mark-dots { display: inline-flex; gap: 4px; }
.mark-dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.mark-dots i:nth-child(1) { background: var(--forum); }
.mark-dots i:nth-child(2) { background: var(--sig); }
.mark-dots i:nth-child(3) { background: var(--workshop); }
.mark-name { font-family: var(--f-display); font-weight: 800; font-size: 1.6rem; letter-spacing: .01em; line-height: 1; }
.mark-sub { display: block; font-family: var(--f-display); font-weight: 600; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; opacity: .8; margin-top: .2rem; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .15rem .3rem; }
.nav a {
  display: block; color: var(--brand-ink); text-decoration: none; opacity: .85;
  font-family: var(--f-display); font-weight: 600; font-size: .98rem; padding: .4rem .6rem; border-radius: 4px;
}
.nav a:hover { opacity: 1; background: rgba(255,255,255,.1); }
.nav a[aria-current="page"] { opacity: 1; box-shadow: inset 0 -3px 0 var(--workshop); border-radius: 0; }
.nav-toggle {
  display: none; background: transparent; color: var(--brand-ink); border: 1px solid rgba(255,255,255,.4);
  border-radius: 4px; font: 600 .95rem var(--f-display); padding: .45rem .8rem; cursor: pointer;
}
@media (max-width: 900px) {
  .site-head .wrap { flex-wrap: wrap; }
  .nav-toggle { display: inline-block; }
  .nav { flex-basis: 100%; display: none; }
  .nav-open .nav { display: block; }
  .nav ul { flex-direction: column; padding-block: .5rem; }
  .nav a { padding: .6rem .25rem; }
}

/* ---------- Page header ---------- */
.page-head { border-bottom: 1px solid var(--rule); background: var(--surface); }
.page-head .wrap { padding-block: clamp(2rem, 5vw, 3.25rem); display: grid; gap: .75rem; }
.eyebrow { font-family: var(--f-display); font-weight: 700; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0; }
.lede { font-size: var(--step-1); color: var(--muted); max-width: 44rem; margin: 0; }

main { display: block; }
.section { padding-block: clamp(2rem, 5vw, 3.5rem); }
.section + .section { border-top: 1px solid var(--rule); }
.prose { max-width: 42rem; }
.prose > * + * { margin-top: 1rem; }
.prose p, .prose ul, .prose ol { margin: 0; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: .35rem; }
.prose h2 { font-size: var(--step-2); margin-top: 2.25rem; }
.prose h3 { margin-top: 1.75rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 820px) { .two-col { grid-template-columns: minmax(0, 1fr); } }

.aside {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 1.25rem;
  display: grid; gap: .6rem; font-size: var(--step--1);
}
.aside h3 { font-size: 1.05rem; }
.aside p { margin: 0; }

.btn {
  display: inline-block; background: var(--brand); color: var(--brand-ink); text-decoration: none;
  font-family: var(--f-display); font-weight: 700; padding: .65rem 1.1rem; border-radius: 4px; border: 0; cursor: pointer; font-size: 1rem;
}
.btn:hover { filter: brightness(1.15); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--rule); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.empty { color: var(--muted); font-style: italic; margin: 0; }

/* ---------- Chips (line colours) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .4rem; font-family: var(--f-display); font-weight: 700;
  font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.chip::before { content: ""; width: .7rem; height: .7rem; border-radius: 50%; background: currentColor; }
.chip-forum { color: var(--forum); }
.chip-sig { color: var(--sig); }
.chip-workshop { color: var(--workshop); }

/* ---------- Home hero + departures board ---------- */
.hero { background: var(--brand); color: var(--brand-ink); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 6vw, 5rem); align-items: start; }
.hero h1 { color: var(--brand-ink); font-size: clamp(2rem, 4.2vw, 2.9rem); }
.hero p { margin: 0; opacity: .88; font-size: var(--step-1); max-width: 34rem; }
.hero-copy { display: grid; gap: 1.25rem; }
.hero .btn { background: var(--workshop); color: #1b1203; }
.hero .btn-ghost { background: transparent; color: var(--brand-ink); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.45); }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: minmax(0, 1fr); } }

.board { background: var(--surface); color: var(--ink); border-radius: 6px; overflow: hidden; box-shadow: 0 10px 30px rgba(4, 16, 32, .25); }
.board-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--rule); font-family: var(--f-display); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; font-size: .8rem;
}
.board-head a { font-weight: 600; letter-spacing: 0; text-transform: none; font-size: .9rem; }
.deps { list-style: none; margin: 0; padding: 0; }
.dep { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) auto; gap: .9rem; align-items: start; padding: 1rem 1.1rem; border-left: 5px solid var(--past); }
.dep + .dep { border-top: 1px solid var(--rule); }
.dep-forum { border-left-color: var(--forum); }
.dep-sig { border-left-color: var(--sig); }
.dep-workshop { border-left-color: var(--workshop); }
.dep-date { display: grid; text-align: center; font-family: var(--f-mono); line-height: 1.05; }
.dep-mon { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dep-day { font-size: 1.7rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.dep-main { display: grid; gap: .2rem; min-width: 0; }
.dep-title { font-family: var(--f-display); font-weight: 700; line-height: 1.3; }
.dep-meta { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); }
.dep-rel { font-family: var(--f-mono); font-size: .78rem; color: var(--muted); white-space: nowrap; padding-top: .15rem; }
@media (max-width: 480px) { .dep { grid-template-columns: 3rem minmax(0, 1fr); } .dep-rel { grid-column: 2; padding-top: 0; } }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1.5rem 2rem; margin: 0; padding: 0; list-style: none; }
.facts li { display: grid; }
.facts b { font-family: var(--f-display); font-size: var(--step-3); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.facts span { color: var(--muted); font-size: var(--step--1); }

.programs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; margin-top: 1.75rem; }
.program { background: var(--surface); padding: 1.4rem 1.4rem 1.5rem; display: grid; gap: .5rem; align-content: start; }
.program p { margin: 0; color: var(--muted); }
.program a.more { font-family: var(--f-display); font-weight: 700; }
@media (max-width: 700px) { .programs { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Calendar route line ---------- */
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: 0; padding: 0; list-style: none; }
.line-year { font-size: var(--step-2); margin: 2.5rem 0 1rem; font-family: var(--f-mono); font-weight: 500; color: var(--muted); }
.line-year:first-child { margin-top: 0; }
.line { list-style: none; margin: 0; padding: 0; position: relative; }
.line::before { content: ""; position: absolute; left: 10.5rem; top: .5rem; bottom: .5rem; width: 4px; background: var(--rule); border-radius: 2px; }
.stop { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 2.5rem; padding-block: .85rem; position: relative; }
.stop::before {
  content: ""; position: absolute; left: calc(10.5rem - 7px); top: 1.05rem; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 4px solid var(--c, var(--past));
}
.stop-forum { --c: var(--forum); }
.stop-sig { --c: var(--sig); }
.stop-workshop { --c: var(--workshop); }
.stop-workshop::before { width: 22px; height: 22px; left: calc(10.5rem - 9px); top: .9rem; border-radius: 4px; }
.stop.is-past::before { border-color: var(--past); background: var(--past); }
.stop.is-past .stop-title, .stop.is-past .stop-when { color: var(--muted); }
.stop.is-past .chip { color: var(--past); }
.stop-when { font-family: var(--f-mono); font-size: .85rem; text-align: right; padding-top: .2rem; font-variant-numeric: tabular-nums; display: grid; }
.stop-when span + span { color: var(--muted); font-size: .78rem; }
.stop-body { display: grid; gap: .3rem; min-width: 0; }
.stop-title { font-size: 1.1rem; line-height: 1.35; }
.stop-today { position: relative; padding-block: .6rem; }
.stop-today::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed var(--ink); opacity: .35; }
.stop-today span {
  position: relative; display: inline-block; margin-left: calc(10.5rem + 2.5rem); background: var(--ink); color: var(--bg);
  font-family: var(--f-mono); font-size: .78rem; padding: .15rem .55rem; border-radius: 3px; letter-spacing: .04em;
}
@media (max-width: 640px) {
  .stop-when { display: flex; flex-wrap: wrap; gap: 0 .6rem; }
  .line::before { left: 7px; }
  .stop { grid-template-columns: minmax(0, 1fr); gap: .2rem; padding-left: 2.1rem; }
  .stop::before { left: 0; }
  .stop-workshop::before { left: -2px; }
  .stop-when { text-align: left; }
  .stop-today span { margin-left: 2.1rem; }
}

details { margin-top: .35rem; }
summary { cursor: pointer; font-family: var(--f-display); font-weight: 700; color: var(--link); font-size: .95rem; width: fit-content; }
details[open] > summary { margin-bottom: .75rem; }
details .prose { font-size: .98rem; }
.call-note { font-size: .88rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: .75rem; }
.ev-loc { font-weight: 600; }

/* ---------- Event cards (Forum Calls, Workshops) ---------- */
.ev-list { display: grid; gap: 1rem; }
.ev { background: var(--surface); border: 1px solid var(--rule); border-left: 5px solid var(--c, var(--past)); border-radius: 4px; padding: 1.1rem 1.25rem; display: grid; gap: .35rem; }
.ev-forum { --c: var(--forum); }
.ev-sig { --c: var(--sig); }
.ev-workshop { --c: var(--workshop); }
.ev.is-past { --c: var(--past); }
.ev-head { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: baseline; }
.ev-when { font-family: var(--f-mono); font-size: .85rem; color: var(--muted); }
.ev-title { font-size: 1.15rem; }

/* ---------- Tables & lists ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-family: var(--f-display); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.mono { font-family: var(--f-mono); font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

.agencies { list-style: none; margin: 0; padding: 0; columns: 2 20rem; column-gap: 3rem; }
.agencies li { break-inside: avoid; padding: .55rem 0; border-bottom: 1px solid var(--rule); }
.agencies b { font-weight: 600; }
.agencies span { display: block; color: var(--muted); font-size: .9rem; }

.modules { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.modules li { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: 1rem; padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.mod-no { font-family: var(--f-mono); font-size: 1.1rem; color: var(--muted); padding-top: .1rem; }
.modules h3 { font-size: 1.1rem; }
.modules p { margin: .3rem 0 0; color: var(--muted); }
.cpe { display: inline-block; margin-top: .4rem; font-family: var(--f-mono); font-size: .78rem; color: var(--sig); }

.dues { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.dues div { background: var(--surface); padding: 1rem 1.1rem; display: grid; gap: .2rem; }
.dues span { font-size: .85rem; color: var(--muted); }
.dues b { font-family: var(--f-mono); font-size: 1.5rem; font-weight: 500; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .dues { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1rem; max-width: 34rem; }
.form label { display: grid; gap: .3rem; font-weight: 600; font-size: .95rem; }
.form input, .form textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--rule); border-radius: 4px; padding: .6rem .7rem; width: 100%;
}
.form input:focus, .form textarea:focus { border-color: var(--forum); outline: none; }
.form-status { margin: 0; font-size: .95rem; color: var(--muted); min-height: 1.5em; }
.hp { position: absolute; left: -9999px; }

/* ---------- Footer ---------- */
.site-foot { background: var(--surface); border-top: 1px solid var(--rule); margin-top: 2rem; font-size: .92rem; }
.site-foot .wrap { padding-block: 2.5rem; display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 2rem; }
.site-foot h2 { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .6rem; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.site-foot p { margin: 0 0 .5rem; color: var(--muted); }
@media (max-width: 760px) { .site-foot .wrap { grid-template-columns: minmax(0, 1fr); } }

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

/* Logo in header */
.mark-logo { display: block; height: 60px; width: auto; }
@media (max-width: 40rem) { .mark-logo { height: 48px; } }

/* Transit Glossary */
.glossary-nav { display: flex; flex-wrap: wrap; gap: .35rem .6rem; font-family: var(--f-display); font-weight: 700; }
.glossary dt { font-weight: 600; margin-top: 1.1rem; }
.glossary dd { margin: .25rem 0 0; }
.glossary dd p + p { margin-top: .4rem; }
.glossary .calc { font-family: "Overpass Mono", monospace; font-size: .88rem; color: var(--muted); }
.prose h2[id^="g-"] { border-bottom: 1px solid var(--rule); padding-bottom: .25rem; }
.prose figure { margin: 0; }
