/* ==========================================================
   JOEL — Vital Signs
   Dark, pinned scenes. A field of points draws a picture for each
   one, a monitor strip keeps the pulse, and the words arrive like
   a poem being read aloud.
   Fonts: Spectral + IBM Plex Mono (SIL OFL), self-hosted.
   ========================================================== */

@font-face { font-family: "Spectral"; src: url("fonts/spectral-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("fonts/spectral-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("fonts/spectral-400i.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Spectral"; src: url("fonts/spectral-300i.woff2") format("woff2"); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("fonts/ibmplexmono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("fonts/ibmplexmono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gut: clamp(20px, 5vw, 72px);
  --bg: #0F1013;
  --text: #EFEAE2;
  --text-2: #B3ADA4;
  --faint: #7C7770;
  --rule: rgba(239, 234, 226, .14);
  --pulse: #E2574C;
  --accent: #E2574C;          /* each scene sets its own */
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, p, dl, dd, blockquote, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
em { font-style: italic; color: var(--accent); }
::selection { background: var(--pulse); color: #fff; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; border-radius: 4px; }
main:focus { outline: none; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 60; padding: 10px 14px; background: var(--text); color: var(--bg); border-radius: 8px; font: 500 14px var(--mono); text-decoration: none; }
.skip:focus { top: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.mono b { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }

#field { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; display: none; }
html.pin #field { display: block; }

/* ---------- header ---------- */
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px var(--gut); }
html:not(.pin) .top { background: var(--bg); border-bottom: 1px solid var(--rule); }
.brand { font: italic 400 24px/1 var(--serif); text-decoration: none; }
.top-r { display: flex; align-items: center; gap: 16px; }
.hr { display: flex; align-items: center; gap: 8px; font: 500 12.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hr b { display: inline-block; min-width: 3ch; text-align: right; font-weight: 500; color: var(--text); }
.beat { width: 8px; height: 8px; border-radius: 50%; background: var(--pulse); animation: beat var(--beat, .83s) ease-out infinite; }
@keyframes beat { 0% { transform: scale(1.6); } 30% { transform: scale(.9); } 100% { transform: scale(.9); } }
html.rm .beat { animation: none; }
html:not(.pin) .hr { display: none; }
.say { font: 500 13px var(--mono); letter-spacing: .08em; text-transform: uppercase; text-decoration: none; padding: 11px 16px; border: 1px solid var(--rule); border-radius: 999px; }
.say:hover { border-color: var(--text-2); }
.count { position: fixed; right: var(--gut); top: 50%; z-index: 40; transform: rotate(90deg) translateX(50%); transform-origin: right center; font-size: 11.5px; color: var(--faint); display: none; }
html.pin .count { display: block; }
@media (max-width: 760px) { .say { display: none; } .count { display: none !important; } }
@media (max-width: 760px) { html.pin .cue { display: none; } }

/* ---------- scenes: simple stacked version first (no motion / short screens / no JS) ---------- */
.scene { position: relative; z-index: 1; padding: 96px 0 40px; border-bottom: 1px solid var(--rule); }
.scene:first-child { padding-top: 130px; }
.layer { padding: 0 var(--gut); }
.text { width: 100%; max-width: 760px; }
.pin-only { display: none; }
html.pin .pin-only { display: block; }
.static-ecg { display: block; width: 100%; height: 70px; margin: 18px 0 26px; color: var(--pulse); }
html.pin .static-ecg { display: none; }
.portrait { display: block; width: min(240px, 60vw); height: auto; margin: 6px 0 24px; border-radius: 999px 999px 16px 16px; border: 1.5px solid var(--rule); }
html.pin .portrait { display: none; }   /* the canvas draws it there */

/* ---------- scenes: the pinned, cinematic version ---------- */
html.pin .scene { position: fixed; inset: 0; padding: 0; border: 0; pointer-events: none; }
html.pin .scene.active .text { pointer-events: auto; }
html.pin .layer { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 84px var(--gut) 15vh; }
html.pin .text { max-width: min(640px, 47vw); }
html.pin .hero .text { max-width: min(760px, 56vw); }
html.pin .rv, html.pin .w { opacity: 0; will-change: opacity, transform; }
html.pin .place { display: none; }              /* the field draws the number */
.w { display: inline-block; }
@media (max-width: 760px) {
  html.pin .layer { justify-content: flex-start; padding: 92px var(--gut) 0; }
  html.pin .text, html.pin .hero .text { max-width: none; }
}

/* ---------- type ---------- */
.num { margin-bottom: 22px; color: var(--accent); }
.name { font: italic 300 clamp(112px, 17vw, 264px)/.92 var(--serif); letter-spacing: -.035em; margin: 14px 0 0 -.04em; }
.lede { max-width: 28ch; font-size: clamp(20px, 1.8vw, 26px); line-height: 1.38; margin-top: clamp(20px, 3vh, 36px); }
.cue { margin-top: 26px; color: var(--faint); }
.cue span { color: var(--pulse); }
.stanza { font: 400 clamp(32px, 3.9vw, 60px)/1.16 var(--serif); letter-spacing: -.015em; }
.giant { font: italic 300 clamp(84px, 12vw, 190px)/.98 var(--serif); letter-spacing: -.03em; }
.title { font: 400 clamp(30px, 3.5vw, 52px)/1.16 var(--serif); letter-spacing: -.012em; }
.sub { margin-top: 20px; max-width: 34ch; color: var(--text-2); font-size: clamp(18px, 1.45vw, 21px); }
.instr { margin-top: 18px; color: var(--faint); }
.place { font: italic 300 96px/.9 var(--serif); margin-bottom: 10px; }
.place sup { font: 500 15px var(--mono); margin-left: 6px; color: var(--accent); vertical-align: top; position: relative; top: 12px; }
.motto { font: italic 300 clamp(46px, 6.6vw, 104px)/1.04 var(--serif); letter-spacing: -.025em; }

.chart > div { display: grid; grid-template-columns: 150px 1fr; gap: 4px 20px; padding: 13px 0; border-top: 1px solid var(--rule); }
.chart > div:last-child { border-bottom: 1px solid var(--rule); }
.chart dt { font-size: 11.5px; line-height: 2.2; }
.chart dd { font-size: clamp(18px, 1.5vw, 21px); }
@media (max-width: 760px) { .chart > div { grid-template-columns: 112px 1fr; gap: 4px 12px; padding: 10px 0; } .chart dt { font-size: 10.5px; line-height: 2.3; } .chart dd { font-size: 17px; line-height: 1.4; } }

.off li { padding: 16px 0; border-top: 1px solid var(--rule); transition: opacity .35s ease; }
.off li:last-child { border-bottom: 1px solid var(--rule); }
.off h3 { font: 400 clamp(28px, 3.2vw, 46px)/1.15 var(--serif); letter-spacing: -.01em; transition: color .35s ease; }
.off p { color: var(--text-2); font-size: 18px; }
html.pin .off li:not(.on) h3 { color: var(--faint); }
html.pin .off li:not(.on) p { color: var(--faint); }
html.pin .off li.on h3 { color: var(--text); font-style: italic; }

.mail { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 20px; }
.mail a { font: 400 clamp(26px, 3.3vw, 46px)/1.2 var(--serif); text-decoration: underline; text-decoration-color: var(--pulse); text-decoration-thickness: 2px; text-underline-offset: 8px; overflow-wrap: anywhere; }
.copy { background: none; border: 0; padding: 0; color: var(--text-2); font: 500 12.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.links { margin-top: 26px; }
.links a { font: 500 13px var(--mono); letter-spacing: .08em; text-transform: uppercase; text-decoration: none; border-bottom: 1px solid var(--rule); padding-bottom: 3px; }
.links a:hover { border-color: var(--pulse); }
.fine { margin-top: 44px; color: var(--faint); }
.fine a { text-decoration: none; color: var(--text-2); }
.credit { margin-top: 14px; font-size: 11px; color: var(--faint); }
.credit a { color: var(--text-2); text-decoration: none; border-bottom: 1px solid var(--rule); padding-bottom: 2px; }
.credit a:hover { color: var(--text); border-color: var(--pulse); }

/* short phones: keep the intro clear of the portrait */
@media (max-width: 760px) and (max-height: 740px) {
  html.pin .layer { padding-top: 78px; }
  html.pin .name { font-size: 84px; margin-top: 6px; }
  html.pin .hero .lede { font-size: 17px; max-width: none; margin-top: 12px; }
  html.pin .stanza { font-size: 29px; }
  html.pin .motto { font-size: 40px; }
}
