/* ============================================================
   BASE - reset, document, typography, RTL foundations
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: clamp(16px, 0.35vw + 14.6px, 18.5px);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  background: var(--c-midnight);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--f-sans);
  font-weight: 400;
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--t-1);
  background-color: var(--bg);
  transition: background-color 1.6s var(--e-in-out);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
}

/* Fine grain across the whole journey */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--grain);
  opacity: 0.5;
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: 1;
}

/* Faint lattice, floating very slowly behind everything */
.atmo {
  position: fixed;
  inset: -20vh 0;
  background-image: var(--pattern-lattice);
  background-size: 140px 140px;
  opacity: var(--orn-faint);
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, #000 20%, transparent 100%);
  will-change: transform;
}

main { position: relative; z-index: 2; }

img, svg { display: block; max-width: 100%; }
svg { overflow: visible; }

h1, h2, h3, p, dl, dd, dt, figure, blockquote, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

::selection { background: rgba(200, 167, 93, 0.35); color: #fff8e8; }

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

/* --- Type roles --- */
.t-display {
  font-family: var(--f-display);
  font-weight: 400;
  line-height: var(--lh-display);
  padding-block: 0.15em;
}
.t-serif { font-family: var(--f-serif); }
.t-label {
  font-family: var(--f-sans);
  font-weight: 500;
  font-size: var(--fs-sm);
  color: var(--c-gold);
}

/* Section headings share one voice */
.heading {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: var(--fs-xl);
  line-height: var(--lh-display);
  color: var(--c-gold-light);
  padding-block: 0.1em;
}

/* Quotation voice */
.quote {
  font-family: var(--f-serif);
  font-weight: 400;
  line-height: 2;
  color: var(--t-1);
}

/* --- Layout primitives --- */
.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}
.measure { max-width: var(--measure); }
.measure-wide { max-width: var(--measure-wide); }

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

/* --- Scrollbar (WebKit) - quiet and warm --- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #0a0d18; }
::-webkit-scrollbar-thumb { background: #2b3050; border-radius: 10px; border: 2px solid #0a0d18; }
::-webkit-scrollbar-thumb:hover { background: #4a4f6e; }

@media (max-width: 767px) {
  :root { --lh-body: 1.95; }
}
