/* ============================================================
   LUMIÈRE — Design system
   Display: Instrument Serif · UI/Body: Hanken Grotesk · Code: JetBrains Mono
   ============================================================ */

:root {
  /* Accent — violet/indigo signature (overridable by accent switcher) */
  --accent-h: 268;
  --accent: oklch(0.68 0.17 var(--accent-h));
  --accent-soft: oklch(0.72 0.15 var(--accent-h));
  --accent-deep: oklch(0.58 0.18 var(--accent-h));
  --accent-rgb: 139 116 255;          /* for rgba glows; updated by JS per accent */
  --glow: color-mix(in oklch, var(--accent) 60%, transparent);

  /* Prism spectrum hints (used only in the hero graphic) */
  --spec-1: oklch(0.72 0.16 250);     /* blue   */
  --spec-2: oklch(0.70 0.17 285);     /* violet */
  --spec-3: oklch(0.80 0.11 95);      /* gold   */

  /* Type */
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Fluid type scale */
  --fs-display: clamp(2.9rem, 1.6rem + 3.4vw, 4.6rem);
  --fs-h1: clamp(2.4rem, 1.4rem + 3.6vw, 4.2rem);
  --fs-h2: clamp(1.9rem, 1.3rem + 2.2vw, 3rem);
  --fs-h3: clamp(1.3rem, 1.05rem + 0.9vw, 1.7rem);
  --fs-lead: clamp(1.1rem, 0.98rem + 0.5vw, 1.4rem);
  --fs-body: 1.0625rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.75rem;

  /* Spacing & shape */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 30px;
  --section-y: clamp(5rem, 3rem + 8vw, 9rem);
  --gutter: clamp(1.25rem, 0.5rem + 3vw, 4rem);
  --maxw: 1240px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --speed: 1; /* scaled to 0 by reduced motion */
}

/* ---------- Dark (primary showcase) ---------- */
:root,
[data-theme="dark"] {
  --bg: oklch(0.155 0.012 274);
  --bg-grad-a: oklch(0.18 0.02 280);
  --bg-grad-b: oklch(0.14 0.012 270);
  --surface-1: oklch(0.19 0.014 274);
  --surface-2: oklch(0.215 0.016 274);
  --surface-glass: oklch(0.20 0.015 274 / 0.6);
  --line: oklch(1 0 0 / 0.09);
  --line-strong: oklch(1 0 0 / 0.16);
  --text: oklch(0.96 0.005 274);
  --text-dim: oklch(0.74 0.012 274);
  --text-faint: oklch(0.58 0.012 274);
  --code-bg: oklch(0.135 0.012 274);
  --shadow: 0 30px 80px -30px rgb(0 0 0 / 0.7);
  color-scheme: dark;
}

/* ---------- Light (ivory) ---------- */
[data-theme="light"] {
  --bg: oklch(0.975 0.006 90);
  --bg-grad-a: oklch(0.99 0.008 90);
  --bg-grad-b: oklch(0.955 0.008 280);
  --surface-1: oklch(1 0 0);
  --surface-2: oklch(0.985 0.004 90);
  --surface-glass: oklch(1 0 0 / 0.7);
  --line: oklch(0.2 0.02 280 / 0.12);
  --line-strong: oklch(0.2 0.02 280 / 0.22);
  --text: oklch(0.22 0.02 280);
  --text-dim: oklch(0.42 0.02 280);
  --text-faint: oklch(0.55 0.02 280);
  --accent: oklch(0.55 0.18 var(--accent-h));
  --accent-soft: oklch(0.6 0.16 var(--accent-h));
  --accent-deep: oklch(0.48 0.19 var(--accent-h));
  --code-bg: oklch(0.18 0.014 274);
  --shadow: 0 30px 70px -34px rgb(40 30 90 / 0.28);
  color-scheme: light;
}

/* ============================================================
   Reset / base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-gutter: stable; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}

/* Ambient page background: layered luminous wash */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 80% at 78% -10%, color-mix(in oklch, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(90% 60% at 10% 0%, color-mix(in oklch, var(--accent-deep) 14%, transparent), transparent 55%),
    linear-gradient(180deg, var(--bg-grad-a), var(--bg-grad-b) 60%, var(--bg));
  opacity: 0.9;
  transition: opacity 0.5s var(--ease);
}
/* Fine technical grid */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 25%, transparent 72%);
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 25%, transparent 72%);
  opacity: 0.5;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
::selection { background: color-mix(in oklch, var(--accent) 40%, transparent); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============================================================
   Layout helpers
   ============================================================ */
.wrap { width: min(100% - calc(var(--gutter) * 2), var(--maxw)); margin-inline: auto; }
.section { padding-block: var(--section-y); position: relative; }
.section + .section { padding-top: 0; }
.eyebrow {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-soft);
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
}
.section-head { max-width: 56ch; margin-bottom: clamp(2.5rem, 1.5rem + 3vw, 4rem); }
.section-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-h2);
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin-top: 1rem;
}
.section-head h2 em { font-style: italic; color: var(--accent-soft); }
.section-head p {
  color: var(--text-dim);
  font-size: var(--fs-lead);
  margin-top: 1.1rem;
  max-width: 52ch;
  text-wrap: pretty;
}
.muted { color: var(--text-dim); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  --pad-y: 0.85em;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: var(--pad-y) 1.4em;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1;
  transition: transform 0.4s var(--ease), background-color 0.3s var(--ease),
              box-shadow 0.4s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
  will-change: transform;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: var(--accent);
  color: oklch(0.16 0.02 280);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 60%, transparent),
              0 14px 40px -12px var(--glow);
  font-weight: 650;
}
[data-theme="light"] .btn-primary { color: oklch(0.99 0 0); }
.btn-primary:hover {
  box-shadow: 0 0 0 1px var(--accent), 0 22px 55px -14px var(--glow);
}
.btn-ghost {
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: color-mix(in oklch, var(--surface-1) 50%, transparent);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.btn-arrow { transition: transform 0.4s var(--ease); }
.btn:hover .btn-arrow { transform: translateX(3px); }
.btn-sm { padding: 0.6em 1em; font-size: var(--fs-xs); }

/* Reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
[data-reduce-motion="true"] .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }

/* Cards shared */
.card {
  position: relative;
  background: color-mix(in oklch, var(--surface-1) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color 0.4s var(--ease), transform 0.4s var(--ease), background-color 0.4s var(--ease);
}
.card:hover { border-color: color-mix(in oklch, var(--accent) 45%, var(--line)); transform: translateY(-3px); }
/* Luminous cursor sheen on cards */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%),
              color-mix(in oklch, var(--accent) 16%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.card:hover::before { opacity: 1; }
[data-reduce-motion="true"] .card:hover { transform: none; }

/* ============================================================
   Moving between pages
   ------------------------------------------------------------
   Choosing a language is a navigation: an article's title and
   prose are rows in the database, one set per language, and only
   the server can render them. A navigation does not have to look
   like one, though — this crossfades the outgoing document into
   the incoming one instead of blanking and repainting.

   Cross-document, so it costs no JavaScript and cannot leave the
   page in a state a plain load would not have produced. A browser
   without it simply navigates, which is what every browser does
   today.

   It applies to every same-origin navigation rather than only to
   the language links — one at-rule cannot be aimed at particular
   links — so it is short enough to read as a settle rather than
   as an effect.

   Opted into only when motion is welcome. `data-reduce-motion`
   is the site's own switch, which a visitor can set even where
   the operating system says nothing.
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

html[data-reduce-motion="true"] {
  view-transition-name: none;
}

::view-transition-old(root) { animation: lum-page-out 0.14s ease both; }
::view-transition-new(root) { animation: lum-page-in 0.18s ease both; }

@keyframes lum-page-out { to { opacity: 0; } }
@keyframes lum-page-in { from { opacity: 0; } }
