:root {
  /* ── Surfaces ──────────────────────────────────────────────
     Warm paper rather than neutral white: this is a print-adjacent
     brand, and a cool grey makes skin tones read cold beside it. */
  --color-bg-primary: #FAF7F4;
  --color-bg-secondary: #F1E9E3;
  --color-bg-elevated: #FFFFFF;
  --color-bg-dark: #171310;

  --color-text-primary: #1C1917;
  --color-text-secondary: #6B625B;
  --color-text-muted: #6F665F;
  --color-text-light: #FFFFFF;

  /* One accent, used sparingly — links, focus, a single CTA. */
  --color-accent: #9E4750;
  --color-accent-hover: #833A42;
  --color-accent-soft: #F3E7E6;
  --color-highlight: #B08154;

  /* ── Material ──────────────────────────────────────────────
     The album is a physical object: paper, page edges, and the surface
     it lies on. Shared by css/book.css (the album) and css/gallery.css
     (the chapter pages), so it lives here rather than in either. */
  --paper: #FBF8F5;
  --paper-edge: #E7DCD1;
  --table: #D8CCC1;
  --board: #2A211C;
  /* Small type on the table or on an album board. --color-text-muted was
     tuned against paper and only reaches 3.56:1 here; this is 4.91:1. */
  --ink-quiet: #5A514A;

  /* Hairlines instead of hard outlines. */
  --color-line: rgba(28, 25, 23, 0.10);
  --color-line-strong: rgba(28, 25, 23, 0.18);
  --color-overlay: rgba(23, 19, 16, 0.42);

  /* ── Typography ─────────────────────────────────────────── */
  --font-family-hebrew: 'Heebo', system-ui, -apple-system, sans-serif;
  /* Frank Ruhl Libre, not Playfair. Playfair carries no Hebrew glyphs at all,
     so every Hebrew headline set in it silently fell back to the browser's
     default serif — measured: Hebrew in Playfair renders byte-identical in
     width to Hebrew in a font that does not exist. Frank Ruhl Libre is a
     Hebrew text serif (Yanek Iontef) and covers Latin too. */
  --font-family-editorial: 'Frank Ruhl Libre', 'Playfair Display', Georgia, serif;

  --font-size-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --font-size-sm: clamp(0.875rem, 0.8rem + 0.38vw, 1rem);
  --font-size-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
  --font-size-md: clamp(1.125rem, 1rem + 0.63vw, 1.25rem);
  --font-size-lg: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --font-size-xl: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
  --font-size-2xl: clamp(2rem, 1.6rem + 2vw, 3rem);
  --font-size-3xl: clamp(2.5rem, 1.8rem + 3.5vw, 4.25rem);
  --font-size-hero: clamp(3rem, 2rem + 5vw, 6rem);
  --font-size-display: clamp(3.25rem, 1.8rem + 7vw, 7.5rem);

  /* Hebrew is unicase and its letterforms rely on tight word shapes, so the
     Latin habit of wide-tracked small caps does not transfer. --tracking-label
     is the value for Hebrew labels; --tracking-widest stays for Latin-only
     ornaments such as the "PORTFOLIO 2026" edition mark. */
  --tracking-tight: -0.01em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;
  --tracking-label: 0.07em;
  --tracking-widest: 0.22em;

  /* Longest comfortable line for Hebrew body copy. */
  --measure: 60ch;
  --measure-tight: 46ch;

  /* ── Spacing ────────────────────────────────────────────── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
  --space-40: 10rem;

  /* Sections breathe: this single value sets the page's rhythm. */
  --section-padding: clamp(5rem, 3rem + 8vw, 9rem);

  /* ── Layout ─────────────────────────────────────────────── */
  --container-width: 1240px;
  --container-padding: clamp(1.25rem, 0.5rem + 3vw, 2.5rem);

  /* ── Borders & Shadows ──────────────────────────────────── */
  --radius-image: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-subtle: 0 1px 2px rgba(28, 25, 23, 0.04), 0 8px 24px rgba(28, 25, 23, 0.05);
  --shadow-medium: 0 2px 4px rgba(28, 25, 23, 0.04), 0 18px 48px rgba(28, 25, 23, 0.09);
  --shadow-lift: 0 30px 70px rgba(28, 25, 23, 0.16);

  /* ── Motion ─────────────────────────────────────────────── */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Dark mode ─────────────────────────────────────────────
   A first-class variant, not an inversion: the surfaces stay warm,
   the accent lifts so it keeps contrast against a dark ground, and
   the photographs — which carry the page — are left untouched. */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg-primary: #14110F;
    --color-bg-secondary: #1C1714;
    --color-bg-elevated: #221C18;
    --color-bg-dark: #0E0B09;

    --color-text-primary: #F3EEE9;
    --color-text-secondary: #A79D95;
    --color-text-muted: #9A9089;

    --color-accent: #DE9098;
    --color-accent-hover: #EEAAB1;
    --color-accent-soft: #2C2022;
    --color-highlight: #C79A6B;

    --paper: #1E1916;
    --paper-edge: #2C241E;
    --table: #100D0B;
    --board: #0B0908;
    --ink-quiet: #A79D95;

    --color-line: rgba(243, 238, 233, 0.12);
    --color-line-strong: rgba(243, 238, 233, 0.22);
    --color-overlay: rgba(6, 4, 3, 0.55);
  }
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-family-hebrew);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  line-height: 1.6;
  direction: rtl;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography Base */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-hebrew);
  font-weight: 300;
  line-height: 1.2;
  margin-bottom: var(--space-4);
}

.editorial-text {
  font-family: var(--font-family-editorial);
}

p {
  margin-bottom: var(--space-4);
}

a {
  color: inherit;
  text-decoration: none;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Focus states */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-highlight);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

/* Selection */
::selection {
  background-color: var(--color-accent-soft);
  color: var(--color-accent);
}

/* RTL Utilities */
.ms-auto { margin-inline-start: auto; }
.me-auto { margin-inline-end: auto; }
.ps-4 { padding-inline-start: var(--space-4); }
.pe-4 { padding-inline-end: var(--space-4); }
.text-start { text-align: start; }
.text-end { text-align: end; }
.text-center { text-align: center; }

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