/* ============================================================
   BEARMINDFUL — BASE
   Reset, typography, page furniture, accessibility floor.
   ============================================================ */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* The nav bar is sticky; anchors must not land underneath it. */
  scroll-padding-top: calc(var(--nav-h) + var(--space-5));
}

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

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: var(--leading-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur-scene) var(--ease-out-quart),
              color var(--dur-scene) var(--ease-out-quart);
}

/* Any component that sets `display` beats the UA rule for [hidden], and
   then hidden things are not hidden. This has to win. */
[hidden] { display: none !important; }

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

img, video { height: auto; }

input, button, textarea, select { font: inherit; color: inherit; }

button { background: none; border: none; padding: 0; }

/* ---------- Paper texture -------------------------------------------
   Picture books are printed on stock, not on a screen. A single
   low-opacity grain, drawn once as a data-URI, applied to the light
   worlds only. It is texture, never tint — the bg stays pure white. */

.world-studio::before,
.world-forest::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: var(--z-base);
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================================
   TYPE
   ============================================================ */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--leading-tight);
  letter-spacing: var(--track-display);
  text-wrap: balance;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); line-height: var(--leading-snug); }
h4 { font-size: var(--step-1); line-height: var(--leading-snug); }

p, li { text-wrap: pretty; }

p { max-width: var(--measure); }

a {
  color: inherit;
  text-decoration-color: color-mix(in oklab, currentColor 40%, transparent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
  transition: text-decoration-color var(--dur-ui) var(--ease-out-quart),
              color var(--dur-ui) var(--ease-out-quart);
}

@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration-color: currentColor; }
}

strong, b { font-weight: 700; }
em, i { font-style: italic; }

/* Read-aloud prose. Larger than normal body copy on purpose: a parent
   reads this at arm's length across a cushion, not at desk distance. */
.read-aloud {
  font-size: var(--step-1);
  line-height: var(--leading-loose);
  max-width: var(--measure);
  font-weight: 400;
}

.lede {
  font-size: var(--step-1);
  line-height: var(--leading-loose);
  color: var(--ink-muted);
  max-width: 54ch;
}

.label {
  font-family: var(--font-text);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: var(--track-label);
  color: var(--ink-muted);
}

.display {
  font-family: var(--font-display);
  font-size: var(--step-6);
  line-height: 0.95;
  letter-spacing: var(--track-display);
  text-wrap: balance;
}

/* ============================================================
   ACCESSIBILITY FLOOR
   ============================================================ */

/* Thick and warm, so it reads from sofa distance, not desk distance. */
:where(a, button, [tabindex], input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-5);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  border-radius: var(--r-full);
  transform: translateY(-160%);
  transition: transform var(--dur-ui) var(--ease-out-quart);
}

.skip-link:focus-visible { transform: translateY(0); }

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

/* ============================================================
   LAYOUT PRIMITIVES
   ============================================================ */

.wrap      { width: min(100% - var(--gutter) * 2, var(--width-page)); margin-inline: auto; }
.wrap-wide { width: min(100% - var(--gutter) * 2, var(--width-wide)); margin-inline: auto; }
.wrap-text { width: min(100% - var(--gutter) * 2, var(--width-text)); margin-inline: auto; }

.section { padding-block: var(--space-section); }
.section-tight { padding-block: clamp(2.5rem, 5vw, 4.5rem); }

.stack > * + * { margin-block-start: var(--space-4); }
.stack-lg > * + * { margin-block-start: var(--space-6); }
.stack-sm > * + * { margin-block-start: var(--space-2); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
}

/* Breakpoint-free responsive grid. */
.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
}

/* ============================================================
   SECTION HEADING
   A hairline rule and a title. No uppercase tracked eyebrow above
   every section — that scaffold is the tell, not the design.
   ============================================================ */

.section-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-5);
  margin-block-end: var(--space-6);
}

.section-head::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--rule);
  border-radius: var(--r-full);
  transform: translateY(-0.35em);
}

/* ============================================================
   MOTION — page entrance
   Reveals enhance an already-visible default. Content is never
   gated on a class-triggered transition, so a headless render,
   a hidden tab, or a JS failure still ships a complete page.
   ============================================================ */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.js .u-rise {
  animation: rise var(--dur-scene) var(--ease-out-expo) both;
  animation-delay: var(--delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  .js .u-rise { animation: fade var(--dur-ui) linear both; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  /* Exempt the deliberate crossfades that carry meaning. */
  .allow-motion, .allow-motion * {
    animation-duration: revert !important;
    transition-duration: revert !important;
  }
}

/* ============================================================
   PLACEHOLDER MARKER
   Every invented asset says so. The client should never wonder
   which pixels are theirs.
   ============================================================ */

.placeholder-note {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: var(--track-label);
  color: var(--ink-muted);
  background: color-mix(in oklab, var(--ink) 7%, transparent);
  border-radius: var(--r-full);
}

.placeholder-note::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: var(--r-full);
  background: var(--accent);
  flex: none;
}
