/* ==========================================================================
   Fonts, reset, base typography
   ========================================================================== */

/* --- Self-hosted fonts ---------------------------------------------------- */

@font-face {
  font-family: "Butler";
  src: url("../fonts/Butler_Ultra_Light.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Butler";
  src: url("../fonts/Butler_Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Butler";
  src: url("../fonts/Butler_Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Nunito Sans ships as one variable file (wght 200–1000). */
@font-face {
  font-family: "Nunito Sans";
  src: url("../fonts/NunitoSans-latin.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Nunito Sans";
  src: url("../fonts/NunitoSans-latin-ext.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* --- Reset ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Lenis drives scrolling; this keeps native anchor jumps sane if JS fails. */
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

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

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

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

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

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- Base ----------------------------------------------------------------- */

body {
  min-height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* `clip`, not `hidden`: hidden would turn <body> into a scroll container
     and break every `position: sticky` in the works stack. */
  overflow-x: clip;
  transition: background-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out);
}

/* The menu overlay and the preloader both lock the page. */
body.is-locked {
  overflow: hidden;
}

/* Lenis smooth scroll — required by the library. */
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: hidden;
}

/* --- Type utilities ------------------------------------------------------- */

.t-decorative,
.t-display,
.t-h1,
.t-h2 {
  font-family: var(--font-display);
  font-weight: 200;
  font-style: normal;
}

.t-decorative {
  font-size: var(--fs-decorative);
  line-height: var(--lh-decorative);
}

.t-display {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  /* [derived] Headings pair a manual <br/> with natural wrapping on
     narrow screens; balance keeps the wrapped side from leaving a lone
     orphan word instead of greedy-wrapping to the last possible line. */
  text-wrap: balance;
}

.t-display--caps {
  letter-spacing: var(--ls-display-caps);
  text-transform: uppercase;
}

.t-h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
  text-wrap: balance; /* [derived] — see .t-display */
}

.t-h2 {
  font-weight: 300; /* Butler Light */
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  text-wrap: balance; /* [derived] — see .t-display */
}

.t-h4 {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-h4);
  line-height: var(--lh-h4);
}

.t-body-strong {
  font-weight: 700;
  font-size: var(--fs-body-strong);
  line-height: var(--lh-body-strong);
}

.t-body {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

.t-caps {
  font-weight: 700;
  font-size: var(--fs-caps);
  line-height: var(--lh-caps);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
}

/* --- Layout helpers ------------------------------------------------------- */

.container {
  width: 100%;
  max-width: calc(var(--content-w) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 200;
  padding: var(--sp-16) var(--sp-24);
  background: var(--color-invert-surface);
  color: var(--color-invert-text);
  transform: translateY(-120%);
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* --- Focus ---------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--color-yellow);
  outline-offset: 4px;
}

/* The accent yellow is decorative-grade on paper; the ink keeps the focus
   indicator above the 3:1 non-text contrast bar in the light theme. */
:root[data-theme="light"] :focus-visible {
  outline-color: var(--color-text);
}

/* Touch devices own their vertical movement. Avoid CSS smooth-scroll and
   gesture interception so Safari/Chrome keep native momentum end to end. */
@media (pointer: coarse), (max-width: 900px) {
  html {
    scroll-behavior: auto;
  }

  body {
    touch-action: pan-y;
  }
}

/* --- Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
