/* ==========================================================================
   Madison Marino — base: reset, typography, layout primitives, grain.
   The base experience is complete with no JS and with reduced motion.
   ========================================================================== */

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

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(46rem 34rem at 8% 8%, color-mix(in srgb, var(--range-pink) 9%, transparent), transparent 72%),
    radial-gradient(52rem 38rem at 92% 24%, color-mix(in srgb, var(--range-teal) 8%, transparent), transparent 74%),
    var(--void);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Paper grain over the whole stage (subtle; decorative). */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  background: url("/assets/grain.svg");
  opacity: 0.07;
  mix-blend-mode: multiply;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  body::after { opacity: 0.05; }
}

img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
a:hover { text-decoration-color: currentColor; }
button { font: inherit; color: inherit; }
:where(ul, ol) { margin: 0; padding: 0; }

/* --- Typography --------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
p { margin: 0; text-wrap: pretty; }
p + p { margin-top: 1em; }

.serif { font-family: var(--font-serif); font-weight: 400; letter-spacing: 0; }
.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  max-width: 100%;
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--range-teal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--range-teal) 24%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .eyebrow .dot { animation: dot-pulse 2.6s var(--ease-io) infinite; }
}
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--range-teal) 24%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--range-teal) 8%, transparent); }
}

/* Gradient ink for emphasis words. */
.grad-ink {
  background: var(--spectrum);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* Underline-swatch emphasis (keeps text legible if clip unsupported). */
.hi {
  font-weight: 600;
  color: var(--text);
  background: var(--spectrum) left 100% / 100% 0.14em no-repeat;
  padding-bottom: 0.04em;
}

/* --- Layout primitives -------------------------------------------------- */
.wrap {
  width: min(var(--wrap), 100%);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap-narrow { width: min(var(--wrap-narrow), 100%); }
.stack > * + * { margin-top: var(--stack, 1rem); }
.section { padding-block: clamp(64px, 12vh, 140px); }
.section-sm { padding-block: clamp(48px, 8vh, 96px); }

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

/* --- Skip link + focus -------------------------------------------------- */
.skip-link {
  position: fixed;
  top: -80px; left: 16px;
  z-index: 200;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 14px; }

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

/* --- Progressive enhancement guards ------------------------------------- */
/* Anything tagged data-enhance is a JS-only affordance: hidden until .js. */
.no-js [data-enhance] { display: none !important; }

/* Reduced motion: neutralize continuous/decorative animation site-wide. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Section rhythm hairlines. */
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* --- Reveal-on-scroll (JS adds .reveal; content is visible without JS) --- */
.js .reveal { opacity: 0; transform: translate3d(0, 18px, 0); transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* Internal page transitions are handled by the JS iris in chrome.js (works in
   every browser); cross-document View Transitions are intentionally not used. */
.site-header { view-transition-name: site-chrome; }
.cs-hero { view-transition-name: project-band; }
/* The incoming page irises open from centre over the outgoing one, matching the
   homepage intro. */
::view-transition-old(root) { animation: mm-page-out 320ms ease-in both; }
::view-transition-new(root) { animation: mm-iris-in 520ms var(--ease-io) both; }
::view-transition-old(site-chrome),
::view-transition-new(site-chrome) { animation-duration: 180ms; }
::view-transition-old(project-band) { animation: mm-band-out 220ms ease-in both; }
::view-transition-new(project-band) { animation: mm-band-in 440ms var(--ease-out) both; }
@keyframes mm-page-out { to { opacity: 0.6; } }
@keyframes mm-iris-in {
  from { clip-path: circle(0% at 50% 50%); }
  to   { clip-path: circle(150% at 50% 50%); }
}
@keyframes mm-band-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes mm-band-in { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root),
  ::view-transition-old(site-chrome), ::view-transition-new(site-chrome),
  ::view-transition-old(project-band), ::view-transition-new(project-band) { animation-duration: 0.001ms; }
}
