/* ==========================================================================
   Museum der Phänomene — dunkles, elegantes Museums-Design
   Palette: tiefes Anthrazit + ein Akzent (Messing/Gold), konsequent.
   ========================================================================== */

:root {
  --bg: #0b0d10;
  --bg-2: #0f1216;
  --panel: #14181f;
  --panel-2: #181d26;
  --line: #242b35;
  --text: #d8dbe0;
  --muted: #97a0ac;
  --accent: #c9a35f;
  --accent-strong: #e2c184;
  --accent-soft: rgba(201, 163, 95, 0.14);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --radius: 12px;
  --maxw: 1180px;
}

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

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 50% -120px, #151b23 0%, transparent 65%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.015em;
  color: #eceef1;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

code {
  font-size: 0.86em;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.4em;
  color: var(--accent-strong);
}

/* --------------------------------------------------------------------------
   Kopf- und Fußzeile
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(11, 13, 16, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: #eceef1;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
}
.brand:hover { color: var(--accent-strong); }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: 1.05rem;
}

.site-nav a {
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.site-nav a:hover { color: var(--accent); }

.site-footer {
  margin-top: 4rem;
  padding: 1.6rem clamp(1rem, 4vw, 2.5rem);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Startseite: Hero + Karten-Grid
   -------------------------------------------------------------------------- */

.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3.5rem, 9vh, 6.5rem) clamp(1rem, 4vw, 2.5rem) 2rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0 0 1.1rem;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1.08;
}

.mission {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.08rem;
}

.grid-section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 0;
}

.grid-section h2 {
  font-size: 1.7rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.7rem;
  margin: 0 0 1.6rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.4rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(170deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(201, 163, 95, 0.55);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  color: var(--text);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-media-fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background:
    radial-gradient(340px 170px at 50% 120%, var(--accent-soft), transparent 70%),
    linear-gradient(160deg, #161c24, #0e1116);
}

.card-media-fallback span {
  font-family: var(--serif);
  font-size: 3.4rem;
  color: var(--accent);
  opacity: 0.85;
}

.card.no-image img { display: none; }
.card.no-image .card-media-fallback { display: grid; }

.card-body {
  padding: 1.1rem 1.25rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.card-body h3 { margin: 0; font-size: 1.45rem; }

.card-sub {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.card-body p:not(.card-sub) {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  flex: 1;
}

.card-link {
  margin-top: 0.9rem;
  font-size: 0.88rem;
  color: var(--accent);
}
.card:hover .card-link { color: var(--accent-strong); }

/* --------------------------------------------------------------------------
   Detailseite: Kopf, Viewer + Steuerung
   -------------------------------------------------------------------------- */

.detail {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.2rem clamp(1rem, 4vw, 2.5rem) 0;
}

.detail-head { margin-bottom: 1.4rem; }
.detail-head h1 {
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.12;
}
.detail-head .eyebrow { margin-bottom: 0.4rem; }

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.2rem;
  align-items: stretch;
}

.viewer {
  position: relative;
  height: clamp(360px, 58vh, 640px);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.viewer canvas { display: block; width: 100%; height: 100%; }

.viewer-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.controls {
  background: linear-gradient(170deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
}

.controls h2 {
  margin: 0 0 0.9rem;
  font-size: 1.25rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.55rem;
}

.controls-list { display: flex; flex-direction: column; gap: 1.05rem; flex: 1; }

.control-row { display: flex; flex-direction: column; gap: 0.35rem; }

.control-row.toggle-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.control-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}

/* Schalter (Toggle) */
.switch {
  --w: 46px;
  position: relative;
  width: var(--w);
  height: 25px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  padding: 0;
}

.switch .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch[aria-checked="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.switch[aria-checked="true"] .knob {
  transform: translateX(21px);
  background: var(--accent);
}

/* Schieberegler */
.slider-wrap { display: flex; align-items: center; gap: 0.7rem; }

.slider-wrap output {
  min-width: 3.6em;
  text-align: right;
  font-size: 0.84rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0b0d10;
  transition: transform 0.15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0b0d10;
}

.hint {
  margin: 1.1rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}

/* --------------------------------------------------------------------------
   Detailseite: Tabs + Inhalte
   -------------------------------------------------------------------------- */

.content { margin-top: 2rem; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}

.tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.93rem;
  font-weight: 500;
  padding: 0.65rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.panel { display: none; padding: 1.6rem 0.2rem 0.4rem; max-width: 820px; }
.panel.active { display: block; animation: fadeIn 0.35s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.panel p { margin: 0 0 1.05rem; }
.panel strong { color: #eceef1; }
.panel em { color: var(--accent-strong); font-style: italic; }

.panel .katex-display {
  padding: 0.7rem 1rem;
  margin: 1.2rem 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 8px;
  overflow-x: auto;
}

/* „Wusstest du schon?"-Fakten */
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }

.facts li {
  position: relative;
  background: linear-gradient(170deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.95rem 1.15rem 0.95rem 3rem;
}

.facts li::before {
  content: "★";
  position: absolute;
  left: 1.05rem;
  top: 0.95rem;
  color: var(--accent);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   Galerie & Foto-Platzhalter
   -------------------------------------------------------------------------- */

.gallery {
  margin-top: 2.4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
}

.gallery:not(:empty)::before {
  content: "Bilder";
  grid-column: 1 / -1;
  font-family: var(--serif);
  font-size: 1.4rem;
  color: #eceef1;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
}

.gallery figure {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.img-placeholder {
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1.2rem;
  text-align: center;
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(255,255,255,0.015) 14px 28px),
    var(--bg-2);
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.img-placeholder .ph-label {
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent);
}

.gallery figcaption {
  padding: 0.75rem 1rem 0.9rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.gallery .credit {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  opacity: 0.75;
}

/* --------------------------------------------------------------------------
   Responsiv (PC & Tablet primär, bis ~768 px fluid)
   -------------------------------------------------------------------------- */

@media (max-width: 940px) {
  .stage { grid-template-columns: 1fr; }
  .viewer { height: clamp(320px, 52vh, 520px); }
  .controls-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
}

@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .hero h1 { font-size: 2.3rem; }
  .controls-list { grid-template-columns: 1fr; }
}
