/* =====================================================================
   DFEF — Base styles (reset + element defaults + utilities)
===================================================================== */

@import url('./tokens.css');

/* ---------- Modern reset (Andy Bell-inspired) ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}
@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;
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-500);
  line-height: var(--lh-relaxed);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01' on, 'cv11' on;
  overflow-x: hidden;
}

img, picture, video, svg {
  display: block;
  max-width: 100%;
  height: auto;
}
img { font-style: italic; background-repeat: no-repeat; background-size: cover; }

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
ul[role='list'], ol[role='list'] { list-style: none; padding: 0; }

a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 4px;
  transition: color var(--t-fast) var(--ease-out);
}
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

::selection { background: var(--c-midnight-800); color: var(--c-cream-100); }

/* ---------- Headings ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: var(--fw-regular);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text);
  text-wrap: balance;
}

h1, .h1 {
  font-size: clamp(var(--fs-1000), 5.6vw, var(--fs-1200));
  line-height: 1.05;
}
h2, .h2 {
  font-size: clamp(var(--fs-900), 4.2vw, var(--fs-1100));
  line-height: 1.1;
}
h3, .h3 {
  font-size: clamp(var(--fs-800), 2.6vw, var(--fs-900));
}
h4, .h4 { font-size: var(--fs-700); line-height: var(--lh-snug); }
h5, .h5 { font-size: var(--fs-600); line-height: var(--lh-snug); }
h6, .h6 { font-size: var(--fs-500); line-height: var(--lh-snug); }

p { text-wrap: pretty; }

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-100);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
  color: var(--accent-deep);
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}
.eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
}
.eyebrow--center { justify-content: center; }
.eyebrow--on-dark { color: var(--accent); }

.lede {
  font-size: clamp(var(--fs-600), 1.6vw, var(--fs-700));
  line-height: var(--lh-relaxed);
  color: var(--text-muted);
  max-width: 60ch;
}

small, .text-sm { font-size: var(--fs-200); }
.text-xs { font-size: var(--fs-100); }
.text-mute { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container-base);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide  { max-width: var(--container-wide); }
.container--narrow{ max-width: var(--container-narrow); }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }
.section--dark {
  background: var(--bg-inverted);
  color: var(--text-on-dark);
}
.section--dark h1, .section--dark h2, .section--dark h3,
.section--dark h4, .section--dark h5, .section--dark h6 { color: var(--text-on-dark); }
.section--cream-deep { background: var(--c-cream-100); }

.grid { display: grid; gap: var(--sp-6); }
.flex { display: flex; }
.flow > * + * { margin-block-start: var(--flow-space, 1em); }

/* ---------- Accessibility helpers ---------- */
.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;
}

.skip-link {
  position: absolute;
  top: -100px; left: 12px;
  background: var(--c-midnight-800);
  color: var(--c-cream-50);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  z-index: var(--z-toast);
  transition: top var(--t-base) var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 720ms var(--ease-out),
    transform 720ms var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal[data-delay="1"] { transition-delay: 80ms; }
.reveal[data-delay="2"] { transition-delay: 160ms; }
.reveal[data-delay="3"] { transition-delay: 240ms; }
.reveal[data-delay="4"] { transition-delay: 320ms; }
.reveal[data-delay="5"] { transition-delay: 400ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
