/* prueba-3d.html: binaural 3D preview. Uses the tokens of style.css; only adds the few colours
   the scene needs (ring, head, right/wrong), dark first like the rest of the site.
   Opens with a scroll-scrubbed flight around a listener (scroll-world engine, clips rendered offline
   by server/page-tools/prueba3d_world.py), wired like monitor.html. Visual rules after
   elayadesign landing-page-design: Tailwind type and spacing steps, Tailwind radii, borders all
   the way round, flat grounds, gradient only on heading text, spring easing, full control states. */
:root { --ring: #5C5C5C; --head: #2A2A2A; --good: #52D9C7; --bad: #F07A6A; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --ring: #9A9A9A; --head: #E2E2E2; --good: #0C7F72; --bad: #C2412F; }
}
:root[data-theme="light"] { --ring: #9A9A9A; --head: #E2E2E2; --good: #0C7F72; --bad: #C2412F; }

/* ---- flight (scroll-world engine). The renders are dark, so the flight keeps the dark tokens
   even when the rest of the page follows a light system theme. ---- */
#mworld.sw-root {
  --bg: #181818; --surface: #1F1F1F; --line: #313131; --fg: #FFFFFF; --muted: #A6A6A6;
  --accent: #52D9C7; --accent-fg: #0B1A17; --grad-a: #FFFFFF; --grad-b: #9B9B9B;
  --sw-bg: #181818; --sw-ink: #FFFFFF; --sw-ink-soft: #A6A6A6; --sw-accent: #52D9C7;
  --sw-font-display: var(--font); --sw-font-body: var(--font);
}
.p3 .sw-copy__title { font-size: 48px !important; line-height: 1 !important; letter-spacing: -0.02em; }
.p3 .sw-copy__body { font-size: 18px !important; line-height: 28px !important; color: #A6A6A6 !important; }
@media (min-width: 861px) { .p3 .sw-copy { width: min(40vw, 560px) !important; } }
.p3 .sw-hint span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.p3 .sw-btn { font-size: 16px !important; line-height: 24px !important; padding: var(--s2) var(--s4) !important; transition: transform .7s var(--ease), filter .7s var(--ease) !important; }
.p3 .sw-btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.p3 .sw-btn:active { transform: scale(0.98); }
.p3 .sw-btn:focus-visible { outline: 2px solid #52D9C7; outline-offset: 3px; }
@media (max-width: 860px) {
  .p3 .sw-copy__title { font-size: 30px !important; line-height: 36px !important; }
  .p3 .sw-copy__body { font-size: 16px !important; line-height: 24px !important; }
  .p3 .sw-copy__tags { display: none !important; }
}
/* without JS the same scenes are a plain list of stills */
.mw-src { list-style: none; margin: 0 auto; padding: 128px max(16px, 5vw) var(--s16); max-width: 1152px; display: flex; flex-direction: column; gap: var(--s16); }
.mw-on .mw-src { display: none; }
.mw-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s8); align-items: center; }
.mw-item img { width: 100%; border-radius: 16px; border: 1px solid var(--line); }
.mw-copy { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.mw-copy h2 { margin: 0; font-size: 36px; line-height: 40px; letter-spacing: -0.02em; }
.mw-copy p { margin: 0; color: var(--muted); font-size: 18px; line-height: 28px; }
.mw-copy .mw-eyebrow { color: var(--accent); font-size: 14px; line-height: 20px; font-weight: 500; }
.mw-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.mw-tags li { font-size: 14px; line-height: 20px; padding: var(--s1) var(--s3); border-radius: 9999px; border: 1px solid var(--line); background: var(--surface); }
.mw-cta { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* ---- page ---- */
.p3-hero { display: flex; flex-direction: column; gap: var(--s6); max-width: 680px; }
.p3-hero p { margin: 0; }
.p3-badges { display: flex; flex-wrap: wrap; gap: var(--s3); }
.p3-phones { display: inline-flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s3); border: 1px solid var(--accent); color: var(--accent); border-radius: 9999px; font-weight: 600; font-size: 14px; line-height: 20px; }
.p3-phones svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.p3-h2 { font-size: 36px; line-height: 40px; letter-spacing: -0.02em; }
.p3-head { display: flex; flex-direction: column; gap: var(--s3); max-width: 680px; }
.p3-end-cta { margin: var(--s3) 0 0; display: flex; flex-wrap: wrap; gap: var(--s3); }
.p3 .muted { color: var(--muted); }
.p3 select, .p3 input { font: inherit; color: inherit; }
.p3 select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: var(--s1) var(--s2); min-height: 36px; min-width: 0; max-width: 100%; cursor: pointer; transition: border-color .3s var(--ease), background-color .3s var(--ease); }
.p3 select:hover { border-color: var(--muted); background: var(--raised); }
.p3 select:focus-visible, .p3 input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.p3 select:disabled, .p3 input:disabled { opacity: .45; cursor: not-allowed; }
.p3 .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.p3 .btn:disabled { opacity: .45; cursor: not-allowed; transform: none; background: var(--surface); filter: none; }
.p3 .btn-primary:disabled { background: var(--accent); }
.p3 input[type="range"] { cursor: pointer; }
.p3 input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; }

/* Transport */
.p3-transport { display: flex; flex-wrap: wrap; gap: var(--s4) var(--s6); align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: var(--s4); }
.p3-play { min-width: 148px; }
.p3-play .ico { width: 12px; height: 12px; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.p3-play[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.p3-play[aria-pressed="true"] .ico { clip-path: none; }
.p3-fieldset { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.p3-fieldset > span { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); }
.p3-master { display: flex; align-items: center; gap: var(--s3); }
.p3-master input { width: 160px; max-width: 40vw; accent-color: var(--accent); }
.p3-seg { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.p3-seg label { position: relative; flex: 1 1 auto; text-align: center; }
.p3-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.p3-seg span { display: block; padding: var(--s2) var(--s3); font-size: 14px; line-height: 20px; background: var(--surface); transition: background-color .3s var(--ease), color .3s var(--ease); }
.p3-seg label:hover input:not(:checked) + span { background: var(--raised); }
.p3-seg label:active span { transform: translateY(1px); }
.p3-seg input:checked + span { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.p3-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.p3-status { font-size: 12px; line-height: 16px; color: var(--muted); margin-left: auto; }

/* Scene */
.p3-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s6); align-items: start; }
.p3-stage { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); position: sticky; top: 104px; }
.p3-svg { width: 100%; max-width: min(640px, calc((100vh - 340px) * 340 / 280)); margin-inline: auto; aspect-ratio: 340 / 280; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.p3-svg text { font-family: var(--mono); fill: var(--muted); }
.p3 .dot { cursor: grab; }
.p3 .dot:active { cursor: grabbing; }
.p3 .dot:focus { outline: none; }
.p3 .dot:focus-visible .halo { stroke: var(--accent); stroke-width: 2.5; }
.p3-readout { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); align-items: baseline; }
.p3-readout b { font-size: 18px; line-height: 28px; }
.p3-hint { font-size: 14px; line-height: 20px; color: var(--muted); margin: 0; }
.p3-snap { display: inline-flex; gap: var(--s2); align-items: center; font-size: 14px; line-height: 20px; cursor: pointer; }
.p3-snap input { accent-color: var(--accent); }

/* Source cards: border all the way round, the colour lives in the swatch and the selection ring */
.p3-sources { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.p3-sources-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.p3-sources-head h3 { font-size: 20px; line-height: 28px; }
.p3 .card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: var(--s3) var(--s4); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); transition: border-color .3s var(--ease), box-shadow .3s var(--ease); }
.p3 .card:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.p3 .card.sel { border-color: var(--c); box-shadow: 0 0 0 1px var(--c); }
.p3 .card.silent { opacity: .6; }
.p3 .card-top { display: flex; align-items: center; gap: var(--s2) var(--s3); flex-wrap: wrap; }
.p3 .swatch { width: 16px; height: 16px; border-radius: 9999px; background: var(--c); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); }
.p3 .name { font: 600 18px/28px var(--font); color: var(--fg); border: 0; background: none; padding: 0; text-align: left; cursor: pointer; border-radius: 4px; transition: color .3s var(--ease); }
.p3 .name:hover { color: var(--accent); }
.p3 .pos { font-size: 12px; line-height: 16px; color: var(--muted); }
.p3 .spacer { flex: 1; }
.p3 .tog { border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 8px; min-width: 36px; min-height: 32px; padding: var(--s1) var(--s2); font: 600 12px/16px var(--font); cursor: pointer; transition: background-color .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease); }
.p3 .tog:hover { background: var(--raised); border-color: var(--muted); }
.p3 .tog:active { transform: scale(0.98); }
.p3 .tog:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.p3 .tog[aria-pressed="true"].m { background: var(--bad); color: #fff; border-color: var(--bad); }
.p3 .tog[aria-pressed="true"].s { background: #d6a50c; color: #1c1600; border-color: #d6a50c; }
.p3 .tog.x { font-weight: 500; }
.p3 .row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 108px; gap: var(--s3); align-items: center; }
.p3 .row > label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); }
.p3 .row input[type="range"] { width: 100%; accent-color: var(--c); }
.p3 .row input[type="number"] { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: var(--s1) var(--s2); text-align: right; }
.p3 .row select { grid-column: 2 / 4; }
.p3 .row .val { white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; font-size: 12px; line-height: 16px; }
.p3 .row.disabled { opacity: .45; }
.p3 .orbit { display: flex; align-items: center; gap: var(--s3); }
.p3 .orbit input { flex: 1; min-width: 72px; }

/* Front/back test */
.p3-test { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: var(--s6); align-items: start; }
.p3-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: var(--s6); display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.p3-test-row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.p3-test-row .p3-fieldset { flex: 1 1 180px; }
.p3-test-row .p3-fieldset:first-child { flex-grow: 2; }
.p3-answers .btn { flex: 1 1 140px; font-size: 18px; line-height: 28px; min-height: 56px; }
.p3-progress { display: flex; flex-direction: column; gap: var(--s2); }
.p3-bar { height: 6px; border-radius: 6px; background: var(--raised); overflow: hidden; }
.p3-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .7s var(--ease); }
.p3-verdict { font-weight: 600; min-height: 24px; margin: 0; }
.p3-verdict.ok { color: var(--good); } .p3-verdict.ko { color: var(--bad); }
.p3-summary { border: 1px solid var(--accent); border-radius: 12px; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); }
.p3-summary h4 { margin: 0; font-size: 18px; line-height: 28px; }
.p3-summary p { margin: 0; color: var(--muted); }
.p3-scores { display: flex; flex-direction: column; gap: var(--s3); }
.p3-scores-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.p3-scores-head h4 { margin: 0; font-size: 16px; line-height: 24px; }
.p3-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s2); }
.p3 .sc { display: flex; flex-direction: column; padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: 8px; background: var(--bg); min-width: 0; }
.p3 .sc span { font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p3 .sc b { font-size: 18px; line-height: 28px; font-weight: 600; }
.p3 .sc small { font-size: 12px; line-height: 16px; color: var(--muted); }
.p3-testmap { width: 100%; max-width: 400px; margin-inline: auto; aspect-ratio: 340 / 280; display: block; }
.p3-testmap text { font-family: var(--mono); fill: var(--muted); }

/* Notes */
.p3-notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6); margin: 0; }
.p3-notes > div { padding: var(--s6); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.p3-notes dt { font-size: 18px; line-height: 28px; font-weight: 600; margin-bottom: var(--s2); }
.p3-notes dd { margin: 0; color: var(--muted); }
.p3-credit { margin: 0; color: var(--muted); font-size: 14px; line-height: 20px; }

@media (max-width: 900px) {
  .mw-item { grid-template-columns: minmax(0, 1fr); }
  .p3-svg { max-width: 560px; }
  .p3-main, .p3-test, .p3-notes { grid-template-columns: minmax(0, 1fr); }
  .p3-stage { position: static; }
  .p3-status { margin-left: 0; }
  .p3-h2 { font-size: 30px; line-height: 36px; }
}
@media (max-width: 480px) {
  .mw-copy h2 { font-size: 30px; line-height: 36px; }
  .p3 .row { grid-template-columns: 72px minmax(0, 1fr) 76px; }
  .p3-panel { padding: var(--s4); }
}
/* Without JS there are no languages to offer: hide the empty selector. */
html:not(.js) .p3 .lang { display: none; }
