@font-face { font-family: "Cormorant"; src: url("vendor/fonts/cormorant-latin-300-normal.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("vendor/fonts/cormorant-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url("vendor/fonts/hanken-grotesk-latin-300-normal.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url("vendor/fonts/hanken-grotesk-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --black: #07080A;
  --graphite: #121418;
  --steel: #C7CBD1;
  --gold: #C9A24A;
  --teal: #2FA7A0;
  --blue: #2C5BA8;
  --ink: #EDE7DC;
  --serif: "Cormorant", "Iowan Old Style", Georgia, serif;
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --m: clamp(20px, 2.6vw, 40px);
  --t-display: clamp(40px, 4.4vw, 76px);
  --t-head: clamp(34px, 3.4vw, 54px);
  --t-body: clamp(17px, 1.3vw, 20px);
  --t-small: 14px;
  --fade: 900ms cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { background: var(--black); color: var(--ink); -webkit-text-size-adjust: 100%; }
html.locked, html.locked body { overflow: hidden; }
body { margin: 0; background: var(--black); font: 300 var(--t-body)/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip; }
::selection { background: var(--gold); color: var(--black); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }
h1, h2 { margin: 0; font-family: var(--serif); font-weight: 300; letter-spacing: -.01em; line-height: 1.02; font-variant-numeric: oldstyle-nums; }
h1 { font-size: var(--t-display); }
h2 { font-size: var(--t-head); }
p { margin: 0; }

/* Stage layers */
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: 0; }
#track, #leaders { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#track { z-index: 6; }
#leaders { z-index: 3; }
#leaders line { stroke: var(--steel); stroke-width: 1; opacity: .55; }
#leaders circle { fill: var(--gold); }
.track__rest { stroke: var(--steel); stroke-width: 1; opacity: .26; fill: none; }
.track__fill { stroke: var(--gold); stroke-width: 1.5; fill: none; }

/* Opening */
#gate { position: fixed; inset: 0; z-index: 1; background: var(--black); display: none; place-items: center; touch-action: none; }
.js #gate { display: grid; }
.gate__ring { width: min(68vh, 78vw); height: min(68vh, 78vw); transform: rotate(-90deg); overflow: visible; }
.gate__ring circle { fill: none; }
.gate__line { stroke: var(--steel); stroke-width: 1; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: .75; animation: draw 1100ms cubic-bezier(.6, 0, .2, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Fixed furniture */
.bar { position: fixed; z-index: 5; top: 0; left: 0; right: 0; padding: calc(var(--m) * .9) calc(var(--m) * 1.4); display: flex; justify-content: space-between; align-items: baseline; }
.bar__mark { font-family: var(--serif); font-size: 26px; letter-spacing: .02em; }
.bar__action, #sound, .chapters em, .small, legend { font-size: var(--t-small); }
.bar__action { letter-spacing: .14em; text-transform: uppercase; background: var(--black); padding: 7px 12px; margin-right: -12px; }
.bar__action { transition: color 300ms; }
.bar__action:hover { color: var(--gold); }

.chapters { position: fixed; z-index: 5; left: calc(var(--m) * 1.4); bottom: calc(var(--m) * 1.1); display: flex; gap: 18px; align-items: baseline; }
.chapters a { display: flex; gap: 8px; align-items: baseline; color: var(--steel); }
.chapters span { font-family: var(--serif); font-size: 20px; transition: color 500ms; }
.chapters em { font-style: normal; letter-spacing: .06em; max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; transition: max-width 800ms, opacity 800ms; }
.chapters a.on span { color: var(--gold); }
.chapters a.on em { max-width: 12em; opacity: 1; }

#sound { position: fixed; z-index: 5; right: calc(var(--m) * 1.4); bottom: calc(var(--m) * 1.1); color: var(--steel); letter-spacing: .14em; text-transform: uppercase; background: var(--black); padding: 6px 12px; margin-right: -12px; }
#sound[aria-pressed="true"] { color: var(--gold); }

/* Chapters */
#flow { position: relative; z-index: 2; pointer-events: none; }
.js:not(.no-webgl) .ch { height: calc(var(--h) * 1svh); }
.pin { position: relative; min-height: 100svh; pointer-events: none; }
.js:not(.no-webgl) .pin { position: fixed; inset: 0; min-height: 0; overflow: hidden; }

.say { position: absolute; left: calc(var(--m) * 1.4); width: min(29em, 31vw); }
.big { font: 300 var(--t-head)/1.08 var(--serif); margin: 0 !important; }
.say--low { bottom: calc(var(--m) * 3.4); }
.say--mid { top: 50%; transform: translateY(-50%); }
.say > div { position: absolute; left: 0; right: 0; bottom: 0; }
.say--mid > div { bottom: auto; top: 50%; transform: translateY(-50%); }
.say p { margin-top: 14px; max-width: 26em; }
#stone .say p { max-width: 16em; }
.say, .parts, .finishes { user-select: none; -webkit-user-select: none; }

.fade { transition: opacity var(--fade), translate var(--fade), visibility 0s linear 900ms; }
.js .fade { opacity: 0; translate: 0 16px; visibility: hidden; }
.js .fade.on { opacity: 1; translate: 0 0; visibility: visible; transition-delay: 0s; pointer-events: auto; }
.no-webgl .fade { opacity: 1; translate: 0 0; visibility: visible; pointer-events: auto; }

.line { margin-top: 26px; padding: 12px 0; letter-spacing: .14em; text-transform: uppercase; font-size: var(--t-small); text-decoration: underline 1px var(--gold); text-underline-offset: 9px; transition: color 300ms; }
.line:hover { color: var(--gold); }

.parts { position: absolute; right: calc(var(--m) * 2.2); top: 0; width: 300px; margin: 0; padding: 0; list-style: none; font-size: 16px; line-height: 1.3; }
.parts li { position: absolute; right: 0; width: 100%; color: var(--ink); }
.parts strong { display: block; font: 300 24px/1.1 var(--serif); }

.finishes { position: absolute; left: calc(var(--m) * 1.4); top: calc(50% + 74px); margin: 0; padding: 0; list-style: none; }
.finishes button { padding: 9px 0; font-family: var(--serif); font-size: 22px; line-height: 1.2; color: var(--steel); transition: color 300ms, translate 300ms; }
.finishes button:hover, .finishes button.on { color: var(--gold); translate: 6px 0; }
#finishTip { position: fixed; z-index: 7; left: 0; top: 0; pointer-events: none; font: 300 22px/1 var(--serif); color: var(--gold); opacity: 0; transition: opacity 300ms; white-space: nowrap; }

/* Yours */
.panel { position: absolute; top: 50%; right: calc(var(--m) * 1.4); translate: 0 calc(-50% + 16px); width: min(440px, 40vw); max-height: calc(100svh - var(--m) * 7); overflow-y: auto; scrollbar-width: none; background: var(--graphite); padding: 30px 32px; }
.js .panel.fade.on, .no-webgl .panel { translate: 0 -50%; }
.panel h2 { margin-bottom: 14px; }
fieldset { border: 0; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
legend { padding: 0 0 6px; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); }
fieldset label { position: relative; display: block; }
fieldset input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
fieldset span { display: block; padding: 8px 12px; font-size: 15px; line-height: 1.2; background: #1b1e24; transition: background 300ms, color 300ms, scale 200ms; }
fieldset label:hover span { background: #262a32; }
fieldset input:active + span { scale: .97; }
fieldset input:checked + span { background: var(--gold); color: var(--black); }
fieldset input:focus-visible + span { outline: 1px solid var(--gold); outline-offset: 2px; }
.price { font: 300 var(--t-head)/1 var(--serif); font-variant-numeric: oldstyle-nums; margin: 6px 0 10px; }
.small { font-size: var(--t-small); line-height: 1.45; color: var(--steel); }
.solid { display: block; width: 100%; margin-top: 16px; padding: 14px 16px; background: var(--ink); color: var(--black); letter-spacing: .12em; text-transform: uppercase; font-size: var(--t-small); font-weight: 400; transition: background 300ms, scale 200ms; }
.solid:hover { background: var(--gold); }
.solid:active { scale: .985; }
.solid:disabled { opacity: .35; cursor: default; background: var(--ink); }
#book { margin-top: 20px; }
#done { outline: 0; }
#done .small { margin-top: 22px; }
.credit { position: absolute; right: calc(var(--m) * 1.4); bottom: calc(var(--m) * 3.3); font-size: var(--t-small); color: var(--steel); }

/* Crown handle and cursor */
#crownHandle { position: fixed; z-index: 4; left: 0; top: 0; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%; touch-action: none; visibility: hidden; }
#crownHandle.on { visibility: visible; }
#crownHandle:focus-visible { outline-offset: -8px; }
#cursor { position: fixed; z-index: 30; left: 0; top: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 1px solid var(--steel); border-radius: 50%; pointer-events: none; display: none; place-items: center; transition: width 250ms, height 250ms, margin 250ms, border-color 250ms, background 250ms; }
#cursor svg { width: 22px; height: 22px; fill: none; stroke: var(--gold); stroke-width: 1.2; opacity: 0; transition: opacity 200ms; }
.has-cursor #cursor { display: grid; }
.has-cursor, .has-cursor * { cursor: none !important; }
#cursor.is-hover { width: 56px; height: 56px; margin: -28px 0 0 -28px; border-color: var(--gold); }
#cursor.is-drag { width: 46px; height: 46px; margin: -23px 0 0 -23px; border-color: var(--gold); }
#cursor.is-drag svg { opacity: 1; }
#cursor.is-down { background: rgba(201, 162, 74, .18); }

/* Without WebGL: the same chapters in plain flow beside a drawn watch */
.fallback { display: none; }
.no-webgl #stage, .no-webgl #gate, .no-webgl #track, .no-webgl #leaders, .no-webgl #crownHandle, .no-webgl #sound, .no-webgl #now, .no-webgl #cursor { display: none !important; }
.no-webgl .fallback { display: block; position: fixed; z-index: 1; right: 8vw; top: 50%; width: min(32vw, 46vh); margin: 0; transform: translateY(-50%); }
.no-webgl .bar { position: absolute; }
.no-webgl .chapters { display: none; }
.no-webgl .ch { padding: 24vh calc(var(--m) * 1.4); min-height: 80vh; }
.no-webgl .pin { position: static; min-height: 0; pointer-events: auto; }
.no-webgl .say, .no-webgl .say > div, .no-webgl .parts, .no-webgl .parts li, .no-webgl .finishes, .no-webgl .panel, .no-webgl .credit { position: static; transform: none; translate: none; width: auto; max-width: 34em; text-align: left; max-height: none; }
.no-webgl .say > div + div { margin-top: 40px; }
.no-webgl .panel { width: min(440px, 100%); }
.no-webgl .parts li { margin-bottom: 14px; }
.no-webgl .credit { margin-top: 24px; }
html:not(.js) .fallback { display: block; position: static; width: 240px; margin: 40px; }
html:not(.js) .ch { padding: 40px; }

@media (max-width: 760px) {
  :root { --m: 16px; --t-display: 40px; --t-head: 34px; }
  .bar { padding: 22px 28px 0 28px; }
  .bar__action { display: none; }
  .chapters { left: 28px; bottom: 26px; gap: 12px; }
  .chapters em { display: none; }
  #sound { right: 28px; bottom: 24px; }
  .say { left: 28px; right: 28px; width: auto; }
  .say--low { bottom: 74px; }
  .say--mid { top: auto; bottom: 74px; transform: none; }
  .say--mid > div { top: auto; bottom: 0; transform: none; }
  .say p { font-size: 17px; }
  #stone .say p { max-width: none; }
  .say p.big { font-size: var(--t-head); }
  .parts { right: 28px; left: 28px; top: auto; bottom: 74px; width: auto; height: 74px; }
  .parts li { position: absolute; left: 0; bottom: 0; top: auto !important; }
  #heart .say--mid { bottom: 146px; }
  .finishes { right: 28px; left: 28px; top: auto; bottom: 68px; display: flex; flex-wrap: wrap; gap: 0 16px; }
  .finishes button { font-size: 17px; padding: 6px 0; }
  #finishTip { display: none; }
  .panel { left: 16px; right: 16px; top: auto; bottom: 62px; width: auto; max-height: 62svh; translate: 0 16px; padding: 18px 18px; }
  .js .panel.fade.on { translate: 0 0; }
  .panel h2 { margin-bottom: 8px; }
  .credit { right: auto; left: 0; right: 0; bottom: 0; text-align: center; padding-bottom: 4px; font-size: 13px; }
  .no-webgl .fallback { position: absolute; left: 20vw; right: auto; top: 76px; width: 60vw; margin: 0; transform: none; }
  .no-webgl .ch { padding: 40px 28px; min-height: 0; }
  .no-webgl #stone { padding-top: calc(76px + 86vw); }
}

@media (prefers-reduced-motion: reduce) {
  .fade, .gate__line { transition-duration: 1ms; animation-duration: 1ms; animation-delay: 0ms; }
}
