/* ==========================================================================
   base.css — reset, design tokens, typography, accessibility utilities
   ========================================================================== */

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

:root {
  /* Type */
  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-sans: "Jost", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Core palette (the stage overrides these per chapter) */
  --ink: #1c1712;
  --cream: #f6efe2;
  --gold: #b08d57;
  --gold-soft: #d8bb8a;

  /* Chrome adapts to the current scene light */
  --chrome-ink: #f4ecdd;
  --chrome-bg: rgba(13, 12, 11, 0.55);

  /* Rhythm */
  --gutter: clamp(1.25rem, 6vw, 3rem);
  --measure: 44rem;

  /* Type scale, mobile first */
  --fs-kicker: clamp(0.6rem, 2.4vw, 0.68rem);
  --fs-body: clamp(0.95rem, 3.4vw, 1.05rem);
  --fs-meta: clamp(0.78rem, 3vw, 0.9rem);
  --fs-title: clamp(2.15rem, 9.5vw, 4.4rem);
  --fs-hero: clamp(2rem, 11.5vw, 4.6rem);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-scene: 1.4s;

  /* Layers */
  --z-stage: 0;
  --z-content: 1;
  --z-rail: 39;
  --z-chrome: 40;
  --z-toast: 60;
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  min-height: 100svh;
  background: #0d0c0b;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.65;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, figure, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

::selection {
  background: var(--gold);
  color: #14100c;
}

:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 5px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Accessibility helpers
   -------------------------------------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: var(--z-toast);
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: translateY(-160%);
  transition: transform 0.3s var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline-color: var(--gold);
}

/* --------------------------------------------------------------------------
   Shared text primitives
   -------------------------------------------------------------------------- */

.kicker {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-family: var(--font-sans);
  font-size: var(--fs-kicker);
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--scene-accent, var(--gold));
}

.kicker::before {
  content: "";
  width: 2rem;
  height: 1px;
  flex: none;
  background: currentColor;
  opacity: 0.6;
}

.kicker--center { justify-content: center; }

p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

main:focus { outline: none; }

.icon {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Placeholder copy is deliberately marked until the couple supplies final wording. */
.is-placeholder {
  font-family: var(--font-display);
  font-style: italic;
  opacity: 0.55;
  border-bottom: 1px dotted currentColor;
  padding-bottom: 0.1em;
}
