/*
 * Lookout — page
 *
 * A normal tall document. The photograph is a fixed WebGL canvas behind it
 * (a still in its place when WebGL is off). Each beat is a section whose copy
 * panel is sticky, so it holds on screen while its part of the day plays, then
 * gives way to the next. Wide viewports put the panel beside the subject of
 * the view; portrait stacks it over the sky or the ground, whichever is
 * quieter for that beat.
 */

@font-face {
  font-family: "Instrument Serif";
  src: url("assets/fonts/InstrumentSerif-Regular-Latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("assets/fonts/InstrumentSerif-Italic-Latin.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: block;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-Latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: block;
}

:root {
  --paper: #f5f0e7;
  --ink-dark: #1c1915;
  --ink-light: #f4efe6;
  --ink: var(--ink-dark);
  --muted: rgba(28, 25, 21, 0.68);
  --accent: #c8641f;
  --accent-ink: #fff6ec;
  --line: rgba(28, 25, 21, 0.18);
  --panel: rgba(245, 240, 231, 0.78);
  --panel-line: rgba(28, 25, 21, 0.12);
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(20px, 4.4vw, 76px);
  --index-col: clamp(0px, 13.5vw, 215px);
  color-scheme: light;
}

html[data-ink="light"] {
  --ink: var(--ink-light);
  --muted: rgba(244, 239, 230, 0.7);
  --line: rgba(244, 239, 230, 0.26);
  --panel: rgba(14, 13, 18, 0.5);
  --panel-line: rgba(244, 239, 230, 0.16);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: #0e0d12;
}
html[data-motion="reduced"] { scroll-behavior: auto; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: color 500ms ease;
}

h1, h2, h3, p, dl, dd, figure, ol { margin: 0; }
a { color: inherit; }
b { font-weight: 600; }

.anchor-point { position: absolute; width: 1px; height: 1px; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: -60px;
  left: var(--gutter);
  padding: 10px 14px;
  background: var(--ink-dark);
  color: var(--paper);
  border-radius: 6px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------- scene */

.scene-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #0e0d12;
  overflow: hidden;
}
.scene-wrap .poster,
.scene-wrap .poster img,
.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.scene-wrap .poster img { object-fit: cover; }
.scene { opacity: 0; transition: opacity 700ms ease; }
html[data-scene="on"] .scene { opacity: 1; }
html[data-scene="off"] .scene-wrap { display: none; }

/* the fallback still lives inside each beat and is only shown when the scene is off */
.still { display: none; }
html[data-scene="off"] .still {
  display: block;
  position: sticky;
  top: 0;
  height: 100vh;
  margin-bottom: -100vh;
  z-index: 0;
}
html[data-scene="off"] .still img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: fixed;
  z-index: 6;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(14px, 2.2vw, 24px) var(--gutter);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  line-height: 1;
}
.wordmark-mark { width: 22px; height: 22px; fill: var(--ink); }

.topnav {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  font-size: 0.86rem;
}
.topnav a { color: var(--ink); text-decoration: none; }
.topnav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.topnav-cta {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(8px);
  font-weight: 600;
}
.topnav-cta:hover { text-decoration: none !important; background: var(--ink); color: var(--paper); }
html[data-ink="light"] .topnav-cta:hover { color: var(--ink-dark); }

.wordmark, .wordmark-mark, .topnav a, .index a, .clock { transition: color 500ms ease, fill 500ms ease; }

/* ------------------------------------------------------------------- index */

.index {
  position: fixed;
  z-index: 6;
  left: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 14px 16px 14px 14px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.index a {
  display: grid;
  grid-template-columns: 2.6rem auto;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.index-name { position: relative; padding-bottom: 3px; }
.index-name::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 320ms ease;
}
.index a[aria-current] { color: var(--ink); }
.index a[aria-current] .index-name::after { transform: scaleX(1); }
.index a:hover { color: var(--ink); }

.clock {
  position: fixed;
  z-index: 6;
  left: var(--gutter);
  bottom: clamp(18px, 3vw, 34px);
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--ink);
  padding: 10px 16px 9px 14px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.clock-time {
  font-family: var(--serif);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.clock-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.scroll-hint {
  position: fixed;
  z-index: 6;
  right: var(--gutter);
  bottom: clamp(18px, 3vw, 34px);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 1;
  transition: opacity 400ms ease;
}
html:not([data-beat="dawn"]) .scroll-hint { opacity: 0; }

/* ------------------------------------------------------------------- beats */

main { position: relative; z-index: 2; }

.beat {
  position: relative;
  min-height: 125vh;
  padding: 0 var(--gutter);
}
.beat-dawn { min-height: 150vh; }
.beat-morning, .beat-afternoon { min-height: 135vh; }
.beat-dusk { min-height: 95vh; }
.beat-night { min-height: 145vh; padding-bottom: 8vh; }

.panel {
  position: sticky;
  top: 14vh;
  width: min(100%, 34rem);
  padding: clamp(22px, 2.6vw, 36px);
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  opacity: var(--vis, 1);
  transform: translateY(calc((1 - var(--vis, 1)) * 18px));
  will-change: opacity, transform;
  margin-left: var(--index-col);
}
.panel-right { margin-left: auto; margin-right: 0; }
.panel-left { margin-left: var(--index-col); }
.panel-low { top: 46vh; }
.panel-centre { margin-left: auto; margin-right: auto; text-align: center; top: 40vh; }
.panel-wide {
  width: min(100%, 60rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}

/* the hero is copy on the sky, no panel */
.panel-hero {
  top: 17vh;
  width: min(100%, 42rem);
  padding: 0;
  background: none;
  border: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
}

.kicker {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(60px, 8.6vw, 148px);
  line-height: 0.92;
  letter-spacing: -0.015em;
  margin: 0 0 22px;
}
h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(42px, 5vw, 78px);
  line-height: 0.96;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}
.panel-centre h2 { font-size: clamp(48px, 6.4vw, 104px); }

.lede {
  font-size: clamp(17px, 1.35vw, 20px);
  max-width: 27em;
  margin-bottom: 26px;
}
.panel p:not(.kicker):not(.lede):not(.note):not(.form-status) { max-width: 34em; }
.note {
  margin-top: 26px;
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 28em;
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--ink-dark);
  color: var(--paper);
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: var(--sans);
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}
.cta:hover { background: var(--accent); color: var(--accent-ink); }
.cta-quiet {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  backdrop-filter: blur(8px);
}
.cta-quiet:hover { background: var(--ink); color: var(--paper); }
html[data-ink="light"] .cta { background: var(--paper); color: var(--ink-dark); }
html[data-ink="light"] .cta:hover { background: var(--accent); color: var(--accent-ink); }
html[data-ink="light"] .cta-quiet { background: var(--panel); color: var(--ink); }

.text-link {
  display: inline-block;
  margin-top: 22px;
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* facts */
.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.facts dt {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd {
  font-family: var(--serif);
  font-size: 1.7rem;
  line-height: 1.1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- the plan */

.plan svg { width: 100%; height: auto; display: block; overflow: visible; }
.plan-lines path, .plan-lines circle {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: clamp(0, calc(1 - (var(--s, 0) - var(--d, 0)) * 2.4), 1);
}
.plan-lines .plan-deck { stroke-dasharray: 0.02 0.012; stroke-dashoffset: 0; opacity: clamp(0, calc((var(--s, 0) - var(--d, 0)) * 4), 1); }
.plan-lines .plan-dim { stroke-width: 0.8; opacity: 0.7; }
.plan-lines .plan-door { stroke-dasharray: 0.06 0.05; stroke-dashoffset: 0; opacity: clamp(0, calc((var(--s, 0) - var(--d, 0)) * 4), 1); }
.plan-labels text {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.06em;
  fill: var(--ink);
  opacity: clamp(0, calc((var(--s, 0) - var(--d, 0)) * 5), 1);
}
.plan-labels .plan-dim-text { font-size: 10px; fill: var(--muted); }
.plan-labels .plan-label-window { font-size: 10px; fill: var(--muted); }

/* ------------------------------------------------------------- the profile */

.profile { margin: 18px 0 22px; }
.profile svg { width: 100%; height: auto; display: block; overflow: visible; }
.profile-ground { fill: var(--ink); opacity: 0.08; }
.profile-line { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.profile-marks path { fill: none; stroke: var(--ink); stroke-width: 0.8; opacity: 0.6; }
.profile text { font-family: var(--sans); font-size: 10px; letter-spacing: 0.08em; fill: var(--muted); text-transform: uppercase; }
.profile-dot {
  fill: var(--accent);
  offset-path: path("M20 44 C60 44 80 52 110 60 S170 66 200 78 S240 104 280 108 S340 112 380 124 S440 134 460 136");
  offset-distance: calc(var(--s, 0) * 100%);
  offset-rotate: 0deg;
}
.profile figcaption {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.walks {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
  font-size: 0.95rem;
}
.walks li { padding-top: 12px; border-top: 1px solid var(--line); }
.walks b { display: block; font-family: var(--serif); font-size: 1.25rem; font-weight: 400; margin-bottom: 2px; }

/* ---------------------------------------------------------------- booking */

.book {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.field { display: grid; gap: 6px; }
.field label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field select {
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  min-height: 44px;
  color-scheme: dark;
}
html[data-ink="dark"] .field input, html[data-ink="dark"] .field select { color-scheme: light; background: rgba(255, 255, 255, 0.5); }
.book .cta { grid-column: 1 / -1; justify-self: start; }
.form-status { grid-column: 1 / -1; font-size: 0.88rem; color: var(--muted); min-height: 1.4em; }
.form-status[data-state="error"] { color: #ff9f6a; }
html[data-ink="dark"] .form-status[data-state="error"] { color: #a33f0c; }

/* ----------------------------------------------------------------- credit */

.credit {
  position: relative;
  z-index: 2;
  padding: 24px var(--gutter) 28px;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--muted);
  background: linear-gradient(to bottom, rgba(14, 13, 18, 0) 0%, rgba(14, 13, 18, 0.72) 100%);
}
.credit p { max-width: 62em; }
.credit b { color: var(--ink); font-weight: 600; }
.credit a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------- portrait */

@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  :root { --index-col: 0px; }
  .index { display: none; }
  .topnav a:not(.topnav-cta) { display: none; }
  .clock { bottom: auto; top: clamp(60px, 11vw, 78px); }
  .clock-time { font-size: 26px; }
  .scroll-hint { display: none; }

  .beat { min-height: 125vh; }
  .beat-dawn { min-height: 135vh; }
  .panel { width: 100%; top: 12vh; padding: 20px; }
  .panel-hero { top: 15vh; width: 100%; }
  .panel-low { top: 40vh; }
  .panel-centre { top: 32vh; }
  .panel-wide { grid-template-columns: 1fr; gap: 18px; top: 10vh; }
  .panel-right, .panel-left, .panel-centre { margin-left: 0; margin-right: 0; }

  h1 { font-size: clamp(48px, 14.5vw, 80px); }
  h2 { font-size: clamp(38px, 11vw, 60px); }
  .panel-centre h2 { font-size: clamp(44px, 13vw, 72px); }
  .facts dd { font-size: 1.4rem; }
  .book { grid-template-columns: 1fr; }
}

/* ----------------------------------------------------------- reduced motion */

html[data-motion="reduced"] .panel { transform: none; transition: none; }
html[data-motion="reduced"] .scene { transition: none; }
html[data-motion="reduced"] .plan, html[data-motion="reduced"] .profile { --s: 1; }
html[data-motion="reduced"] .index-name::after { transition: none; }
html[data-motion="reduced"] .cta, html[data-motion="reduced"] body { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .panel { transform: none; transition: none; }
}
