/* theogonia.eu – Landing
   Farben aus config/stil.json (gold #C9A45C, verlauf #0B0F1A). Bewusst nur ein (dunkles) Thema. */
:root {
  --void: #06080d;
  --storm: #0b0f1a;
  --mist: #8795a8;
  --bone: #ece6d8;
  --gold: #c9a45c;
  --gold-pale: #ead7a4;
  --display: "Cinzel", "Trajan Pro", "Times New Roman", serif;
  --greek: "GFS Didot", "Didot", "Palatino Linotype", serif;
  --text: "Lato", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(20px, 4vw, 56px);
  color-scheme: dark;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--void);
  color: var(--bone);
  font: 400 15px/1.55 var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Bühne: Video + Partikel ---------- */
.stage { position: fixed; inset: 0; overflow: hidden; background: var(--storm); }

/* Das Video füllt den Bildschirm und pendelt langsam um wenige Grad (die Videos drehen sich selbst schon).
   scale 1.14 deckt die Ecken bei ±3° auch im Hochformat ab. */
.vortex {
  position: absolute; inset: 0;
  scale: 1.14;
  animation: sway 48s ease-in-out infinite alternate;
}
.vortex video, .vortex img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity 900ms ease;
}
.vortex .parting { opacity: 0; }
body.is-parting .vortex .loop { opacity: 0; }
body.is-parting .vortex .parting { opacity: 1; }
body.is-direct .vortex video { opacity: 0 !important; }
@keyframes sway { from { rotate: -3deg; } to { rotate: 3deg; } }

#dust { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* Vignette: ruhige Ränder, Text bleibt lesbar */
.stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 75% 70% at 50% 50%, transparent 45%, rgba(6,8,13,.72) 100%),
    linear-gradient(to top, rgba(6,8,13,.75), transparent 38%);
}

/* ---------- Landing-Inhalt ---------- */
.landing {
  position: fixed; inset: 0;
  padding-inline: var(--gutter);
  padding-block: calc(var(--gutter) + env(safe-area-inset-top, 0px)) calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  transition: opacity 700ms ease, filter 700ms ease;
}
body.is-parting .landing { opacity: 0; filter: blur(6px); pointer-events: none; }

.verse { max-width: 34ch; margin: 0; }
.verse .greek {
  font: 400 clamp(17px, 1.6vw, 22px)/1.35 var(--greek);
  color: var(--gold-pale);
  margin: 0;
}
.verse .english {
  margin: .45em 0 0;
  font: italic 300 14px/1.5 var(--text);
  color: var(--mist);
}
.verse cite {
  display: block; margin-top: .6em;
  font: 700 10.5px/1 var(--text); letter-spacing: .22em; text-transform: uppercase;
  font-style: normal; color: var(--gold);
}

/* Der Eingang sitzt im Licht des Chaos */
.gate { place-self: center; display: grid; place-items: center; }
.enter {
  --size: clamp(118px, 13vw, 156px);
  width: var(--size); height: var(--size);
  border-radius: 50%;
  border: 1px solid rgba(201,164,92,.55);
  background: radial-gradient(circle, rgba(234,215,164,.10), rgba(11,15,26,0) 70%);
  color: var(--gold-pale);
  font: 600 13px/1 var(--display); letter-spacing: .34em; text-indent: .34em; text-transform: uppercase;
  cursor: pointer;
  position: relative;
  transition: border-color 400ms ease, background 400ms ease, scale 400ms ease;
}
.enter::before, .enter::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 1px solid rgba(201,164,92,.18);
  animation: halo 5.5s ease-in-out infinite;
}
.enter::after { inset: -22px; border-color: rgba(201,164,92,.08); animation-delay: -2.7s; }
.enter:hover { border-color: var(--gold); background: radial-gradient(circle, rgba(234,215,164,.2), rgba(11,15,26,0) 72%); scale: 1.04; }
.enter:focus-visible { outline: 1px solid var(--gold-pale); outline-offset: 30px; }
@keyframes halo { 0%,100% { scale: 1; opacity: .9; } 50% { scale: 1.07; opacity: .35; } }

.foot {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 18px 40px;
}
.wordmark {
  margin: 0;
  font: 400 clamp(40px, 8.4vw, 132px)/.86 var(--display);
  letter-spacing: .06em;
  color: var(--bone);
  text-shadow: 0 0 40px rgba(6,8,13,.8);
}
.wordmark .dot { color: var(--gold); }
.claim { max-width: 30ch; margin: 0; color: var(--mist); font-size: 14px; text-align: right; }
.claim b { display: block; color: var(--bone); font-weight: 700; letter-spacing: .02em; margin-bottom: .2em; }

/* ---------- Handy ---------- */
@media (max-width: 640px) {
  .foot { flex-direction: column; align-items: start; }
  .claim { text-align: left; }
}

/* ---------- Weniger Bewegung ---------- */
@media (prefers-reduced-motion: reduce) {
  .vortex, .enter::before, .enter::after { animation: none; }
  .vortex video { display: none; }
}

/* =========================================================
   Stammbaum
   ========================================================= */
.atlas {
  position: fixed; inset: 0;
  opacity: 0; pointer-events: none;
  transition: opacity 900ms ease;
  background: radial-gradient(ellipse 90% 80% at 50% 45%, rgba(6,8,13,.25), rgba(6,8,13,.72));
}
body.is-parted .atlas { opacity: 1; pointer-events: auto; }

.atlas-bar {
  position: absolute; z-index: 3; left: 0; right: 0; top: 0;
  padding: calc(14px + env(safe-area-inset-top, 0px)) var(--gutter) 14px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  background: linear-gradient(to bottom, rgba(6,8,13,.85), rgba(6,8,13,0));
  pointer-events: none;
}
.atlas-bar > * { pointer-events: auto; }
.home {
  justify-self: start; background: none; border: 0; padding: 4px 0; cursor: pointer;
  font: 400 22px/1 var(--display); letter-spacing: .06em; color: var(--bone);
}
.home span { color: var(--gold); }
.atlas-title {
  margin: 0; font: 700 10.5px/1 var(--text); letter-spacing: .26em; text-transform: uppercase; color: var(--gold);
}
.reveal {
  justify-self: end; background: none; cursor: pointer;
  border: 1px solid rgba(201,164,92,.45); border-radius: 999px; padding: 9px 16px;
  font: 700 10.5px/1 var(--text); letter-spacing: .2em; text-transform: uppercase; color: var(--gold-pale);
  transition: border-color 250ms ease, background 250ms ease;
}
.reveal:hover { border-color: var(--gold); background: rgba(201,164,92,.08); }
.bar-right { justify-self: end; display: flex; align-items: center; gap: 10px; }
.lang {
  background: none; cursor: pointer; border: 1px solid rgba(201,164,92,.28); border-radius: 999px;
  padding: 8px 12px; font: 700 10.5px/1 var(--text); letter-spacing: .2em; color: var(--mist);
  transition: color 250ms ease, border-color 250ms ease;
}
.lang:hover { color: var(--gold-pale); border-color: rgba(201,164,92,.6); }
.lang:focus-visible { outline: 1px solid var(--gold-pale); outline-offset: 4px; }
.lang-solo {
  position: absolute; z-index: 4;
  top: calc(20px + env(safe-area-inset-top, 0px)); right: var(--gutter);
}
.is-parting .lang-solo { opacity: 0; pointer-events: none; transition: opacity 400ms ease; }
.home:focus-visible, .reveal:focus-visible { outline: 1px solid var(--gold-pale); outline-offset: 5px; }

#tree { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#tree:active { cursor: grabbing; }

/* Kategorien */
.band { cursor: pointer; outline: none; }
.band-hit { fill: transparent; }
.band-field { fill: rgba(11,15,26,.34); }
.band .rule { stroke: rgba(201,164,92,.34); stroke-width: 1; transition: stroke 300ms ease; }
.band-name {
  font: 400 30px/1 var(--display); letter-spacing: .14em; text-anchor: middle; fill: var(--bone);
  transition: fill 300ms ease;
}
.band-greek { font: 400 15px/1 var(--greek); text-anchor: middle; fill: var(--mist); }
.band-sign { font: 300 26px/1 var(--text); fill: var(--gold); }
.band-gen { font: 400 13px/1 var(--text); letter-spacing: .2em; text-anchor: end; fill: rgba(201,164,92,.5); }
.band.is-open .band-gen { fill: rgba(201,164,92,.85); }
.band-quote { text-anchor: middle; pointer-events: none; }
.band-quote.gr { font: 400 19px/1 var(--greek); fill: rgba(234,215,164,.82); }
.band-quote.en { font: 400 15px/1 var(--display); letter-spacing: .06em; fill: rgba(232,226,214,.72); font-style: italic; }
.band-quote.src { font: 300 12px/1 var(--text); letter-spacing: .18em; text-transform: uppercase; fill: rgba(135,149,168,.7); }
.band:hover .rule, .band:focus-visible .rule { stroke: rgba(201,164,92,.8); }
.band:hover .band-name, .band:focus-visible .band-name { fill: var(--gold-pale); }
.band.is-open .band-name { fill: var(--gold-pale); }

/* Linien */
.edge { fill: none; stroke: rgba(201,164,92,.34); stroke-width: 1.1; transition: stroke 300ms ease, stroke-width 300ms ease, opacity 300ms ease; }
.edge.is-alt { stroke-dasharray: 5 6; stroke: rgba(135,149,168,.5); }
.edge.is-made { stroke-dasharray: 1 6; stroke-linecap: round; stroke-width: 1.6; }
.consort { fill: none; stroke: rgba(234,215,164,.55); stroke-width: 1; stroke-dasharray: 2 5; stroke-linecap: round; pointer-events: none; }

/* Figuren */
.node { cursor: pointer; outline: none; }
.node .disc { fill: #0d1320; }
.node .ring { fill: none; stroke: rgba(201,164,92,.7); stroke-width: 1.2; transition: stroke 250ms ease, stroke-width 250ms ease; }
.node .halo { fill: none; stroke: rgba(201,164,92,.3); stroke-dasharray: 2 4; }
.node .initial { font: 400 20px/1 var(--greek); text-anchor: middle; fill: var(--gold); }
.node .label { font: 400 14px/1 var(--display); letter-spacing: .06em; text-anchor: middle; fill: var(--bone); paint-order: stroke; stroke: rgba(6,8,13,.85); stroke-width: 4px; }
.node .sublabel { font: 400 11px/1 var(--text); letter-spacing: .08em; text-anchor: middle; fill: var(--mist); paint-order: stroke; stroke: rgba(6,8,13,.85); stroke-width: 3px; }
.node.has-portrait .ring { stroke: var(--gold); stroke-width: 1.6; }
.node.is-mortal .disc { fill: rgba(6,8,13,.8); }
.node.is-mortal .ring { stroke: rgba(135,149,168,.8); }
.node.is-mortal .label { fill: var(--mist); font-size: 12.5px; }
.node:hover .ring, .node:focus-visible .ring { stroke: var(--gold-pale); stroke-width: 2.4; }
.node.is-focus .ring { stroke: var(--gold-pale); stroke-width: 3; }

/* Fokus: alles außer der Familie tritt zurück */
#tree.has-focus .node { transition: opacity 300ms ease; }
#tree.has-focus .node:not(.is-kin) .disc,
#tree.has-focus .node:not(.is-kin) .ring,
#tree.has-focus .node:not(.is-kin) image,
#tree.has-focus .node:not(.is-kin) text { opacity: .22; }
#tree.has-focus .edge { opacity: .12; }
#tree.has-focus .edge.is-kin { opacity: 1; stroke: var(--gold); stroke-width: 1.8; }
#tree.has-focus .edge.is-kin.is-alt { stroke: var(--gold-pale); }

.legend {
  position: absolute; z-index: 2; left: var(--gutter); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  font: 400 12px/1 var(--text); color: var(--mist);
}
.legend .k { display: inline-block; width: 26px; height: 0; border-top: 1.5px solid rgba(201,164,92,.7); margin-left: 8px; }
.legend .k:first-child { margin-left: 0; }
.legend .k-alt { border-top: 1.5px dashed rgba(135,149,168,.8); }
.legend .k-made { border-top: 2px dotted rgba(201,164,92,.7); }
.legend .k-gen { margin-left: 8px; color: var(--gold-pale); letter-spacing: .16em; }
.atlas.has-profile .legend { opacity: 0; }

/* Steckbrief */
.profile {
  position: absolute; z-index: 4;
  top: calc(72px + env(safe-area-inset-top, 0px)); right: var(--gutter); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: min(400px, calc(100vw - 2 * var(--gutter)));
  overflow-y: auto; overscroll-behavior: contain;
  background: rgba(9,12,20,.93);
  border: 1px solid rgba(201,164,92,.28);
  border-radius: 3px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
  animation: rise 450ms cubic-bezier(.2,.7,.2,1);
  scrollbar-width: thin; scrollbar-color: rgba(201,164,92,.4) transparent;
}
@keyframes rise { from { opacity: 0; translate: 0 14px; } }
.close {
  position: sticky; top: 10px; float: right; margin: 10px 10px -46px 0; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(201,164,92,.45); background: rgba(6,8,13,.7);
  color: var(--gold-pale); font: 300 22px/1 var(--text);
}
.close:focus-visible { outline: 1px solid var(--gold-pale); outline-offset: 3px; }
/* KI-Kennzeichnung: Badge oben links auf dem Porträt (der Schließen-Knopf sitzt rechts) */
#profile-body { position: relative; }
.ki-badge {
  position: absolute; z-index: 3; top: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 9px 5px 5px; border-radius: 3px;
  background: rgba(6,8,13,.72); border: 1px solid rgba(234,215,164,.35);
  font: 700 9.5px/1 var(--text); letter-spacing: .16em; text-transform: uppercase; color: var(--bone);
  pointer-events: none; transition: opacity 300ms ease;
}
.ki-badge b, .ki-icon {
  display: inline-grid; place-items: center; min-width: 20px; height: 16px; padding: 0 3px; box-sizing: border-box;
  border-radius: 2px; background: var(--gold-pale); color: #06080d;
  font: 700 9.5px/1 var(--text); letter-spacing: .04em;
}
.portrait { display: block; width: 100%; aspect-ratio: 4 / 5; max-width: 100%; object-fit: cover; object-position: 50% 30%; background: var(--storm); }
.portrait.is-empty {
  aspect-ratio: 16 / 9;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  background: radial-gradient(ellipse at 50% 60%, rgba(201,164,92,.16), transparent 70%), var(--storm);
}
.portrait.is-empty span { font: 400 48px/1 var(--greek); color: var(--gold-pale); }
.portrait.is-empty small { font: 700 10px/1 var(--text); letter-spacing: .22em; text-transform: uppercase; color: var(--mist); }
.sheet { padding: 22px 26px 30px; }
.sheet .eyebrow { margin: 0 0 10px; font: 700 10.5px/1 var(--text); letter-spacing: .24em; text-transform: uppercase; color: var(--gold); }
.sheet h2 { margin: 0; font: 400 40px/1 var(--display); letter-spacing: .04em; color: var(--bone); text-wrap: balance; }
.sheet .greekname { margin: 6px 0 0; font: 400 20px/1.2 var(--greek); color: var(--gold-pale); }
.sheet .hook { margin: 18px 0 0; font: italic 300 19px/1.4 var(--text); color: var(--bone); }
.sheet .role { margin: 12px 0 0; color: #c9c6bd; }
.facts { margin: 20px 0 0; display: grid; gap: 10px; }
.facts div { display: grid; grid-template-columns: 78px 1fr; gap: 12px; }
.facts dt, .lineage dt { font: 700 10px/1.7 var(--text); letter-spacing: .2em; text-transform: uppercase; color: var(--mist); }
.facts dd, .lineage dd { margin: 0; }
.sheet h3 {
  margin: 28px 0 12px; padding-top: 18px; border-top: 1px solid rgba(201,164,92,.22);
  font: 700 10.5px/1 var(--text); letter-spacing: .26em; text-transform: uppercase; color: var(--gold);
}
.lineage { margin: 0; display: grid; gap: 16px; }
.lineage .line { display: grid; gap: 6px; }
.lineage .line.is-alt dt { color: var(--gold-pale); }
.lineage cite { display: block; margin-top: 6px; font: italic 400 12.5px/1.4 var(--text); color: var(--mist); }
.lineage .gloss { margin: 6px 0 0; font-size: 13.5px; color: #c9c6bd; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.amp { margin: 0 6px; color: var(--mist); font-family: var(--greek); }
.chip {
  cursor: pointer; background: rgba(201,164,92,.06);
  border: 1px solid rgba(201,164,92,.4); border-radius: 999px; padding: 6px 12px;
  font: 400 13px/1 var(--display); letter-spacing: .05em; color: var(--bone);
  transition: background 200ms ease, border-color 200ms ease;
}
.chip:hover { background: rgba(201,164,92,.16); border-color: var(--gold); }
.chip:focus-visible { outline: 1px solid var(--gold-pale); outline-offset: 2px; }
.chip.is-mortal { border-color: rgba(135,149,168,.55); color: #c9c6bd; }
.chip.is-alt { border-style: dashed; }
.sheet .tap { display: none; }
.note { margin: 20px 0 0; font-size: 13.5px; color: var(--mist); }

@media (max-width: 820px) {
  .atlas-title { display: none; }
  .lang { padding: 8px 10px; letter-spacing: .14em; }
  .atlas-bar { grid-template-columns: 1fr auto; }
  /* Handy: Steckbrief bildschirmfüllend. Erst das Bild groß im Originalformat,
     ein Tipp darauf blendet die Details ein und dunkelt das Bild ab. */
  .profile {
    inset: 0; width: auto; max-height: none;
    border: 0; border-radius: 0; box-shadow: none;
    background: var(--void);
    overflow: hidden;
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  }
  .close { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; margin: 0; float: none; z-index: 5; }
  #profile-body { position: relative; height: 100%; }
  .portrait {
    position: absolute; left: 0; right: 0; top: 0;
    width: 100%; height: auto; aspect-ratio: 4 / 5; max-height: 78%;
    object-position: 50% 30%;
    transition: filter 450ms ease, scale 600ms ease;
    cursor: pointer;
  }
  .portrait.is-empty { aspect-ratio: 4 / 5; }
  .sheet {
    position: absolute; left: 0; right: 0; bottom: 0; top: 0;
    --img: min(125vw, 78dvh);
    display: flex; flex-direction: column; justify-content: flex-start;
    padding: calc(var(--img) - 84px) 22px calc(22px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to bottom, transparent calc(var(--img) - 200px), rgba(6,8,13,.9) calc(var(--img) - 50px), var(--void) var(--img));
    overflow: hidden;
    cursor: pointer;
    transition: background 450ms ease;
  }
  .sheet .more { display: none; }
  .sheet .tap {
    display: inline-block; margin: 16px 0 0; align-self: flex-start;
    font: 700 10.5px/1 var(--text); letter-spacing: .22em; text-transform: uppercase; color: var(--gold);
    border: 0; background: none; padding: 6px 0; border-bottom: 1px solid rgba(201,164,92,.5); cursor: pointer;
  }
  .sheet h2 { font-size: 34px; }
  .sheet .hook { font-size: 17px; }

  .profile.is-open .portrait { filter: brightness(.28) blur(2px); scale: 1.04; }
  .ki-badge { top: calc(14px + env(safe-area-inset-top, 0px)); }
  .profile.is-open .ki-badge { opacity: 0; }
  .profile.is-open .sheet {
    justify-content: flex-start;
    overflow-y: auto; overscroll-behavior: contain;
    padding-top: calc(64px + env(safe-area-inset-top, 0px));
    background: rgba(6,8,13,.35);
    cursor: default;
  }
  .profile.is-open .sheet .more { display: block; animation: rise 400ms cubic-bezier(.2,.7,.2,1); }
  .profile.is-open .sheet .tap { display: none; }
  .legend { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .profile { animation: none; }
}

/* ---------- Rechtliches: schmale Leiste am unteren Rand, auf Startseite und Stammbaum ---------- */
:root { --leiste: 30px; }
.rechtsleiste {
  position: fixed; z-index: 3; left: 0; right: 0; bottom: 0;
  min-height: var(--leiste); box-sizing: border-box;
  padding: 0 var(--gutter) env(safe-area-inset-bottom, 0px);
  display: flex; align-items: center; justify-content: flex-end; gap: 18px;
  font: 400 11px/1 var(--text); letter-spacing: .06em; color: rgba(135,149,168,.75);
  background: linear-gradient(to top, rgba(6,8,13,.85), rgba(6,8,13,0));
  pointer-events: none;
}
.rechtsleiste > * { pointer-events: auto; }
.rechtsleiste a { color: rgba(135,149,168,.9); text-decoration: none; padding: 8px 0; }
.rechtsleiste a:hover, .rechtsleiste a:focus-visible { color: var(--gold-pale); text-decoration: underline; text-underline-offset: 3px; }
.rechtsleiste .ki-hinweis { margin-right: auto; display: inline-flex; align-items: center; gap: 7px; color: rgba(236,230,216,.82); }
/* Platz schaffen, damit nichts unter der Leiste verschwindet */
.landing { padding-bottom: calc(var(--gutter) + var(--leiste) + env(safe-area-inset-bottom, 0px)); }
.legend { bottom: calc(var(--leiste) + 10px + env(safe-area-inset-bottom, 0px)); }
.profile { bottom: calc(var(--leiste) + 12px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 820px) {
  :root { --leiste: 46px; }
  .rechtsleiste { justify-content: center; flex-wrap: wrap; column-gap: 18px; row-gap: 0; padding-top: 4px; }
  .rechtsleiste .ki-hinweis { flex-basis: 100%; justify-content: center; margin-right: 0; }
  .profile { bottom: 0; }          /* Handy: Steckbrief bildschirmfuellend ueber der Leiste */
  .atlas.has-profile ~ .rechtsleiste { display: none; }
}
