/* =============================================================================
   PITLINE — reset, fonts, typography, shared primitives
============================================================================= */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn[wght].woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/Archivo[wdth,wght].woff2") format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: 6rem;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-fa);
  font-size: var(--step-0);
  line-height: 1.75;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg, video { display: block; max-width: 100%; }
/* sprite symbols carry no fill of their own, so tie them to colour */
svg { fill: currentColor; }
img { height: auto; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.015em;
  text-wrap: balance;
}
h1 { font-size: var(--step-5); font-weight: 900; line-height: 1.02; letter-spacing: -.032em; }
h2 { font-size: var(--step-4); font-weight: 900; line-height: 1.04; letter-spacing: -.032em; }
h3 { font-size: var(--step-2); }
p  { margin: 0; text-wrap: pretty; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
/* figure carries a UA margin of 1em 40px, which insets every tile and quote
   card inside its grid track */
figure, figcaption, blockquote, dl, dd { margin: 0; }

::selection { background: var(--accent); color: var(--accent-ink); }

:where(a, button, [tabindex], input, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---- shell ---------------------------------------------------------------
   Every section body sits inside .shell. Nothing is centred by default.      */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section); position: relative; }

/* ---- the one machined-corner shape used across the page ------------------ */
.notch {
  clip-path: polygon(
    0 0,
    calc(100% - var(--notch)) 0,
    100% var(--notch),
    100% 100%,
    var(--notch) 100%,
    0 calc(100% - var(--notch))
  );
}

/* ---- type primitives ----------------------------------------------------- */
.lede {
  font-size: var(--step-1);
  line-height: 1.7;
  color: var(--fg-2);
  max-width: 46ch;
  font-weight: 400;
}
.body { color: var(--fg-2); max-width: 62ch; }

/* Section intro block. Sized in rem, not ch: a ch cap on the wrapper resolves
   against the wrapper's 1rem font and strangles the heading inside it. */
.sec-head { max-width: min(100%, 44rem); }
.sec-head--narrow { max-width: min(100%, 34rem); }

/* Persian is a joined script: wide tracking and small-caps do not apply, so the
   eyebrow earns its emphasis from weight and colour instead. */
.eyebrow {
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--accent-text);
  display: block;
  margin-block-end: 1rem;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 2px;
  margin-inline-end: .6rem;
  vertical-align: .28em;
  background: var(--accent);
}

/* Latin technical figures: condensed, tabular, never mixed into Persian prose */
.figure {
  font-family: var(--font-la);
  font-stretch: 74%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---- buttons -------------------------------------------------------------
   Square like everything else, with the same notch at a smaller radius.      */
.btn {
  --notch: var(--notch-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  white-space: nowrap;
  padding: .95rem 1.7rem;
  font-weight: 700;
  font-size: var(--step--1);
  letter-spacing: -.005em;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease),
              color var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease),
              transform var(--dur-1) var(--ease);
  clip-path: polygon(
    0 0, calc(100% - var(--notch)) 0, 100% var(--notch),
    100% 100%, var(--notch) 100%, 0 calc(100% - var(--notch))
  );
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn svg { width: 1em; height: 1em; flex: none; }

.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 84%, var(--fg)); }

.btn--ghost {
  background: transparent;
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--line-2);
  clip-path: none;
}
.btn--ghost:hover { box-shadow: inset 0 0 0 1px var(--line-3); background: var(--bg-2); }

.btn--sm { padding: .62rem 1.15rem; font-size: var(--step--2); }

/* ---- grain: one fixed, non-scrolling, pointer-transparent layer ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: .32;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}
:root[data-theme="light"] .grain { opacity: .2; mix-blend-mode: multiply; }

/* ---- scroll reveal (IntersectionObserver adds .is-in) -------------------- */
@media (prefers-reduced-motion: no-preference) {
  [data-reveal] {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity var(--dur-3) var(--ease), transform var(--dur-3) var(--ease);
    transition-delay: var(--reveal-delay, 0ms);
  }
  [data-reveal].is-in { opacity: 1; transform: none; }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute;
  inset-block-start: -100%;
  inset-inline-start: var(--gutter);
  z-index: var(--z-menu);
  background: var(--accent);
  color: var(--accent-ink);
  padding: .75rem 1.25rem;
  font-weight: 700;
}
.skip-link:focus { inset-block-start: .75rem; }
