/* The Nest — Calming Morning Sky: Houston's growth portraits, the serene hawk card, the
   luminous morning sky of soaring hawks, and the gentle celebration when Houston grows.

   Custom properties a screen may set around these:
     --hawk-disc   the pale sky medallion behind a hawkArt picture that has no frame around it
                   (set to none on a sky of your own); framed pictures use --hawk-well instead
*/

/* ---------- Houston portraits (hawkArt) ----------
   Inside a frame the picture itself is bare. The frame is a small window of sky drawn by
   the wrapper around it (.hawk-pic beside a name, .hawk-card-art in a hawk card), so it
   is the same in both themes and at every size, whether the picture is an <img> or
   Houston's layered, living figure. The frame is sized by the picture inside it:

     size   frame   picture   corner
     xs     32px    26px      10px
     s      56px    46px      16px
     m      120px   100px     28px
     l      220px   188px     44px
     xl     360px   312px     64px     (shrinks to fit narrow screens)

   A fully grown Houston's frame is sunlit. A picture with no frame around it (the
   celebration) keeps the pale disc of its own. */
.hawk {
  display: block; flex: none; object-fit: contain; object-position: 50% 100%;
  border-radius: 28%;
  background: var(--hawk-disc, radial-gradient(circle at 50% 30%, #fffdf2 0%, #e1f2ff 54%, #c4e4fc 100%));
  box-shadow: inset 0 0 0 1.5px #ffffffcc, 0 4px 12px -6px #1444732e;
}
.hawk-xs { width: 34px; height: 34px; padding: 2px; border-radius: 10px; }
.hawk-s { width: 58px; height: 58px; padding: 3px 3px 2px; border-radius: 16px; }
.hawk-m { width: 122px; height: 122px; padding: 8px 8px 4px; }
.hawk-l { width: 224px; height: 224px; padding: 14px 14px 6px; }
.hawk-xl { width: 360px; height: auto; aspect-ratio: 1; max-width: 100%; padding: 22px 22px 10px; }
.hawk-stage-houston { object-position: 50% 100%; }

.hawk-pic, .hawk-card-art {
  --hawk-pad: 10px; --hawk-corner: 28px;
  position: relative; display: grid; place-items: center; flex: none;
  box-sizing: border-box; max-width: 100%; padding: var(--hawk-pad); line-height: 0;
  border-radius: var(--hawk-corner);
  background: var(--hawk-well);
  box-shadow: inset 0 0 0 1px var(--hawk-well-edge);
}
.hawk-pic:has(> .hawk-xs), .hawk-card-art:has(> .hawk-xs) { --hawk-pad: 3px; --hawk-corner: 10px; }
.hawk-pic:has(> .hawk-s), .hawk-card-art:has(> .hawk-s) { --hawk-pad: 5px; --hawk-corner: 16px; }
.hawk-pic:has(> .hawk-l), .hawk-card-art:has(> .hawk-l) { --hawk-pad: 16px; --hawk-corner: 44px; }
.hawk-pic:has(> .hawk-xl), .hawk-card-art:has(> .hawk-xl) { --hawk-pad: 24px; --hawk-corner: 64px; }
.hawk-pic:has(> .hawk-stage-houston), .hawk-card-art:has(> .hawk-stage-houston) {
  background: var(--hawk-well-sun);
  box-shadow: inset 0 0 0 1px var(--hawk-well-sun-edge);
}
.hawk-pic > .hawk, .hawk-card-art > .hawk { padding: 0; border-radius: 0; background: none; box-shadow: none; }
.hawk-pic > .hawk-xs, .hawk-card-art > .hawk-xs { width: 26px; height: 26px; }
.hawk-pic > .hawk-s, .hawk-card-art > .hawk-s { width: 46px; height: 46px; }
.hawk-pic > .hawk-m, .hawk-card-art > .hawk-m { width: 100px; height: 100px; }
.hawk-pic > .hawk-l, .hawk-card-art > .hawk-l { width: 188px; height: 188px; }
.hawk-pic > .hawk-xl, .hawk-card-art > .hawk-xl { width: 312px; height: auto; }

/* ---------- The hawk card: the picture in its frame, the stage, the meter, one sentence ---------- */
.hawk-card {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5);
  margin: 0; padding: var(--space-3) var(--space-5) var(--space-3) var(--space-3);
  background: var(--surface-quiet);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.hawk-card-stage-houston { border-color: var(--sun-edge); background: var(--sun-surface); }
.hawk-caption { flex: 1 1 180px; display: grid; gap: var(--space-2); min-width: 0; }
.hawk-whose {
  font-size: var(--text-2xs); font-weight: 700; letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--accent-ink);
}
.hawk-stage-name {
  font-family: var(--font-display); font-weight: 600;
  font-variation-settings: "SOFT" 65, "WONK" 0;
  font-size: var(--text-lg); line-height: 1.18; letter-spacing: var(--tracking-display); color: var(--ink);
}
.hawk-line { font-size: var(--text-sm); line-height: var(--leading-snug); color: var(--muted); font-weight: 500; text-wrap: pretty; }

.hawk-card-xs, .hawk-card-s { gap: var(--space-2) var(--space-3); padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2); border-radius: var(--radius-md); }
.hawk-card-xs .hawk-caption, .hawk-card-s .hawk-caption { flex-basis: 140px; gap: var(--space-1); }
.hawk-card-xs .hawk-stage-name, .hawk-card-s .hawk-stage-name { font-size: var(--text-md); }
.hawk-card-xs .hawk-line, .hawk-card-s .hawk-line { font-size: var(--text-xs); }

.hawk-card-l { gap: var(--space-4) var(--space-8); padding: var(--space-5) var(--space-6) var(--space-5) var(--space-5); }
.hawk-card-l .hawk-caption { flex-basis: 240px; gap: var(--space-3); }
.hawk-card-l .hawk-whose { font-size: var(--text-xs); }
.hawk-card-l .hawk-stage-name { font-size: clamp(1.5rem, 3vw, 1.875rem); line-height: 1.12; }
.hawk-card-l .hawk-line { font-size: var(--text-md); color: var(--ink-2); }

.hawk-card-xl { flex-direction: column; align-items: center; gap: var(--space-4); padding: var(--space-6); text-align: center; }
.hawk-card-xl .hawk-caption { flex: none; width: min(460px, 100%); justify-items: center; gap: var(--space-3); }
.hawk-card-xl .hawk-whose { font-size: var(--text-sm); }
.hawk-card-xl .hawk-stage-name { font-size: clamp(1.625rem, 4vw, 2.25rem); line-height: 1.1; }
.hawk-card-xl .hawk-line { font-size: var(--text-lg); color: var(--ink-2); }
.hawk-card-xl .hawk-meter { width: 100%; }

/* Progress toward the next stage: honey twigs laid one per book, or one strand filling. */
.hawk-meter {
  position: relative; display: block; width: 100%; max-width: 320px; height: 12px; overflow: hidden;
  border: 1px solid var(--feather-500); border-radius: var(--radius-pill);
  background: repeating-linear-gradient(118deg, var(--straw-light) 0 5px, var(--straw) 5px 8px);
}
.hawk-meter-fill {
  display: block; height: 100%; border-radius: var(--radius-pill);
  background:
    repeating-linear-gradient(118deg, #ffffff4d 0 4px, transparent 4px 10px),
    linear-gradient(180deg, var(--sun-300), var(--sun-500) 58%, var(--sun-600));
}
.hawk-meter.has-pieces {
  height: auto; overflow: visible; border: 0; background: none;
}
.hawk-meter.has-pieces .hawk-meter-fill { display: none; }
.hawk-meter-pieces { display: flex; gap: var(--space-1); }
.hawk-piece {
  flex: 1 1 0; min-width: 6px; max-width: 40px; height: 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--control-line);
  background: var(--surface);
}
.hawk-piece.is-read {
  border-color: var(--feather-500);
  background:
    repeating-linear-gradient(118deg, #ffffff4d 0 3px, transparent 3px 8px),
    linear-gradient(180deg, var(--sun-300), var(--sun-500) 58%, var(--sun-600));
}
.hawk-meter.is-done { border-color: var(--feather-700); box-shadow: 0 0 0 2px #f9d98266; }
.hawk-card-xs .hawk-meter, .hawk-card-s .hawk-meter, .hawk-card-xs .hawk-piece, .hawk-card-s .hawk-piece { height: 8px; }
.hawk-card-l .hawk-meter, .hawk-card-l .hawk-piece { height: 16px; }
.hawk-card-l .hawk-meter { max-width: 420px; }
.hawk-card-l .hawk-meter-pieces { gap: 6px; }
.hawk-card-xl .hawk-meter, .hawk-card-xl .hawk-piece { height: 20px; }
.hawk-card-xl .hawk-meter { max-width: 460px; }
.hawk-card-xl .hawk-meter-pieces { gap: var(--space-2); justify-content: center; }

/* ---------- The sky strip (skyScene): a small window of morning sky where the class's hawks fly ---------- */
.sky {
  --strip-high: #bddcf8; --strip-mid: #dcedfc; --strip-low: #f4f9ff;
  --strip-hill-far: #c5e2dc; --strip-hill-near: #a9d3c4;
  --egg-base: 10px;
  position: relative; isolation: isolate; overflow: hidden;
  container: sky-art / size;
  height: 112px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--strip-high) 0%, var(--strip-mid) 56%, var(--strip-low) 100%);
  box-shadow: var(--shadow-1);
}
:root[data-theme="night"] .sky {
  --strip-high: #091830; --strip-mid: #11294a; --strip-low: #1a3a63;
  --strip-hill-far: #173a61; --strip-hill-near: #0e2744;
}
/* Two soft hills along the bottom: the ground the caption and the nest rest on. */
.sky::before, .sky::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; z-index: 0;
  background: var(--strip-hill-far);
  height: 30%; clip-path: ellipse(64% 100% at 30% 100%);
  opacity: 0.7;
}
.sky::after {
  background: var(--strip-hill-near);
  height: 22%; clip-path: ellipse(70% 100% at 78% 100%);
  opacity: 0.6;
}
.sky-tall { height: clamp(240px, 42vh, 520px); --egg-base: 16px; }
.sky-art { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

/* A soft morning sun, high on the right; a pale moon after dark. */
.sky-sun {
  position: absolute; right: 8%; top: 13%; z-index: 1;
  width: clamp(24px, 30cqh, 64px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #fffef4 0%, #fdefbd 62%, #f7dc90 100%);
  box-shadow: 0 0 14px 5px #fff5cfb8, 0 0 54px 22px #fff5cf5c;
}
.sky.has-nest .sky-sun { right: auto; left: 60%; }
:root[data-theme="night"] .sky-sun {
  background: radial-gradient(circle at 36% 34%, #fffef6 0%, #f1e8c8 58%, #d8cc9f 100%);
  box-shadow: inset -5px -4px 7px #a89c6e80, 0 0 16px 3px #efe6c23d, 0 0 48px 18px #efe6c21f;
}
/* A few stars, only at night. */
.sky-stars {
  position: absolute; inset: 0; z-index: 0; opacity: 0;
  background:
    radial-gradient(circle at 7% 24%, #f2f7ff 0 1px, transparent 1.7px),
    radial-gradient(circle at 18% 52%, #f2f7ffb3 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 29% 15%, #f2f7ffcc 0 0.9px, transparent 1.6px),
    radial-gradient(circle at 41% 38%, #f2f7ff99 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 52% 12%, #f2f7ff 0 1px, transparent 1.7px),
    radial-gradient(circle at 66% 30%, #f2f7ffb3 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 74% 56%, #f2f7ff8c 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 93% 44%, #f2f7ffcc 0 0.9px, transparent 1.6px);
}
:root[data-theme="night"] .sky-stars { opacity: 1; }

/* Three soft clouds, drifting slowly behind the birds. */
.sky-cloud {
  position: absolute; left: 0; z-index: 1; aspect-ratio: 11 / 5;
  background: url(/art/cloud.svg) center / contain no-repeat;
}
:root[data-theme="night"] .sky-cloud { opacity: 0.14; filter: brightness(0.8) saturate(0.7); }
.sky-cloud-1 { top: 12%; width: clamp(58px, 12cqw, 150px); left: 10%; opacity: 0.9; }
.sky-cloud-2 { top: 40%; width: clamp(46px, 9cqw, 112px); left: 42%; opacity: 0.62; }
.sky-cloud-3 { top: 22%; width: clamp(64px, 14cqw, 170px); left: 70%; opacity: 0.78; }

/* The hawks. A bird is three boxes: .sky-bird crosses the sky, .sky-bird-body rides the air
   (sinking a little as it glides, climbing as it beats), and .sky-bird-cell is a window one
   pose wide onto .sky-bird-wings, the sheet of poses in art/bird.svg (32 across, body line
   54% of the way down). Far birds are smaller, slower and a little lost in the haze. */
.sky-bird {
  position: absolute; left: 0; right: 0; top: var(--y); z-index: 2; height: 0;
  opacity: var(--haze, 1);
}
.sky-bird-body {
  position: absolute; left: var(--x); top: 0; display: block;
  width: var(--w, 42px); aspect-ratio: 4 / 5;
  translate: -50% -54%;
  transform-origin: 56% 54%;
}
.sky-bird-cell { display: block; width: 100%; height: 100%; overflow: hidden; }
.sky-bird-wings {
  display: block; width: 3200%; height: 100%;
  background: url(/art/bird.svg) 0 0 / 100% 100% no-repeat;
  transform: translateX(calc(var(--pose, 0) * -3.125%));
}
:root[data-theme="night"] .sky-bird-wings,
:root[data-theme="night"] .sky-branch,
:root[data-theme="night"] .sky-nest { filter: brightness(0.74) saturate(0.86); }

/* The nest of eggs, on a branch from the right. Its width follows the front row of eggs:
   --cols across, each --egg wide, and never more than 46% of the sky. */
.sky-art {
  --nest-w: min(calc(var(--egg-base) * var(--egg-scale, 1) * (var(--cols, 3) * 1.02 + 1.7)), 46cqw);
  --egg: calc(var(--nest-w) / (var(--cols, 3) * 1.02 + 1.7));
  --nest-h: calc(var(--nest-w) * 0.17 + var(--egg) * 0.62);
  --nest-floor: max(7px, 9cqh);
}
.sky-branch {
  position: absolute; right: 0; bottom: calc(var(--nest-floor) - 1px); z-index: 3;
  width: calc(var(--nest-w) * 1.22 + 5cqw); height: max(4px, calc(var(--egg) * 0.42));
  border-radius: 999px 0 0 999px;
  background: linear-gradient(180deg, var(--feather-500) 0 38%, var(--feather-700) 38%);
  rotate: -1.5deg; transform-origin: 100% 50%;
}
.sky-nest {
  position: absolute; right: 5cqw; bottom: var(--nest-floor); z-index: 4;
  width: var(--nest-w); height: var(--nest-h);
}
/* The bowl: woven twigs, a paler rim, a few straws left sticking out. */
.sky-nest::after {
  content: ""; position: absolute; inset: 0; z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 30' preserveAspectRatio='none'%3E%3Cpath d='M1 6Q0 3 4 4L96 4Q100 3 99 6Q95 30 50 30Q5 30 1 6Z' fill='%23855233'/%3E%3Cpath d='M6 12Q30 20 52 13T95 11M9 18Q34 26 58 19T91 17M18 24Q42 30 62 25T82 23' fill='none' stroke='%236a3f25' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M8 15Q30 23 50 16T93 14M14 21Q40 28 60 22T87 20' fill='none' stroke='%23a9764e' stroke-width='1.2' stroke-linecap='round'/%3E%3Cpath d='M1.5 6.5Q1 2.5 5 3.2Q50 9 95 3.2Q99 2.5 98.5 6.5Q50 13 1.5 6.5Z' fill='%23c69a6e'/%3E%3Cpath d='M6 5.2Q50 10 94 5.2' fill='none' stroke='%23e6c9a2' stroke-width='1.1' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
/* The back of the nest: the far rim and the shadowed hollow the eggs lie in. With the bowl
   drawn in front of them, the eggs are plainly inside the nest and not standing on it. */
.sky-nest::before {
  content: ""; position: absolute; left: 1.5%; right: 1.5%; z-index: 0;
  top: calc(13% - var(--egg) * 0.5); height: calc(var(--egg) * 1);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 58%, #4b2c1a 0 58%, #6f4428 59% 100%);
  box-shadow: inset 0 calc(var(--egg) * 0.13) 0 #c69a6e, 0 0 0 0.75px #6f422680;
}
/* The clutch: rows from the front of the nest to the back (eggRows in nest.js). The front
   row sits down behind the rim; each row behind it shows a third of an egg above the last. */
.sky-eggs { position: absolute; inset: 0; z-index: 1; }
.sky-egg-row {
  position: absolute; left: 50%; translate: -50% 0;
  bottom: calc(100% - var(--egg) * (0.8 - var(--row, 0) * 0.34));
  z-index: calc(3 - var(--row, 0));
  display: flex; justify-content: center;
  filter: brightness(calc(1 - var(--row, 0) * 0.045));
}
.sky-egg {
  flex: none; width: var(--egg); aspect-ratio: 10 / 13;
  margin: 0 calc(var(--egg) * 0.01);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(ellipse at 36% 30%, #fffefa 0%, #fbf3e2 52%, #ecd9b6 100%);
  box-shadow: 0 0 0 0.75px #6f422647;
}
.sky-egg:nth-child(3n + 1) { rotate: -5deg; }
.sky-egg:nth-child(4n + 2) { rotate: 6deg; }

/* The caption: a solid label resting bottom left, clear of the flight lanes. */
.sky-caption {
  position: absolute; left: 10px; bottom: 9px; z-index: 6;
  width: fit-content; max-width: calc(100% - 20px);
  margin: 0; padding: 4px 13px;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink); box-shadow: var(--shadow-1);
  font-weight: 650; font-size: var(--text-sm); line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.sky.has-nest .sky-caption { max-width: calc(100% - var(--egg-base) * 9 - 5cqw - 24px); }
.sky-tall .sky-caption {
  left: 16px; bottom: 14px; padding: 7px 18px;
  font-size: clamp(17px, 1.6vw, 25px);
}

@container sky-art (max-width: 560px) { .sky-bird:nth-child(n + 22 of .sky-bird) { display: none; } }
@container sky-art (max-width: 420px) { .sky-bird:nth-child(n + 15 of .sky-bird) { display: none; } }

/* The sky's motion. With reduced motion none of this applies: the birds rest where --x puts
   them, each held in one pose of the sheet. Every delay adds --sky-clock (set by the shell
   after each redraw), so a sky that is drawn again carries on from where it was. */
@media (prefers-reduced-motion: no-preference) {
  .sky-bird {
    animation: sky-cross var(--dur) linear calc(var(--delay) + var(--sky-clock, 0s)) infinite;
  }
  .sky-bird-body { left: 0; translate: -100% -54%; }
  .sky-bird-body.fly-a { animation: hawk-climb-a var(--loop) linear calc(var(--beat) + var(--sky-clock, 0s)) infinite; }
  .sky-bird-body.fly-b { animation: hawk-climb-b var(--loop) linear calc(var(--beat) + var(--sky-clock, 0s)) infinite; }
  .sky-bird-body.fly-c { animation: hawk-climb-c var(--loop) linear calc(var(--beat) + var(--sky-clock, 0s)) infinite; }
  .fly-a .sky-bird-wings { animation: hawk-wings-a var(--loop) linear calc(var(--beat) + var(--sky-clock, 0s)) infinite; }
  .fly-b .sky-bird-wings { animation: hawk-wings-b var(--loop) linear calc(var(--beat) + var(--sky-clock, 0s)) infinite; }
  .fly-c .sky-bird-wings { animation: hawk-wings-c var(--loop) linear calc(var(--beat) + var(--sky-clock, 0s)) infinite; }
  .sky-bird-cell {
    animation: sky-bob var(--bob) var(--ease-silk) calc(var(--beat) * 0.4 + var(--sky-clock, 0s)) infinite alternate;
  }
  .sky-egg.is-wobbly { animation: egg-wobble 7.5s var(--ease-silk) var(--wobble) infinite; transform-origin: 50% 90%; }
  .sky-cloud-1 { left: 0; animation: sky-cloud-cross 132s linear calc(-24s + var(--sky-clock, 0s)) infinite; }
  .sky-cloud-2 { left: 0; animation: sky-cloud-cross 176s linear calc(-84s + var(--sky-clock, 0s)) infinite; }
  .sky-cloud-3 { left: 0; animation: sky-cloud-cross 118s linear calc(-88s + var(--sky-clock, 0s)) infinite; }

  @keyframes sky-cross { from { transform: translateX(0); } to { transform: translateX(calc(100% + 140px)); } }
  @keyframes sky-cloud-cross { from { transform: translateX(-180px); } to { transform: translateX(calc(100cqw + 180px)); } }
  @keyframes sky-bob { from { transform: translateY(-4%); } to { transform: translateY(4%); } }

  /* The three flight loops. hawk-wings-* steps the sheet of poses: it holds the glide (pose 0),
     lifts into a run of beats (1–6, then 7–22 once per beat) and settles (23–31). hawk-climb-*
     is the same loop for the body: sinking gently through each glide, nose just down, and
     winning the height back, nose up, while the wings beat. Printed by art-source/make-bird.mjs,
     which also draws art/bird.svg; the sheet and these keyframes must change together. */
  @keyframes hawk-wings-a {
    0% { transform: translateX(0); animation-timing-function: steps(1, end); }
    40.29% { transform: translateX(-3.125%); animation-timing-function: steps(6, jump-none); }
    42.408% { transform: translateX(-18.75%); animation-timing-function: steps(1, end); }
    42.412% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    46.6% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    46.604% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    50.792% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    50.796% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    54.984% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    54.988% { transform: translateX(-71.875%); animation-timing-function: steps(9, jump-none); }
    58.639% { transform: translateX(-96.875%); animation-timing-function: steps(1, end); }
    58.643% { transform: translateX(0); animation-timing-function: steps(1, end); }
    85.839% { transform: translateX(-3.125%); animation-timing-function: steps(6, jump-none); }
    87.957% { transform: translateX(-18.75%); animation-timing-function: steps(1, end); }
    87.961% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    92.149% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    92.153% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    96.341% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    96.345% { transform: translateX(-71.875%); animation-timing-function: steps(9, jump-none); }
    99.996% { transform: translateX(-96.875%); animation-timing-function: steps(1, end); }
    100% { transform: translateX(0); }
  }
  @keyframes hawk-climb-a {
    0% { transform: translateY(-7%) rotate(0.6deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    40.29% { transform: translateY(7%) rotate(1.4deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    50.384% { transform: translateY(0%) rotate(-2.2deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    58.643% { transform: translateY(-5%) rotate(0.6deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    85.839% { transform: translateY(5%) rotate(1.4deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    93.628% { transform: translateY(-2%) rotate(-2.2deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    100% { transform: translateY(-7%) rotate(0.6deg); }
  }
  @keyframes hawk-wings-b {
    0% { transform: translateX(0); animation-timing-function: steps(1, end); }
    24.229% { transform: translateX(-3.125%); animation-timing-function: steps(6, jump-none); }
    26.347% { transform: translateX(-18.75%); animation-timing-function: steps(1, end); }
    26.351% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    30.539% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    30.543% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    34.731% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    34.735% { transform: translateX(-71.875%); animation-timing-function: steps(9, jump-none); }
    38.386% { transform: translateX(-96.875%); animation-timing-function: steps(1, end); }
    38.39% { transform: translateX(0); animation-timing-function: steps(1, end); }
    85.839% { transform: translateX(-3.125%); animation-timing-function: steps(6, jump-none); }
    87.957% { transform: translateX(-18.75%); animation-timing-function: steps(1, end); }
    87.961% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    92.149% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    92.153% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    96.341% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    96.345% { transform: translateX(-71.875%); animation-timing-function: steps(9, jump-none); }
    99.996% { transform: translateX(-96.875%); animation-timing-function: steps(1, end); }
    100% { transform: translateX(0); }
  }
  @keyframes hawk-climb-b {
    0% { transform: translateY(-7%) rotate(0.6deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    24.229% { transform: translateY(7%) rotate(1.4deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    32.018% { transform: translateY(0%) rotate(-2.2deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    38.39% { transform: translateY(-5%) rotate(0.6deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    85.839% { transform: translateY(5%) rotate(1.4deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    93.628% { transform: translateY(-2%) rotate(-2.2deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    100% { transform: translateY(-7%) rotate(0.6deg); }
  }
  @keyframes hawk-wings-c {
    0% { transform: translateX(0); animation-timing-function: steps(1, end); }
    50.182% { transform: translateX(-3.125%); animation-timing-function: steps(6, jump-none); }
    52.3% { transform: translateX(-18.75%); animation-timing-function: steps(1, end); }
    52.304% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    56.492% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    56.496% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    60.684% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    60.688% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    64.876% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    64.88% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    69.068% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    69.072% { transform: translateX(-71.875%); animation-timing-function: steps(9, jump-none); }
    72.723% { transform: translateX(-96.875%); animation-timing-function: steps(1, end); }
    72.727% { transform: translateX(0); animation-timing-function: steps(1, end); }
    90.031% { transform: translateX(-3.125%); animation-timing-function: steps(6, jump-none); }
    92.149% { transform: translateX(-18.75%); animation-timing-function: steps(1, end); }
    92.153% { transform: translateX(-21.875%); animation-timing-function: steps(16, jump-none); }
    96.341% { transform: translateX(-68.75%); animation-timing-function: steps(1, end); }
    96.345% { transform: translateX(-71.875%); animation-timing-function: steps(9, jump-none); }
    99.996% { transform: translateX(-96.875%); animation-timing-function: steps(1, end); }
    100% { transform: translateX(0); }
  }
  @keyframes hawk-climb-c {
    0% { transform: translateY(-7%) rotate(0.6deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    50.182% { transform: translateY(7%) rotate(1.4deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    62.582% { transform: translateY(0%) rotate(-2.2deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    72.727% { transform: translateY(-5%) rotate(0.6deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    90.031% { transform: translateY(5%) rotate(1.4deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    95.514% { transform: translateY(-2%) rotate(-2.2deg); animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); }
    100% { transform: translateY(-7%) rotate(0.6deg); }
  }
}

/* ---------- The celebration: serene sunlit sky moment when a child's Houston grows ---------- */
.celebrate {
  position: fixed; inset: 0; z-index: 35;
  display: grid; place-items: center; padding: 16px 16px 84px; overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, #fff8dc 0, #fff8dc00 44%),
    linear-gradient(180deg, #bfe1fb 0%, #e1f2ff 56%, #f6fbff 100%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* The celebration is always a bright, serene morning moment: it is shown to a child. */
.celebrate {
  color-scheme: light;
  --surface: #ffffff; --ink: #122c46; --muted: #425e7a; --line: #d7e7f6; --accent-ink: #13518a;
  --sand-300: #d7e7f6; --sand-400: #b2d3ef; --straw-light: #f6ead2; --twig: #8f5b3a;
  --shadow-3: 0 8px 20px #0a1b2e1c, 0 36px 80px -24px #0a1b2e47;
  color: var(--ink);
}
.celebrate > * { grid-area: 1 / 1; }
.celebrate-clouds { position: absolute; inset: 0; pointer-events: none; }
.celebrate-clouds span {
  position: absolute; width: 24vw; min-width: 140px; max-width: 320px; aspect-ratio: 2 / 1;
  background: url(/art/cloud.svg) center / contain no-repeat;
  opacity: 0.85;
}
.celebrate-clouds span:nth-child(1) { left: 3%; top: 8%; }
.celebrate-clouds span:nth-child(2) { right: 3%; top: 18%; width: 20vw; }
.celebrate-clouds span:nth-child(3) { left: 8%; bottom: 10%; width: 18vw; }
.celebrate-clouds span:nth-child(4) { right: 8%; bottom: 12%; width: 25vw; }

.celebrate-rays {
  position: absolute; left: 50%; top: calc(50% - 34px); translate: -50% -50%;
  width: min(128vmax, 1080px); aspect-ratio: 1; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, #fff3bd66 0 6deg, #fff3bd00 6deg 18deg);
  mask-image: radial-gradient(circle, #000 0 26%, transparent 66%);
}
.celebrate-card {
  position: relative; z-index: 1;
  width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  display: grid; justify-items: center; gap: var(--space-2); text-align: center;
  padding: var(--space-6) var(--space-6) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--sun-300); border-radius: var(--radius-lg);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--surface) 55%, transparent), var(--shadow-3);
}
.celebrate-kicker {
  padding: 3px var(--space-3); border-radius: var(--radius-pill); background: var(--sun-100);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--sun-ink);
}
/* The picture stands in a round pool of morning light; a ring of it widens as he grows. */
.celebrate-art {
  position: relative; display: grid; place-items: center; isolation: isolate;
  width: min(248px, 58vw, 34dvh); aspect-ratio: 1; margin: var(--space-1) 0 0;
  transform-origin: 50% 88%;
}
.celebrate-glow {
  position: absolute; z-index: -1; inset: -4%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 50% 46%, var(--sun-50) 0%, var(--sun-100) 44%,
    color-mix(in srgb, var(--sun-300) 55%, transparent) 62%, transparent 71%);
}
.celebrate-glow::after {
  content: ""; position: absolute; inset: 14%; border-radius: 50%;
  border: 2px solid var(--sun-300); opacity: 0;
}
.celebrate .hawk {
  width: 86%; height: auto; aspect-ratio: 1; max-width: none;
  padding: 0; border-radius: 0; background: none; box-shadow: none;
}
/* Houston himself hops for joy once he has grown into view, then waves. */
.celebrate .hrig { --hr-cue: 0.95s; --hr-wait: 3.4s; }
.celebrate-title {
  font-family: var(--font-display); font-size: clamp(var(--text-2xl), 6vw, var(--text-3xl)); line-height: 1.1;
  font-weight: 600; font-variation-settings: "SOFT" 65, "WONK" 0; letter-spacing: var(--tracking-display);
  text-wrap: balance;
}
.celebrate-stage {
  padding: var(--space-1) var(--space-4); border-radius: var(--radius-pill);
  background: var(--sun-100); border: 1px solid var(--sun-300);
  color: var(--ink);
  font-size: clamp(var(--text-md), 4vw, var(--text-lg)); font-weight: 700;
}
/* Seven stages from egg to hawk: the ones behind, the one just reached, the ones to come. */
.celebrate-steps { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-1) 0; }
.celebrate-step {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line); box-shadow: inset 0 0 0 1px var(--sand-400);
}
.celebrate-step.is-done { background: var(--sun-500); box-shadow: none; }
.celebrate-step.is-new {
  width: 12px; height: 12px; background: var(--sun-500);
  box-shadow: 0 0 0 3px var(--sun-100), 0 0 0 4px var(--sun-300);
}
.celebrate-line { color: var(--muted); font-size: var(--text-md); font-weight: 500; text-wrap: balance; }
.celebrate-hint { margin-top: var(--space-1); color: var(--muted); font-size: var(--text-xs); }

.celebrate-burst { position: relative; width: 0; height: 0; z-index: 0; pointer-events: none; }
.celebrate-bit {
  position: absolute; left: 0; top: 0; width: 15px; height: 9px; border-radius: 4px;
  background: var(--bit, var(--sun-500));
  transform: translate(var(--x), var(--y)) rotate(var(--r));
}
.celebrate-bit.is-feather {
  width: 24px; height: 10px; border-radius: 0 100% 0 100%;
  background: linear-gradient(160deg, color-mix(in srgb, var(--bit) 70%, var(--surface)), var(--bit) 60%);
}
.celebrate-bit.is-star {
  width: 20px; height: 20px; border: 0; border-radius: 0;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* ---------- Motion: Houston's stages and the celebration; disabled when reduced ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Gentle, calming life across Houston's growth stages. */
  .hawk-card .hawk-stage-egg:not([src$="#alive"]), .hawk-card .hawk-stage-cracking:not([src$="#alive"]),
  .celebrate .hawk-stage-egg, .celebrate .hawk-stage-cracking {
    animation: egg-wobble 6s var(--ease-silk) 0.8s infinite; transform-origin: 50% 88%;
  }
  /* In a hawk card a picture that is alive on its own (opened at #alive) is left to its
     own motion; only a plain picture is given this gentle life from outside. */
  .hawk-card .hawk-stage-hatching:not([src$="#alive"]), .hawk-card .hawk-stage-hatchling:not([src$="#alive"]),
  .hawk-card .hawk-stage-nestling:not([src$="#alive"]) {
    animation: chick-hop 6.5s var(--ease-silk) 1s infinite;
  }
  .hawk-card .hawk-stage-fledgling:not([src$="#alive"]) {
    animation: fledgling-flutter 5.8s var(--ease-silk) 0.8s infinite;
  }
  .hawk-card .hawk-stage-houston {
    animation: houston-soar 5.5s var(--ease-silk) infinite;
  }
  .hawk-meter-fill, .hawk-piece.is-read {
    transition: width var(--dur-3) var(--ease-out), transform var(--dur-2) var(--ease-out);
  }
  .reader:hover .hawk-pic .hawk { animation: mini-lift 360ms var(--ease-out); }

  /* Full-screen celebration motion. */
  .celebrate { animation: celebrate-in 0.32s var(--ease-out) both; }
  .celebrate-clouds span:nth-child(odd) { animation: celebrate-cloud 16s var(--ease-silk) infinite alternate; }
  .celebrate-clouds span:nth-child(even) { animation: celebrate-cloud-rev 19s var(--ease-silk) infinite alternate; }
  .celebrate-rays { animation: rays-turn 64s linear infinite, celebrate-in 0.6s var(--ease-out) both; }
  .celebrate-card { animation: card-pop 0.48s var(--ease-out) both; }
  /* He grows into the light, the ring widens, the words follow one by one, and the
     confetti bursts from behind the card and drifts down out of the way. */
  .celebrate-art { animation: celebrate-grow 0.85s cubic-bezier(0.3, 1.45, 0.5, 1) 0.16s both; }
  .celebrate-glow { animation: celebrate-in 0.7s var(--ease-out) 0.1s both; }
  .celebrate-glow::after { animation: celebrate-ring 1.5s var(--ease-out) 0.5s both; }
  .celebrate-kicker, .celebrate-title, .celebrate-stage, .celebrate-steps, .celebrate-line, .celebrate-hint {
    animation: celebrate-rise 0.5s var(--ease-out) both;
  }
  .celebrate-kicker { animation-delay: 0.12s; }
  .celebrate-title { animation-delay: 0.4s; }
  .celebrate-stage { animation-delay: 0.5s; }
  .celebrate-steps { animation-delay: 0.6s; }
  .celebrate-line { animation-delay: 0.7s; }
  .celebrate-hint { animation-delay: 1.4s; }
  .celebrate-step.is-new { animation: celebrate-step 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) 1s both; }
  .celebrate-bit { animation: bit-fly 4.2s linear calc(0.3s + var(--d, 0s)) both; }
}
@keyframes egg-wobble {
  0%, 72%, 100% { transform: rotate(0); }
  77% { transform: rotate(-4.5deg); }
  83% { transform: rotate(3.8deg); }
  89% { transform: rotate(-2deg); }
  94% { transform: rotate(1deg); }
}
@keyframes chick-hop {
  0%, 82%, 100% { transform: translateY(0); }
  88% { transform: translateY(-5%); }
  94% { transform: translateY(0); }
}
@keyframes fledgling-flutter {
  0%, 78%, 100% { transform: translateY(0) rotate(0); }
  85% { transform: translateY(-5%) rotate(-1.5deg); }
  92% { transform: translateY(-2%) rotate(1.5deg); }
}
@keyframes houston-soar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes mini-lift { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px) scale(1.03); } }
@keyframes celebrate-in { from { opacity: 0; } }
@keyframes celebrate-cloud { from { transform: translateX(-14px); } to { transform: translateX(18px); } }
@keyframes celebrate-cloud-rev { from { transform: translateX(16px); } to { transform: translateX(-16px); } }
@keyframes rays-turn { to { rotate: 360deg; } }
@keyframes card-pop { from { opacity: 0; transform: scale(0.92) translateY(14px); } }
@keyframes celebrate-grow { from { transform: scale(0.5); opacity: 0; } 35% { opacity: 1; } }
@keyframes celebrate-ring { from { transform: scale(0.7); opacity: 0.9; } to { transform: scale(1.5); opacity: 0; } }
@keyframes celebrate-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes celebrate-step { from { transform: scale(0); } }
@keyframes bit-fly {
  0% { transform: translate(0, 0) rotate(0deg) scale(0.4); opacity: 0; animation-timing-function: var(--ease-out); }
  6% { opacity: 1; }
  34% { transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(1); opacity: 1; animation-timing-function: cubic-bezier(0.3, 0, 0.7, 0.6); }
  78% { opacity: 1; }
  100% { transform: translate(var(--x), calc(var(--y) + 150px)) rotate(calc(var(--r) + 70deg)) scale(0.9); opacity: 0; }
}

/* ---------- Print: no scenery ---------- */
@media print {
  .sky, .celebrate { display: none !important; }
  .hawk, .hawk-pic, .hawk-card-art { background: none; box-shadow: none; }
  .hawk-card { background: none; break-inside: avoid; box-shadow: none; }
}
