/* ============================================================
   FALLGESCHICHTE — Anerkennung & Missachtung
   Geteiltes Design-System für Buch & Slideshow
   ============================================================ */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Spectral:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400;1,500&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ---------- Tokens ---------- */
:root{
  /* type families (tweakable) */
  --f-display: 'Cormorant Garamond', Georgia, serif;
  --f-body: 'Spectral', Georgia, serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* DARK PHASE — der Fall, die Theorie */
  --ink-bg:        #17130c;
  --ink-bg-2:      #201a11;
  --ink-panel:     #251d12;
  --ink-text:      #f1ece1;
  --ink-muted:     #b9ab93;
  --ink-faint:     #7d6f59;
  --ink-line:      rgba(241,236,225,.14);
  --ink-line-2:    rgba(241,236,225,.07);

  /* accents (shared across phases) */
  --accent:        #c2563e;   /* warm rust-red */
  --accent-soft:   #d98b6f;
  --gold:          #c79a5b;
  --slate:         #8aa0b8;

  /* LIGHT PHASE — die Aufhellung, Reckahner, Lösung */
  --paper-bg:      #f3ede2;
  --paper-bg-2:    #ece4d6;
  --paper-text:    #20303f;
  --paper-muted:   #5d6b78;
  --paper-line:    rgba(32,48,63,.14);

  /* live theme vars (set per phase) */
  --bg:    var(--ink-bg);
  --bg-2:  var(--ink-bg-2);
  --panel: var(--ink-panel);
  --text:  var(--ink-text);
  --muted: var(--ink-muted);
  --line:  var(--ink-line);
  --line-2:var(--ink-line-2);

  --measure: 34rem;
  --ease: cubic-bezier(.22,.61,.36,1);
  --anim-scale: 1; /* tweakable animation intensity 0..1.4 */
}

*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--f-body);
  font-weight:400;
  font-size:clamp(17px,1.05vw + 12px,21px);
  line-height:1.62;
  text-rendering:optimizeLegibility;
  -webkit-font-smoothing:antialiased;
  transition:background .9s var(--ease), color .9s var(--ease);
}

/* phase backgrounds applied to body via data attr */
body[data-phase="light"]{
  --bg:var(--paper-bg); --bg-2:var(--paper-bg-2); --panel:#fbf6ec;
  --text:var(--paper-text); --muted:var(--paper-muted);
  --line:var(--paper-line); --line-2:rgba(32,48,63,.07);
}
body[data-phase="dawn"]{
  --bg:#2b251b; --bg-2:#332c20; --panel:#393124;
  --text:#f0ebe0; --muted:#b3a890; --line:rgba(240,235,224,.16); --line-2:rgba(240,235,224,.08);
}

::selection{ background:var(--accent); color:#fff; }

/* ---------- Typography primitives ---------- */
.kicker{
  font-family:var(--f-mono);
  font-size:.72rem;
  letter-spacing:.32em;
  text-transform:uppercase;
  color:var(--accent-soft);
  font-weight:500;
  margin:0 0 1.4em;
  display:flex; align-items:center; gap:.9em;
}
.kicker::before{
  content:""; width:2.4em; height:1px; background:var(--accent);
  opacity:.7; flex:none;
}
.kicker.center{ justify-content:center; }
.kicker.center::after{
  content:""; width:2.4em; height:1px; background:var(--accent); opacity:.7;
}

h1,h2,h3{ font-family:var(--f-display); font-weight:600; line-height:1.08; margin:0; }
h1{ font-size:clamp(2.6rem,6.5vw,5.4rem); letter-spacing:-.01em; line-height:1.07; }
h2{ font-size:clamp(2rem,4.4vw,3.4rem); letter-spacing:-.005em; line-height:1.12; }
h3{ font-size:clamp(1.4rem,2.4vw,2rem); line-height:1.16; }

.lede{
  font-size:clamp(1.18rem,1.5vw,1.5rem);
  line-height:1.5;
  color:var(--text);
  font-weight:400;
}
p{ margin:0 0 1.15em; max-width:var(--measure); text-wrap:pretty; }
em{ font-style:italic; }
strong{ font-weight:600; color:var(--text); }

.drop::first-letter{
  font-family:var(--f-display);
  font-size:3.6em; line-height:.74; float:left;
  padding:.06em .12em 0 0; color:var(--accent); font-weight:600;
}

/* ---------- Theory inset ---------- */
.theory{
  border-left:2px solid var(--accent);
  padding:.2em 0 .2em 1.5em;
  margin:2.4em 0;
  max-width:var(--measure);
}
.theory .tag{
  font-family:var(--f-mono); font-size:.66rem; letter-spacing:.26em;
  text-transform:uppercase; color:var(--accent-soft); display:block; margin-bottom:.7em;
}
.theory h4{
  font-family:var(--f-display); font-weight:600;
  font-size:1.5rem; margin:0 0 .35em; line-height:1.1;
}
.theory p{ font-size:.95em; color:var(--muted); }
.theory cite{
  font-family:var(--f-mono); font-style:normal; font-size:.72rem;
  color:var(--muted); opacity:.8;
}

/* ---------- Pull quote ---------- */
.pull{
  font-family:var(--f-display);
  font-size:clamp(1.6rem,3.4vw,2.9rem);
  line-height:1.18; font-weight:500; font-style:italic;
  color:var(--text); max-width:24ch; margin:0;
  text-wrap:balance;
}
.pull .mark{ color:var(--accent); font-style:normal; }
.attrib{
  font-family:var(--f-mono); font-size:.74rem; letter-spacing:.12em;
  color:var(--muted); margin-top:1.4em; text-transform:uppercase;
}

/* ---------- Veil (harsh quotes hidden until revealed) ---------- */
.veil{
  position:relative; cursor:pointer; border-radius:2px;
  display:inline-block; isolation:isolate;
}
.veil .content{
  filter:blur(8px); opacity:.5; transition:filter .6s var(--ease), opacity .6s var(--ease);
  user-select:none;
}
.veil .hint{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-family:var(--f-mono); font-size:.7rem; letter-spacing:.2em; text-transform:uppercase;
  color:var(--accent-soft); transition:opacity .4s; pointer-events:none; text-align:center;
}
.veil.revealed .content{ filter:none; opacity:1; user-select:text; }
.veil.revealed .hint{ opacity:0; }

/* ---------- Image treatments ---------- */
figure{ margin:0; }
.etch{
  filter:saturate(.78) contrast(1.04);
  display:block; max-width:100%; height:auto;
}
.etch.cut{ /* transparent cut-out illustration */
  filter:drop-shadow(0 30px 60px rgba(0,0,0,.5)) saturate(.85);
}
.framed{
  border:1px solid var(--line);
  box-shadow:0 40px 90px -30px rgba(0,0,0,.65);
  background:var(--panel);
}
figcaption{
  font-family:var(--f-mono); font-size:.7rem; letter-spacing:.1em;
  color:var(--muted); margin-top:1em; line-height:1.5; max-width:42ch;
}
figcaption .src{ opacity:.6; }

/* ---------- Mirror leitmotif ---------- */
.mirror-wrap{ position:relative; }
.mirror-wrap .reflection{
  transform:scaleY(-1);
  -webkit-mask-image:linear-gradient(to bottom, rgba(0,0,0,.4), transparent 62%);
          mask-image:linear-gradient(to bottom, rgba(0,0,0,.4), transparent 62%);
  opacity:.5; pointer-events:none; margin-top:-1px;
}
body.no-mirror .reflection{ display:none; }
body.no-mirror .mirror-line{ display:none; }
.mirror-line{
  position:fixed; top:0; bottom:0; left:50%; width:1px;
  background:linear-gradient(to bottom, transparent, var(--accent), transparent);
  opacity:.12; pointer-events:none; z-index:2; mix-blend-mode:screen;
}

/* ---------- Redesigned charts ---------- */
.chart{ width:100%; max-width:50rem; margin:1em 0; }
.bar-row{ display:grid; grid-template-columns:1fr; gap:1.5em; }
.bar{ display:grid; grid-template-columns:1fr; gap:.7em; }
.bar .bhead{ display:flex; justify-content:space-between; align-items:flex-end; gap:1.4em; }
.bar .blabel{ font-family:var(--f-body); font-size:1rem; line-height:1.3; color:var(--text); }
.bar .bval{ font-family:var(--f-display); font-size:2rem; font-weight:600; color:var(--accent); line-height:.9; flex:none; }
.bar.good .bval{ color:var(--gold); }
.bar .btrack{ height:10px; background:var(--line); border-radius:99px; overflow:hidden; }
.bar .bfill{ height:100%; width:var(--w,0%); background:var(--accent); border-radius:99px;
  transition:width 1.1s var(--ease); }
.bar.good .bfill{ background:var(--gold); }
.bar .bnote{ font-family:var(--f-mono); font-size:.7rem; color:var(--muted); letter-spacing:.04em; }

.taxon{ display:grid; gap:.7em; max-width:38rem; }
.taxon .t-item{
  display:flex; gap:1em; align-items:baseline; padding:.85em 1.1em;
  background:var(--panel); border:1px solid var(--line); border-radius:3px;
}
.taxon .t-no{ font-family:var(--f-mono); font-size:.72rem; color:var(--accent-soft); flex:none; }
.taxon .t-text{ font-size:.98rem; }
.taxon .t-text b{ color:var(--text); }

.steps{ display:grid; gap:0; max-width:40rem; counter-reset:s; }
.steps .step{
  display:grid; grid-template-columns:auto 1fr; gap:1.4em; padding:1.3em 0;
  border-top:1px solid var(--line); align-items:start;
}
.steps .step:last-child{ border-bottom:1px solid var(--line); }
.steps .step .num{
  font-family:var(--f-display); font-size:1.9rem; font-weight:600; color:var(--accent);
  line-height:1; counter-increment:s; min-width:1.3em;
}
.steps .step .num::before{ content:counter(s,decimal-leading-zero); }
.steps .step h5{ margin:0 0 .25em; font-family:var(--f-display); font-size:1.35rem; font-weight:600; }
.steps .step p{ margin:0; font-size:.92rem; color:var(--muted); }

/* ---------- Sources accordion ---------- */
.sources{ border-top:1px solid var(--line); }
.sources summary{
  list-style:none; cursor:pointer; padding:1.4em 0;
  display:flex; align-items:center; justify-content:space-between; gap:1em;
  font-family:var(--f-mono); font-size:.78rem; letter-spacing:.18em; text-transform:uppercase;
  color:var(--muted);
}
.sources summary::-webkit-details-marker{ display:none; }
.sources summary .chev{ transition:transform .35s var(--ease); }
.sources[open] summary .chev{ transform:rotate(45deg); }
.sources .reflist{
  font-family:var(--f-mono); font-size:.78rem; line-height:1.75; color:var(--muted);
  padding-bottom:2em; columns:2; column-gap:3em; max-width:none;
}
.sources .reflist p{ break-inside:avoid; margin:0 0 1em; max-width:none; }
@media (max-width:720px){ .sources .reflist{ columns:1; } }

/* ---------- Reflexionsraum (interactive) ---------- */
.reflect{
  background:var(--panel); border:1px solid var(--line); border-radius:4px;
  padding:clamp(1.6rem,3vw,2.6rem);
}
.reflect .q{ font-family:var(--f-display); font-size:1.5rem; font-weight:600; color:var(--text); margin:0 0 1em; line-height:1.2; }
.reflect textarea{
  width:100%; min-height:7em; resize:vertical;
  background:var(--bg-2); color:var(--text);
  border:1px solid var(--line); border-radius:3px; padding:1em 1.1em;
  font-family:var(--f-body); font-size:1rem; line-height:1.5;
}
.reflect textarea:focus{ outline:none; border-color:var(--accent); }
.reflect textarea::placeholder{ color:var(--muted); opacity:.6; }
.reflect .meta{
  display:flex; justify-content:space-between; align-items:center; margin-top:.8em;
  font-family:var(--f-mono); font-size:.7rem; letter-spacing:.06em; color:var(--muted);
}
.reflect .saved{ color:var(--gold); opacity:0; transition:opacity .4s; }
.reflect .saved.on{ opacity:1; }

/* ---------- Buttons ---------- */
.btn{
  font-family:var(--f-mono); font-size:.74rem; letter-spacing:.18em; text-transform:uppercase;
  color:var(--text); background:transparent; border:1px solid var(--line);
  padding:.95em 1.6em; border-radius:99px; cursor:pointer; text-decoration:none;
  display:inline-flex; align-items:center; gap:.7em; transition:all .3s var(--ease);
}
.btn:hover{ border-color:var(--accent); color:var(--accent-soft); }
.btn.solid{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.solid:hover{ background:var(--accent-soft); border-color:var(--accent-soft); color:#1a1a1a; }

/* reduced-motion */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.001ms !important; transition-duration:.001ms !important; }
}
