/* telomere.digital — grainy cinematic documentary */

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

:root {
  --grain-bg: #1a1420;
  --neon-green: #00ff88;
  --neon-pink: #ff0088;
  --grain-white: #d0c8c0;
  --duotone-teal: #008888;
  --grid-faint: #2a2430;
  --deep-black: #0a0810;
}

html, body {
  background: var(--grain-bg);
  color: var(--grain-white);
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection { background: var(--neon-green); color: var(--deep-black); }

/* ---------- film grain ---------- */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.05;
  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='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.9'/></svg>");
  mix-blend-mode: overlay;
  animation: grain-shift 0.6s steps(6) infinite;
}

@keyframes grain-shift {
  0% { transform: translate(0,0); }
  10% { transform: translate(-3px,2px); }
  20% { transform: translate(2px,-1px); }
  30% { transform: translate(-1px,3px); }
  40% { transform: translate(3px,1px); }
  50% { transform: translate(-2px,-2px); }
  60% { transform: translate(1px,-3px); }
  70% { transform: translate(-3px,-1px); }
  80% { transform: translate(2px,2px); }
  90% { transform: translate(-1px,1px); }
  100% { transform: translate(0,0); }
}

/* ---------- grid lines ---------- */
.grid-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.04;
  background-image:
    linear-gradient(to right, var(--grain-white) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grain-white) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ---------- topbar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(20px, 5vw, 60px);
  background: linear-gradient(180deg, rgba(10,8,16,0.75) 0%, transparent 100%);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--grain-white);
  text-transform: uppercase;
}

.brand-mark {
  color: var(--neon-green);
  font-size: 18px;
  animation: brand-glow 3s ease-in-out infinite;
}

@keyframes brand-glow {
  0%, 100% { text-shadow: 0 0 6px rgba(0,255,136,0.6); }
  50% { text-shadow: 0 0 12px rgba(0,255,136,0.9); }
}

.brand-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(208,200,192,0.6);
  text-transform: uppercase;
}

.brand-meta .bar {
  width: 22px;
  height: 1px;
  background: rgba(208,200,192,0.4);
}

.kinetic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-pink);
  box-shadow: 0 0 8px var(--neon-pink);
  animation: rec-blink 1.6s ease-in-out infinite;
}

@keyframes rec-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---------- opening ---------- */
.opening {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 120px clamp(20px, 6vw, 80px) 100px;
  max-width: 1200px;
  margin: 0 auto;
  z-index: 2;
}

.opening-eyebrow {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  opacity: 0;
  animation: fade-up 700ms 200ms ease forwards;
}

.ey-line {
  width: 36px;
  height: 1px;
  background: var(--neon-green);
}

.ey-text {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--neon-green);
  text-transform: uppercase;
}

.opening-title {
  font-family: "Sora", sans-serif;
  font-weight: 800;
  font-size: clamp(42px, 8.5vw, 120px);
  line-height: 0.96;
  color: var(--grain-white);
  letter-spacing: -0.012em;
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.kt {
  display: inline-block;
  opacity: 0;
  transform: translateY(0);
  animation:
    kt-enter 700ms ease forwards,
    kt-kinetic 4s ease-in-out infinite;
}

.kt:nth-child(1) { animation-delay: 400ms, 1100ms; }
.kt:nth-child(2) { animation-delay: 460ms, 1140ms; }
.kt:nth-child(3) { animation-delay: 520ms, 1180ms; }
.kt:nth-child(4) { animation-delay: 580ms, 1220ms; }
.kt:nth-child(5) { animation-delay: 640ms, 1260ms; }
.kt:nth-child(6) { animation-delay: 700ms, 1300ms; }
.kt:nth-child(7) { animation-delay: 760ms, 1340ms; }
.kt:nth-child(8) { animation-delay: 820ms, 1380ms; }
.kt:nth-child(9) { animation-delay: 880ms, 1420ms; color: var(--neon-pink); }
.kt:nth-child(10) { animation-delay: 940ms, 1460ms; }
.kt:nth-child(11) { animation-delay: 1000ms, 1500ms; }
.kt:nth-child(12) { animation-delay: 1060ms, 1540ms; }
.kt:nth-child(13) { animation-delay: 1120ms, 1580ms; }
.kt:nth-child(14) { animation-delay: 1180ms, 1620ms; }
.kt:nth-child(15) { animation-delay: 1240ms, 1660ms; }
.kt:nth-child(16) { animation-delay: 1300ms, 1700ms; }

.kt-dot { color: var(--neon-pink); padding: 0 0.04em; }

@keyframes kt-enter {
  from { opacity: 0; transform: translateY(20px) rotate(-2deg); }
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

@keyframes kt-kinetic {
  0%, 100% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-1px) scale(1.005); }
  50% { transform: translateY(0.5px) scale(1); }
  75% { transform: translateY(-0.5px) scale(0.998); }
}

.title-underline {
  display: block;
  width: 0;
  height: 3px;
  background: var(--neon-green);
  box-shadow: 0 0 12px rgba(0,255,136,0.7);
  animation: underline-draw 1500ms 1500ms cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  margin-bottom: 30px;
}

@keyframes underline-draw {
  to { width: 220px; }
}

.opening-strap {
  font-size: clamp(16px, 1.6vw, 19px);
  max-width: 56ch;
  color: rgba(208,200,192,0.85);
  margin-bottom: 36px;
  opacity: 0;
  animation: fade-up 900ms 1800ms ease forwards;
}

.opening-strap em {
  font-style: italic;
  color: var(--neon-green);
  font-weight: 500;
}

.opening-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--grain-white);
  opacity: 0;
  animation: fade-up 900ms 2100ms ease forwards;
}

.meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-key {
  color: rgba(208,200,192,0.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 10px;
}

.meta-val {
  color: var(--grain-white);
  letter-spacing: 0.04em;
}

.opening-pulse {
  position: absolute;
  bottom: 50px;
  right: clamp(20px, 6vw, 80px);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: rgba(208,200,192,0.6);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neon-pink);
  box-shadow: 0 0 12px var(--neon-pink);
  animation: rec-blink 1.6s ease-in-out infinite;
}

@keyframes fade-up {
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- reel ---------- */
.reel {
  position: relative;
  z-index: 2;
  max-width: 680px;
  margin: 0 auto;
  padding: 60px clamp(20px, 4vw, 40px) 160px;
  display: flex;
  flex-direction: column;
  gap: 100px;
}

.chapter {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.chapter.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.ch-header {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--grid-faint);
}

.ch-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  color: var(--neon-green);
  letter-spacing: 0.06em;
}

.ch-title-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(208,200,192,0.5);
}

.ch-title {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 5vw, 56px);
  line-height: 1.05;
  color: var(--grain-white);
  letter-spacing: -0.005em;
  margin-bottom: 22px;
  animation: kinetic-soft 6s ease-in-out infinite;
}

.ch-title-alt {
  display: block;
  color: var(--neon-green);
  font-weight: 600;
  font-style: italic;
}

@keyframes kinetic-soft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.5px); }
}

.ch-lede {
  font-size: 1.06em;
  line-height: 1.85;
  color: var(--grain-white);
  margin-bottom: 24px;
}

.ch-lede em {
  color: var(--neon-pink);
  font-style: italic;
}

.ch-body {
  margin-bottom: 18px;
  color: rgba(208,200,192,0.86);
}

.ch-body em { color: var(--neon-green); font-style: italic; }

.seq {
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
  background: rgba(0,255,136,0.1);
  color: var(--neon-green);
  padding: 1px 8px;
  border: 1px solid rgba(0,255,136,0.4);
  border-radius: 3px;
  font-size: 0.9em;
  letter-spacing: 0.04em;
}

/* ---------- frame / zoom-focus image ---------- */
.frame {
  margin: 30px 0;
}

.frame-inner {
  position: relative;
  background: var(--deep-black);
  overflow: hidden;
  cursor: zoom-in;
}

.frame-svg {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 320ms ease, filter 320ms ease;
  filter: contrast(0.95);
}

.frame-inner:hover .frame-svg {
  transform: scale(1.1);
  filter: contrast(1.1) saturate(1.05);
}

.frame-crop {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--neon-green);
  pointer-events: none;
  opacity: 0.85;
}

.frame-crop-tl { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.frame-crop-tr { top: 8px; right: 8px; border-left: none; border-bottom: none; }
.frame-crop-bl { bottom: 8px; left: 8px; border-right: none; border-top: none; }
.frame-crop-br { bottom: 8px; right: 8px; border-left: none; border-top: none; }

.frame figcaption {
  margin-top: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: rgba(208,200,192,0.6);
  letter-spacing: 0.04em;
  line-height: 1.6;
}

.cap-mark {
  display: inline-block;
  background: var(--neon-pink);
  color: var(--deep-black);
  padding: 1px 6px;
  margin-right: 8px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

/* ---------- data strip ---------- */
.data-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--grid-faint);
  border: 1px solid var(--grid-faint);
  margin: 30px 0;
}

.data-cell {
  background: var(--deep-black);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  transition: background 280ms ease;
}

.data-cell:hover {
  background: #110d18;
}

.data-cell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 1px;
  background: var(--neon-green);
}

.data-num {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 26px;
  color: var(--grain-white);
  letter-spacing: -0.005em;
  line-height: 1;
}

.data-unit {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--neon-pink);
  letter-spacing: 0.06em;
}

.data-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: rgba(208,200,192,0.55);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 4px;
}

/* ---------- hypotheses list ---------- */
.hypotheses {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 28px 0 8px;
  border-top: 1px solid var(--grid-faint);
}

.hypotheses li {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--grid-faint);
  align-items: baseline;
  transition: padding-left 320ms ease, background 320ms ease;
}

.hypotheses li:hover {
  padding-left: 14px;
  background: rgba(0,255,136,0.03);
}

.hyp-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--neon-green);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hyp-text {
  font-size: 16px;
  color: rgba(208,200,192,0.86);
  line-height: 1.7;
}

/* ---------- closing ---------- */
.closing-card {
  margin-top: 46px;
  padding: 28px 24px;
  border: 1px solid var(--neon-green);
  background: rgba(0,255,136,0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.closing-mark {
  font-size: 24px;
  color: var(--neon-green);
}

.closing-text {
  font-family: "Sora", sans-serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--grain-white);
}

.closing-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: rgba(208,200,192,0.5);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .opening { padding: 110px 20px 80px; }
  .opening-pulse { right: 20px; bottom: 30px; }
  .reel { padding: 40px 20px 100px; gap: 70px; }
  .data-strip { grid-template-columns: repeat(2, 1fr); }
  .brand-meta span:first-child { display: none; }
  .brand-meta .bar { display: none; }
}
