/* ==========================================================================
   Kukulu Labs LLC — Kīlauea 3-Act Scroll Architecture
   Aesthetic: Igloo Inc. × Arc'teryx System_0 × Synchronized Studio
   Default: Mauna Kea Chalk Mist (#cfd3d7) + Charcoal Ink (#101214)
   Dynamic Eruption Invert (.erupt-invert): HUD text smoothly turns bright
   chalk while the sky darkens into volcanic twilight during Act II!
   ========================================================================== */

:root,
:root[data-tone="light"] {
  --bg: #cfd3d7;
  --bg-solid: #d5d8dc;
  --bg-hover: rgba(16, 18, 20, 0.045);
  --ink: #101214;
  --ink-dim: #3d4249;
  --ink-faint: #555b63;
  --line: rgba(16, 18, 20, 0.16);
  --line-strong: rgba(16, 18, 20, 0.34);
  --accent: #e0481e;
  --hud-bg: rgba(212, 216, 220, 0.62);

  /* Stage-only typography tokens (auto-invert during Act II Eruption twilight) */
  --stage-ink: #101214;
  --stage-dim: #2f343b;
  --stage-line: rgba(16, 18, 20, 0.24);
  --stage-pill: rgba(216, 220, 224, 0.72);
  --stage-btn-ink: #f4f5f6;
}

:root[data-tone="light"].erupt-invert {
  --stage-ink: #f4f1ec;
  --stage-dim: #c9c2ba;
  --stage-line: rgba(244, 241, 236, 0.26);
  --stage-pill: rgba(16, 13, 12, 0.66);
  --stage-btn-ink: #101214;
}

:root[data-tone="dark"] {
  --bg: #090a0c;
  --bg-solid: #0d0f12;
  --bg-hover: rgba(234, 237, 240, 0.045);
  --ink: #eaedf0;
  --ink-dim: #9aa1aa;
  --ink-faint: #656c75;
  --line: rgba(234, 237, 240, 0.14);
  --line-strong: rgba(234, 237, 240, 0.32);
  --accent: #f25a2b;
  --hud-bg: rgba(11, 13, 16, 0.66);

  --stage-ink: #f2f4f7;
  --stage-dim: #b4bac2;
  --stage-line: rgba(242, 244, 247, 0.22);
  --stage-pill: rgba(12, 14, 18, 0.66);
  --stage-btn-ink: #090a0c;
}

:root {
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --max-w: 1320px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 3px;
}

/* ---- Fixed Architectural Top HUD ---- */
.hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--stage-line);
  background: var(--stage-pill);
  color: var(--stage-ink);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.4s var(--ease), background-color 0.4s var(--ease), border-color 0.4s var(--ease);
}

.hud-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  font-weight: 500;
}

.sq-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}

.hud-coords {
  display: none;
  color: var(--stage-dim);
}

.hud-nav {
  display: none;
  align-items: center;
  gap: 24px;
  color: var(--stage-dim);
}

.hud-nav a {
  padding: 6px 0;
  transition: color 0.2s var(--ease);
}

.hud-nav a:hover {
  color: var(--stage-ink);
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--stage-line);
  font-family: var(--font-mono);
  font-size: 0.69rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stage-ink);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.hud-btn:hover {
  background: var(--stage-ink);
  color: var(--stage-btn-ink);
  border-color: var(--stage-ink);
}

.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 36px;
  border: 1px solid var(--stage-line);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.mobile-drawer {
  display: none;
  position: fixed;
  top: 67px;
  left: 0;
  right: 0;
  z-index: 49;
  background: var(--bg-solid);
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding: 12px 20px 20px;
}

.mobile-drawer.open {
  display: block;
}

.mobile-drawer nav {
  display: flex;
  flex-direction: column;
}

.mobile-drawer a {
  display: flex;
  align-items: center;
  min-height: 46px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.mobile-drawer a:last-child {
  border-bottom: 0;
}

/* ---- 3-Act Scroll-Driven Kīlauea Cinema Stage ---- */
.volcano-story {
  position: relative;
  height: 340vh;
}

.volcano-stage {
  position: sticky;
  top: 0;
  height: 100svh;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 86px 20px 22px;
  color: var(--stage-ink);
  cursor: grab;
  user-select: none;
  transition: color 0.45s var(--ease);
}

#volcano-canvas,
#ember-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

#volcano-canvas {
  z-index: 0;
}

#ember-canvas {
  z-index: 1;
}

.stage-top-meta {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.69rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stage-dim);
  pointer-events: none;
}

.stage-top-meta .col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stage-top-meta .right {
  text-align: right;
}

.stage-top-meta strong {
  color: var(--stage-ink);
  font-weight: 500;
}

.temp-readout {
  color: var(--accent) !important;
}

/* Crossfading 3-Act Story Copy Layer */
.stage-bottom {
  position: relative;
  z-index: 3;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.act-deck {
  position: relative;
  min-height: 170px;
  pointer-events: none;
}

.act-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s var(--ease), transform 0.65s var(--ease);
}

.act-panel.active {
  opacity: 1;
  transform: none;
}

.act-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.act-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.4rem, 7.6vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  color: var(--stage-ink);
}

.act-sub {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stage-dim);
  max-width: 46ch;
}

/* Bottom Telemetry & Act Jump Rail */
.stage-rail {
  position: relative;
  padding-top: 14px;
  border-top: 1px solid var(--stage-line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.69rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.progress-line {
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0.02);
}

.act-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.act-btn {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--stage-line);
  background: var(--stage-pill);
  backdrop-filter: blur(8px);
  color: var(--stage-dim);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.act-btn:hover {
  border-color: var(--stage-ink);
  color: var(--stage-ink);
}

.act-btn.active {
  background: var(--stage-ink);
  border-color: var(--stage-ink);
  color: var(--stage-btn-ink);
}

.rail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--stage-dim);
}

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  color: var(--stage-ink);
  font-weight: 500;
}

.scroll-cue:hover {
  color: var(--accent);
}

/* ---- Solid Architectural Content Sheet Below Volcano Story ---- */
.content-sheet {
  position: relative;
  z-index: 4;
  background: var(--bg-solid);
  border-top: 1px solid var(--line-strong);
  transition: background-color 0.22s var(--ease), color 0.22s var(--ease);
}

/* ---- Kinetic Seismic Velocity Marquee ---- */
.marquee-band {
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  padding-block: 14px;
  background: var(--bg);
}

.marquee-track {
  display: flex;
  width: max-content;
  will-change: transform;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.marquee-chunk {
  display: flex;
  align-items: center;
  gap: 28px;
  padding-right: 28px;
  white-space: nowrap;
}

.marquee-chunk .accent {
  color: var(--accent);
}

.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: 20px;
}

.spec-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---- Scroll-Scrubbed Manifesto ---- */
.manifesto {
  padding-block: 80px;
  border-bottom: 1px solid var(--line);
}

.manifesto-grid {
  display: grid;
  gap: 28px;
}

.manifesto-text {
  margin: 0;
  font-size: clamp(1.65rem, 3.8vw, 2.9rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.032em;
  max-width: 26ch;
}

.m-word {
  color: var(--ink-faint);
  opacity: 0.34;
  transition: opacity 0.28s var(--ease), color 0.28s var(--ease);
}

.m-word.lit {
  color: var(--ink);
  opacity: 1;
}

.manifesto-sub {
  margin: 26px 0 0;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--ink-dim);
  max-width: 56ch;
}

/* ---- Sticky Tectonic Stacking Portfolio Plates ---- */
.index-section {
  padding-block: 76px 92px;
  border-bottom: 1px solid var(--line);
}

.index-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 18px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.plate-stack {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.tectonic-plate {
  position: sticky;
  top: calc(74px + var(--stack-i, 0) * 18px);
  z-index: calc(10 + var(--stack-i, 0));
  isolation: isolate;
  border: 1px solid var(--line-strong);
  background: var(--bg-solid);
  display: grid;
  gap: 0;
  transform-origin: center top;
  will-change: transform, filter;
  transition: border-color 0.25s var(--ease);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.28);
}

.tectonic-plate:hover {
  border-color: var(--ink);
}

/* Architectural precision corner ticks */
.tectonic-plate::before,
.tectonic-plate::after {
  content: "+";
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1;
  color: var(--ink-faint);
  pointer-events: none;
  z-index: 3;
  transition: color 0.2s var(--ease);
}

.tectonic-plate::before {
  top: 8px;
  left: 10px;
}

.tectonic-plate::after {
  bottom: 8px;
  right: 10px;
}

.tectonic-plate:hover::before,
.tectonic-plate:hover::after {
  color: var(--accent);
}

.plate-info {
  padding: 24px 20px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.plate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.plate-code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 500;
}

.plate-status {
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  font-size: 0.66rem;
}

.plate-status.active {
  border-color: var(--accent);
  color: var(--accent);
}

.sys-name {
  margin: 14px 0 14px;
  font-size: clamp(2.1rem, 5.2vw, 3.6rem);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.sys-desc {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.96rem;
  line-height: 1.65;
  max-width: 46ch;
}

.plate-specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plate-specs div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.plate-specs span {
  color: var(--ink-faint);
}

.plate-specs strong {
  color: var(--ink);
  font-weight: 500;
}

/* Live Instrument Viewport on Each Tectonic Plate */
.plate-viz {
  position: relative;
  border-top: 1px solid var(--line);
  min-height: 175px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viz-bar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--bg-solid);
}

.viz-bar strong {
  color: var(--accent);
  font-weight: 500;
}

.viz-canvas {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 140px;
}

/* ---- Scroll-Reactive Architecture Spec Matrix ---- */
.spec-section {
  padding-block: 80px;
  border-bottom: 1px solid var(--line);
}

.spec-head-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 30px;
}

.spec-matrix {
  display: grid;
  gap: 18px;
}

.spec-cell {
  position: relative;
  padding: 30px 26px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  will-change: transform;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.spec-cell:hover {
  border-color: var(--accent);
  background: var(--bg-solid);
}

.spec-cell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.45s var(--ease);
}

.spec-cell:hover::before {
  width: 100%;
}

.spec-cell-num {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.spec-cell h3 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.spec-cell p {
  margin: 0;
  font-size: 0.94rem;
  color: var(--ink-dim);
  line-height: 1.64;
}

/* ---- Contact & Corporate Specification ---- */
.contact-section {
  padding-block: 72px;
}

.contact-grid {
  display: grid;
  gap: 36px;
}

.contact-headline {
  margin: 14px 0 18px;
  font-size: clamp(1.9rem, 4.5vw, 3.1rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.email-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.email-bar a {
  font-weight: 500;
  word-break: break-all;
}

.email-bar a:hover {
  color: var(--accent);
}

.copy-btn {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.copy-btn:hover {
  background: var(--ink);
  color: var(--bg);
}

.spec-table {
  margin: 0;
  border-top: 1px solid var(--line-strong);
}

.spec-tr {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.spec-tr dt {
  color: var(--ink-faint);
}

.spec-tr dd {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 26px 40px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}

.footer-links a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  color: var(--ink-dim);
}

.footer-links a:hover {
  color: var(--accent);
}

/* ---- Legal Pages ---- */
.legal-page {
  background: var(--bg-solid);
  min-height: 100svh;
}

.legal-main {
  padding-top: 108px;
  padding-bottom: 84px;
}

.legal-shell {
  max-width: 740px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 18px;
}

.back-link:hover {
  color: var(--accent);
}

.legal-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.legal-meta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 12px 0 36px;
}

.legal-body h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 34px 0 10px;
}

.legal-body p,
.legal-body li {
  color: var(--ink-dim);
  line-height: 1.7;
}

.legal-body ul {
  padding-left: 20px;
}

/* ---- Responsive Breakpoints ---- */
@media (min-width: 720px) {
  .hud-top { padding: 15px 32px; }
  .volcano-stage { padding: 92px 32px 26px; }
  .wrap { padding-inline: 32px; }
  .hud-coords { display: inline; }
  .hud-nav { display: flex; }
  .menu-btn { display: none; }
  .mobile-drawer.open { display: none; }
  .stage-rail {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .spec-matrix { grid-template-columns: repeat(3, 1fr); }
  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 820px) {
  .plate-stack {
    gap: 44px;
  }
  .tectonic-plate {
    top: calc(92px + var(--stack-i, 0) * 26px);
    grid-template-columns: 1.15fr 0.85fr;
    min-height: 360px;
  }
  .plate-info {
    padding: 38px 36px 34px;
    gap: 24px;
  }
  .plate-viz {
    border-top: 0;
    border-left: 1px solid var(--line);
    min-height: 360px;
  }
  .viz-canvas {
    min-height: 260px;
  }
}

@media (min-width: 960px) {
  .act-panel {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
  }
  .act-copy-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .manifesto { padding-block: 112px; }
  .manifesto-grid {
    grid-template-columns: 260px 1fr;
    gap: 40px;
    align-items: start;
  }
  .index-section { padding-block: 104px 124px; }
  .spec-section { padding-block: 104px; }
  .contact-section { padding-block: 104px; }
  .contact-grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 64px;
    align-items: end;
  }
}
