/* The hero film on the home page: the paper house building itself, its words and cards.
   Everything here is scoped to .hf (the hero's own block on the page), so the site's styles and these
   never meet; its states (stack, strip, one-col, no-alpha, calm) are classes on .hf, set by hero.js.
   Sizes that were in vw are in cqw: the width of the hero itself, without the page's scrollbar. */
  .hf * { margin: 0; box-sizing: border-box; }
  .hf { font-family: "Hanken Grotesk", sans-serif; color: #1c1c1e; background: #e3ebfc; }
  /* Flat page blue: the video's own background, so its frame has no visible edge. */
  .hf .film-hero { position: relative; isolation: isolate; height: var(--hv, calc(100vh - 65px)); min-height: 640px; container-type: inline-size; overflow: hidden; background: #e3ebfc; }
  /* Grain on the background and the words only: a canvas over the hero, masked every frame to where the film shows plain background. */
  .hf .grain { position: absolute; inset: 0; z-index: -1; pointer-events: none; width: 100%; height: 100%; }   /* plain colour, no blend mode: the soft-light blend on the page blue is baked into the tile in hero.js */

  /* The stage is the 16:9 video frame, full width, centred in height. Everything on it is
     placed in % of the 1920 × 1080 frame. */
  .hf { --S: .85; }   /* the hero's scale: the 16:9 film is this share of the screen width, and every word scales with it */
  .hf .stage { position: absolute; left: calc((1 - var(--S)) * 50cqw); top: 50%; width: calc(var(--S) * 100cqw); aspect-ratio: 16 / 9;
           transform: translate(var(--x, 0px), -50%); transition: transform 1s cubic-bezier(.65,0,.35,1); }
  .hf .stage video { position: absolute; display: block; }
  .hf .stage video.intro { inset: 0; width: 100%; height: 100%; z-index: 3; transition: opacity .35s linear; }
  /* the loop is the square final frame: x 420–1500 of 1920, full height */
  .hf .stage video.loop { left: 21.875%; top: 0; width: 56.25%; height: 100%; opacity: 0; z-index: 2; }
  /* Safari on a phone: both films carry only the middle strip, x 560–1360 of 1920, full height */
  .hf.strip .stage video.intro, .hf.strip .stage video.loop { inset: 0 auto auto 29.1667%; width: 41.6667%; height: 100%; }
  /* Safari's end state as a picture, over the films, in the intro's place */
  .hf .stage img.still { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; }
  .hf.strip .stage img.still { inset: 0 auto auto 29.1667%; width: 41.6667%; }
  /* Some browsers composite a video on screen without its alpha, so the film is copied frame by
     frame onto canvases (which keep the alpha) and the videos themselves stay invisible. */
  /* Lamp light: every cube carries a small warm glow behind it from the moment it appears. As the cubes
     meet, their glows overlap and add up into one halo behind the whole house. Each breathes very slightly
     like a live lamp. In the stage (moves with the house), under the words and the film. */
  .hf .glow { position: absolute; width: 36%; height: 62%; z-index: 0; pointer-events: none; transform: translate(-50%, -50%);
          opacity: 0; transition: opacity .6s ease-out; }
  .hf .glow i { position: absolute; inset: 0; border-radius: 50%; animation: lamp 5s ease-in-out infinite alternate;
            background: radial-gradient(closest-side, rgba(255, 190, 135, .34), rgba(255, 198, 148, .15) 55%, rgba(255, 205, 160, 0)); }
  @keyframes lamp { from { opacity: .84; } to { opacity: 1; } }
  @media (prefers-reduced-motion: reduce) { .hf .glow i { animation: none; } }
  .hf .stage canvas.film { position: absolute; display: block; pointer-events: none; }
  .hf .stage canvas.film.intro { inset: 0; width: 100%; height: 100%; z-index: 3; }
  .hf .stage canvas.film.loop { left: 21.875%; top: 0; width: 56.25%; height: 100%; z-index: 2; }
  .hf:not(.no-alpha) .stage video { visibility: hidden; }
  /* Firefox stops decoding a video it is not showing: the copy on the canvas froze on one frame while the
     clock ran on. There the films stay shown, at 1 %, under the canvas that carries the same picture. */
  .hf.ff:not(.no-alpha) .stage video { visibility: visible; filter: opacity(.01); }
  /* Safari cannot show a transparent film: there the words go back on top */
  .hf.no-alpha .hf-word { z-index: 4; }

  /* The words lie under the film: cubes pass in front of them and their shadows fall on the letters. */
  .hf .hf-word { position: absolute; z-index: 1; display: flex; align-items: flex-start; gap: .4em; font-size: clamp(20px, 2.12cqw, 39px); font-weight: 600;
           letter-spacing: -0.03em; line-height: 1.12; transform: translateY(-50%); width: max-content; max-width: 10.5em; transition: opacity .4s; }
  .hf .hf-word span { text-wrap: balance; }
  .hf .hf-word.left { flex-direction: row-reverse; text-align: right; }
  .hf .hf-word svg { width: .8em; height: .8em; flex: none; margin-top: .1em; }
  .hf .ch.new { color: #2f6bed; }
  /* Words of the same material as the film: a hair softer than vector-sharp, ink a touch lighter. */
  /* Words of the same material as the film: a fine grain in the ink and a hair softer than vector-sharp. */
  .hf .hf-word, .hf .copy h1, .hf .copy p, .hf .hf-cards li span { filter: none; }
  .hf .copy h1 { color: #242427; }   /* between the site's --ink-900 (#1c1c1e) and #2c2c30: dark like the page below, a touch softer next to the film */
  .hf .hf-word { color: rgba(40, 31, 27, .82); }   /* warm ink, the same as the feature row below, so a word keeps its colour when it moves down */
  .hf .hf-word b { font-weight: inherit; }
  /* While its cube travels, a word is a ribbon: every letter runs along the path the cube has just
     taken, so on a hop the word bends into the same arc. When the cube lands it straightens out
     into the still label beside its room. */
  .hf .snake { position: absolute; left: 0; top: 0; z-index: 1; opacity: 0;   /* hidden until its ribbon runs: before that its letters sit piled at the corner */ font-size: clamp(20px, 2.12cqw, 39px); font-weight: 600; letter-spacing: -0.03em;
           color: rgba(40, 31, 27, .82); filter: none; pointer-events: none; }
  .hf .snake i { position: absolute; left: 0; top: 0; font-style: normal; white-space: pre; will-change: transform; }

  /* The text column stands as tall as the house: the headline level with the roof, the cards down
     at the ground, so the cards' rows sit by the floors. */
  .hf .copy { position: absolute; top: var(--cy, 0px); left: 0; z-index: 2; display: flex; flex-direction: column;
          transform: translate(var(--cx, 0px), 12px); opacity: 0; width: max-content; }
  .hf .copy.on { opacity: 1; transform: translate(var(--cx, 0px), 0); }
  /* Its fade and slide only once hero.js has set it in place (.live): the first style the page gets is
     not animated from, so a page read before this file arrived (an extension does that) does not show
     the headline sliding across from the left. While hidden it moves without a slide. */
  .hf.live .copy { transition: opacity .8s ease-out .35s; }
  .hf.live .copy.on { transition: opacity .8s ease-out .35s, transform .8s ease-out .35s; }

  /* Narrow screens: one column. The house keeps its size (up to the screen width) and stands on top,
     the words and the cards go under it; the words do not ride beside the house, there is no room. */
  .hf.stack .film-hero { height: var(--hh); min-height: 0; }
  .hf.stack .stage { top: var(--sy); left: var(--sx); width: var(--sw); transform: none; transition: none; }
  /* The words keep the size they have next to the house on a wide screen, measured against the house:
     the whole picture shrinks together, the column starts at the house's left edge. */
  .hf.stack .copy { top: var(--cy); left: var(--cl); width: max-content; max-width: calc(100cqw - var(--cl) - 16px); height: auto; transform: translateY(12px); }
  .hf.stack .copy.on { transform: none; }
  .hf.stack h1 { font-size: var(--h1); }
  .hf.stack .copy p { font-size: var(--pf); }
  .hf.stack .hf-word, .hf.stack .snake { display: none; }
  .hf.stack .hf-cards { margin-top: 0; padding-top: var(--fg); font-size: var(--ff); gap: var(--rg); }
  /* narrow screens: rows as wide as the house, two cards side by side where both fit, otherwise one
     (hero.js, layCards); each as wide as its words (never squeezed: a label wraps only if it is wider
     than the screen) and at least 44 px tall, a finger's target */
  .hf.stack .hf-cards { flex-direction: row; flex-wrap: wrap; align-items: flex-start; max-width: none; }
  .hf.stack .hf-cards li { white-space: nowrap; max-width: 100%; }
  .hf.stack .hf-cards li a { min-height: 44px; box-sizing: border-box; }
  .hf.one-col .hf-cards { flex-direction: column; align-items: flex-start; }
  .hf.one-col .hf-cards li { white-space: normal; }
  .hf h1 { font-size: clamp(40px, 4.68cqw, 78px); font-weight: 700; letter-spacing: -0.035em; line-height: 1; }
  .hf .lockup { display: flex; align-items: center; gap: calc(1em * 18 / 64); margin-left: calc(1em * 56 / 64 * -12 / 64); }
  .hf .lockup svg { width: calc(1em * 56 / 64); height: calc(1em * 56 / 64); flex: none; position: relative; top: .07em; }
  .hf .copy p { margin-top: .9em; font-size: clamp(17px, 1.49cqw, 24px); color: #3a3a3e; }   /* --ink-700, as the site's body text */
  /* After the house moves aside, its words move under the headline and settle into small white cards.
     Nine equal cards, in the order of the tour further down the page: the six rooms of the house and the
     three features that have no room. Each card is a link to its step of the tour. A room's card inflates
     under its word the moment the word lands; the other three fill in alongside. */
  .hf .hf-cards { margin: 0; padding: 40px 0 0; list-style: none; display: flex; flex-wrap: wrap; gap: 10px; max-width: 36em;
              font-size: clamp(14px, .94cqw, 16px); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; color: rgba(40, 31, 27, .82); }
  .hf .hf-cards li { position: relative; z-index: 0; display: flex; white-space: nowrap; }
  .hf .hf-cards li a { display: flex; align-items: center; gap: .55em; padding: .62em 1.15em .62em .8em; color: inherit; text-decoration: none; border-radius: 12px; }
  .hf .hf-cards li a:focus-visible { outline: 2px solid #2f6bed; outline-offset: 2px; }
  .hf .hf-cards li.on:hover::before { box-shadow: 0 1px 2px rgba(40, 31, 27, .08), 0 10px 24px rgba(40, 31, 27, .12); transform: translateY(-1px); }
  .hf .hf-cards li.on:hover a { cursor: pointer; }
  .hf .hf-cards li::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 12px; background: #fff;
                         box-shadow: 0 1px 2px rgba(40, 31, 27, .06), 0 6px 18px rgba(40, 31, 27, .07);
                         opacity: 0; transform: scale(.86); transition: opacity .35s ease-out, transform .5s cubic-bezier(.34, 1.56, .64, 1); }
  .hf .hf-cards li.on::before { opacity: 1; transform: none; }
  .hf .hf-cards li span { opacity: 0; transition: opacity .3s ease-out; }
  .hf .hf-cards li svg { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
                     opacity: 0; transform: scale(.5); transition: opacity .3s ease-out, transform .45s cubic-bezier(.34,1.56,.64,1); }
  .hf .hf-cards li.text span { opacity: 1; }
  .hf .hf-cards li.on svg { opacity: 1; transform: none; }
  .hf .hf-cards b { font-weight: inherit; }
  .hf .copy .wl, .hf .copy .lockup svg { display: inline-block; will-change: transform; }
  .hf .ghost { position: fixed; z-index: 6; margin: 0; pointer-events: none; transform-origin: 0 0; text-wrap: balance; }
  /* reduced motion: everything arrives without moving */
  .hf.calm .film-hero *, .hf.calm .film-hero *::before, .hf.calm .film-hero *::after { transition: none !important; animation: none !important; }
  /* Play again: a quiet text button under the cards, its baseline near the house's floor. Its hover
     pill lines up with the cards' left edge, as a button of the same column. It comes in once
     the cards are filled. */
  /* The way to the Store, under the cards, its bottom on the house's floor: the site's black Store
     button (ink-900, a pill, 600), and the quiet Play again beside it. They come in once the cards are filled. */
  .hf .cta { position: static; margin-top: 40px; display: flex; align-items: center; gap: 14px;
         opacity: 0; pointer-events: none; transition: opacity .6s ease-out; }
  .hf .copy.on .cta { opacity: 1; pointer-events: auto; transition: opacity .6s ease-out 1.9s; }
  .hf .store { display: inline-flex; align-items: center; height: 48px; padding: 0 22px; border-radius: 999px; background: #1c1c1e; color: #fff;
           font: 600 16px "Hanken Grotesk", sans-serif; letter-spacing: -0.005em; text-decoration: none; white-space: nowrap; transition: background-color .2s; }
  .hf .store:hover { background: #3a3a3e; }
  .hf .store:focus-visible { outline: 2px solid #2f6bed; outline-offset: 3px; }
  /* stacked: the button's distance to the cards is set in hero.js (as far as the cards are from the line above);
     Play again, wrapped under it, 28 px as seen to its icon (21 between the boxes, 7 of its own padding) */
  .hf.stack .cta { position: static; margin-top: 24px; flex-wrap: wrap; row-gap: 21px; }
  /* a narrow column: the Store button stays one line and the whole button scales down to fit it, text
     and padding together (the label is 13.06 em wide, with its padding 15.8 em), never above its 16 px */
  .hf.stack .store { font-size: min(16px, calc((100cqw - var(--cl) - 16px) / 15.9)); height: 3em; padding: 0 1.375em; }
  .hf .again { position: static; display: inline-flex; align-items: center; gap: .5em; margin-left: 0;
           padding: .45em .8em .45em .55em; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
           font: 400 clamp(14px, .94cqw, 16px) "Hanken Grotesk", sans-serif; letter-spacing: -0.01em; color: rgba(40, 31, 27, .82);
           transition: background-color .2s; }
  .hf .again svg { width: 1.25em; height: 1.25em; flex: none; }
  .hf .again:hover { background: rgba(40, 31, 27, .06); }
  .hf .again:focus-visible { outline: 2px solid #2f6bed; outline-offset: 2px; }

  /* the site's links underline and turn blue on hover; inside the hero they keep their own look */
  .hf a:hover { text-decoration: none; }
  .hf .store:hover { color: #fff; }
  .hf .hf-cards a:hover { color: inherit; }
