/* ============================================================
   DNA — Wissenschaftliche Visualisierung
   Farbsystem: heller, neutraler Hintergrund + vier kräftige
   Neon-Akzentfarben für die vier Basen — gut sichtbar auf Weiß.
   Das Rückgrat (Zucker-Phosphat) bleibt überall neutral-grau,
   weil es chemisch in beiden Strängen identisch ist.
   ============================================================ */

:root{
  --bg:        #ffffff;
  --bg-soft:   #f4f6f9;
  --panel:     #eef1f5;
  --ink:       #14181f;
  --ink-dim:   #636c7a;
  --line:      #dfe3e9;

  --backbone:  #717a88;  /* Zucker-Phosphat-Rückgrat, neutral */

  --a: #0047ff;  /* Adenin   – Neon-Blau   */
  --t: #ff2d55;  /* Thymin   – Neon-Rot/Pink */
  --g: #00d957;  /* Guanin   – Neon-Grün   */
  --c: #ff9f00;  /* Cytosin  – Neon-Orange */

  --font-display: 'IBM Plex Mono', 'Courier New', monospace;
  --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection{ background: var(--a); color: #ffffff; }

/* Fortschrittsbalken: Struktur + Basis-Gradient leben in nav.css (nav.js erzeugt das Element dort) */

/* ---------------- Maßstabs-Anzeige ---------------- */

.zoom-indicator{
  position: fixed;
  top: 22px;
  left: 24px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-display);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(20,24,31,0.06);
  pointer-events: none;
}
.zoom-eyebrow{
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.zoom-scale{
  font-size: 0.82rem;
  color: var(--ink);
  transition: opacity .3s;
}
.zoom-name{
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-dim);
  transition: opacity .3s;
}

/* ---------------- Szenen-Navigation ---------------- */

.scene-dots{
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dot{
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--ink-dim);
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: background .25s, transform .25s, border-color .25s;
}
.dot:hover{ border-color: var(--ink); }
.dot.active{
  background: var(--a);
  border-color: var(--a);
  transform: scale(1.3);
}
.dot:focus-visible{
  outline: 2px solid var(--a);
  outline-offset: 3px;
}

@media (max-width: 880px){
  .scene-dots{ display: none; }
}

/* ---------------- Layout ---------------- */

.layout{
  display: flex;
  align-items: flex-start;
}

.visual-panel{
  position: sticky;
  top: 0;
  height: 100vh;
  width: 46%;
  flex-shrink: 0;
  background:
    radial-gradient(ellipse at 50% 30%, var(--bg-soft) 0%, var(--bg) 70%);
  border-right: 1px solid var(--line);
}

.visual-stage{
  position: relative;
  width: 100%;
  height: 100%;
}

.text-panel{
  width: 54%;
  position: relative;
  padding: 0 6vw;
}

@media (max-width: 880px){
  .layout{ flex-direction: column; }
  .visual-panel{ display: none; }
  .text-panel{ width: 100%; padding: 0 1.5rem; }
  .chapter{ margin-left: auto; margin-right: auto; padding-top: 3vh; padding-bottom: 3vh; min-height: unset; }
  .mob-scene-slot{
    display: block;
    width: 100%;
    height: 44vh;
    position: relative;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 30%, var(--bg-soft) 0%, var(--bg) 70%);
    border-bottom: 1px solid var(--line);
  }
  .mob-scene-slot .visual-stage{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
  .zoom-indicator{ display: none; }
}

/* ---------------- Layer-System (Crossfade) ---------------- */

.layer{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity .7s ease, transform .7s ease;
  pointer-events: none;
}
.layer.active{
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

#svg-helix{ width: 100%; height: 100%; }

.helix-annotations{ opacity: 0; transition: opacity .5s ease; }
.helix-annotations.show{ opacity: 1; }

/* ---------------- Kapitel-Texte ---------------- */

.chapter{
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8vh 0;
  max-width: 46ch;
}

.chapter-hero{ max-width: 30ch; }

.eyebrow{
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 1.1em;
}

h1{
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.08;
  font-weight: 600;
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h2{
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  margin: 0 0 0.7em;
  letter-spacing: -0.01em;
  color: var(--ink);
}

p{ margin: 0 0 1em; color: var(--ink); }

.lead{
  font-size: 1.05rem;
  color: var(--ink-dim);
}

.scroll-hint{
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--ink-dim);
  margin-top: 2em;
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob{
  0%, 100%{ transform: translateY(0); }
  50%{ transform: translateY(6px); }
}

.note{
  font-size: 0.84rem;
  color: var(--ink-dim);
  border-left: 2px solid var(--line);
  padding-left: 1em;
}

/* Faktenblatt (Doppelhelix-Kapitel) */

.fact-list{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9em 1.6em;
  margin: 1.6em 0 0;
  padding: 1.1em 0 0;
  border-top: 1px solid var(--line);
}
.fact-list div{ display: flex; flex-direction: column; gap: 2px; }
.fact-list dt{
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0;
}
.fact-list dd{
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin: 0;
  color: var(--ink);
}

/* ---------------- Helix-SVG ---------------- */

.helix-strand{
  fill: none;
  stroke: var(--backbone);
  stroke-width: 3;
  stroke-linecap: round;
}
.helix-rung{ stroke-width: 3.4; stroke-linecap: round; }
.helix-dot{ fill: var(--backbone); }

.helix-annotations text{
  font-family: var(--font-display);
  font-size: 11px;
  fill: var(--ink-dim);
}
.helix-annotations line{
  stroke: var(--ink-dim);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

/* ---------------- Segment-Karte (Szene 2) ---------------- */

.segment-track{
  display: flex;
  flex-direction: column;
  gap: 3px;
  height: 78%;
  width: 96px;
}
.segment{
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
}
.segment[data-type~="coding"]{ background: var(--c); }
.segment[data-type~="regulatory"]{ background: var(--g); }
.segment[data-type~="noncoding"]{ background: var(--backbone); }
.segment.hatch{
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.18) 0 6px, transparent 6px 12px);
}

.segment-label{
  position: absolute;
  left: calc(100% + 14px);
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--ink-dim);
}
.segment-label::before{
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  width: 10px;
  height: 1px;
  background: var(--ink-dim);
}

@media (max-width: 880px){
  .segment-label{ font-size: 0.62rem; }
}

/* ---------------- Codon-Streifen (Szene 3) ---------------- */

.codon-strip{ display: flex; flex-direction: column; gap: 0; }

.codon-strip-caption{
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--ink-dim);
  margin: 0 0 1.4em;
  text-align: center;
}

.codon-row{
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity .55s ease, transform .55s ease;
}
.codon-row.visible{ opacity: 1; transform: none; }

.codon-row::after{
  content: attr(data-aa);
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--ink-dim);
  white-space: nowrap;
}

.triplet{
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

.base{
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}
.base[data-base="A"]{ background: var(--a); color: #ffffff; }
.base[data-base="T"]{ background: var(--t); color: #ffffff; }
.base[data-base="G"]{ background: var(--g); color: var(--ink); }
.base[data-base="C"]{ background: var(--c); color: var(--ink); }

/* ---------------- Molekül-Schema (Szene 4) ---------------- */

#layer-molecule svg{ width: 100%; height: 100%; }

.mol-backbone{ stroke: var(--backbone); stroke-width: 3; }
.mol-backbone-fade{ stroke: var(--backbone); stroke-width: 3; opacity: 0.4; }
.mol-phosphate{ fill: var(--backbone); }
.mol-sugar{ fill: var(--bg-soft); stroke: var(--backbone); stroke-width: 2; }
.mol-bond{ stroke: var(--backbone); stroke-width: 2; }

.mol-base{ stroke: none; }
.mol-g{ fill: var(--g); }
.mol-c{ fill: var(--c); }
.mol-base-letter{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  fill: var(--ink);
  text-anchor: middle;
}

.mol-hbond{ stroke: var(--ink-dim); stroke-width: 1.6; stroke-dasharray: 3 3; }

.mol-leader{ stroke: var(--ink-dim); stroke-width: 1; opacity: 0.6; }
.mol-label{
  font-family: var(--font-display);
  font-size: 12px;
  fill: var(--ink-dim);
}
.mol-end{
  font-family: var(--font-display);
  font-size: 12px;
  fill: var(--ink-dim);
}
.mol-note{
  font-family: var(--font-display);
  font-size: 10px;
  fill: var(--ink-dim);
  opacity: 0.85;
}

/* ---------------- Rückblick (Szene 5) ---------------- */

.recap-scale{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 90%;
  position: relative;
}
.recap-scale::before{
  content: '';
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}
.recap-step{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  flex: 1;
}
.recap-dot{
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line);
}
.recap-dot[data-c="dim"]{ background: var(--backbone); }
.recap-dot[data-c="g"]{ background: var(--g); }
.recap-dot[data-c="a"]{ background: var(--a); }
.recap-dot[data-c="c"]{ background: var(--c); }

.recap-label{
  font-family: var(--font-display);
  font-size: 0.68rem;
  color: var(--ink-dim);
  text-align: center;
  line-height: 1.5;
}
.recap-label small{ opacity: 0.75; }

canvas {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;

  @media (max-width: 880px) {
    position: relative;
    clip-path: none;
  }
}

/* ---------------- Bewegungsreduktion ---------------- */

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *{
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}