/* ==========================================================================
   BASE — reset, element defaults, accessibility, global utilities
   Depends on: tokens.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* The UA rule for [hidden] is display:none, but any author `display` — a flex
   row, a grid — outranks it and the element stays on screen. Scripts here
   hide things with the attribute, so make it win outright. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  overflow-x: hidden;                       /* tilted marquees stick out on purpose */
}

body {
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --------------------------------------------------------------------------
   2. Elements
   -------------------------------------------------------------------------- */
a {
  color: inherit;
  text-decoration: none;
}

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

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

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4 {
  line-height: 1.15;
  font-weight: 700;
}

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

/* --------------------------------------------------------------------------
   3. Accessibility
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--c-gold);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Keyboard-only shortcut past the nav — appears on focus */
.skip-link {
  position: fixed;
  top: -100px;
  left: 50%;
  z-index: 200;
  transform: translateX(-50%);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-pill);
  background: var(--c-gold);
  color: var(--c-ink-invert);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--text-xs);
  transition: top var(--dur-fast);
}

.skip-link:focus {
  top: var(--space-3);
}

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

/* --------------------------------------------------------------------------
   4. Utilities
   -------------------------------------------------------------------------- */
.text-center  { text-align: center; }
.tilt-left    { transform: rotate(-1.2deg); }
.tilt-right   { transform: rotate(1.1deg); }

/* Scroll reveal — the `is-visible` class is added by js/site.js.
   Stagger siblings with an inline `style="--delay:.08s"`. */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity   var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--delay, 0s);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Entry animation for a whole page body */
.page-enter {
  animation: page-in .6s var(--ease-out) both;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(14px); filter: blur(8px); }
  to   { opacity: 1; transform: none;             filter: blur(0); }
}

/* --------------------------------------------------------------------------
   5. Film grain — sits above the background, below the content
   -------------------------------------------------------------------------- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: .05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   6. Reduced motion — kill every animation, keep every element visible
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
