/*
 * Shared design tokens + base rules for Bommel Visuals.
 * Loaded on every front-end page (index.php, project.php, shop.html).
 * Each page keeps its own <style> block for page-specific layout — this
 * file only owns things that must stay consistent everywhere: color
 * tokens (dark OLED + light theme), typography scale, i18n, cursor,
 * focus states, reduced motion, and the brutalist/organic utility classes
 * used across pages.
 */

:root {
  /* --- Brand & OLED-dark tokens (default theme) --- */
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --bg-subtle: rgba(255, 255, 255, 0.03);
  --text: #cccccc;
  --text-strong: #ffffff;
  --heading: #ffffff;
  --border: rgba(255, 255, 255, 0.15);
  --border-strong: rgba(255, 255, 255, 0.4);
  --accent: #d9b38c;
  --accent-contrast: #000000;
  --input-bg: rgba(255, 255, 255, 0.02);
  --bg-gradient: radial-gradient(circle at center, #111111 0%, #000000 100%);

  --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
  --ease-luxe: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.25, 1, 0.5, 1);

  --section-py: clamp(6rem, 11vw, 11rem);
  --section-px: 6%;

  color-scheme: dark;
}

/* Light theme — explicit opt-in via the toggle, persisted in localStorage.
   Not a stark white: a warm off-white keeps the copper accent legible and
   avoids glare next to high-contrast photography. */
:root[data-theme="light"] {
  --bg: #f2f0ec;
  --bg-elevated: #ffffff;
  --bg-subtle: rgba(0, 0, 0, 0.035);
  --text: #4a4a48;
  --text-strong: #111111;
  --heading: #111111;
  --border: rgba(0, 0, 0, 0.14);
  --border-strong: rgba(0, 0, 0, 0.55);
  --accent: #a9754a;
  --accent-contrast: #ffffff;
  --input-bg: rgba(0, 0, 0, 0.015);
  --bg-gradient: radial-gradient(circle at center, #ffffff 0%, #f2f0ec 100%);

  color-scheme: light;
}

/* No-JS / pre-hydration fallback: if the visitor has never chosen a theme,
   follow the OS preference. The inline boot script in <head> normally sets
   data-theme before first paint, making this a defense-in-depth fallback
   rather than the primary mechanism. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f2f0ec;
    --bg-elevated: #ffffff;
    --bg-subtle: rgba(0, 0, 0, 0.035);
    --text: #4a4a48;
    --text-strong: #111111;
    --heading: #111111;
    --border: rgba(0, 0, 0, 0.14);
    --border-strong: rgba(0, 0, 0, 0.55);
    --accent: #a9754a;
    --accent-contrast: #ffffff;
    --input-bg: rgba(0, 0, 0, 0.015);
    --bg-gradient: radial-gradient(circle at center, #ffffff 0%, #f2f0ec 100%);
    color-scheme: light;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
}

body {
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  transition: background-color 0.4s var(--ease-out), color 0.4s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  body,
  a,
  button,
  .menu-trigger,
  .skip-btn {
    cursor: none;
  }
}

h1,
h2,
h3,
h4,
.bebas {
  font-family: "Bebas Neue", sans-serif;
  text-transform: uppercase;
  line-height: 0.95;
  letter-spacing: 0.01em;
  margin: 0;
  font-weight: 400;
  color: var(--heading);
}

.text-xl {
  font-size: clamp(4rem, 14vw, 12rem);
  letter-spacing: -0.01em;
}
.text-lg {
  font-size: clamp(3rem, 7vw, 6rem);
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}
.text-md {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
}
.eyebrow {
  letter-spacing: 3px;
  display: inline-block;
  margin-bottom: 1rem;
}
.copper {
  color: var(--accent);
}

/* --- i18n --- */
.i18n-en {
  display: none;
}
html[data-lang="en"] .i18n-en {
  display: inline;
}
html[data-lang="en"] .i18n-nl {
  display: none;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s;
}
img,
video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: absolute;
  top: -80px;
  left: 1.5rem;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 1rem 1.5rem;
  z-index: 100001;
  font-family: "Bebas Neue";
  letter-spacing: 1px;
  transition: top 0.3s var(--ease-out);
}
.skip-link:focus {
  top: 1.5rem;
}

/* --- THEME TOGGLE --- */
.theme-toggle {
  cursor: pointer;
  font-family: "Bebas Neue", sans-serif;
  font-size: 1rem;
  color: var(--heading);
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  backdrop-filter: blur(5px);
  transition: border-color 0.3s, color 0.3s, transform 0.3s var(--ease-out);
  padding: 0;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.theme-toggle .icon-moon {
  display: block;
}
.theme-toggle .icon-sun {
  display: none;
}
[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}
[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

/* --- KINETIC TYPE: line-mask reveal for section headings --- */
.reveal-line-wrap {
  display: block;
  overflow: hidden;
}
.reveal-line {
  display: block;
  will-change: transform;
}

/* --- KINETIC TYPE: "filling text" reveal ---
   A subtle, one-shot alternative to a continuous animation: a muted/hollow
   base layer is always present, and a solid accent-colored layer wipes in
   from the bottom when the element scrolls into view (toggled via the
   .is-filled class). Element must be empty except for a `data-text`
   attribute — both layers render from that via generated content, so
   there's no dependency on JS even rendering the text itself. */
.fill-text {
  position: relative;
  display: inline-block;
}
.fill-text::before {
  content: attr(data-text);
  color: var(--border-strong);
}
.fill-text::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: var(--accent);
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1s var(--ease-luxe);
}
.fill-text.is-filled::after {
  clip-path: inset(0 0 0 0);
}

/* --- NEO-BRUTALISM: hard offset shadow + thick border utility --- */
.btn-brutal {
  border-width: 2px !important;
  border-style: solid !important;
  box-shadow: 6px 6px 0 0 var(--accent);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out),
    background 0.3s, color 0.3s;
}
.btn-brutal:hover,
.btn-brutal:focus-visible {
  transform: translate(-3px, -3px);
  box-shadow: 9px 9px 0 0 var(--accent);
}
.btn-brutal:active {
  transform: translate(0, 0);
  box-shadow: 2px 2px 0 0 var(--accent);
}

/* --- ORGANIC SHAPES: soft blurred accent blob, SVG wave divider --- */
.organic-blob {
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  filter: blur(180px);
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}

.section-divider {
  display: block;
  width: 100%;
  line-height: 0;
  position: relative;
  z-index: 1;
}
.section-divider svg {
  width: 100%;
  height: 60px;
  display: block;
}
.section-divider path {
  fill: var(--bg);
}
.section-divider.flip {
  transform: rotate(180deg);
}

/* --- CINEMATIC SCROLL-THROUGH ---
   Applied to whole <section>s: a scroll-scrubbed scale/opacity (driven
   from JS, see initSceneScroll() in site.js) makes each section grow in
   as it enters the viewport and shrink/fade as it's scrolled past —
   deliberately native-scroll-driven (no pinning, no scroll-jacking), so
   normal wheel/trackpad/touch/keyboard scrolling is never touched and no
   section risks clipping its own content (unlike a pinned/fixed-height
   approach, this can't hide a paragraph or a form that runs long). */
.scene {
  transform-origin: center center;
}

/* --- REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 1024px) {
  .cursor-dot,
  .cursor-circle {
    display: none !important;
  }
  body,
  a,
  button {
    cursor: auto !important;
  }
}
