/* ─── Tiger Takes on the Thames · v2 "river spine" ─────────────────────────────
   Navy-led (My Name'5 Doddie Foundation Pantone 280 / 2935), paper background,
   yellow only for Tiger and the live state, tartan as a thin strip.            */
:root {
  --paper: #f6f4ef; --card: #ffffff; --ink: #14181f; --muted: #5f6673; --line: #e3ded4;
  --navy: #002169; --blue: #0055b8; --blue-soft: #c9d8ee; --blue-faint: #edf2f9;
  --gold: #f0b400; --gold-soft: #fff4cc; --gold-text: #8f6a00; --late: #b3410f; --early: #1f7a4a;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  --sans: 'Work Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 6px; --max: 1040px; --rail: 88px; --river-w: 10px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.08; margin: 0 0 12px 0; text-wrap: balance; letter-spacing: -0.012em; color: var(--navy); }
h1 { font-size: clamp(40px, 7vw, 74px); }
h2 { font-size: clamp(26px, 3.6vw, 38px); }
h3 { font-size: 20px; }
p { margin: 0 0 12px 0; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px 0; }
.sub { color: var(--muted); max-width: 60ch; }
.fine { font-size: 13px; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card.small { padding: 20px; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9em; }

/* Tartan strip: navy / white / yellow / black, as a thin band only */
.tartan { height: 6px; background: repeating-linear-gradient(90deg, var(--navy) 0 26px, #ffffff 26px 30px, var(--navy) 30px 44px, var(--gold) 44px 58px, #111 58px 61px, var(--gold) 61px 72px, var(--navy) 72px 96px); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: var(--radius); font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; border: 1.5px solid transparent; font-family: inherit; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #001a52; }
.btn-outline { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background: var(--blue-faint); }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 14px; background: var(--navy); color: #fff; }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn[hidden] { display: none; }

/* Header */
.top { position: sticky; top: 0; z-index: 10; background: rgba(246,244,239,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; }
.brand { font-family: var(--serif); font-weight: 600; color: var(--navy); text-decoration: none; font-size: 18px; white-space: nowrap; }
.top nav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.top nav a:not(.btn) { color: var(--ink); text-decoration: none; }
@media (max-width: 720px) { .top nav a:not(.btn) { display: none; } }

main { max-width: var(--max); margin: 0 auto; padding: 0 20px 40px 20px; }
section { margin: 64px 0; }

/* ── Hero ──────────────────────────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: end; margin-top: 36px; }
.hero-photo { margin: 0; position: relative; border-radius: var(--radius); overflow: hidden; background: #e6e1d6; aspect-ratio: 4 / 5; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
figure.missing img { display: none; }
figure .placeholder { display: none; }
figure.missing .placeholder { display: flex; position: absolute; inset: 0; align-items: center; justify-content: center; text-align: center; padding: 20px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #8a8377; }
.lede { font-size: 19px; color: #333b47; max-width: 50ch; }
#countdown { color: var(--gold-text); font-weight: 600; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; gap: 22px; } .hero-photo { aspect-ratio: 4 / 3; order: -1; } }

/* ── Numbers cascade ───────────────────────────────────────────────────────── */
.numbers { display: flex; flex-direction: column; gap: 6px; margin: 40px 0 64px; }
.stat { display: flex; flex-direction: column; margin-left: calc(var(--i, 0) * 9%); opacity: 0; transform: translateY(10px); animation: rise 0.6s ease forwards; animation-delay: calc(var(--i, 0) * 120ms); }
.stat b { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 4.6vw, 50px); color: var(--navy); line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat span { font-size: clamp(15px, 1.8vw, 19px); color: var(--gold-text); font-weight: 500; margin-top: 2px; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (max-width: 720px) { .stat { margin-left: calc(var(--i, 0) * 4%); } .numbers { gap: 10px; } }
@media (prefers-reduced-motion: reduce) { .stat { animation: none; opacity: 1; transform: none; } }

/* ── Fundraising ───────────────────────────────────────────────────────────── */
.raise { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.raise-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.raise-total { display: flex; align-items: baseline; gap: 12px; }
.raise-total > span { font-family: var(--serif); font-weight: 600; font-size: clamp(38px, 5.5vw, 56px); font-variant-numeric: tabular-nums; line-height: 1; }
.raise-total small { color: rgba(255,255,255,0.7); font-size: 14px; }
.raise-count { color: rgba(255,255,255,0.7); font-size: 14px; }
.bar { height: 10px; border-radius: 5px; background: rgba(255,255,255,0.15); overflow: hidden; }
.bar-fill { height: 100%; background: var(--gold); transition: width 0.8s ease; }
.raise-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.raise .btn-primary { background: var(--gold); color: var(--ink); }
.raise .btn-primary:hover { background: #e0a800; }
.raise .btn-outline { color: #fff; border-color: rgba(255,255,255,0.6); }
.raise .btn-outline:hover { background: rgba(255,255,255,0.08); }
.raise .fine { color: rgba(255,255,255,0.65); margin: 0; }
@media (min-width: 720px) { .raise-actions .btn { min-width: 240px; } }

/* ── The river ─────────────────────────────────────────────────────────────── */
.journey-head { margin-bottom: 28px; max-width: 70ch; }
.live-tag .dot { display: none; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); margin-right: 8px; vertical-align: middle; }
body[data-state="live"] .live-tag { color: var(--navy); }
body[data-state="live"] .live-tag .dot { display: inline-block; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .live-tag .dot { animation: none; } html { scroll-behavior: auto; } }
.journey-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
#updated { margin-top: 10px; }

.river-wrap { position: relative; }
#river-svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.flow { list-style: none; margin: 0; padding: 0 0 0 var(--rail); position: relative; }

/* Checkpoint node */
.node { position: relative; padding: 10px 0 10px 8px; min-height: 64px; display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: baseline; }
.node .mark { position: absolute; left: calc(var(--mx, 44px) - var(--rail)); top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--paper); border: 3px solid var(--blue-soft); z-index: 2; }
.node.done .mark { background: var(--navy); border-color: var(--navy); }
.node.next .mark { border-color: var(--navy); }
.node .name { font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--navy); }
.node .name small { font-family: var(--sans); font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 8px; letter-spacing: 0.04em; }
.node .times { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); white-space: nowrap; }
.node .times b { display: block; font-weight: 600; color: var(--ink); font-size: 15px; }
.node.done .times b { color: var(--navy); }
.node.next .times b { color: var(--navy); }
.node .delta { font-size: 12px; font-weight: 600; margin-left: 6px; }
.delta.late { color: var(--late); } .delta.early { color: var(--early); }
.node .runners { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin-top: -2px; }
.node.first .name, .node.last .name { font-size: 24px; }

/* Leg (the stretch between two checkpoints) */
.leg { position: relative; padding: 6px 0 6px 8px; display: grid; grid-template-columns: 1fr; gap: 10px; align-items: start; }
.leg-meta { display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline; font-size: 13px; color: var(--muted); }
.leg-meta .n { font-weight: 600; color: var(--ink); letter-spacing: 0.04em; text-transform: uppercase; font-size: 12px; }
.leg-meta .sponsor { color: var(--navy); font-weight: 600; }
.leg-meta .open { color: var(--muted); }
.leg-meta .open a { color: var(--navy); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--blue-soft); }
.leg-photo { margin: 0; position: relative; border-radius: var(--radius); overflow: hidden; background: #e9e4da; aspect-ratio: 16 / 9; max-width: 560px; }
.leg-photo img { width: 100%; height: 100%; object-fit: cover; }
.leg-photo { display: none; }
.leg-photo.loaded { display: block; }
.leg-photo figcaption.cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px; font-size: 12px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,0.55)); }
.leg .note { font-size: 14px; color: var(--ink); max-width: 56ch; }

/* Tiger marker */
.tiger { position: absolute; z-index: 3; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: var(--gold); border: 3px solid #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.18); display: none; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: var(--ink); }
.tiger .label { position: absolute; left: 38px; top: 50%; transform: translateY(-50%); background: var(--gold); color: var(--ink); font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 4px; white-space: nowrap; }
body[data-state="live"] .tiger, body[data-state="finished"] .tiger { display: flex; }
body[data-state="finished"] .tiger .label { display: none; }

/* Story interlude inside the flow */
.interlude { position: relative; margin: 36px 0 36px -8px; padding: 0; }
.interlude-inner { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-left: 8px; }
.pull { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 3vw, 30px); line-height: 1.3; margin: 0 0 20px 0; max-width: 32ch; color: var(--navy); }
.story-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 28px; align-items: start; }
.story-body { max-width: 62ch; }
.story-photo { margin: 0; position: relative; border-radius: var(--radius); overflow: hidden; background: #e6e1d6; aspect-ratio: 4 / 5; }
.story-photo img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 820px) { .story-grid { grid-template-columns: 1fr; } .story-photo { aspect-ratio: 4 / 3; } .interlude-inner { padding: 20px; } }

/* Finish */
.finish-card { margin: 24px 0 0 8px; background: var(--gold-soft); border: 1px solid #f1dc8c; border-radius: var(--radius); padding: 20px; }
.finish-card h3 { color: var(--navy); }

/* After the Barrier */
.after-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; }
#follow[hidden] { display: none; }
.after-grid:has(#follow[hidden]) { grid-template-columns: 1fr; }
/* Updates */
.updates[hidden] { display: none; }
.posts { display: flex; flex-direction: column; gap: 16px; margin: 8px 0 16px; }
.post { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; grid-template-columns: 1fr; }
.post.older { display: none; }
.post-photo { margin: 0; background: #e9e4da; aspect-ratio: 16 / 9; }
.post-photo img { width: 100%; height: 100%; object-fit: cover; }
.post-body { padding: 20px 22px; max-width: 66ch; }
.post-body h3 { margin-bottom: 8px; }
.post-body p { font-size: 15.5px; }
@media (min-width: 820px) { .post:has(.post-photo) { grid-template-columns: 0.9fr 1.1fr; } .post-photo { aspect-ratio: auto; min-height: 100%; } }
.social { display: flex; gap: 10px; flex-wrap: wrap; }
.social .btn { min-height: 40px; font-size: 14px; }
#press p { font-size: 14.5px; }
@media (max-width: 820px) { .after-grid { grid-template-columns: 1fr; } }

footer { border-top: 1px solid var(--line); text-align: center; font-size: 13px; color: var(--muted); }
footer p { padding: 18px 20px 26px; margin: 0; }

/* Wider rail on larger screens so the meander has room */
@media (min-width: 720px) { :root { --rail: 150px; } .node { padding-left: 14px; } .leg { padding-left: 14px; grid-template-columns: 1fr; } }
@media (min-width: 900px) { .leg { grid-template-columns: 1fr 1fr; } .leg-meta { grid-column: 1 / -1; } }

/* States */
body[data-state="finished"] .bar-fill { background: var(--gold); }
