/* Animation Handbook — page chrome for the guided-steps demo pages.
   Linked after each demo's own <style>, so these rules win where they overlap.
   The animation keeps its own styles; this file lays out the page around it:
   top bar, header, the three steps, About, related cards and footer. */

@font-face{font-family:'Schibsted Grotesk';src:url('../fonts/schibsted-latin-ext.woff2') format('woff2');font-weight:400 900;font-style:normal;font-display:swap;
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Schibsted Grotesk';src:url('../fonts/schibsted-latin.woff2') format('woff2');font-weight:400 900;font-style:normal;font-display:swap;
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root{
  --hb-font:'Schibsted Grotesk',system-ui,-apple-system,'Segoe UI',sans-serif;
  --disp:var(--hb-font);--mono:var(--hb-font);
  --hb-bg:#0b0b0d;--hb-panel:#111114;
  --hb-ink:#f4f4f2;--hb-text:#e6e6e8;--hb-soft:#d6d6da;--hb-dim:#adadb2;--hb-muted:#8a8a92;
  --hb-line:rgba(255,255,255,.085);--hb-edge:rgba(255,255,255,.16);--hb-edge-2:rgba(255,255,255,.36);
  --hb-accent:var(--ui-accent,#6ea8ff);--hb-bar:56px;
}

body.hb{margin:0;padding:0;background:var(--hb-bg);color:var(--hb-ink);font-family:var(--hb-font);-webkit-font-smoothing:antialiased}
body.hb :focus-visible{outline:2px solid var(--hb-accent);outline-offset:3px}
/* Demo styles often set display on their own classes; keep the hidden attribute authoritative. */
body.hb [hidden]{display:none!important}
.hb-ic{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* Top bar: always one line. "Animation Handbook" keeps its full text and never shrinks; the pager shrinks instead,
   and a page name that does not fit is cut with an ellipsis (the link keeps the full name in its aria-label). */
.hb-bar{position:sticky;top:0;z-index:50;box-sizing:border-box;height:var(--hb-bar);display:flex;flex-wrap:nowrap;align-items:center;justify-content:space-between;gap:12px;
  padding:0 clamp(8px,3vw,40px);background:rgba(11,11,13,.9);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-bottom:1px solid var(--hb-line)}
.hb-bar a{display:inline-flex;align-items:center;gap:8px;min-height:44px;min-width:44px;padding:0 8px;border-radius:8px;color:var(--hb-dim);
  text-decoration:none;font:500 15px/1 var(--hb-font);white-space:nowrap}
.hb-bar .hb-home{flex:none;color:var(--hb-ink);font-weight:700;font-size:16px;letter-spacing:-.01em}
.hb-mark{width:26px;height:26px;flex:none}
.hb-mark .g{fill:var(--hb-bg);stroke:var(--hb-ink);stroke-width:1.8}
.hb-mark .b{fill:var(--hb-ink)}
.hb-pager{display:flex;gap:4px;min-width:0}
/* The page name inside a pager link: cut with an ellipsis; the taller line box keeps descenders from being clipped */
.hb-pager a > span{min-width:0;overflow:hidden;text-overflow:ellipsis;line-height:1.5}
.hb-bar .hb-ic{width:16px;height:16px}
/* The Star link: the last item of the top bar. The pager's auto margin puts the two together at the right end (with
   space-between alone the pager would sit in the middle). Computers (from 1061px) read "Star on GitHub", screens from 820px
   to 1060px get a round star, and narrower screens leave it out so the page names keep their room: the star row under the
   prompt card is theirs. */
.hb-bar .hb-pager{margin-left:auto}
.hb-bar .hb-star{box-sizing:border-box;flex:none;padding:0 14px;border:1px solid var(--hb-edge);border-radius:999px;color:var(--hb-soft)}

/* The page: one centred column */
.hb-page{box-sizing:border-box;width:100%;max-width:1040px;margin:0 auto;
  padding:clamp(24px,4vw,40px) clamp(16px,4vw,40px) clamp(40px,6vw,64px);display:flex;flex-direction:column;gap:clamp(32px,4vw,40px)}
.hb-head{margin:0;display:flex;flex-direction:column;gap:8px}
.hb-cat{margin:0;font:600 14px/1.3 var(--hb-font);letter-spacing:.04em;color:var(--hb-accent)}
.hb-page h1{margin:0;font:800 clamp(40px,6vw,64px)/1 var(--hb-font);letter-spacing:-.035em;color:var(--hb-ink)}
.hb-lede{margin:0;font:400 clamp(17px,2vw,20px)/1.5 var(--hb-font);color:var(--hb-dim)}

/* Steps */
.hb-step{display:flex;flex-direction:column;gap:clamp(16px,2.4vw,24px)}
.hb-step+.hb-step{padding-top:clamp(28px,4vw,36px);border-top:1px solid var(--hb-line)}
/* The Watch step's gap is a custom property, read again by the help line beside the mode switch (from 761px, below) */
.hb-watch{--hb-watch-gap:16px;gap:var(--hb-watch-gap)}
.hb-step-head{display:flex;align-items:flex-start;gap:14px}
.hb-num{flex:none;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;
  background:var(--hb-accent);color:#0b0b0d;font:800 16px/1 var(--hb-font)}
.hb-step-head h2{margin:0;font:700 clamp(22px,2.6vw,26px)/1.2 var(--hb-font);letter-spacing:-.015em;color:var(--hb-ink)}
.hb-step-head p{margin:4px 0 0;font:400 16px/1.5 var(--hb-font);color:var(--hb-dim)}

/* Step 1: stage and player bar. 420px is roughly everything above and below the stage on the
   first screen, so on a laptop the stage and the player bar are both visible on arrival.
   The height is declared twice: browsers that know svh use the second, others keep the vh one. */
.hb-page .stage{box-sizing:border-box;width:100%;min-width:0;margin:0;flex:none;
  height:var(--hb-stage-h,clamp(300px,calc(100vh - 420px),440px));height:var(--hb-stage-h,clamp(300px,calc(100svh - 420px),440px));
  border:1px solid rgba(255,255,255,.1);border-radius:12px}
/* Overflow belongs to the demo: this default has zero specificity, so a demo's own .stage rule wins
   (scroll demos scroll inside their stage). A demo that needs another height sets --hb-stage-h or --hb-stage-h-phone. */
:where(.hb-page .stage){min-height:0;overflow:hidden}
.hb-page .stage.hb-dots{background-image:radial-gradient(rgba(255,255,255,.075) 1px,transparent 1.5px);background-size:24px 24px;background-position:center}
/* A stage whose text the visitor can change: at least the usual height, and taller when the text needs it */
.hb-page .stage.hb-grow{height:auto;min-height:clamp(300px,calc(100vh - 420px),440px);min-height:clamp(300px,calc(100svh - 420px),440px)}
/* The stage clips what sticks out of it, so the site focus ring (drawn 3px outside) would be cut off on anything focusable
   inside it: there the ring is drawn inward. This selector outranks body.hb :focus-visible. A stage that is itself the
   scroller is not inside itself, so it keeps the normal ring. */
.hb-page .stage :focus-visible{outline-offset:-3px}
.hb-player{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.hb-play,.hb-toggle{box-sizing:border-box;display:inline-flex;align-items:center;gap:10px;min-height:44px;padding:0 18px;
  border:1px solid rgba(255,255,255,.18);border-radius:8px;background:none;color:var(--hb-ink);font:500 15px/1 var(--hb-font);cursor:pointer}
/* Under reduced motion the shared script switches Loop and Slow motion off, greys them out and adds a note */
.hb-toggle.is-disabled{opacity:.45;cursor:not-allowed}
.hb-toggle.is-disabled .hb-switch{cursor:not-allowed}
/* The note sits beside the controls when there is room, so it does not push the page down */
.hb-player-note{flex:1 1 240px;margin:0;font:400 13px/1.4 var(--hb-font);color:var(--hb-muted)}
/* Pause on loop pages: a pause icon while the demo moves, a play icon while it is paused */
[data-hb-pause] .hb-i-play,[data-hb-pause][data-state="paused"] .hb-i-pause{display:none}
[data-hb-pause][data-state="paused"] .hb-i-play{display:inline}
/* Pause and Play keep one width, so the Slow motion switch beside the button does not move when it is pressed */
[data-hb-pause]{justify-content:center;min-width:112px}
/* data-hb-pause="css": the shared script puts hb-paused on the stage, which holds every CSS animation on it */
.hb-page .stage.hb-paused,.hb-page .stage.hb-paused::before,.hb-page .stage.hb-paused::after,
.hb-page .stage.hb-paused *,.hb-page .stage.hb-paused *::before,.hb-page .stage.hb-paused *::after{animation-play-state:paused!important}
/* Scroll pages: while Play scrolls a box, the shared script marks it, and CSS scroll snapping is off for it, or every step would
   snap and the box would jump from one snap point to the next. !important, so that this rule beats any snap type the page sets
   without !important (inline or in its own style; a page never sets one with !important), and nothing has to be remembered and
   written back. When the mark goes the page's own snap type applies again and the browser settles the box on the nearest snap
   point. */
[data-hb-autoscrolling]{scroll-snap-type:none!important}

/* See inside and Compare: the mode switch (Normal · See inside · Compare) above the stage, and under the player bar the note
   that says what the stage shows. Normal has no note, and the empty box then takes no room. From 761px the switch sits at the
   right end of the Watch step's heading row (below), so the stage keeps its place on a laptop's first screen. The switch is a
   .seg too, and the .seg rules come later in the file: the rules here that must win name .seg.hb-modes. */
.hb-page .seg.hb-modes{gap:6px}
/* The empty box is the live region that makes a screen reader read each note out loud, so it stays on the page: display:none would
   take it out of the accessibility tree, and the first note might not be announced. It is hidden to the eye and taken out of the
   flow instead, so it takes no room and adds no gap. It counts as empty until a note is un-hidden: any element with data-hb-for,
   wherever it sits in the box, because that is what the script toggles. */
.hb-mode-notes:not(:has([data-hb-for]:not([hidden]))){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.hb-mode-notes p{margin:0;max-width:72ch;font:400 15px/1.55 var(--hb-font);color:var(--hb-dim)}
.hb-mode-notes a{color:var(--hb-ink);text-decoration:underline;text-underline-offset:3px}

/* Switches: a checkbox drawn as a track and knob (gradients, so no pseudo-elements on the input) */
.hb-switch{appearance:none;-webkit-appearance:none;flex:none;width:32px;height:20px;margin:0;border-radius:999px;cursor:pointer;
  background:radial-gradient(circle at 10px 50%,var(--hb-ink) 6.5px,transparent 7px) rgba(255,255,255,.22)}
.hb-switch:checked{background:radial-gradient(circle at 22px 50%,#0b0b0d 6.5px,transparent 7px) var(--hb-accent)}
/* The label draws the focus ring for its switch; browsers without :has() keep the switch's own ring */
@supports selector(:has(*)){
  .hb-toggle:has(:focus-visible),.hb-switch-row:has(:focus-visible){outline:2px solid var(--hb-accent);outline-offset:3px}
  .hb-toggle .hb-switch:focus-visible,.hb-switch-row .hb-switch:focus-visible{outline:none}
}

/* Step 2: settings */
.hb-settings{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px 32px}
.hb-setting{display:flex;flex-direction:column;gap:10px;min-width:0}
.hb-setting-name{margin:0;font:600 17px/1.3 var(--hb-font);color:var(--hb-ink)}
.hb-hint{margin:0;font:400 14px/1.45 var(--hb-font);color:var(--hb-muted)}
.hb-page .seg{display:flex;flex-wrap:wrap;gap:8px}
.hb-page .seg button{box-sizing:border-box;min-height:44px;min-width:44px;padding:0 16px;border:1px solid var(--hb-edge);border-radius:8px;background:none;
  color:var(--hb-soft);font:500 15px/1.2 var(--hb-font);cursor:pointer;transition:background-color .15s,border-color .15s,color .15s}
.hb-page .seg button.on,.hb-page .seg button[aria-pressed="true"]{border-color:var(--hb-accent);color:var(--hb-accent);
  background:color-mix(in srgb,var(--hb-accent) 12%,transparent)}
.hb-switch-row{box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:52px;padding:0 16px;
  border:1px solid rgba(255,255,255,.14);border-radius:8px;font:500 15px/1.3 var(--hb-font);color:var(--hb-ink);cursor:pointer}
.hb-options>summary{display:inline-flex;align-items:center;gap:6px;min-height:44px;list-style:none;cursor:pointer;
  font:600 15px/1 var(--hb-font);color:var(--hb-accent)}
.hb-options>summary::-webkit-details-marker{display:none}
.hb-options>summary .hb-ic{transition:transform .2s}
.hb-options[open]>summary .hb-ic{transform:rotate(180deg)}
.hb-options .hb-less,.hb-options[open] .hb-more-label{display:none}
.hb-options[open] .hb-less{display:inline}
.hb-options>.hb-settings{margin-top:16px}
.hb-setting-top{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.hb-value{font:600 15px/1.3 var(--hb-font);color:var(--hb-accent);white-space:nowrap}
.hb-page .hb-setting input[type=range]{width:100%;min-height:44px;margin:0;accent-color:var(--hb-accent);cursor:pointer}
.hb-select,.hb-text{box-sizing:border-box;width:100%;min-height:44px;padding:0 12px;border:1px solid var(--hb-edge);border-radius:8px;
  background:var(--hb-panel);color:var(--hb-ink);font:500 16px/1.3 var(--hb-font)}
textarea.hb-text{min-height:88px;padding:10px 12px;resize:vertical}
.hb-page .swatches{display:flex;flex-wrap:wrap;gap:10px}
.hb-page .swatches button{box-sizing:border-box;width:44px;height:44px;padding:0;border:2px solid transparent;border-radius:50%;
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.45);cursor:pointer}
.hb-page .swatches button[aria-pressed="true"]{border-color:var(--hb-ink);box-shadow:inset 0 0 0 3px var(--hb-bg)}

/* Step 3: the prompt card */
.hb-card{display:flex;flex-direction:column;gap:20px;padding:clamp(18px,3vw,28px);border:1px solid rgba(255,255,255,.12);border-radius:12px;background:var(--hb-panel)}
.hb-prompt{margin:0;font:400 17px/1.65 var(--hb-font);color:var(--hb-text)}
.hb-fill{padding:1px 5px;border-radius:4px;background:rgba(255,255,255,.1);color:var(--hb-ink)}
.hb-prompt-more{display:none;align-self:flex-start;min-height:44px;margin-top:-12px;padding:0;border:0;background:none;
  color:var(--hb-accent);font:600 15px/1 var(--hb-font);cursor:pointer}
.hb-chips-box{display:flex;flex-direction:column;gap:10px}
.hb-chips-title{margin:0;font:400 14px/1.4 var(--hb-font);color:var(--hb-muted)}
.hb-chips{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0;list-style:none}
.hb-chips li{padding:6px 12px;border-radius:999px;background:color-mix(in srgb,var(--hb-accent) 12%,transparent);color:var(--hb-accent);
  font:500 14px/1.3 var(--hb-font)}
.hb-copy-row{display:flex;flex-wrap:wrap;align-items:center;gap:12px 20px}
.hb-copy-row .hb-hint{flex:1 1 260px}
.hb-copy{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:52px;padding:0 26px;border:0;
  border-radius:8px;background:var(--hb-ink);color:#0b0b0d;font:700 16px/1 var(--hb-font);cursor:pointer}
.hb-copy .hb-i-done,.hb-copy.is-done .hb-i-copy{display:none}
.hb-copy.is-done .hb-i-done{display:inline}
/* Under the prompt card: a sentence and an outline Star on GitHub button (full width on phones). Once the visitor has copied the
   prompt the shared script marks the row is-asked: the sentence brightens and the button's edge and star turn gold, with one
   small pulse where motion is welcome. */
.hb-star-row{display:flex;flex-wrap:wrap;align-items:center;gap:12px 20px}
.hb-star-row p{flex:1 1 260px;margin:0;font:400 15px/1.5 var(--hb-font);color:var(--hb-dim)}
.hb-star-btn{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;
  border:1px solid var(--hb-edge);border-radius:999px;color:var(--hb-ink);text-decoration:none;font:600 15px/1 var(--hb-font)}
.hb-star-btn .hb-ic{width:16px;height:16px}
.hb-star-row.is-asked p{color:var(--hb-text)}
.hb-star-row.is-asked .hb-star-btn{border-color:#f2c14e}
.hb-star-row.is-asked .hb-star-btn .hb-ic{fill:#f2c14e;stroke:#f2c14e}
@keyframes hb-ask{0%,100%{transform:scale(1)}40%{transform:scale(1.06)}}

/* About and related animations */
.hb-about{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:clamp(24px,5vw,48px);padding-top:clamp(28px,4vw,36px);
  border-top:1px solid var(--hb-line)}
.hb-about h2,.hb-related h2{margin:0 0 12px;font:700 22px/1.2 var(--hb-font);letter-spacing:-.01em;color:var(--hb-ink)}
.hb-about h3{margin:20px 0 12px;font:600 16px/1.3 var(--hb-font);color:var(--hb-dim)}
.hb-what-text p{margin:0;font:400 16px/1.7 var(--hb-font);color:var(--hb-dim)}
.hb-what-text p+p{margin-top:12px}
.hb-what-text a{color:var(--hb-ink)}
.hb-tags{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0;list-style:none}
.hb-tags li{padding:8px 14px;border:1px solid rgba(255,255,255,.14);border-radius:999px;font:400 15px/1.2 var(--hb-font);color:var(--hb-soft)}
.hb-avoid li{border-style:dashed;color:var(--hb-muted)}
.hb-rel-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px}
.hb-rel{display:flex;flex-direction:column;gap:6px;padding:18px 20px;border:1px solid rgba(255,255,255,.12);border-radius:10px;text-decoration:none}
.hb-rel b{font:700 18px/1.25 var(--hb-font);color:var(--hb-ink)}
.hb-rel span{font:400 14px/1.45 var(--hb-font);color:var(--hb-muted)}

/* Footer: the site's name on the left, and its two links (Source on GitHub, Back to top) on the right. On phones the name
   has a line of its own and the links share the line below it, one at each end. */
.hb-foot{box-sizing:border-box;display:flex;flex-wrap:wrap;align-items:center;gap:4px 24px;
  padding:16px clamp(16px,4vw,40px) 24px;border-top:1px solid var(--hb-line);font:400 14px/1.4 var(--hb-font);color:var(--hb-muted)}
.hb-foot>span{margin-right:auto}
.hb-foot a{display:inline-flex;align-items:center;min-height:44px;color:var(--hb-dim);text-decoration:none}

@media(hover:hover){
  .hb-bar a:hover{color:var(--hb-ink)}
  .hb-bar .hb-star:hover,.hb-star-btn:hover{border-color:var(--hb-edge-2);color:var(--hb-ink)}
  .hb-play:hover,.hb-toggle:hover,.hb-switch-row:hover{border-color:var(--hb-edge-2)}
  .hb-page .seg button:hover{border-color:rgba(255,255,255,.34);color:var(--hb-ink)}
  .hb-page .seg button.on:hover,.hb-page .seg button[aria-pressed="true"]:hover{border-color:var(--hb-accent);color:var(--hb-accent)}
  .hb-page .swatches button:not([aria-pressed="true"]):hover{border-color:var(--hb-edge-2)}
  .hb-select:hover,.hb-text:hover{border-color:var(--hb-edge-2)}
  .hb-options>summary:hover,.hb-prompt-more:hover{color:color-mix(in srgb,var(--hb-accent) 70%,#fff)}
  .hb-copy:hover{background:#fff}
  .hb-rel:hover{border-color:color-mix(in srgb,var(--hb-accent) 55%,transparent)}
  .hb-foot a:hover{color:var(--hb-ink)}
}

@media(max-width:759px){
  .hb-settings,.hb-about{grid-template-columns:minmax(0,1fr)}
}
/* From 820px to 1060px the Star link is a round 44px star with no words (its aria-label still names it) */
@media(max-width:1060px){
  .hb-bar .hb-star{width:44px;padding:0;justify-content:center}
  .hb-bar .hb-star>span{display:none}
}
/* Tablets and phones: the "Previous: " / "Next: " words go, so two page names fit beside the home link */
@media(max-width:1024px){
  .hb-bar .hb-dir{display:none}
}
/* Below 820px the Star link leaves the top bar: even as a round star it would cut the page names on many pages, and the
   star row under the prompt card asks instead */
@media(max-width:819px){
  .hb-bar .hb-star{display:none}
}
/* The narrowest phones (down to 320px): the full home link and the two chevron links only fit on one line with a little
   less spacing and type. The home link keeps all its text. */
@media(max-width:359px){
  .hb-bar{gap:4px;padding:0 8px}
  .hb-bar .hb-home{font-size:15px}
}
/* From 761px the mode switch sits at the right end of the Watch step's heading row (two columns: the heading, the switch), and the
   help line runs under that row across the whole step, as wide as on a page without the switch. The step is a grid. The heading box
   and the box around the heading and the help line give way (display: contents: both are plain boxes, so the heading and the help
   line keep their meaning for screen readers, and the reading order is the page's), and the number, the heading and the help line
   take places on the grid themselves: the number in the first column over the first two rows, the heading in the first row up to
   the switch's column, the help line in the second row across every column, both 46px in (the number's 32px and the heading box's
   14px gap). Nothing in the heading row is taller than the heading line, so the stage stays where it is on a page without the
   switch: the switch is stretched to that line (its buttons drop the 44px minimum here; up to 760px, in a row of their own, they
   keep it), and the number reaches into the help line's row, as it does there. The help line keeps its 4px under the heading: it
   is pulled up by the gap between the step's rows less 4px, read from --hb-watch-gap (16px, and 12px on a short laptop screen).
   A player bar with one or two controls leaves room beside it, so there the note for the mode in view sits next to the bar, under
   the switch, and is on a laptop's first screen too. Three columns then: the player bar's own width, the room left over and the
   switch's width. The heading spans the first two (the room it had before), the stage spans all three, the player bar keeps the
   start of its row (a note taller than the bar grows the row, not the bar, so the bar does not move) and the note spans the other
   two. A bar with a third control has no room to spare, and neither has one with the note that reduced motion adds: the note is
   looked for itself (a bar with one control and that note has only two children), and either way the bar keeps the full row and
   the note stays under it. An empty notes box is taken out of the flow (above), so it takes no room here either. Up to 760px the
   note stays under the player bar. */
@media(min-width:761px){
  .hb-watch:has(> .hb-modes){display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:20px;align-items:end}
  .hb-watch:has(> .hb-modes) > *{grid-column:1/-1}
  .hb-watch:has(> .hb-modes) > .hb-step-head,.hb-watch:has(> .hb-modes) > .hb-step-head > div{display:contents}
  .hb-watch:has(> .hb-modes) > .hb-step-head > .hb-num{grid-row:1/span 2;grid-column:1;align-self:start}
  .hb-watch:has(> .hb-modes) > .hb-step-head > div > h2{grid-row:1;grid-column:1/-2;margin-left:46px}
  .hb-watch:has(> .hb-modes) > .hb-step-head > div > p{grid-row:2;grid-column:1/-1;margin:calc(4px - var(--hb-watch-gap)) 0 0 46px}
  .hb-watch:has(> .hb-modes) > .hb-modes{grid-row:1;grid-column:2;flex-wrap:nowrap;align-self:stretch}
  .hb-watch:has(> .hb-modes) > .hb-modes button{min-height:0}
  .hb-watch:has(> .hb-modes):not(:has(> .hb-player > :nth-child(3), > .hb-player > .hb-player-note)){grid-template-columns:auto minmax(0,1fr) auto}
  .hb-watch:has(> .hb-modes):not(:has(> .hb-player > :nth-child(3), > .hb-player > .hb-player-note)) > .hb-modes{grid-column:3}
  .hb-watch:has(> .hb-modes):not(:has(> .hb-player > :nth-child(3), > .hb-player > .hb-player-note)) > .hb-player{grid-column:1;align-self:start}
  .hb-watch:has(> .hb-modes):not(:has(> .hb-player > :nth-child(3), > .hb-player > .hb-player-note)) > .hb-mode-notes{grid-column:2/-1;align-self:center}
}
/* With a coarse pointer (a phone held sideways, a tablet) the mode buttons, only as tall as the heading line from 761px, would be
   small to tap. So each button's tap area reaches 10px above and below it: an empty ::after that draws nothing and moves nothing.
   It counts from inside the 1px border, so even with the smallest heading line (26.4px) a finger gets 44.4px. The areas do not
   widen, so no button takes its neighbor's taps; above the switch is empty page, and below it the help line, which is plain text. */
@media(min-width:761px) and (pointer:coarse){
  .hb-watch:has(> .hb-modes) > .hb-modes button{position:relative}
  .hb-watch:has(> .hb-modes) > .hb-modes button::after{content:"";position:absolute;inset:-10px 0}
}
/* Up to 760px the switch has a row of its own above the stage, its three buttons sharing it equally (.seg.hb-modes outranks the
   .seg button rule for phones further down) */
@media(max-width:760px){
  .hb-page .seg.hb-modes button{flex:1 1 0;padding:0 6px}
}
/* Short laptop screens (1366×768 leaves about 650px of page): a tighter header and a shorter stage
   keep the stage and the player bar on the first screen. */
@media(min-width:601px) and (max-height:760px){
  .hb-page{padding-top:20px;gap:24px}
  .hb-head{gap:6px}
  .hb-page h1{font-size:44px}
  .hb-lede{font-size:17px}
  .hb-step-head h2{font-size:22px}
  .hb-watch{--hb-watch-gap:12px}
  .hb-page .stage{height:var(--hb-stage-h,clamp(260px,calc(100vh - 330px),440px));height:var(--hb-stage-h,clamp(260px,calc(100svh - 330px),440px))}
  /* A stage that grows with its text gets the same shorter minimum */
  .hb-page .stage.hb-grow{min-height:clamp(260px,calc(100vh - 330px),440px);min-height:clamp(260px,calc(100svh - 330px),440px)}
}
@media(max-width:600px){
  .hb-page .stage{height:var(--hb-stage-h-phone,300px)}
  .hb-page .stage.hb-grow{min-height:300px}
  /* With both Previous and Next, phones show only the two chevrons; each link keeps its full name as its label */
  .hb-pager:has(a + a) a > span{display:none}
  .hb-step-head{gap:12px}
  .hb-num{width:30px;height:30px;font-size:15px}
  .hb-step-head p{font-size:15px}
  /* Three controls do not fit on one line at phone widths: Replay takes the first row, the two switches share the
     second, and the reduced-motion note gets a row of its own. On a loop page Pause and Slow motion share one row. */
  .hb-player{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .hb-play,.hb-player-note{grid-column:1/-1}
  .hb-player:has(> [data-hb-pause] + .hb-toggle) > .hb-play{grid-column:auto}
  /* Two buttons in the player bar (Show me and Reset, Play and Back to top) share one row */
  .hb-player:has(> .hb-play + .hb-play) > .hb-play{grid-column:auto}
  .hb-play,.hb-toggle{justify-content:center;gap:8px;padding:0 12px;font-size:14px}
  .hb-page .seg button{flex:1 0 auto;padding:0 10px}
  .hb-prompt{font-size:16px;line-height:1.6}
  .hb-prompt.is-clamped{display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;overflow:hidden}
  .hb-prompt-more{display:inline-flex;align-items:center}
  .hb-copy{width:100%}
  .hb-star-btn{width:100%}
  .hb-foot{justify-content:space-between}
  .hb-foot>span{flex-basis:100%}
}
@media(prefers-reduced-motion:no-preference){
  .hb-star-row.is-asked .hb-star-btn{animation:hb-ask .7s ease-out}
}
@media(prefers-reduced-motion:reduce){
  .hb-page .seg button,.hb-options>summary .hb-ic{transition:none}
}
