/* ==========================================================
   DIGIT29 — From thought to thing.
   Cinematic scrollytelling site.
   ========================================================== */

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

:root {
  --bg-0: #050507;
  --bg-1: #0a0a10;
  --ink: #f5f3ef;
  --ink-dim: #8d8d95;
  --ink-faint: #5a5a63;
  --accent: #ffb37c;     /* warm spark */
  --accent-2: #ff5a8a;   /* drifty */
  --accent-3: #6fffd2;   /* offbeat */
  --rule: rgba(255,255,255,0.08);
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Geist', system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
}

html, body {
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

html { scroll-behavior: auto; }

body {
  min-height: 100vh;
}

/* (Body fade-in removed — we let JS animate text in instead.) */

/* ============== STAGE (fixed 3D canvas) ============== */
#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  display: block;
}

/* Subtle film grain overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.8'/></svg>");
}

/* Vignette */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,.55) 100%);
}

/* ============== NAVIGATION ============== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 36px;
  font-size: 14px;
  mix-blend-mode: difference;   /* default: punches through the cinematic stage */
  color: #fff;
  transition: background 0.3s ease;
}

/* When over the footer, drop the blend mode and add a subtle backdrop */
.nav.nav--solid {
  mix-blend-mode: normal;
  background: rgba(5, 5, 7, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

.logo-text {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  opacity: 0.75;
  transition: opacity 0.2s;
}

.nav-links a:hover { opacity: 1; }

.nav-cta {
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: inherit;
  padding: 8px 16px;
  border: 1px solid currentColor;
  border-radius: 999px;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.nav-cta:hover { opacity: 1; }

/* ============== SCROLL METER ============== */
.meter {
  position: fixed;
  top: 50%;
  left: 24px;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: left center;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.meter.meter--hidden {
  opacity: 0;
}

.meter-track {
  width: 120px;
  height: 1px;
  background: rgba(255,255,255,0.15);
  position: relative;
  overflow: hidden;
}

.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--accent);
  transition: width 0.1s linear;
}

.meter-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  text-transform: uppercase;
  white-space: nowrap;
}

/* ============== STORY (scrollable acts) ============== */
.story {
  position: relative;
  z-index: 10;
}

.act {
  min-height: 100vh;
  padding: 12vh 8vw;
  display: flex;
  align-items: center;
  position: relative;
}

.act-inner {
  max-width: 720px;
  width: 100%;
}

.act-inner.align-left { margin-right: auto; margin-left: 6vw; }
.act-inner.align-right { margin-left: auto; margin-right: 6vw; text-align: right; }
.act:not([data-act="5"]):not([data-act="6"]):not([data-act="8"]) .act-inner:not(.align-left):not(.align-right) {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* Kicker (act label) */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 32px;
}

.kicker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* Big serif headlines */
h1, h2 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--ink);
}

h1 { font-size: clamp(56px, 9vw, 144px); }
h2 { font-size: clamp(48px, 7.5vw, 120px); }

.ital { font-style: italic; color: var(--accent); }

/* Reveal-words: each <span> is a word that animates in.
   We use a JS-added class so headlines remain visible if JS fails. */
.reveal-words.js-ready span {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px);
  filter: blur(8px);
}

/* Sub copy */
.sub {
  margin-top: 36px;
  font-family: var(--sans);
  font-size: clamp(15px, 1.4vw, 19px);
  line-height: 1.55;
  color: var(--ink-dim);
  max-width: 48ch;
  font-weight: 300;
}

.act-inner.align-right .sub { margin-left: auto; }
.act-inner:not(.align-left):not(.align-right) .sub { margin-left: auto; margin-right: auto; }

.fade-in.js-ready { opacity: 0; transform: translateY(20px); }

/* ============== PRODUCT TITLES (Acts 5, 6) ============== */
.product-title {
  font-family: var(--serif);
  font-size: clamp(80px, 14vw, 220px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-weight: 400;
}

.product-title .dot-accent {
  color: var(--accent-2);
}

[data-act="6"] .product-title .dot-accent {
  color: var(--accent-3);
}

.product-tag {
  margin-top: 18px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 2.2vw, 28px);
  color: var(--ink);
  opacity: 0.9;
}

.product-link {
  display: inline-block;
  margin-top: 32px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 3px;
  transition: color 0.2s;
}

[data-act="5"] .product-link:hover { color: var(--accent-2); }
[data-act="6"] .product-link:hover { color: var(--accent-3); }

/* ============== FEATURE LIST (Act 8) ============== */
.feature-list {
  list-style: none;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  max-width: 560px;
}

.feature-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 20px;
  align-items: start;
  opacity: 0;
  transform: translateY(20px);
}

.feature-item.js-ready {
  opacity: 0;
  transform: translateY(20px);
}

.feature-num {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--accent-2);
  padding-top: 4px;
  border-top: 1px solid currentColor;
  display: inline-block;
  width: 36px;
}

.feature-item h3 {
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--ink);
}

.feature-item p {
  margin-top: 8px;
  font-family: var(--sans);
  font-size: clamp(14px, 1.2vw, 16px);
  line-height: 1.55;
  color: var(--ink-dim);
  font-weight: 300;
  max-width: 44ch;
}

/* Italic line used in Act 3's quote */
.italic-line {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 1.8vw, 24px);
  color: var(--ink);
  opacity: 0.85;
}

/* ============== FINAL CTA ============== */
.act.final {
  text-align: center;
}

.big-cta {
  display: inline-block;
  margin-top: 48px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(28px, 4vw, 56px);
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 6px;
  transition: opacity 0.2s;
}

.big-cta:hover { opacity: 0.8; }

.footer-meta {
  margin-top: 80px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-top: 1px solid var(--rule);
  padding-top: 24px;
}

/* ==============================================================
   COMPANY ACT — cinematic star-map readout.
   Transparent background so the 3D constellation shows through.
   ============================================================== */
.company-act {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  padding: 14vh 6vw 10vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-stage {
  width: 100%;
  max-width: 1280px;
  display: grid;
  gap: 48px;
  position: relative;
}

/* Decorative crosshair corners on the stage */
.company-stage::before,
.company-stage::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 179, 124, 0.4);
}
.company-stage::before {
  top: -32px; left: -32px;
  border-right: none;
  border-bottom: none;
}
.company-stage::after {
  bottom: -32px; right: -32px;
  border-left: none;
  border-top: none;
}

/* ===== Top transmission bar ===== */
.readout-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 179, 124, 0.18);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.readout-pulse {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse-ping 2s ease-in-out infinite;
}

@keyframes pulse-ping {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

.readout-coords {
  display: flex;
  gap: 28px;
  color: var(--ink-dim);
}

.coord-line {
  position: relative;
}
.coord-line::before {
  content: "◆ ";
  color: var(--accent);
  opacity: 0.6;
  margin-right: 6px;
}

/* ===== Vessel identification ===== */
.readout-id {
  text-align: center;
  padding: 40px 0 16px;
}

.readout-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 24px;
}

.vessel-name {
  font-family: var(--serif);
  font-size: clamp(48px, 7vw, 110px);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 28px;
}

.vessel-name .vn-line {
  display: block;
}

.vessel-name .vn-line--italic {
  font-style: italic;
  color: var(--accent);
}

.vessel-cin {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.vessel-cin span {
  color: var(--ink);
  margin-left: 8px;
  padding: 4px 12px;
  border: 1px solid rgba(255, 179, 124, 0.3);
  border-radius: 4px;
  letter-spacing: 0.1em;
}

/* ===== Grid of four panels ===== */
.readout-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: rgba(255, 179, 124, 0.18);
  border: 1px solid rgba(255, 179, 124, 0.18);
}

.panel {
  background: rgba(5, 5, 7, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 28px 24px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.panel-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 179, 124, 0.18);
}

.panel-data {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  font-weight: 300;
}

.panel-data--large {
  font-family: var(--serif);
  font-size: 32px;
  font-style: italic;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.panel-sub {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-link {
  display: block;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 300;
  color: var(--ink);
  text-decoration: none;
  padding: 6px 0;
  position: relative;
  transition: color 0.2s, padding 0.2s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-link:last-child { border-bottom: none; }

.panel-link::after {
  content: "→";
  position: absolute;
  right: 0;
  opacity: 0;
  color: var(--accent);
  transition: opacity 0.2s, transform 0.2s;
}

.panel-link:hover {
  color: var(--accent);
  padding-left: 4px;
}

.panel-link:hover::after {
  opacity: 1;
  transform: translateX(-2px);
}

/* ===== Bottom credit ===== */
.readout-bottom {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 179, 124, 0.18);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.bottom-spacer {
  color: var(--accent);
  opacity: 0.5;
}

@media (max-width: 900px) {
  .readout-grid { grid-template-columns: 1fr 1fr; }
  .readout-top { flex-direction: column; gap: 12px; }
}

@media (max-width: 560px) {
  .readout-grid { grid-template-columns: 1fr; }
  .company-stage::before, .company-stage::after { display: none; }
  .readout-bottom { flex-direction: column; gap: 8px; text-align: center; }
}

/* ================================================================
   CUSTOM CINEMATIC TRANSITION when clicking "Company" in nav.
   A black fade + dolly creates the sense of "engaging warp drive".
   ================================================================ */
.scene-curtain {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #050507;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.scene-curtain.scene-curtain--active {
  opacity: 1;
}

/* Star streaks during the warp */
.warp-streaks {
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  overflow: hidden;
}

.warp-streaks.warp-streaks--active {
  opacity: 1;
}

.warp-streak {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform-origin: center;
  opacity: 0.6;
}

/* ============== LEGAL PAGES (privacy, terms) ============== */
.legal-page {
  position: relative;
  z-index: 10;
  background: var(--bg-0);
  min-height: 100vh;
  padding: 140px 8vw 80px;
  color: var(--ink);
}

.legal-page .legal-inner {
  max-width: 720px;
  margin: 0 auto;
}

.legal-page h1 {
  font-family: var(--serif);
  font-size: clamp(48px, 6vw, 80px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 12px;
}

.legal-page .updated {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 48px;
}

.legal-page h2 {
  font-family: var(--serif);
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-top: 48px;
  margin-bottom: 14px;
}

.legal-page p, .legal-page li {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-dim);
  font-weight: 300;
  margin-bottom: 16px;
}

.legal-page ul {
  padding-left: 20px;
  margin-bottom: 16px;
}

.legal-page a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.legal-page .back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-dim);
  text-decoration: none;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 48px;
  border: none;
}

.legal-page .back-link:hover { color: var(--ink); }

/* ============== RESPONSIVE ============== */
@media (max-width: 768px) {
  .nav { padding: 18px 20px; }
  .nav-links { display: none; }
  .meter { left: 14px; }
  .meter-track { width: 80px; }
  .meter-label { font-size: 9px; }
  .act { padding: 10vh 6vw; }
  .act-inner.align-left, .act-inner.align-right { margin-left: 0; margin-right: 0; text-align: left; }
  .act-inner.align-right .sub { margin-left: 0; }
  .footer-meta { flex-direction: column; gap: 12px; text-align: center; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal-words span { opacity: 1; transform: none; filter: none; }
  .fade-in { opacity: 1; transform: none; }
  .logo-dot { animation: none; }
}
