/* ——— Jacaranda Journal: interactive editorial plate ——— */

@font-face {
  font-family: "Instrument Serif";
  src: url("./vendor/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("./vendor/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("./vendor/fonts/manrope-latin-300-normal.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("./vendor/fonts/manrope-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("./vendor/fonts/manrope-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("./vendor/fonts/manrope-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f2ece2;
  --paper-deep: #ebe2d4;
  --ink: #2e2a26;
  --ink-soft: #6f655b;
  --ink-faint: #9a8f83;
  --line: rgba(46, 42, 38, 0.16);
  --line-strong: rgba(46, 42, 38, 0.32);
  --accent: #7665a5;
  --warm: #a97542;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Manrope", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --stage-ink: #38322c;
  --stage-ink-soft: rgba(56, 50, 44, 0.62);
  --stage-paper: rgba(244, 237, 226, 0.88);
  --stage-line: rgba(56, 50, 44, 0.22);
  --dock-bg: rgba(244, 237, 226, 0.82);
  --dock-ink: #342f29;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
}

body {
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body[data-time="dusk"] {
  --stage-ink: #3d332d;
  --stage-ink-soft: rgba(61, 51, 45, 0.7);
  --stage-paper: rgba(244, 233, 219, 0.9);
  --stage-line: rgba(61, 51, 45, 0.24);
}
body[data-time="night"] {
  --stage-ink: #f2e9db;
  --stage-ink-soft: rgba(242, 233, 219, 0.62);
  --stage-paper: rgba(18, 24, 38, 0.64);
  --stage-line: rgba(242, 233, 219, 0.26);
}

button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: #cfc4e6; color: #241f30; }

.spread {
  display: flex;
  height: 100vh;
  height: 100dvh;
  background: var(--paper);
}

/* ——— Editorial column ——— */

.editorial {
  position: relative;
  z-index: 4;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  width: clamp(326px, 34.2vw, 660px);
  min-width: 0;
  padding: clamp(24px, 3vw, 50px) clamp(24px, 3.1vw, 54px) clamp(20px, 2.3vw, 36px);
  border-right: 1px solid var(--line);
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(255, 252, 246, 0.72) 0%, rgba(255, 252, 246, 0) 58%),
    linear-gradient(160deg, #f6f0e7 0%, var(--paper) 52%, #efe7db 100%);
  overflow: hidden;
  transition: width .78s cubic-bezier(.22,.8,.2,1), padding .78s cubic-bezier(.22,.8,.2,1), opacity .48s ease, transform .78s cubic-bezier(.22,.8,.2,1), border-color .4s ease;
}

.spread.is-story-hidden .editorial {
  width: 0;
  min-width: 0;
  padding: 0;
  border-right-color: transparent;
  border-right-width: 0;
  opacity: 0;
  transform: translateX(-18px);
  pointer-events: none;
}

.editorial::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(78, 64, 50, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(78, 64, 50, 0.022) 1px, transparent 1px);
  background-size: 100% 8px, 8px 100%;
  mix-blend-mode: multiply;
}

.editorial > * { position: relative; }

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--serif);
  font-size: clamp(24px, 1.8vw, 30px);
  line-height: 1;
  letter-spacing: 0.005em;
  color: var(--ink);
}
.wordmark-flower {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  color: var(--accent);
  transition: transform 1.4s cubic-bezier(.22,.8,.2,1);
}
.wordmark:hover .wordmark-flower { transform: rotate(45deg); }
.wordmark-flower svg { width: 100%; height: 100%; }

.issue {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: right;
  color: var(--ink-soft);
  white-space: nowrap;
}

.hairline {
  height: 1px;
  margin: clamp(20px, 2.4vw, 32px) 0 0;
  background: var(--line);
}

.hero-copy {
  padding-top: clamp(20px, 3.2vh, 40px);
}

.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 clamp(10px, 1.6vh, 20px);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.23em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.kicker span + span {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.kicker span + span::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--line-strong);
}

h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(64px, 6.05vw, 102px);
  line-height: 0.84;
  letter-spacing: -0.028em;
}
h1 em {
  font-weight: 400;
  color: #594b7f;
  letter-spacing: -0.02em;
}
h1 .period { color: var(--accent); }

.dek {
  max-width: 33ch;
  margin: clamp(20px, 2.8vh, 32px) 0 0;
  font-family: var(--serif);
  font-size: clamp(18px, 1.32vw, 22px);
  line-height: 1.34;
  letter-spacing: 0.002em;
  color: #4d453d;
}

.body-copy {
  max-width: 35ch;
  margin-top: clamp(14px, 2vh, 24px);
  padding-top: clamp(12px, 1.7vh, 18px);
  border-top: 1px solid var(--line);
  font-size: clamp(10.5px, 0.73vw, 12px);
  font-weight: 400;
  line-height: 1.8;
  color: var(--ink-soft);
}
.body-copy p { margin: 0 0 0.7em; }
.body-copy p:last-child { margin-bottom: 0; }

.details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: auto;
  padding-top: clamp(20px, 4vh, 42px);
}
.detail { display: flex; flex-direction: column; gap: 7px; }
.detail-label {
  font-size: 7.7px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.detail-value {
  font-family: var(--serif);
  font-size: clamp(13px, 0.92vw, 15px);
  line-height: 1.18;
  color: #4b433a;
}

.editorial-foot {
  margin-top: clamp(20px, 3.4vh, 38px);
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 16px;
  font-size: 8px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.note-dot {
  flex: 0 0 auto;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.folio {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ——— Stage ——— */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, #dfe8e8 0%, #f1e9dd 100%);
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  cursor: grab;
  touch-action: none;
}
#scene:active { cursor: grabbing; }

.stage-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(40, 33, 28, 0.10) 0%, rgba(40, 33, 28, 0) 17%, rgba(40, 33, 28, 0) 78%, rgba(40, 33, 28, 0.18) 100%),
    radial-gradient(120% 90% at 54% 44%, transparent 52%, rgba(28, 25, 23, 0.16) 100%);
  mix-blend-mode: multiply;
}

.stage-grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  mix-blend-mode: multiply;
}

.stage-head {
  position: absolute;
  z-index: 5;
  top: clamp(20px, 2.6vw, 34px);
  left: clamp(20px, 2.8vw, 40px);
  right: clamp(20px, 2.8vw, 40px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  pointer-events: none;
  color: var(--stage-ink);
  text-shadow: 0 1px 14px rgba(255, 250, 240, 0.25);
}
body[data-time="night"] .stage-head { text-shadow: 0 1px 12px rgba(0, 0, 0, 0.3); }
.stage-index {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.stage-index-rule {
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.46;
}
.stage-coords {
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  opacity: 0.8;
  white-space: nowrap;
}

.story-toggle,
.reset-view {
  position: absolute;
  z-index: 6;
  top: clamp(48px, 5.6vw, 78px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--stage-line);
  border-radius: 2px;
  background: var(--stage-paper);
  color: var(--stage-ink);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background .3s ease, color .3s ease;
}

.story-toggle { left: clamp(20px, 2.8vw, 40px); }
.story-toggle svg { width: 13px; height: 13px; transition: transform .6s cubic-bezier(.22,.8,.2,1); }
.spread.is-story-hidden .story-toggle svg { transform: rotate(180deg); }
.story-toggle:hover,
.reset-view:hover { background: rgba(255, 252, 246, 0.94); }
body[data-time="night"] .story-toggle:hover,
body[data-time="night"] .reset-view:hover { background: rgba(34, 46, 65, 0.9); }

.reset-view {
  right: clamp(20px, 2.8vw, 40px);
  opacity: 0;
  transform: translateY(-3px);
  pointer-events: none;
  transition: opacity .5s ease, transform .5s ease, background .3s ease;
}
.reset-view svg { width: 12px; height: 12px; }
.reset-view.is-visible { opacity: 1; transform: none; pointer-events: auto; }

.hour-dock {
  position: absolute;
  z-index: 6;
  left: clamp(20px, 2.8vw, 40px);
  bottom: clamp(20px, 3vw, 38px);
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.4vw, 20px);
  padding: 10px 15px 9px;
  border: 1px solid var(--stage-line);
  border-radius: 2px;
  background: var(--dock-bg);
  color: var(--dock-ink);
  box-shadow: 0 14px 38px rgba(48, 38, 30, 0.07);
  backdrop-filter: blur(16px) saturate(1.05);
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
}
.hour-label {
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(52, 47, 41, 0.48);
  white-space: nowrap;
}
.hour-options { display: flex; align-items: center; gap: 2px; }
.hour-btn {
  position: relative;
  padding: 4px 8px 5px;
  border: 0;
  border-radius: 1px;
  background: transparent;
  color: rgba(52, 47, 41, 0.55);
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color .35s ease, background .35s ease;
}
.hour-btn::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 1px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .4s cubic-bezier(.22,.8,.2,1);
}
.hour-btn:hover { color: var(--dock-ink); }
.hour-btn.is-active { color: var(--dock-ink); }
.hour-btn.is-active::after { transform: scaleX(1); }
.hour-btn:focus-visible,
.weather-btn:focus-visible,
.story-toggle:focus-visible,
.reset-view:focus-visible,
.wordmark:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }

.hour-divider {
  width: 1px;
  height: 16px;
  margin: 0 1px;
  background: rgba(52, 47, 41, 0.16);
}

.weather-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 1px;
  padding: 4px 7px 5px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: rgba(52, 47, 41, 0.58);
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color .3s ease, background .3s ease, border-color .3s ease;
}
.weather-btn svg { width: 12px; height: 12px; opacity: 0.72; transition: opacity .3s ease; }
.weather-btn:hover { color: var(--dock-ink); background: rgba(52, 47, 41, 0.055); }
.weather-btn.is-active {
  border-color: rgba(62, 87, 98, 0.22);
  background: rgba(62, 87, 98, 0.1);
  color: #314b57;
}
.weather-btn.is-active svg { opacity: 1; }

.stage-foot {
  position: absolute;
  z-index: 5;
  left: clamp(20px, 2.8vw, 40px);
  right: clamp(20px, 2.8vw, 40px);
  bottom: calc(clamp(20px, 3vw, 38px) + 62px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
  color: var(--stage-ink);
  opacity: 1;
  transition: opacity .7s ease;
}
.orbit-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(246, 239, 229, 0.16);
  border-radius: 2px;
  background: rgba(28, 28, 23, 0.3);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(247, 240, 230, 0.9);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.42);
  transition: opacity .8s ease;
}
.orbit-hint svg { width: 24px; height: 16px; opacity: 0.72; }
.orbit-hint.is-dim { opacity: 0; }
.hint-mobile { display: none; }
@media (max-width: 860px) {
  .hint-desktop { display: none; }
  .hint-mobile { display: inline; }
}
.stage-caption {
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: 300px;
  padding: 8px 11px;
  border: 1px solid rgba(246, 239, 229, 0.2);
  background: rgba(28, 28, 23, 0.3);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  text-align: right;
}
.caption-rule { width: 26px; height: 1px; background: rgba(248, 241, 231, 0.6); opacity: 0.7; flex: 0 0 auto; }
.stage-caption p {
  margin: 0;
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.26;
  font-style: italic;
  color: rgba(248, 241, 231, 0.94);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

/* ——— Loading / error ——— */

.loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: linear-gradient(165deg, #eef1ec 0%, #f2eadf 100%);
  transition: opacity .65s cubic-bezier(.4,0,.2,1), visibility .65s;
}
.loading.is-done { opacity: 0; visibility: hidden; }
.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px;
}
.loading-kicker {
  margin: 0;
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #7d7164;
}
.loading-title {
  margin-top: 15px;
  font-family: var(--serif);
  font-size: 31px;
  line-height: 1;
  color: #3a342d;
}
.loading-line {
  display: block;
  width: 132px;
  height: 1px;
  margin: 23px 0 13px;
  overflow: hidden;
  background: rgba(58, 52, 45, 0.15);
}
.loading-line i {
  display: block;
  width: 100%;
  height: 100%;
  background: #51456f;
  transform: scaleX(.04);
  transform-origin: left;
  transition: transform .5s ease;
}
.loading-meta {
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: #968a7d;
}

.webgl-error {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  background: #f2ece2;
}
.webgl-error-title {
  margin: 14px 0 9px;
  font-family: var(--serif);
  font-size: 34px;
  color: var(--ink);
}
.webgl-error-body { max-width: 34ch; margin: 0; font-size: 12px; line-height: 1.7; color: var(--ink-soft); }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  background: var(--paper);
  font-family: var(--serif);
  font-size: 24px;
}

.stage-head {
  transition: opacity .65s ease, transform .95s cubic-bezier(.16,.84,.24,1);
}
.story-toggle {
  transition: opacity .65s ease .15s, transform .95s cubic-bezier(.16,.84,.24,1) .15s, background .3s ease, color .3s ease;
}
.hour-dock {
  transition: opacity .7s ease .32s, transform .95s cubic-bezier(.16,.84,.24,1) .32s;
}
.stage-foot {
  transition: opacity .7s ease .28s, transform .95s cubic-bezier(.16,.84,.24,1) .28s;
}
html:not(.is-ready) .stage-head,
html:not(.is-ready) .story-toggle,
html:not(.is-ready) .hour-dock,
html:not(.is-ready) .stage-foot {
  opacity: 0;
  transform: translateY(12px) scale(.965);
}

/* ——— Small viewports ——— */

@media (max-width: 1120px) {
  .editorial { width: 35.5vw; }
  h1 { font-size: clamp(58px, 6vw, 78px); }
  .body-copy { max-width: 32ch; }
}

@media (max-width: 860px) {
  body { overflow-x: hidden; overflow-y: auto; }
  .spread {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
  }
  .stage {
    order: 1;
    height: 65dvh;
    min-height: 430px;
    flex: 0 0 auto;
  }
  .editorial {
    order: 2;
    flex: 0 0 auto;
    width: 100%;
    padding: 30px 24px calc(30px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
    min-height: 35dvh;
  }
  .spread.is-story-hidden .stage { height: 100dvh; min-height: 100dvh; }
  .spread.is-story-hidden .editorial { display: none; }
  .masthead { align-items: baseline; }
  .wordmark { font-size: 25px; }
  .hero-copy { padding-top: 24px; }
  h1 { font-size: clamp(64px, 16vw, 92px); }
  .dek { max-width: 36ch; font-size: 20px; }
  .body-copy { max-width: 42ch; font-size: 11.5px; }
  .details { margin-top: 32px; padding-top: 0; }
  .editorial-foot { margin-top: 26px; }
  .stage-head { top: 18px; left: 18px; right: 18px; }
  .stage-coords { display: none; }
  .story-toggle,
  .reset-view { top: 46px; }
  .story-toggle { left: 18px; }
  .reset-view { right: 18px; }
  .hour-dock { left: 18px; bottom: 18px; gap: 9px; padding: 9px 12px 8px; }
  .hour-label { display: none; }
  .stage-foot { left: 18px; right: 18px; bottom: 78px; }
  .stage-caption { display: none; }
}

@media (max-width: 420px) {
  .stage { height: 62dvh; min-height: 380px; }
  h1 { font-size: 60px; }
  .details { gap: 8px; }
  .detail-value { font-size: 12px; }
  .hour-btn { padding-inline: 6px; font-size: 9px; }
  .stage-foot { bottom: 72px; }
  .orbit-hint span { letter-spacing: 0.11em; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .wordmark-flower { transition: none; }
  .loading { transition: opacity .2s ease; }
  .editorial { transition: none; }
  .story-toggle svg { transition: none; }
  html:not(.is-ready) .stage-head,
  html:not(.is-ready) .story-toggle,
  html:not(.is-ready) .hour-dock,
  html:not(.is-ready) .stage-foot {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
[hidden] { display: none !important; }
