/* History page: slide projector + freight train timeline */

/* ---------- slide projector ---------- */
.proj { margin: 0; display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.proj__screen { position: relative; aspect-ratio: 4 / 3; background: #141011; overflow: hidden; box-shadow: inset 0 0 0 2px var(--ink); }
.proj__screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,.5) 100%); }
.proj__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transform: translateX(-7%); filter: blur(2px); transition: opacity .2s ease, transform .22s cubic-bezier(.3,.7,.2,1), filter .22s; }
.proj__img.is-cur { opacity: 1; transform: none; filter: none; animation: proj-flicker 7s infinite steps(1); }
.proj__img.is-out { opacity: 0; transform: translateX(7%); filter: blur(2px); transition-duration: .16s; }
.proj__flash { position: absolute; inset: 0; background: #fffbe8; opacity: 0; pointer-events: none; }
.proj__flash.is-on { animation: proj-flash .3s ease-out; }
.proj__count { position: absolute; left: 10px; top: 8px; z-index: 2; color: var(--sign-pink); background: rgba(20,16,17,.7); padding: 3px 7px; text-transform: uppercase; }
.proj__bar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.proj__btn { width: 44px; height: 44px; border: 0; background: var(--ink); color: var(--ground); font: 800 22px/1 var(--font-display); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.proj__btn:hover { background: var(--oxblood); }
.proj__btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.proj__tray { display: flex; gap: 4px; flex-wrap: wrap; margin-left: var(--space-2); }
.proj__dot { width: 14px; height: 14px; padding: 0; border: 0; background: var(--line); cursor: pointer; }
.proj__dot[aria-current="true"] { background: var(--heart-red); }
.proj__cap { color: var(--ink-muted); min-height: 54px; }
.proj__cap b { color: var(--ink); }
.proj__cap a { white-space: nowrap; }
@keyframes proj-flash { 0% { opacity: .55; } 100% { opacity: 0; } }
@keyframes proj-flicker { 0%, 100% { opacity: 1; } 31% { opacity: .96; } 32% { opacity: 1; } 67% { opacity: .97; } 68% { opacity: 1; } }

/* ---------- freight train timeline ---------- */
/* The train is a lit scene: it keeps its daylight colors after sunset so the cars, rails and plates stay readable. */
.tl { margin: var(--space-6) 0 var(--space-8); padding: var(--space-4) 0; --ground: #f3ebdd; --ground-raised: #fbf6ee; --ink: #231f20; --ink-muted: #5a514c; --line: #d2c4b0; --heart-red: #cc1229; --focus: #232f80; background: var(--ground); color: var(--ink); }
.tl__intro { max-width: 1200px; margin: 0 auto; box-sizing: border-box; padding: 0 clamp(16px, 4vw, 48px); display: flex; flex-direction: column; gap: var(--space-2); }
.tl__hint { color: var(--ink-muted); margin: 0; }
.tl__stage { position: relative; }
.tl__track { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: var(--space-6) var(--space-4); padding: var(--space-6) clamp(16px, 4vw, 48px); max-width: 1200px; margin: 0 auto; box-sizing: border-box; }
.tl__sky, .tl__poles, .tl__rails, .tl__meter, .tl__engine, .tl__coupler { display: none; }

/* a car (works stacked or rolling) */
.car { position: relative; display: flex; flex-direction: column; min-width: 0; }
.car__body { position: relative; flex: 1; display: flex; flex-direction: column; padding: 12px 12px 22px; background-color: var(--oxblood); background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.07) 0 2px, transparent 2px 24px); border-top: 7px solid rgba(0,0,0,.35); box-sizing: border-box; }
.car--ink .car__body { background-color: #231f20; }
.car--red .car__body { background-color: #a40f22; }
.car--pink .car__body { background-color: #e9a0ae; }
.car__marks { position: absolute; left: 12px; bottom: 4px; font: 500 10px/14px var(--font-mono); letter-spacing: .12em; color: rgba(255,255,255,.75); text-transform: uppercase; }
.car--pink .car__marks { color: rgba(35,31,32,.7); }
.car__plate { flex: 1; background: var(--ground-raised); color: #231f20; padding: 14px 16px 16px; box-shadow: inset 0 0 0 1px rgba(35,31,32,.15); display: flex; flex-direction: column; gap: 6px; }
.car__year { margin: 0; font: 900 44px/0.9 var(--font-display); color: var(--heart-red); }
.car__title { margin: 0; font: 800 24px/1 var(--font-display); text-transform: uppercase; letter-spacing: .01em; }
.car__text { margin: 0; font: 400 15px/21px var(--font-text); }
.car__photo { margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px; }
.car__photo img { display: block; width: 100%; height: auto; max-height: 190px; object-fit: cover; background: #ddd; }
.car__photo figcaption { font: 500 12px/16px var(--font-text); color: #5a514c; }
.car__trucks { display: flex; justify-content: space-between; padding: 0 14px; height: 30px; margin-top: -2px; }
.car__trucks span { display: flex; gap: 4px; }
.wheel { width: 28px; height: 28px; border-radius: 50%; background: repeating-conic-gradient(#231f20 0 18deg, #5a514c 18deg 30deg); box-shadow: inset 0 0 0 4px #231f20; transform: rotate(var(--spin, 0deg)); }
.car--wide { grid-column: span 2; }
@media (max-width: 680px) { .car--wide { grid-column: auto; } }

/* Bill Cole's hole: a depth gauge on the car */
.dig { display: grid; grid-template-columns: 1fr 74px; gap: 14px; flex: 1; }
.dig__gauge { position: relative; background: #3b2a22; box-shadow: inset 0 0 0 2px #231f20; overflow: hidden; min-height: 200px; }
.dig__dirt { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, #6b4b36 0 6px, #5b3e2c 6px 12px); }
.dig__hole { position: absolute; left: 22%; right: 22%; top: 0; height: var(--depth, 100%); background: #120c0a; transition: height 2.4s cubic-bezier(.3,.6,.3,1); }
.dig__ticks { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 4px 4px; font: 500 10px/12px var(--font-mono); color: #f3ebdd; text-align: right; pointer-events: none; }
.dig__ft { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font: 900 20px/1 var(--font-display); color: var(--sign-pink); }

/* caboose */
.car--caboose .car__body { background-color: #cc1229; border-top-color: #8e0c1c; }
.car--caboose .car__cupola { position: absolute; left: 50%; top: -42px; width: 86px; height: 36px; transform: translateX(-50%); background: #cc1229; border-top: 6px solid #8e0c1c; display: flex; gap: 8px; justify-content: center; align-items: center; }
.car--caboose .car__cupola i { width: 18px; height: 14px; background: #ffd27a; display: block; }
.car__lamp { position: absolute; right: -8px; top: 30px; width: 12px; height: 12px; border-radius: 50%; background: #ff3b3b; box-shadow: 0 0 10px 4px rgba(255,59,59,.6); }

/* ---------- rolling mode (set by script, not for reduced motion) ---------- */
.tl--rolling .tl__scroll { position: relative; }
.tl--rolling .tl__stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; background: linear-gradient(180deg, var(--ground) 0%, var(--ground) 58%, #eadcc6 100%); }
.tl--rolling .tl__sky { display: block; position: absolute; left: 0; right: 0; bottom: 120px; height: 46%; pointer-events: none; }
.tl--rolling .tl__sky svg { position: absolute; bottom: 0; left: 0; height: 100%; width: 300%; }
.tl--rolling .tl__poles { display: block; position: absolute; left: 0; right: 0; bottom: 62px; height: 62%; pointer-events: none; opacity: .5; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='400' viewBox='0 0 520 400'%3E%3Cg fill='%23231f20'%3E%3Crect x='258' y='10' width='5' height='390'/%3E%3Crect x='236' y='26' width='50' height='4'/%3E%3Crect x='242' y='46' width='38' height='3'/%3E%3C/g%3E%3Cpath d='M0 40 Q130 70 260 28 Q390 70 520 40' stroke='%23231f20' stroke-width='1.2' fill='none'/%3E%3C/svg%3E"); background-repeat: repeat-x; background-size: auto 100%; background-position: 0 bottom; }
.tl--rolling .tl__meter { display: flex; position: absolute; top: 64px; left: clamp(16px, 4vw, 48px); z-index: 3; align-items: center; gap: 10px; background: var(--ink); color: var(--ground); padding: 6px 12px; }
.tl--rolling .tl__meter b { font: 900 28px/1 var(--font-display); color: var(--sign-pink); min-width: 3.4em; }
.tl--rolling .tl__meter .tl__bar { width: clamp(80px, 18vw, 220px); height: 4px; background: rgba(243,235,221,.25); position: relative; }
.tl--rolling .tl__meter .tl__bar i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--p, 0%); background: var(--sign-pink); }
.tl--rolling .tl__track { display: flex; align-items: flex-end; gap: 0; padding: 0 0 0 clamp(16px, 6vw, 80px); max-width: none; margin: 0; width: max-content; will-change: transform; position: relative; z-index: 2; }
.tl--rolling .car { width: min(80vw, 330px); flex: none; }
.tl--rolling .car__body { flex: none; height: var(--car-h, auto); }
.tl--rolling .car--wide { width: min(92vw, 560px); }
.tl--rolling .car__plate { flex: 0 0 auto; }
.tl--rolling .dig { flex: 1; }
.tl--rolling .dig > .car__plate { flex: 1; }
.tl--rolling .car__body::after { content: ""; position: absolute; left: 50%; bottom: 22px; width: 38%; height: 30%; max-height: 120px; transform: translateX(-50%); box-shadow: inset 0 0 0 3px rgba(0,0,0,.28); background: repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 14px); z-index: 0; pointer-events: none; }
.tl--rolling .car__plate, .tl--rolling .dig { position: relative; z-index: 1; }
.tl--rolling .car--caboose .car__body::after { width: 30%; }
.tl--rolling .tl__coupler { display: block; flex: none; width: 18px; height: 8px; background: #231f20; margin-bottom: 36px; }
.tl--rolling .tl__engine { display: block; flex: none; width: 360px; position: relative; margin-bottom: 0; }
.tl--rolling .tl__rails { display: block; position: relative; height: 34px; flex: none; margin-top: -6px; background: linear-gradient(180deg, transparent 0 6px, #8a7b6a 6px 9px, transparent 9px 100%), linear-gradient(180deg, transparent 0 4px, #231f20 4px 7px, transparent 7px 100%); }
.tl--rolling .tl__rails::before { content: ""; position: absolute; left: 0; right: 0; top: 2px; height: 14px; background-image: repeating-linear-gradient(90deg, #5a3e2b 0 14px, transparent 14px 40px); background-position-x: var(--ties, 0px); }
.tl--rolling .tl__rails::after { content: ""; position: absolute; left: 0; right: 0; top: 16px; bottom: 0; background: repeating-radial-gradient(circle at 3px 3px, #b9a88f 0 1.5px, transparent 2px 7px), #d9c9ae; }
.tl--rolling .tl__stage > .tl__track { margin-bottom: 0; }
.tl--rolling .car__trucks { height: 30px; }

/* engine pieces */
.loco { display: block; width: 100%; height: auto; overflow: visible; }
.loco .drv { transform-box: fill-box; transform-origin: center; transform: rotate(var(--spin, 0deg)); }
.smoke { position: absolute; left: 70px; top: -10px; width: 60px; height: 60px; pointer-events: none; }
.smoke i { position: absolute; left: 10px; bottom: 0; width: 26px; height: 26px; border-radius: 50%; background: rgba(90,81,76,.45); opacity: 0; }
.tl.is-moving .smoke i { animation: puff 1.1s ease-out infinite; }
.tl.is-moving .smoke i:nth-child(2) { animation-delay: .37s; }
.tl.is-moving .smoke i:nth-child(3) { animation-delay: .74s; }
@keyframes puff { 0% { transform: translate(0, 0) scale(.5); opacity: .8; } 100% { transform: translate(40px, -90px) scale(2.4); opacity: 0; } }

/* short screens: tighter cars */
@media (max-height: 760px) {
  .tl--rolling .car__text { font-size: 14px; line-height: 19px; }
  .tl--rolling .car__year { font-size: 36px; }
  .tl--rolling .car__title { font-size: 21px; }
  .tl--rolling .car__photo img { max-height: 130px; }
  .tl--rolling .tl__meter { top: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  .proj__img, .proj__img.is-cur, .proj__img.is-out { transition: opacity .2s; transform: none; filter: none; animation: none; }
  .proj__flash.is-on { animation: none; }
  .dig__hole { transition: none; }
}

/* Around town list */
.around { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); column-gap: var(--space-8); }
