/*
 * KeyPip site styles.
 *
 * The tokens below are the app's own (packages/KeyPipDesign/Sources/KeyPipDesign/KPColor.swift,
 * docs/VISUAL_SYSTEM.md). Nothing here invents a colour, a radius or a lift: the site is the same
 * sunny paper-cut world the game is, seen on a page instead of a screen. Keep it that way.
 */

/* ---------------------------------------------------------------- tokens */

:root {
  /* Ground */
  --kp-sun: #ffd84d;
  --kp-sun-deep: #f5c62e;
  --kp-cloud: #ffe47f;
  --kp-paper: #fff7e0;
  --kp-ink: #20302b;

  /* The four inks. Never invent a fifth. */
  --kp-ink-soft: rgba(32, 48, 43, 0.6);
  --kp-ink-faint: rgba(32, 48, 43, 0.3);
  --kp-ink-ghost: rgba(32, 48, 43, 0.13);
  --kp-scrim: rgba(32, 48, 43, 0.38);
  --kp-shadow-ambient: rgba(32, 48, 43, 0.22);

  /* Action and reward */
  --kp-grass: #20b967;
  --kp-grass-shade: #178d4f;
  --kp-gold: #ffc531;
  --kp-gold-shade: #d9930f;

  /* The letter wheel */
  --kp-coral: #f2695c;
  --kp-coral-shade: #cd4a3f;
  --kp-sky: #55b3e4;
  --kp-sky-shade: #3286ba;
  --kp-leaf: #6dc24b;
  --kp-leaf-shade: #4c9a2f;
  --kp-sunflower: #f79728;
  --kp-sunflower-shade: #c47108;
  --kp-berry: #b784e0;
  --kp-berry-shade: #8f5eb8;

  /* Space scale */
  --kp-space-1: 4px;
  --kp-space-2: 8px;
  --kp-space-3: 12px;
  --kp-space-4: 16px;
  --kp-space-5: 24px;
  --kp-space-6: 32px;
  --kp-space-7: 48px;
  --kp-space-8: 64px;

  /* Radii and lifts */
  --kp-radius-tile: 18px;
  --kp-radius-panel: 26px;
  --kp-lift-1: 3px;
  --kp-lift-2: 5px;
  --kp-lift-3: 8px;

  --kp-settle: cubic-bezier(0.22, 1, 0.36, 1);
  --kp-lid: cubic-bezier(0.4, 0, 0.2, 1);

  color-scheme: light;
}

/*
 * Nunito is the identity, not a preference (docs/LETTER_SYSTEM.md 2). The variable file carries the
 * whole weight axis, so 600 body text and 900 letter objects come out of one 55 kB download.
 */
@font-face {
  font-family: 'Nunito';
  src: url('/assets/fonts/nunito-var.woff2') format('woff2-variations');
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------------- reset */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--kp-sun);
  color: var(--kp-ink);
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-color: var(--kp-ink-faint);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 2px;
}

a:hover {
  text-decoration-color: var(--kp-grass);
}

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

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

.kp-skip {
  position: absolute;
  top: var(--kp-space-3);
  left: var(--kp-space-3);
  z-index: 40;
  padding: var(--kp-space-2) var(--kp-space-4);
  border-radius: 999px;
  background: var(--kp-paper);
  font-weight: 800;
  transform: translateY(-200%);
}

.kp-skip:focus {
  transform: none;
}

/* ---------------------------------------------------------------- type roles */

.kp-display,
.kp-headline,
.kp-label {
  text-transform: uppercase;
  margin: 0;
}

.kp-display {
  font-size: clamp(43px, 7.4vw, 74px);
  font-weight: 850;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.kp-headline {
  font-size: clamp(26px, 3.6vw, 38px);
  font-weight: 800;
  line-height: 1.1;
}

.kp-label {
  font-size: clamp(16px, 1.5vw, 18.4px);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.kp-body {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.55;
}

.kp-caption {
  font-size: 13.6px;
  font-weight: 650;
  line-height: 1.35;
  color: var(--kp-ink-soft);
}

.kp-lede {
  font-size: clamp(18px, 2.1vw, 21px);
  font-weight: 650;
  line-height: 1.5;
  color: var(--kp-ink-soft);
  max-width: 40ch;
}

/* An eyebrow legend with its grass dot, straight off the settings groups. */
.kp-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--kp-space-2);
  margin: 0 0 var(--kp-space-3);
  color: var(--kp-grass-shade);
  font-size: 13.6px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.kp-eyebrow::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--kp-grass);
  flex: none;
}

/* ---------------------------------------------------------------- layout */

.kp-page {
  position: relative;
  z-index: 1;
}

.kp-wrap {
  width: min(1080px, 100% - var(--kp-space-6));
  margin-inline: auto;
}

.kp-wrap--narrow {
  width: min(720px, 100% - var(--kp-space-6));
}

.kp-section {
  padding-block: clamp(48px, 8vh, 96px);
}

/* ---------------------------------------------------------------- the world */

/*
 * The scenery is drawn once, behind everything, and runs to the physical edges
 * (docs/VISUAL_SYSTEM.md 4b). It is decor: aria-hidden, never interactive.
 */
.kp-scenery {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.kp-scenery svg {
  position: absolute;
  display: block;
}

/* The atmosphere layer: generated cloud below the threshold at which anything reads as a shape. */
.kp-atmosphere {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.kp-atmosphere__band {
  position: absolute;
  left: 0;
  width: 200%;
  height: 100%;
  animation: kp-atmosphere-drift linear infinite;
}

.kp-atmosphere__band--far {
  animation-duration: 372s;
  animation-delay: -120s;
}

.kp-atmosphere__band--mid {
  animation-duration: 214s;
  animation-delay: -60s;
}

.kp-atmosphere__band--low {
  animation-duration: 288s;
  animation-delay: -200s;
}

@keyframes kp-atmosphere-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.kp-sun {
  top: -2vh;
  left: -3vw;
  width: clamp(120px, 21vw, 200px);
}

.kp-sun__disc {
  transform-box: view-box;
  transform-origin: 0 0;
  fill: var(--kp-cloud);
  opacity: 0.85;
  animation: kp-sun-breathe 11s ease-in-out infinite;
}

.kp-sun__rays {
  transform-box: view-box;
  transform-origin: 0 0;
  fill: var(--kp-cloud);
  opacity: 0.55;
  animation: kp-sun-shimmer 17s ease-in-out infinite;
}

@keyframes kp-sun-breathe {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 0.95; transform: scale(1.035); }
}

@keyframes kp-sun-shimmer {
  0%, 100% { opacity: 0.5; transform: rotate(-3.5deg); }
  50% { opacity: 0.62; transform: rotate(3.5deg); }
}

.kp-cloud path {
  fill: var(--kp-cloud);
}

.kp-cloud--high {
  top: 6%;
  left: 0;
  width: clamp(124px, 21vw, 210px);
  transform: translateX(66vw);
  opacity: 0.6;
  animation: kp-cloud-drift 96s linear -31s infinite;
}

.kp-cloud--low {
  top: 47%;
  left: 0;
  width: clamp(96px, 15vw, 152px);
  transform: translateX(6vw);
  opacity: 0.36;
  animation: kp-cloud-drift 134s linear -78s infinite;
}

@keyframes kp-cloud-drift {
  from { transform: translateX(-130%); }
  to { transform: translateX(calc(100vw + 30%)); }
}

.kp-butterfly {
  top: 21%;
  right: 8vw;
  width: clamp(30px, 5.2vw, 46px);
  animation: kp-butterfly-float 17s ease-in-out infinite;
}

.kp-butterfly__wings {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  fill: var(--kp-sky);
  animation: kp-butterfly-flutter 2.9s ease-in-out infinite;
}

.kp-butterfly__body {
  fill: var(--kp-ink);
  opacity: 0.7;
}

@keyframes kp-butterfly-float {
  0%, 100% { transform: translate(0, 0) rotate(-3deg); }
  32% { transform: translate(-1.7vw, -15px) rotate(4deg); }
  68% { transform: translate(1.2vw, -6px) rotate(-1deg); }
}

@keyframes kp-butterfly-flutter {
  0%, 100% { transform: scaleX(1); }
  50% { transform: scaleX(0.74); }
}

.kp-bird {
  top: 5%;
  left: 0;
  width: clamp(34px, 5vw, 52px);
  opacity: 0.5;
  animation: kp-bird-glide 128s linear -40s infinite;
}

.kp-bird__body { fill: var(--kp-coral); }
.kp-bird__wing { fill: var(--kp-coral-shade); }
.kp-bird__eye { fill: var(--kp-ink); }

@keyframes kp-bird-glide {
  from { transform: translate(-140%, 0); }
  25% { transform: translate(25vw, -9px); }
  50% { transform: translate(50vw, 5px); }
  75% { transform: translate(75vw, -7px); }
  to { transform: translate(calc(100vw + 40%), 0); }
}

/*
 * The ground band: two stacked rises with a little planting. One piece of scenery, and it belongs
 * at the foot of the document rather than pinned to the viewport, so it reads as the floor the page
 * stands on instead of a strip sliding under the middle of it. The footer reserves its height in
 * its own bottom padding.
 */
.kp-ground {
  position: absolute;
  z-index: 0;
  right: 0;
  bottom: 0;
  left: 0;
  height: clamp(96px, 17vh, 210px);
  pointer-events: none;
}

.kp-hill {
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.kp-hill--back path {
  fill: var(--kp-sun-deep);
  opacity: 0.6;
}

.kp-hill--front path {
  fill: color-mix(in srgb, var(--kp-sun-deep) 84%, var(--kp-grass));
  opacity: 0.92;
}

.kp-tuft path {
  fill: color-mix(in srgb, var(--kp-sun-deep) 58%, var(--kp-grass-shade));
}

.kp-tuft,
.kp-flower,
.kp-sprout {
  transform-origin: 50% 100%;
  animation: kp-decor-sway 9.5s ease-in-out infinite;
}

@keyframes kp-decor-sway {
  0%, 100% { transform: rotate(calc(var(--sway, 2.4deg) * -1)); }
  50% { transform: rotate(var(--sway, 2.4deg)); }
}

.kp-tuft--one {
  --sway: 2deg;
  bottom: clamp(38px, 7vh, 86px);
  left: 3vw;
  width: 132px;
  opacity: 0.55;
}

.kp-tuft--two {
  --sway: 2.6deg;
  bottom: clamp(44px, 8vh, 96px);
  left: 31vw;
  width: 112px;
  opacity: 0.5;
  animation-duration: 11.5s;
  animation-delay: -3.4s;
}

.kp-tuft--three {
  --sway: 2.2deg;
  bottom: clamp(40px, 7.4vh, 90px);
  right: 6vw;
  width: 124px;
  opacity: 0.5;
  animation-duration: 10.8s;
  animation-delay: -6.1s;
}

.kp-flower__petals { fill: var(--shape-fill); }
.kp-flower__eye { fill: var(--kp-gold); }

.kp-flower--one {
  --sway: 3.4deg;
  --shape-fill: var(--kp-coral);
  bottom: clamp(28px, 5.2vh, 66px);
  left: 17vw;
  width: clamp(26px, 4.4vw, 40px);
  animation-duration: 8.2s;
  animation-delay: -1.9s;
}

.kp-flower--two {
  --sway: 3deg;
  --shape-fill: var(--kp-berry);
  bottom: clamp(40px, 7.2vh, 90px);
  left: 58vw;
  width: clamp(22px, 3.8vw, 34px);
  animation-duration: 10.4s;
  animation-delay: -5.1s;
}

.kp-sprout__stem { fill: var(--kp-leaf-shade); opacity: 0.75; }
.kp-sprout__leaves { fill: var(--kp-leaf); }

.kp-sprout--one {
  --sway: 3.8deg;
  bottom: clamp(24px, 4.6vh, 58px);
  left: 41vw;
  width: clamp(22px, 3.8vw, 36px);
  animation-duration: 12.5s;
  animation-delay: -7.2s;
}

/* ---------------------------------------------------------------- letter objects */

/*
 * A letter is one glyph that is also a small creature: the fill glyph, an identical shade glyph
 * offset 0.055em straight down, and eyes at hand-tuned per-glyph offsets on top
 * (docs/LETTER_SYSTEM.md 1). Everything is em-relative, so one rule serves every size.
 */
.kp-word {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.035em;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.kp-tile {
  position: relative;
  display: grid;
  place-items: center;
  color: var(--lc, var(--kp-ink-ghost));
  transform: rotate(var(--tile-tilt, 0deg)) translateY(var(--tile-lift, 0));
}

.kp-tile--lit {
  text-shadow: 0 0.055em 0 var(--lcs);
}

/*
 * A waiting letter is the ink ghost with no shade and no card: it is there, it is asleep, and it
 * gives nothing of the answer away. Its colour is already assigned; it simply is not wearing it
 * yet (docs/LETTER_SYSTEM.md 5).
 */
.kp-tile--waiting {
  color: var(--kp-ink-ghost);
  text-shadow: none;
}

.kp-tile--c0 { --lc: var(--kp-coral); --lcs: var(--kp-coral-shade); }
.kp-tile--c1 { --lc: var(--kp-sky); --lcs: var(--kp-sky-shade); }
.kp-tile--c2 { --lc: var(--kp-leaf); --lcs: var(--kp-leaf-shade); }
.kp-tile--c3 { --lc: var(--kp-sunflower); --lcs: var(--kp-sunflower-shade); }
.kp-tile--c4 { --lc: var(--kp-berry); --lcs: var(--kp-berry-shade); }

.kp-tile__glyph {
  position: relative;
  display: grid;
  place-items: center;
}

.kp-eyes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.kp-eye-position {
  position: absolute;
  top: 50%;
  left: 50%;
  display: inline-flex;
  width: 0.14em;
  height: 0.14em;
}

.kp-eye {
  display: block;
  overflow: visible;
  filter: drop-shadow(0 0.008em 0 var(--kp-ink-ghost));
}

.kp-tile--waiting .kp-eye {
  opacity: 0.48;
}

/* ---------------------------------------------------------------- the hero */

.kp-hero {
  display: grid;
  justify-items: center;
  text-align: center;
  padding-top: clamp(40px, 9vh, 96px);
  padding-bottom: clamp(32px, 6vh, 72px);
}

.kp-pip {
  width: clamp(132px, 19vw, 190px);
  margin-bottom: clamp(4px, 1.4vh, 14px);
}

.kp-pip svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Pip floats gently: 7 pt over 3.2 s at his welcome size (docs/PIP_CHARACTER.md 4). */
#pip {
  animation: kp-pip-float 3.2s ease-in-out infinite;
}

@keyframes kp-pip-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3.9%); }
}

.kp-wordmark {
  font-size: clamp(45px, 14vw, 102px);
  margin-bottom: clamp(16px, 3vh, 30px);
}

@media (max-width: 600px) {
  .kp-wordmark {
    font-size: clamp(45px, 17vw, 67px);
  }

  /* Compact tightens the decor too: the butterfly keeps out of the lockup's way. */
  .kp-butterfly {
    top: 7%;
    right: 3vw;
  }
}

/* The status pill. Paper, not gold: a reward colour is never a label. */
.kp-status {
  display: inline-flex;
  align-items: center;
  gap: var(--kp-space-2);
  padding: 9px var(--kp-space-4) 9px var(--kp-space-3);
  border-radius: 999px;
  background: var(--kp-paper);
  box-shadow: 0 var(--kp-lift-1) 0 var(--kp-sun-deep);
  color: var(--kp-ink);
  font-size: 13.6px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: clamp(16px, 3vh, 28px);
}

.kp-status__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--kp-grass);
  flex: none;
  animation: kp-status-pulse 2.6s ease-in-out infinite;
}

@keyframes kp-status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.82); }
}

.kp-hero__lede {
  margin: 0 auto clamp(24px, 4vh, 36px);
  max-width: 34ch;
  text-align: center;
}

/* ---------------------------------------------------------------- chunky objects */

/*
 * The chunky-object recipe (docs/VISUAL_SYSTEM.md 3): flat fill, a solid shadow of the object's
 * shade offset straight down by the lift, zero blur. On press the object sits down: it moves down
 * by the lift and the shadow goes to nothing.
 */
.kp-button {
  --lift: var(--kp-lift-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--kp-space-2);
  min-height: 56px;
  padding: var(--kp-space-3) var(--kp-space-6);
  border: 0;
  border-radius: var(--kp-radius-tile);
  background: var(--kp-grass);
  box-shadow: 0 var(--lift) 0 var(--kp-grass-shade);
  color: #ffffff;
  font: inherit;
  font-size: clamp(16px, 1.5vw, 18.4px);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 90ms var(--kp-lid), box-shadow 90ms var(--kp-lid), background-color 120ms linear;
}

.kp-button:hover {
  background: color-mix(in srgb, var(--kp-grass) 94%, var(--kp-ink));
}

.kp-button:active {
  transform: translateY(var(--lift));
  box-shadow: 0 0 0 var(--kp-grass-shade);
}

.kp-button--quiet {
  background: var(--kp-paper);
  box-shadow: 0 var(--lift) 0 color-mix(in srgb, var(--kp-paper) 58%, var(--kp-sun-deep));
  color: var(--kp-ink);
}

.kp-button--quiet:hover {
  background: color-mix(in srgb, var(--kp-paper) 94%, var(--kp-ink));
}

.kp-button--quiet:active {
  box-shadow: 0 0 0 color-mix(in srgb, var(--kp-paper) 58%, var(--kp-sun-deep));
}

.kp-button__sub {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.82;
}

.kp-button__stack {
  display: grid;
  gap: 2px;
  text-align: left;
}

.kp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kp-space-4);
  justify-content: center;
  align-items: center;
}

/* Store slots. Hidden until the config says we have shipped. */
.kp-stores {
  display: none;
  flex-wrap: wrap;
  gap: var(--kp-space-4);
  justify-content: center;
}

.kp-stores[data-live='true'] {
  display: flex;
}

.kp-stores-soon {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kp-space-3);
  justify-content: center;
}

.kp-stores-soon[hidden] {
  display: none;
}

.kp-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--kp-space-2);
  padding: 10px var(--kp-space-4);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 0 2px var(--kp-ink-ghost);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--kp-ink-soft);
}

.kp-chip svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  flex: none;
}

/* ---------------------------------------------------------------- panels */

.kp-panel {
  position: relative;
  border-radius: var(--kp-radius-panel);
  background: var(--kp-paper);
  padding: clamp(24px, 3.4vw, 40px);
  box-shadow: 0 var(--kp-lift-3) 0 var(--kp-sun-deep), 0 18px 34px -18px var(--kp-shadow-ambient);
}

.kp-cards {
  display: grid;
  gap: var(--kp-space-5);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.kp-card {
  border-radius: var(--kp-radius-panel);
  background: var(--kp-paper);
  padding: clamp(22px, 2.6vw, 32px);
  box-shadow: 0 var(--kp-lift-2) 0 var(--kp-sun-deep);
}

.kp-card h3 {
  margin: 0 0 var(--kp-space-2);
  font-size: 21px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.kp-card p {
  margin: 0;
  color: var(--kp-ink-soft);
  font-size: 16px;
  line-height: 1.5;
}

.kp-card__mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--kp-space-4);
  border-radius: var(--kp-radius-tile);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 var(--kp-lift-1) 0 var(--kp-ink-ghost);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

/* The tick list on the grown-ups panel. */
.kp-ticks {
  display: grid;
  gap: var(--kp-space-3);
  margin: 0;
  padding: 0;
  list-style: none;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.kp-ticks li {
  display: flex;
  gap: var(--kp-space-3);
  align-items: flex-start;
  font-size: 16px;
  font-weight: 650;
}

.kp-ticks li::before {
  content: '';
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--kp-grass) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round' d='M5 12.5l4.6 4.6L19 7.6'/%3E%3C/svg%3E") center / 15px 15px no-repeat;
  box-shadow: 0 2px 0 var(--kp-grass-shade);
}

/* ---------------------------------------------------------------- the demo word */

.kp-demo {
  display: grid;
  justify-items: center;
  gap: var(--kp-space-4);
  padding-block: clamp(20px, 3vh, 34px);
}

.kp-demo__word {
  font-size: clamp(46px, 11vw, 104px);
  min-height: 1.35em;
  align-items: center;
}

.kp-demo .kp-tile {
  min-width: 0.68em;
  height: 1.28em;
  padding: 0 0.035em;
  border-radius: 0.16em;
}

.kp-demo .kp-tile--active {
  background: rgba(255, 255, 255, 0.55);
  animation: kp-letter-breathe 2.4s ease-in-out infinite;
}

/* The one geometric motion the play word keeps (KP-D-046). */
@keyframes kp-letter-breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.045em); }
}

.kp-demo__caption {
  color: var(--kp-ink-soft);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- footer */

.kp-footer {
  position: relative;
  z-index: 1;
  overflow: hidden;
  margin-top: clamp(24px, 3vh, 48px);
  padding-top: clamp(32px, 5vh, 56px);
  padding-bottom: clamp(150px, 22vh, 260px);
}

.kp-footer > .kp-wrap {
  position: relative;
  z-index: 2;
}

.kp-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kp-space-5);
  align-items: flex-start;
  justify-content: space-between;
  padding-top: clamp(24px, 3vh, 32px);
  border-top: 2px solid var(--kp-ink-ghost);
}

.kp-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kp-space-2) var(--kp-space-5);
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 750;
}

/* Pip peeks over the crest of the front rise, the way he peeks over a sticker book page. */
.kp-footer__peek {
  position: absolute;
  z-index: 1;
  right: clamp(16px, 8vw, 130px);
  bottom: clamp(74px, 11vh, 128px);
  width: clamp(110px, 15vw, 180px);
  height: auto;
  transform: rotate(5deg);
  pointer-events: none;
}

/* ---------------------------------------------------------------- documents */

.kp-doc {
  padding-block: clamp(28px, 5vh, 56px);
}

.kp-doc .kp-panel {
  padding: clamp(26px, 4vw, 56px);
}

.kp-doc h1 {
  margin: 0 0 var(--kp-space-3);
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.kp-doc h2 {
  margin: clamp(28px, 4vh, 40px) 0 var(--kp-space-3);
  font-size: 21px;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.kp-doc h3 {
  margin: var(--kp-space-5) 0 var(--kp-space-2);
  font-size: 17px;
  font-weight: 800;
}

.kp-doc p,
.kp-doc li {
  font-size: 16.5px;
  line-height: 1.6;
}

.kp-doc ul,
.kp-doc ol {
  padding-left: 1.3em;
}

.kp-doc li + li {
  margin-top: var(--kp-space-2);
}

.kp-doc__meta {
  margin: 0 0 var(--kp-space-5);
  color: var(--kp-ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.kp-doc__toc {
  margin: 0 0 var(--kp-space-6);
  padding: var(--kp-space-4) var(--kp-space-5);
  border-radius: var(--kp-radius-tile);
  background: rgba(255, 216, 77, 0.28);
  font-size: 15px;
}

.kp-doc__toc ol {
  margin: var(--kp-space-2) 0 0;
  columns: 2;
  column-gap: var(--kp-space-6);
}

@media (max-width: 560px) {
  .kp-doc__toc ol { columns: 1; }
}

/* The masthead that carries the small wordmark on document pages. */
.kp-masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--kp-space-4);
  padding-block: var(--kp-space-5);
}

.kp-masthead a {
  text-decoration: none;
}

.kp-masthead .kp-word {
  font-size: 30px;
}

.kp-masthead__back {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--kp-ink-soft);
}

/* ---------------------------------------------------------------- contact */

/*
 * The address is never written out in the markup. `site.js` assembles it from parts at runtime,
 * so a crawler reading the HTML finds no mailbox to harvest. Without scripting the reader still
 * gets a spelled-out fallback they can type.
 */
.kp-mail {
  font-weight: 800;
  white-space: nowrap;
}

.kp-mail__spelled::after {
  content: attr(data-user) ' at ' attr(data-domain);
}

/* ---------------------------------------------------------------- consent */

.kp-consent {
  position: fixed;
  z-index: 30;
  right: var(--kp-space-4);
  bottom: var(--kp-space-4);
  left: var(--kp-space-4);
  margin-inline: auto;
  max-width: 560px;
  padding: var(--kp-space-5);
  border-radius: var(--kp-radius-panel);
  background: var(--kp-paper);
  box-shadow: 0 var(--kp-lift-3) 0 var(--kp-sun-deep), 0 24px 44px -20px var(--kp-shadow-ambient);
}

.kp-consent[hidden] {
  display: none;
}

.kp-consent p {
  margin: 0 0 var(--kp-space-4);
  font-size: 15px;
  line-height: 1.5;
}

.kp-consent__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kp-space-3);
}

.kp-consent .kp-button {
  min-height: 46px;
  padding-inline: var(--kp-space-5);
  font-size: 15px;
}

/* ---------------------------------------------------------------- reduced motion */

/*
 * Reduce Motion parks every ambient loop at its resting pose. A blink is state, not decoration,
 * so the eyes keep blinking; nothing wanders (docs/VISUAL_SYSTEM.md 8).
 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .kp-atmosphere__band,
  .kp-cloud--high,
  .kp-cloud--low,
  .kp-bird,
  .kp-butterfly,
  .kp-butterfly__wings,
  .kp-sun__disc,
  .kp-sun__rays,
  .kp-tuft,
  .kp-flower,
  .kp-sprout,
  .kp-status__dot,
  #pip,
  .kp-demo .kp-tile--active {
    animation: none !important;
  }

  .kp-bird { display: none; }
}

/* ---------------------------------------------------------------- eye motion */

/*
 * Gaze eases over 500 ms on the settle curve: a fast start and a long soft deceleration. Lids run
 * at 90 ms a phase on the standard curve. Both are set here rather than per eye so the engine only
 * ever writes a transform (docs/LETTER_SYSTEM.md 4).
 */
.kp-eye__lens {
  transition: transform 500ms var(--kp-settle);
}

.kp-eye__lid {
  transition: transform 90ms var(--kp-lid);
}

/* ---------------------------------------------------------------- composition helpers */

/*
 * A short, named set for the handful of arrangements the pages need. The site's
 * Content-Security-Policy allows no inline style, so every one of these has to be a class, and a
 * name that says what it is for beats a pile of one-declaration utilities.
 */

/* The rig declares its pivot inline in the shipped artwork; the inlined copy takes the same two
 * numbers from here instead, so no style attribute has to survive the policy. */
#pip {
  transform-box: view-box;
  transform-origin: 180px 286px;
}

.kp-centred {
  text-align: center;
}

.kp-eyebrow--centred {
  justify-content: center;
}

.kp-soft {
  color: var(--kp-ink-soft);
}

/* The line under the hero's action. */
.kp-hero__note {
  max-width: 34ch;
  margin: var(--kp-space-3) auto 0;
}

/* A centred introduction above a section's content. */
.kp-section__intro {
  max-width: 44ch;
  margin-inline: auto;
  text-align: center;
}

.kp-section__intro .kp-lede {
  margin: var(--kp-space-4) auto 0;
}

.kp-section__title {
  margin-bottom: clamp(20px, 3vh, 28px);
}

/* Colour marks on the three how-it-plays cards. */
.kp-card__mark--sky { color: var(--kp-sky); }
.kp-card__mark--gold { color: var(--kp-gold); }
.kp-card__mark--letter {
  color: var(--kp-coral);
  text-shadow: 0 0.055em 0 var(--kp-coral-shade);
}

/* Copy inside a paper panel. */
.kp-panel__lede {
  max-width: 56ch;
  margin: 0 0 var(--kp-space-4);
  color: var(--kp-ink-soft);
}

.kp-panel__body {
  max-width: 46ch;
  margin: var(--kp-space-4) auto 0;
  color: var(--kp-ink-soft);
}

.kp-panel__note {
  max-width: 62ch;
  margin-top: clamp(20px, 3vh, 28px);
}

.kp-panel .kp-ticks {
  margin-top: clamp(20px, 3vh, 28px);
}

/* A button standing on its own under a block of copy. */
.kp-cta {
  margin: clamp(20px, 3vh, 28px) 0 0;
}

.kp-cta--tight {
  margin-top: var(--kp-space-4);
}

/* The footer's two columns. */
.kp-footer__address {
  margin: 0 0 var(--kp-space-2);
}

.kp-footer__fine {
  margin: 0;
}

.kp-footer__legal {
  margin: var(--kp-space-4) 0 0;
}

/* Document pages. */
.kp-doc__intro {
  max-width: none;
}

.kp-doc__contact {
  margin: 0;
}
