:root {
  --bg: #14110f;
  --panel: #1f1a16;
  --ink: #ece4d6;
  --muted: #a89c8a;
  --gold: #e3c27f;
  --line: #3a322a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--gold); }

header { max-width: 900px; margin: 0 auto; padding: 40px 20px 12px; text-align: center; }
.kicker { margin: 0; color: var(--gold); letter-spacing: .2em; text-transform: uppercase; font-size: 12px; }
h1 { margin: 6px 0 8px; font: 400 clamp(28px, 4vw, 44px)/1.15 var(--serif); }
.sub { margin: 0 auto; max-width: 640px; color: var(--muted); }

#tools { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 12px 20px; }
#tools:empty { display: none; }
#tools button, .d-nav button, .narrate {
  background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font: inherit; font-size: 14px; cursor: pointer;
}
#tools button:hover, #tools button[aria-pressed="true"], .d-nav button:hover, .narrate:hover { border-color: var(--gold); color: var(--gold); }

main { max-width: 1400px; margin: 0 auto; padding: 0 16px 24px; }
.scroller { overflow-x: auto; border-radius: 6px; box-shadow: 0 20px 60px #000a; }
.stage { position: relative; overflow: hidden; line-height: 0; }
.swipe-hint { display: none; margin: 0 0 8px; text-align: center; color: var(--muted); font-size: 13px; }
.stage img { width: 100%; height: auto; display: block; transition: filter .25s; }
.stage.dim img { filter: brightness(.35) saturate(.5); }

/* One button per face, positioned in % of the photo. When lit, it paints a full-brightness crop of the face. */
.spot {
  position: absolute; padding: 0; border: 0; border-radius: 42%; cursor: pointer;
  background: transparent no-repeat; transition: box-shadow .2s, background-color .2s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.spot.lit { background-image: var(--crop); box-shadow: 0 0 0 2px var(--gold), 0 0 24px 4px #e3c27f66; }
.spot:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.spot[style*="--tint"]::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--tint); mix-blend-mode: color; opacity: .75; pointer-events: none;
}
.spot .label {
  position: absolute; left: 50%; bottom: -4px; transform: translate(-50%, 100%);
  background: #000c; color: var(--ink); font: 600 11px/1.4 var(--sans); padding: 1px 6px; border-radius: 4px;
  white-space: nowrap; pointer-events: none;
}
/* The tapped face is named on the photo, since the preview card now sits below the picture. */
.spot .tap-label {
  position: absolute; left: 50%; bottom: -3px; transform: translate(-50%, 100%);
  background: var(--gold); color: #1a1408; font: 600 11px/1.6 var(--sans); padding: 0 7px; border-radius: 999px;
  white-space: nowrap; pointer-events: none;
}
.spot .tap-label.flip { bottom: auto; top: -3px; transform: translate(-50%, -100%); }

.portrait { background-repeat: no-repeat; border-radius: 6px; flex: none; }

.tip {
  position: fixed; z-index: 10; width: 300px; padding: 12px 14px; pointer-events: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px #000c;
  line-height: 1.45;
}
.tip .row { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.tip .portrait { width: 52px; }
.tip h4 { margin: 0; font: 400 19px/1.2 var(--serif); }
.tip .meta { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.tip .tagline { margin: 0 0 4px; color: var(--gold); font: italic 15px var(--serif); }
.tip p { margin: 0; font-size: 14px; }
.tip .hint { margin-top: 8px; font-size: 12px; color: var(--muted); }
/* Docked (Connections on): compact, so it stays in the faceless top corner of the photo */
.tip.docked { width: 270px; padding: 10px 12px; background: #1f1a16ee; }
.tip.docked .portrait { width: 40px; }
.tip.docked h4 { font-size: 17px; }
.tip.docked p { font-size: 13px; }
.tip.docked .tagline { font-size: 14px; }
.tip.docked .hint { display: none; }
/* Phones: no popup over the picture. The card sits in the page flow under the photo (it is in the DOM there),
   so no face is ever covered. The tapped face is named on the photo and the card opens the full story. */
.tip.peek {
  position: static; width: auto; max-width: 460px; margin: 12px auto 0; padding: 12px 14px;
  background: var(--panel); pointer-events: auto;
}
.tip.peek .hint { display: none; }
.tip-go {
  margin-top: 8px; width: 100%; background: var(--gold); color: #1a1408; border: 0; border-radius: 999px;
  padding: 8px; font: 600 14px var(--sans); cursor: pointer;
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.chip { font-size: 11px; font-weight: 600; letter-spacing: .03em; color: #1a1408; background: var(--gold); border-radius: 999px; padding: 1px 8px; }

dialog {
  width: min(760px, 94vw); max-height: 90vh; padding: 0; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 30px 80px #000;
}
/* iOS Safari: vh measures the tall viewport, so a 90vh dialog puts its top under the URL bar. dvh measures what is visible. */
@supports (height: 1dvh) {
  dialog { max-height: 90dvh; }
}
dialog::backdrop { background: #000b; }
.close { position: absolute; top: max(8px, env(safe-area-inset-top)); right: 12px; background: none; border: 0; color: var(--muted); font-size: 28px; line-height: 1; padding: 6px 10px; cursor: pointer; }
.d-head { display: flex; gap: 20px; padding: 28px 28px 8px; align-items: flex-start; }
.d-head .portrait { width: 120px; }
.d-head h2 { margin: 0; font: 400 30px/1.15 var(--serif); }
.d-head .meta { margin: 4px 0; color: var(--muted); font-size: 14px; }
.d-head .tagline { margin: 4px 0; color: var(--gold); font: italic 18px var(--serif); }
.narrate { margin-top: 6px; }
.d-body { padding: 4px 28px 8px; }
.d-body h3 { margin: 22px 0 6px; font: 600 12px var(--sans); letter-spacing: .15em; text-transform: uppercase; color: var(--gold); }
.story p { font: 17px/1.7 var(--serif); margin: 12px 0; transition: color .2s; }
.story p.speaking, .legacy p.speaking { color: var(--gold); }
.d-body ul { margin: 0; padding-left: 20px; }
.d-body li { margin: 3px 0; }
.legacy p { font: 17px/1.7 var(--serif); margin: 0; }
.d-nav { display: flex; justify-content: space-between; padding: 16px 28px 24px; border-top: 1px solid var(--line); margin-top: 16px; }

footer { max-width: 900px; margin: 0 auto; padding: 8px 20px 40px; text-align: center; color: var(--muted); font-size: 13px; }

@media (max-width: 600px) {
  .d-head { flex-direction: column; padding: 24px 20px 4px; }
  .d-body, .d-nav { padding-left: 20px; padding-right: 20px; }
}
/* Phones: a long story scrolls inside the dialog, so the close button, the portrait and prev/next stay put. */
@media (max-width: 700px) {
  dialog { display: flex; flex-direction: column; max-height: 92vh; }
  @supports (height: 1dvh) { dialog { max-height: 92dvh; } } /* keep clear of the URL bar */
  .d-head, .d-nav { flex: none; }
  .d-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .d-nav { padding-bottom: calc(20px + env(safe-area-inset-bottom)); } /* home indicator */
}
@media (max-width: 900px) {
  .spot .label { font-size: 9px; padding: 0 3px; }
}

/* Phones: keep faces at a tappable size (~32px wide) and let the photo scroll sideways. */
@media (max-width: 700px) {
  .stage { min-width: 640px; }
  /* A face box is only ~26px wide here. Widen the hit area sideways only: neighbouring rows overlap vertically. */
  .spot::before { content: ""; position: absolute; inset: 0 -6px; }
  .swipe-hint { display: block; }
  header { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
