/* =========================================================
   dwice.io — Design Tokens
   ========================================================= */
:root {
  /* Light Mode (Warm White + Deep Orange) */
  --bg: 246 244 242;        /* #F6F4F2 warm white */
  --fg: 18 16 16;           /* #121010 */
  --muted: 122 117 112;     /* #7A7570 */
  --gold: 210 82 0;         /* #D25200 deep orange, WCAG AA on light */
  --line: 18 16 16;
  --on-gold: 255 255 255;
  --glass-bg: 255 255 255;
  --glass-alpha: 0.58;
  --glass-border: 18 16 16;
  --glass-border-alpha: 0.07;
  --shadow: 0 30px 80px -40px rgba(18, 16, 16, 0.25);
  --vignette: rgba(246, 244, 242, 0.85);
  --grain-opacity: 0.04;
  color-scheme: light;
}

:root.dark {
  /* Dark Mode (Matte Black Metallic + Glowing Orange) */
  --bg: 8 8 8;              /* #080808 deep matte black */
  --fg: 232 228 224;        /* #E8E4E0 warm off-white */
  --muted: 138 133 128;     /* #8A8580 warm grey */
  --gold: 255 107 0;        /* #FF6B00 vivid glowing orange */
  --line: 232 228 224;
  --on-gold: 8 8 8;
  --glass-bg: 18 18 16;     /* #121210 warm black */
  --glass-alpha: 0.45;
  --glass-border: 255 255 255;
  --glass-border-alpha: 0.06;
  --shadow: 0 40px 100px -40px rgba(0, 0, 0, 0.85);
  --vignette: rgba(8, 8, 8, 0.92);
  --grain-opacity: 0.06;
  color-scheme: dark;
}

html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  background: rgb(var(--bg));
  transition: background-color 0.7s ease, color 0.7s ease;
  overflow-x: hidden;
}

/* Während Loader: kein Scroll */
body.is-loading { overflow: hidden; }

/* =========================================================
   WebGL Layer
   ========================================================= */
#webgl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 120% 80% at 50% 40%, transparent 45%, var(--vignette) 100%);
  transition: background 0.7s ease;
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 2;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 8s steps(10) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-5%, 3%); }
  40% { transform: translate(3%, -6%); }
  60% { transform: translate(-7%, 2%); }
  80% { transform: translate(4%, 5%); }
}

main { position: relative; z-index: 10; }

/* =========================================================
   Glassmorphism
   ========================================================= */
.glass {
  background: rgb(var(--glass-bg) / var(--glass-alpha));
  border: 1px solid rgb(var(--glass-border) / var(--glass-border-alpha));
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow), inset 0 1px 0 rgb(255 255 255 / 0.06);
  transition: background-color 0.7s ease, border-color 0.7s ease, box-shadow 0.7s ease;
}

.nav-glass {
  background: rgb(var(--glass-bg) / 0.35);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

#header.is-scrolled {
  background: rgb(var(--bg) / 0.55);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgb(var(--line) / 0.06);
}
#header.is-hidden { transform: translateY(-100%); }
#header { transition: transform 0.5s cubic-bezier(.2,.8,.2,1), background 0.5s, backdrop-filter 0.5s; }

/* =========================================================
   Header / Nav / Buttons
   ========================================================= */
.nav-link {
  position: relative;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  color: rgb(var(--fg) / 0.7);
  border-radius: 999px;
  transition: color 0.3s, background 0.3s;
}
.nav-link:hover, .nav-link.is-active {
  color: rgb(var(--fg));
  background: rgb(var(--fg) / 0.06);
}

.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.4s, color 0.4s, border-color 0.4s;
  will-change: transform;
}
.btn-lg { padding: 1rem 1.6rem; font-size: 0.95rem; }
.btn-primary {
  background: rgb(var(--gold));
  color: rgb(var(--on-gold));
  box-shadow: 0 0 24px rgb(var(--gold) / 0.3), 0 0 60px rgb(var(--gold) / 0.08);
}
.btn-primary:hover { background: rgb(var(--fg)); color: rgb(var(--bg)); box-shadow: none; }
.btn-ghost {
  border: 1px solid rgb(var(--line) / 0.18);
  color: rgb(var(--fg));
}
.btn-ghost:hover { border-color: rgb(var(--gold)); color: rgb(var(--gold)); }
.btn-primary:active, .btn-ghost:active { transform: scale(0.97); }

/* Theme Toggle */
.theme-toggle {
  position: relative;
  width: 64px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgb(var(--line) / 0.15);
  background: rgb(var(--fg) / 0.05);
  transition: background 0.5s, border-color 0.5s;
}
.theme-toggle__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgb(var(--gold));
  color: rgb(var(--on-gold));
  transform: translateX(30px);
  transition: transform 0.6s cubic-bezier(.7,0,.2,1), background 0.5s;
}
.dark .theme-toggle__knob { transform: translateX(0); }
.theme-toggle svg { position: absolute; width: 15px; height: 15px; transition: opacity 0.4s, transform 0.6s cubic-bezier(.7,0,.2,1); }
.icon-sun { opacity: 1; transform: rotate(0); }
.icon-moon { opacity: 0; transform: rotate(-90deg); }
.dark .icon-sun { opacity: 0; transform: rotate(90deg); }
.dark .icon-moon { opacity: 1; transform: rotate(0); }

/* Mobile menu */
.menu-icon { position: relative; width: 16px; height: 8px; }
.menu-icon i { position: absolute; left: 0; width: 100%; height: 1.5px; background: currentColor; transition: transform 0.5s cubic-bezier(.7,0,.2,1), top 0.5s; }
.menu-icon i:first-child { top: 0; }
.menu-icon i:last-child { top: 6.5px; }
.menu-open .menu-icon i:first-child { top: 3.25px; transform: rotate(45deg); }
.menu-open .menu-icon i:last-child { top: 3.25px; transform: rotate(-45deg); }
#mobile-menu { opacity: 0; visibility: hidden; transition: opacity 0.5s, visibility 0.5s; }
.menu-open #mobile-menu { opacity: 1; visibility: visible; }

/* =========================================================
   Hero
   ========================================================= */
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.18em; }
.hero-title .line > span { display: inline-block; will-change: transform; }

.pulse-dot {
  position: relative;
  width: 7px; height: 7px;
  border-radius: 999px;
  background: rgb(var(--gold));
  box-shadow: 0 0 8px rgb(var(--gold) / 0.6), 0 0 20px rgb(var(--gold) / 0.2);
  flex-shrink: 0;
}
.pulse-dot::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 999px;
  border: 1px solid rgb(var(--gold));
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(0.6); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }

.scroll-line { position: relative; width: 40px; height: 1px; background: rgb(var(--line) / 0.2); overflow: hidden; }
.scroll-line::after {
  content: ""; position: absolute; inset: 0; background: rgb(var(--gold));
  animation: scrollLine 2s cubic-bezier(.7,0,.2,1) 1.5s 3 both;
}
@keyframes scrollLine { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }

/* Manifest word reveal */
#manifest-text .word { display: inline-block; opacity: 0.12; transition: color 0.3s; }

/* =========================================================
   Services
   ========================================================= */
.service-card {
  position: relative;
  border-radius: 32px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) { .service-card { padding: 3rem; } }
@media (min-width: 1024px) {
  .service-card {
    position: sticky;
    top: calc(12vh + var(--i) * 22px);
    margin-bottom: 12vh;
    min-height: 70vh;
    transform-origin: 50% 0%;
  }
}
.svc-icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  display: grid; place-items: center;
  border: 1px solid rgb(var(--gold) / 0.35);
  color: rgb(var(--gold));
  background: rgb(var(--gold) / 0.06);
}
.svc-icon svg { width: 34px; height: 34px; }

/* =========================================================
   Process
   ========================================================= */
.proc-track {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
@media (min-width: 1024px) {
  .proc-track {
    flex-direction: row;
    gap: 1.5rem;
    width: max-content;
    padding-left: max(2.5rem, calc((100vw - 1440px) / 2 + 2.5rem));
    padding-right: 30vw;
    will-change: transform;
  }
}
.proc-card {
  position: relative;
  border-radius: 28px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  min-height: 340px;
  overflow: hidden;
}
@media (min-width: 1024px) { .proc-card { width: 420px; min-height: 52vh; padding: 2.5rem; } }
.proc-card::before {
  content: ""; position: absolute; left: 0; top: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, rgb(var(--gold)), transparent);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.9s cubic-bezier(.2,.8,.2,1);
}
.proc-card.is-active::before { transform: scaleX(1); }
.proc-num {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 6rem;
  line-height: 1;
  color: rgb(var(--gold) / 0.9);
  transition: color 0.5s;
}
.proc-card h3 { margin-top: auto; padding-top: 2rem; font-size: 1.75rem; font-weight: 500; letter-spacing: -0.02em; }
.proc-card p { margin-top: 0.75rem; color: rgb(var(--muted)); line-height: 1.6; }
.proc-meta {
  margin-top: 1.75rem; padding-top: 1.25rem;
  border-top: 1px solid rgb(var(--line) / 0.1);
  display: flex; justify-content: space-between; gap: 1rem;
  font-family: "JetBrains Mono", monospace; font-size: 0.7rem; color: rgb(var(--muted));
}

/* =========================================================
   Contact
   ========================================================= */
.chip {
  font-size: 0.82rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid rgb(var(--line) / 0.14);
  color: rgb(var(--fg) / 0.75);
  transition: all 0.3s;
}
.chip:hover { border-color: rgb(var(--gold) / 0.6); color: rgb(var(--fg)); }
.chip.is-active { background: rgb(var(--gold)); border-color: rgb(var(--gold)); color: rgb(var(--on-gold)); box-shadow: 0 0 16px rgb(var(--gold) / 0.25); }

.field { position: relative; display: block; padding-top: 1rem; }
.field input, .field textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgb(var(--line) / 0.18);
  padding: 0.6rem 0;
  color: rgb(var(--fg));
  font-size: 1rem;
  outline: none;
  resize: none;
  transition: border-color 0.3s;
}
.field input:focus, .field textarea:focus { border-color: rgb(var(--gold)); }
.field span {
  position: absolute; left: 0; top: 1.6rem;
  font-size: 1rem; color: rgb(var(--muted));
  pointer-events: none;
  transform-origin: left top;
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), color 0.3s;
}
.field input:focus + span, .field input:not(:placeholder-shown) + span,
.field textarea:focus + span, .field textarea:not(:placeholder-shown) + span {
  transform: translateY(-1.4rem) scale(0.78);
  color: rgb(var(--gold));
}
.field.is-invalid input { border-color: #e5484d; }

.footer-logo {
  display: block;
  width: 100%;
  height: auto;
  color: rgb(var(--fg) / 0.92);
}
button.footer-link { background: none; border: none; padding: 0; font: inherit; cursor: pointer; color: inherit; }
.footer-link { position: relative; transition: color 0.3s; }
.footer-link:hover { color: rgb(var(--fg)); }
.footer-link::after { content: ""; position: absolute; left: 0; bottom: -3px; width: 100%; height: 1px; background: rgb(var(--gold)); transform: scaleX(0); transform-origin: right; transition: transform 0.4s; }
.footer-link:hover::after { transform: scaleX(1); transform-origin: left; }


/* Brand-Logo */
.brand { display: inline-flex; align-items: center; color: rgb(var(--fg)); }
.brand svg { height: 30px; width: auto; transition: transform 0.6s cubic-bezier(.2,.8,.2,1); }
.brand:hover svg { transform: translateY(-1px) scale(1.03); }

/* Zahlen */
.stats { background: rgb(var(--line) / 0.1); }
.stat {
  background: rgb(var(--glass-bg) / var(--glass-alpha));
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  padding: 1.75rem 1.5rem;
  display: flex; flex-direction: column-reverse; gap: 0.5rem;
}
@media (min-width: 768px) { .stat { padding: 2.5rem 2rem; } }
.stat dt { font-size: 0.85rem; color: rgb(var(--muted)); }
.stat dd { font-size: clamp(2.75rem, 5.5vw, 5rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1; }

.pillars li { border-top: 1px solid rgb(var(--line) / 0.12); padding-top: 1.25rem; }
.pillars h3 { font-size: 1.15rem; font-weight: 500; letter-spacing: -0.01em; }
.pillars p { margin-top: 0.5rem; color: rgb(var(--muted)); line-height: 1.6; }

/* Leistungen */
.svc-kicker { margin-top: 0.75rem; font-size: 0.8rem; color: rgb(var(--muted)); line-height: 1.5; max-width: 34ch; }
.svc-kicker sup { font-size: 0.6em; }
.svc-title { margin-top: 2.25rem; font-size: clamp(1.9rem, 3.6vw, 3.25rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1.02; }
.svc-lead { margin-top: 1.1rem; max-width: 44rem; color: rgb(var(--muted)); line-height: 1.6; }
@media (min-width: 768px) { .svc-lead { font-size: 1.075rem; } }
.svc-features {
  margin-top: auto; padding-top: 2rem;
  display: grid; gap: 1.25rem 2rem;
}
@media (min-width: 640px) { .svc-features { grid-template-columns: 1fr 1fr; } }
.svc-features li { border-top: 1px solid rgb(var(--line) / 0.1); padding-top: 0.9rem; }
.svc-features h4 { font-size: 0.95rem; font-weight: 500; display: flex; align-items: center; gap: 0.6rem; }
.svc-features h4::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: rgb(var(--gold)); flex-shrink: 0; }
.svc-features p { margin-top: 0.35rem; font-size: 0.875rem; color: rgb(var(--muted)); line-height: 1.55; }

.svc-index { counter-reset: svc; display: grid; gap: 0.15rem; }
.svc-index li {
  counter-increment: svc;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.55rem 0;
  font-size: 0.95rem;
  color: rgb(var(--muted));
  transition: color 0.4s;
}
.svc-index li::before {
  content: counter(svc, decimal-leading-zero);
  font-family: "JetBrains Mono", monospace; font-size: 0.7rem;
  width: 1.75rem;
}
.svc-index li::after {
  content: ""; height: 1px; flex: 0 0 0; background: rgb(var(--gold));
  transition: flex-basis 0.6s cubic-bezier(.2,.8,.2,1);
}
.svc-index li.is-active { color: rgb(var(--fg)); }
.svc-index li.is-active::before { color: rgb(var(--gold)); }
.svc-index li.is-active::after { flex-basis: 48px; }

/* Branchen */
.ind-list { border-top: 1px solid rgb(var(--line) / 0.12); }
.ind-row {
  position: relative;
  display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; gap: 1rem;
  padding: 1.6rem 0.25rem;
  border-bottom: 1px solid rgb(var(--line) / 0.12);
  overflow: hidden;
}
.ind-row::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgb(var(--gold));
  transform: scaleY(0); transform-origin: bottom;
  transition: transform 0.55s cubic-bezier(.7,0,.2,1);
}
.ind-num { font-family: "JetBrains Mono", monospace; font-size: 0.75rem; color: rgb(var(--gold)); transition: color 0.4s; }
.ind-name { font-size: clamp(1.4rem, 2.8vw, 2.5rem); font-weight: 500; letter-spacing: -0.03em; transition: color 0.4s, transform 0.55s cubic-bezier(.2,.8,.2,1); }
.ind-arrow { font-size: 1.4rem; color: rgb(var(--muted)); transition: color 0.4s, transform 0.55s cubic-bezier(.2,.8,.2,1); }
@media (hover: hover) {
  .ind-row:hover::before { transform: scaleY(1); }
  .ind-row:hover .ind-num, .ind-row:hover .ind-name, .ind-row:hover .ind-arrow { color: rgb(var(--on-gold)); }
  .ind-row:hover .ind-name { transform: translateX(0.75rem); }
  .ind-row:hover .ind-arrow { transform: rotate(45deg); }
}

/* Consent */
.consent { display: flex; gap: 0.75rem; align-items: flex-start; font-size: 0.8rem; color: rgb(var(--muted)); line-height: 1.5; cursor: pointer; }
.consent input {
  appearance: none; -webkit-appearance: none;
  flex-shrink: 0; margin-top: 0.1rem;
  width: 18px; height: 18px; border-radius: 5px;
  border: 1px solid rgb(var(--line) / 0.3);
  display: grid; place-items: center;
  transition: background 0.3s, border-color 0.3s;
}
.consent input:checked { background: rgb(var(--gold)); border-color: rgb(var(--gold)); }
.consent input:checked::after { content: ""; width: 9px; height: 5px; border-left: 1.5px solid rgb(var(--on-gold)); border-bottom: 1.5px solid rgb(var(--on-gold)); transform: rotate(-45deg) translate(1px, -1px); }
.consent a { color: rgb(var(--fg)); text-decoration: underline; text-underline-offset: 3px; }
.consent.is-invalid input { border-color: #e5484d; }

/* 3D-Szenen-Umschalter */
.scene-switch {
  display: flex;
  align-items: center; gap: 0.15rem;
  padding: 0.25rem;
  border-radius: 999px;
  border: 1px solid rgb(var(--line) / 0.15);
  background: rgb(var(--fg) / 0.04);
  font-size: 0.72rem;
}
.scene-switch--header { display: none; }
@media (min-width: 768px) { .scene-switch--header { display: flex; } }
.scene-switch__label { padding: 0 0.5rem 0 0.6rem; font-family: "JetBrains Mono", monospace; color: rgb(var(--muted)); }
.scene-switch button { padding: 0.35rem 0.7rem; border-radius: 999px; color: rgb(var(--fg) / 0.7); transition: background 0.3s, color 0.3s; }
.scene-switch button:hover { color: rgb(var(--fg)); }
.scene-switch button.is-active { background: rgb(var(--gold)); color: rgb(var(--on-gold)); box-shadow: 0 0 12px rgb(var(--gold) / 0.3); }
.no-webgl .scene-switch { display: none; }

/* =========================================================
   Cursor (nur Desktop mit Maus)
   ========================================================= */
#cursor {
  position: fixed; top: 0; left: 0; z-index: 90;
  pointer-events: none;
  display: none;
}
#cursor span {
  display: block;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 999px;
  background: rgb(var(--gold));
  transition: width 0.35s cubic-bezier(.2,.8,.2,1), height 0.35s cubic-bezier(.2,.8,.2,1), margin 0.35s cubic-bezier(.2,.8,.2,1), opacity 0.3s, background 0.3s;
  mix-blend-mode: difference;
}
#cursor.is-hover span { width: 54px; height: 54px; margin: -27px 0 0 -27px; opacity: 0.35; }
@media (hover: hover) and (pointer: fine) { #cursor { display: block; } }

/* =========================================================
   Loader
   ========================================================= */
#loader { transition: clip-path 1.1s cubic-bezier(.8,0,.2,1) 0.45s; clip-path: inset(0 0 0 0); --p: 0; }
#loader.is-done { clip-path: inset(0 0 100% 0); pointer-events: none; }

.loader-mark {
  position: relative;
  width: min(62vw, 520px);
  aspect-ratio: 126 / 43;
}
.loader-logo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* leeres Logo: nur angedeutet */
.loader-logo--base { color: rgb(var(--fg) / 0.1); --logo-dot: rgb(var(--fg) / 0.1); }
/* Füllung in Kontrastfarbe, steigt von unten auf */
.loader-fill {
  position: absolute; inset: 0;
  clip-path: inset(calc((1 - var(--p)) * 100%) 0 0 0);
}
.loader-logo--fill { color: rgb(var(--gold)); --logo-dot: rgb(var(--gold)); }

/* 100 %: kurzer Abschluss, der i-Punkt wechselt in die Textfarbe, das Logo atmet einmal */
#loader.is-full .loader-mark { animation: loaderPop 0.7s cubic-bezier(.2,.8,.2,1) both; }
#loader.is-full .loader-logo--fill { color: rgb(var(--fg)); --logo-dot: rgb(var(--fg)); }
#loader.is-full .loader-foot { opacity: 0; transform: translateY(8px); }
@keyframes loaderPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.loader-foot {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 1.5rem;
  font-size: 0.72rem; color: rgb(var(--muted));
  transition: opacity 0.4s, transform 0.4s;
}
@media (min-width: 768px) { .loader-foot { padding: 2.5rem; } }
@media (max-width: 480px) { .loader-foot span:last-child { display: none; } }

/* Fallback, wenn WebGL fehlt */
.no-webgl #webgl { display: none; }
.no-webgl body {
  background:
    radial-gradient(circle at 70% 30%, rgb(var(--gold) / 0.18), transparent 50%),
    rgb(var(--bg));
}

/* =========================================================
   Legal Prose (Impressum / Datenschutz)
   ========================================================= */
.legal-prose h2 { font-size: 1.5rem; font-weight: 600; color: rgb(var(--fg)); margin-bottom: 0.75rem; }
.legal-prose h3 { font-size: 1.125rem; font-weight: 500; color: rgb(var(--fg)); margin-top: 1.5rem; margin-bottom: 0.5rem; }
.legal-prose h4 { font-size: 1rem; font-weight: 500; color: rgb(var(--fg)); margin-top: 1rem; margin-bottom: 0.25rem; }
.legal-prose p { margin-top: 0.5rem; }
.legal-prose a { color: rgb(var(--gold)); text-decoration: underline; text-underline-offset: 3px; transition: color 0.3s; }
.legal-prose a:hover { color: rgb(var(--fg)); }
.legal-prose ul { list-style-type: disc; padding-left: 1.5rem; margin-top: 0.5rem; }
.legal-prose li { margin-top: 0.25rem; }

/* =========================================================
   Cookie Consent
   ========================================================= */
#cookie-consent {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s cubic-bezier(.2,.8,.2,1);
}
#cookie-consent.is-visible { opacity: 1; pointer-events: auto; }
#cookie-consent.is-hiding { opacity: 0; pointer-events: none; }

@media (min-width: 768px) { #cookie-consent { padding: 1.5rem; } }

.cc-banner {
  width: 100%;
  max-width: 720px;
  border-radius: 24px;
  padding: 1.5rem;
  transform: translateY(24px);
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}
#cookie-consent.is-visible .cc-banner { transform: translateY(0); }
#cookie-consent.is-hiding .cc-banner { transform: translateY(24px); }

@media (min-width: 768px) { .cc-banner { padding: 2rem; } }

.cc-text {
  font-size: 0.85rem;
  line-height: 1.6;
  color: rgb(var(--muted));
}
.cc-text a {
  color: rgb(var(--fg));
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.3s;
}
.cc-text a:hover { color: rgb(var(--gold)); }

.cc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.cc-btn {
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.35s, color 0.35s, border-color 0.35s;
}
.cc-btn--primary {
  padding: 0.65rem 1.25rem;
  background: rgb(var(--gold));
  color: rgb(var(--on-gold));
  box-shadow: 0 0 20px rgb(var(--gold) / 0.25);
}
.cc-btn--primary:hover { background: rgb(var(--fg)); color: rgb(var(--bg)); box-shadow: none; }
.cc-btn--ghost {
  padding: 0.65rem 1.25rem;
  border: 1px solid rgb(var(--line) / 0.18);
  color: rgb(var(--fg));
}
.cc-btn--ghost:hover { border-color: rgb(var(--gold)); color: rgb(var(--gold)); }
.cc-btn--link {
  padding: 0.65rem 0.75rem;
  color: rgb(var(--muted));
}
.cc-btn--link:hover { color: rgb(var(--fg)); }

/* Settings panel */
.cc-settings {
  border-top: 1px solid rgb(var(--line) / 0.1);
  margin-top: 1.25rem;
  padding-top: 1.25rem;
}
.cc-settings__inner { display: grid; gap: 1rem; }

.cc-cat {
  padding: 0.75rem 0;
}
.cc-cat:not(:last-child) { border-bottom: 1px solid rgb(var(--line) / 0.08); }

.cc-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.cc-cat__label {
  font-size: 0.9rem;
  font-weight: 500;
  color: rgb(var(--fg));
  cursor: pointer;
}
.cc-cat__desc {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgb(var(--muted));
}

/* Toggle switch */
.cc-toggle {
  position: relative;
  flex-shrink: 0;
}
.cc-toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.cc-toggle__track {
  display: block;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: rgb(var(--fg) / 0.12);
  cursor: pointer;
  transition: background 0.35s;
}
.cc-toggle__knob {
  display: block;
  width: 18px;
  height: 18px;
  margin: 3px;
  border-radius: 999px;
  background: rgb(var(--fg) / 0.5);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), background 0.35s;
}
.cc-toggle__input:checked ~ .cc-toggle__track {
  background: rgb(var(--gold) / 0.2);
}
.cc-toggle__input:checked ~ .cc-toggle__track .cc-toggle__knob {
  transform: translateX(20px);
  background: rgb(var(--gold));
}
.cc-toggle--locked .cc-toggle__track {
  opacity: 0.5;
  cursor: not-allowed;
}
.cc-toggle--locked .cc-toggle__input:checked ~ .cc-toggle__track {
  background: rgb(var(--gold) / 0.15);
}
.cc-toggle--locked .cc-toggle__input:checked ~ .cc-toggle__track .cc-toggle__knob {
  background: rgb(var(--gold) / 0.7);
}

.cc-settings__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* =========================================================
   Reduced Motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .grain { display: none; }
  #manifest-text .word { opacity: 1 !important; }
}
