/* Egg Nebula
   Palette sampled from the existing art; texture borrowed from crayon/pastel references. */

:root {
  /* Brand palette. Night + cream carry the page; pink and purple are the
     accents (use sparingly); teal is for grass; blue only in illustrations. */
  --night: #19082b;
  --cream: #fbf4d3;
  --pink: #a34e8b;
  --purple: #702dbe;
  --lavender: #e5deee;
  --teal: #4e9aa3;
  --teal-deep: #3a7a82;
  --blue: #2d7ebe;

  /* Roles, derived from the palette */
  --bg: var(--night);
  --bg-deep: #12051f;
  --surface: #211033;
  --surface-2: #2a163f;
  --text: var(--cream);
  --muted: #aca2b7;
  --line: #3a2752;
  --card: var(--surface);
  --accent: var(--pink);

  --font-display: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hand: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --hill-h: clamp(70px, 10vw, 140px);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 100%) var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Paper grain over everything, like pastel on toothy paper. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.32;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.4 -0.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.25rem);
  font-weight: 600;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.3rem;
  font-weight: 500;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--text);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--lavender);
}

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

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

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--cream);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
}

.skip-link:focus {
  top: 12px;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
}

/* ---------- Small pieces ---------- */

.eyebrow {
  font-family: var(--font-hand);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--lavender);
  margin: 0 0 0.9em;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 1.6em;
  height: 2px;
  margin-right: 0.7em;
  vertical-align: 0.3em;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: left;
  scale: var(--tick, 1) 1;
}

.lead {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--muted);
  max-width: 34em;
}

.btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.7em 1.5em;
  border: 0;
  background: none;
  color: var(--cream);
  font: 500 1rem/1.2 var(--font-display);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 999px;
  background: var(--accent);
}

.btn:hover {
  color: var(--cream);
  transform: translateY(-2px);
}

.btn--ghost::before {
  background: transparent;
  border: 1.5px solid var(--muted);
}

.btn--ghost,
.btn--ghost:hover {
  color: var(--text);
}

.sparkle {
  position: absolute;
  width: var(--s, 28px);
  height: var(--s, 28px);
  fill: var(--cream);
  pointer-events: none;
  animation: twinkle 4.5s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}

.sparkle--pink {
  fill: var(--pink);
}

.stars {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.stars i {
  position: absolute;
  border-radius: 50%;
  background: var(--cream);
}

.stars i.twinkle {
  animation: twinkle 5s ease-in-out infinite;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 1;
    scale: 1;
  }
  50% {
    opacity: 0.35;
    scale: 0.8;
  }
}

@keyframes bob {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -8px;
  }
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

.site-header.is-scrolled {
  background: rgb(18 5 31 / 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px -18px rgb(6 2 12 / 0.9);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 1.25rem/1 var(--font-display);
  text-decoration: none;
  color: var(--text);
}

.brand img {
  width: 58px;
}

.nav-toggle {
  display: none;
  background: none;
  border: 2px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font: 500 1rem var(--font-display);
  padding: 6px 16px;
  cursor: pointer;
}

.site-nav ul {
  display: flex;
  gap: clamp(14px, 3vw, 34px);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  position: relative;
  font: 400 1rem var(--font-display);
  text-decoration: none;
  padding: 6px 2px;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 0;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
  scale: 0 1;
  transform-origin: right;
  transition: scale 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
  scale: 1 1;
  transform-origin: left;
}

@media (max-width: 640px) {
  .nav-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 18px;
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    gap: 4px;
  }

  .site-nav a {
    display: block;
    padding: 10px 0;
  }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding-top: clamp(32px, 6vw, 72px);
  overflow: hidden;
}

.hero .wrap {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: end;
  min-height: min(74vh, 640px);
}

.hero-copy {
  align-self: center;
  padding-bottom: calc(var(--hill-h) + 24px);
}

.hero-copy .lead {
  margin-bottom: 1.6em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-scene {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(var(--hill-h) * 0.32);
}

.hero-scene .sunny {
  width: 46%;
  margin-right: -6%;
  position: relative;
  z-index: 1;
  animation: bob 7s ease-in-out infinite;
}

.hero-scene .nilly {
  width: 50%;
  animation: bob 6s ease-in-out infinite -2s;
}

.hill .hill-back {
  fill: var(--teal-deep);
}

.hill {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: var(--hill-h);
  z-index: 1;
  fill: var(--teal);
}

@media (max-width: 760px) {
  .hero .wrap {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-copy {
    padding-bottom: 8px;
  }

  .hero-scene {
    max-width: 380px;
    margin-inline: auto;
    width: 100%;
  }
}

/* ---------- Sections ---------- */

.section {
  position: relative;
  padding-block: clamp(56px, 9vw, 110px);
}

.section > .wrap {
  position: relative;
  z-index: 1;
}

@media (max-width: 760px) {
  .newsletter > .sparkle {
    display: none;
  }
}

.section-head {
  max-width: 40em;
  margin-bottom: clamp(24px, 4vw, 44px);
}

.section-head.center {
  margin-inline: auto;
  text-align: center;
}

.section-head.center .lead {
  margin-inline: auto;
}

/* About: a light page in the night. Without motion it is an ordinary section.
   With motion (.has-motion) it pins for a few screens while the story plays
   paragraph by paragraph, then the Lab section slides up and covers it. */
.about {
  position: relative;
  background: var(--cream);
  color: var(--night);
  text-align: center;
}

.about-pin {
  padding-block: clamp(64px, 10vw, 120px);
}

.about .eyebrow {
  color: var(--purple);
}

.about h2 {
  color: var(--night);
}

.about-story {
  max-width: 30em;
  margin: clamp(20px, 3vw, 36px) auto 0;
  font-size: clamp(1.25rem, 2.4vw, 1.9rem);
  font-weight: 300;
  line-height: 1.5;
  text-wrap: pretty;
}

.about-story p {
  margin: 0 0 1em;
}

.about blockquote {
  margin: 0;
  font-weight: 500;
}

.has-motion .about {
  height: 420vh;
}

.has-motion .about-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: grid;
  align-items: center;
  padding-block: 68px 0;
  overflow: hidden;
}

.has-motion .about-story {
  display: grid;
  min-height: 7.5em;
  align-items: center;
}

.has-motion .about-story > * {
  grid-area: 1 / 1;
  margin: 0;
}

/* The Lab rises over the pinned About like a sheet of night sky. */
.has-motion #lab {
  margin-top: -100vh;
  margin-top: -100svh;
  /* Must be at least as tall as what it pulls up over, or About shows below it. */
  min-height: 100vh;
  min-height: 100svh;
  z-index: 2;
  overflow: clip;
  background: var(--bg);
  border-radius: clamp(24px, 4vw, 48px) clamp(24px, 4vw, 48px) 0 0;
  box-shadow: 0 -24px 60px -24px rgb(6 2 12 / 0.4);
}

/* ---------- Cards ---------- */

.cards {
  display: grid;
  gap: clamp(18px, 3vw, 30px);
}

.cards--2 {
  grid-template-columns: repeat(2, 1fr);
}

.cards--3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 820px) {
  .cards--3 {
    grid-template-columns: 1fr;
    max-width: 440px;
    margin-inline: auto;
  }
}

@media (max-width: 640px) {
  .cards--2 {
    grid-template-columns: 1fr;
  }
}

.card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
}

a.card:hover {
  color: var(--text);
  transform: translateY(-4px);
}

a.card:hover::before {
  border-color: rgb(163 78 139 / 0.7);
}

.card-art {
  margin: 14px 14px 0;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
}

.card-art img,
.card-art svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.card-body {
  padding: 18px 24px 24px;
}

.card-body p {
  color: var(--muted);
  margin-bottom: 0.6em;
}

.card-link {
  font: 500 1rem var(--font-display);
  color: var(--lavender);
  padding-bottom: 3px;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 2px no-repeat;
  transition: background-size 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

a.card:hover .card-link {
  background-size: 0 2px;
  background-position: 100% 100%;
}

.card--soon .card-art {
  opacity: 0.7;
}

.tag {
  display: inline-block;
  font: 500 0.8rem/1 var(--font-hand);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--accent);
  padding: 6px 12px;
  border-radius: 999px;
}

.section-foot {
  margin-top: clamp(24px, 4vw, 40px);
  text-align: center;
}

/* ---------- Resources card swap (home) ---------- */

/* Text on the left, a skewed 3D stack of guides on the right. The stack is
   laid out here with --i (its slot); js/motion.js animates the swaps. */
.resources-home {
  overflow: clip;
}

.resources-home .wrap {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}

.resources-home .section-foot {
  text-align: left;
}

.card-swap {
  --card-w: min(460px, 78vw);
  --dx: calc(var(--card-w) * 0.09);
  --dy: calc(var(--card-w) * 0.1);
  position: relative;
  height: calc(var(--card-w) * 1.3);
  perspective: 900px;
  margin: 0;
  padding: 0;
}

/* The card itself is a positioning shell that GSAP moves around the stack;
   its visuals live on .swap-card-inner, which lifts on hover without
   fighting those transforms. */
.swap-card {
  position: absolute;
  top: 56%;
  left: 42%;
  width: var(--card-w);
  aspect-ratio: 5 / 4;
  color: var(--text);
  text-decoration: none;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform;
  z-index: calc(10 - var(--i));
  transform:
    translate(-50%, -50%)
    translate3d(calc(var(--i) * var(--dx)), calc(var(--i) * var(--dy) * -1), calc(var(--i) * var(--dx) * -1.5))
    skewY(5deg);
}

.swap-card:hover {
  color: var(--text);
}

.swap-card-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 30px 60px -30px rgb(6 2 12 / 0.8);
  transition:
    translate 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.4s ease,
    box-shadow 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.swap-card:hover .swap-card-inner,
.swap-card:focus-visible .swap-card-inner {
  translate: 0 -18px;
  border-color: rgb(163 78 139 / 0.7);
  box-shadow: 0 44px 70px -30px rgb(6 2 12 / 0.9);
}

.swap-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}

.swap-arrow {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: 400 1.15rem/1 var(--font-display);
  cursor: pointer;
  transition: border-color 0.3s ease, background-color 0.3s ease, translate 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.swap-arrow:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.swap-arrow[data-swap="-1"]:hover {
  translate: -3px 0;
}

.swap-arrow[data-swap="1"]:hover {
  translate: 3px 0;
}

.swap-arrow:active {
  scale: 0.92;
}

.swap-count {
  min-width: 4.5em;
  text-align: center;
  font: 400 0.95rem var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.swap-card-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font: 500 0.8rem/1 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.swap-card-bar::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pink);
}

.swap-card img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: cover;
  object-position: top;
}

.swap-card-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 48px 20px 18px;
  background: linear-gradient(rgb(18 5 31 / 0), rgb(18 5 31 / 0.88) 32%, rgb(18 5 31 / 0.97));
}

.swap-card-title {
  display: block;
  font: 500 1.2rem/1.25 var(--font-display);
}

.swap-card-text {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--muted);
}

.swap-card:focus-visible {
  outline-offset: 4px;
  border-radius: 16px;
}

@media (max-width: 820px) {
  .resources-home .wrap {
    grid-template-columns: 1fr;
  }

  .card-swap {
    --card-w: min(340px, 74vw);
    height: calc(var(--card-w) * 1.2);
  }

  .swap-card-body {
    padding: 36px 16px 14px;
  }

  .swap-card-title {
    font-size: 1rem;
  }

  .swap-card-text {
    display: none;
  }
}
/* ---------- Newsletter ---------- */

.newsletter {
  padding-bottom: 0;
  overflow: hidden;
}

.newsletter-form {
  max-width: 420px;
  margin-inline: auto;
  display: grid;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.field label {
  display: block;
  font: 500 1rem var(--font-display);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.field input::placeholder {
  color: #7d7090;
}

.field input:focus-visible {
  outline-offset: 1px;
  border-radius: 999px;
  border-color: var(--accent);
}

.newsletter-form .btn {
  justify-self: center;
  margin-top: 6px;
}

/* Spam trap: invisible to people, tempting to bots. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.form-note {
  min-height: 1.6em;
  margin: 0;
  text-align: center;
  color: var(--lavender);
  font-weight: 500;
}

.ground {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: -40px;
  padding-inline: var(--gutter);
  max-width: 1240px;
  margin-inline: auto;
}

.ground .nilly {
  width: clamp(90px, 15vw, 170px);
  margin-bottom: 6px;
}

.stargazers {
  display: flex;
  align-items: flex-end;
  margin-bottom: 4px;
}

.stargazers .sunny {
  width: clamp(90px, 14vw, 160px);
  margin-right: -14px;
}

.stargazers .telescope {
  width: clamp(80px, 13vw, 150px);
  height: auto;
  cursor: grab;
  touch-action: none;
}

.stargazers .telescope.is-dragging {
  cursor: grabbing;
}

.stargazers .telescope:focus-visible {
  outline-offset: 0;
}

/* The tube pivots on the tripod head; --tilt is set by js/main.js. */
.telescope-tube {
  transform-box: view-box;
  transform-origin: 82px 84px;
  transform: rotate(calc(var(--tilt, 30) * -1deg));
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.is-dragging .telescope-tube {
  transition-duration: 0.15s;
}

.grass {
  position: relative;
  height: 46px;
  margin-top: -30px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='46'%3E%3Cpath d='M0 46V26l8-14 6 16 8-22 8 24 8-14 8 14 10-22 6 20 8-14 10 12v20z' fill='%234e9aa3'/%3E%3C/svg%3E") 0 100% / 80px 46px repeat-x,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='110' height='46'%3E%3Cpath d='M0 46V20l10-16 9 20 12-18 11 22 13-24 10 22 12-16 11 18 12-14 10 10v16z' fill='%233a7a82'/%3E%3C/svg%3E") 30px 60% / 110px 46px repeat-x;
}

@media (max-width: 640px) {
  .ground {
    margin-top: 24px;
  }
}

/* ---------- Footer ---------- */

/* The footer is the ground the eggs stand on: same teal as the grass.
   Night text, since cream on teal is too low-contrast. */
.site-footer {
  background: var(--teal);
  color: var(--night);
  padding-block: 36px 44px;
}

.site-footer h2,
.site-footer a,
.site-footer a:hover {
  color: var(--night);
}

.site-footer a {
  text-decoration-color: var(--night);
}

.site-footer a:hover {
  text-decoration-thickness: 3px;
}

.site-footer :focus-visible {
  outline-color: var(--night);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px 48px;
}

.site-footer h2 {
  font-size: 1.5rem;
  margin-bottom: 0.3em;
}

.site-footer p {
  margin: 0 0 0.4em;
  max-width: 30em;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.site-footer a {
  font-weight: 500;
}

.footer-small {
  font-size: 0.95rem;
  opacity: 0.9;
}

/* ---------- Resources page ---------- */

.page-head {
  position: relative;
  padding-block: clamp(48px, 8vw, 96px) clamp(24px, 4vw, 40px);
  overflow: hidden;
}

.page-head .wrap {
  position: relative;
  z-index: 2;
}

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 1.4em 0 0;
}

.jump a {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: 400 0.95rem var(--font-display);
  text-decoration: none;
}

.jump a:hover {
  border-color: var(--accent);
}

.resource-section {
  padding-block: clamp(36px, 6vw, 72px);
  border-top: 1px solid var(--line);
}

.piece {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(20px, 4vw, 48px);
  align-items: start;
  margin-top: clamp(32px, 5vw, 56px);
}

.piece-text {
  max-width: 38em;
}

.piece-text h3 {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
}

.piece-text h4 {
  font: 500 1.15rem var(--font-display);
  margin: 1.2em 0 0.3em;
  color: var(--lavender);
}

.piece-text dl {
  margin: 0;
}

.piece-text dt {
  font: 500 1.05rem var(--font-display);
  color: var(--text);
  margin-top: 0.9em;
}

.piece-text dd {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .piece {
    grid-template-columns: 1fr;
  }

  .piece .zoom {
    max-width: 420px;
  }
}

.zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.zoom:hover {
  transform: scale(1.01);
  border-color: var(--accent);
}

.zoom:focus-visible {
  border-radius: 18px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: clamp(24px, 4vw, 40px) 0 0;
}

@media (max-width: 460px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

/* ---------- Lightbox ---------- */

.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  max-width: min(96vw, 1000px);
  max-height: 96vh;
  overflow: visible;
}

.lightbox::backdrop {
  background: rgb(18 5 31 / 0.94);
}

.lightbox img {
  max-width: 100%;
  max-height: calc(96vh - 110px);
  width: auto;
  margin-inline: auto;
  border-radius: 14px;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 12px;
}

.lightbox-bar button {
  min-width: 44px;
  min-height: 44px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: 500 1rem var(--font-display);
  cursor: pointer;
}

.lightbox-bar button:hover {
  border-color: var(--accent);
}

.lightbox-count {
  font: 400 1rem var(--font-hand);
  min-width: 4em;
  text-align: center;
}

/* ---------- Motion (GSAP, see js/motion.js) ---------- */

/* Held back until the intro timeline reveals it. */
.has-motion .hero-copy,
.has-motion .hero-scene,
.has-motion .page-head .wrap {
  visibility: hidden;
}

/* GSAP drives these transforms; CSS hover transforms would fight it. */
.has-motion .btn,
.has-motion .card {
  transition: none;
}

.has-motion .btn:hover,
.has-motion a.card:hover {
  transform: none;
}

.has-motion a.card::before {
  transition: border-color 0.4s ease;
}

/* Page curtain: covers the page until the intro starts, and again on the
   way out to another page. GSAP drives --curtain. */
.has-motion::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  background: var(--bg-deep);
  opacity: var(--curtain, 1);
}

.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  transform-origin: left;
  pointer-events: none;
}

/* Soft pink spotlight that follows the cursor across a card. */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 20px;
  pointer-events: none;
  opacity: var(--glow, 0);
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgb(163 78 139 / 0.16), transparent 65%);
}

.btn-label {
  display: inline-block;
}

/* Headline line masks: a little room so descenders aren't clipped. */
[class$="line-mask"] {
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
}

.shooting-star {
  position: absolute;
  top: 0;
  left: 0;
  width: 130px;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgb(251 244 211 / 0), rgb(251 244 211 / 0.9));
  transform-origin: right center;
  pointer-events: none;
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}