/* The frontend question hero (markup from sd-hero.js; LEARNINGS N). Loaded on frontend question pages only.
   Uses the tokens and the [data-hue] mapping in sd.css; defines no tokens. Independent of sd-reqs.css
   except for the Interview insights dialog, which shows the numbers band as sd-reqs.js draws it. */

/* ---------- header: title + Interview insights, then the quiet out-of-scope line ---------- */
.sd-hero-head { padding-bottom: clamp(18px, 2.4vw, 28px); }
/* baseline, not flex-end: with the smaller title (round 5, point 7) the 44px button bottom-aligned pushed the title
   13px further down than on backend pages. */
.sd-hero-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 28px; }
.sd-hero-title h1 { flex: 1 1 0; min-width: min(100%, 14em); }
.sd-hero-ins {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 2px; margin-block: -6px;
  border: 0; background: none; cursor: pointer; color: var(--text);
  font: 700 1.05rem/1.2 var(--font-body); text-decoration: underline; text-underline-offset: .22em; text-decoration-thickness: .08em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); -webkit-tap-highlight-color: transparent;
}
.sd-hero-ins:hover { text-decoration-color: currentColor; }
.sd-hero-ins:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sd-hero-ins-ic { width: 20px; height: 20px; flex: none; color: var(--sd-amber-ink); }
.sd-hero-out { margin: 12px 0 0; color: var(--text-muted); font-size: 1.05rem; line-height: 1.5; }
.sd-hero-out-l { font-weight: 700; color: var(--sd-rose-ink); margin-right: .2em; }
.sd-hero-out-sep { color: var(--text-muted); }
.sd-hero-out-i { white-space: normal; }

/* ---------- the hero: demo left, points right ---------- */
.sd-hero {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1fr); align-items: start;
  gap: 20px clamp(24px, 3vw, 44px); padding: 4px var(--gut) clamp(32px, 4vw, 52px);
}
.sd-hero-stage { position: sticky; top: 14px; min-width: 0; }
.sd-hero-cap {
  margin: 0 0 12px; min-height: calc(2 * 1.45em); line-height: 1.45; font-weight: 700; font-size: 1.15rem;
  color: var(--sd-h-ink, var(--text)); overflow-wrap: anywhere;
}
.sd-hero-frame {
  display: block; width: 100%; height: var(--h, 520px); border: 1.5px solid var(--rule); border-radius: 6px;
  background: var(--paper); color-scheme: normal;
}
.sd-hero-frame:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sd-hero-acts { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; min-height: 44px; }
/* a hidden "Show the whole app" must not hold its space, or the row needs 335px at 320 (round 5 mobile pass) */
.sd-hero-acts > [hidden] { display: none; }
.sd-hero-acts > :last-child { margin-left: auto; }
.sd-hero-act {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 14px;
  font: 700 .98rem/1.2 var(--font-body); border-radius: 6px; cursor: pointer; white-space: nowrap;
  border: 1.5px solid var(--rule); background: var(--paper); color: var(--text);
  transition: border-color .15s var(--ease), transform .1s var(--ease);
}
@media (hover: hover) { .sd-hero-act:hover { border-color: var(--text); } }
.sd-hero-act:active { transform: scale(.97); }
.sd-hero-act:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sd-hero-act:last-child { margin-left: auto; }
/* kept in the layout while the whole app is showing, so nothing moves when it comes back */
.sd-hero-whole.is-off { visibility: hidden; }

/* the switch */
.sd-hero-side { min-width: 0; }
.sd-hero-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  border: 1.5px solid var(--rule); border-radius: 9px; background: var(--paper-2);
}
.sd-hero-tab {
  min-height: 48px; padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text);
  font: 700 1rem/1.2 var(--font-body); cursor: pointer; text-align: center; white-space: normal;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
@media (hover: hover) { .sd-hero-tab:hover { background: var(--paper); } }
.sd-hero-tab[aria-pressed="true"] { background: var(--action); color: var(--action-on); }
.sd-hero-tab:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* both lists share one cell, so the switch never changes the hero's height */
.sd-hero-lists { display: grid; margin-top: 12px; }
.sd-hero-list { grid-area: 1 / 1; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; visibility: hidden; }
.sd-hero-list.is-on { visibility: visible; }
.sd-hero-list > li { margin: 0; }

/* a point: the whole row is the button */
.sd-hero-pt {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; column-gap: 14px;
  width: 100%; padding: 12px 12px 12px 10px; margin: 0; text-align: left; cursor: pointer;
  border: 1.5px solid transparent; border-bottom-color: var(--border); border-radius: 8px;
  background: transparent; color: var(--text); font: inherit; line-height: 1.4;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .sd-hero-pt:hover { background: var(--paper-2); border-color: var(--border); } }
.sd-hero-pt:active { transform: scale(.99); }
.sd-hero-pt:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sd-hero-pt[aria-pressed="true"] { background: var(--sd-h-bg); border-color: var(--sd-h-ink); color: var(--sd-h-tx, var(--text)); }
.sd-hero-pt.is-static { cursor: default; }
.sd-hero-ic {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--sd-h-bg); color: var(--sd-h-ink); border: 1.5px solid var(--sd-h-ink);
}
.sd-hero-pt[aria-pressed="true"] .sd-hero-ic { background: var(--sd-h-fill); color: var(--sd-h-on); border-color: var(--sd-h-fill); }
.sd-hero-ic-svg { width: 21px; height: 21px; }
.sd-hero-pt-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-top: 2px; }
/* headline 1.2x its detail at every width, and the detail on the 16px floor (review 2026-11-19: 1.06rem over
   .98rem was one size, and .98rem was under the floor) */
.sd-hero-pt-head { font-weight: 700; font-size: 1.2rem; line-height: 1.3; overflow-wrap: anywhere; }
.sd-hero-pt-detail { font-size: 1rem; color: var(--text-muted); overflow-wrap: anywhere; }
.sd-hero-pt[aria-pressed="true"] .sd-hero-pt-detail { color: var(--sd-h-tx, var(--text)); }
.sd-hero-go {
  display: inline-flex; align-items: center; gap: 6px; align-self: center; padding: 6px 11px; border-radius: 6px;
  border: 1.5px solid var(--rule); color: var(--text); font: 700 .95rem/1.1 var(--font-body); white-space: nowrap;
}
.sd-hero-go-ic { width: 13px; height: 13px; }
@media (hover: hover) { .sd-hero-pt:hover .sd-hero-go { border-color: var(--text); } }
.sd-hero-pt[aria-pressed="true"] .sd-hero-go { background: var(--action); color: var(--action-on); border-color: var(--action); }

/* ---------- the Interview insights dialog ---------- */
.sd-hero-dlg { width: min(780px, calc(100vw - 32px)); max-height: min(86vh, 900px); }
.sd-hero-dlg[open] { display: flex; flex-direction: column; }
.sd-hero-dlg-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 14px 24px;
  background: var(--sd-amber-fill); color: var(--sd-amber-on);
}
.sd-hero-dlg-top h2 { margin: 0; font-size: 2rem; line-height: 1.1; }
.sd-hero-dlg-top .sd-btn { min-height: 44px; }
.sd-hero-dlg-in { overflow: auto; padding: 20px 24px 24px; }
.sd-hero-dlg-in .sd-rq-sec { padding-bottom: 0; }
.sd-hero-dlg-in .sd-rq-sec > * { margin-inline: 0; }
/* inside the 780px dialog the requirement scale steps down one notch and stays under the dialog's title:
   title 32px > group 25.6px (1.28x) > headline 20px (1.25x) > detail 16px */
.sd-hero-dlg-in .sd-rq-gh { font-size: 1.6rem; }
.sd-hero-dlg-in .sd-rq-pt { --pt-lh: calc(1.25rem * 1.3); }
.sd-hero-dlg-in .sd-rq-pt-head { font-size: 1.25rem; }
.sd-hero-dlg-in .sd-rq-pt-detail { font-size: 1rem; }
.sd-hero-dlg-in .sd-rq-pt-sum { font-size: 1rem; }
.sd-hero-ins-list { margin: 0; padding-left: 1.2em; }
.sd-hero-ins-list > li { margin: 0 0 10px; }

/* ---------- narrow: demo on top, the switch and the points below ---------- */
@media (max-width: 1100px) {
  .sd-hero { grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); }
}
@media (max-width: 760px) {
  .sd-hero { grid-template-columns: minmax(0, 1fr); }
  .sd-hero-stage { position: static; scroll-margin-top: 12px; }
}
@media (max-width: 600px) {
  .sd-hero-title { align-items: flex-start; }
  .sd-hero-ins { margin-bottom: 0; }
  .sd-hero-out { font-size: 1rem; }
  .sd-hero-frame { height: var(--hp, var(--h, 520px)); }
  .sd-hero-cap { font-size: 1.06rem; min-height: calc(3 * 1.45em); }
  .sd-hero-tab { font-size: .96rem; padding: 8px; }
  .sd-hero-pt { grid-template-columns: auto minmax(0, 1fr); row-gap: 8px; column-gap: 12px; }
  .sd-hero-go { grid-column: 2; justify-self: start; }
  .sd-hero-ic { width: 36px; height: 36px; }
  .sd-hero-dlg-in { padding: 16px 18px 20px; }
  .sd-hero-dlg-top h2 { font-size: 1.75rem; }
  .sd-hero-dlg-in .sd-rq-gh { font-size: 1.5rem; }
  .sd-hero-dlg-in .sd-rq-pt { --pt-lh: calc(1.2rem * 1.3); }
  .sd-hero-dlg-in .sd-rq-pt-head { font-size: 1.2rem; }

  /* the page: title, the hero, then level 1; once level 1 is answered the hero moves into the sheet
     (sd.js renders a second one there), the same way the requirements do on the backend path */
  .sd-player.is-playing > .sd-hero { order: 0; }
  .sd-player.is-started > .sd-hero { display: none; }
  .sd-sheet .sd-hero { padding-top: 14px; }
  .sd-sheet .sd-hero-stage { scroll-margin-top: 84px; }   /* clear of the sheet's sticky tab row */
}
/* ---------- phones: the answer box comes up (Rahul, 2026-11-20, mobile pass B7: "do BOTH") ----------
   1. "Start answering Level N" directly under the demo (sd.js; it scrolls to the level and puts the cursor in the
      answer box). The guide's blue with white text, like the band it leads to (4.90:1 in both themes).
   2. The points are one line each, headline + "Try it": a point's detail opens when it is pressed (it plays in
      the demo at the same time). The detail stays in the button's accessible name while it is closed. */
.sd-hero-start { display: none; }
@media (max-width: 600px) {
  .sd-hero-start {
    display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; margin-top: 12px; padding: 10px 16px;
    border-radius: 6px; background: var(--sd-blue-fill); color: #ffffff; text-decoration: none;
    font: 700 1.1rem/1.2 var(--font-body); -webkit-tap-highlight-color: transparent;
  }
  .sd-hero-start::after {
    content: ""; 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' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v15M5 12l7 7 7-7'/%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' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v15M5 12l7 7 7-7'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .sd-hero-start:active { transform: scale(.98); }
  .sd-hero-start:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

  .sd-hero-pt { position: relative; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; row-gap: 0; padding-block: 8px; }
  .sd-hero-go { grid-column: auto; justify-self: end; }
  .sd-hero-pt-body { padding-top: 0; }
  .sd-hero-pt-head { font-size: 1.1rem; }
  /* only the list on show takes room: with one-line points the longer hidden list left an empty band of up to 139px
     above Level 1 (the shared cell keeps the hero's height fixed on wider screens, where the demo is sticky beside it;
     here a switch is a tap, so the page below moving is expected) */
  .sd-hero-list:not(.is-on) { display: none; }
  .sd-hero-pt:not([aria-pressed="true"]) .sd-hero-pt-detail {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sd-hero-pt:active, .sd-hero-act:active, .sd-hero-start:active { transform: none; }
}
