/* Home hero: copy on the left, the product on the right.

   Colours come from the design-system tokens when they exist and fall back to the current
   palette, so this file keeps working before and after the token stylesheet lands. Every box in
   the preview has a fixed size: the loop and the captions swap inside it, never around it, so
   neither the animation nor pressing Play moves anything on the page. */
.home-page .home-hero.hh {
  --hh-primary: var(--color-primary, #2457e6);
  --hh-primary-hover: var(--color-primary-hover, #1642bf);
  --hh-ink: var(--color-text, #101c2d);
  --hh-muted: var(--color-text-muted, #4f5a66);
  --hh-border: var(--color-border, #d6dee6);
  --hh-surface: var(--color-surface, #ffffff);
  --hh-subtle: var(--color-surface-subtle, #f3f6f9);
  --hh-navy: var(--color-surface-inverse, #102739);
  --hh-navy-2: var(--color-surface-inverse-raised, #19354a);
  --hh-on-navy: var(--color-text-inverse, #eef5fc);
  --hh-on-navy-muted: var(--color-text-inverse-muted, #b9cddd);
  --hh-success: var(--color-success, #087f66);
  --hh-success-soft: var(--color-success-soft, #e6f4ef);
  --hh-caller: var(--color-primary-soft, #edf3ff);
  --hh-focus: var(--color-focus, #2457e6);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  max-width: 1264px;
  padding-top: clamp(28px, 4.5vw, 72px);
  padding-bottom: clamp(36px, 4.5vw, 72px);
}
.home-page .home-hero.hh h1 { font-size: clamp(38px, 4.1vw, 60px); line-height: 1.06; letter-spacing: -0.02em; }
.home-page .home-hero.hh .product-lead { max-width: 560px; font-size: clamp(17px, 1.35vw, 20px); }
.home-page .home-hero.hh .product-actions { align-items: center; gap: 12px 28px; }
.hh-guided {
  color: var(--hh-primary);
  font-weight: 700;
  font-size: 15px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.hh-guided:hover { color: var(--hh-primary-hover); }
.home-page .home-hero.hh .home-demo-note { margin-top: 14px; }
.home-page .home-hero.hh .home-facts { max-width: 560px; margin-top: 20px; }

.hh-sr {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hh button, .hh a { -webkit-tap-highlight-color: transparent; }
.hh button { font-family: inherit; cursor: pointer; }
.hh button:focus-visible, .hh a:focus-visible { outline: 3px solid var(--hh-focus); outline-offset: 3px; }

/* ---- The product panel ---- */
.hh-product {
  min-width: 0;
  background: var(--hh-surface);
  border: 1px solid var(--hh-border);
  border-radius: 20px;
  padding: 10px;
  box-shadow: 0 1px 2px rgba(16, 28, 45, .04), 0 24px 64px -24px rgba(16, 39, 57, .28);
}
.hh-console {
  position: relative;
  background: var(--hh-navy);
  color: var(--hh-on-navy);
  border-radius: 13px;
  overflow: hidden;
  height: 440px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.hh-console[data-mode="call"] { cursor: default; }
.hh-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  flex: none;
}
.hh-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #4e687d;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--hh-on-navy);
  white-space: nowrap;
}
.hh-dot { width: 7px; height: 7px; border-radius: 50%; background: #7fe0c4; box-shadow: 0 0 0 3px rgba(127, 224, 196, .16); flex: none; }
.hh-bar-title { font-size: 13px; color: var(--hh-on-navy-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The white workspace inside the navy frame, as on the demo page. */
.hh-stage, .hh-call {
  flex: 1;
  min-height: 0;
  margin: 0 8px 8px;
  background: var(--hh-surface);
  color: var(--hh-ink);
  border-radius: 9px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hh-console[data-mode="call"] .hh-stage { display: none; }
.hh-label {
  margin: 0 0 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--hh-muted);
}
.hh-bubble {
  margin: 0;
  background: var(--hh-caller);
  border: 1px solid #d5e2fa;
  border-radius: 12px 12px 12px 3px;
  padding: 11px 14px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--hh-ink);
}
.hh-fields { margin: 0; display: grid; gap: 6px; }
.hh-field {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 40px;
  padding: 7px 11px;
  border: 1px dashed #cfd9e3;
  border-radius: 8px;
  transition: background-color .4s ease, border-color .4s ease;
}
.hh-field dt { font-size: 13px; color: var(--hh-muted); font-weight: 700; }
.hh-field dd { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.35; position: relative; min-width: 0; }
.hh-value { transition: opacity .35s ease .18s, transform .35s ease .18s; }
.hh-wait { transition: opacity .15s ease; }
.hh-wait { position: absolute; left: 0; top: 50%; transform: translateY(-50%); font-weight: 500; color: #7a8794; font-style: italic; opacity: 0; }
.hh-card {
  margin-top: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--hh-success-soft);
  border: 1px solid #b8dfd0;
  transition: opacity .45s ease, transform .45s ease;
}
.hh-tick { width: 28px; height: 28px; border-radius: 50%; background: var(--hh-success); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.hh-card-text b { display: block; font-size: 14.5px; color: #064f40; }
.hh-card-text span { display: block; font-size: 12.5px; color: #3a5a52; margin-top: 2px; }
.hh-ref {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #064f40;
  background: #fff;
  border: 1px solid #b8dfd0;
  border-radius: 6px;
  padding: 5px 8px;
  white-space: nowrap;
}
.hh-caller-line { transition: opacity .45s ease, transform .45s ease; }

/* Loop steps. "final" is also the no-script and reduced-motion state, so the first paint is the
   finished request and nothing flashes in before the script arrives. */
.hh-console[data-step="0"] .hh-caller-line,
.hh-console[data-step="0"] .hh-card, .hh-console[data-step="1"] .hh-card,
.hh-console[data-step="2"] .hh-card, .hh-console[data-step="3"] .hh-card,
.hh-console[data-step="4"] .hh-card { opacity: 0; transform: translateY(6px); }
.hh-field .hh-value { opacity: 1; }
.hh-console[data-step="0"] .hh-field .hh-value,
.hh-console[data-step="1"] .hh-field .hh-value,
.hh-console[data-step="2"] .hh-field[data-at="3"] .hh-value,
.hh-console[data-step="2"] .hh-field[data-at="4"] .hh-value,
.hh-console[data-step="3"] .hh-field[data-at="4"] .hh-value { opacity: 0; transform: translateX(-4px); }
.hh-console[data-step="1"] .hh-field .hh-wait,
.hh-console[data-step="2"] .hh-field[data-at="3"] .hh-wait,
.hh-console[data-step="2"] .hh-field[data-at="4"] .hh-wait,
.hh-console[data-step="3"] .hh-field[data-at="4"] .hh-wait { opacity: 1; }
.hh-console:not([data-step="0"]):not([data-step="1"]) .hh-field[data-at="2"],
.hh-console[data-step="3"] .hh-field[data-at="3"], .hh-console[data-step="4"] .hh-field[data-at="3"],
.hh-console[data-step="final"] .hh-field[data-at="3"],
.hh-console[data-step="4"] .hh-field[data-at="4"], .hh-console[data-step="final"] .hh-field[data-at="4"] {
  border-style: solid;
  border-color: #cfe0f7;
  background: #f7faff;
}
.hh-console[data-step="fade"] .hh-stage > * { opacity: 0; transition: opacity .5s ease; }

/* ---- The playing call ---- */
.hh-call { overflow: hidden; gap: 10px; }
.hh-transcript { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.hh-turn { max-width: 94%; }
.hh-turn .hh-who { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--hh-muted); margin-bottom: 4px; }
.hh-turn .hh-said { margin: 0; padding: 10px 13px; font-size: 14.5px; line-height: 1.55; border-radius: 12px 12px 12px 3px; background: var(--hh-caller); border: 1px solid #d5e2fa; }
.hh-turn.is-assistant { align-self: flex-end; }
.hh-turn.is-assistant .hh-who { text-align: right; }
.hh-turn.is-assistant .hh-said { background: var(--hh-subtle); border-color: #e0e7ee; border-radius: 12px 12px 3px 12px; }
.hh-cue { transition: color .3s ease, opacity .3s ease; }
.hh-cue.is-past { color: #44515e; }
.hh-cue.is-now { color: var(--hh-ink); background: #dfe8fb; border-radius: 3px; box-shadow: 0 0 0 2px #dfe8fb; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.hh-cue.is-future { display: none; }
.hh-call[data-captions="all"] .hh-cue.is-future { display: inline; }
.hh-source {
  flex: none;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: #064f40;
  background: var(--hh-success-soft);
  border: 1px solid #b8dfd0;
  border-radius: 8px;
  padding: 8px 11px;
}

/* ---- The player ---- */
.hh-player { padding: 12px 6px 4px; }
.hh-controls, .hh-next { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.hh-play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--hh-primary);
  background: var(--hh-surface);
  color: var(--hh-primary);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  flex: none;
}
.hh-play:hover { background: #f1f5ff; }
.hh-play small { font-weight: 600; font-size: 13px; color: var(--hh-muted); }
.hh-play-icon { width: 34px; height: 34px; border-radius: 50%; background: var(--hh-primary); position: relative; flex: none; }
.hh-play-icon::before {
  content: "";
  position: absolute; left: 13px; top: 10px;
  border-style: solid; border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent #fff;
}
.hh-player[data-state="playing"] .hh-play-icon::before,
.hh-player[data-state="loading"] .hh-play-icon::before {
  left: 11px; top: 11px; width: 4px; height: 12px; border: 0;
  background: #fff; box-shadow: 8px 0 0 #fff;
}
.hh-progress { flex: 1; min-width: 40px; height: 4px; border-radius: 4px; background: #e2e8ee; overflow: hidden; }
.hh-progress-fill { display: block; height: 100%; width: 100%; background: var(--hh-primary); transform-origin: left; transform: scaleX(0); }
.hh-time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--hh-muted); white-space: nowrap; }
.hh-sound {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 0 10px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--hh-muted); font-size: 13px; font-weight: 700; white-space: nowrap;
}
.hh-sound:hover { background: var(--hh-subtle); color: var(--hh-ink); }
.hh-sound-icon { width: 18px; height: 18px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='black'/%3E%3Cpath d='M16 8.5a5 5 0 0 1 0 7M18.5 6a8.5 8.5 0 0 1 0 12' stroke='black' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='black'/%3E%3Cpath d='M16 8.5a5 5 0 0 1 0 7M18.5 6a8.5 8.5 0 0 1 0 12' stroke='black' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.hh-sound[aria-pressed="false"] .hh-sound-icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='black'/%3E%3Cpath d='M16 9l6 6M22 9l-6 6' stroke='black' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='black'/%3E%3Cpath d='M16 9l6 6M22 9l-6 6' stroke='black' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
.hh-next { flex-wrap: wrap; gap: 10px 18px; }
.hh-next-primary {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 8px;
  background: var(--hh-primary); color: #fff; font-weight: 700; font-size: 15px; text-decoration: none;
}
.hh-next-primary:hover { background: var(--hh-primary-hover); color: #fff; }
.hh-next-secondary {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--hh-primary); font-weight: 700; font-size: 15px;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.hh-replay {
  margin-left: auto; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--hh-muted); font-size: 14px; font-weight: 700;
}
.hh-replay:hover { background: var(--hh-subtle); color: var(--hh-ink); }
.hh-player[data-state="ended"] .hh-excerpt, .hh-player[data-state="fallback"] .hh-excerpt { display: none; }
.hh-excerpt, .hh-status { margin: 6px 4px 0; font-size: 13px; line-height: 1.5; color: var(--hh-muted); }
.hh-status:empty { display: none; }
.hh-status { color: #8a4b00; }

/* ---- Tablet and phone: copy first, then the product ---- */
@media (max-width: 980px) {
  .home-page .home-hero.hh { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .hh-product { max-width: 640px; }
}
@media (max-width: 600px) {
  .home-page .home-hero.hh { gap: 28px; }
  .home-page .home-hero.hh .product-actions { gap: 4px; }
  .hh-guided { align-self: center; }
  .hh-product { border-radius: 16px; padding: 6px; margin: 0 -4px; }
  .hh-console { height: 492px; }
  .hh-bar { padding: 12px 12px; }
  .hh-bar-title { display: none; }
  .hh-stage, .hh-call { margin: 0 6px 6px; padding: 14px 13px; gap: 12px; }
  .hh-bubble { font-size: 14.5px; }
  .hh-field { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 5px 10px; min-height: 0; }
  .hh-label { margin-bottom: 5px; }
  .hh-field dt { font-size: 11.5px; }
  .hh-field dd { font-size: 13.5px; min-height: 18px; }
  .hh-card { gap: 10px; padding: 10px 11px; }
  .hh-card { grid-template-columns: auto minmax(0, 1fr); row-gap: 6px; }
  .hh-card-text span { display: none; }
  .hh-ref { grid-column: 2; justify-self: start; font-size: 12.5px; padding: 3px 6px; }
  .hh-controls { flex-wrap: wrap; gap: 4px 8px; }
  .hh-progress { order: -1; flex: 1 0 100%; margin: 0 4px 6px; }
  .hh-time { margin-left: auto; }
  .hh-play { padding-right: 14px; }
  .hh-time { font-size: 12px; }
  .hh-sound { padding: 0; justify-content: center; }
  .hh-sound-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .hh-replay { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hh *, .hh *::before { transition: none !important; animation: none !important; }
}
