/* ==========================================================================
   AMIR SAADATI — Base layer
   Design tokens carried over verbatim from v2 so the visual identity is
   byte-identical. Do not re-theme these values.
   ========================================================================== */

@font-face {
  font-family: Hasti;
  src: url("../../fonts/Hasti-Heavy.ttf?v=4") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url("../../fonts/Vazirmatn-Variable.woff2?v=33.003") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Palette — locked (brief §05) */
  --night-950: #020b11;
  --night-900: #04131d;
  --night-850: #071824;
  --night-800: #0b1a2e;
  --night-700: #132741;
  --cream: #f0ede4;
  --cream-muted: #b9b7b1;
  --amber: #e8a24a;
  --gold: #f4c26b;

  --line: rgba(240, 237, 228, 0.12);
  --line-soft: rgba(240, 237, 228, 0.075);

  --font-display: "Hasti", sans-serif;
  --font-body: "Vazirmatn", sans-serif;

  --container: 1240px;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.42s var(--ease-out);

  /* Vertical rhythm — tighter than v2 to cut page height (brief §08) */
  --chapter-y: clamp(4.5rem, 8vw, 7.5rem);
  --chapter-y-tight: clamp(3.25rem, 5.5vw, 5rem);
}

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  background: var(--night-950);
  /* Offset for the fixed nav when jumping to anchors */
  scroll-padding-top: 6rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--night-950);
  color: var(--cream);
  font-family: var(--font-body);
  font-feature-settings: "ss01", "ss02";
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body,
button,
input,
textarea,
select {
  font-family: var(--font-body);
}

img,
picture,
video {
  display: block;
  max-width: 100%;
}

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

h1,
h2,
h3,
h4,
p,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Display face is reserved for headings + statements only (brief §25) */
.font-hasti,
.h-display {
  font-family: var(--font-display) !important;
  font-weight: 400;
  font-synthesis: none;
  -webkit-text-stroke: 0 transparent;
  text-shadow: none;
  text-wrap: balance;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  inset-inline-end: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--cream);
  color: var(--night-950);
  font-size: 0.85rem;
  transform: translateY(-160%);
  transition: transform 0.18s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* Vazirmatn ss01/ss02 remap Latin digits to Persian glyphs, which is right for
   Persian copy but wrong for Latin labels like "AUGUST 2026" or "© 2026". */
.latin-nums {
  font-feature-settings: normal;
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-container {
  width: min(calc(100% - 2 * var(--gutter)), var(--container));
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   Glass surfaces — carried over verbatim (used by the locked Hero nav)
   -------------------------------------------------------------------------- */

.nav-glass {
  background: #021218ad;
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow:
    inset 0 1px #ffffff14,
    0 12px 40px #0003;
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
}

.liquid-glass {
  position: relative;
  overflow: hidden;
  border: none;
  background: #ffffff03;
  background-blend-mode: luminosity;
  box-shadow: inset 0 1px 1px #ffffff1a;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.liquid-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(
    180deg,
    #ffffff73,
    #ffffff26,
    #fff0,
    #fff0,
    #ffffff26,
    #ffffff73
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Shared editorial primitives
   -------------------------------------------------------------------------- */

.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.35rem;
  color: #f0ede475;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-eyebrow > span {
  display: block;
  width: 2.5rem;
  height: 1px;
  background: #f0ede44d;
}

.chapter {
  position: relative;
  padding-block: var(--chapter-y);
  overflow: clip;
}

.chapter--tight {
  padding-block: var(--chapter-y-tight);
}

/* Persian multi-line headings: controlled measure + generous leading (brief §25) */
.h-1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 1.2rem + 3vw, 3.35rem);
  line-height: 1.28;
  letter-spacing: -0.005em;
  text-wrap: balance;
  max-width: 20ch;
}

.h-2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.45rem, 1.05rem + 1.6vw, 2.1rem);
  line-height: 1.35;
  text-wrap: balance;
  max-width: 24ch;
}

.lead {
  font-size: clamp(0.98rem, 0.94rem + 0.22vw, 1.1rem);
  line-height: 2;
  color: #f0ede4cc;
  max-width: 58ch;
  text-wrap: pretty;
}

.body-text {
  font-size: 0.96rem;
  line-height: 1.95;
  color: #f0ede4a6;
  max-width: 62ch;
  text-wrap: pretty;
}

.meta {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f0ede47a;
}

/* --------------------------------------------------------------------------
   Custom cursor — desktop only (brief §22). Never rendered on touch devices.
   -------------------------------------------------------------------------- */

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  will-change: transform;
}

.cursor.is-visible {
  opacity: 1;
}

.cursor::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 999px;
  background: var(--gold);
  transition:
    width 0.45s var(--ease-out),
    height 0.45s var(--ease-out),
    margin 0.45s var(--ease-out),
    background-color 0.45s var(--ease-out);
}

.cursor.is-link::before {
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  background: rgba(232, 162, 74, 0.28);
}

.cursor.is-active::before {
  width: 78px;
  height: 78px;
  margin: -39px 0 0 -39px;
  background: rgba(232, 162, 74, 0.92);
}

.cursor__label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--night-950);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}

.cursor.is-active .cursor__label {
  opacity: 1;
}

/* Hide the native pointer only while the custom one is live */
@media (hover: hover) and (pointer: fine) {
  body.has-cursor,
  body.has-cursor a,
  body.has-cursor button,
  body.has-cursor [data-cursor] {
    cursor: none;
  }
  body.has-cursor input,
  body.has-cursor textarea {
    cursor: text;
  }
}

@media (hover: none), (pointer: coarse) {
  .cursor {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion (brief §28)
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .js [data-reveal],
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
  .js [data-reveal-mask] .reveal-media {
    clip-path: none !important;
  }
  .cursor {
    display: none !important;
  }
}

/* ==========================================================================
   PRELOADER — logo fade, no spinner. Self-removes; JS-off never shows it.
   ========================================================================== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--night-950);
  opacity: 1;
  transition: opacity .6s var(--ease-out), visibility .6s var(--ease-out);
}
html.is-loading .preloader { display: flex; }
.preloader__logo {
  width: clamp(64px, 9vw, 88px);
  height: auto;
  opacity: .25;
  animation: preloaderBreathe 1.7s var(--ease-out) infinite;
}
.preloader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
@keyframes preloaderBreathe {
  0%, 100% { opacity: .22; }
  50%      { opacity: .85; }
}
/* Keep the page from scrolling behind the loader. */
html.is-loading, html.is-loading body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .preloader { display: none !important; }
  .preloader__logo { animation: none; }
}
