@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=Cinzel:wght@400;500;600&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root {
  /* Colour palette */
  --color-furnace-black:  #0e0b08;
  --color-vellum-cream:   #f0e6c8;
  --color-vellum-dark:    #d9c99a;
  --color-cinnabar-red:   #8b1a1a;
  --color-cinnabar-light: #b32020;
  --color-vitriol-green:  #3a5a40;
  --color-sulphur-gold:   #c9a227;
  --color-sulphur-light:  #e8c15a;
  --color-silver:         #b8bcc2;
  --color-azure:          #1a3a5c;
  --color-azure-light:    #2a5a8c;

  /* Semantic aliases */
  --color-bg:             var(--color-furnace-black);
  --color-bg-surface:     #1a1510;
  --color-bg-card:        #221c14;
  --color-text-primary:   var(--color-vellum-cream);
  --color-text-secondary: var(--color-vellum-dark);
  --color-text-muted:     #8a7a60;
  --color-accent:         var(--color-sulphur-gold);
  --color-accent-hover:   var(--color-sulphur-light);
  --color-danger:         var(--color-cinnabar-red);
  --color-border:         rgba(201, 162, 39, 0.25);
  --color-border-strong:  rgba(201, 162, 39, 0.55);

  /* Typography */
  --font-heading:   'IM Fell English', 'Palatino Linotype', Georgia, serif;
  --font-body:      'Cormorant Garamond', 'Palatino Linotype', Georgia, serif;
  --font-label:     'Cinzel', 'Trajan Pro', 'Times New Roman', serif;

  /* Type scale (fluid, clamped) */
  --text-xs:   clamp(0.70rem, 0.65rem + 0.25vw, 0.80rem);
  --text-sm:   clamp(0.85rem, 0.80rem + 0.25vw, 0.95rem);
  --text-base: clamp(1.05rem, 1.00rem + 0.25vw, 1.20rem);
  --text-md:   clamp(1.20rem, 1.10rem + 0.50vw, 1.40rem);
  --text-lg:   clamp(1.40rem, 1.20rem + 1.00vw, 1.80rem);
  --text-xl:   clamp(1.80rem, 1.50rem + 1.50vw, 2.50rem);
  --text-2xl:  clamp(2.40rem, 1.80rem + 3.00vw, 4.00rem);
  --text-3xl:  clamp(3.20rem, 2.40rem + 4.00vw, 5.50rem);

  /* Spacing scale — 8pt base grid */
  --space-1:  8px;
  --space-2:  16px;
  --space-3:  24px;
  --space-4:  32px;
  --space-5:  40px;
  --space-6:  48px;
  --space-8:  64px;
  --space-12: 96px;
  --space-16: 128px;

  /* Border radius */
  --radius-sm:   2px;
  --radius-md:   4px;
  --radius-lg:   8px;
  --radius-xl:   16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md:   0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg:   0 8px 32px rgba(0, 0, 0, 0.7);
  --shadow-gold: 0 0 20px rgba(201, 162, 39, 0.25);
  --shadow-glow: 0 0 40px rgba(201, 162, 39, 0.40);

  /* Z-index layers */
  --z-base:    0;
  --z-raised:  10;
  --z-overlay: 100;
  --z-modal:   200;
  --z-nav:     300;
  --z-tooltip: 400;

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   300ms ease;
  --transition-slow:   600ms ease;
  --transition-crawl: 1200ms ease;

  /* Layout */
  --container-max: 1200px;
  --container-wide: 1440px;
  --nav-height: 72px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.75;
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--color-accent-hover);
}

ul, ol {
  padding-left: var(--space-3);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p { margin-bottom: var(--space-2); }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; color: var(--color-vellum-cream); }
em { font-style: italic; }

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.container--wide {
  max-width: var(--container-wide);
}

.container--narrow {
  max-width: 760px;
}

.section {
  padding-block: var(--space-12);
}

.section--sm {
  padding-block: var(--space-6);
}

.section--lg {
  padding-block: var(--space-16);
}

.section--surface {
  background: var(--color-bg-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.page-header {
  padding-top: calc(var(--nav-height) + var(--space-8));
  padding-bottom: var(--space-8);
  text-align: center;
}

.page-header__eyebrow {
  font-family: var(--font-label);
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.page-header__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
}

.page-header__subtitle {
  font-size: var(--text-md);
  font-style: italic;
  color: var(--color-text-secondary);
  max-width: 640px;
  margin-inline: auto;
}

.content-prose {
  font-size: var(--text-base);
  line-height: 1.85;
  color: var(--color-text-secondary);
  max-width: 72ch;
}

.content-prose h2,
.content-prose h3,
.content-prose h4 {
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
}

.content-prose p {
  margin-bottom: var(--space-3);
}

.content-prose ul,
.content-prose ol {
  margin-bottom: var(--space-3);
}

.content-prose li {
  margin-bottom: var(--space-1);
}

/* ============================================================
   INLINE / TEXT STYLES
   ============================================================ */

.alchemical-term {
  font-variant: small-caps;
  color: var(--color-sulphur-gold);
  letter-spacing: 0.08em;
  font-weight: 500;
}

.latin {
  font-style: italic;
  opacity: 0.80;
  font-family: var(--font-body);
}

blockquote.scripture {
  border-left: 3px solid var(--color-cinnabar-red);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0;
  font-style: italic;
  font-family: var(--font-body);
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  background: rgba(139, 26, 26, 0.06);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

blockquote.scripture cite {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-style: normal;
  font-family: var(--font-label);
  letter-spacing: 0.05em;
  color: var(--color-cinnabar-light);
  opacity: 0.85;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-right   { text-align: right; }

.text-gold    { color: var(--color-sulphur-gold); }
.text-silver  { color: var(--color-silver); }
.text-red     { color: var(--color-cinnabar-red); }
.text-muted   { color: var(--color-text-muted); }

.font-heading { font-family: var(--font-heading); }
.font-body    { font-family: var(--font-body); }
.font-label   { font-family: var(--font-label); }

.content-prose--full { max-width: 100%; }

.section-heading    { font-family: var(--font-heading); font-size: var(--text-xl); margin-bottom: var(--space-6); }
.section-heading--sm { margin-bottom: var(--space-4); }
.section-heading--xs { margin-bottom: var(--space-2); }

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

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col    { flex-direction: column; }
.gap-1       { gap: var(--space-1); }
.gap-2       { gap: var(--space-2); }
.gap-3       { gap: var(--space-3); }
.gap-4       { gap: var(--space-4); }
.gap-6       { gap: var(--space-6); }

.grid        { display: grid; }
.grid-2      { grid-template-columns: repeat(2, 1fr); }
.grid-3      { grid-template-columns: repeat(3, 1fr); }
.grid-4      { grid-template-columns: repeat(4, 1fr); }

.w-full      { width: 100%; }
.h-full      { height: 100%; }

.sr-only     { @extend .visually-hidden; }

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  color: var(--color-border-strong);
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.divider__glyph {
  font-family: var(--font-label);
  font-size: var(--text-md);
  color: var(--color-sulphur-gold);
  opacity: 0.7;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .container {
    padding-inline: var(--space-2);
  }
  .section {
    padding-block: var(--space-8);
  }
}

@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Skip navigation link (keyboard accessibility) ── */
.skip-link {
  position: absolute;
  top: -56px;
  left: var(--space-4);
  background: var(--color-gold);
  color: #000;
  font-family: var(--font-label);
  font-size: var(--text-sm);
  letter-spacing: 0.06em;
  padding: var(--space-2) var(--space-5);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 9999;
  text-decoration: none;
  transition: top 0.15s ease;
  white-space: nowrap;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid #000;
  outline-offset: 0;
}
