/* ============================================================
   VENE — BASE
   Fonts, reset, typographic primitives, shared idioms.
   ============================================================ */

@font-face {
  font-family: "Bodoni Moda";
  src: url("../assets/fonts/BodoniModa-VF.ttf") format("truetype-variations");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bodoni Moda";
  src: url("../assets/fonts/BodoniModa-Italic-VF.ttf") format("truetype-variations");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "GFS Didot";
  src: url("../assets/fonts/GFSDidot-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/Inter-VF.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html:focus-within { scroll-behavior: smooth; }
body {
  background: var(--vellum);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 450;  /* didone hairlines need help below display sizes */
  font-size: var(--text-base);
  line-height: var(--leading-prose);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
/* the page reads as one uneven sheet of vellum, not a flat fill; this sits
   behind the content, so it shows under the light folios and the dark folios
   (which paint their own backgrounds) cover it */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 85% at 12% -5%, rgba(201, 177, 135, 0.11), transparent 55%),
    radial-gradient(110% 90% at 93% 22%, rgba(165, 141, 99, 0.08), transparent 58%),
    radial-gradient(95% 80% at 62% 105%, rgba(201, 177, 135, 0.09), transparent 55%);
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--gold); color: var(--ink); }

/* ---------- Vellum grain (one fixed veil over everything) ---------- */
.grain {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.05;
}

/* ---------- First-load: a calm illuminated entrance ----------
   A gold initial draws itself onto warm vellum, a rule draws under it, the
   wordmark settles, and the whole sheet lifts away into the hero. It is driven
   entirely in CSS (so it clears itself even with no JS); main.js only removes
   the node afterwards. Hidden outright under reduced motion. */
.preload {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 41%, var(--vellum-bright) 0%, var(--vellum) 58%, var(--vellum-shade) 100%);
  animation: preload-out 600ms var(--ease-settle) 1300ms forwards;
}
.preload__mark { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; }
.preload__a { width: clamp(60px, 8.5vw, 88px); height: auto; overflow: visible; }
.preload__stroke {
  fill: none; stroke: var(--gold-deep); stroke-width: 4;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 440; stroke-dashoffset: 440;
  filter: drop-shadow(0 2px 9px rgba(196, 162, 74, 0.35));
  animation: preload-draw 920ms var(--ease-settle) 160ms forwards;
}
.preload__rule {
  width: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold) 82%, transparent);
  animation: preload-rule 540ms var(--ease-settle) 640ms forwards;
}
.preload__word {
  font-family: var(--serif); font-size: 1.1rem; letter-spacing: 0.02em;
  color: var(--ink-faded); opacity: 0;
  animation: preload-word 460ms var(--ease-settle) 840ms forwards;
}
.preload__dot { color: var(--gold); }
@keyframes preload-draw { to { stroke-dashoffset: 0; } }
@keyframes preload-rule { to { width: clamp(86px, 12vw, 132px); } }
@keyframes preload-word { to { opacity: 1; } }
@keyframes preload-out { to { opacity: 0; visibility: hidden; transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) { .preload { display: none; } }

/* ---------- Typographic primitives ---------- */
.label {  /* quiet sentence-case lines, in the eyebrow register — never tracked capitals */
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--text-sm);
  font-weight: 480;
  letter-spacing: 0.01em;
  color: var(--ink-faded);
}
.label--gold   { color: var(--gold-deep); }
.label--rubric { color: var(--madder); }

.folio-no {  /* "folio i" markers — quiet manuscript pagination */
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--ink-ghost);
  letter-spacing: 0.05em;
}

.display {
  font-family: var(--serif);
  font-weight: 460;
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
}
.display em { font-style: italic; font-weight: 420; }

.prose { max-width: var(--measure-prose); }
.prose p + p { margin-top: 1.2em; }
.prose .lead { font-size: var(--text-md); line-height: 1.45; }

/* ---------- Rules & ornaments ---------- */
.rule-gold {
  height: 1px; border: 0;
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold) 82%, transparent);
}
.rule-hair { height: 1px; border: 0; background: var(--ink); opacity: 0.12; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.6em;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 520;
  letter-spacing: 0.02em;
  padding: 0.95em 1.9em;
  border-radius: 2px;
  transition: background var(--t-small) var(--ease-drift),
              color var(--t-small) var(--ease-drift),
              border-color var(--t-small) var(--ease-drift),
              transform var(--t-small) var(--ease-settle),
              box-shadow var(--t-small) var(--ease-drift);
}
.btn--primary {
  background: var(--ink);
  color: var(--vellum-bright);
  border: 1px solid var(--ink);
}
.btn--primary:hover {
  background: var(--gold-deep);
  border-color: var(--gold-deep);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px -12px rgba(142, 115, 39, 0.55);
}
.btn--quiet {
  border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  color: var(--ink-soft);
  background: transparent;
}
.btn--quiet:hover { border-color: var(--gold-deep); color: var(--gold-deep); }
.btn--gold {
  background: linear-gradient(160deg, var(--gold-bright), var(--gold) 55%, var(--gold-deep));
  color: var(--night);
  border: 1px solid var(--gold-deep);
  font-weight: 600;
}
.btn--gold:hover { transform: translateY(-1px); box-shadow: 0 14px 34px -12px rgba(196, 162, 74, 0.7); }

/* ---------- Reveal system (JS adds .is-seen) ---------- */
.rv {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity var(--t-reveal) var(--ease-settle),
              transform var(--t-reveal) var(--ease-settle);
  transition-delay: var(--rv-delay, 0ms);
}
.rv.is-seen { opacity: 1; transform: none; }

.rv-line {  /* gold rules that draw themselves */
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--t-draw) var(--ease-settle);
  transition-delay: var(--rv-delay, 0ms);
}
.rv-line.is-seen { transform: scaleX(1); }

/* ---------- Layout helpers ---------- */
.wrap   { width: min(100% - 2 * var(--page-margin), var(--measure-wide)); margin-inline: auto; }
.center { text-align: center; }

/* ---------- Accessibility ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 3px; }

.skip-link {
  position: fixed; top: -100px; left: 16px; z-index: 100;
  background: var(--ink); color: var(--vellum); padding: 10px 18px;
  font-family: var(--sans); font-size: 14px; border-radius: 2px;
  transition: top 200ms var(--ease-settle);
}
.skip-link:focus { top: 16px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .rv, .rv-line { opacity: 1; transform: none; }
}
