/* ===================================================================
   Ritus Candelabrum - core
   Design tokens, reset, typography, layout primitives.
   =================================================================== */

:root {
  /* --- surfaces: warm near-black, never neutral grey --- */
  --void-0: #06040820;
  --void-1: #0b0710;
  --void-2: #120c16;
  --void-3: #1a1220;

  /* --- ink --- */
  --ink-1: #fbf1e3;
  --ink-2: #c9b6a6;
  --ink-3: #8d7c71;
  --ink-4: #5f5450;

  /* --- solar accents --- */
  --gold: #e9a93f;
  --gold-hot: #ffd892;
  --gold-deep: #ac7126;
  --ember: #d0521c;
  --blood: #8e2e17;
  --violet: #6b4b9a;

  /* --- lines & glass --- */
  --line: rgba(233, 169, 63, 0.16);
  --line-soft: rgba(233, 169, 63, 0.08);
  --line-strong: rgba(233, 169, 63, 0.34);
  --glass: rgba(255, 233, 205, 0.032);
  --glass-2: rgba(255, 233, 205, 0.055);

  /* --- type --- */
  --font-display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --font-roman: 'Cinzel', 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;

  --fs-display: clamp(3rem, 8.4vw, 7rem);
  --fs-h1: clamp(2.1rem, 4.6vw, 3.9rem);
  --fs-h2: clamp(1.65rem, 3.1vw, 2.7rem);
  --fs-h3: clamp(1.2rem, 1.9vw, 1.55rem);
  --fs-body: clamp(1rem, 0.35vw + 0.92rem, 1.08rem);
  --fs-sm: 0.905rem;
  --fs-xs: 0.775rem;

  /* --- space --- */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;
  --s-9: 7rem;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 22px;
  --r-pill: 999px;

  --page: 1240px;
  --page-narrow: 880px;
  --nav-h: 68px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --glow-gold: 0 0 44px rgba(233, 169, 63, 0.22);
  --shadow-panel: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
}

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--void-1);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 350;
  line-height: 1.62;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

button { cursor: pointer; }

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

a:hover { color: var(--gold-hot); }

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

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

::selection {
  background: rgba(233, 169, 63, 0.28);
  color: var(--ink-1);
}

/* =================================================== ambient page light */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(180, 88, 26, 0.16), transparent 62%),
    radial-gradient(90% 60% at 12% 108%, rgba(107, 75, 154, 0.12), transparent 60%),
    var(--void-1);
}

/* film grain - keeps the flat darks from banding */
body::after {
  content: '';
  position: fixed;
  inset: -50%;
  z-index: 9;
  pointer-events: none;
  opacity: 0.055;
  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='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 6s steps(6) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-2%, 1%); }
  40% { transform: translate(1%, -2%); }
  60% { transform: translate(-1%, -1%); }
  80% { transform: translate(2%, 2%); }
}

/* =================================================== typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink-1);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.012em;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.25; }

em { font-style: italic; }

.display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  line-height: 0.94;
  letter-spacing: -0.02em;
  color: var(--ink-1);
}

.roman {
  font-family: var(--font-roman);
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

.eyebrow {
  font-family: var(--font-roman);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--gold);
  display: block;
}

.lede {
  font-size: clamp(1.06rem, 1.4vw, 1.22rem);
  color: var(--ink-2);
  line-height: 1.65;
  max-width: 62ch;
}

.muted { color: var(--ink-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }

.tabular { font-variant-numeric: tabular-nums; }

/* =================================================== layout */
.page {
  width: min(100% - 2.5rem, var(--page));
  margin-inline: auto;
}

.page--narrow { width: min(100% - 2.5rem, var(--page-narrow)); }

.section {
  padding-block: clamp(4rem, 9vw, 8.5rem);
  position: relative;
}

.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }

.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-6); }
.stack-sm > * + * { margin-top: var(--s-2); }

.row {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
  align-items: center;
}

.grid {
  display: grid;
  gap: var(--s-5);
}

.center { text-align: center; }
.center .lede { margin-inline: auto; }

/* section heading block */
.head {
  max-width: 66ch;
}

.head .eyebrow { margin-bottom: var(--s-3); }
.head h2 + .lede { margin-top: var(--s-4); }

.head--center {
  margin-inline: auto;
  text-align: center;
}

.head--center .lede { margin-inline: auto; }

/* ornamental rule */
.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  color: var(--gold-deep);
  font-size: 0.7rem;
  letter-spacing: 0.4em;
}

.rule::before,
.rule::after {
  content: '';
  height: 1px;
  flex: 1;
  max-width: 120px;
  background: linear-gradient(90deg, transparent, var(--line-strong));
}

.rule::after { background: linear-gradient(90deg, var(--line-strong), transparent); }

/* =================================================== reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

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

/* =================================================== a11y */
.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;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 1rem;
  z-index: 200;
  background: var(--gold);
  color: #1a0d02;
  padding: 0.6rem 1rem;
  border-radius: var(--r-sm);
  font-weight: 600;
  transition: top 0.2s var(--ease);
}

.skip-link:focus { top: 1rem; }
