/* Nythoria – eine Website, die mit der Höhle wächst */

/* ---------- Epochen-Tokens ---------- */
:root, [data-epoch="0"] {
  --bg: #000000;
  --surface: #000000;
  --text: #ffffff;
  --muted: #b8b8b8;
  --line: #ffffff;
  --accent: #ffffff;
  --accent-ink: #000000;
  --accent-2: #ffffff;
  --accent-3: #ffffff;
  --body-font: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --head-font: var(--body-font);
  --radius: 0px;
  --border: 2px;
}
[data-epoch="1"] {
  --bg: #0a1420;
  --surface: #0f1d2e;
  --text: #cfe6f5;
  --muted: #8fbfde;
  --line: #1d3a57;
  --accent: #cfe6f5;
  --accent-ink: #0a1420;
  --accent-2: #5d8fb8;
  --accent-3: #8fbfde;
}
[data-epoch="2"] {
  --bg: #0d1a2b;
  --surface: #12233a;
  --text: #e3edf5;
  --muted: #a3b6cb;
  --line: #24405f;
  --accent: #59d36b;
  --accent-ink: #06210c;
  --accent-2: #9c8cff;
  --accent-3: #f2b76a;
  --body-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 2px;
}
[data-epoch="3"] {
  --bg: #0b1626;
  --surface: rgba(19, 35, 57, 0.72);
  --text: #eaf2f9;
  --muted: #9fb3c8;
  --line: rgba(120, 160, 210, 0.22);
  --accent: #3fa2ff;
  --accent-ink: #04182b;
  --accent-2: #8b6cff;
  --accent-3: #59d36b;
  --body-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --head-font: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --radius: 12px;
  --border: 1px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--body-font); font-size: 1.0625rem; line-height: 1.65;
  transition: background-color .6s, color .6s;
}
[data-epoch="0"] body, [data-epoch="1"] body { font-size: 0.98rem; line-height: 1.7; }

a { color: var(--accent); text-underline-offset: 0.2em; }
[data-epoch="0"] a { color: #fff; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--accent-3); outline-offset: 3px; }
[data-epoch="0"] :focus-visible { outline-color: #fff; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; z-index: 50; }
.wrap { max-width: 1100px; margin: 0 auto; padding-left: clamp(16px, 4vw, 48px); padding-right: clamp(16px, 4vw, 48px); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Pixelschrift ---------- */
.px { --px: 4px; }
.px-pixels { display: inline-flex; flex-wrap: wrap; gap: calc(var(--px) * 1) calc(var(--px) * 4); align-items: flex-end; }
.px-word { fill: currentColor; display: block; shape-rendering: crispEdges; }
.px-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[data-epoch="3"] .px-pixels { display: none; }
[data-epoch="3"] .px-text { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }

h1, h2, h3 { margin: 0; font-weight: 400; }
h1.px { --px: clamp(5px, 1.15vw, 11px); }
h2.px { --px: clamp(3px, 0.55vw, 5px); }
h3.px { --px: 3px; }
[data-epoch="1"] h1.px, [data-epoch="1"] h2.px { color: #e4f3fc; }
[data-epoch="2"] h1.px { color: #e3edf5; filter: drop-shadow(var(--px) var(--px) 0 #24405f); }
[data-epoch="2"] h2.px { color: var(--accent); filter: drop-shadow(calc(var(--px) * .6) calc(var(--px) * .6) 0 #06210c); }
[data-epoch="2"] h3.px { color: var(--accent-3); }

[data-epoch="3"] h1, [data-epoch="3"] h2, [data-epoch="3"] h3 { font-family: var(--head-font); font-weight: 700; letter-spacing: 0.01em; line-height: 1.05; }
[data-epoch="3"] h1 { font-size: clamp(2.8rem, 8vw, 6rem); text-transform: uppercase; background: linear-gradient(180deg, #fff 40%, #b9cde0); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-epoch="3"] h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); color: var(--accent); }
[data-epoch="3"] h3 { font-size: 1.35rem; }

/* ---------- Kopf ---------- */
.site-header { position: relative; z-index: 3; }
#site-nav { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 20px; padding-bottom: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border: var(--border) solid var(--line); cursor: default; }
.logo-px { width: 30px; height: 30px; fill: currentColor; shape-rendering: crispEdges; }
.logo-img { display: none; width: 40px; height: 40px; border-radius: 50%; }
[data-epoch="3"] .brand-mark { border: 0; width: 44px; height: 44px; box-shadow: 0 0 0 1px var(--line), 0 0 24px -6px rgba(63, 162, 255, .6); border-radius: 50%; }
[data-epoch="3"] .logo-px { display: none; }
[data-epoch="3"] .logo-img { display: block; width: 44px; height: 44px; }
.brand-name.px { --px: 3px; }
[data-epoch="3"] .brand-name { font-family: var(--head-font); font-weight: 600; letter-spacing: 0.32em; font-size: 1.05rem; text-transform: uppercase; }
.nav-links { display: flex; gap: clamp(14px, 3vw, 30px); list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--muted); text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); text-decoration: underline; }

/* ---------- Hero mit Höhle ---------- */
.hero { position: relative; overflow: hidden; min-height: min(90vh, 820px); display: flex; flex-direction: column; background: var(--bg); }
.sky { position: absolute; inset: 0; display: none; }
[data-epoch="3"] .sky {
  display: block;
  background:
    radial-gradient(1px 1px at 14% 14%, #fff, transparent 60%), radial-gradient(1px 1px at 31% 7%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 47% 20%, #fff, transparent 60%), radial-gradient(1px 1px at 63% 9%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 79% 18%, #fff, transparent 60%), radial-gradient(1px 1px at 91% 6%, #fff, transparent 60%),
    linear-gradient(180deg, #06101d 0%, #0c1a2e 55%, #15294a 100%);
}
.aurora { position: absolute; inset: -10% -20% 35% -20%; filter: blur(48px); opacity: .55; }
.aurora::before, .aurora::after { content: ""; position: absolute; border-radius: 50%; animation: drift 28s ease-in-out infinite alternate; }
.aurora::before { left: 15%; top: 16%; width: 70%; height: 22%; background: linear-gradient(90deg, transparent, #74e0c2 30%, rgba(116,224,194,.4) 70%, transparent); transform: rotate(-8deg); }
.aurora::after { left: 38%; top: 30%; width: 58%; height: 16%; background: linear-gradient(90deg, transparent, #8b6cff 40%, transparent); transform: rotate(-4deg); animation-duration: 36s; animation-direction: alternate-reverse; }
@keyframes drift { from { translate: -6% 0; } to { translate: 6% 4%; } }

.scene { position: absolute; left: 0; right: 0; bottom: 0; height: 82%; z-index: 1; }
.scene-svg { width: 100%; height: 100%; display: block; }
.odd-leaf { cursor: default; }
.beam { mix-blend-mode: screen; }

.hero-content { position: relative; z-index: 2; padding-top: clamp(24px, 6vh, 80px); padding-bottom: 40px; flex: 1; }
.epoch-tag { display: inline-block; margin: 0 0 18px; padding: 4px 10px; border: var(--border) solid var(--line); color: var(--muted); font-size: .9rem; border-radius: var(--radius); }
.hero h1 { margin-bottom: 22px; }
.hero-text { max-width: 44ch; margin: 0 0 28px; font-size: 1.1rem; text-shadow: 0 1px 8px var(--bg); }
[data-epoch="3"] .hero-text { font-size: 1.25rem; }
.hero-meta { margin: 14px 0 0; color: var(--muted); font-size: .92rem; text-shadow: 0 1px 6px var(--bg); }

.join-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.copy-btn { display: inline-flex; padding: 0; border: var(--border) solid var(--accent); background: none; cursor: pointer; font: inherit; border-radius: var(--radius); overflow: hidden; }
.copy-address { padding: 12px 16px; color: var(--text); background: var(--bg); font-weight: 600; }
.copy-label { padding: 12px 16px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
[data-epoch="2"] .copy-btn, [data-epoch="3"] .copy-btn { border-color: var(--accent-3); }
[data-epoch="2"] .copy-label, [data-epoch="3"] .copy-label { background: var(--accent-3); color: #1c1203; }
[data-epoch="3"] .copy-btn { box-shadow: 0 10px 36px -12px rgba(89, 211, 107, .55); }
.copy-btn.is-copied .copy-label { background: var(--text); color: var(--bg); }

.status { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: var(--muted); text-shadow: 0 1px 6px var(--bg); }
.status-dot { width: 10px; height: 10px; background: var(--muted); flex: none; }
[data-epoch="3"] .status-dot { border-radius: 50%; }
.status[data-state="online"] { color: var(--text); }
.status[data-state="online"] .status-dot { background: var(--accent-3); }
[data-epoch="0"] .status[data-state="online"] .status-dot { background: #fff; }
.status[data-state="offline"] .status-dot { background: #e98a8a; }

/* ---------- Abschnitte ---------- */
.section { padding: clamp(56px, 8vw, 100px) 0; border-top: var(--border) solid var(--line); }
[data-epoch="0"] .section { border-top-style: dashed; }
.section h2 { margin-bottom: 18px; }
.intro { max-width: 62ch; color: var(--muted); margin: 0 0 28px; }

/* Runenstein */
.progress-blocks { display: flex; gap: 10px; margin-bottom: 10px; }
.block { width: 34px; height: 34px; border: var(--border) solid var(--line); }
.block.is-on { background: var(--accent); border-color: var(--accent); }
[data-epoch="2"] .block.is-on { background: var(--accent-2); border-color: var(--accent-2); box-shadow: 0 0 18px -2px var(--accent-2); }
[data-epoch="3"] .block { border-radius: 6px; }
[data-epoch="3"] .block.is-on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; }
.progress-text { margin: 0 0 24px; color: var(--muted); }
.quest { max-width: 62ch; margin: 0 0 28px; padding: 16px 18px; border: var(--border) dashed var(--accent); border-radius: var(--radius); }
.quest-title { margin: 0 0 4px; font-weight: 700; color: var(--accent); }
.quest-hint { margin: 0; }
[data-epoch="2"] .quest { border-color: var(--accent-3); }
[data-epoch="2"] .quest-title { color: var(--accent-3); }
[data-epoch="3"] .quest { border-style: solid; background: var(--surface); }
.stone-next { margin: 10px 0 0; padding-top: 10px; border-top: var(--border) dashed var(--line); }

.stone { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; max-width: 820px; }
.field { display: grid; gap: 6px; }
.field label { font-size: .9rem; color: var(--muted); }
.field input {
  font: inherit; color: var(--text); background: var(--surface);
  border: var(--border) solid var(--line); border-radius: var(--radius);
  padding: 11px 13px; width: 100%;
}
[data-epoch="0"] .field input { border-color: #fff; }
.field input:focus { outline: none; border-color: var(--accent); }
.btn { font: inherit; font-weight: 600; cursor: pointer; padding: 12px 18px; border: var(--border) solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: var(--radius); }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .6; cursor: wait; }
.stone-result { margin-top: 20px; max-width: 62ch; min-height: 1.6em; }
.stone-result.is-new { border-left: 4px solid var(--accent); padding-left: 16px; }
.stone-title { font-weight: 700; margin: 0 0 6px; }

/* Was entsteht */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.mode { border: var(--border) solid var(--line); padding: 24px; border-radius: var(--radius); background: var(--surface); }
.mode h3 { margin-bottom: 6px; }
.mode .tagline { margin: 0 0 10px; color: var(--muted); }
.mode p:last-child { margin-bottom: 0; }
[data-epoch="2"] .mode-survival h3, [data-epoch="3"] .mode-survival h3 { color: var(--accent-3); }
[data-epoch="2"] .mode-mmorpg h3 { color: var(--accent-2); }
[data-epoch="3"] .mode-mmorpg h3 { color: var(--accent); }
[data-epoch="3"] .mode { backdrop-filter: blur(6px); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
[data-epoch="3"] .mode-survival { border-color: rgba(89, 211, 107, .35); }
[data-epoch="3"] .mode-mmorpg { border-color: rgba(63, 162, 255, .35); }
.note { margin-top: 24px; max-width: 62ch; }

/* Hall of Fame */
.finds { list-style: none; margin: 0; padding: 0; max-width: 820px; border-top: var(--border) solid var(--line); counter-reset: f; }
.finds li { counter-increment: f; display: grid; grid-template-columns: 2.5rem 1fr auto; gap: 4px 16px; padding: 14px 0; border-bottom: var(--border) solid var(--line); align-items: baseline; }
.finds li::before { content: counter(f); color: var(--accent); font-weight: 700; grid-row: span 2; }
.find-title { font-weight: 600; }
.find-who { color: var(--accent-3); grid-column: 2; }
.finds time { color: var(--muted); font-size: .9rem; grid-column: 3; grid-row: 1; }

/* Chronik */
.chronicle { max-width: 64ch; margin-bottom: 44px; }
.chronicle h3 { margin-bottom: 14px; }
.chronicle p { margin: 0 0 1em; }
[data-epoch="3"] .chronicle h3 { color: var(--accent-2); }

/* Nächste Schritte */
.steps-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 26px; }
.steps-list h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; font-family: var(--body-font); }
.steps-list p { margin: 0; color: var(--muted); }
.steps-list li:nth-child(1) h3 { color: var(--accent); }
.steps-list li:nth-child(2) h3 { color: var(--accent-2); }
.steps-list li:nth-child(3) h3 { color: var(--accent-3); }
.ember { color: var(--bg); }
.ember::selection { color: var(--accent-3); background: #2a1a06; }

/* KI und Dank */
.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.duo article { border: var(--border) solid var(--line); border-radius: var(--radius); padding: 26px; background: var(--surface); }
.duo h3 { margin-bottom: 8px; color: var(--accent); }
.duo article + article h3 { color: var(--accent-2); }
.duo p { margin: 0; color: var(--muted); }

/* Beitreten */
.join-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 26px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); counter-reset: s; }
.join-steps li { counter-increment: s; position: relative; padding-left: 50px; }
.join-steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 34px; height: 34px; display: grid; place-items: center; border: var(--border) solid var(--accent); color: var(--accent); font-weight: 700; border-radius: var(--radius); }
.join-steps h3 { font-family: var(--body-font); font-size: 1.02rem; font-weight: 700; margin-bottom: 4px; }
.join-steps p { margin: 0; color: var(--muted); }
.join-steps code { font-family: inherit; color: var(--text); font-weight: 700; }

/* ---------- Unterseiten ---------- */
.page { padding-top: clamp(28px, 6vw, 64px); padding-bottom: clamp(56px, 8vw, 100px); }
.page h1 { margin-bottom: 20px; }
.lead { max-width: 52ch; font-size: 1.15rem; margin: 0 0 32px; }
.rules { list-style: none; margin: 0; padding: 0; counter-reset: r; border-top: var(--border) solid var(--line); max-width: 760px; }
.rules li { counter-increment: r; display: grid; grid-template-columns: 3rem 1fr; padding: 20px 0; border-bottom: var(--border) solid var(--line); }
.rules li::before { content: counter(r); color: var(--accent); font-weight: 700; font-size: 1.3rem; grid-row: span 2; }
.rules h2 { font-family: var(--body-font); font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.rules p { margin: 0; color: var(--muted); }
.prose { max-width: 68ch; }
.prose h2 { font-family: var(--body-font); font-size: 1.25rem; font-weight: 700; margin: 2em 0 .4em; }
.prose p { color: var(--muted); }
.todo { border-left: 4px solid var(--accent-3); padding: 10px 14px; color: var(--text) !important; }
.stille { display: grid; place-items: center; min-height: 60vh; text-align: center; }
.stille svg { width: min(520px, 80vw); height: auto; fill: var(--muted); opacity: .5; shape-rendering: crispEdges; }

/* ---------- Fuß ---------- */
.footer-outer { border-top: var(--border) solid var(--line); }
#site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px 30px; padding-top: 26px; padding-bottom: 36px; color: var(--muted); font-size: .88rem; }
.footer-note { margin: 0; max-width: 52ch; }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; }
.footer-links a { color: var(--muted); }
.lantern { background: none; border: 0; padding: 0; width: 21px; height: 27px; cursor: pointer; }
.lantern svg { width: 100%; height: 100%; filter: drop-shadow(0 0 6px #f2b76a); }

/* ---------- Rune gefunden ---------- */
.rune-found {
  position: fixed; z-index: 60; left: 50%; top: 50%; translate: -50% -50%;
  width: min(92vw, 460px); padding: 28px; text-align: center;
  background: var(--bg); color: var(--text); border: var(--border) solid var(--accent);
  border-radius: var(--radius); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .7);
}
.rune-word { --px: clamp(5px, 1.6vw, 8px); color: var(--accent); margin: 18px 0; display: flex; justify-content: center; }
[data-epoch="3"] .rune-word { font-family: var(--head-font); font-size: 2rem; font-weight: 700; letter-spacing: .08em; }
.rune-close { font: inherit; margin-top: 8px; padding: 10px 16px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--radius); cursor: pointer; font-weight: 600; }

/* ---------- Epochenwechsel ---------- */
.epoch-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; pointer-events: none; }
.epoch-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(16, 1fr); grid-template-rows: repeat(10, 1fr); }
.epoch-grid span { background: #000; opacity: 0; transition: opacity .5s; }
.epoch-overlay.is-in .epoch-grid span { opacity: 1; }
.epoch-overlay.is-in .epoch-grid span.gone { opacity: 0; transition: opacity .25s; }
.epoch-overlay-title { --px: clamp(4px, 1vw, 9px); position: relative; color: #fff; opacity: 0; transition: opacity .6s; padding: 0 16px; }
.epoch-overlay-title .px-pixels { justify-content: center; }
.epoch-overlay.is-in .epoch-overlay-title { opacity: 1; }
.epoch-overlay.is-out .epoch-overlay-title { opacity: 0; }

/* ---------- Responsiv ---------- */
@media (max-width: 760px) {
  .stone { grid-template-columns: 1fr; }
  .hero { min-height: 760px; }
  .scene { height: 36%; }
  .copy-btn { width: 100%; flex-direction: column; text-align: center; }
  .finds li { grid-template-columns: 2rem 1fr; }
  .finds time { grid-column: 2; grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .aurora::before, .aurora::after { animation: none; }
  body { transition: none; }
}
