/* CSS Custom Properties - Exact colors from DESIGN.md */
:root {
  --abyss-bg: #0B0F1A;
  --pressure-blue: #111827;
  --coral-accent: #FF6B35;
  --amber-signal: #E8952F;
  --sunset-blush: #FF8E72;
  --fog-text: #D4DEE7;
  --muted-data: #7A8BA3;
  --glow-edge: #FF9F5A;
  
  /* Gradients */
  --depth-gradient: linear-gradient(180deg, #0B0F1A 0%, #111827 40%, #1A1F35 70%, #0B0F1A 100%);
  --coral-pulse: radial-gradient(ellipse at 30% 50%, rgba(255, 107, 53, 0.08) 0%, transparent 70%);
  --sunset-horizon: linear-gradient(135deg, #FF6B35, #E8952F, #FF8E72);
}

/* Global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--fog-text);
  background-color: var(--abyss-bg);
  line-height: 1.65;
  font-weight: 400;
  letter-spacing: 0.005em;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3 {
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.domain-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.2rem, 6vw, 5.5rem);
  font-weight: 700;
  background: var(--sunset-horizon);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  margin-bottom: 1rem;
}

.system-heading, .glow-heading {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.2rem, 3vw, 2.4rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: var(--coral-accent);
  margin-bottom: 0.75rem;
}

.final-proclamation {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.2rem, 6vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--sunset-blush);
}

.oracle-tagline, .system-text, .glow-text, .transmission-text, .utterance-text {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.95rem, 1.2vw, 1.15rem);
  line-height: 1.65;
  color: var(--fog-text);
  font-weight: 400;
}

.oracle-tagline {
  font-style: italic;
  color: var(--sunset-blush);
  opacity: 0.85;
}

.coordinate-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
  color: var(--muted-data);
  margin: 0.25rem 0;
}

.data-label, .counter-label, .tide-label {
  font-family: 'Syne', sans-serif;
  font-size: clamp(0.85rem, 1.5vw, 1.1rem);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--amber-signal);
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.data-value, .counter-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1rem, 2.5vw, 1.75rem);
  color: var(--coral-accent);
  letter-spacing: 0.05em;
  font-weight: 500;
}

.counter-value {
  display: inline-block;
  min-width: 4ch;
  animation: counter-flicker 2.8s steps(1, end) infinite;
}

@keyframes counter-flicker {
  0%, 100% {
    transform: translateY(0);
    opacity: 1;
  }
  47% {
    transform: translateY(-1px);
    opacity: 0.78;
  }
  49% {
    transform: translateY(1px);
    opacity: 1;
  }
}

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Bokeh background system */
.bokeh-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bokeh {
  position: fixed;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 53, 0.12) 0%, rgba(255, 142, 114, 0.04) 40%, transparent 70%);
  filter: blur(40px);
  will-change: transform;
}

.bokeh-1 {
  width: 180px;
  height: 180px;
  top: 10%;
  left: 5%;
  animation: drift 18s ease-in-out infinite alternate;
}

.bokeh-2 {
  width: 240px;
  height: 240px;
  top: 20%;
  right: 10%;
  animation: drift 22s ease-in-out infinite alternate;
  animation-delay: 2s;
  background: radial-gradient(circle, rgba(74, 144, 226, 0.06) 0%, rgba(100, 170, 255, 0.02) 40%, transparent 70%);
}

.bokeh-3 {
  width: 120px;
  height: 120px;
  top: 40%;
  left: 8%;
  animation: drift 15s ease-in-out infinite alternate;
  animation-delay: 1s;
  background: radial-gradient(circle, rgba(232, 149, 47, 0.08) 0%, rgba(255, 158, 90, 0.03) 40%, transparent 70%);
}

.bokeh-4 {
  width: 200px;
  height: 200px;
  top: 55%;
  right: 5%;
  animation: drift 25s ease-in-out infinite alternate;
  animation-delay: 3s;
}

.bokeh-5 {
  width: 150px;
  height: 150px;
  bottom: 20%;
  left: 15%;
  animation: drift 20s ease-in-out infinite alternate;
  animation-delay: 1.5s;
  background: radial-gradient(circle, rgba(74, 144, 226, 0.05) 0%, rgba(100, 170, 255, 0.01) 40%, transparent 70%);
}

.bokeh-6 {
  width: 100px;
  height: 100px;
  bottom: 30%;
  right: 20%;
  animation: drift 17s ease-in-out infinite alternate;
  animation-delay: 2.5s;
}

.bokeh-7 {
  width: 160px;
  height: 160px;
  bottom: 5%;
  left: 40%;
  animation: drift 23s ease-in-out infinite alternate;
  animation-delay: 0.5s;
}

.bokeh-8 {
  width: 80px;
  height: 80px;
  bottom: 15%;
  right: 30%;
  animation: drift 19s ease-in-out infinite alternate;
  animation-delay: 4s;
  background: radial-gradient(circle, rgba(255, 107, 53, 0.08) 0%, rgba(255, 142, 114, 0.02) 40%, transparent 70%);
}

.bokeh-9 {
  width: 280px;
  height: 280px;
  top: 2%;
  left: 42%;
  animation: drift-wide 25s ease-in-out infinite alternate;
  animation-delay: 1.2s;
  background: radial-gradient(circle, rgba(255, 142, 114, 0.09) 0%, rgba(255, 159, 90, 0.025) 42%, transparent 72%);
}

.bokeh-10 {
  width: 70px;
  height: 70px;
  top: 68%;
  left: 66%;
  animation: drift 12s ease-in-out infinite alternate;
  animation-delay: 3.6s;
  background: radial-gradient(circle, rgba(232, 149, 47, 0.11) 0%, rgba(255, 158, 90, 0.035) 40%, transparent 70%);
}

.bokeh-11 {
  width: 320px;
  height: 320px;
  bottom: -10%;
  right: -4%;
  animation: abyss-pulse 24s ease-in-out infinite alternate;
  animation-delay: 2s;
  opacity: 0.5;
}

.bokeh-12 {
  width: 95px;
  height: 95px;
  top: 34%;
  left: 52%;
  animation: drift-wide 16s ease-in-out infinite alternate;
  animation-delay: 4.2s;
  background: radial-gradient(circle, rgba(74, 144, 226, 0.06) 0%, rgba(100, 170, 255, 0.018) 40%, transparent 70%);
}

@keyframes drift {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(30px, -50px);
  }
  100% {
    transform: translate(-20px, 40px);
  }
}

@keyframes drift-wide {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-42px, 32px, 0) scale(1.08);
  }
  100% {
    transform: translate3d(36px, -46px, 0) scale(0.94);
  }
}

@keyframes abyss-pulse {
  0% {
    transform: translate3d(0, 0, 0) scale(0.92);
    opacity: 0.28;
  }
  100% {
    transform: translate3d(-28px, -22px, 0) scale(1.1);
    opacity: 0.55;
  }
}

/* Main content */
.page-content {
  position: relative;
  z-index: 1;
  width: 100%;
}

/* Tier sections */
.tier {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.tier-grid {
  width: 100%;
  max-width: 1400px;
}

/* Depth breaker between tiers */
.depth-cell {
  min-height: 20vh;
  width: 100%;
  background: var(--depth-gradient);
  position: relative;
  overflow: hidden;
}

.depth-cell::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: rgba(255, 142, 114, 0.15);
  transform: translateY(-50%);
}

/* Bento Grid System */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto;
  gap: clamp(8px, 1.5vw, 16px);
  position: relative;
}

/* Bento Cell Base Styles */
.bento-cell {
  background: var(--pressure-blue);
  border: 1px solid rgba(255, 140, 66, 0.15);
  border-radius: 16px;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease,
              box-shadow 0.3s ease;
  will-change: transform, opacity;
}

.bento-cell.in-view {
  opacity: 1;
  transform: translateY(0);
}

.bento-cell:hover {
  border-color: rgba(255, 140, 66, 0.4);
  box-shadow: 0 0 30px rgba(255, 107, 53, 0.12);
}

.cell-inner {
  position: relative;
  z-index: 2;
}

.corner-label,
.abyss-label {
  margin-bottom: 1.1rem;
  color: var(--glow-edge);
}

.micro-reading {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--amber-signal);
  margin-top: 1rem;
  opacity: 0.85;
}

/* Cell Type Variations */
.oracle-cell {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 300px;
}

.oracle-main {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.8) 0%, rgba(26, 31, 53, 0.6) 100%),
              var(--coral-pulse);
  padding: clamp(2rem, 4vw, 3.5rem);
  min-height: 400px;
}

.oracle-glow {
  text-shadow: 0 0 40px rgba(255, 107, 53, 0.3);
}

.oracle-wide {
  padding: clamp(2rem, 3vw, 3rem);
  min-height: auto;
}

.oracle-final {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(3rem, 5vw, 5rem);
  min-height: 100vh;
  text-align: center;
  grid-row: span 1;
}

.signal-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(1.25rem, 2vw, 2rem);
  min-height: 140px;
}

.tide-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(1.5rem, 2.5vw, 2rem);
  min-height: 200px;
}

/* Dot-matrix grid texture on select cells */
.bento-cell {
  background-image: radial-gradient(circle, rgba(255, 107, 53, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0, 0 0;
}

.oracle-cell {
  background-image: 
    linear-gradient(135deg, rgba(17, 24, 39, 0.8) 0%, rgba(26, 31, 53, 0.6) 100%),
    var(--coral-pulse),
    radial-gradient(circle, rgba(255, 107, 53, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 24px 24px;
  background-position: 0 0, 0 0, 0 0;
}

/* SVG Circuit Traces */
.circuit-trace {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.2;
  pointer-events: none;
}

.circuit-dense {
  opacity: 0.12;
}

/* Sonar Ring Animation */
.sonar-ring circle {
  animation: sonar-pulse 2s ease-out infinite;
}

.sonar-ring circle:nth-child(2) {
  animation-delay: 0.6s;
}

.sonar-ring circle:nth-child(3) {
  animation-delay: 1.2s;
}

@keyframes sonar-pulse {
  0% {
    r: 15;
    opacity: 0.8;
  }
  100% {
    r: 40;
    opacity: 0;
  }
}

/* Waveform Animation */
.waveform-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 80px;
  margin-bottom: 1rem;
}

.wave {
  width: 8px;
  background: linear-gradient(180deg, var(--coral-accent), var(--amber-signal));
  border-radius: 4px;
  transform-origin: bottom;
  animation: wave-motion 0.8s ease-in-out infinite;
  will-change: transform;
}

.wave:nth-child(1) {
  animation-delay: 0s;
}

.wave:nth-child(2) {
  animation-delay: 0.1s;
}

.wave:nth-child(3) {
  animation-delay: 0.2s;
}

.wave:nth-child(4) {
  animation-delay: 0.3s;
}

.wave:nth-child(5) {
  animation-delay: 0.4s;
}

.wave:nth-child(6) {
  animation-delay: 0.5s;
}

@keyframes wave-motion {
  0%, 100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}

.waveform-complex .wave {
  animation: wave-motion-complex 1s ease-in-out infinite;
}

.mini-radar {
  display: flex;
  gap: 6px;
  margin-top: 1rem;
}

.mini-radar span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral-accent);
  box-shadow: 0 0 16px rgba(255, 107, 53, 0.55);
  animation: radar-blink 1.4s ease-in-out infinite;
}

.mini-radar span:nth-child(2) {
  animation-delay: 0.25s;
}

.mini-radar span:nth-child(3) {
  animation-delay: 0.5s;
}

@keyframes radar-blink {
  0%, 100% {
    transform: scale(0.65);
    opacity: 0.35;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes wave-motion-complex {
  0%, 100% {
    transform: scaleY(0.2);
  }
  50% {
    transform: scaleY(1.2);
  }
}

/* Colophon styles */
.colophon {
  margin-top: 2rem;
  text-align: center;
  border-top: 1px solid rgba(255, 140, 66, 0.2);
  padding-top: 2rem;
}

.colophon-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-data);
}

.colophon-timestamp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--muted-data);
  opacity: 0.6;
  margin-top: 0.5rem;
}

/* Tier Navigation Dots */
.tier-nav {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  z-index: 100;
}

.tier-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--glow-edge);
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  opacity: 0.5;
}

.tier-dot:hover {
  opacity: 0.8;
  box-shadow: 0 0 15px rgba(255, 159, 90, 0.3);
}

.tier-dot.active {
  opacity: 1;
  background: var(--glow-edge);
  box-shadow: 0 0 20px rgba(255, 159, 90, 0.5);
}

.tier-dot.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--glow-edge);
  border-radius: 1px;
  animation: underline-draw 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes underline-draw {
  from {
    width: 0;
  }
  to {
    width: 20px;
  }
}

/* Underline-draw animation for links/emphasized text */
a, .underline-draw {
  background-image: linear-gradient(var(--glow-edge), var(--glow-edge));
  background-position: 0 100%;
  background-size: 0% 2px;
  background-repeat: no-repeat;
  transition: background-size 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

a:hover, .underline-draw:hover {
  background-size: 100% 2px;
}

/* Mobile/Tablet Adaptation */
@media (max-width: 1200px) {
  .bento-grid {
    grid-template-columns: repeat(8, 1fr);
  }

  .oracle-cell {
    grid-column: span 8 !important;
    grid-row: span 1 !important;
    min-height: 200px;
  }

  .signal-cell {
    grid-column: span 4 !important;
    grid-row: span 1 !important;
  }

  .tide-cell {
    grid-column: span 8 !important;
    grid-row: span 1 !important;
  }

  .oracle-main {
    min-height: 300px;
  }
}

@media (max-width: 768px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .bento-cell {
    border-radius: 12px;
    padding: clamp(1rem, 2vw, 1.5rem);
  }

  .oracle-cell, .signal-cell, .tide-cell {
    grid-column: span 2 !important;
    grid-row: span 1 !important;
    min-height: auto;
  }

  .oracle-cell {
    min-height: 180px;
  }

  .oracle-main {
    min-height: 250px;
  }

  .oracle-final {
    min-height: 100vh;
    grid-column: span 2 !important;
  }

  .tier {
    padding: 1rem;
  }

  .tier-nav {
    right: 1rem;
    gap: 1rem;
  }

  .tier-dot {
    width: 10px;
    height: 10px;
    border-width: 1.5px;
  }

  .domain-title {
    font-size: clamp(1.8rem, 5vw, 3rem);
  }

  .final-proclamation {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }
}

@media (max-width: 480px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }

  .oracle-cell, .signal-cell, .tide-cell {
    grid-column: 1 !important;
  }

  .tier-nav {
    flex-direction: row;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    bottom: 1rem;
    top: auto;
    width: auto;
    gap: 0.75rem;
  }

  .tier-dot.active::after {
    bottom: -6px;
  }

  .domain-title {
    font-size: clamp(1.4rem, 4vw, 2.2rem);
  }

  .coordinate-label {
    font-size: 0.65rem;
  }

  .waveform-container {
    height: 60px;
    gap: 3px;
  }

  .wave {
    width: 6px;
  }
}

/* Tier-specific adjustments */
.tier-two {
  --bokeh-density: 0.8;
}

.tier-three {
  --bokeh-density: 0.6;
}

.tier-four {
  --bokeh-density: 1;
}

.tier-five {
  --bokeh-density: 0.3;
}
