/* ============================================================
   base.css — reset, typography, layout primitives
   Depends on tokens.css.
   ============================================================ */

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

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

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

/* ── Page surface: warm radial gradient mesh + fine grain ──
   The bone is never flat. This is what makes the room feel
   like paper rather than a Bootstrap canvas. */
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--t-body);
  font-weight: var(--w-body);
  line-height: 1.7;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%,
      color-mix(in srgb, var(--bone-2) 100%, transparent) 0%,
      color-mix(in srgb, var(--bone-warm) 100%, transparent) 45%,
      var(--bone) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  position: relative;
}

/* Paper grain overlay — set on a pseudo so it doesn't tint content */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

main { position: relative; z-index: 2; }

/* ── Page transitions — true cross-document crossfade ──
   Modern browsers (Chrome/Edge 126+, Safari 18.2+) animate a real
   crossfade between pages via the View Transitions API: the old
   page fades down while the new page fades up in the same frames,
   so there's no bone-flash gap in the middle. Other browsers get
   instant navigation as a fallback (no synthetic fade — that's
   what was making it feel cheap before). Reduced-motion users
   skip via the global override at the top of this file. */
@view-transition {
  navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 520ms;
  animation-timing-function: cubic-bezier(.22, .61, .36, 1);
  animation-fill-mode: both;
}
::view-transition-old(root) { animation-name: page-fade-out; }
::view-transition-new(root) { animation-name: page-fade-in; }
@keyframes page-fade-out { to   { opacity: 0; } }
@keyframes page-fade-in  { from { opacity: 0; } }

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

a {
  color: var(--ink);
  text-decoration-color: color-mix(in srgb, var(--rose-gold) 60%, transparent);
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--pink); }

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

/* ── Type: light, tight, refined ─────────────────────────── */
h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: var(--w-display);
  font-variation-settings: var(--fr-soft);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 var(--space-3) 0;
  color: var(--ink);
}
h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); font-weight: var(--w-display-h); letter-spacing: -0.01em; line-height: 1.2; }

.display--hero {
  font-size: var(--t-hero);
  font-weight: var(--w-display);
  letter-spacing: -0.035em;
  line-height: 1.0;
}
em { font-style: italic; }

p  { margin: 0 0 var(--space-3) 0; max-width: 60ch; }
p:last-child { margin-bottom: 0; }

::selection { background: var(--pink); color: var(--bone); }

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

/* ── Layout primitives ─────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.reading {
  max-width: var(--reading);
  margin-inline: auto;
}
section { padding-block: var(--section-y); }

/* ── Kicker ────────────────────────────────────────────────── */
.kicker {
  font-family: var(--font-body);
  font-size: var(--t-kick);
  font-weight: var(--w-body-m);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--rose-gold);
  margin: 0 0 var(--space-3) 0;
  display: inline-block;
}
.kicker--on-dark { color: var(--rose-gold-2); }

/* Filipino subtitle under H1 — the bilingual touch, quiet */
.page-subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: calc(-1 * var(--space-2)) 0 var(--space-4) 0;
  letter-spacing: 0.01em;
}

/* ── Skip link ──────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--ink);
  color: var(--bone);
  z-index: 999;
}
.skip-link:focus { left: var(--space-2); top: var(--space-2); }

/* ── Reveal on scroll ──────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-slow) var(--ease),
              transform var(--dur-slow) var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
