/* ==========================================================================
   Storybook homepage: shared foundation (tokens, reset, shared pieces,
   sheets, peekers, the fixed bar, motion switches; the menu is in menu.css).
   Owned by the foundation builder. Section builders: do not edit; read API.md.
   Breakpoints: desktop 1100+, tablet 761-1099 (max-width:1099px),
   phone 760 and narrower (max-width:760px).
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --cream: #fff7e8;
  --paper: #fffdf7;
  --ink: #10244a;
  --ink-2: #1d3a6e;
  --ink-deep: #071631;
  --gold: #f6a313;
  --gold-light: #ffcf6b;
  --gold-deep: #a86a00;
  --pink: #ff4f8b;
  --blue: #0f7daf;
  --sky: #8fd0ea;
  --muted: #3b4d75;
  --muted-on-navy: rgba(255, 247, 232, .84);

  --font-display: 'Baloo 2', sans-serif;
  --font-label: 'Big Shoulders Display', sans-serif;
  --font-body: 'Nunito', sans-serif;
  --body-max: 13px;

  --gutter: 80px;
  --wrap: 1280px;
  --sheet-radius: 56px;
  --sheet-foot: 200px;
  --nav-top: 24px;
  --nav-h: 68px;
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);

  /* Extras (not in BUILD 3.3, safe to use): */
  --focus: var(--ink);            /* focus ring colour; navy sheets switch it to gold-light */
  --peeker-size: 230px;           /* the friend peeking over a sheet's top edge */
  --peeker-x: 0px;                /* sideways shift of the peeker from the sheet's centre */
  --peeker-tag-y: 45%;            /* name tag's top, as a share of the peeker box height */
  --peeker-tag-gap: 6px;          /* gap between the peeker box and its name tag */
  --blob: #ffe8b5;                /* the soft blob under the bar's links */
}
@media (max-width: 1099px) {
  :root {
    --gutter: 40px;
    --sheet-radius: 44px;
    --sheet-foot: 160px;
    --nav-top: 16px;
    --nav-h: 62px;
    --peeker-size: 190px;
  }
}
@media (max-width: 760px) {
  :root {
    --body-max: 11px;
    --gutter: 16px;
    --sheet-radius: 32px;
    --sheet-foot: 124px;
    --nav-top: 10px;
    --nav-h: 56px;
    --peeker-size: 150px;
    --peeker-tag-y: 70%;
    --peeker-tag-gap: -8px;
  }
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;       /* no layout jump when the menu locks scrolling */
  /* Focus and in-page jumps stop below the fixed bar (and above the phone dock, below), never under it. */
  scroll-padding-top: calc(var(--nav-top) + var(--nav-h) + 12px);
}
@media (max-width: 760px) {
  html { scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink-deep);    /* the dark that shows beside a sheet sinking back */
  color: var(--ink);
  font: 700 var(--body-max)/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
h1, h2, h3, h4, h5, h6 { font-weight: 800; }
img, video { max-width: 100%; height: auto; }
img, svg, video { vertical-align: middle; }
a { color: inherit; }
button { font: inherit; color: inherit; }
#page { display: block; overflow-x: clip; }   /* clip, not hidden: sticky sheets keep working */

/* Visible keyboard focus everywhere. Navy surfaces switch --focus. */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sheet--write, .sheet--watch { --focus: var(--gold-light); }

/* ---------- 3. Shared pieces ---------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.eyebrow {
  margin: 0;
  font: 800 14px/1 var(--font-label);
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* Buttons. Hover and press use the `translate` property (not `transform`), so they
   still work on buttons that GSAP moves (GSAP writes inline `transform`). */
.btn {
  --btn-shadow: 5px;
  --btn-shadow-color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; padding: 0 28px;
  border-radius: 999px; border: 2.5px solid var(--ink);
  background: var(--paper); color: var(--ink);
  box-shadow: 0 var(--btn-shadow-now, var(--btn-shadow)) 0 var(--btn-shadow-color);
  font: 700 18px/1 var(--font-display);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: translate .15s ease;
}
.btn:hover { translate: 0 -2px; }
.btn:active { translate: 0 calc(var(--btn-shadow) - 2px); --btn-shadow-now: 2px; transition-duration: .06s; }
.btn svg { flex: none; }
.btn--gold { background: var(--gold); color: var(--ink); }
.btn--paper { background: var(--paper); color: var(--ink); }
.btn--ghost { background: transparent; color: var(--cream); border-color: var(--cream); box-shadow: none; }
.btn--ghost:active { translate: 0 2px; }
.btn--ink { background: var(--ink); color: var(--cream); --btn-shadow-color: var(--ink-deep); }
.btn--gold-on-navy { background: var(--gold); color: var(--ink); border-color: var(--gold); --btn-shadow-color: var(--gold-deep); }
.btn--sm { --btn-shadow: 3px; height: 48px; padding: 0 22px; font-size: 16px; }
@media (max-width: 760px) {
  .btn { gap: 8px; height: 52px; padding: 0 20px; font-size: 16px; }
  .btn--sm { height: 48px; padding: 0 18px; font-size: 15px; }
}

/* The two arrow icons (markup in API.md). Size comes from the svg's width/height. */
.icon-arrow, .icon-out {
  flex: none; fill: none; stroke: currentColor; stroke-width: 3;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Die-cut stickers */
.stk {
  filter: drop-shadow(0 3px 0 #fff) drop-shadow(0 -3px 0 #fff) drop-shadow(3px 0 0 #fff) drop-shadow(-3px 0 0 #fff) drop-shadow(0 10px 10px rgba(16, 36, 74, .28));
  pointer-events: none; user-select: none; -webkit-user-drag: none;
}
.stks {
  filter: drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff) drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 4px 5px rgba(7, 22, 49, .35));
  pointer-events: none; user-select: none; -webkit-user-drag: none;
}
@media (max-width: 760px) {
  .stk { filter: drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff) drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 10px 10px rgba(16, 36, 74, .28)); }
}

/* Name tag (a link). Rotation uses the `rotate` property so GSAP can scale it freely. */
.tag {
  position: relative;
  display: inline-block;
  padding: 7px 12px 6px;
  border-radius: 10px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  color: var(--ink);
  font: 800 14px/1 var(--font-label);
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  rotate: 3deg;
  transition: translate .15s ease;
}
.tag:hover { translate: 0 -2px; }
.tag::after { content: ""; position: absolute; left: -8px; right: -8px; top: -12px; bottom: -12px; } /* at least 44px tall, phones included */
@media (max-width: 1099px) { .tag { font-size: 13px; } }
@media (max-width: 760px) { .tag { padding: 6px 10px 5px; border-radius: 9px; font-size: 12px; } }

/* The gold competition ticket (markup in API.md). Tilt it from your own CSS with `rotate`. */
.ticket {
  position: relative;
  display: inline-flex; align-items: center;
  height: 60px;
  border-radius: 16px;
  background: var(--gold);
  border: 2.5px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
}
.ticket__stub {
  display: flex; align-items: center; justify-content: center; align-self: stretch;
  width: 56px; flex: none;
  border-right: 2px dashed var(--ink);
}
.ticket__stub svg { width: 22px; height: 22px; fill: var(--ink); }
.ticket__text {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 0 20px 0 16px;
  font: 800 19px/1 var(--font-label);
  letter-spacing: .08em;
  text-transform: uppercase;
}
@media (max-width: 1099px) {
  .ticket { height: 52px; border-radius: 14px; }
  .ticket__stub { width: 48px; }
  .ticket__stub svg { width: 20px; height: 20px; }
  .ticket__text { padding: 0 18px 0 14px; font-size: 16px; }
}
@media (max-width: 760px) {
  .ticket { height: 44px; box-shadow: 0 4px 0 var(--ink); }
  .ticket__stub { width: 40px; }
  .ticket__stub svg { width: 18px; height: 18px; }
  .ticket__text { gap: 8px; padding: 0 14px 0 12px; font-size: 14px; }
}

/* The small pulsing pink dot: a ring that grows and fades (transform and opacity only). */
.dot {
  position: relative;
  display: inline-block; flex: none;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--pink);
}
.dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--pink);
  animation: jjw-livedot 1.8s ease-out infinite;
}
@keyframes jjw-livedot { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(3); opacity: 0; } }

/* Twinkling four-point star (uses the `scale` property, so a builder's own transform is kept). */
.star { fill: var(--gold); animation: jjw-twinkle 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes jjw-twinkle { 0%, 100% { opacity: 1; scale: 1; } 50% { opacity: .35; scale: .7; } }

/* Extra: a gentle CSS bob (the tablet and phone hero ticket). Uses `translate`. */
.bob { animation: jjw-bob 3.2s ease-in-out infinite; }
@keyframes jjw-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }

/* Endless CSS animations rest while their sheet is off screen or covered. */
.sheet[data-inview="false"] .star,
.sheet[data-inview="false"] .bob,
.sheet[data-inview="false"] .dot::after,
.sheet[data-inview="false"] .sheen__bar { animation-play-state: paused; }

/* ---------- 4. Sheets (the pages of the book) ---------- */
.sheet {
  position: relative;
  z-index: 1;                      /* every sheet is its own layer; later sheets paint over earlier ones */
  margin-top: calc(var(--sheet-radius) * -1);
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
}
#page > .sheet:first-child { margin-top: 0; border-radius: 0; }
.sheet:not(:last-child) { padding-bottom: var(--sheet-foot); }   /* the foot: where the next friend peeks */
.sheet__body { position: relative; }
/* Added by the core in motion mode: darkens a sheet as the next one covers it. */
.sheet__shade {
  position: absolute; inset: 0; z-index: 40;
  border-radius: inherit;
  background: var(--ink-deep);
  opacity: 0;
  pointer-events: none;
}

/* Sheen sweep (the core adds .sheen inside each [data-sheen] element, motion only). */
.sheen {
  position: absolute; inset: 0; z-index: 2;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}
.sheen__bar {
  position: absolute; top: -20%; bottom: -20%; left: 0;
  width: 45%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .42) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-120%) skewX(-12deg);
  animation: jjw-sheen var(--sheen-every, 5s) ease-in-out var(--sheen-delay, 0s) infinite;
}
@keyframes jjw-sheen {
  0% { transform: translateX(-120%) skewX(-12deg); }
  22%, 100% { transform: translateX(340%) skewX(-12deg); }
}

/* ---------- 5. Peekers ---------- */
/* The box sits on the sheet's top edge; its clip-path cuts everything below that edge,
   so the friend seems to rise from behind the page. The tag sits beside the friend's head. */
.peeker {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 100%;
  width: var(--peeker-size);
  height: var(--peeker-size);
  margin-left: calc(var(--peeker-size) / -2 + var(--peeker-x));
  clip-path: inset(-60% -400% 0 -400%);
  pointer-events: none;
}
.peeker__img {
  position: absolute;
  left: 0;
  top: calc(var(--peeker-size) * .04);   /* the lowest 4% (the gripping hands) hides behind the edge */
  width: 100%;
  height: 100%;
  max-width: none;
  display: block;
}
.peeker__tag {
  position: absolute;
  z-index: 1;
  left: calc(100% + var(--peeker-tag-gap));
  top: var(--peeker-tag-y);
  pointer-events: auto;
}
.peeker--tag-left .peeker__tag { left: auto; right: calc(100% + var(--peeker-tag-gap)); rotate: -3deg; }

/* ---------- 6. Motion switches ---------- */
/* The one allowed pre-hide (BUILD 4.5). GSAP's autoAlpha shows these; a failsafe in the head
   script turns the page calm after 4 s if the scripts never ran. */
html.motion [data-intro] { visibility: hidden; }

/* Motion off: stop every CSS animation and transition. */
html.calm *, html.calm *::before, html.calm *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  html:not(.motion) *, html:not(.motion) *::before, html:not(.motion) *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Pokeable stickers answer touches only while motion is on. */
html.motion [data-sticker] { pointer-events: auto; cursor: pointer; -webkit-tap-highlight-color: transparent; }
[data-count] { font-variant-numeric: tabular-nums; }

/* Word spans made by data-reveal="words" / helpers.splitWords. */
.split-w { display: inline-block; }

/* Burst stars layer (motion only, created by the core). */
.fx-layer { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.fx-star { position: absolute; left: 0; top: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; fill: currentColor; opacity: 0; visibility: hidden; }

/* ---------- 7. The fixed bar ---------- */
.bar {
  position: fixed;
  z-index: 60;
  top: var(--nav-top);
  left: 0; right: 0;
  margin-inline: auto;
  width: min(100% - 2 * var(--gutter), var(--wrap));
  height: var(--nav-h);
  pointer-events: none;            /* only the pill takes clicks */
}
.bar__pill {
  position: relative;
  isolation: isolate;
  height: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 0 10px 0 22px;
  pointer-events: auto;
}
/* The pill's paper face lives on ::before so phones can fade it in with opacity alone. */
.bar__pill::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: 999px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  transition: opacity .2s ease;
}
.bar__logo { position: relative; display: block; flex: none; line-height: 0; border-radius: 12px; }
.bar__logo::after { content: ""; position: absolute; inset: -4px -2px; } /* 44px hit area on phones, where the logo is 40px tall */
.bar__logo img { display: block; width: 82px; height: 46px; object-fit: contain; }
.bar__nav { flex: 1; display: flex; justify-content: center; min-width: 0; }
.bar__links {
  position: relative;
  display: flex; align-items: center;
  gap: clamp(2px, calc((100vw - 1100px) * .047 + 2px), 18px);
  margin: 0; padding: 0; list-style: none;
}
.bar__link {
  position: relative; z-index: 1;
  display: block;
  padding: 11px 8px;
  border-radius: 999px;
  color: var(--ink);
  font: 700 17px/1 var(--font-display);
  text-decoration: none;
  white-space: nowrap;
}
.bar__links:not(.has-blob) .bar__link:hover { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 3px; text-underline-offset: 6px; }
/* The page you are on: a navy pill. */
.bar__link[aria-current="page"] { padding-left: 16px; padding-right: 16px; background: var(--ink); color: var(--cream); }
.bar__links:not(.has-blob) .bar__link[aria-current="page"]:hover { text-decoration: none; }
/* The sliding blob: two round caps and a middle that stretches (transform only). */
.bar__blob { position: absolute; left: 0; top: 50%; height: 40px; margin-top: -20px; pointer-events: none; opacity: 0; }
.bar__blob span { position: absolute; top: 0; left: 0; height: 40px; background: var(--blob); }
.bar__blob .bar__blob-cap { width: 20px; border-radius: 20px 0 0 20px; }
.bar__blob .bar__blob-cap--end { border-radius: 0 20px 20px 0; }
.bar__blob .bar__blob-mid { width: 100px; transform-origin: 0 50%; }
.bar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }
.bar__write { box-shadow: 0 3px 0 var(--ink); }
.bar__menu {
  display: grid; place-items: center;
  width: 48px; height: 48px; padding: 0;
  border-radius: 50%;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: translate .15s ease;
}
.bar__menu:hover { translate: 0 -2px; }
.bar__menu:active { translate: 0 1px; }
.bar__menu svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.bar__menu .icon-close { display: none; }
.bar__menu[aria-expanded="true"] .icon-open { display: none; }
.bar__menu[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 1099px) {
  .bar__pill { padding: 0 8px 0 20px; }
  .bar__logo img { width: 76px; height: 43px; }
  .bar__nav { display: none; }
  .bar__write { height: 46px; padding: 0 20px; font-size: 15px; }
  .bar__menu { width: 46px; height: 46px; }
}
@media (max-width: 760px) {
  .bar__pill { padding: 0 4px 0 10px; }
  .bar__pill::before { opacity: 0; border-width: 2px; box-shadow: 0 4px 0 var(--ink); }
  .bar.is-scrolled .bar__pill::before,
  html.menu-open .bar__pill::before { opacity: 1; }
  .bar__logo img { width: 71px; height: 40px; }
  .bar__write { display: none; }
  .bar__menu { width: 44px; height: 44px; border-width: 2px; }
}

/* The menu (menu D) and the phone dock: css/menu.css. */
