/* Terraforming Venus. A quiet frame around a painting. */

@font-face { font-family: 'Caslon'; src: url('./fonts/libre-caslon-text-normal-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Caslon'; src: url('./fonts/libre-caslon-text-italic-400.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Jost'; src: url('./fonts/jost-variable.woff2') format('woff2'); font-weight: 300 600; font-style: normal; font-display: swap; }

:root {
  --umber: #24180f;
  --umber-2: #3a2a1d;
  --paper: #efe4cf;
  --paper-dim: rgba(239, 228, 207, 0.72);
  --paper-faint: rgba(239, 228, 207, 0.38);
  --ochre: #d39a52;
  --ochre-deep: #a8692c;
  --line: rgba(239, 228, 207, 0.22);
  --serif: 'Caslon', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Jost', 'Futura', 'Century Gothic', 'Avenir Next', sans-serif;
  --gutter: clamp(16px, 3vw, 36px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--umber); color: var(--paper); }
body { font-family: var(--serif); font-size: 16px; line-height: 1.5; overflow: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ochre); }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--ochre); outline-offset: 3px; }
[hidden] { display: none !important; }

.kicker { font-family: var(--sans); font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--paper-dim); margin: 0 0 10px; }
.small { font-size: 13px; color: var(--paper-dim); }
.label { font-family: var(--sans); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper-faint); }

/* ── intro ─────────────────────────────────────────── */
.intro { position: fixed; inset: 0; z-index: 5; display: flex; align-items: flex-end; transition: opacity 0.9s ease; }
.intro.leaving { opacity: 0; pointer-events: none; }
.stills { position: absolute; inset: 0; overflow: hidden; background: #8a5a2c; }
.still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.still-b { opacity: 0; }
.stills.cycling .still-b { animation: becoming 26s ease-in-out infinite; }
@keyframes becoming { 0%, 18% { opacity: 0; } 50%, 68% { opacity: 1; } 100% { opacity: 0; } }
.intro::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(20, 13, 8, 0.82) 0%, rgba(20, 13, 8, 0.55) 34%, rgba(20, 13, 8, 0) 62%),
              linear-gradient(0deg, rgba(20, 13, 8, 0.55) 0%, rgba(20, 13, 8, 0) 40%); }
.plate { position: relative; z-index: 1; max-width: 470px; margin: 0 0 clamp(24px, 7vh, 72px) var(--gutter); padding: 0; }
.plate h1 { font-weight: 400; font-size: clamp(38px, 5.4vw, 64px); line-height: 1.02; letter-spacing: -0.01em; margin: 0 0 12px; }
.plate .lede { font-style: italic; font-size: clamp(19px, 2vw, 23px); line-height: 1.35; margin: 0 0 18px; color: var(--paper); max-width: 26ch; }
.plate p { margin: 0 0 16px; color: var(--paper-dim); max-width: 42ch; }
.actions { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 24px 0 22px; }
.primary { background: var(--paper); color: var(--umber); border: 0; border-radius: 2px; padding: 13px 20px 12px; font-family: var(--sans); font-size: 14px; letter-spacing: 0.06em; font-weight: 500; }
.primary:hover { background: #fff6e4; }
.primary:disabled { opacity: 0.6; cursor: progress; }
.quiet { background: none; border: 0; padding: 6px 0; color: var(--paper-dim); font-family: var(--sans); font-size: 14px; letter-spacing: 0.04em; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--paper-faint); }
.quiet:hover { color: var(--paper); }
.links a { color: var(--paper-dim); }

/* ── the painting ──────────────────────────────────── */
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; background: var(--umber); }
#world:active { cursor: grabbing; }

/* ── the interface ─────────────────────────────────── */
.ui { position: fixed; inset: 0; pointer-events: none; z-index: 3; transition: opacity 0.4s; }
.ui.hiding { opacity: 0; }
.ui > * { pointer-events: auto; }
.top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 30px; background: linear-gradient(180deg, rgba(18, 12, 7, 0.5), rgba(18, 12, 7, 0)); pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand .name { font-family: var(--serif); font-size: 19px; line-height: 1.1; }
.brand .by { font-family: var(--sans); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper-dim); }
.brand .by a { text-decoration: none; }
.brand .by a:hover { text-decoration: underline; }
.tools { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.tools button { background: rgba(20, 13, 8, 0.38); border: 1px solid var(--line); border-radius: 2px; padding: 6px 11px 5px; font-family: var(--sans); font-size: 12px; letter-spacing: 0.08em; color: var(--paper); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.tools button:hover { border-color: var(--paper-faint); background: rgba(20, 13, 8, 0.55); }

.dock { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px var(--gutter) max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(16, 10, 6, 0.86) 0%, rgba(16, 10, 6, 0.66) 55%, rgba(16, 10, 6, 0) 100%); }
.readout { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.when { display: flex; align-items: baseline; gap: 12px; }
.year { font-family: var(--serif); font-size: 46px; line-height: 0.9; font-variant-numeric: lining-nums tabular-nums; min-width: 2.2ch; }
.stage { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--ochre); }
.facts { display: flex; gap: 22px; margin: 0; }
.facts div { display: flex; flex-direction: column; }
.facts dt { font-family: var(--sans); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper-faint); }
.facts dd { margin: 0; font-size: 15px; font-variant-numeric: lining-nums tabular-nums; color: var(--paper); white-space: nowrap; }
.caption { max-width: 74ch; margin: 10px 0 14px; color: var(--paper-dim); font-size: 15.5px; line-height: 1.5; min-height: 3em; transition: opacity 0.35s; }
.caption.fading { opacity: 0; }
.controls { display: grid; grid-template-columns: auto 1fr 210px; gap: 18px; align-items: end; }
.play { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--paper-faint); background: rgba(239, 228, 207, 0.06); display: grid; place-items: center; padding: 0; margin-bottom: 8px; }
.play svg { width: 16px; height: 16px; fill: var(--paper); }
.play .i-pause { display: none; }
.play.on .i-play { display: none; }
.play.on .i-pause { display: block; }
.play:hover { border-color: var(--paper); }

.timeline { position: relative; padding-top: 22px; }
.stages { position: absolute; top: 0; left: 0; right: 0; height: 20px; }
.stages button { position: absolute; top: 0; height: 20px; background: none; border: 0; padding: 0 0 0 6px; text-align: left; font-family: var(--sans); font-size: 11px; letter-spacing: 0.06em; color: var(--paper-faint); white-space: nowrap; overflow: hidden; text-overflow: clip; border-left: 1px solid var(--line); }
.stages button:hover { color: var(--paper); }
.stages button.now { color: var(--ochre); }
.ticks { position: relative; height: 14px; font-family: var(--sans); font-size: 10.5px; letter-spacing: 0.04em; color: var(--paper-faint); margin-top: 1px; }
.ticks span { position: absolute; top: 0; transform: translateX(-1px); padding-left: 6px; border-left: 1px solid transparent; font-variant-numeric: lining-nums tabular-nums; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(90deg, var(--ochre) 0 var(--fill, 0%), var(--line) var(--fill, 0%) 100%); border-radius: 2px; }
input[type=range]::-moz-range-track { height: 3px; background: var(--line); border-radius: 2px; }
input[type=range]::-moz-range-progress { height: 3px; background: var(--ochre); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border-radius: 50%; background: var(--paper); border: 3px solid var(--umber); box-shadow: 0 0 0 1px var(--paper-faint); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 3px solid var(--umber); }
input[type=range]:disabled { opacity: 0.35; cursor: default; }

.hour label { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-variant-numeric: lining-nums tabular-nums; }
.hournote { display: block; font-family: var(--sans); font-size: 10.5px; letter-spacing: 0.06em; color: var(--paper-faint); min-height: 1.3em; margin-top: 1px; }

.toast { position: absolute; left: 50%; top: 74px; transform: translate(-50%, -6px); background: rgba(20, 13, 8, 0.78); border: 1px solid var(--line); padding: 8px 14px; font-family: var(--sans); font-size: 13px; letter-spacing: 0.03em; border-radius: 2px; opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none; max-width: calc(100% - 2 * var(--gutter)); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.hint { position: absolute; left: 50%; transform: translateX(-50%); top: max(64px, calc(env(safe-area-inset-top) + 56px)); margin: 0; font-family: var(--sans); font-size: 12px; letter-spacing: 0.06em; color: var(--paper-faint); transition: opacity 1s; pointer-events: none; }
.hint.gone { opacity: 0; }

/* ── sheets (places, notes) ────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 8; background: rgba(14, 9, 5, 0.6); display: grid; place-items: center; padding: var(--gutter); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet-inner { position: relative; width: min(820px, 100%); max-height: calc(100vh - 2 * var(--gutter)); max-height: calc(100dvh - 2 * var(--gutter)); overflow: auto; background: var(--paper); color: var(--umber); padding: clamp(22px, 4vw, 44px); border-radius: 2px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); }
.sheet-inner .kicker { color: rgba(36, 24, 15, 0.6); }
.sheet-inner h2 { font-weight: 400; font-size: clamp(26px, 3.4vw, 36px); line-height: 1.1; margin: 0 0 18px; }
.sheet-inner h3 { font-family: var(--sans); font-weight: 500; font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase; margin: 28px 0 8px; color: var(--ochre-deep); }
.sheet-inner a { color: var(--umber); }
.sheet-inner a:hover { color: var(--ochre-deep); }
.sheet-inner .small { color: rgba(36, 24, 15, 0.65); }
.close { position: absolute; top: 10px; right: 12px; width: 40px; height: 40px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--umber); }
.prose p, .prose li { max-width: 66ch; }
.steps { padding-left: 1.2em; margin: 10px 0; }
.steps li { margin: 0 0 8px; }
.steps b { font-weight: 400; font-style: italic; }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0; font-size: 15px; }
.keys dt { font-family: var(--sans); font-size: 13px; letter-spacing: 0.06em; }
.keys dd { margin: 0; }
.sources { padding-left: 1.1em; font-size: 14.5px; }

.places-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.locator { margin: 0; }
.locator canvas { width: 100%; height: auto; display: block; border-radius: 2px; background: #5d4630; }
.locator figcaption { font-size: 13px; color: rgba(36, 24, 15, 0.7); margin-top: 8px; line-height: 1.4; }
.view-list { display: flex; flex-direction: column; gap: 8px; }
.view-list button { text-align: left; background: rgba(36, 24, 15, 0.04); border: 1px solid rgba(36, 24, 15, 0.16); border-radius: 2px; padding: 12px 14px; color: var(--umber); display: grid; grid-template-columns: 26px 1fr; gap: 2px 10px; }
.view-list button:hover { border-color: var(--ochre-deep); background: rgba(211, 154, 82, 0.1); }
.view-list button.now { border-color: var(--umber); }
.view-list .num { font-family: var(--sans); font-size: 12px; color: var(--ochre-deep); grid-row: span 2; padding-top: 3px; }
.view-list .vname { font-size: 18px; line-height: 1.2; }
.view-list .vsub { font-size: 13.5px; color: rgba(36, 24, 15, 0.7); }

/* ── boot ──────────────────────────────────────────── */
.boot { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 60%, #6b4523 0%, #2a1b10 70%); transition: opacity 0.8s; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-inner { width: min(360px, calc(100% - 2 * var(--gutter))); text-align: center; }
.boot-text { font-style: italic; font-size: 20px; margin: 0 0 16px; }
.bar { height: 2px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ochre); transition: width 0.3s; }
.fail { margin-top: 18px; font-style: normal; color: var(--paper); font-size: 15px; line-height: 1.5; }

.nojs { padding: var(--gutter); max-width: 720px; }
.nojs img { width: 100%; height: auto; }

/* ── narrow screens ────────────────────────────────── */
@media (max-width: 760px) {
  .wide-only { display: none; }
  .plate { margin-bottom: 22px; margin-right: var(--gutter); }
  .intro::after { background: linear-gradient(0deg, rgba(20, 13, 8, 0.92) 0%, rgba(20, 13, 8, 0.7) 45%, rgba(20, 13, 8, 0) 78%); }
  .plate p { font-size: 15px; }
  .brand .name { font-size: 16px; white-space: nowrap; }
  .brand .by { display: none; }
  #hideBtn { display: none; }
  #placesBtn { display: none; }
  .tools button { padding: 6px 9px 5px; font-size: 11.5px; }
  .dock { padding-top: 44px; }
  .year { font-size: 36px; }
  .stage { font-size: 19px; }
  .facts { gap: 14px; }
  .facts dd { font-size: 13.5px; }
  .caption { font-size: 14px; margin: 8px 0 10px; min-height: 4.5em; }
  .controls { grid-template-columns: auto 1fr; gap: 6px 14px; }
  .hour { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
  .hour label { gap: 8px; }
  .hournote { grid-column: 1 / -1; margin-top: -4px; }
  .stages button { font-size: 0; padding: 0; }
  .stages button.now { font-size: 11px; padding-left: 6px; overflow: visible; }
  .ticks span { font-size: 9.5px; padding-left: 3px; }
  .ticks span:nth-child(2), .ticks span:nth-child(3) { display: none; }
  .hint { display: none; }
  .places-grid { grid-template-columns: 1fr; }
}
@media (max-height: 560px) and (min-width: 761px) {
  .caption { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .stills.cycling .still-b { animation: none; opacity: 0; }
  .intro, .boot, .caption, .toast { transition: none; }
}

/* ── acting ───────────────────────────────────────── */
.act { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 12px; }
.act-btn { background: var(--ochre); color: var(--umber); border: 0; border-radius: 2px; padding: 11px 18px 10px; font-family: var(--sans); font-size: 14px; letter-spacing: 0.06em; font-weight: 500; box-shadow: 0 0 0 0 rgba(211, 154, 82, 0.6); }
.act-btn:hover { background: #e2ad68; }
.act-btn.pulse { animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(211, 154, 82, 0.55); } 70% { box-shadow: 0 0 0 14px rgba(211, 154, 82, 0); } 100% { box-shadow: 0 0 0 0 rgba(211, 154, 82, 0); } }
.act-btn.on { background: var(--paper); }
.act-btn:disabled { opacity: 0.5; cursor: default; animation: none; }
.act-note { font-family: var(--sans); font-size: 13px; letter-spacing: 0.03em; color: var(--paper-dim); }
.act-finish { background: none; border: 1px solid var(--paper-faint); color: var(--paper); border-radius: 2px; padding: 9px 14px 8px; font-family: var(--sans); font-size: 13px; letter-spacing: 0.05em; }
.act-finish:hover { border-color: var(--paper); }
.tools button.on { background: rgba(211, 154, 82, 0.35); border-color: var(--ochre); }
body.hand #world { cursor: crosshair; }
.flypad { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 250px; display: none; justify-content: space-between; align-items: flex-end; pointer-events: none; }
body.touch.flying .flypad { display: flex; }
.stick { width: 110px; height: 110px; border-radius: 50%; border: 1px solid var(--paper-faint); background: rgba(20, 13, 8, 0.25); position: relative; pointer-events: auto; touch-action: none; }
.stick i { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(239, 228, 207, 0.55); }
.updown { display: flex; flex-direction: column; gap: 10px; pointer-events: auto; }
.updown button { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--paper-faint); background: rgba(20, 13, 8, 0.3); font-size: 20px; touch-action: none; }
@media (max-width: 760px) {
  .act { margin-bottom: 8px; gap: 10px; }
  .act-btn { padding: 10px 14px 9px; font-size: 13px; }
  .act-note { font-size: 12px; flex-basis: 100%; order: 3; }
  .flypad { bottom: 300px; }
}

.fade { position: fixed; inset: 0; z-index: 4; background: #0b0806; opacity: 0; pointer-events: none; transition: opacity 0.35s ease; }
.fade.on { opacity: 1; }
