/* ==========================================================================
   LKI-Architektur — design tokens (shared by website + admin)
   Palette derived from the project photography:
     timber   ≈ oklch(0.55 0.06 62°)  — chalets, larch, oak (most frequent)
     stone    ≈ oklch(0.50 0.005 70°) — granite plinths, plaster
     snow     ≈ oklch(0.98 0.004 75°) — backgrounds
   The accent hue/chroma come from content.settings.accent (set by JS).
   Every project carries its own hue (--t-h/--t-c) from its cover photo.
   ========================================================================== */
:root {
  --accent-h: 62;
  --accent-c: 0.075;
  --stone-h: 70;

  /* light (snow + timber) */
  --bg: oklch(0.985 0.004 var(--stone-h));
  --bg-tint: oklch(0.962 0.007 var(--stone-h));
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.954 0.008 var(--stone-h));
  --text: oklch(0.23 0.012 var(--stone-h));
  --text-2: oklch(0.45 0.014 var(--stone-h));
  --text-3: oklch(0.53 0.013 var(--stone-h));
  --hairline: oklch(0.3 0.02 var(--stone-h) / 0.14);
  --fill: oklch(0.55 0.012 var(--stone-h) / 0.13);
  --accent: oklch(0.7 calc(var(--accent-c) * 1.35) var(--accent-h));
  --accent-hover: oklch(0.745 calc(var(--accent-c) * 1.35) var(--accent-h));
  --accent-ink: oklch(0.47 calc(var(--accent-c) * 1.2) var(--accent-h));
  --accent-soft: oklch(0.7 var(--accent-c) var(--accent-h) / 0.17);
  --on-accent: oklch(0.2 0.025 var(--accent-h));
  --glass: oklch(0.985 0.004 var(--stone-h) / 0.74);
  --glass-strong: oklch(0.985 0.004 var(--stone-h) / 0.88);
  --glass-menu: oklch(0.985 0.004 var(--stone-h) / 0.96);
  --seg-thumb: oklch(1 0 0);
  --shadow-1: 0 1px 2px oklch(0.3 0.02 var(--stone-h) / 0.06), 0 6px 20px oklch(0.3 0.02 var(--stone-h) / 0.08);
  --shadow-2: 0 2px 8px oklch(0.3 0.02 var(--stone-h) / 0.08), 0 30px 80px oklch(0.25 0.02 var(--stone-h) / 0.2);
  --focus: oklch(0.56 0.17 255);
  --danger: oklch(0.53 0.19 27);
  --danger-soft: oklch(0.6 0.19 27 / 0.12);
  --success: oklch(0.52 0.12 150);
  --success-soft: oklch(0.6 0.12 150 / 0.14);
  --warn: oklch(0.6 0.13 75);
  --ink-l: 0.47;       /* lightness for text tinted with a project colour */
  --tint-bg-l: 0.91;   /* lightness for image placeholders tinted with a project colour */
  --scrim: oklch(0.15 0.01 var(--stone-h) / 0.46);

  /* layout */
  --nav-h: 52px;
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  /* full-width header + hero text: one gutter on both sides so the edges are symmetric */
  --page-gutter: clamp(20px, 4vw, 64px);
  --r-l: 28px;
  --r-m: 18px;
  --r-s: 12px;
  --section-pad: clamp(88px, 12vw, 168px);

  /* z-index scale */
  --z-nav: 50;
  --z-sheet: 80;
  --z-popover: 90;
  --z-lightbox: 100;
  --z-toast: 120;

  /* type & motion */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --ease-out: cubic-bezier(0.22, 0.8, 0.24, 1);

  color-scheme: light;
}

/* dark (charcoal timber) — set via html[data-theme], resolved from the user's choice or the system */
:root[data-theme="dark"] {
  --bg: oklch(0.155 0.006 var(--stone-h));
  --bg-tint: oklch(0.185 0.007 var(--stone-h));
  --surface: oklch(0.205 0.008 var(--stone-h));
  --surface-2: oklch(0.25 0.009 var(--stone-h));
  --text: oklch(0.955 0.005 var(--stone-h));
  --text-2: oklch(0.77 0.01 var(--stone-h));
  --text-3: oklch(0.68 0.01 var(--stone-h));
  --hairline: oklch(1 0 0 / 0.11);
  --fill: oklch(0.65 0.01 var(--stone-h) / 0.2);
  --accent: oklch(0.72 calc(var(--accent-c) * 1.35) var(--accent-h));
  --accent-hover: oklch(0.775 calc(var(--accent-c) * 1.35) var(--accent-h));
  --accent-ink: oklch(0.8 calc(var(--accent-c) * 1.25) var(--accent-h));
  --accent-soft: oklch(0.72 var(--accent-c) var(--accent-h) / 0.18);
  --glass: oklch(0.2 0.008 var(--stone-h) / 0.74);
  --glass-strong: oklch(0.2 0.008 var(--stone-h) / 0.88);
  --glass-menu: oklch(0.23 0.008 var(--stone-h) / 0.96);
  --seg-thumb: oklch(0.42 0.012 var(--stone-h));
  --shadow-1: 0 1px 2px oklch(0 0 0 / 0.5), 0 6px 20px oklch(0 0 0 / 0.35);
  --shadow-2: 0 2px 8px oklch(0 0 0 / 0.5), 0 30px 80px oklch(0 0 0 / 0.6);
  --focus: oklch(0.7 0.15 250);
  --danger: oklch(0.7 0.17 25);
  --danger-soft: oklch(0.6 0.19 27 / 0.2);
  --success: oklch(0.75 0.13 150);
  --success-soft: oklch(0.6 0.12 150 / 0.2);
  --ink-l: 0.8;
  --tint-bg-l: 0.28;
  --scrim: oklch(0 0 0 / 0.6);
  color-scheme: dark;
}

/* Elements tinted with their own photo colour */
.tint {
  --t-h: var(--accent-h);
  --t-c: var(--accent-c);
  --t-ink: oklch(var(--ink-l) calc(var(--t-c) * 1.2) var(--t-h));
  --t-soft: oklch(0.7 var(--t-c) var(--t-h) / 0.17);
  --t-bg: oklch(var(--tint-bg-l) calc(var(--t-c) * 0.5) var(--t-h));
  --t-glow: oklch(0.5 calc(var(--t-c) * 1.6) var(--t-h) / 0.42);
}

@media (prefers-contrast: more) {
  :root { --hairline: oklch(0.3 0.02 var(--stone-h) / 0.45); --text-2: oklch(0.35 0.014 var(--stone-h)); --text-3: oklch(0.38 0.013 var(--stone-h)); --ink-l: 0.4; }
  :root[data-theme="dark"] { --hairline: oklch(1 0 0 / 0.45); --text-2: oklch(0.88 0.01 var(--stone-h)); --text-3: oklch(0.84 0.01 var(--stone-h)); --ink-l: 0.86; }
}
