/* ============================================================
   theme.css — single source of truth for colour, type and motion
   Loaded by the homepage and every case study.

   Light: off-white, ink, cobalt.  Dark: near-black, warm white, periwinkle.
   Contrast (WCAG AA): muted on bg ≥ 5.9:1, accent on bg ≥ 6.4:1.
   ============================================================ */

:root {
  --ease: cubic-bezier(0.16, 1, 0.3, 1); /* expo out — arrivals */
  --ease-io: cubic-bezier(0.76, 0, 0.24, 1); /* in-out — wipes */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --f-display: "Inter Tight", system-ui, sans-serif;
  --f-body: "Geist", system-ui, sans-serif;
  --f-mono: "Geist Mono", ui-monospace, monospace;
  --pad: clamp(20px, 4vw, 64px);
  --radius: 16px;

  /* constant across themes */
  --on-night: #edece7;
  --on-night-muted: #a3a29c;
  --accent-on-night: #8b97ff;
}

:root,
:root[data-theme="light"] {
  --bg: #f7f7f5;
  --bg-2: #eeeeeb;
  --surface: #ffffff;
  --ink: #0b0b0c;
  --muted: #5f5f5c;
  --faint: #858581;
  --rule: #dededa;
  --accent: #2a3cf4;
  --accent-ink: #ffffff;
  --night: #0b0b0c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -12px rgba(0, 0, 0, 0.12);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0b0c;
  --bg-2: #141416;
  --surface: #161618;
  --ink: #edece7;
  --muted: #9b9a94;
  --faint: #757470;
  --rule: #26262a;
  --accent: #8b97ff;
  --accent-ink: #0b0b0c;
  --night: #18181b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 40px -16px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ── Aliases used throughout the case-study CSS/JSX ── */
:root {
  --page-bg: var(--bg);
  --page-fg: var(--ink);
  --page-muted: var(--muted);
  --page-line: var(--rule);
  --page-line-strong: var(--ink);
  --page-card: var(--surface);
  --page-card-alt: var(--surface);
  --page-dark: var(--night);
  --page-dark-2: color-mix(in srgb, var(--night) 88%, #fff);
  --page-on-dark: var(--on-night);
  --page-muted-on-dark: var(--on-night-muted);
  --page-accent: var(--accent);
  --page-accent-on-dark: var(--accent-on-night);
  --page-hover: var(--accent);
  --page-highlight: color-mix(in srgb, var(--accent) 22%, transparent);

  --font-display: var(--f-display);
  --font-sans: var(--f-body);
  --font-mono: var(--f-mono);
}
/* Accent on dark sections (both themes) stays legible */
[style*="var(--page-dark)"],
[style*="var(--night)"] {
  --page-accent: var(--accent-on-night);
  --accent: var(--accent-on-night);
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ── Accessibility primitives ── */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip,
.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 10000;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font: 500 15px/1.2 var(--f-body);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.3s var(--ease);
}
.skip:focus,
.skip-link:focus {
  transform: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* German (and other long-word languages): break long compounds cleanly */
:lang(de) h1,
:lang(de) h2,
:lang(de) h3,
:lang(de) p,
:lang(de) li {
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}

/* ── Smooth scroll (Lenis) ── */
html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-stopped {
  overflow: hidden;
}

/* ── Page transitions: leave with a wipe up, arrive with it sliding away ── */
.wipe {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: var(--accent);
  transform: translateY(100%);
  pointer-events: none;
}
.wipe.go {
  transform: none;
  transition: transform 0.6s var(--ease-io);
}
html.enter::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: var(--accent);
  pointer-events: none;
  animation: page-enter 0.8s var(--ease-io) 0.05s forwards;
}
@keyframes page-enter {
  to {
    transform: translateY(-100%);
  }
}

/* ── Cursor label ── */
.cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 80;
  pointer-events: none;
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  transform: translate3d(-200px, -200px, 0) scale(0);
}
.cursor span {
  font: 600 11px/1 var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
@media (hover: none) {
  .cursor {
    display: none;
  }
}

/* ── Theme switch: circular reveal ── */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-new(root) {
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  html.enter::after {
    display: none;
  }
}
