/* ==========================================================================
   ILC Wellness — main.css
   Design tokens, base elements, typography, and layout primitives.
   Mobile-first. Wider-screen overrides live in responsive.css.
   See DESIGN-SYSTEM.md for usage rules.
   ========================================================================== */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */
@font-face {
  font-family: "Cormorant Garamond";
  src: url("/assets/fonts/cormorant-garamond-var.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("/assets/fonts/cormorant-garamond-var-italic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Brand palette */
  --ivory: #F7F4EE;
  --sand: #E7E0D6;
  --taupe: #B8AA9A;
  --espresso: #403831;
  --sage: #A5AD9A;
  --gold: #C2A477;

  /* Derived tones (all text tones pass WCAG AA on ivory; see DESIGN-SYSTEM.md) */
  --ink: var(--espresso);          /* 10.4:1 on ivory */
  --ink-muted: #6B5F54;            /* 5.6:1 on ivory, 4.7:1 on sand */
  --sage-ink: #5C6553;             /* 5.6:1 on ivory */
  --gold-ink: #7A6446;             /* 5.1:1 on ivory only, small labels */
  --espresso-deep: #342D27;
  --sand-soft: #EFEAE2;
  --line: rgba(64, 56, 49, 0.14);
  --line-strong: rgba(64, 56, 49, 0.28);
  --line-on-dark: rgba(247, 244, 238, 0.18);

  /* Typography */
  --font-serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --step--1: 0.8125rem;                              /* 13px  labels */
  --step-0: 1rem;                                    /* 16px  body (mobile) */
  --step-1: 1.125rem;                                /* 18px  lead */
  --step-2: clamp(1.5rem, 1.3rem + 0.9vw, 1.875rem); /* h4 / card titles */
  --step-3: clamp(1.875rem, 1.5rem + 1.6vw, 2.625rem); /* h3 */
  --step-4: clamp(2.25rem, 1.7rem + 2.6vw, 3.5rem);  /* h2 */
  --step-5: clamp(2.75rem, 1.9rem + 4.2vw, 5.25rem); /* h1 */

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;
  --section-y: clamp(4rem, 3rem + 5vw, 8rem);

  /* Layout */
  --container: 76rem;
  --container-narrow: 46rem;
  --gutter: clamp(1.25rem, 0.8rem + 2.4vw, 3rem);
  --header-h: 4.5rem;

  /* Shape & motion */
  --radius-sm: 4px;
  --radius: 10px;
  --radius-lg: 20px;
  --radius-arch: 999px 999px 0 0;
  --shadow-soft: 0 1px 2px rgba(52, 45, 39, 0.04), 0 12px 32px -12px rgba(52, 45, 39, 0.16);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 220ms;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  min-height: 100vh;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg, picture, video { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
p, li, h1, h2, h3, h4 { overflow-wrap: break-word; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
[hidden] { display: none !important; }

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--espresso);
  outline-offset: 3px;
  border-radius: 2px;
}
.on-dark :focus-visible,
.section--dark :focus-visible { outline-color: var(--ivory); }

/* ---------- Typography ---------- */
h1, h2, h3, .display {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: balance;
}
h1, .h1 { font-size: var(--step-5); font-weight: 400; }
h2, .h2 { font-size: var(--step-4); }
h3, .h3 { font-size: var(--step-3); line-height: 1.12; }
h4, .h4 {
  font-family: var(--font-serif);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.2;
}
h1 em, h2 em, h3 em, .display em {
  font-style: italic;
  font-weight: 400;
  color: var(--gold-ink);
}
.section--dark h1 em, .section--dark h2 em { color: var(--gold); }

p { max-width: 68ch; text-wrap: pretty; }
.lead {
  font-size: var(--step-1);
  line-height: 1.7;
  color: var(--ink-muted);
}
.muted { color: var(--ink-muted); }
.small { font-size: 0.875rem; }
strong { font-weight: 600; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--gold);
}
.eyebrow--plain::before { display: none; }

.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 2.2em; font-size: var(--step-3); }
.prose h3 { margin-top: 1.8em; font-size: var(--step-2); font-weight: 500; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li + li { margin-top: 0.4em; }
.prose a { color: var(--ink); text-decoration-color: var(--gold); }
.prose a:hover { text-decoration-thickness: 2px; }

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: calc(var(--container-narrow) + var(--gutter) * 2); }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * 0.6); }
.section--sand { background: var(--sand); }
.section--soft { background: var(--sand-soft); }
.section--dark {
  background: var(--espresso);
  color: var(--ivory);
}
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: var(--ivory); }
.section--dark .lead, .section--dark .muted { color: rgba(247, 244, 238, 0.78); }
.section--dark .eyebrow { color: rgba(247, 244, 238, 0.78); }

.section-head { display: grid; gap: var(--space-4); margin-bottom: var(--space-7); }
.section-head--center { text-align: center; justify-items: center; }
.section-head--center p { margin-inline: auto; }

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

.grid { display: grid; gap: var(--space-6); }

.rule { border: 0; border-top: 1px solid var(--line); }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--espresso);
  color: var(--ivory);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

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

main { display: block; }
::selection { background: var(--sand); color: var(--espresso); }
