/*
  Zohar Kalev — Design System
  Colors & Type tokens (v2.0 · 05/2026 · zoharkalev.com palette only)

  4 brand colors only. No secondary blues, no poster surfaces.
  Use --alabaster as background, --black for text, --hunyadi sparingly
  (one accent band per page), --imperial only as a thin accent line.
*/

/* ---------- WEBFONTS ---------- */
@font-face {
  font-family: "Sapir Classic";
  src: url("./fonts/sapir-classic-light-fm.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Masada Mono";
  src: url("./fonts/MasadaMono-Demi.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Hebrew body fallback — SUBSTITUTION, please confirm. */
@import url("https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;700&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600&display=swap");

/* ---------- TOKENS ---------- */
:root {
  /* Brand colors — zoharkalev.com */
  --alabaster:   #F6F5F1;   /* broken white — cool paper, near-white, neutral */
  --hunyadi:     #F1BA66;   /* warm accent — Eva Bloom only */
  --imperial:    #DD3823;   /* red — Eva Bloom only, NEVER on ZK pages */
  --black:       #000000;
  --zk-accent:   #000000;   /* ZK pages use BLACK for accent — no red */

  /* Tonal extensions (alpha-derived, do not invent new hues) */
  --black-80:    rgba(0,0,0,.80);
  --black-60:    rgba(0,0,0,.60);
  --black-40:    rgba(0,0,0,.40);
  --black-12:    rgba(0,0,0,.12);
  --alabaster-80: rgba(235,231,216,.80);

  /* Semantic surface/text mapping */
  --bg:          var(--alabaster);
  --bg-elevated: #F5F2E6;
  --bg-inverse:  var(--black);

  --fg:          var(--black);       /* primary text */
  --fg-muted:    var(--black-60);
  --fg-subtle:   var(--black-40);
  --fg-inverse:  var(--alabaster);

  --accent:      var(--zk-accent); /* DEFAULT — ZK pages get black accent. Eva Bloom pages override to --imperial. */
  --accent-warm: var(--hunyadi);

  --rule:        var(--black-12);
  --line-strong: var(--black);

  /* Type families */
  --font-display: "Sapir Classic", "Cormorant Garamond", "David Libre", "Times New Roman", serif;
  --font-mono:    "Masada Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
  --font-body:    "Heebo", "Sapir Classic", "Helvetica Neue", system-ui, sans-serif;

  /* Type scale (1.250 — major third) */
  --text-7xl: 96px;
  --text-6xl: 72px;
  --text-5xl: 56px;
  --text-4xl: 44px;
  --text-3xl: 34px;
  --text-2xl: 26px;
  --text-xl:  20px;
  --text-base: 16px;
  --text-sm:  14px;
  --text-xs:  12px;

  /* Line heights */
  --leading-display: 0.95;
  --leading-tight:   1.10;
  --leading-snug:    1.25;
  --leading-normal:  1.50;
  --leading-loose:   1.70;

  /* Letter spacing */
  --track-display: -0.02em;   /* tight display */
  --track-body:     0em;
  --track-mono:     0.02em;   /* slight track for the mono caps */
  --track-eyebrow:  0.18em;   /* widely-spaced labels */

  /* Spacing — 8pt */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-6:  24px;
  --space-8:  32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;
  --space-32: 128px;

  /* Radii — the brand is mostly sharp */
  --radius-0:   0px;
  --radius-pill: 9999px;
  --radius-1:   2px;   /* very rare */

  /* Borders */
  --hairline: 1px solid var(--line-strong);
  --hairline-soft: 1px solid var(--rule);
  --rule-heavy: 1.5px solid var(--line-strong);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 200ms;
  --dur-base: 400ms;
  --dur-slow: 600ms;
}

/* Inverse mode utility — for dark posters / dark sections */
.surface-dark,
[data-surface="dark"] {
  --bg: var(--black);
  --bg-elevated: #0E0E0E;
  --fg: var(--alabaster);
  --fg-muted: rgba(235,231,216,.70);
  --fg-subtle: rgba(235,231,216,.45);
  --rule: rgba(235,231,216,.18);
  --line-strong: var(--alabaster);
  background: var(--bg);
  color: var(--fg);
}

.surface-red    { --bg: var(--imperial); --fg: var(--alabaster); --line-strong: var(--alabaster); background: var(--bg); color: var(--fg); }
.surface-yellow { --bg: var(--hunyadi);  --fg: var(--black);     background: var(--bg); color: var(--fg); }

/* ---------- BASE ELEMENT STYLES ---------- */
html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: var(--track-display);
  line-height: var(--leading-display);
  text-wrap: balance;
  margin: 0 0 var(--space-4);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); line-height: var(--leading-tight); }
h4 { font-size: var(--text-2xl); line-height: var(--leading-tight); }

.display { font-size: var(--text-6xl); }
.display-hero { font-family: var(--font-display); font-weight: 300; font-size: var(--text-7xl); line-height: var(--leading-display); letter-spacing: var(--track-display); }

p {
  margin: 0 0 var(--space-4);
  text-wrap: pretty;
  max-width: 62ch;
}

.lead { font-size: var(--text-xl); line-height: var(--leading-snug); }
.body { font-size: var(--text-base); line-height: var(--leading-normal); }
.caption { font-size: var(--text-sm); color: var(--fg-muted); }

/* Eyebrow / mono caption — small label set in the geometric mono */
.eyebrow,
.mono {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
}

.mono-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-feature-settings: "tnum" 1;
}

/* Hebrew running text */
[lang="he"], .rtl {
  direction: rtl;
  text-align: right;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: color var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
a:hover { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

hr {
  border: 0;
  border-top: var(--hairline);
  margin: var(--space-12) 0;
}

::selection { background: var(--imperial); color: var(--alabaster); }

/* Paper texture overlay — apply to .poster / .paper containers */
.paper {
  position: relative;
  isolation: isolate;
}
.paper::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: multiply;
  opacity: .08;
  background-image:
    radial-gradient(circle at 25% 30%, rgba(0,0,0,.20) 0, transparent 60%),
    radial-gradient(circle at 75% 70%, rgba(0,0,0,.18) 0, transparent 55%),
    repeating-linear-gradient(115deg, rgba(0,0,0,.12) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(65deg,  rgba(0,0,0,.08) 0 1px, transparent 1px 9px);
}

/* Utility: trim-line typography that bleeds */
.bleed-left  { margin-left:  calc(var(--space-12) * -1); }
.bleed-right { margin-right: calc(var(--space-12) * -1); }
