/* The photo pages: /events and /events/<slug> (lib/event-page.php). These pages do not load css/site.css.
   The tokens and fonts are copies of the ones in css/site.css. Keep them the same.
   On an event page, --bg changes with the time of day (js/events.js). */

:root {
  --paper: #EEE7D7;
  --ink: #1D2419;
  --hay: #E7C58A;
  --clay: #8A5A2B;
  --ticket: #F4EFE3;
  --map-bg: #1A2016;

  --display: 'Instrument Serif', serif;
  --text: 'Newsreader', Georgia, serif;
  --mono: 'IBM Plex Mono', monospace;

  --pad: clamp(20px, 6vw, 96px);

  --bg: #EEE7D7;
  --fg: #1D2419;
  --fg-soft: rgba(29, 36, 25, .62);
  --line: rgba(29, 36, 25, .16);
  --accent: #8A5A2B;
}

html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: color .6s;
}
/* After sundown the text turns light. proto.js sets the class from the brightness of --bg. */
/* In the late-afternoon colors the accent goes darker, so it keeps its contrast. */
body.is-warm { --accent: #4A2A0E; --fg-soft: rgba(29, 36, 25, .74); }
body.is-dark {
  --fg: #EEE7D7;
  --fg-soft: rgba(238, 231, 215, .66);
  --line: rgba(238, 231, 215, .18);
  --accent: #E7C58A;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; }
p { margin: 0; }

/* The preview bar of a page that is not published. */
.flag {
  position: absolute; left: 50%; top: 76px; z-index: 6; translate: -50% 0; white-space: nowrap;
  padding: 8px 13px; border-radius: 999px;
  background: var(--ink); color: var(--hay);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}

/* ---------- Top and cover ---------- */

.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 22px var(--pad);
  color: var(--paper);
}
.top a { text-decoration: none; }
.top a:hover { color: var(--hay); }
.top__brand { font-family: var(--display); font-size: 26px; }
.top__nav { display: flex; gap: 22px; }

.cover {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: grid; align-items: end;
  color: var(--paper); background: var(--map-bg);
  overflow: hidden;
}
.cover__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.motion .cover__img { animation: kb 14s cubic-bezier(.22, .61, .25, 1) both; }
@keyframes kb { from { transform: scale(1.12); } to { transform: scale(1.01); } }
.cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(26, 32, 22, .55) 0%, rgba(26, 32, 22, .08) 24%, rgba(26, 32, 22, .32) 50%, rgba(26, 32, 22, .92) 100%);
}
/* The shadow keeps the text readable on a bright cover photo. */
.cover__in { position: relative; z-index: 1; padding: 120px var(--pad) clamp(36px, 7vh, 80px); text-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 24px rgba(0, 0, 0, .4); }
.cover__kick { color: var(--hay); }
.cover h1 {
  margin: 18px 0 22px; max-width: 12ch;
  font-family: var(--display); font-weight: 400;
  font-size: clamp(54px, 9.5vw, 156px); line-height: .9; letter-spacing: -.01em;
}
.cover h1 em { color: var(--hay); }
.cover__lede { max-width: 40ch; margin-bottom: 34px; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.45; opacity: .92; }
.stats {
  display: flex; flex-wrap: wrap; gap: 16px clamp(28px, 4vw, 56px);
  margin: 0; padding-top: 22px;
  border-top: 1px solid rgba(238, 231, 215, .25);
}
.stats div { display: flex; flex-direction: column; gap: 6px; }
.stats dt { order: 2; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; opacity: .72; }
.stats dd { margin: 0; font-family: var(--display); font-size: clamp(36px, 4.2vw, 60px); line-height: 1; }
.cue { display: inline-flex; gap: 10px; margin-top: 34px; color: var(--hay); text-decoration: none; }
.motion .cue span { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(5px); } }

/* ---------- The day: a sticky rail and the chapters ---------- */

.day {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: clamp(28px, 4.5vw, 80px);
  padding: 0 var(--pad);
}
.rail {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  box-sizing: border-box;
  display: flex; flex-direction: column; gap: 16px;
  padding: 30px 0 26px;
}
.clock { display: flex; align-items: baseline; gap: 10px; margin: 0; }
.clock__t {
  font-family: var(--display); font-size: clamp(66px, 6vw, 96px); line-height: .85;
  font-variant-numeric: tabular-nums;
}
.clock__ap { font-size: 13px; }
.clock__ch { margin-top: 10px; color: var(--accent); min-height: 1.3em; transition: color .6s; }

.sky { display: block; width: 100%; height: auto; overflow: visible; }
.sky__arc { fill: none; stroke: var(--fg-soft); stroke-width: 1; stroke-dasharray: 2 4; opacity: .7; }
.sky__sun { fill: #E7A94A; }
.sky__glow { fill: #E7C58A; opacity: .35; }
.sky__hills { fill: var(--bg); }
.sky__ridge { fill: none; stroke: var(--fg); stroke-width: 1.2; stroke-linejoin: round; }
.sky__ticks text { fill: var(--fg-soft); font-size: 8.5px; letter-spacing: .08em; }
.sky__ticks line { stroke: var(--fg-soft); stroke-width: 1; }
.sky__star { fill: #EEE7D7; }

.rail__map { position: relative; padding: 10px; border-radius: 3px; background: var(--map-bg); align-self: flex-start; }
.rail__map canvas { display: block; }
.rail__n { position: absolute; top: 16px; right: 16px; color: rgba(238, 231, 215, .6); font-size: 10px; }
.rail__key { margin-top: 8px; color: rgba(238, 231, 215, .7); font-size: 9.5px; letter-spacing: .1em; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sw { display: inline-block; width: 10px; height: 10px; border: 1.5px solid; }
.sw--ag { border-color: rgb(108, 196, 154); background: repeating-linear-gradient(135deg, rgba(108, 196, 154, .75) 0 1.5px, transparent 1.5px 4px); }
.sw--cons { border-color: rgb(185, 138, 214); background: repeating-linear-gradient(45deg, rgba(185, 138, 214, .75) 0 1.5px, transparent 1.5px 4px); margin-left: 6px; }

.toc { list-style: none; margin: 0; padding: 0; display: grid; overflow: auto; min-height: 0; }
.toc a {
  display: grid; grid-template-columns: 62px 1fr; gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-soft); text-decoration: none;
  transition: color .3s;
}
.toc a:hover, .toc a.is-on { color: var(--fg); }
.toc a.is-on span:first-child { color: var(--accent); }
.rail__bar { display: none; }

.chapters { min-width: 0; padding-top: 14vh; }
.ch { padding-bottom: 24vh; scroll-margin-top: 20px; }
.ch__head { max-width: 680px; margin-bottom: clamp(40px, 7vh, 72px); }
.ch__kick { display: flex; gap: 14px; align-items: baseline; color: var(--fg-soft); }
.ch__kick b { font-weight: 500; color: var(--accent); transition: color .6s; }
.ch h2, .end h2 {
  margin: 14px 0 20px;
  font-family: var(--display); font-weight: 400;
  font-size: clamp(46px, 6vw, 96px); line-height: .94; letter-spacing: -.005em;
}
.ch h2 em, .end h2 em { color: var(--accent); transition: color .6s; }
.ch__text, .end__head > p:last-child { max-width: 46ch; font-size: clamp(18px, 1.45vw, 21px); line-height: 1.5; }

/* The ticket stub in the check-in chapter, like the ticket on the home page. */
.stub {
  display: inline-grid; grid-template-columns: auto auto; gap: 4px 22px;
  margin-top: 26px; padding: 14px 18px 14px 22px;
  background: var(--ticket); color: var(--ink);
  border-left: 2px dashed rgba(29, 36, 25, .35);
  box-shadow: 0 14px 30px -16px rgba(0, 0, 0, .5);
  transform: rotate(-2.5deg);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
}
.stub b { grid-column: 1 / -1; font-family: var(--display); font-size: 30px; font-weight: 400; letter-spacing: 0; text-transform: none; }

/* ---------- Photos as prints ---------- */

.spread {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(16px, 2.2vw, 36px);
  row-gap: clamp(30px, 6vh, 64px);
  align-items: start;
}
.f { margin: 0; position: relative; }
.f--full { grid-column: 1 / -1; }
.f--a { grid-column: 1 / span 7; }
.f--b { grid-column: 8 / span 5; margin-top: clamp(40px, 14vh, 160px); }
.f--c { grid-column: 2 / span 6; }
.f--d { grid-column: 8 / span 5; margin-top: clamp(24px, 7vh, 90px); }
.f--pa { grid-column: 2 / span 4; }
.f--pb { grid-column: 9 / span 4; margin-top: clamp(40px, 12vh, 140px); }
.f--pc { grid-column: 1 / span 4; }
.f--pd { grid-column: 7 / span 4; margin-top: clamp(24px, 7vh, 90px); }

.f__btn {
  display: block; width: 100%; padding: clamp(6px, .65vw, 10px); border: 0;
  background: var(--ticket); cursor: zoom-in;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 22px 44px -22px rgba(0, 0, 0, .55);
  transform: rotate(var(--r, 0deg));
  transition: transform .6s cubic-bezier(.2, .7, .2, 1), box-shadow .6s;
}
.f__btn:hover, .f__btn:focus-visible { transform: rotate(0deg) translateY(-6px); box-shadow: 0 2px 4px rgba(0, 0, 0, .14), 0 34px 60px -26px rgba(0, 0, 0, .6); }
.f__btn img { display: block; width: 100%; height: auto; background: #CFC6B2; }
.f figcaption {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  margin-top: 12px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-soft);
}
.f figcaption b { font-weight: 500; color: var(--fg); }
.f figcaption .wp { color: var(--accent); }

/* The group photo: one large print with tape at the corners. */
.f--frame .f__btn { padding: clamp(12px, 1.4vw, 22px); transform: rotate(-.6deg); }
.f--frame .f__btn::before, .f--frame .f__btn::after {
  content: ''; position: absolute; top: -12px; width: 92px; height: 26px;
  background: rgba(231, 197, 138, .62);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.f--frame .f__btn::before { left: 8%; transform: rotate(-5deg); }
.f--frame .f__btn::after { right: 8%; transform: rotate(4deg); }
.f--frame figcaption { justify-content: center; text-align: center; }
/* A tall group photo gets a narrower frame, so it fits on the screen. */
.f--frame.is-tall { grid-column: 4 / span 6; }
.f__slot { flex-basis: 100%; margin-top: 4px; font-family: var(--text); font-size: 17px; font-style: italic; letter-spacing: 0; text-transform: none; color: var(--fg); }

/* The route map inside a chapter. It shows only when the rail map is hidden (narrow screens). */
.ch__map { display: none; }

/* Reveal: a print drops onto the table. */
.motion .f { opacity: 0; transform: translateY(46px) rotate(calc(var(--r, 0deg) * 2.5)); transition: opacity 1s cubic-bezier(.2, .7, .2, 1), transform 1.1s cubic-bezier(.2, .7, .2, 1); }
.motion .f.is-in { opacity: 1; transform: none; }
.motion .ch__head { opacity: 0; transform: translateY(26px); transition: opacity .9s, transform .9s cubic-bezier(.2, .7, .2, 1); }
.motion .ch__head.is-in { opacity: 1; transform: none; }

/* ---------- The end ---------- */

.end { padding: 6vh var(--pad) 12vh; }
.end__head { max-width: 820px; margin-bottom: 9vh; }
.end__label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); color: var(--fg-soft); }
.sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(28%, 120px), 1fr)); gap: 8px; margin-bottom: 9vh; }
.sheet button { display: block; padding: 0; border: 0; aspect-ratio: 1; overflow: hidden; cursor: zoom-in; background: #2A3024; }
.sheet img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1), opacity .3s; opacity: .88; }
.sheet button:hover img, .sheet button:focus-visible img { transform: scale(1.07); opacity: 1; }
.end__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: clamp(28px, 4vw, 64px); margin-bottom: 9vh; }
.send { padding: clamp(24px, 3vw, 40px); border: 1px solid var(--line); }
.send__t { margin: 6px 0 14px; font-family: var(--display); font-size: clamp(36px, 3.6vw, 54px); line-height: 1; }
.send__t em { color: var(--accent); }
.send p:not(.mono):not(.send__t) { font-size: 18px; line-height: 1.5; max-width: 40ch; }
.btn {
  display: inline-flex; gap: 14px; margin-top: 22px; padding: 16px 22px;
  background: var(--hay); color: var(--ink); text-decoration: none;
  font-size: 12px; font-weight: 500;
}
.btn:hover { background: var(--paper); }
.credits__names { font-size: 20px; line-height: 1.5; }
.credits__note { margin-top: 16px; font-size: 15px; line-height: 1.5; color: var(--fg-soft); }
.end__nav { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.end__nav a { text-decoration: none; color: var(--fg-soft); }
.end__nav a:hover { color: var(--hay); }

/* ---------- Photo viewer ---------- */

.lb {
  position: fixed; inset: 0; z-index: 60;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: rgba(14, 17, 12, .97); color: var(--paper);
}
.lb__bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; color: rgba(238, 231, 215, .7); }
.lb__close { background: none; border: 0; color: var(--paper); cursor: pointer; padding: 8px; }
.lb__close:hover { color: var(--hay); }
.lb__stage { position: relative; min-height: 0; touch-action: pan-y; }
/* Absolute, so the size limits resolve against the stage height. */
.lb__img { position: absolute; inset: 0; margin: auto; max-width: calc(100% - 152px); max-height: calc(100% - 8px); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); transition: opacity .25s, transform .35s cubic-bezier(.2, .7, .2, 1); }
.lb__img.is-swap { opacity: 0; transform: scale(.985); }
.lb__nav {
  position: absolute; top: 50%; translate: 0 -50%;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(238, 231, 215, .3); background: rgba(26, 32, 22, .6);
  color: var(--paper); font-size: 20px; cursor: pointer;
}
.lb__nav:hover { border-color: var(--hay); color: var(--hay); }
.lb__prev { left: 12px; }
.lb__next { right: 12px; }
.lb__cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 22px; padding: 16px 20px 24px; }
.lb__ch { font-family: var(--display); font-size: 28px; line-height: 1; }
.lb__meta { color: rgba(238, 231, 215, .7); font-size: 11px; }

/* ---------- Narrow screens: the rail becomes a bar at the top ---------- */

@media (max-width: 899px) {
  .day { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 20px; }
  .rail {
    z-index: 6; height: auto;
    flex-direction: row; align-items: center; gap: 14px;
    margin: 0 -20px; padding: 10px 20px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .rail__clock { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1; }
  .clock__t { font-size: 40px; }
  .clock__ap { font-size: 11px; }
  .clock__ch { margin: 0; font-size: 10px; letter-spacing: .12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sky { width: 104px; flex: none; }
  .sky__ticks { display: none; }
  .rail__map, .toc { display: none; }
  .rail__bar { display: block; position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--accent); }
  .chapters { padding-top: 8vh; }
  .ch { padding-bottom: 14vh; scroll-margin-top: 70px; }
  .spread { grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 34px; }
  .f--full, .f--a, .f--c { grid-column: 1 / -1; }
  .f--b, .f--d { grid-column: 2 / -1; margin-top: 0; }
  .f--pa, .f--pc { grid-column: 1 / span 5; }
  .f--pb, .f--pd { grid-column: 2 / -1; margin-top: 0; }
  .f--frame.is-tall { grid-column: 1 / -1; }
  .ch__map { display: block; margin: 0 0 40px; padding: 10px; background: var(--map-bg); }
  .ch__map canvas { display: block; width: 100%; aspect-ratio: 1108 / 1090; }
  .ch__map p { margin-top: 8px; color: rgba(238, 231, 215, .7); font-size: 10px; }
  .lb__img { max-width: 100%; max-height: calc(100% - 70px); }
  .flag { top: 64px; font-size: 9.5px; }
  .lb__nav { top: auto; bottom: 8px; translate: 0 0; width: 46px; height: 46px; }
  .stub { transform: rotate(-1.5deg); }
}


/* ---------- Additions for the live pages ---------- */

.flag a { color: var(--paper); }
.flag a:hover { color: var(--hay); }
.ev-empty { margin: 0; padding: 12vh var(--pad); font-size: 22px; font-style: italic; color: var(--fg-soft); }
.end__text { max-width: 46ch; margin-top: 14px; font-size: clamp(18px, 1.45vw, 21px); line-height: 1.5; }
.ch__text + .ch__text { margin-top: 14px; }
.cover__lede + .cover__lede { margin-top: -18px; }
.lb__caption { flex-basis: 100%; font-style: italic; font-size: 17px; color: rgba(238, 231, 215, .85); }
.lb__caption:empty { display: none; }

/* ---------- /events: one row for each year, newest first ---------- */

.ev-index { background: var(--map-bg); color: var(--paper); --bg: #1A2016; --fg: #EEE7D7; --fg-soft: rgba(238, 231, 215, .66); --line: rgba(238, 231, 215, .18); --accent: #E7C58A; }
.ev { position: relative; padding: 150px var(--pad) 10vh; }
.ev h1 { margin: 16px 0 10vh; font-family: var(--display); font-weight: 400; font-size: clamp(56px, 9vw, 150px); line-height: .9; }
.ev h1 em { color: var(--hay); }
.ev__kick { color: var(--hay); }
.year { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); gap: clamp(20px, 4vw, 64px); padding: 34px 0 60px; border-top: 1px solid var(--line); align-items: start; }
.year__n { font-family: var(--display); font-size: clamp(80px, 13vw, 210px); line-height: .8; color: var(--hay); }
.card { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(18px, 2.4vw, 36px); align-items: end; color: inherit; text-decoration: none; }
.card__img { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: #2A3024; }
.card__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(.2, .7, .2, 1); }
.card:hover .card__img img { transform: scale(1.05); }
.card__draft { margin-bottom: 10px; color: var(--hay); }
.card__date { color: var(--fg-soft); }
.card__t { margin: 12px 0 14px; font-family: var(--display); font-size: clamp(34px, 3.4vw, 54px); line-height: .98; }
.card__t em { color: var(--hay); }
.card__meta { color: var(--fg-soft); line-height: 1.9; }
.card__go { display: inline-flex; gap: 12px; margin-top: 22px; color: var(--hay); }
.card:hover .card__go { color: var(--paper); }
.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.strip img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; opacity: .85; }
@media (max-width: 899px) {
  .year { grid-template-columns: minmax(0, 1fr); padding-bottom: 44px; }
  .card { grid-template-columns: minmax(0, 1fr); }
}
