/* ============================================================
   De Happytail — base reset & typography
   ============================================================ */

/* ---------- Self-hosted fonts ---------- */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/dm-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/dm-sans-500.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/dm-sans-700.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/dm-sans-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "DM Serif Display";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/dm-serif-display-400.woff2") format("woff2");
}
@font-face {
  font-family: "DM Serif Display";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/dm-serif-display-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Homemade Apple";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/homemade-apple-400.woff2") format("woff2");
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--banner-h) + var(--space-2));
}
@media (max-width: 820px) {
  html {
    scroll-padding-top: calc(var(--nav-h) + var(--space-1));
  }
}
:target {
  scroll-margin-top: calc(var(--nav-h) + var(--banner-h) + var(--space-2));
}
@media (max-width: 820px) {
  :target {
    scroll-margin-top: calc(var(--nav-h) + var(--space-1));
  }
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ul, ol {
  margin: 0;
}

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

img, svg, video, picture {
  display: block;
  max-width: 100%;
  height: auto;
}

button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- Base typography ---------- */
html {
  font-family: var(--font-body);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100%;
}

body {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

/* Hide the whole page while content is hydrating so the banner/header/main
   don't paint pre-hydration text and then shift. animations.js adds .is-loaded
   once content:ready (or fallback) fires; the body fades in smoothly. */
.js body { transition: opacity 250ms ease-out; }
.js:not(.is-loaded) body { opacity: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--c-text);
}

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

p { max-width: 65ch; }
p + p { margin-top: var(--space-4); }
:where(h1, h2, h3, h4) + p { margin-top: var(--space-6); }

.hero-title { font-size: var(--fs-hero); line-height: var(--lh-tight); letter-spacing: -0.015em; }
.hero-title em { font-style: italic; color: var(--c-ink); }

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--c-sage);
  margin-bottom: var(--space-3);
}
.eyebrow,
.eyebrow * { color: var(--c-sage); }

.script {
  font-family: var(--font-script);
  font-weight: 400;
  color: var(--c-accent);
  letter-spacing: 0;
  line-height: 1.1;
}

.lead { font-size: var(--fs-lead); color: var(--c-ink-80); }

::selection { background: var(--c-rose-100); color: var(--c-ink); }

/* ---------- Lenis smooth-scroll (recommended) ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ---------- Sage-tinted scrollbar (soft, banner-toned) ---------- */
html { scrollbar-color: var(--c-sage-100) var(--c-cream-100); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--c-cream-100); }
::-webkit-scrollbar-thumb {
  background: var(--c-sage-100);
  border-radius: 999px;
  border: 2px solid var(--c-cream-100);
}
::-webkit-scrollbar-thumb:hover { background: var(--c-sage); }

/* ---------- Focus ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--c-ink);
  color: var(--c-cream);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
  transition: transform var(--motion-fast) var(--ease-out);
  z-index: 1000;
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---------- Visually hidden ---------- */
.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;
}

/* ---------- Reduced motion ---------- */
@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;
    scroll-behavior: auto !important;
  }
}
