/* Homepage "How it works" film (templates/_home_how.html, static/js/home-how.js).
   Loaded only by templates/index.html, after home.css and home-proof.css. The product frame, its bar and
   the gradient glow behind it are the shared ones from home-proof.css (.hp-stage, .hp-glow, .hp-frame,
   .hp-bar, .hp-sample), so this section sits in the same family as Results and AI visibility.
   The film is dark in both site themes and carries its own fixed tokens (--u-*), copied from the app's
   dark theme. The step buttons under it use the page tokens and follow the site theme.
   Two coordinate spaces: .hw-world is a large fixed size canvas (2100px wide, 660px as an agenda) that
   the script scales and moves as a camera, so its sizes are canvas pixels. Everything else in .hw-film
   sits in the viewport at real size. "Before" states exist only under .is-live, which the script adds. */

/* ---------- Section copy ---------- */
.hw-head { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 80px); align-items: end; margin-bottom: clamp(36px, 4.4vw, 56px); }
.hw-head-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; min-width: 0; }
.hw-head .hx-h2 { max-width: 17ch; }
.hw-head .hx-sub { max-width: 46ch; }
.hw-note { margin-top: clamp(28px, 3.4vw, 40px); }

/* ---------- Frame and viewport ---------- */
.hw-screen { position: relative; overflow: hidden; border-radius: 7px; background: #050505; aspect-ratio: 1.86; }
.hw-toggle {
  position: relative; flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-left: 6px; padding: 0;
  border: 1px solid #2E2E2E; border-radius: 5px; background: #141416; color: #B4B4B4; cursor: pointer;
  transition: color 150ms, border-color 150ms, background-color 150ms;
}
.hw-toggle[hidden] { display: none; }
.hw-toggle::before { content: ""; position: absolute; inset: -9px; }
.hw-toggle:hover { color: #FFFFFF; border-color: #4A4A4A; background: #1C1C1F; }
.hw-toggle:focus-visible { outline: 2px solid #51A2FF; outline-offset: 2px; }
.hw-toggle span { display: grid; place-items: center; }
.hw-toggle svg { fill: currentColor; stroke: none; }
.hw-toggle .hw-toggle-play, .hw-toggle.is-off .hw-toggle-pause { display: none; }
.hw-toggle.is-off .hw-toggle-play { display: grid; }

.hw-film {
  --u-ground: #050505; --u-surface: #111111; --u-soft: #0C0C0C; --u-fill: #1A1A1A; --u-fill2: #222222;
  --u-line: #222222; --u-line2: #2E2E2E; --u-strong: #525252;
  --u-ink: #F2F2F2; --u-ink2: #D6D6D6; --u-muted: #A8A8A8; --u-cap: #8A8A8A; --u-faint: #5C5C5C;
  --u-blue: #3D5CFF; --u-sky: #86AEFF; --u-red: #FF6B5E; --u-amber: #F5B544; --u-green: #3DDC84; --u-grey: #7C7C86;
  --u-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --g: 25px;
  position: absolute; inset: 0; overflow: hidden; background: var(--u-ground); color: var(--u-ink);
  font-family: var(--font-sans); font-size: 13px; line-height: 1.4; letter-spacing: 0; text-align: left;
  user-select: none; -webkit-user-select: none;
}
.hw-film *, .hw-film *::before, .hw-film *::after { box-sizing: border-box; }
.hw-film :where(p, ul) { margin: 0; padding: 0; list-style: none; }
.hw-film :where(i, em) { font-style: normal; }
.hw-film svg { flex: none; }
.hw-film.is-snap, .hw-film.is-snap *, .hw-film.is-snap *::before, .hw-film.is-snap *::after { transition: none !important; }
.hw-film.is-paused *, .hw-film.is-paused *::before, .hw-film.is-paused *::after { animation-play-state: paused !important; }
/* The loop closes on a short dip to the ground colour. */
.hw-film::after { content: ""; position: absolute; inset: 0; z-index: 9; background: var(--u-ground); opacity: 0; pointer-events: none; transition: opacity 240ms ease; }
.hw-film.is-veil::after { opacity: 1; }

/* ---------- Status glyphs: the calendar's own set ---------- */
.s-planned { --c: var(--u-grey); --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6' stroke-dasharray='2.4 2.4'/%3E%3C/svg%3E"); }
.s-writing { --c: var(--u-amber); --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M8 2a6 6 0 0 1 0 12z' fill='black' stroke='none'/%3E%3C/svg%3E"); }
.s-review { --c: var(--u-amber); --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Ccircle cx='8' cy='8' r='2.4' fill='black' stroke='none'/%3E%3C/svg%3E"); }
.s-scheduled { --c: var(--u-green); --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M8 4.9V8l2.1 1.4'/%3E%3C/svg%3E"); }
.s-published { --c: var(--u-green); --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm3.6 5.7a.85.85 0 0 0-1.2-1.2L7.1 8.9 5.6 7.4a.85.85 0 0 0-1.2 1.2l2.1 2.1a.85.85 0 0 0 1.2 0z'/%3E%3C/svg%3E"); }
.hw-g { flex: none; display: block; width: var(--g); height: var(--g); background: var(--c, var(--u-grey)); -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.hw-g.is-pop { animation: hwPop 360ms var(--u-ease); }
@keyframes hwPop { 0% { transform: scale(0.4); opacity: 0.2; } 60% { transform: scale(1.14); opacity: 1; } 100% { transform: none; } }

/* ---------- The calendar canvas (canvas pixels: about half size in the wide shot) ---------- */
.hw-world {
  position: absolute; left: 0; top: 0; width: 2100px; height: 1129px; transform-origin: 0 0; transform: scale(0.5229);
  background: var(--u-ground); transition: transform 560ms var(--u-ease);
}
.hw-top { height: 124px; display: flex; align-items: center; gap: 30px; padding: 0 40px 0 44px; white-space: nowrap; }
.hw-top strong { font-size: 46px; font-weight: 500; letter-spacing: -0.028em; }
.hw-nav, .hw-seg, .hw-mode { display: inline-flex; align-items: center; height: 58px; border: 2px solid var(--u-line2); border-radius: 12px; font-size: 22px; color: var(--u-ink2); }
.hw-nav i { display: grid; place-items: center; height: 100%; padding: 0 14px; color: var(--u-muted); }
.hw-nav i + i { border-left: 2px solid var(--u-line2); }
.hw-nav .hw-nav-t { padding: 0 22px; color: var(--u-ink2); }
.hw-seg { padding: 5px; gap: 2px; }
.hw-seg i { display: grid; place-items: center; height: 100%; padding: 0 22px; border-radius: 8px; color: var(--u-cap); }
.hw-seg i.is-on { background: var(--u-fill2); color: var(--u-ink); }
.hw-counts { margin-left: auto; display: flex; align-items: center; gap: 36px; font-size: 22px; color: var(--u-muted); --g: 22px; }
.hw-count { display: inline-flex; align-items: center; gap: 11px; }
.hw-count b { min-width: 1.3em; font-family: var(--font-mono); font-size: 20px; font-weight: 500; color: var(--u-ink); font-variant-numeric: tabular-nums; }
.hw-mode { gap: 12px; padding: 0 22px 0 18px; }
.hw-mode i { width: 12px; height: 12px; border-radius: 50%; background: var(--u-amber); }

.hw-cal {
  height: 981px; margin: 0 28px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: 56px repeat(5, minmax(0, 1fr));
  border: 2px solid var(--u-line); border-radius: 16px; overflow: hidden; background: var(--u-surface);
}
.hw-wd { display: flex; align-items: center; padding: 0 20px; font-family: var(--font-mono); font-size: 17px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--u-cap); border-right: 2px solid var(--u-line); border-bottom: 2px solid var(--u-line); }
.hw-day { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; padding: 12px 12px 0; border-right: 2px solid var(--u-line); border-bottom: 2px solid var(--u-line); }
.hw-cal > :nth-child(7n) { border-right: 0; }
.hw-cal > :nth-last-child(-n + 7) { border-bottom: 0; }
.hw-num { align-self: flex-start; padding: 0 8px; border-radius: 7px; font-family: var(--font-mono); font-size: 19px; line-height: 30px; font-weight: 500; color: var(--u-muted); white-space: nowrap; transition: background-color 300ms, color 300ms; }
.hw-num b { display: none; font-weight: 500; }
.hw-day.is-out .hw-num, .hw-day.is-past .hw-num { color: var(--u-faint); }
.hw-day.is-today .hw-num { background: var(--u-blue); color: #FFFFFF; }
.hw-day.is-landed::before { content: ""; position: absolute; inset: 0; background: var(--u-green); opacity: 0; pointer-events: none; animation: hwLand 1000ms ease-out; }
@keyframes hwLand { 0% { opacity: 0; } 14% { opacity: 0.16; } 100% { opacity: 0; } }

.hw-pill {
  position: relative; display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding: 10px 14px 10px 12px; border-radius: 13px; overflow: hidden;
  background: color-mix(in srgb, var(--c) 14%, var(--u-surface));
  font-size: 22.5px; line-height: 30px; font-weight: 500; letter-spacing: -0.006em; color: var(--u-ink);
  transition: opacity 240ms ease, transform 380ms var(--u-ease), background-color 300ms ease, box-shadow 220ms ease;
}
.hw-pill > .hw-g { margin-top: 2.5px; }
.hw-pill.s-planned { background: color-mix(in srgb, var(--u-ink) 7%, var(--u-surface)); }
.hw-t { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; min-width: 0; overflow-wrap: break-word; }
.hw-pill.s-planned .hw-t { color: var(--u-ink2); font-weight: 450; }
.hw-pill.is-focus { box-shadow: 0 0 0 3px var(--u-ink); }
.hw-film.is-live .hw-pill:not(.is-in) { opacity: 0; transform: translateY(-20px) scale(0.97); }
/* Being written: the half filled glyph pulses and a soft band sweeps across the pill. */
.hw-pill.s-writing > .hw-g { animation: hwPulse 0.7s ease-in-out infinite; }
.hw-pill.s-writing::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(245, 181, 68, 0.26) 50%, transparent 70%); transform: translateX(-100%); animation: hwSweep 0.75s linear infinite; }
@keyframes hwPulse { 50% { opacity: 0.45; } }
@keyframes hwSweep { to { transform: translateX(100%); } }

/* Agenda: the same days as a list, for a narrow film. */
.hw-film.is-agenda .hw-world { width: 660px; height: auto; }
.hw-film.is-agenda .hw-top { height: 108px; gap: 16px; padding: 0 22px 0 26px; }
.hw-film.is-agenda .hw-top strong { font-size: 38px; }
.hw-film.is-agenda :is(.hw-nav, .hw-seg, .hw-mode, .hw-wd, .hw-day.is-out, .hw-day.is-past), .hw-film.is-agenda .hw-count:nth-child(2) { display: none; }
.hw-film.is-agenda .hw-counts { gap: 22px; font-size: 20px; }
.hw-film.is-agenda .hw-cal { display: block; height: auto; margin: 0 16px 16px; }
.hw-film.is-agenda .hw-day { flex-direction: row; align-items: center; gap: 14px; height: 82px; padding: 0 14px; border-right: 0; border-bottom: 2px solid var(--u-line); }
.hw-film.is-agenda .hw-day:last-child { border-bottom: 0; }
.hw-film.is-agenda .hw-num { flex: none; align-self: center; width: 112px; padding: 2px 10px; font-size: 20px; }
.hw-film.is-agenda .hw-num b { display: inline-block; width: 52px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--u-cap); }
.hw-film.is-agenda .hw-day.is-today .hw-num b { color: rgba(255, 255, 255, 0.78); }
.hw-film.is-agenda .hw-pill { flex: 1 1 0; align-items: center; padding: 12px 16px 12px 14px; }
.hw-film.is-agenda .hw-pill > .hw-g { margin-top: 0; }
.hw-film.is-agenda .hw-t { display: block; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- Layers over the calendar (real pixels) ---------- */
.hw-scrim { position: absolute; inset: 0; background: rgba(5, 5, 5, 0.7); opacity: 0; pointer-events: none; transition: opacity 300ms ease; }
.hw-film.is-dim .hw-scrim { opacity: 1; }
.hw-ov {
  --g: 14px;
  position: absolute; left: 50%; top: 50%; opacity: 0; visibility: hidden; pointer-events: none;
  transform: translate(-50%, -50%) translate(var(--fx, 0px), var(--fy, 14px)) scale(calc(var(--k, 1) * var(--fz, 0.95)));
  transition: transform 380ms var(--u-ease), opacity 220ms ease, visibility 0s linear 380ms;
}
.hw-ov.is-open { opacity: 1; visibility: visible; transform: translate(-50%, -50%) translate(0px, 0px) scale(var(--k, 1)); transition: transform 480ms var(--u-ease), opacity 220ms ease, visibility 0s; }
.hw-art { --fz: 0.16; top: 48%; }
.hw-k { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; color: var(--u-cap); }
.hw-k span { padding-left: 10px; border-left: 1px solid var(--u-line2); color: var(--u-sky); }

/* Step 1 card */
.hw-card { width: 520px; padding: 26px; border-radius: 14px; background: var(--u-surface); border: 1px solid var(--u-line2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 40px 90px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.5); }
.hw-card-h { margin: 8px 0 16px; font-size: 22px; font-weight: 500; line-height: 1.2; letter-spacing: -0.022em; }
.hw-field { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 7px 0 13px; border: 1px solid var(--u-line2); border-radius: 8px; background: var(--u-ground); color: var(--u-cap); box-shadow: 0 0 0 3px rgba(61, 92, 255, 0.16); border-color: rgba(134, 174, 255, 0.5); }
.hw-typed { flex: 1 1 auto; min-width: 0; font-size: 15px; color: var(--u-ink); white-space: nowrap; }
.hw-caret { display: inline-block; width: 1.5px; height: 17px; margin-left: 1px; vertical-align: -3px; background: var(--u-sky); animation: hwBlink 1s steps(1) infinite; }
.hw-read.is-sent .hw-caret { visibility: hidden; }
@keyframes hwBlink { 50% { opacity: 0; } }
.hw-btn { flex: none; display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 5px; background: var(--u-blue); color: #FFFFFF; font-size: 13px; font-weight: 500; transition: transform 160ms var(--u-ease), background-color 160ms; }
.hw-btn.is-press { transform: scale(0.95); background: #2B46D8; }
.hw-pages { margin-top: 16px; }
.hw-pages li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 10px; height: 34px; border-top: 1px solid var(--u-line); transition: opacity 180ms ease, transform 280ms var(--u-ease); }
.hw-pages li span { font-family: var(--font-mono); font-size: 12px; color: var(--u-ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-pages li em { font-size: 12px; color: var(--u-cap); white-space: nowrap; }
.hw-sum { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 13px; border-top: 1px solid var(--u-line); font-size: 13px; white-space: nowrap; transition: opacity 320ms ease, transform 460ms var(--u-ease); }
.hw-sum b { font-weight: 500; }
.hw-sum span { color: var(--u-sky); }
.hw-film.is-live .hw-pages li:not(.is-in), .hw-film.is-live .hw-sum:not(.is-in) { opacity: 0; transform: translateY(6px); }

/* Steps 3 and 4: the article */
.hw-doc { width: 940px; border-radius: 14px; overflow: hidden; background: var(--u-surface); border: 1px solid var(--u-line2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 40px 90px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.5); }
.hw-doc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 46px; padding: 0 14px 0 20px; border-bottom: 1px solid var(--u-line); }
.hw-crumb { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--u-cap); white-space: nowrap; }
.hw-status { --g: 13px; display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px 0 8px; border-radius: 13px; font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--u-ink); background: color-mix(in srgb, var(--sc) 15%, var(--u-surface)); transition: background-color 300ms; }
.hw-status.is-writing, .hw-status.is-review { --sc: var(--u-amber); }
.hw-status.is-scheduled { --sc: var(--u-green); }
.hw-status.is-writing .hw-g { animation: hwPulse 1.2s ease-in-out infinite; }
.hw-doc-body { display: grid; grid-template-columns: minmax(0, 1fr) 286px; }
.hw-doc-main { display: flex; flex-direction: column; gap: 13px; min-height: 404px; padding: 26px 34px 28px 30px; }
.hw-doc-h { font-size: 31px; line-height: 1.12; font-weight: 500; letter-spacing: -0.03em; text-wrap: balance; }
.hw-doc-p { max-width: 58ch; font-size: 15px; line-height: 1.6; color: #C4C4C4; }
.hw-w { transition: opacity 160ms ease; }
.hw-film.is-live .hw-w:not(.is-on) { opacity: 0; }
.hw-take { margin-top: auto; padding: 14px 16px 15px; border: 1px solid var(--u-line2); border-radius: 10px; background: var(--u-soft); transition: opacity 220ms ease, transform 340ms var(--u-ease); }
.hw-take > p { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; color: var(--u-sky); }
.hw-take ul { display: grid; gap: 6px; margin-top: 9px; }
.hw-take li { position: relative; padding-left: 16px; font-size: 13.5px; line-height: 1.4; color: var(--u-ink2); }
.hw-take li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--u-sky); }
.hw-film.is-live .hw-take:not(.is-in) { opacity: 0; transform: translateY(10px); }
.hw-doc-side { display: flex; flex-direction: column; gap: 12px; padding: 24px 20px 20px; border-left: 1px solid var(--u-line); background: var(--u-soft); }
.hw-checks li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 10px; height: 40px; border-bottom: 1px solid var(--u-line); font-size: 13.5px; color: var(--u-cap); white-space: nowrap; transition: color 300ms; }
.hw-checks em { font-family: var(--font-mono); font-size: 10.5px; color: var(--u-cap); transition: opacity 300ms; }
.hw-tick { position: relative; width: 16px; height: 16px; border-radius: 50%; border: 1.5px dashed var(--u-strong); transition: background-color 260ms, border-color 260ms, transform 420ms var(--u-ease); }
.hw-tick::after { content: ""; position: absolute; left: 4.6px; top: 1.6px; width: 4.2px; height: 7.6px; border: solid #04130A; border-width: 0 1.8px 1.8px 0; transform: rotate(45deg) scale(0); transition: transform 240ms var(--u-ease); }
.hw-film.is-live .hw-checks li:not(.is-on) em { opacity: 0; }
.hw-checks li.is-on, .hw-film:not(.is-live) .hw-checks li { color: var(--u-ink); }
.hw-checks li.is-on .hw-tick, .hw-film:not(.is-live) .hw-tick { border: 0; background: var(--u-green); }
.hw-checks li.is-on .hw-tick::after, .hw-film:not(.is-live) .hw-tick::after { left: 5.9px; top: 3px; transform: rotate(45deg) scale(1); }
.hw-when { display: flex; flex-direction: column; gap: 2px; margin-top: auto; font-size: 12px; color: var(--u-cap); }
.hw-when b { font-size: 13.5px; font-weight: 500; color: var(--u-ink); }
.hw-approve { position: relative; display: grid; place-items: center; height: 40px; border-radius: 6px; background: var(--u-blue); color: #FFFFFF; font-size: 14px; font-weight: 500; opacity: 0.4; transition: opacity 300ms, transform 160ms var(--u-ease), background-color 260ms, color 260ms, box-shadow 260ms; }
.hw-approve.is-ready { opacity: 1; box-shadow: 0 0 0 3px rgba(61, 92, 255, 0.22); }
.hw-approve.is-press { transform: scale(0.96); background: #2B46D8; }
.hw-approve.is-done { opacity: 1; background: color-mix(in srgb, var(--u-green) 14%, var(--u-surface)); color: var(--u-green); box-shadow: inset 0 0 0 1px rgba(61, 220, 132, 0.36); }
.hw-approve > span { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 7px; transition: opacity 220ms; }
.hw-approve-b, .hw-approve.is-done .hw-approve-a { opacity: 0; }
.hw-approve.is-done .hw-approve-b { opacity: 1; }

/* Narrow film (and the four stills): single column designs. */
.hw-film.is-narrow .hw-wide-only { display: none; }
.hw-film.is-narrow .hw-card { width: 340px; padding: 18px; }
.hw-film.is-narrow .hw-card-h { margin: 6px 0 12px; font-size: 18px; }
.hw-film.is-narrow .hw-field { height: 44px; }
.hw-film.is-narrow .hw-typed { font-size: 14px; }
.hw-film.is-narrow .hw-btn { height: 32px; padding: 0 11px; font-size: 12.5px; }
.hw-film.is-narrow .hw-pages { margin-top: 12px; }
.hw-film.is-narrow .hw-pages li { height: 32px; }
.hw-film.is-narrow .hw-pages li:nth-child(n + 5) { display: none; }
.hw-film.is-narrow .hw-sum { font-size: 12px; }
.hw-film.is-narrow .hw-sum span { display: none; }
.hw-film.is-narrow .hw-doc { width: 350px; }
.hw-film.is-narrow .hw-doc-bar { height: 38px; padding: 0 9px 0 14px; }
.hw-film.is-narrow .hw-doc-body { grid-template-columns: minmax(0, 1fr); }
.hw-film.is-narrow .hw-doc-main { gap: 8px; min-height: 0; padding: 14px 16px 14px; }
.hw-film.is-narrow .hw-doc-main .hw-k span { display: none; }
.hw-film.is-narrow .hw-doc-h { font-size: 21px; }
.hw-film.is-narrow .hw-doc-p { font-size: 13px; line-height: 1.5; }
.hw-film.is-narrow .hw-take { margin-top: 4px; padding: 10px 12px 11px; }
.hw-film.is-narrow .hw-take li { font-size: 12.5px; }
.hw-film.is-narrow .hw-doc-side { gap: 10px; padding: 4px 16px 14px; border-left: 0; border-top: 1px solid var(--u-line); }
.hw-film.is-narrow .hw-doc-side > .hw-k, .hw-film.is-narrow .hw-when, .hw-film.is-narrow .hw-checks em { display: none; }
.hw-film.is-narrow .hw-checks { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }
.hw-film.is-narrow .hw-checks li { grid-template-columns: 16px minmax(0, 1fr); gap: 8px; height: 32px; font-size: 12px; }
.hw-film.is-narrow .hw-approve { height: 36px; font-size: 13px; }

/* Toast, cursor, lower third */
.hw-toast {
  --g: 16px;
  position: absolute; left: 0; top: 0; z-index: 3; display: inline-flex; align-items: center; gap: 9px; height: 36px; padding: 0 14px 0 10px; border-radius: 9px;
  background: #101512; border: 1px solid rgba(61, 220, 132, 0.34); box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.5);
  font-size: 12.5px; color: var(--u-muted); white-space: nowrap; opacity: 0; pointer-events: none;
  transform: translate(var(--x, 0px), var(--y, 0px)) translateY(-6px) scale(0.96); transform-origin: 0 0;
  transition: opacity 220ms ease, transform 360ms var(--u-ease);
}
.hw-toast b { font-weight: 500; color: var(--u-ink); margin-right: 5px; }
.hw-toast.is-on { opacity: 1; transform: translate(var(--x, 0px), var(--y, 0px)) translateY(0px) scale(1); }
.hw-cursor { position: absolute; left: -3px; top: -2px; z-index: 5; opacity: 0; pointer-events: none; transform: translate(var(--x, 0px), var(--y, 0px)); transition: transform 440ms var(--u-ease), opacity 180ms ease; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.6)); }
.hw-cursor.is-on { opacity: 1; }
.hw-cursor svg { display: block; transform-origin: 4px 3px; transition: transform 140ms ease; }
.hw-cursor.is-press svg { transform: scale(0.84); }
.hw-cap {
  position: absolute; right: 14px; bottom: 14px; z-index: 6; display: inline-flex; align-items: center; gap: 9px; height: 28px; padding: 0 12px 0 10px; border-radius: 6px;
  background: rgba(14, 14, 16, 0.86); border: 1px solid rgba(255, 255, 255, 0.11); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.8);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; color: #E4E4E4; white-space: nowrap;
  opacity: 0; transition: opacity 300ms ease;
}
.hw-cap.is-on { opacity: 1; }
.hw-cap i { width: 6px; height: 6px; background: #51A2FF; flex: none; }
.hw-cap.is-swap span { animation: hwCap 320ms var(--u-ease); }
@keyframes hwCap { from { opacity: 0; transform: translateY(5px); } }

/* ---------- Reduced motion: four stills, one per step ---------- */
.hw-screen.is-still { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; background: #0A0A0C; }
.hw-panel { position: relative; overflow: hidden; min-width: 0; min-height: 0; border-radius: 6px; background: #050505; }
.hw-panel::after { content: ""; position: absolute; inset: 0; z-index: 10; border-radius: inherit; box-shadow: inset 0 0 0 1px #1E1E20; pointer-events: none; }
.hw-panel.is-on::after { box-shadow: inset 0 0 0 1.5px #86AEFF; }
.hw-screen.is-still *, .hw-screen.is-still *::before, .hw-screen.is-still *::after { transition: none !important; animation: none !important; }
.hw-screen.is-still .hw-scrim { background: rgba(5, 5, 5, 0.78); }
@media (prefers-reduced-motion: reduce) {
  .hw-screen { aspect-ratio: 1.3; }
  .hw-film *, .hw-film *::before, .hw-film *::after { transition: none !important; animation: none !important; }
}

/* ---------- The stepper ---------- */
.hw-steps { list-style: none; margin: clamp(36px, 4.4vw, 52px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px clamp(16px, 2.2vw, 28px); }
.hw-steps li { display: flex; min-width: 0; }
.hw-step {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; margin: 0; padding: 0 0 4px; border: 0; border-radius: 0; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hw-step-bar { position: relative; display: block; width: 100%; height: 2px; margin-bottom: 12px; overflow: hidden; background: var(--line); transition: background-color 240ms; }
.hw-step-bar i { position: absolute; inset: 0; background: var(--hx-em); transform: scaleX(0); transform-origin: 0 50%; }
.hw-step-k { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 11px; line-height: 1.2; letter-spacing: 0.08em; text-transform: uppercase; color: var(--caption); transition: color 240ms; }
.hw-step-k i { font-style: normal; color: var(--faint); transition: color 240ms; }
.hw-step-t { font-size: 18px; line-height: 1.3; letter-spacing: -0.017em; color: var(--muted); transition: color 240ms; }
.hw-step-b { font-size: 14.5px; line-height: 1.55; color: var(--caption); text-wrap: pretty; transition: color 240ms; }
.hw-step.is-on .hw-step-k, .hw-step.is-on .hw-step-k i { color: var(--hx-em); }
.hw-step.is-on .hw-step-t { color: var(--ink); }
.hw-step.is-on .hw-step-b { color: var(--muted); }
@media (hover: hover) {
  .hw-step:hover .hw-step-t { color: var(--ink); }
  .hw-step:hover .hw-step-bar { background: var(--line-2); }
}
.hw-step:active .hw-step-t { color: var(--hx-em); }
.hw-step:focus-visible { outline: 2px solid var(--blue, #51A2FF); outline-offset: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hw-head { grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
  .hw-head .hx-h2 { max-width: 20ch; }
  .hw-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .hw-screen { aspect-ratio: 0.8; border-radius: 6px; }
  .hw-toggle { width: 20px; height: 20px; }
  .hw-cap { right: auto; left: 10px; bottom: 10px; height: 26px; font-size: 10px; }
  .hw-steps { margin-top: 32px; }
  /* One still at a time on a phone: the step buttons switch between them. */
  .hw-screen.is-still { display: block; }
  .hw-screen.is-still .hw-panel { position: absolute; inset: 0; }
  .hw-screen.is-still .hw-panel:not(.is-on), .hw-screen.is-still .hw-panel:not(.is-on) * { visibility: hidden !important; }
  .hw-screen.is-still .hw-panel.is-on::after { box-shadow: inset 0 0 0 1px #1E1E20; }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) { .hw-screen { aspect-ratio: 0.8; } }
@media (max-width: 520px) {
  .hw-steps { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .hw-step-b { max-width: 44ch; }
}

/* The film's own frame. These used to be shared with the Results and AI visibility sections; those
   sections now have different layouts, so the frame lives here and cannot be removed from under it. */
.hw .hw-stage { position: relative; isolation: isolate; }
.hw .hw-frame {
  position: relative; z-index: 1; margin: 0; overflow: hidden; border-radius: 14px; background: #0B0B0D; color: #EDEDED;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 40px 80px -36px rgba(0, 0, 0, 0.55), 0 12px 28px -18px rgba(0, 0, 0, 0.4);
}
.hw .hw-frame > .hp-bar {
  display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px 0 14px;
  background: #121214; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.hw .hw-frame > .hp-bar > span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); flex: none; }
.hw .hw-frame > .hp-bar > em {
  flex: 1 1 auto; min-width: 0; text-align: center; font-style: normal; font-family: var(--font-mono); font-size: 11px;
  color: rgba(255, 255, 255, 0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hw .hw-frame > .hp-bar > .hp-sample { flex: none; color: rgba(255, 255, 255, 0.6); }
.hw .hw-frame > .hp-bar > .hw-toggle { flex: none; margin-left: 6px; }
@media (max-width: 640px) { .hw .hw-frame { border-radius: 10px; } .hw .hw-frame > .hp-bar > em { text-align: left; } }
