/* ==========================================================================
   BASE — shared reset, layout primitives and media handling
   Palette / type tokens live in each direction's own stylesheet.
   ========================================================================== */

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

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

body {
  margin: 0;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

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

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

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

::selection {
  background: currentColor;
  color: #fff;
}

/* Hide content until GSAP takes over, so nothing flashes unstyled. */
.js-loading [data-anim] {
  visibility: hidden;
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--shell-max, 1440px);
  margin-inline: auto;
  padding-inline: var(--gutter, 2rem);
}

.stack > * + * {
  margin-top: var(--stack-gap, 1.5rem);
}

.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;
}

/* --------------------------------------------------------------------------
   Media — images drop into assets/img/... When a file is missing the frame
   still holds its space and prints the expected path, so the layout never
   collapses while artwork is being collected.
   -------------------------------------------------------------------------- */

.media {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--ratio, 3 / 4);
  background: var(--media-placeholder, rgba(128, 128, 128, 0.08));
}

.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, center);
}

.media::after {
  content: attr(data-label);
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.75rem 1rem;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Parallax frames overscan their image so the drift never exposes an edge. */
.media[data-parallax] img {
  position: absolute;
  inset: -9% 0;
  height: 118%;
}

/* media.js adds this class when the <img> fails to load. */
.media.is-empty::after {
  opacity: 0.45;
}

.media.is-empty img {
  opacity: 0;
}

/* --------------------------------------------------------------------------
   Reveal helpers — split lines and masked words for GSAP
   -------------------------------------------------------------------------- */

/* Padding keeps descenders from being clipped by the mask; the negative margin
   gives the space back so line spacing is unchanged. Sized for a serif with
   long descenders set at a line-height of 1. */
.line-mask {
  display: block;
  overflow: hidden;
  padding-bottom: 0.2em;
  margin-bottom: -0.2em;
}

.line-mask > span {
  display: block;
  will-change: transform;
}

/* --------------------------------------------------------------------------
   Preloader
   -------------------------------------------------------------------------- */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: var(--preload-bg, #111);
  color: var(--preload-fg, #fff);
}

@media (max-width: 900px) {
  .preloader {
    display: none !important;
  }

  .js-loading [data-anim] {
    visibility: visible;
  }
}

.preloader__count {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2rem, 8vw, 5rem);
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .js-loading [data-anim] {
    visibility: visible;
  }
}
