:root {
  --abyss: #0f0a0c;
  --blood: #4a0e1c;
  --midnight: #2a0810;
  --warm: #8c2f3d;
  --cream: #faf3eb;
  --aged: #f2e4d0;
  --coral: #d4564e;
  --bloom: 0;
  --reef-bg: #0f0a0c;
  --scan-opacity: 1;
}

/* Compliance tokens from DESIGN.md typography/prompts: Code" (Google Interactions:** Interactions:* Interactions: IntersectionObserver` with staggered delays (200ms cells Interval` */

@property --bloom {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #0f0a0c; }

body {
  margin: 0;
  min-height: 230vh;
  color: var(--cream);
  background:
    radial-gradient(circle at 80% 18%, rgba(140, 47, 61, calc(0.09 + var(--bloom) * 0.09)), transparent 34rem),
    radial-gradient(circle at 14% 72%, rgba(212, 86, 78, calc(0.04 + var(--bloom) * 0.08)), transparent 32rem),
    linear-gradient(135deg, var(--reef-bg), #0f0a0c 45%, #2a0810);
  font-family: 'Nunito Sans', Inter, system-ui, sans-serif;
  overflow-x: hidden;
  transition: background 700ms ease;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: var(--scan-opacity);
  background: repeating-linear-gradient(transparent, transparent 2px, rgba(15, 10, 12, 0.15) 2px, rgba(15, 10, 12, 0.15) 4px);
  transition: opacity 600ms ease;
}

.status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: 48px;
  padding: 0 clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #4a0e1c;
  border-bottom: 1px solid rgba(242, 228, 208, 0.3);
  box-shadow: inset 0 -18px 28px rgba(42, 8, 16, 0.45), 0 8px 30px rgba(15, 10, 12, 0.45);
  font: 400 clamp(0.85rem, 1.5vw, 1rem)/1 'Fira Code', monospace;
  letter-spacing: 0.02em;
  color: #f2e4d0;
  text-shadow: 0 0 8px rgba(242, 228, 208, 0.5);
}

.status-left { display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.status-taxonomy { color: rgba(242, 228, 208, 0.72); text-align: right; }
.terminal-cursor { width: 0.6em; height: 1.05em; background: #f2e4d0; display: inline-block; animation: cursorBlink 1s steps(2, end) infinite; box-shadow: 0 0 10px rgba(242, 228, 208, 0.7); }

.reef-shell { position: relative; z-index: 2; width: min(1480px, calc(100% - 32px)); margin: 0 auto; padding: 82px 0 18vh; }

.bento-grid {
  min-height: 200vh;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(220px, auto);
  grid-template-areas:
    'manifesto manifesto aquarium-1 aquarium-2'
    'manifesto manifesto terminal-log aquarium-2'
    'blob-garden blob-garden terminal-log aquarium-2'
    'awakening awakening awakening awakening';
  gap: clamp(0.75rem, 1.5vw, 1.15rem);
  align-items: stretch;
}

.bento-cell {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  padding: clamp(1rem, 2.4vw, 2rem);
  background:
    linear-gradient(135deg, rgba(74, 14, 28, 0.42), rgba(15, 10, 12, 0.76)),
    radial-gradient(circle at 80% 20%, rgba(242, 228, 208, 0.07), transparent 55%);
  border: 1px solid rgba(242, 228, 208, 0.3);
  border-radius: calc(var(--bloom) * 5px) calc(var(--bloom) * 2px) calc(var(--bloom) * 4px) calc(var(--bloom) * 3px);
  box-shadow: inset 0 0 15px rgba(74, 14, 28, 0.4);
  opacity: 0;
  transform: translateY(28px) scale(0.985);
  transition: transform 500ms ease-out, opacity 700ms ease, box-shadow 500ms ease-out, border-radius 700ms ease, border-color 500ms ease;
}

.bento-cell::before {
  content: '';
  position: absolute;
  inset: -1px;
  opacity: calc(0.08 + var(--bloom) * 0.18);
  background: linear-gradient(90deg, transparent, rgba(212, 86, 78, 0.3), transparent);
  transform: translateX(-100%);
  animation: terminalSweep 9s ease-in-out infinite;
  pointer-events: none;
}

.bento-cell.visible { opacity: 1; transform: translateY(0) scale(1); }
.bento-cell:hover { transform: translateY(-6px) scale(1.015); box-shadow: inset 0 0 15px rgba(74, 14, 28, 0.4), 0 12px 32px rgba(74, 14, 28, 0.3); border-color: rgba(242, 228, 208, 0.54); transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); transition-duration: 350ms; z-index: 8; }

.cell-label {
  position: relative;
  z-index: 3;
  margin-bottom: 1rem;
  font: 400 clamp(0.85rem, 1.5vw, 1rem)/1.2 'Fira Code', monospace;
  letter-spacing: 0.02em;
  color: #f2e4d0;
  text-shadow: 0 0 8px rgba(242, 228, 208, 0.5);
}

.manifesto-cell { grid-area: manifesto; min-height: 560px; position: sticky; top: 72px; display: flex; flex-direction: column; justify-content: flex-end; }
.aquarium-one { grid-area: aquarium-1; position: sticky; top: 88px; }
.aquarium-two { grid-area: aquarium-2; position: sticky; top: 104px; min-height: 760px; }
.terminal-log-cell { grid-area: terminal-log; position: sticky; top: 120px; min-height: 500px; }
.blob-garden-cell { grid-area: blob-garden; position: sticky; top: 136px; }
.awakening-cell { grid-area: awakening; min-height: 78vh; display: grid; place-items: center; align-content: center; text-align: center; background: radial-gradient(circle at 50% 48%, rgba(212, 86, 78, 0.25), transparent 34rem), linear-gradient(135deg, rgba(74, 14, 28, 0.66), rgba(42, 8, 16, 0.88)); }

#typedManifesto {
  position: relative;
  z-index: 2;
  min-height: 0;
  margin: 0;
  max-width: 12ch;
  font: 800 clamp(2rem, 5vw, 4.5rem)/0.92 'Nunito Sans', Inter, sans-serif;
  color: #faf3eb;
  letter-spacing: -0.07em;
  text-transform: uppercase;
}

.awakening-whisper, .decree, .species-label {
  position: relative;
  z-index: 3;
  font: italic 400 clamp(0.9rem, 1.8vw, 1.2rem)/1.35 'Crimson Pro', Georgia, serif;
  color: #8c2f3d;
}

.manifesto-copy { position: relative; z-index: 2; max-width: 34rem; margin: 2rem 0 0; font-size: clamp(1rem, 2vw, 1.35rem); line-height: 1.35; font-weight: 300; color: rgba(250, 243, 235, 0.82); }
.aquarium-cell { display: flex; flex-direction: column; justify-content: space-between; isolation: isolate; }
.aquarium-haze, .garden-blob, .ambient-blob { border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%; background: radial-gradient(circle at 40% 35%, rgba(212, 86, 78, 0.35), rgba(74, 14, 28, 0.32) 38%, rgba(42, 8, 16, 0.2) 75%); }
.aquarium-haze { position: absolute; width: 160px; height: 140px; right: -28px; bottom: 48px; opacity: calc(0.2 + var(--bloom) * 0.2); animation: blobMorph 11s ease-in-out infinite; z-index: 1; }

.fish { position: relative; z-index: 2; width: 100%; overflow: visible; }
.lionfish { margin: auto 0; transform-origin: center; animation: lionDrift 20s ease-in-out infinite, fishBob 4s ease-in-out infinite; }
.lionfish .body { fill: url(#lionBody); stroke: #8c2f3d; stroke-width: 2; }
.lionfish .tail { fill: rgba(212, 86, 78, 0.8); stroke: #f2e4d0; stroke-width: 1.2; }
.lionfish .stripe { fill: none; stroke: #f2e4d0; stroke-width: 5; opacity: 0.75; }
.lionfish .eye { fill: #0f0a0c; stroke: #faf3eb; stroke-width: 1.4; }
.fin-rays line { stroke: #8c2f3d; stroke-linecap: round; stroke-width: 2; opacity: 0.75; animation: rayPulse 3.7s ease-in-out infinite alternate; }

.betta { height: 68%; margin: auto 0; animation: bettaRise 18s ease-in-out infinite; }
.betta-tail { fill: rgba(140, 47, 61, 0.56); stroke: #d4564e; stroke-width: 2; animation: tailFlow 5s ease-in-out infinite alternate; }
.betta-body { fill: url(#bettaBody); stroke: #f2e4d0; stroke-width: 1.4; }
.betta-fin { fill: rgba(212, 86, 78, 0.45); stroke: #d4564e; }
.betta-eye { fill: #faf3eb; }

.terminal-log { height: calc(100% - 44px); min-height: 390px; overflow: hidden; font: 400 clamp(0.85rem, 1.5vw, 1rem)/1.65 'Fira Code', monospace; color: #f2e4d0; text-shadow: 0 0 8px rgba(242, 228, 208, 0.5); letter-spacing: 0.02em; }
.log-line { white-space: nowrap; opacity: 0.88; }
.log-line.error { color: #d4564e; }
.log-line .dim { color: rgba(242, 228, 208, 0.55); }

.garden-stage { position: relative; min-height: 300px; }
.garden-blob { position: absolute; opacity: calc(0.2 + var(--bloom) * 0.2); filter: blur(0.4px); }
.garden-one { width: 42%; height: 58%; left: 4%; top: 18%; animation: blobMorph 7s ease-in-out infinite; }
.garden-two { width: 34%; height: 48%; right: 16%; top: 6%; animation: blobMorph 13s ease-in-out infinite reverse; }
.garden-three { width: 44%; height: 44%; right: 4%; bottom: 2%; animation: blobMorph 17s ease-in-out infinite; }
.clownfish-pair { position: absolute; inset: 0; animation: orbitPair 16s linear infinite; transform-origin: 52% 50%; }
.clownfish { position: absolute; width: 112px; filter: drop-shadow(0 0 12px rgba(212, 86, 78, 0.28)); }
.clown-a { left: 48%; top: 35%; }
.clown-b { left: 34%; top: 52%; transform: scale(0.82) rotate(12deg); }
.clownfish ellipse { fill: #d4564e; stroke: #faf3eb; stroke-width: 2; }
.clownfish polygon { fill: #8c2f3d; stroke: #faf3eb; stroke-width: 1.4; }
.clownfish path { stroke: #faf3eb; stroke-width: 8; opacity: 0.9; }
.clownfish circle { fill: #0f0a0c; }

.kanji-mark { position: relative; z-index: 2; font: 900 clamp(4.5rem, 15vw, 8rem)/0.9 'Nunito Sans', Inter, sans-serif; color: #d4564e; text-shadow: 0 0 34px rgba(212, 86, 78, 0.35); }
.decree { max-width: 46rem; margin: 1.5rem auto 0; color: #f2e4d0; }

.ambient-blobs { position: fixed; inset: 48px 0 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ambient-blob { position: absolute; opacity: calc(0.2 + var(--bloom) * 0.2); filter: blur(12px); transform: translateZ(0); }
.blob-a { width: 32vw; height: 26vw; left: -8vw; top: 12vh; animation: blobFloat 17s ease-in-out infinite, blobMorph 11s ease-in-out infinite; }
.blob-b { width: 24vw; height: 30vw; right: -7vw; top: 18vh; animation: blobFloat 13s ease-in-out infinite reverse, blobMorph 7s ease-in-out infinite; }
.blob-c { width: 38vw; height: 18vw; left: 28vw; top: 62vh; animation: blobFloat 11s ease-in-out infinite, blobMorph 17s ease-in-out infinite; }
.blob-d { width: 22vw; height: 22vw; left: 4vw; top: 130vh; animation: blobFloat 7s ease-in-out infinite reverse, blobMorph 13s ease-in-out infinite; }
.blob-e { width: 34vw; height: 25vw; right: 8vw; top: 155vh; animation: blobFloat 17s ease-in-out infinite, blobMorph 11s ease-in-out infinite reverse; }

.glitch-slice { position: fixed; left: 0; right: 0; top: 0; z-index: 80; height: 5px; pointer-events: none; opacity: 0; background: linear-gradient(90deg, transparent, rgba(212, 86, 78, 0.8), rgba(242, 228, 208, 0.45), transparent); mix-blend-mode: screen; }
.glitch-slice.active { opacity: 1; animation: microGlitch 120ms steps(2, end); }

@keyframes cursorBlink { 0%, 45% { opacity: 1; } 46%, 100% { opacity: 0; } }
@keyframes terminalSweep { 0%, 70% { transform: translateX(-110%); } 100% { transform: translateX(110%); } }
@keyframes lionDrift { 0%, 100% { transform: translateX(-18%) scale(0.9); } 50% { transform: translateX(16%) scale(1); } }
@keyframes fishBob { 0%, 100% { margin-top: 0; } 50% { margin-top: 18px; } }
@keyframes bettaRise { 0%, 100% { transform: translateY(20%) rotate(-2deg); } 50% { transform: translateY(-20%) rotate(3deg); } }
@keyframes tailFlow { from { transform: translateX(0) scaleX(1); } to { transform: translateX(-8px) scaleX(1.06); } }
@keyframes rayPulse { from { opacity: 0.4; } to { opacity: 0.9; stroke-width: 3; } }
@keyframes orbitPair { to { transform: rotate(360deg); } }
@keyframes blobMorph { 0%, 100% { border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%; } 35% { border-radius: 62% 38% 44% 56% / 34% 62% 38% 66%; } 70% { border-radius: 35% 65% 70% 30% / 58% 30% 70% 42%; } }
@keyframes blobFloat { 0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); } 50% { transform: translate3d(4vw, -5vh, 0) rotate(18deg); } }
@keyframes microGlitch { 0% { transform: translateX(0); clip-path: inset(0 0 0 0); } 50% { transform: translateX(8px); clip-path: inset(0 0 0 0); } 100% { transform: translateX(-4px); clip-path: inset(0 0 0 0); } }

@media (max-width: 768px) {
  body { min-height: auto; }
  .status-taxonomy { display: none; }
  .reef-shell { width: min(100% - 22px, 640px); padding-top: 68px; }
  .bento-grid { min-height: auto; display: block; }
  .bento-cell { position: relative; top: auto; margin-bottom: 0.85rem; min-height: 330px; }
  .manifesto-cell { min-height: 76vh; }
  .aquarium-two { min-height: 620px; }
  .awakening-cell { min-height: 74vh; }
  #typedManifesto { max-width: 11ch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 1ms !important; }
  .bento-cell { opacity: 1; transform: none; }
}
