/* Fewer Problems For All Of Humanity - site styles */

@font-face {
  font-family: "Anybody";
  src: url("../fonts/anybody.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --summit-night: #1B2A5B;
  --dawn-rose: #F08A7E;
  --sun-gold: #F6B93B;
  --open-sky: #6FB7E9;
  --ridge-green: #2E7D5B;
  --snow: #F8FBFF;

  --font-display: "Anybody", "Arial Narrow", sans-serif;
  --font-body: "Atkinson Hyperlegible Next", system-ui, sans-serif;

  /* Modular scale, ratio 1.25 */
  --step--1: 0.9rem;
  --step-0: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);
  --step-1: 1.4rem;
  --step-2: 1.76rem;
  --step-3: clamp(1.76rem, 1.3rem + 1.8vw, 2.75rem);
  --step-4: clamp(2.2rem, 1.4rem + 3.4vw, 4.3rem);
  --step-5: clamp(2.6rem, 1rem + 6.5vw, 7rem);

  --measure: 65ch;
  --gutter: clamp(1rem, 4vw, 3rem);
  --ease-rise: cubic-bezier(0.05, 0.7, 0.1, 1);
  --ease-calm: cubic-bezier(0.37, 0, 0.63, 1);

  /* Per-page sky, overridden below */
  --sky: var(--summit-night);
  --ground: var(--summit-night);
  --ink: var(--snow);
  --accent: var(--sun-gold);
}

/* The climb: each page sits higher and later in the day */
.page-1 { --sky: linear-gradient(#0F1A40, #1B2A5B 45%, #4B3F8F 80%, #7A4F8F); --ground: #1B2A5B; --ink: var(--snow); --accent: var(--sun-gold); }
.page-2 { --sky: linear-gradient(#3B3477, #5B4B8A 55%, var(--dawn-rose) 82%, var(--sun-gold)); --ground: #2F2758; --ink: var(--snow); --accent: var(--sun-gold); }
.page-3 { --sky: linear-gradient(var(--open-sky), #A9D6F2 70%, #D6EDFA); --ground: var(--snow); --ink: var(--summit-night); --accent: var(--ridge-green); }
.page-4 { --sky: linear-gradient(var(--sun-gold), #F9CF72 55%, #FCE7B6); --ground: var(--snow); --ink: var(--summit-night); --accent: #9A5B00; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--sun-gold); outline-offset: 3px; border-radius: 4px; }
.page-3 :focus-visible, .page-4 :focus-visible { outline-color: var(--summit-night); }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 10; padding: .6rem 1rem; background: var(--sun-gold); color: var(--summit-night); }
.skip:focus { top: 1rem; }

.display {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem var(--gutter);
  color: var(--ink);
}
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; margin-right: auto; }
.brand svg { width: 2.6rem; height: 2.6rem; }
.brand span {
  font: 700 0.95rem/1 var(--font-display);
  font-stretch: 75%;
  max-width: 13ch;
}
.site-nav { display: flex; align-items: center; }
.nav-pages { display: flex; gap: clamp(1rem, 2.2vw, 2rem); list-style: none; margin: 0; padding: 0; }
.nav-pages a {
  position: relative;
  display: block;
  padding: 0.5rem 0;
  font: 700 1rem/1 var(--font-display);
  font-stretch: 90%;
  text-decoration: none;
  white-space: nowrap;
}
/* The current page is marked with a small summit, the peak of the logo */
.nav-pages a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.35rem;
  width: 0.8rem;
  height: 0.4rem;
  translate: -50% 0;
  background: var(--accent);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
  scale: 0 1;
  transition: scale 200ms var(--ease-rise);
}
.nav-pages a:hover::after, .nav-pages a[aria-current="page"]::after { scale: 1 1; }
.nav-toggle { display: none; }

.nav-actions { display: flex; gap: 0.5rem; }
.nav-button {
  padding: 0.7rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  box-shadow: inset 0 0 0 2px currentColor;
  font: 800 1rem/1 var(--font-display);
  font-stretch: 110%;
  cursor: pointer;
  transition: transform 150ms var(--ease-rise);
}
.nav-button:hover { transform: translateY(-2px); }
.nav-button-main { background: var(--sun-gold); color: var(--summit-night); box-shadow: none; }
.page-4 .nav-button-main { background: var(--summit-night); color: var(--sun-gold); }

/* "Coming soon": drops in under the header, near the buttons that raised it */
.toast {
  position: fixed;
  top: 5rem;
  right: var(--gutter);
  z-index: 7;
  margin: 0;
  padding: 0.85rem 1.3rem 0.85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-radius: 1rem;
  background: var(--summit-night);
  color: var(--snow);
  font: 800 var(--step-1)/1 var(--font-display);
  font-stretch: 105%;
  box-shadow: 0 1rem 2.5rem -1rem rgb(15 26 64 / 0.6);
  animation: drop 450ms var(--ease-rise) both;
}
.toast::before { content: ""; width: 1.4rem; height: 0.7rem; background: var(--sun-gold); clip-path: polygon(0 100%, 50% 0, 100% 100%); }
.toast:empty { display: none; }
@keyframes drop { from { opacity: 0; translate: 0 -0.75rem; } }

/* ---------- Hero scenes ---------- */
.hero {
  position: relative;
  min-height: max(100svh, 46rem, 58vw);
  display: grid;
  align-content: start;
  padding: clamp(7rem, 20vh, 11rem) var(--gutter) 40vh;
  background: var(--sky);
  overflow: hidden;
  isolation: isolate;
}
.hero > :not(.scene, .cue) { position: relative; z-index: 1; }
.scene { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-title { font-size: var(--step-5); text-align: center; max-width: 16ch; margin-inline: auto; animation: stretch 1400ms var(--ease-rise) both; }

/* The one orchestrated entrance: type widens as the sun rises */
@keyframes stretch { from { font-stretch: 50%; opacity: 0; translate: 0 0.3em; } to { font-stretch: 125%; opacity: 1; translate: 0 0; } }
.hero-title { font-stretch: 125%; }
.sunrise { animation: sunrise 1800ms var(--ease-rise) 200ms both; }
@keyframes sunrise { from { translate: 0 22%; } }

/* Parallax, driven purely by CSS scroll timelines where supported */
@supports (animation-timeline: scroll()) {
  .layer {
    animation: drift linear both;
    animation-timeline: scroll(root);
    animation-range: 0 100vh;
  }
  @keyframes drift { to { translate: 0 calc(var(--depth, 0) * 45vh); } }
  .site-header { animation: solid linear both; animation-timeline: scroll(root); animation-range: 50vh 70vh; }
  @keyframes solid { to { background: color-mix(in srgb, var(--ground) 94%, transparent); box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 15%, transparent); } }
  .soar { animation: soar linear both; animation-timeline: scroll(root); animation-range: 0 120vh; }
  @keyframes soar { to { translate: 0 -35vh; } }
}

@supports not (animation-timeline: scroll()) {
  .site-header { background: color-mix(in srgb, var(--ground) 94%, transparent); }
}

/* Birds: each wing beat is a vertical squash, ambient bob on the group */
.flap { animation: flap 900ms var(--ease-calm) infinite alternate; transform-origin: 0 0; }
@keyframes flap { to { scale: 1 -0.55; } }
.bob { animation: bob 6s var(--ease-calm) infinite alternate; }
@keyframes bob { to { translate: 0 -14px; } }

/* Time rings turn at different speeds */
.ring { transform-box: fill-box; transform-origin: center; animation: turn var(--t, 60s) linear infinite; }
.ring:nth-child(even) { animation-direction: reverse; }
@keyframes turn { to { rotate: 1turn; } }

.trail { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: trail 2400ms var(--ease-rise) 400ms forwards; }
@keyframes trail { to { stroke-dashoffset: 0; } }

.twinkle { animation: twinkle 3s var(--ease-calm) infinite alternate; }
.twinkle:nth-child(3n) { animation-delay: -1.2s; }
.twinkle:nth-child(3n+1) { animation-delay: -2.1s; }
@keyframes twinkle { to { opacity: 0.25; } }

/* ---------- Content ---------- */
.content {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding: clamp(3rem, 8vw, 6rem) var(--gutter);
}
.content > * + * { margin-top: 1.5em; }
.content p { margin-bottom: 0; }
.heading { font-size: var(--step-4); font-stretch: 110%; }
.statement { font-size: var(--step-3); font-stretch: 100%; color: var(--accent); }
.lede { font: 600 var(--step-2)/1.35 var(--font-display); font-stretch: 90%; text-wrap: pretty; max-width: 34ch; }
.lede + .lede { margin-top: 1em; }
.page-2 .lede { margin-inline: auto; text-align: center; }
/* Body copy the client asked to stand out a little: larger than body, smaller than the lede */
.emph, .waypoints, .wishes, .rally-body { font-size: clamp(1.3rem, 1.2rem + 0.5vw, 1.55rem); }

/* Nine requirements: a trail of waypoints */
.waypoints { list-style: none; padding: 0; margin-top: 2.5rem; border-left: 2px dashed color-mix(in srgb, var(--ink) 40%, transparent); }
.waypoints li { position: relative; padding: 0.7rem 0 0.7rem 1.6rem; }
.waypoints li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: calc(0.7rem + 0.44em);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sun-gold);
}
.waypoints .n { font: 800 var(--step-1)/1 var(--font-display); color: var(--sun-gold); margin-right: 0.15em; }

/* Wishes: plain, unordered, marked with a small bird */
.wishes { list-style: none; padding: 0; }
.wishes li { position: relative; padding: 0.35rem 0 0.35rem 2.2rem; }
.wishes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: calc(0.35rem + 0.4em);
  width: 1.4rem;
  height: 0.6rem;
  background: var(--accent);
  mask: url("../img/bird.svg") center / contain no-repeat;
}

.rally { font-size: var(--step-0); font-weight: 400; max-width: var(--measure); margin: 0; }
.page-4 .hero-title { font-size: clamp(1.9rem, 1rem + 3vw, 3.6rem); max-width: 24ch; }
.page-4 .site-header { --sun: var(--snow); }
.hero-title span { display: block; }
.dream-action { margin-top: 0.5em; font-weight: 900; }
.rally-cry { display: block; font: 800 var(--step-4)/0.95 var(--font-display); font-stretch: 120%; margin-bottom: 0.4em; text-wrap: balance; animation: stretch 1400ms var(--ease-rise) both; }
.page-3 .hero, .page-3 .hero .rally { text-align: left; }
.rally-body {
  display: block;
  padding: 1.1rem 1.3rem;
  border-radius: 1rem;
  /* Glass: frosted snow with a soft sheen across the top */
  background:
    linear-gradient(160deg, rgb(255 255 255 / 0.55), rgb(255 255 255 / 0.12) 45%, transparent 70%),
    color-mix(in srgb, var(--snow) 55%, transparent);
  border: 1px solid rgb(255 255 255 / 0.7);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.9), 0 12px 32px rgb(27 42 91 / 0.12);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
}

/* Sign that breaks apart (page 4) */
.sign { margin: 3rem 0; view-timeline: --sign; }
.sign svg { width: 100%; height: auto; overflow: visible; }
@supports (animation-timeline: view()) {
  .letter { animation: scatter linear both; animation-timeline: --sign; animation-range: contain 10% contain 90%; transform-box: fill-box; transform-origin: center; }
  @keyframes scatter { to { translate: var(--dx) -260px; rotate: var(--dr); opacity: 0; } }
  .board { animation: fade linear both; animation-timeline: --sign; animation-range: contain 30% contain 95%; }
  @keyframes fade { to { opacity: 0; translate: 0 40px; } }
  .rise { animation: rise linear both; animation-timeline: --sign; animation-range: cover 10% cover 90%; }
  @keyframes rise { from { translate: 0 200px; } to { translate: 0 -220px; } }
}

/* ---------- The guide: scroll cue, progress, next step ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Progress up the page, a thin gold rope under the header */
.progress { position: fixed; inset: 0 0 auto; height: 4px; z-index: 6; background: var(--sun-gold); transform-origin: 0 50%; scale: 0 1; }
@supports (animation-timeline: scroll()) {
  .progress { animation: progress linear both; animation-timeline: scroll(root); }
  @keyframes progress { to { scale: 1 1; } }
}
@supports not (animation-timeline: scroll()) { .progress { display: none; } }

/* Scroll cue: a hiker's dot walking down a trail */
.cue {
  position: absolute;
  left: 50%;
  bottom: clamp(1.25rem, 4vh, 2.5rem);
  translate: -50% 0;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  color: var(--ink);
  font: 700 0.95rem/1 var(--font-display);
  font-stretch: 110%;
  text-decoration: none;
}
.cue-trail { position: relative; width: 2px; height: 2.75rem; background: linear-gradient(currentColor 50%, transparent 0) 0 0 / 2px 8px; }
.cue-trail::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--sun-gold);
  animation: walk 1600ms var(--ease-calm) 1200ms infinite both;
}
@keyframes walk { from { translate: 0 0; opacity: 1; } 80% { opacity: 1; } to { translate: 0 2.4rem; opacity: 0; } }
/* Desktop heroes can run taller than the screen: pin the cue to the bottom of the first screen */
@media (min-width: 641px) {
  .cue { bottom: auto; top: calc(100svh - 5.5rem - clamp(1.25rem, 4vh, 2.5rem)); }
}
@supports (animation-timeline: scroll()) {
  .cue { animation: leave linear both; animation-timeline: scroll(root); animation-range: 0 30vh; }
  @keyframes leave { to { opacity: 0; visibility: hidden; } }
}

/* Next step: the trail continues down to the button */
.onward { display: grid; justify-items: center; gap: 1rem; padding: 0 var(--gutter) clamp(4rem, 10vw, 7rem); text-align: center; }
.onward::before { content: ""; width: 2px; height: 5rem; background: linear-gradient(var(--ink) 50%, transparent 0) 0 0 / 2px 10px; opacity: 0.5; }
.next {
  display: inline-grid;
  justify-items: center;
  gap: 0.45rem;
  padding: 1.1rem 2rem 1rem;
  border-radius: 1.5rem;
  background: var(--sun-gold);
  color: var(--summit-night);
  text-decoration: none;
  transition: transform 150ms var(--ease-rise);
}
.next:hover { transform: translateY(-3px); }
.next-label { font: 800 var(--step-2)/1 var(--font-display); font-stretch: 105%; }
.next-step { font-size: var(--step--1); font-weight: 600; }
.next { animation: beckon 1800ms var(--ease-rise) infinite; }
@keyframes beckon { 20% { translate: 0 -6px; box-shadow: 0 0 0 10px color-mix(in srgb, var(--glow, var(--sun-gold)) 35%, transparent); } 40%, to { translate: 0 0; box-shadow: 0 0 0 0 transparent; } }
.page-4 .onward { padding-top: 3rem; }
.page-4 .onward::before { display: none; }
.page-3 .cue { background: color-mix(in srgb, var(--ground) 90%, transparent); border-radius: 0.9rem; padding: 0.6rem 1.1rem 0.7rem; }
.page-3 .next, .page-4 .next { background: var(--summit-night); color: var(--snow); --glow: var(--summit-night); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem var(--gutter);
  background: var(--summit-night);
  color: var(--snow);
  font-size: var(--step--1);
}
.site-footer .brand span { max-width: none; }
.legal { display: grid; gap: 0.25rem; text-align: right; }
.legal p { margin: 0; }
.legal a { text-underline-offset: 0.2em; }
.legal a:hover { color: var(--sun-gold); }

/* ---------- Page menu (narrow screens): Store and Podcast stay in the bar ---------- */
@media (max-width: 60rem) {
  .site-nav { order: 1; }
  .nav-toggle {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
  }
  .nav-toggle svg { width: 1.6rem; height: 1.6rem; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; overflow: visible; }
  .nav-toggle path { transform-origin: 12px 12px; transition: rotate 250ms var(--ease-rise), translate 250ms var(--ease-rise), opacity 150ms; }
  .nav-toggle[aria-expanded="true"] .bar-top { translate: 0 5px; rotate: 45deg; }
  .nav-toggle[aria-expanded="true"] .bar-mid { opacity: 0; }
  .nav-toggle[aria-expanded="true"] .bar-low { translate: 0 -5px; rotate: -45deg; }
  .nav-pages {
    position: absolute;
    inset: 100% 0 auto;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem var(--gutter) 1.5rem;
    background: var(--ground);
    box-shadow: 0 1.5rem 2rem -1.5rem rgb(15 26 64 / 0.5);
  }
  .nav-toggle[aria-expanded="false"] + .nav-pages { display: none; }
  .nav-pages a { padding: 0.9rem 0 0.9rem 1.5rem; font-size: var(--step-2); font-stretch: 100%; }
  .nav-pages a::after { left: 0; bottom: auto; top: 50%; translate: 0 -50%; }
  .nav-pages li + li { border-top: 1px solid color-mix(in srgb, var(--ink) 15%, transparent); }
  /* Overrides the scroll-driven header fade so the open menu reads as one panel */
  .site-header:has([aria-expanded="true"]) { background: var(--ground) !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .site-header .brand span { display: none; }
  .legal { text-align: left; }
  .site-header { gap: 0.5rem; }
  .nav-button { padding: 0.65rem 0.9rem; font-size: 0.9rem; }
  .toast { left: var(--gutter); justify-content: center; }
  .hero { padding-bottom: 32vh; }
  .ring { opacity: 0.4; }
  .cue { bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .flock { scale: 0.5; transform-origin: 720px 570px; }
  .page-2 .lede { font-size: var(--step-1); }
  .next-label { font-size: var(--step-1); }
}

/* ---------- Reduced motion: a still mountain ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .trail { stroke-dashoffset: 0; }
  .site-header { background: color-mix(in srgb, var(--ground) 94%, transparent); }
}

/* ---------- Not found ---------- */
.lost { align-content: center; padding-bottom: 6rem; }
.lost .hero-title { font-size: var(--step-4); margin-bottom: 2rem; }
.lost .onward::before { display: none; }
