:root {
  --ink: #05060c;
  --paper: #f4ebdd;
  --paper-muted: #c9c3d8;
  --brass: #c69a5b;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: #e9e6da;
  font-family: "Iowan Old Style", Baskerville, "Palatino Linotype", Palatino, Georgia, serif;
}

body::before,
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 8; }
body::before { box-shadow: inset 0 0 12vw rgba(0, 0, 0, 0.58); }
body::after {
  opacity: 0.07;
  background-image:
    repeating-radial-gradient(circle at 23% 31%, transparent 0, rgba(255,255,255,.22) .5px, transparent 1px, transparent 4px),
    repeating-radial-gradient(circle at 77% 69%, transparent 0, rgba(255,255,255,.16) .5px, transparent 1px, transparent 5px);
  background-size: 13px 17px, 19px 23px;
  mix-blend-mode: soft-light;
}

button { font: inherit; }
button:focus-visible { outline: 1px solid var(--paper); outline-offset: 5px; }

.sky-plate { position: relative; height: 100svh; min-height: 500px; width: 100vw; overflow: hidden; }
.sky-canvas-wrap { position: absolute; inset: 0; }
#sky { display: block; width: 100%; height: 100%; }

.sky-caption {
  position: absolute;
  top: clamp(28px, 7vh, 68px);
  left: clamp(28px, 7vw, 104px);
  width: min(470px, calc(100vw - 56px));
  padding-left: 18px;
  text-align: left;
  pointer-events: none;
  border-left: 1px solid rgba(198, 154, 91, 0.52);
  text-shadow: 0 2px 22px rgba(5, 6, 12, 0.82);
  z-index: 10;
}
.sky-kicker { margin: 0 0 8px; font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: #cfad78; }
.sky-caption h1 { margin: 0 0 9px; font-weight: 400; font-size: clamp(22px, 2.5vw, 34px); letter-spacing: 0.01em; color: var(--paper); }
.sky-note { margin: 0; max-width: 440px; font-size: 13px; line-height: 1.6; color: #bbb6cb; font-style: italic; }

.star-info {
  position: absolute;
  right: clamp(24px, 6vw, 84px);
  bottom: clamp(80px, 11vh, 118px);
  transform: translateY(18px);
  width: min(370px, calc(100vw - 48px));
  padding: 26px 28px 24px;
  background: rgba(13, 12, 19, 0.91);
  backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid rgba(198, 154, 91, 0.42);
  border-radius: 1px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), inset 0 0 0 4px rgba(255,255,255,.018);
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.42s ease, transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear .42s;
  z-index: 30;
}
.star-info::before { content: "FIELD NOTE"; display: block; margin-bottom: 9px; color: var(--brass); font-size: 9px; letter-spacing: .24em; }
.star-info.visible { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); transition-delay: 0s; }
.si-name { margin: 0 0 8px; font-size: 20px; letter-spacing: 0.02em; color: var(--paper); }
.si-note { margin: 0; font-size: 13px; line-height: 1.7; font-style: italic; color: var(--paper-muted); white-space: pre-line; }
.si-note:empty { display: none; }
.si-close { position: absolute; top: 9px; right: 11px; background: none; border: 0; color: #918a9f; font-size: 19px; cursor: pointer; line-height: 1; padding: 6px; }
.si-close:hover { color: var(--paper); }

.page-light {
  position: fixed;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,226,178,1) 0%, rgba(255,226,178,.55) 34%, rgba(255,226,178,0) 72%);
  box-shadow: 0 0 24px 6px rgba(255,214,150,.55);
  pointer-events: none;
  z-index: 1000;
  transform: translate(var(--lx, 50vw), var(--ly, 50vh)) scale(var(--lscale, 1));
  will-change: transform, opacity;
}

.page-transition { position: fixed; inset: 0; background: var(--ink); z-index: 999; opacity: 1; pointer-events: none; transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1); }
.page-transition.hidden { opacity: 0; }
main { transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), filter 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s ease; transform: scale(1); filter: blur(0); opacity: 1; }
main.scene-exit { transform: scale(0.975); filter: blur(7px); opacity: 0.42; }
main.scene-enter { transform: scale(1.025); filter: blur(7px); opacity: 0; }

.field-nav { position: fixed; top: 50%; left: 22px; transform: translateY(-50%); z-index: 50; }
.field-nav ol { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.field-nav-item { display: flex; align-items: center; gap: 10px; width: 110px; height: 28px; padding: 0; border: 0; background: transparent; color: #777283; text-align: left; cursor: pointer; }
.field-nav-mark { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid rgba(244, 235, 221, .18); border-radius: 50%; font-size: 8px; transition: color .3s ease, border-color .3s ease, background .3s ease; }
.field-nav-label { font-size: 9px; letter-spacing: .13em; text-transform: uppercase; opacity: 0; transform: translateX(-4px); transition: opacity .3s ease, transform .3s ease; }
.field-nav:hover .field-nav-label,
.field-nav-item:focus-visible .field-nav-label,
.field-nav-item[aria-current="page"] .field-nav-label { opacity: 1; transform: none; }
.field-nav-item[data-reached="true"] { color: #ae9875; }
.field-nav-item[aria-current="page"] { color: var(--paper); }
.field-nav-item[aria-current="page"] .field-nav-mark { border-color: var(--brass); background: rgba(198,154,91,.14); box-shadow: 0 0 18px rgba(198,154,91,.16); }

.continue-arrow { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 96px; padding: 8px 14px; border: 0; background: transparent; color: var(--paper); cursor: pointer; z-index: 40; }
.continue-label { font-size: 8px; letter-spacing: .2em; text-transform: uppercase; color: #a89f90; }
.continue-chevron { display: block; font-size: 15px; animation: continue-drift 2.8s ease-in-out infinite; }
.continue-arrow:hover .continue-label { color: var(--paper); }
@keyframes continue-drift { 0%, 100% { transform: translateY(0); opacity: .55; } 50% { transform: translateY(4px); opacity: 1; } }

.soundtrack-toggle {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 52;
  display: grid;
  grid-template-columns: 22px auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  min-width: 76px;
  padding: 8px 11px 8px 9px;
  border: 1px solid rgba(244,235,221,.14);
  border-radius: 1px;
  background: rgba(7,7,11,.46);
  backdrop-filter: blur(8px);
  color: #c8bdad;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.soundtrack-toggle:hover { border-color: rgba(198,154,91,.45); background: rgba(7,7,11,.68); }
.soundtrack-glyph { grid-row: 1 / 3; display: flex; align-items: center; justify-content: center; gap: 2px; width: 22px; height: 20px; }
.soundtrack-glyph i { display: block; width: 1px; height: 5px; background: #ad936c; transform-origin: center; }
.soundtrack-toggle.playing .soundtrack-glyph i:nth-child(1) { animation: sound-pulse .9s ease-in-out infinite; }
.soundtrack-toggle.playing .soundtrack-glyph i:nth-child(2) { animation: sound-pulse .9s .18s ease-in-out infinite; }
.soundtrack-toggle.playing .soundtrack-glyph i:nth-child(3) { animation: sound-pulse .9s .36s ease-in-out infinite; }
.soundtrack-name { align-self: end; font-size: 10px; line-height: 1; font-style: italic; }
.soundtrack-state { align-self: start; margin-top: 3px; color: #746f79; font-size: 7px; line-height: 1; letter-spacing: .14em; text-transform: uppercase; }
.soundtrack-toggle.needs-resume { border-color: rgba(198,154,91,.42); }
@keyframes sound-pulse { 0%,100% { transform: scaleY(.7); opacity: .6; } 50% { transform: scaleY(2.1); opacity: 1; } }

@media (max-width: 720px) {
  .sky-caption { top: 25px; left: 22px; width: calc(100vw - 44px); padding-left: 13px; }
  .sky-note { font-size: 12px; max-width: 84vw; }
  .water-plate .sky-caption { width: 68vw; }
  .star-info { left: 50%; right: auto; bottom: 78px; transform: translate(-50%, 18px); }
  .star-info.visible { transform: translate(-50%, 0); }
  .field-nav { top: auto; bottom: 15px; left: 18px; right: 18px; transform: none; }
  .field-nav ol { flex-direction: row; justify-content: space-between; }
  .field-nav-item { width: 34px; height: 34px; }
  .field-nav-label { display: none; }
  .continue-arrow { bottom: 52px; }
  .soundtrack-toggle { top: auto; right: 18px; bottom: 60px; min-width: 68px; padding: 7px 9px 7px 7px; }
}

@media (prefers-reduced-motion: reduce) {
  main, main.scene-exit, main.scene-enter { transition: none; transform: none; filter: none; opacity: 1; }
  .continue-chevron { animation: none; }
  .soundtrack-toggle.playing .soundtrack-glyph i { animation: none; }
  .page-transition, .star-info, .field-nav-mark { transition: none; }
  .page-light { display: none; }
  body::after { display: none; }
}
