/* KaroVox "How it works" (howto.js): mode buttons, three steps with scenes, one "Try" button. Load after premium.css.
   Only theme tokens from premium.css (dark default, html[data-theme="light"] light). Phone: mode buttons 2 x 2, one big
   scene at a time with the next mode peeking in from the right (swipe), dots under the scene, the three steps as rows;
   >= 760 px: buttons in one row, three cards in a row. .hw-compact: always the phone layout, lower stage, no peek. */
.hw { --hw-stage: 86%; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* deep version of the brand gradient: white text on it stays >= 4.5:1 (#d6176a 5.0, #a8237f 6.1, #6a3fd6 6.1) */
.hw { --hw-on: linear-gradient(110deg, #d6176a 0%, #a8237f 48%, #6a3fd6 100%); }

/* ---- mode buttons ---- */
.hw-head { position: relative; }
.hw-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hw-tab { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 54px; padding: 6px 14px 6px 7px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); box-shadow: var(--shadow-s); cursor: pointer; overflow: hidden;
  color: var(--text); font: 650 15px/1.15 var(--font); letter-spacing: -0.01em; text-align: left; -webkit-tap-highlight-color: transparent;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.2s var(--ease); }
.hw-tab:hover { border-color: var(--violet); box-shadow: var(--shadow-s), 0 0 0 3px rgba(124, 92, 255, 0.14); }
.hw-tab:active { transform: scale(0.97); }
.hw-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hw-tl { position: relative; z-index: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-ico { position: relative; z-index: 1; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  color: var(--accent); background: var(--accent-soft); transition: background-color 0.25s, color 0.25s; }
.hw-ico svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.hw-tab[aria-selected="true"] { color: #fff; border-color: transparent; background: var(--hw-on);
  box-shadow: 0 10px 30px -12px rgba(214, 23, 106, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.12) inset; }
.hw-tab[aria-selected="true"] .hw-ico { color: #fff; background: rgba(255, 255, 255, 0.2); }
/* auto-advance: a bright bar along the bottom of the active button */
.hw-prog { position: absolute; left: 22px; right: 22px; bottom: 6px; height: 3.5px; border-radius: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.3); opacity: 0; transition: opacity 0.3s; }
.hw-prog i { display: block; height: 100%; border-radius: inherit; background: #fff; box-shadow: 0 0 8px rgba(255, 255, 255, 0.8); transform: scaleX(0); transform-origin: 0 50%; }
.hw-tab[aria-selected="true"] .hw-prog { opacity: 1; }
.hw-held .hw-prog { opacity: 0 !important; }
/* first show: the other buttons glow twice */
.hw-intro .hw-tab[aria-selected="false"] { animation: hw-pulse 1.3s var(--ease) 2; }
.hw-intro .hw-tab[aria-selected="false"]:nth-child(2) { animation-delay: 0.12s; }
.hw-intro .hw-tab[aria-selected="false"]:nth-child(3) { animation-delay: 0.24s; }
.hw-intro .hw-tab[aria-selected="false"]:nth-child(4) { animation-delay: 0.36s; }
@keyframes hw-pulse { 0% { box-shadow: var(--shadow-s), 0 0 0 0 rgba(255, 46, 126, 0.55); border-color: var(--pink); }
  70% { box-shadow: var(--shadow-s), 0 0 0 9px rgba(255, 46, 126, 0); border-color: var(--violet); } 100% { box-shadow: var(--shadow-s), 0 0 0 0 rgba(255, 46, 126, 0); } }

/* "Tap a mode": a small inverted chip under the buttons, arrow up */
.hw-tip { position: absolute; z-index: 6; left: 50%; top: 100%; margin-top: 12px; transform: translateX(-50%); padding: 8px 15px; border-radius: 999px;
  background: var(--text); color: var(--bg); font: 650 13.5px/1.2 var(--font); white-space: nowrap; pointer-events: none;
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, 0.55); animation: hw-tip-in 0.4s var(--ease-out) both, hw-tip-bob 1.6s 0.4s ease-in-out infinite; }
.hw-tip::before { content: ""; position: absolute; left: 50%; top: -5px; width: 11px; height: 11px; margin-left: -5.5px; background: inherit; border-radius: 2px; transform: rotate(45deg); }
.hw-tip[hidden] { display: none; }
.hw-tip.hw-tip-out { opacity: 0; transition: opacity 0.25s; animation: none; }
@keyframes hw-tip-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes hw-tip-bob { 0%, 100% { transform: translateX(-50%); } 50% { transform: translate(-50%, -4px); } }

/* ---- views (all four stacked in one cell: no height jump between modes) ---- */
.hw-panel { position: relative; touch-action: pan-y; outline: 0; min-width: 0; overflow: hidden; overflow: clip; }
.hw-track { position: relative; display: grid; }
/* drag: the scenes (not the step rows) follow the finger; --hw-dx is set by howto.js */
.hw-track .hw-art, .hw-peek { translate: var(--hw-dx, 0px) 0; }
.hw-track.hw-snap .hw-peek { transition: translate 0.3s var(--ease-out); }
.hw-track.hw-snap .hw-art { transition: opacity 0.5s var(--ease), transform 0.6s var(--ease-out), translate 0.3s var(--ease-out); }
.hw-view { position: relative; grid-area: 1 / 1; min-width: 0; opacity: 0; visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0s linear 0.35s; }
.hw-view.on { opacity: 1; visibility: visible; transition: opacity 0.45s var(--ease-out), visibility 0s; }
.hw-view.hw-enter { animation: hw-in 0.55s var(--ease-out) both; }
.hw[data-dir="prev"] .hw-view.hw-enter { animation-name: hw-in-prev; }
@keyframes hw-in { from { opacity: 0; transform: translateX(48px); } to { opacity: 1; transform: none; } }
@keyframes hw-in-prev { from { opacity: 0; transform: translateX(-48px); } to { opacity: 1; transform: none; } }
.hw-view:not(.on) .sc * { animation-play-state: paused !important; }

/* phone: the stage is --hw-stage of the width (square); padding / margin in % are taken from the width */
.hw-steps { position: relative; margin: 0; padding: calc(var(--hw-stage) + 34px) 0 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.hw-step { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hw-art { position: absolute; top: 0; left: 0; width: var(--hw-stage); aspect-ratio: 1 / 1; border-radius: var(--radius-l);
  box-shadow: inset 0 0 0 1px var(--line); opacity: 0; transform: scale(0.985);
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease-out); }
.hw-step.on .hw-art { opacity: 1; transform: none; z-index: 1; }
.hw-step:not(.on) .hw-art .sc * { animation-play-state: paused !important; }
.hw-art > svg.sc, .hw-peek-art > svg.sc { border-radius: inherit; }
.hw-cap { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 6px 14px; border-radius: 14px; color: var(--muted);
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.hw-step.on .hw-cap { color: var(--text); background: var(--glass); box-shadow: inset 0 0 0 1px var(--line-strong); }
.hw-num { flex: none; min-width: 30px; font-family: var(--display); font-style: italic; font-weight: 600; font-size: 22px; line-height: 1;
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: lining-nums tabular-nums; }
.hw-txt { font-family: var(--font); font-weight: 600; font-size: 16px; line-height: 1.25; letter-spacing: -0.01em; }

/* the next mode peeking in from the right (tap = next) */
.hw-peek { position: absolute; z-index: 1; top: 0; left: calc(var(--hw-stage) + 10px); width: var(--hw-stage); aspect-ratio: 1 / 1; padding: 0; border: 0;
  border-radius: var(--radius-l); background: none; overflow: hidden; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hw-peek-art { position: absolute; inset: 0; display: none; border-radius: inherit; opacity: 0.6; }
.hw-peek-art.on { display: block; }
.hw-peek-art .sc * { animation-play-state: paused !important; }
.hw-peek-go { position: absolute; z-index: 2; left: 6px; top: 50%; display: grid; place-items: center; width: 30px; height: 30px; margin-top: -15px;
  border-radius: 50%; color: #fff; background: var(--hw-on); box-shadow: 0 6px 16px -6px rgba(214, 23, 106, 0.9); }
.hw-peek-go svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* dots under the scene */
.hw-dots { position: absolute; z-index: 2; top: 0; left: 0; width: var(--hw-stage); margin-top: calc(var(--hw-stage) + 8px);
  display: flex; justify-content: center; gap: 2px; }
.hw-dot { width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
.hw-dot::before { content: ""; width: 7px; height: 7px; border-radius: 4px; background: var(--line-strong); transition: width 0.3s var(--ease-out), background-color 0.3s; }
.hw-dot.on::before { width: 22px; background: var(--hw-on); }

/* tour: "on my own" line, a glass chip on the bottom edge of the stage */
.hw-hint { position: absolute; z-index: 2; top: 0; left: 10px; width: calc(var(--hw-stage) - 20px); margin: calc(var(--hw-stage) - 10px) 0 0; transform: translateY(-100%);
  padding: 8px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.35; color: var(--text-soft);
  background: var(--glass); box-shadow: inset 0 0 0 1px var(--line-strong); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); pointer-events: none; }
.hw-hint b { color: var(--text); font-weight: 650; }

/* ---- try ---- */
.hw-cta-row { display: flex; justify-content: center; }
.hw .hw-try { width: 100%; max-width: 460px; }
.hw-try-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- small phones (320): tighter buttons ---- */
@media (max-width: 359px) {
  .hw-tab { min-height: 50px; gap: 7px; padding: 5px 8px 5px 6px; font-size: 13.5px; letter-spacing: -0.02em; }
  .hw-ico { width: 32px; height: 32px; }
  .hw-ico svg { width: 19px; height: 19px; }
  .hw-txt { font-size: 15px; }
  .hw-cap { min-height: 38px; padding: 5px 12px; }
}

/* ---- compact: full-width stage 16:10, no peek ---- */
.hw-compact { --hw-stage: 100%; gap: 12px; }
.hw-compact .hw-steps { padding-top: calc(100% * 10 / 16 + 32px); gap: 2px; }
.hw-compact .hw-art { aspect-ratio: 16 / 10; border-radius: 20px; }
.hw-compact .hw-peek { display: none; }
.hw-compact .hw-dots { margin-top: calc(100% * 10 / 16 + 6px); }
.hw-compact .hw-hint { margin-top: calc(100% * 10 / 16 - 8px); font-size: 12.5px; padding: 6px 10px; }
.hw-compact .hw-cap { min-height: 38px; padding: 5px 12px; }
.hw-compact .hw-num { font-size: 18px; min-width: 26px; }
.hw-compact .hw-txt { font-size: 15px; }
.hw-compact .hw-try { min-height: 54px; font-size: 16px; }

/* ---- wide: buttons in one row, three cards in a row ---- */
@media (min-width: 560px) {
  .hw:not(.hw-compact) .hw-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 760px) {
  .hw:not(.hw-compact) { --hw-stage: 100%; gap: 28px; }
  .hw:not(.hw-compact) .hw-tabs { width: 100%; max-width: 820px; margin: 0 auto; gap: 10px; }
  .hw:not(.hw-compact) .hw-tab { min-height: 58px; font-size: 16px; justify-content: flex-start; }
  .hw:not(.hw-compact) .hw-panel { overflow: visible; padding-top: 4px; }
  .hw:not(.hw-compact) .hw-peek, .hw:not(.hw-compact) .hw-dots { display: none; }
  .hw:not(.hw-compact) .hw-steps { padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .hw:not(.hw-compact) .hw-step { position: relative; display: flex; flex-direction: column; border-radius: var(--radius-l); overflow: hidden;
    background: linear-gradient(var(--card), var(--card)) padding-box, var(--edge) border-box; border: 1px solid transparent; box-shadow: var(--shadow-s);
    transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease-out); }
  .hw:not(.hw-compact) .hw-step:hover { transform: translateY(-2px); }
  .hw:not(.hw-compact) .hw-step.on { background: linear-gradient(var(--card), var(--card)) padding-box, var(--grad) border-box;
    box-shadow: var(--shadow-s), 0 18px 50px -24px rgba(255, 46, 126, 0.75); transform: translateY(-3px); }
  .hw:not(.hw-compact) .hw-art { translate: none; position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 0; box-shadow: none; opacity: 1; transform: none; }
  .hw:not(.hw-compact) .hw-step:not(.on) .hw-art .sc * { animation-play-state: running !important; }
  .hw:not(.hw-compact) .hw-view:not(.on) .hw-art .sc * { animation-play-state: paused !important; }
  .hw:not(.hw-compact) .hw-cap { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 16px; min-height: 0; flex: 1;
    padding: 18px 22px 22px; border-radius: 0; background: none !important; box-shadow: none !important; color: var(--text); }
  .hw:not(.hw-compact) .hw-num { font-size: 46px; line-height: 0.9; min-width: 0; }
  .hw:not(.hw-compact) .hw-txt { font-family: var(--display); font-size: 23px; line-height: 1.12; letter-spacing: -0.02em; }
  .hw:not(.hw-compact) .hw-hint { position: static; transform: none; width: fit-content; max-width: 100%; margin: 18px auto 0; text-align: center;
    font-size: 15px; padding: 9px 18px; border-radius: 999px; }
}

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