/* ═══════════════════════════════════════════════
   EMBER · DER RAUM
   Navigation in zwei Achsen: XY = Ort, Z = Tiefe
   ═══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --red: #c0392b; --cyan: #00e5ff;
  --black: #060708; --white: #fff;
  --D: 'Bebas Neue', sans-serif; --B: 'Space Grotesk', sans-serif;
}
html, body { height: 100%; overflow: hidden; background: var(--black); }
body {
  font-family: var(--B); color: var(--white);
  overscroll-behavior: none;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── VIEWPORT & WELT ── */
#viewport {
  position: fixed; inset: 0;
  cursor: grab; touch-action: none;
  z-index: 1;
}
#viewport.drag { cursor: grabbing; }
#world {
  position: absolute; top: 50%; left: 50%;
  width: 0; height: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* Hologramm-Boden */
#floor {
  position: absolute; left: -1700px; top: -1250px;
  width: 3400px; height: 2500px;
  background-image:
    linear-gradient(rgba(0,229,255,.085) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,.085) 1px, transparent 1px);
  background-size: 80px 80px;
  border: 1px solid rgba(0,229,255,.18);
  box-shadow: inset 0 0 260px rgba(0,229,255,.05);
}
/* Glut-Schein am Grill */
#glow {
  position: absolute; left: -700px; top: -450px;
  width: 1100px; height: 1100px; margin: -550px 0 0 -550px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(192,57,43,.20), transparent 62%);
  animation: emberPulse 5s ease-in-out infinite;
}
@keyframes emberPulse {
  0%, 100% { opacity: .55; transform: scale(1); }
  50%      { opacity: 1;  transform: scale(1.1); }
}

/* Verbindungslinien */
#links { position: absolute; left: -1700px; top: -1250px; width: 3400px; height: 2500px;
  pointer-events: none; overflow: visible; }
#links line { stroke: rgba(0,229,255,.14); stroke-dasharray: 7 12; }

/* ── SEKTOREN ── */
.sector {
  position: absolute; width: 330px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(0,229,255,.28);
  background: rgba(6,10,14,.86);
  backdrop-filter: blur(8px);
  padding: 26px 26px 28px;
  transition: border-color .4s, box-shadow .4s, width .5s cubic-bezier(.2,.8,.2,1);
  cursor: pointer;
}
.sector::before, .sector::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  border: 1px solid var(--cyan); opacity: .5; transition: opacity .4s, width .4s, height .4s;
}
.sector::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.sector::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.sector:hover { border-color: var(--cyan); box-shadow: 0 0 60px rgba(0,229,255,.22); }
.sector:hover::before, .sector:hover::after { opacity: 1; width: 26px; height: 26px; }

.sector .tag {
  display: block; font-size: .58rem; letter-spacing: 3.5px;
  text-transform: uppercase; color: var(--cyan); margin-bottom: 9px;
}
.sector h2 {
  font-family: var(--D); font-size: 2.3rem;
  letter-spacing: 3px; line-height: .95; font-weight: 400;
}
.sector h2 span { color: var(--red); }
.sector .teaser {
  font-size: .8rem; line-height: 1.75;
  color: rgba(255,255,255,.48); margin-top: 12px;
}

/* Ebene 3 — die Tiefe. Erst beim Hineinzoomen sichtbar. */
.sector-deep {
  max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height .6s cubic-bezier(.2,.8,.2,1), opacity .45s, margin-top .6s;
}
.sector.open .sector-deep {
  max-height: 1400px; opacity: 1; margin-top: 22px;
}
.sector.open { width: 560px; border-color: var(--cyan); box-shadow: 0 0 90px rgba(0,229,255,.24); }

.deep-line { height: 1px; background: rgba(0,229,255,.2); margin-bottom: 20px; }
.deep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.deep-item {
  border: 1px solid rgba(255,255,255,.08);
  padding: 13px 14px; transition: border-color .25s, background .25s;
}
.deep-item:hover { border-color: rgba(0,229,255,.35); background: rgba(0,229,255,.04); }
.deep-item .n { font-family: var(--D); font-size: 1.25rem; letter-spacing: 1.5px; }
.deep-item .d { font-size: .66rem; color: rgba(255,255,255,.38); margin-top: 3px; line-height: 1.6; }
.deep-item .p { font-size: .82rem; color: var(--red); margin-top: 7px; font-weight: 600; }

.deep-img { margin-bottom: 18px; overflow: hidden; position: relative; }
.deep-img img { width: 100%; height: 170px; object-fit: cover; filter: brightness(.82) contrast(1.06); }
.deep-img::after {
  content: ''; position: absolute; inset: 0;
  border: 1px solid rgba(0,229,255,.25);
  box-shadow: inset 0 0 50px rgba(0,229,255,.08);
}

.deep-list { list-style: none; }
.deep-list li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: .78rem;
}
.deep-list li span:first-child { color: rgba(255,255,255,.65); }
.deep-list li span:last-child { color: var(--cyan); white-space: nowrap; }
.deep-list li.closed span:last-child { color: rgba(255,255,255,.25); }

.deep-cta {
  display: inline-block; margin-top: 20px;
  background: var(--red); color: var(--white);
  padding: 12px 26px; font-size: .68rem;
  letter-spacing: 2.5px; text-transform: uppercase; font-weight: 600;
  transition: background .25s, box-shadow .25s, transform .25s;
}
.deep-cta:hover {
  background: #962d22; transform: translateY(-2px);
  box-shadow: 0 0 28px rgba(192,57,43,.55);
}
.deep-cta.ghost {
  background: transparent; border: 1px solid rgba(0,229,255,.4); color: var(--cyan);
  margin-left: 10px;
}
.deep-cta.ghost:hover { background: rgba(0,229,255,.08); box-shadow: 0 0 28px rgba(0,229,255,.28); }

.deep-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.deep-thumbs img { height: 92px; object-fit: cover; width: 100%; filter: brightness(.8); transition: filter .3s; }
.deep-thumbs img:hover { filter: brightness(1.05); }

/* Ebene 1 — Fernsicht: nur Name, kein Text */
body.lod-far .teaser { opacity: 0; }
body.lod-far .sector { width: 300px; padding: 22px; }

/* ── DIREKT-LEISTE (der garantierte Weg) ── */
#direct {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; gap: 4px;
  padding: 13px 22px;
  background: linear-gradient(to bottom, rgba(6,7,8,.96), rgba(6,7,8,.72));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,229,255,.12);
}
#direct .brand {
  font-family: var(--D); font-size: 1.65rem; letter-spacing: 6px;
  margin-right: auto; text-shadow: 0 0 18px rgba(0,229,255,.3);
}
#direct a.item {
  font-size: .66rem; letter-spacing: 2px; text-transform: uppercase;
  color: rgba(255,255,255,.52); padding: 9px 14px;
  transition: color .25s, background .25s;
}
#direct a.item:hover { color: var(--white); background: rgba(255,255,255,.05); }
#direct a.res {
  background: var(--red); color: var(--white); font-weight: 600;
  padding: 10px 20px; margin-left: 8px;
  transition: background .25s, box-shadow .25s;
}
#direct a.res:hover { background: #962d22; box-shadow: 0 0 24px rgba(192,57,43,.5); }

/* ── HUD ── */
#hud {
  position: fixed; left: 22px; bottom: 22px; z-index: 30;
  font-size: .6rem; letter-spacing: 3px; text-transform: uppercase;
  color: rgba(0,229,255,.7); pointer-events: none;
}
#hud .sect { color: var(--white); font-size: .72rem; margin-bottom: 5px; display: block; }
#hud .coord { color: rgba(255,255,255,.25); font-size: .55rem; letter-spacing: 2px; }

#zoomctl {
  position: fixed; right: 22px; bottom: 150px; z-index: 30;
  display: flex; flex-direction: column; gap: 6px;
}
#zoomctl button {
  width: 38px; height: 38px; cursor: pointer;
  background: rgba(6,10,14,.85); color: var(--cyan);
  border: 1px solid rgba(0,229,255,.28);
  font-size: 1.1rem; font-family: var(--B);
  transition: background .25s, border-color .25s;
}
#zoomctl button:hover { background: rgba(0,229,255,.12); border-color: var(--cyan); }

/* ── MINIMAP ── */
#map {
  position: fixed; right: 22px; bottom: 22px; z-index: 30;
  width: 186px; height: 118px;
  border: 1px solid rgba(0,229,255,.28);
  background: rgba(0,0,0,.66); cursor: crosshair;
}
#map .pt {
  position: absolute; width: 5px; height: 5px;
  background: rgba(0,229,255,.5); transform: translate(-50%,-50%);
  transition: background .3s, box-shadow .3s;
}
#map .pt.on { background: var(--cyan); box-shadow: 0 0 9px var(--cyan); }
#eye {
  position: absolute; border: 1px solid var(--red);
  background: rgba(192,57,43,.12); transform: translate(-50%,-50%);
  pointer-events: none;
}

/* ── HINWEIS ── */
#hint {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 30; font-size: .6rem; letter-spacing: 2.5px;
  color: rgba(255,255,255,.3); text-align: center;
  transition: opacity .6s; pointer-events: none;
}
#hint.gone { opacity: 0; }

/* ── PARTIKEL ── */
#dust { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .75; }

/* Scanlines */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 35; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(0,0,0,.16) 3px 4px);
  opacity: .45;
}

/* ── MOBIL ── */
@media (max-width: 860px) {
  #direct { padding: 10px 14px; gap: 0; flex-wrap: wrap; }
  #direct .brand { font-size: 1.3rem; letter-spacing: 4px; }
  #direct a.item { display: none; }
  #direct a.res { padding: 9px 16px; font-size: .6rem; margin-left: 0; }
  #map { width: 120px; height: 78px; right: 14px; bottom: 14px; }
  #zoomctl { right: 14px; bottom: 104px; }
  #hud { left: 14px; bottom: 14px; }
  .sector { width: 270px; padding: 20px; }
  .sector.open { width: min(84vw, 360px); }
  /* Geöffnete Sektoren dürfen mobil nicht über den Schirm wachsen */
  .sector.open .sector-deep {
    max-height: 52vh; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .deep-grid { grid-template-columns: 1fr; }
  .deep-img img { height: 120px; }
  .deep-thumbs { grid-template-columns: repeat(3, 1fr); }
  .deep-thumbs img { height: 62px; }
  .deep-cta { padding: 10px 18px; font-size: .62rem; }
  .deep-cta.ghost { margin-left: 0; margin-top: 8px; }
  #hint { font-size: .55rem; bottom: 100px; }
}

/* ── OHNE JS / REDUZIERTE BEWEGUNG ── */
.noscript-fallback {
  position: fixed; inset: 0; z-index: 100; overflow: auto;
  background: var(--black); padding: 90px 24px 40px;
}
@media (prefers-reduced-motion: reduce) {
  #glow, #dust { animation: none; }
  .sector, .sector-deep { transition-duration: .01ms; }
}
