/* The Persian Gal — design tokens.
   Authoritative values live in raha-runs/runs/v1-design/01_design_spec.md §4.
   Keep this file free of component rules: it is the vocabulary, not the grammar. */

:root {
  /* Ground — ink gallery */
  --ink-000: #06060a;
  --ink-050: #0c0c12;
  --ink-100: #14141c;
  --ink-200: #1e1e28;

  /* Ground — paper letterpress */
  --paper-000: #f3efe7;
  --paper-050: #e9e3d8;
  --paper-100: #dcd4c5;

  /* Ink on paper */
  --letter-000: #14131a;
  --letter-100: #3a3742;
  --letter-200: #6e6a76;

  /* Text on ink */
  --ink-text-000: #edeff3;
  --ink-text-100: #a7aeba;
  --ink-text-200: #6f7684;

  /* Accents — single purpose, never mixed */
  --heat: #b4555f;
  --saffron: #c08a2e;

  /* Hairlines */
  --hair-ink: rgba(237, 239, 243, 0.1);
  --hair-ink-strong: rgba(237, 239, 243, 0.22);
  --hair-paper: rgba(20, 19, 26, 0.14);
  --hair-paper-strong: rgba(20, 19, 26, 0.3);

  /* Ornament ink — the girih watermark. These document the values baked into the
     generated tinted tiles (girih-ink.svg / girih-paper.svg); the files are the
     source of truth because only a baked tint survives being loaded through CSS. */
  --girih-ink: rgba(201, 169, 242, 0.06);
  --girih-paper: rgba(180, 85, 95, 0.09);

  /* Type */
  --font-display: "Bodoni Moda", "Didot", "Bodoni MT", "Times New Roman", serif;
  --font-ui: "Archivo", "Helvetica Neue", system-ui, sans-serif;
  --font-signature: "Amiri", "Noto Naskh Arabic", serif;

  --step-display: clamp(3.2rem, 9vw, 7.5rem);
  --step-h1: clamp(2.4rem, 6vw, 4rem);
  --step-h2: clamp(1.5rem, 2.6vw, 2.1rem);
  --step-lede: clamp(1.15rem, 2vw, 1.5rem);
  --step-body: 1.0625rem;
  --step-caption: 0.8125rem;
  --step-label: 0.6875rem;

  --track-display: -0.01em;
  --track-label: 0.18em;
  --track-numeral: 0.06em;

  /* Space + grid */
  --gutter: 24px;
  --max: 1440px;
  --pad-x: clamp(20px, 4vw, 64px);
  --band-y: clamp(72px, 12vh, 160px);
  --measure: 62ch;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --fast: 180ms;
  --mid: 320ms;
  --slow: 620ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--ink-000);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink-000);
  color: var(--ink-text-000);
  font-family: var(--font-ui);
  font-size: var(--step-body);
  line-height: 1.65;
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
}

/* Paper grounds are a body class so Book/Shop/colophon share one material. */
body.ground-paper {
  background: var(--paper-000);
  color: var(--letter-100);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.28em;
}

:focus-visible {
  outline: 2px solid var(--saffron);
  outline-offset: 3px;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

/* Type primitives ------------------------------------------------------- */

.micro {
  font-family: var(--font-ui);
  font-size: var(--step-label);
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--ink-text-100);
}

.ground-paper .micro {
  color: var(--letter-200);
}

.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: var(--track-display);
  line-height: 0.92;
  margin: 0;
}

.lede {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--step-lede);
  line-height: 1.32;
  margin: 0;
}

.caption {
  font-size: var(--step-caption);
  line-height: 1.55;
  color: var(--ink-text-100);
}

.ground-paper .caption {
  color: var(--letter-200);
}

.saffron {
  color: var(--saffron);
}

.heat-text {
  color: var(--heat);
}

.sig {
  font-family: var(--font-signature);
  font-size: 1.05rem;
  direction: rtl;
  unicode-bidi: isolate;
}

/* A hairline that sits inside a flow of text or between bands. */
.hair {
  border: 0;
  border-top: 1px solid var(--hair-ink);
  margin: 0;
}

.ground-paper .hair {
  border-top-color: var(--hair-paper);
}

/* Ornament layers ------------------------------------------------------- */

/* Girih linework as an architectural watermark — never a sticker.
   Three generated variants of one geometry: girih-ink.svg (violet, 6%) on the ink
   ground, girih-paper.svg (heat, 9%) on paper, and the neutral currentColor tile for
   inline use. The tint is baked into the file on purpose — an SVG loaded through
   background-image cannot inherit currentColor, so a neutral tile tints BLACK and
   disappears on ink. (A mask-image approach was tried and rejected: Chrome resolves
   the SVG mask case as luminance, so black strokes mask everything out.) */
.ornament-girih {
  position: relative;
  isolation: isolate;
}

.ornament-girih::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("/brand/girih-ink.svg");
  background-size: 96px 96px;
  background-repeat: repeat;
  pointer-events: none;
}

.ground-paper .ornament-girih::before {
  background-image: url("/brand/girih-paper.svg");
}

.ornament-grain::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("/brand/grain.png");
  background-size: 240px 240px;
  opacity: 0.5;
  mix-blend-mode: overlay;
  pointer-events: none;
}

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