/* ============================================
   concurrent.day — Styles
   Y2K Futurism × Deep Burgundy × Botanical Lab
   ============================================ */

/* --- Custom Properties --- */
:root {
  --deep-claret: #2b0a14;
  --burgundy-core: #6b1d3a;
  --oxidized-rose: #8c3a5a;
  --bruised-copper: #b86e4a;
  --bone: #f2e8e0;
  --ash: #c4b5a8;
  --wine-glass: #3a0f1e;
  --chrome-plum: #d4a0b8;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}

body {
  background: var(--deep-claret);
  color: var(--bone);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Skeleton Shimmer Keyframes --- */
@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }
  100% {
    background-position: 400px 0;
  }
}

@keyframes shimmer-wide {
  0% {
    background-position: -800px 0;
  }
  100% {
    background-position: 800px 0;
  }
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes drawPath {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes counterFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* --- Thread Counter (Fixed) --- */
.thread-counter {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  background: var(--wine-glass);
  border: 1px solid var(--burgundy-core);
  border-radius: 20px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
}

.thread-counter-inner {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--chrome-plum);
  white-space: nowrap;
}

.thread-counter.flash .thread-counter-inner {
  animation: counterFlash 0.4s ease-in-out;
}

/* --- Horizontal Rules & Node Dots --- */
.h-rule {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--burgundy-core);
  pointer-events: none;
}

.node-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--oxidized-rose);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  background: var(--deep-claret);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  scroll-snap-align: start;
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 90%;
  max-width: 1400px;
  gap: 4rem;
}

.hero-text {
  flex: 1;
  max-width: 60%;
}

.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(3.5rem, 9vw, 8rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--bone);
}

.title-line {
  display: block;
}

.hero-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--oxidized-rose);
  margin-top: 2rem;
}

/* --- Fern Illustration (Hero) --- */
.hero-fern {
  position: relative;
  flex: 0 0 320px;
  height: 500px;
}

.fern-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--wine-glass) 0%,
    var(--chrome-plum) 50%,
    var(--wine-glass) 100%
  );
  background-size: 800px 100%;
  animation: shimmer-wide 3s ease-in-out infinite;
  border-radius: 4px;
  opacity: 1;
  transition: opacity 0.8s ease;
}

.fern-shimmer.hidden {
  opacity: 0;
  pointer-events: none;
}

.fern-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.6s ease 0.3s;
}

.fern-svg.visible {
  opacity: 1;
}

.fern-path {
  fill: none;
  stroke: var(--oxidized-rose);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
}

.fern-svg.visible .fern-path {
  animation: drawPath 2s ease forwards;
}

.fern-svg.visible .fern-path:nth-child(1) { animation-delay: 0s; }
.fern-svg.visible .fern-path:nth-child(2) { animation-delay: 0.05s; }
.fern-svg.visible .fern-path:nth-child(3) { animation-delay: 0.08s; }
.fern-svg.visible .fern-path:nth-child(4) { animation-delay: 0.11s; }
.fern-svg.visible .fern-path:nth-child(5) { animation-delay: 0.14s; }
.fern-svg.visible .fern-path:nth-child(6) { animation-delay: 0.17s; }
.fern-svg.visible .fern-path:nth-child(7) { animation-delay: 0.2s; }
.fern-svg.visible .fern-path:nth-child(8) { animation-delay: 0.23s; }
.fern-svg.visible .fern-path:nth-child(9) { animation-delay: 0.26s; }
.fern-svg.visible .fern-path:nth-child(10) { animation-delay: 0.29s; }
.fern-svg.visible .fern-path:nth-child(11) { animation-delay: 0.32s; }
.fern-svg.visible .fern-path:nth-child(12) { animation-delay: 0.35s; }
.fern-svg.visible .fern-path:nth-child(13) { animation-delay: 0.38s; }
.fern-svg.visible .fern-path:nth-child(14) { animation-delay: 0.41s; }
.fern-svg.visible .fern-path:nth-child(15) { animation-delay: 0.44s; }
.fern-svg.visible .fern-path:nth-child(16) { animation-delay: 0.47s; }
.fern-svg.visible .fern-path:nth-child(17) { animation-delay: 0.5s; }
.fern-svg.visible .fern-path:nth-child(18) { animation-delay: 0.53s; }
.fern-svg.visible .fern-path:nth-child(19) { animation-delay: 0.56s; }
.fern-svg.visible .fern-path:nth-child(20) { animation-delay: 0.59s; }
.fern-svg.visible .fern-path:nth-child(21) { animation-delay: 0.62s; }
.fern-svg.visible .fern-path:nth-child(22) { animation-delay: 0.65s; }
.fern-svg.visible .fern-path:nth-child(23) { animation-delay: 0.68s; }
.fern-svg.visible .fern-path:nth-child(24) { animation-delay: 0.71s; }
.fern-svg.visible .fern-path:nth-child(25) { animation-delay: 0.74s; }

.fern-label {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 9px;
  letter-spacing: 0.06em;
  fill: var(--oxidized-rose);
  text-transform: uppercase;
  opacity: 0;
}

.fern-svg.visible .fern-label {
  opacity: 1;
  transition: opacity 0.5s ease 1.5s;
}

.fern-leader {
  stroke: var(--oxidized-rose);
  stroke-width: 0.5;
  opacity: 0;
}

.fern-svg.visible .fern-leader {
  opacity: 0.6;
  transition: opacity 0.5s ease 1.5s;
}

/* ============================================
   GRID SECTION (Specimen Wall)
   ============================================ */
.grid-section {
  position: relative;
  padding: 4rem 5%;
  scroll-snap-align: start;
}

.specimen-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(200px, auto);
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.grid-cell {
  position: relative;
  background: var(--wine-glass);
  border: 1px solid var(--burgundy-core);
  overflow: hidden;
  min-height: 200px;
  transition: border-color 0.3s ease;
}

.grid-cell:hover {
  border-color: var(--oxidized-rose);
}

.grid-cell:hover .cell-illustration {
  filter: drop-shadow(0 0 8px rgba(140, 58, 90, 0.4));
}

/* Span modifiers */
.span-row-2 {
  grid-row: span 2;
}

.span-col-2 {
  grid-column: span 2;
}

/* --- Cell Shimmer --- */
.cell-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--wine-glass) 0%,
    var(--chrome-plum) 50%,
    var(--wine-glass) 100%
  );
  background-size: 800px 100%;
  animation: shimmer-wide 3s ease-in-out infinite;
  z-index: 2;
  opacity: 1;
  transition: opacity 0.6s ease;
}

.cell-shimmer.resolved {
  opacity: 0;
  pointer-events: none;
}

.active-forever {
  opacity: 1 !important;
  pointer-events: none;
}

/* --- Cell Content --- */
.cell-content {
  position: relative;
  z-index: 1;
  padding: 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease 0.3s;
}

.cell-content.visible {
  opacity: 1;
}

.permanent-shimmer .cell-content {
  opacity: 1;
  z-index: 3;
  justify-content: flex-end;
  align-items: flex-start;
}

.cell-text {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: clamp(0.95rem, 1.1vw, 1.15rem);
  line-height: 1.7;
  color: var(--ash);
  margin-bottom: 1rem;
}

.cell-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--oxidized-rose);
}

.pending-label {
  color: var(--chrome-plum);
  opacity: 0.7;
}

/* --- Cell SVG Illustrations --- */
.cell-illustration {
  width: 100%;
  max-height: 100%;
  transition: filter 0.3s ease;
}

.cell-illustration.wide {
  max-height: 200px;
}

/* Mycelium Network */
.mycelium-node {
  fill: var(--oxidized-rose);
  opacity: 0.8;
}

.mycelium-path {
  fill: none;
  stroke: var(--oxidized-rose);
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* Root Cross-Section */
.root-ring {
  fill: none;
  stroke: var(--oxidized-rose);
  stroke-width: 1.5;
}

.root-ray {
  stroke: var(--oxidized-rose);
  stroke-width: 0.8;
  opacity: 0.5;
}

/* Panicle / Inflorescence */
.panicle-path {
  fill: none;
  stroke: var(--oxidized-rose);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.panicle-bud {
  fill: none;
  stroke: var(--oxidized-rose);
  stroke-width: 1.5;
}

/* Pinnule */
.pinnule-path {
  fill: none;
  stroke: var(--oxidized-rose);
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* Tall Fern */
.tall-fern {
  fill: none;
  stroke: var(--oxidized-rose);
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* Fiber Ring / Ray */
.fiber-ring {
  fill: none;
  stroke: var(--oxidized-rose);
  stroke-width: 1.5;
}

.fiber-ray {
  stroke: var(--oxidized-rose);
  stroke-width: 0.8;
  opacity: 0.5;
}

/* Cell Labels */
.cell-label {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 300;
  font-size: 9px;
  letter-spacing: 0.06em;
  fill: var(--oxidized-rose);
  text-transform: uppercase;
}

/* ============================================
   LOWER GRID (Compressed)
   ============================================ */
.lower-grid {
  padding-top: 2rem;
}

.specimen-grid.lower {
  grid-auto-rows: minmax(180px, auto);
  gap: 12px;
}

.specimen-grid.lower .grid-cell {
  min-height: 180px;
}

/* ============================================
   MANIFESTO RIBBON
   ============================================ */
.manifesto-ribbon {
  width: 100%;
  height: 4rem;
  background: var(--burgundy-core);
  overflow: hidden;
  display: flex;
  align-items: center;
  scroll-snap-align: start;
}

.manifesto-track {
  display: flex;
  white-space: nowrap;
  animation: marquee 30s linear infinite;
}

.manifesto-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  color: var(--bone);
  white-space: nowrap;
  padding-right: 0;
}

/* ============================================
   ROOT SYSTEM (Footer)
   ============================================ */
.root-system {
  position: relative;
  width: 100%;
  min-height: 450px;
  background: var(--deep-claret);
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-snap-align: end;
  padding-bottom: 3rem;
}

.roots-svg {
  width: 100%;
  max-width: 1400px;
  height: 400px;
}

.root-path {
  fill: none;
  stroke: var(--oxidized-rose);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  transition: stroke-dashoffset 0.1s linear;
}

.root-terminal {
  fill: var(--bruised-copper);
  opacity: 0;
  transition: opacity 0.6s ease;
}

.root-terminal.visible {
  opacity: 1;
}

.root-footer-text {
  margin-top: 2rem;
  text-align: center;
}

.root-footer-text span {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--oxidized-rose);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .hero-content {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }

  .hero-text {
    max-width: 100%;
  }

  .hero-fern {
    flex: 0 0 260px;
    height: 400px;
    width: 260px;
  }

  .specimen-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .span-col-2 {
    grid-column: span 2;
  }
}

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

  .span-col-2 {
    grid-column: span 1;
  }

  .span-row-2 {
    grid-row: span 1;
  }

  .hero-fern {
    flex: 0 0 200px;
    height: 320px;
    width: 200px;
  }

  .hero-title {
    font-size: clamp(2.5rem, 12vw, 5rem);
  }

  .manifesto-text {
    font-size: 1.4rem;
  }

  .manifesto-ribbon {
    height: 3rem;
  }

  .thread-counter {
    top: 12px;
    right: 12px;
  }

  .grid-section {
    padding: 2rem 4%;
  }
}
