@font-face {
  font-family: "Cormorant Garamond";
  src: url("/assets/cormorant-garamond.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  --ink: #100e0d;
  --ivory: #f7eddc;
  --gold: #e8c694;
  --label: #e6dccbb8;
  --muted: #c2b4a1;
  --rule: #e8c69433;
  --gutter: clamp(1rem, 3vw, 2.75rem);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--ivory);
  font: 100%/1.5 var(--sans);
}

a { color: inherit; }
button { font: inherit; }

a:focus-visible, button:focus-visible, canvas:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

main { position: fixed; inset: 0; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
canvas:focus-visible { outline-offset: -4px; }

.scene-unavailable main {
  background: var(--ink) url("/assets/scene-preview.webp") center 52% / cover no-repeat;
}

.scene-unavailable canvas,
.scene-unavailable #controls,
.scene-unavailable #status .line { display: none; }

.masthead {
  position: fixed;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  padding: 1.25rem calc(var(--gutter) + 6.5rem) 2.75rem var(--gutter);
  background: linear-gradient(#100e0dea, #100e0d80 55%, transparent);
  pointer-events: none;
}

.identity { display: flex; align-items: center; gap: .8rem; }
.identity img { border-radius: 10px; }
.identity h1 { margin: 0; font: 500 clamp(2rem, 3.7vw, 3.25rem)/.93 var(--serif); }

.eyebrow {
  display: block;
  color: var(--gold);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .19em;
  line-height: 1.3;
  text-decoration: none;
  text-transform: uppercase;
}

.identity a { width: fit-content; pointer-events: auto; }

.quiet-button {
  min-height: 2.625rem;
  padding: .4rem .9rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: #14110ee6;
  color: var(--ivory);
  cursor: pointer;
  font-size: .875rem;
  pointer-events: auto;
  white-space: nowrap;
}

.quiet-button:hover {
  border-color: var(--gold);
  background: #2a2119;
}

.scene-caption {
  position: fixed;
  inset: auto 0 0;
  padding: 3.5rem var(--gutter) 1.35rem;
  background: linear-gradient(transparent, #100e0daa 43%, #100e0df2);
  pointer-events: none;
}

.scene-title,
.scene-description { margin: 0; }
.scene-title { font: 500 clamp(1.75rem, 3.1vw, 2.75rem)/1.05 var(--serif); }
.scene-description { margin-top: .25rem; color: var(--ivory); font-size: .875rem; }

#controls {
  width: fit-content;
  margin: .8rem 0 0;
  padding-top: .65rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.75;
}

#controls b { color: var(--ivory); font-weight: 600; }
#controls .touch { display: none; }

#status, #noscript {
  position: fixed;
  right: var(--gutter);
  bottom: 1.5rem;
  max-width: min(30rem, calc(100vw - var(--gutter) * 2));
  margin: 0;
  padding: .55rem .65rem;
  border-radius: 3px;
  background: #100e0de6;
  color: var(--ivory);
  font-size: .8125rem;
  text-align: right;
  pointer-events: none;
}

#status .line { display: block; width: 200px; max-width: 100%; height: 1px; margin: 7px 0 0 auto; background: #e6dccb26; }
#status .line span { display: block; height: 100%; background: var(--label); transform-origin: left; transform: scaleX(var(--progress, 0)); transition: transform .2s linear; }

.ui-hidden .masthead, .ui-hidden .lil-gui, .ui-hidden .scene-caption { display: none; }

#notes {
  width: min(67.5rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  max-width: none;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #171310;
  color: var(--ivory);
  box-shadow: 0 1.5rem 6rem #000b;
}

#notes::backdrop { background: #090706c9; }

.notes-bar {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .5rem var(--gutter);
  border-bottom: 1px solid var(--rule);
  background: #171310;
}

.notes-inner { padding: var(--gutter); }

.notes-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.25rem, 4vw, 3rem);
  padding-bottom: clamp(1.5rem, 4vw, 3rem);
  border-bottom: 1px solid var(--rule);
}

.notes-art {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1.55;
  object-fit: cover;
  object-position: 70% center;
  border-radius: 3px;
}

.notes-copy h2,
.reading h2,
.post-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
}

.notes-copy h2 { font-size: clamp(2.5rem, 5vw, 4rem); line-height: .98; }
.notes-copy p { margin: .8rem 0 0; color: var(--muted); line-height: 1.65; }
.reading { margin-top: 1.5rem; }
.reading-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .9rem; }
.reading h2 { font-size: clamp(1.9rem, 3.5vw, 2.6rem); line-height: 1; }
.text-link, .notes-credit a { color: var(--gold); text-underline-offset: .22em; }
.text-link { font-size: .875rem; }

.reading-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reading-list a {
  display: block;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #1d1713;
  text-decoration: none;
}

.reading-list a:hover { border-color: var(--gold); }
.reading-list img { display: block; width: 100%; height: auto; aspect-ratio: 1.6; object-fit: cover; }
.post-meta { padding: .75rem .8rem .95rem; }
.post-date { color: var(--gold); font-size: .75rem; }
.post-title { margin-top: .2rem; font-size: 1.4rem; line-height: 1.13; }
.notes-credit { margin: 1.5rem 0 0; color: var(--muted); font-size: .8125rem; }

.lil-gui.root { top: 1.35rem; right: var(--gutter); }
.lil-gui.root, .lil-gui.root .lil-gui {
  --background-color: #0d0c0bf0;
  --text-color: #d8d2c4;
  --title-background-color: transparent;
  --title-text-color: #e6dfd0;
  --widget-color: #24211d;
  --hover-color: #332f29;
  --focus-color: #433d35;
  --number-color: #e3c48f;
  --string-color: #e3c48f;
  --font-size: 11px;
  --font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.lil-gui.root, .lil-gui.root * { text-transform: uppercase; }
.lil-gui.root.closed, .lil-gui.root .lil-gui { background-color: transparent; }
.lil-gui.root .title { text-align: center; }
.lil-gui.root > .title { font-weight: 400; letter-spacing: .16em; }
.lil-gui.root.closed > .title { padding: 0 .65rem; border: 1px solid var(--rule); border-radius: 3px; background: #14110ee6; }
.lil-gui.root .title::before { position: static; padding-right: 2px; }

@media (pointer: coarse) {
  #controls .keys { display: none; }
  #controls .touch { display: inline; }
}

@media (max-width: 760px) {
  .masthead { padding-right: var(--gutter); }
  .lil-gui.root { top: 4.6rem; }
  .reading-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes-intro { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  #status, #noscript { bottom: 10rem; }
  .identity img { width: 38px; height: 38px; }
}

@media (max-height: 450px) {
  .scene-caption { padding-top: 1.2rem; }
  .scene-title { font-size: 1.65rem; }
  #status, #noscript { bottom: 1.25rem; max-width: 45vw; }
}
