/* ==========================================================================
   Base — reset, body, shared utilities and the scroll-reveal system
   ========================================================================== */

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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("../assets/images/grain.png");
  background-size: 320px 320px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }

::selection { background: var(--gold-light); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Nothing may widen the page sideways (slide-in reveals, bleeding art).
   `clip` (unlike `hidden`) keeps position: sticky working inside. */
main > section, .footer { overflow-x: clip; }

.container {
  width: min(100% - (var(--gutter) * 2), var(--maxw));
  margin-inline: auto;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.8em;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

.display {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: 0.92;
  letter-spacing: 0.002em;
}

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

/* --------------------------------------------------------------------------
   Scroll reveal. Elements start hidden ONLY when JS is running (html.js),
   so the page is still fully readable without it.
   -------------------------------------------------------------------------- */
.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity 0.9s var(--ease-out) calc(var(--i, 0) * 90ms),
    transform 1.1s var(--ease-out) calc(var(--i, 0) * 90ms);
  will-change: opacity, transform;
}
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="left"] { transform: translate3d(-36px, 0, 0); }
.js [data-reveal="right"] { transform: translate3d(36px, 0, 0); }
.js [data-reveal="scale"] { transform: scale(0.94); }

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* Masked line reveal (headlines) */
.line {
  display: block;
  overflow: hidden;
  padding-block: 0.06em;
  margin-block: -0.06em;
}
.line__inner {
  display: block;
  transform: translate3d(0, 108%, 0);
  transition: transform 1.25s var(--ease-out) calc(var(--d, 0) * 1s);
  will-change: transform;
}
.is-visible .line__inner { transform: none; }
.hero .line__inner { transform: none; transition: none; }
html:not(.js) .line__inner { transform: none; }

/* Per-letter reveal ([data-split] headlines; letters are wrapped by reveal.js) */
[data-split] .line__inner { transform: none; transition: none; }
.word { display: inline-block; white-space: nowrap; }
.char {
  display: inline-block;
  transform: translate3d(0, 115%, 0) rotate(9deg);
  transform-origin: 0 100%;
  transition: transform 1.05s var(--ease-out) calc(var(--d, 0) * 1s + var(--c, 0) * 32ms);
}
.is-visible .char { transform: none; }

/* Scroll progress bar + shared buttons ------------------------------------ */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 100;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
  height: clamp(54px, 4.3vw, 70px);
  padding-inline: clamp(22px, 2.4vw, 40px);
  border: 0;
  border-radius: var(--radius);
  background: var(--gold);
  color: #fff;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out), background 0.3s;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.28) 50%, transparent 80%);
  transform: translateX(-120%);
  transition: transform 0.9s var(--ease-out);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -12px rgba(124, 88, 40, 0.65); background: #b0854d; }
.btn:hover::before { transform: translateX(120%); }
.btn:active { transform: translateY(0) scale(0.985); }

@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;
    transition-delay: 0ms !important;
  }
  .js [data-reveal], .line__inner, .char { opacity: 1; transform: none; }
}
