/* History pages: loaded after /styles.css, whose tokens and chrome these build on.
   The timeline, story page and poster are adapted from the Sorell Asset Story mockup. */
:root {
  --bg: var(--wash); --surface: var(--paper); --ink-2: #3c4658; --line: var(--rule);
  --brand: var(--blue); --accent: var(--gold);
  --tone-blue: var(--blue); --tone-gold: #b77400; --tone-green: #2e7d4f; --tone-teal: #1f6f6b; --tone-red: #b3412e; --tone-ink: var(--ink);
  --shadow: 0 1px 2px rgba(29, 36, 51, .06), 0 6px 20px rgba(29, 36, 51, .06);
}

main { padding-bottom: 64px; }
h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); }
p { margin: 0; }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 62ch; margin-top: 10px; }
.empty { color: var(--muted); padding: 12px 0; }
.gap { color: var(--muted); font-style: italic; }
.gap a { font-style: normal; }

/* ---- kinds ----------------------------------------------------------------- */
.kind-built { --k: var(--tone-blue); } .kind-donated { --k: var(--tone-gold); } .kind-helped { --k: var(--tone-green); }
.kind-supported { --k: var(--tone-teal); } .kind-hosted { --k: var(--tone-red); } .kind-club { --k: var(--tone-ink); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; background: var(--k); }
.badge { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge.kind { color: var(--k); box-shadow: inset 0 0 0 1.5px currentColor; }
.badge.example { background: var(--gold); color: var(--ink); }
.preview-banner { background: var(--gold); color: var(--ink); text-align: center; padding: 6px 12px; font-size: .9rem; }

/* ---- shared pieces --------------------------------------------------------- */
.picture { position: relative; aspect-ratio: 5 / 3; overflow: hidden; border-radius: 10px; background: var(--line); }
.picture img { display: block; width: 100%; height: 100%; object-fit: cover; }
.event-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.btn { appearance: none; border: 0; cursor: pointer; font: 700 1rem var(--font); padding: 12px 18px; border-radius: 12px; background: var(--blue); color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.btn-ghost { background: transparent; color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.btn:focus-visible, a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 20px 0 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; margin: 0; }
.tile-value { font-size: 1.1rem; font-weight: 700; line-height: 1.25; margin: 0; }
.tile-label { font-size: .8rem; color: var(--ink-2); line-height: 1.3; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 6px; }

/* ---- filters ----------------------------------------------------------------- */
.intro { padding-top: 28px; }
.stats { margin-top: 10px; font-size: .95rem; color: var(--ink-2); }
.stats strong { color: var(--ink); }
.controls { padding: 18px 0 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-width: 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; padding: 2px; }
.chip { appearance: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 .88rem var(--font); padding: 6px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.select { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-2); }
.select select { font: 600 .92rem var(--font); padding: 7px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); max-width: 60vw; }

/* ---- timeline: one line per programme, on a shared 1985-to-today scale ---- */
.gantt-wrap { max-width: 72rem; }
.gantt { --label: 330px; --gap: 20px; position: relative; padding: 8px 0 4px; }
.g-row, .g-head, .g-foot { position: relative; z-index: 1; display: grid; grid-template-columns: var(--label) 1fr; column-gap: var(--gap); align-items: center; }
.g-row { padding: 6px 0; }
.g-row + .g-row { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.g-label { font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: right; }
.g-track { position: relative; align-self: stretch; min-height: 40px; }
.g-grid { position: absolute; z-index: 0; top: 0; bottom: 28px; left: calc(var(--label) + var(--gap)); right: 0; pointer-events: none; }
.g-grid i { position: absolute; top: 0; bottom: 0; width: 1px; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.g-grid b { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -2px; background: var(--gold); }

.g-card { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 8px; border-radius: var(--radius); color: inherit; text-decoration: none; }
.g-card:hover { background: var(--wash); }
.g-thumb { width: 64px; height: 64px; aspect-ratio: auto; border-radius: 10px; }
.g-text { display: flex; flex-direction: column; min-width: 0; }
.g-title { font-weight: 800; line-height: 1.2; }
.g-when { font-size: .8rem; font-weight: 700; color: var(--k); }
.g-hook { font-size: .82rem; line-height: 1.35; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.is-example .g-when { color: #9a6a00; }

.g-bar { position: absolute; top: 50%; height: 16px; margin-top: -8px; min-width: 8px; border-radius: 999px; background: var(--k); }
.g-bar.is-ongoing { border-radius: 999px 0 0 999px; }
.is-example .g-bar { background: repeating-linear-gradient(135deg, var(--k) 0 6px, color-mix(in srgb, var(--k) 55%, #fff) 6px 10px); }
.g-row:hover .g-bar { filter: brightness(1.12); }
.g-dot { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--k); box-shadow: 0 0 0 3px #fff; }
.is-example .g-dot { background: repeating-linear-gradient(135deg, var(--k) 0 3px, color-mix(in srgb, var(--k) 55%, #fff) 3px 5px); }
.g-mark { position: absolute; top: 50%; z-index: 2; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--k); }
.g-mark:hover, .g-mark:focus-visible { transform: scale(1.4); }

.g-head { padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.g-top { min-height: 0; padding: 4px 0; }
.g-moments { position: relative; height: 38px; }
.g-moment { position: absolute; top: 0; display: flex; flex-direction: column; padding: 0 0 0 10px; border-left: 2px solid var(--k); color: var(--ink); text-decoration: none; white-space: nowrap; line-height: 1.2; }
.g-moment::before { content: ""; position: absolute; left: -6px; bottom: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--k); }
.g-moment span { font-size: .82rem; font-weight: 800; }
.g-moment small { font-size: .72rem; font-weight: 700; color: var(--muted); }
.g-moment:hover span { color: var(--blue); text-decoration: underline; }
.g-moment.is-example { border-left-style: dashed; }
.g-moment.is-flipped { transform: translateX(-100%); padding: 0 10px 0 0; border-left: 0; border-right: 2px solid var(--k); align-items: flex-end; }
.g-moment.is-flipped::before { left: auto; right: -6px; }
.g-moment.is-flipped.is-example { border-right-style: dashed; }
.g-axis { min-height: 28px; font-size: .8rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.g-axis span { position: absolute; top: 6px; transform: translateX(-50%); }
.g-axis span:first-child { transform: none; }
.g-axis .g-today { transform: translateX(-100%); color: var(--ink); }
.gantt .empty { grid-column: 1 / -1; padding: 24px 0; }
.tl-foot { padding-top: 20px; display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; }

/* A picture with no photo: a plain panel in the kind's colour with its icon. */
.panel { display: grid; place-items: center; background: color-mix(in srgb, var(--k) 14%, #fff); }
.panel .icon { width: 40%; max-width: 120px; fill: none; stroke: var(--k); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.g-thumb.panel .icon { width: 55%; }

@media (max-width: 760px) {
  .gantt { --label: 0px; --gap: 0px; }
  .g-row, .g-head, .g-foot { grid-template-columns: 1fr; }
  .g-label, .g-head .g-label, .g-foot .g-label { display: none; }
  .g-card { padding: 6px 0; }
  .g-track { min-height: 26px; }
  .g-grid { left: 0; }
}

/* ---- list ----------------------------------------------------------------- */
#list section { padding-top: 28px; scroll-margin-top: 20px; }
.asset-grid { display: grid; gap: 14px; margin-top: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.asset-card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--k); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.asset-card:hover { border-color: var(--k); }
.asset-card .picture { border-radius: 0; }
.asset-card.is-example { outline: 2px dashed var(--gold); }
.asset-card-body { padding: 12px 16px 16px; display: block; }
.asset-card-body h3 { margin-top: 8px; font-size: 1.1rem; }
.asset-card-body p { margin-top: 6px; color: var(--ink-2); font-size: .93rem; }
@media (max-width: 560px) {
  .asset-card { flex-direction: row; }
  .asset-card .picture { flex: none; width: 104px; aspect-ratio: auto; }
  .asset-card-body { padding: 10px 12px; }
  .asset-card-body h3 { font-size: 1rem; margin-top: 4px; }
  .asset-card-body p { font-size: .88rem; margin-top: 3px; }
}
.asset-grid > img { width: 100%; border-radius: 10px; aspect-ratio: 5 / 3; object-fit: cover; }

/* ---- story page --------------------------------------------------------------- */
.back { display: inline-block; margin: 16px 0 12px; text-decoration: none; font-weight: 700; font-size: .95rem; }
.hero-picture { border-radius: var(--radius); aspect-ratio: 16 / 10; }
.hero-body { padding-top: 16px; }
.hero-body h1 { margin-top: 10px; }
main section[id] { padding-top: 32px; }
main section[id] > h2 { margin-bottom: 14px; }
.summary { font-size: 1.12rem; line-height: 1.6; max-width: 62ch; }
.chapters { list-style: none; padding: 0; margin: 20px 0 0; position: relative; display: grid; gap: 22px; }
.chapters::before { content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.chapter { position: relative; padding-left: 38px; scroll-margin-top: 20px; }
.event-dot { position: absolute; left: 4px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--k, var(--blue)); color: transparent; }
.chapter-year { font-weight: 700; font-variant-numeric: tabular-nums; }
.chapter h3 { margin-top: 4px; font-size: 1.15rem; }
.chapter p { margin-top: 6px; color: var(--ink-2); max-width: 62ch; }
.chapter:target .chapter-body { background: #fdf0d5; border-radius: var(--radius); box-shadow: 0 0 0 10px #fdf0d5; }
.callout { margin-top: 28px; padding: 18px; border-radius: var(--radius); background: #fdf0d5; display: grid; gap: 14px; }
.callout p { margin-top: 4px; font-size: .97rem; }
.poster-link { margin-top: 18px; font-weight: 700; }
.club-cta { margin-top: 28px; padding: 20px; border-radius: var(--radius); background: var(--blue); color: #fff; display: grid; gap: 8px; }
.club-cta a { color: #fff; font-weight: 700; }

/* ---- poster --------------------------------------------------------------- */
.poster-tools { padding: 28px 0 20px; display: grid; gap: 16px; }
.poster-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sheet-wrap { container-type: inline-size; }
.sheet { width: 100%; max-width: 620px; aspect-ratio: 210 / 297; margin: 0 auto; background: #fff; color: var(--ink); box-shadow: 0 10px 40px rgba(0, 0, 0, .18); display: flex; flex-direction: column; overflow: hidden; font-size: calc(min(100cqw, 620px) * .026); }
.sheet-picture { height: 40%; flex: none; }
.sheet-picture .picture { height: 100%; aspect-ratio: auto; border-radius: 0; }
.sheet-body { flex: 1; padding: 5% 8% 0; display: flex; flex-direction: column; min-height: 0; }
.sheet-kicker { font-size: .85em; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); }
.sheet h2 { font-size: 2.4em; margin-top: .2em; line-height: 1.05; }
.sheet-hook { font-size: 1.25em; line-height: 1.35; margin-top: .6em; color: var(--ink-2); }
.sheet-moments { list-style: none; padding: .8em 0 0; margin: 1.2em 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1em; border-top: .15em solid var(--ink); }
.sheet-moments strong { display: block; font-size: 1.2em; line-height: 1.15; }
.sheet-moments span { font-size: .82em; line-height: 1.3; display: block; color: var(--ink-2); }
.sheet-scan { margin-top: auto; margin-bottom: 4%; display: grid; grid-template-columns: 30% 1fr; gap: 6%; align-items: center; background: var(--wash); border-radius: 1em; padding: 4%; }
.qr { background: #fff; padding: 6%; border-radius: .5em; line-height: 0; }
.qr svg { width: 100%; height: auto; display: block; }
.scan-title { font-weight: 700; font-size: 1.5em; line-height: 1.1; }
.sheet-scan p + p { margin-top: .5em; font-size: .95em; line-height: 1.35; color: var(--ink-2); }
.sheet-scan .scan-url { font-size: .72em; color: var(--muted); word-break: break-all; }
.sheet-footer { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 1em; padding: 2.5% 8%; background: var(--blue); color: #fff; font-size: .9em; font-weight: 700; border-top: .35em solid var(--gold); }
.sheet-footer img { width: 12em; height: auto; background: #fff; border-radius: .3em; padding: .3em; }

/* ---- wider screens -------------------------------------------------------- */
@media (min-width: 720px) {
  .tl-foot { grid-template-columns: 1fr auto; align-items: start; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .entry-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; }
  .hero-body { padding-top: 0; }
  .callout { grid-template-columns: 1fr auto; align-items: center; }
  .poster-tools { grid-template-columns: 1fr auto; align-items: end; }
}

/* ---- print: the poster alone, edge to edge on A4 -------------------------- */
@page { size: A4 portrait; margin: 0; }
@media print {
  .preview-banner, .site-header, .site-footer, .poster-tools { display: none !important; }
  body, .poster-page { background: #fff; }
  .poster-page main.wrap { max-width: none; padding: 0; }
  .sheet-wrap { width: 210mm; }
  .sheet { max-width: none; width: 210mm; height: 297mm; box-shadow: none; font-size: 5.46mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
