:root {
  --console-night: #101820;
  --oxidized-teal: #1F6F6A;
  --verdigris: #3D8C7A;
  --orbital-blue: #4E7896;
  --moonstone: #E9DDC4;
  --amber: #C98A2E;
  --charcoal: #26211C;
  --jade-shadow: #294B47;
  --serif: "Cormorant Garamond", serif;
  --body: "Libre Baskerville", serif;
  --mono: "IBM Plex Mono", monospace;
  /* compliance token: Mono** */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--moonstone);
  background:
    radial-gradient(circle at 18% 8%, rgba(78, 120, 150, .22), transparent 31rem),
    radial-gradient(circle at 82% 72%, rgba(31, 111, 106, .18), transparent 35rem),
    linear-gradient(135deg, var(--console-night), #0a0f14 62%, var(--charcoal));
  font-family: var(--body);
  overflow-x: hidden;
}

.grain,
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.grain {
  opacity: .34;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(233, 221, 196, .11) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(201, 138, 46, .09) 0 1px, transparent 1px),
    linear-gradient(115deg, transparent, rgba(233, 221, 196, .04), transparent);
  background-size: 29px 31px, 41px 37px, 100% 100%;
  mix-blend-mode: screen;
}

.scanlines {
  opacity: .18;
  background: repeating-linear-gradient(to bottom, rgba(233, 221, 196, .08) 0 1px, transparent 1px 5px);
}

.orbital-reliquary { position: relative; }

.sector-tabs {
  position: fixed;
  top: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  gap: .7rem;
  padding: .55rem .8rem;
  border: 1px solid rgba(233, 221, 196, .18);
  border-radius: 999px;
  background: rgba(16, 24, 32, .72);
  box-shadow: inset 0 0 18px rgba(201, 138, 46, .08), 0 12px 45px rgba(0, 0, 0, .35);
  backdrop-filter: blur(10px);
}

.sector-tabs span {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .11em;
  color: rgba(233, 221, 196, .58);
  white-space: nowrap;
}

.sector-tabs span.current { color: var(--amber); text-shadow: 0 0 12px rgba(201, 138, 46, .8); }

.scene {
  position: relative;
  min-height: 165vh;
}

.scene-open { min-height: 110vh; }

.sticky-console {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  padding: clamp(5rem, 7vw, 7rem) clamp(1.1rem, 4vw, 4.5rem) clamp(1rem, 3vw, 3rem);
}

.bento-grid,
.split-console,
.cartographer-console,
.end-console {
  display: grid;
  gap: clamp(.8rem, 1.5vw, 1.25rem);
}

.bento-tile {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(233, 221, 196, .19);
  border-radius: 28px;
  padding: clamp(1rem, 2vw, 1.55rem);
  background:
    linear-gradient(135deg, rgba(233, 221, 196, .08), rgba(41, 75, 71, .18)),
    rgba(16, 24, 32, .76);
  box-shadow:
    inset 0 1px 0 rgba(233, 221, 196, .18),
    inset 0 -35px 55px rgba(0, 0, 0, .22),
    0 28px 70px rgba(0, 0, 0, .36);
  transform-style: preserve-3d;
  transition: transform .55s ease, border-color .55s ease, filter .55s ease;
}

.bento-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 9%, rgba(201, 138, 46, .18) 9.3%, transparent 9.6%, transparent 54%, rgba(31, 111, 106, .2) 54.2%, transparent 54.5%),
    repeating-linear-gradient(28deg, transparent 0 32px, rgba(233, 221, 196, .045) 33px 34px);
  opacity: .48;
  pointer-events: none;
}

.bento-tile:hover { border-color: rgba(201, 138, 46, .52); filter: brightness(1.08); }

.marble-tile {
  color: var(--charcoal);
  background:
    radial-gradient(circle at 24% 12%, rgba(233, 221, 196, .95), rgba(233, 221, 196, .5) 28%, transparent 52%),
    linear-gradient(125deg, rgba(233, 221, 196, .92), rgba(61, 140, 122, .5) 42%, rgba(78, 120, 150, .42)),
    repeating-linear-gradient(145deg, rgba(38, 33, 28, .15) 0 1px, transparent 1px 19px);
}

.parchment-tile { background: linear-gradient(135deg, rgba(233, 221, 196, .14), rgba(16, 24, 32, .84)); }

.mono-label {
  position: relative;
  z-index: 1;
  margin: 0 0 .7rem;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--amber);
}

h1,
h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  line-height: .92;
  letter-spacing: .025em;
}

h1 { font-size: clamp(4.4rem, 11vw, 12.5rem); max-width: 980px; }
h2 { font-size: clamp(2rem, 4.6vw, 5.4rem); }

p,
strong,
button { position: relative; z-index: 1; }

p { line-height: 1.75; font-size: clamp(.92rem, 1.1vw, 1.08rem); }

.intro-copy { max-width: 620px; color: rgba(233, 221, 196, .78); }

.ring-arc {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: drop-shadow(0 0 35px rgba(61, 140, 122, .28));
}

.ring-arc-hero {
  width: min(86vw, 1050px);
  aspect-ratio: 1;
  right: -18vw;
  top: -28vh;
  border: clamp(42px, 8vw, 116px) solid transparent;
  background:
    radial-gradient(circle, transparent 55%, rgba(233, 221, 196, .72) 56%, rgba(61, 140, 122, .44) 62%, rgba(78, 120, 150, .22) 68%, transparent 69%),
    conic-gradient(from 20deg, transparent, rgba(201, 138, 46, .36), rgba(61, 140, 122, .72), rgba(233, 221, 196, .78), transparent 75%);
  mask: radial-gradient(circle, transparent 50%, #000 51% 68%, transparent 69%);
  opacity: .83;
  animation: resolveRing 8s ease-in-out infinite alternate;
}

.ring-arc-hero::after,
.full-ring::after {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 10deg, rgba(201, 138, 46, .42) 0 1deg, transparent 1deg 11deg);
  mask: radial-gradient(circle, transparent 54%, #000 55% 57%, transparent 58%);
}

@keyframes resolveRing {
  from { opacity: .46; transform: rotate(-4deg) scale(.985); }
  to { opacity: .92; transform: rotate(3deg) scale(1.02); }
}

.circuit-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .78;
  pointer-events: none;
}

.circuit-path {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: calc(1200 - (1200 * var(--progress, 0)));
  filter: drop-shadow(0 0 7px rgba(201, 138, 46, .65));
}

.circuit-path.delay { stroke: var(--verdigris); stroke-width: 1.5; }
.circuit-path.slow { stroke: var(--orbital-blue); stroke-width: 1.2; }

.title-block {
  max-width: 1080px;
  margin: 0 0 1.1rem;
}

.boot-grid {
  grid-template-columns: 1.1fr .9fr .72fr 1.05fr;
  grid-template-rows: minmax(150px, 1fr) minmax(150px, 1fr);
  max-width: 1180px;
}

.tile-sector { grid-column: 1 / 2; grid-row: 1 / 3; }
.tile-relic { grid-column: 2 / 4; }
.tile-signal { grid-column: 4; min-height: 150px; }
.tile-horizon { grid-column: 2; }
.tile-log { grid-column: 3 / 5; }

.boot-tile,
.map-card,
.artifact-card,
.stone-slab,
.horizon-inscription,
.dim-panel {
  opacity: 0;
  transform: translateY(28px) scale(.98);
}

.is-visible .boot-tile,
.is-visible .map-card,
.is-visible .artifact-card,
.is-visible .stone-slab,
.is-visible .horizon-inscription,
.is-visible .dim-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity .9s ease, transform .9s ease, filter .55s ease, border-color .55s ease;
}

.is-visible .boot-tile:nth-child(2), .is-visible .artifact-card:nth-child(2), .is-visible .map-b { transition-delay: .12s; }
.is-visible .boot-tile:nth-child(3), .is-visible .artifact-card:nth-child(3), .is-visible .map-c { transition-delay: .24s; }
.is-visible .boot-tile:nth-child(4), .is-visible .map-d { transition-delay: .36s; }
.is-visible .boot-tile:nth-child(5), .is-visible .map-e { transition-delay: .48s; }

.lamp,
.last-lamp {
  display: inline-block;
  width: .82rem;
  height: .82rem;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 20px rgba(201, 138, 46, .72), inset 0 0 5px rgba(233, 221, 196, .7);
  animation: lampPulse 2.8s ease-in-out infinite;
}

.lamp:not(.active) { opacity: .48; animation-duration: 4.5s; }

@keyframes lampPulse { 50% { transform: scale(.78); opacity: .55; box-shadow: 0 0 8px rgba(201, 138, 46, .36); } }

.small-card strong {
  display: block;
  font-family: var(--mono);
  font-size: clamp(1.4rem, 3vw, 2.5rem);
  color: var(--moonstone);
}

.viewport-tile { background: radial-gradient(ellipse at 50% 28%, rgba(78, 120, 150, .36), transparent 55%), rgba(16, 24, 32, .78); }

.mini-ring,
.astrolabe {
  width: min(70%, 210px);
  aspect-ratio: 1;
  margin: .4rem auto 1rem;
  border: 2px solid rgba(201, 138, 46, .72);
  border-radius: 50%;
  background: radial-gradient(circle, transparent 45%, rgba(233, 221, 196, .25) 46% 49%, transparent 50%), conic-gradient(from 0deg, transparent, rgba(31, 111, 106, .55), transparent 34%, rgba(201, 138, 46, .5), transparent 68%);
}

.split-console {
  grid-template-columns: 1.2fr .8fr;
  align-items: center;
}

.chapter-mark {
  position: absolute;
  top: 6rem;
  right: 5vw;
  font-family: var(--serif);
  font-size: clamp(6rem, 16vw, 17rem);
  color: rgba(233, 221, 196, .05);
  font-style: italic;
}

.stone-slab { min-height: 62vh; padding: clamp(1.4rem, 4vw, 4rem); }

.trace-board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .8rem;
  margin-top: 2rem;
}

.trace-board span {
  height: 72px;
  border: 1px solid rgba(38, 33, 28, .24);
  border-radius: 16px;
  background: linear-gradient(90deg, transparent 48%, rgba(201, 138, 46, .5) 49% 51%, transparent 52%), radial-gradient(circle at 50% 50%, rgba(31, 111, 106, .38), transparent 42%);
}

.artifact-stack { display: grid; gap: 1rem; }
.artifact-card { min-height: 26vh; }

.glyph { position: relative; z-index: 1; height: 70px; margin: .6rem 0; }
.glyph::before, .glyph::after { content: ""; position: absolute; border: 2px solid var(--amber); }
.key-orbit::before { width: 58px; height: 58px; border-radius: 50%; left: 10%; }
.key-orbit::after { width: 120px; height: 2px; border-width: 0 0 2px; left: 62px; top: 30px; }
.aperture::before { width: 72px; height: 72px; border-radius: 50%; left: 15%; box-shadow: inset 0 0 0 18px rgba(31, 111, 106, .35); }
.aperture::after { width: 150px; height: 42px; border-radius: 50%; left: 54px; top: 14px; transform: rotate(-12deg); }
.rover::before { width: 135px; height: 32px; border-radius: 30px 30px 8px 8px; left: 10%; top: 14px; }
.rover::after { width: 150px; height: 2px; border-width: 0 0 2px; left: 9%; top: 58px; }

.cartographer-console {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(5, 1fr);
}

.ellipse-gap {
  position: absolute;
  left: 50%;
  top: 52%;
  width: min(62vw, 760px);
  height: min(35vw, 360px);
  transform: translate(-50%, -50%) rotate(-8deg);
  border-radius: 50%;
  border: 1px dashed rgba(233, 221, 196, .22);
  background: radial-gradient(ellipse, rgba(16, 24, 32, .9), rgba(16, 24, 32, .18) 58%, transparent 70%);
  box-shadow: inset 0 0 70px rgba(0,0,0,.55), 0 0 50px rgba(31,111,106,.18);
}

.map-card { z-index: 1; }
.map-a { grid-column: 1 / 4; grid-row: 1 / 3; }
.map-b { grid-column: 5 / 7; grid-row: 1 / 4; }
.map-c { grid-column: 1 / 3; grid-row: 4 / 6; }
.map-d { grid-column: 3 / 5; grid-row: 4 / 6; }
.map-e { grid-column: 5 / 7; grid-row: 4 / 6; }

.horizon-console { padding: 0; display: grid; place-items: center; }

.full-ring {
  position: absolute;
  width: 130vw;
  height: 130vw;
  border-radius: 50%;
  top: 36vh;
  left: -15vw;
  background:
    radial-gradient(circle, transparent 51%, rgba(233, 221, 196, .8) 52%, rgba(61, 140, 122, .72) 56%, rgba(78, 120, 150, .35) 62%, transparent 63%),
    conic-gradient(from 150deg, rgba(78, 120, 150, .35), rgba(233, 221, 196, .82), rgba(31, 111, 106, .58), rgba(201, 138, 46, .32), rgba(78, 120, 150, .35));
  mask: radial-gradient(circle, transparent 48%, #000 49% 63%, transparent 64%);
  animation: horizonDrift 10s ease-in-out infinite alternate;
}

@keyframes horizonDrift { to { transform: translateY(-5vh) rotate(5deg); } }

.horizon-inscription {
  max-width: 900px;
  margin: 0 1rem;
  padding: clamp(1.4rem, 4vw, 4rem);
  border: 1px solid rgba(233, 221, 196, .18);
  border-radius: 34px;
  background: rgba(16, 24, 32, .55);
  box-shadow: 0 30px 120px rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
}

.end-console { place-items: center; }
.dim-panel { max-width: 780px; text-align: center; }
.dim-panel span { color: var(--amber); font-family: var(--mono); }

.relic-button {
  margin-top: 1rem;
  border: 1px solid rgba(201, 138, 46, .7);
  border-radius: 999px;
  padding: .9rem 1.25rem;
  color: var(--moonstone);
  background: radial-gradient(circle at 20% 20%, rgba(201, 138, 46, .32), rgba(16, 24, 32, .85));
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .12em;
  cursor: pointer;
}

.end-console.is-turned .dim-panel { border-color: rgba(201, 138, 46, .82); box-shadow: 0 0 90px rgba(201, 138, 46, .22); }
.end-console.is-turned .last-lamp { transform: scale(1.45); }

@media (max-width: 900px) {
  .sector-tabs { max-width: calc(100vw - 1rem); overflow: hidden; }
  .sector-tabs span { display: none; }
  .sector-tabs span.current { display: inline; }
  .boot-grid,
  .split-console,
  .cartographer-console { grid-template-columns: 1fr; grid-template-rows: auto; }
  .tile-sector,
  .tile-relic,
  .tile-signal,
  .tile-horizon,
  .tile-log,
  .map-a,
  .map-b,
  .map-c,
  .map-d,
  .map-e { grid-column: auto; grid-row: auto; }
  .sticky-console { overflow-y: auto; }
  .ellipse-gap { width: 80vw; height: 42vh; }
  .full-ring { width: 170vw; height: 170vw; left: -35vw; }
}
