/* =========================================================================
   BASE / RESET  (ported from the site's styled-components global styles)
   ========================================================================= */

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--surface-page);
}

/* guard against stray horizontal scroll on small screens (wide headings,
   the fixed scroll-thread overlay, parallax transforms) */
html { overflow-x: clip; }

html:has(:target) {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-display);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

pre, code, kbd, samp {
  font-family: var(--font-mono);
}

pre, code, kbd, samp,
blockquote, p, a,
h1, h2, h3, h4, h5, h6,
ul li, ol li {
  margin: 0;
  padding: 0;
  color: var(--ink);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
}

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

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

figure { margin: 0; }

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

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

strong, b {
  font-weight: 600;
  color: var(--ink);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

/* the site cross-fades almost every colour change on interactive elements */
button, input, select, textarea, a, svg, svg * {
  transition:
    color 320ms var(--ease-standard),
    background-color 320ms var(--ease-standard),
    border-color 320ms var(--ease-standard),
    fill 320ms var(--ease-standard),
    opacity 320ms var(--ease-standard);
}

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

::selection {
  background: var(--refract);
  color: #fff;
}

/* =========================================================================
   SKIP LINK
   ========================================================================= */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 2000;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--surface-page);
}
.skip-link:focus-visible {
  width: auto;
  height: auto;
  padding: 12px 16px;
  overflow: visible;
  clip-path: none;
  pointer-events: auto;
  border: 1px solid var(--refract);
}

/* =========================================================================
   GRAIN OVERLAY  (fixed fractal-noise texture over the whole page)
   ========================================================================= */
.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-repeat: repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-reduced-transparency: reduce) {
  .grain { display: none; }
}

/* =========================================================================
   VIGNETTE  (dark theme only — softens the flat charcoal toward the edges)
   ========================================================================= */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 89; /* just under .grain (90) */
  pointer-events: none;
  opacity: 0;
}
:root[data-theme="dark"] body::before {
  opacity: 1;
  background: radial-gradient(120% 90% at 50% 30%, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
  mix-blend-mode: multiply;
}

/* =========================================================================
   REDUCED MOTION
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -------------------------------------------------------------------------
   ANIMATION HOOKS — see js/animations.stub.js
   The original hides these until a scroll-trigger reveals them. In this
   static reconstruction they are visible by default; the attributes are
   kept as ready-made targets for whatever entrance animation goes here.
   ------------------------------------------------------------------------- */
[data-reveal] { opacity: 1; }          /* original: opacity: 0 until revealed  */
[data-reveal-heading] { }              /* original: per-line clip-path wipe     */
img[data-fade] { opacity: 1; }         /* original: 0 → 1 fade once loaded      */
