/* ---------- Recorrido de primer uso (onboarding.js, 2026-10-26) ----------
   A native dialog over study: a dark card in the interior's tokens (relieve.css)
   with the 1489 case on ivory paper, the same paper the public landing uses.
   The interior has a single dark theme ("Mesa de luz"); the tour follows it in
   either system scheme. Desktop: a centered card. Phones and narrow windows: a
   bottom sheet that scrolls inside, never sideways. A decorative ring marks the
   real control each step names; the card's text never depends on it. */
html.ob-lock { overflow: hidden }

.onboarding:not([open]) { display: none }
.onboarding {
  position: fixed; inset: 0; z-index: 1000;
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 16px; border: 0;
  display: grid; place-items: center; overflow: hidden;
  background: transparent; color: var(--r-paper, #f7f3ea);
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
  font-size: 15px; line-height: 1.5; text-align: left;
}
.onboarding::backdrop { background: rgb(5 9 13 / .66) }
.onboarding.has-spot::backdrop { background: transparent }
/* Without showModal (old engines, tests) the dialog paints its own dim. */
.onboarding.ob-fallback { background: rgb(5 9 13 / .66) }
.onboarding.ob-fallback.has-spot { background: transparent }
.onboarding [hidden] { display: none !important }

.ob-spot {
  position: fixed; left: var(--ob-x, 0); top: var(--ob-y, 0);
  width: var(--ob-w, 0); height: var(--ob-h, 0);
  border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 2px var(--r-rose, #d998ae), 0 0 26px 6px rgb(217 152 174 / .32), 0 0 0 200vmax rgb(5 9 13 / .66);
}

.ob-card {
  position: relative; box-sizing: border-box;
  display: flex; flex-direction: column;
  width: min(560px, 100%); max-height: min(740px, calc(100vh - 32px)); max-height: min(740px, calc(100dvh - 32px));
  padding: 20px 24px 18px;
  border: 1px solid var(--r-edge-strong, rgb(247 243 234 / .18)); border-radius: 28px;
  background: linear-gradient(165deg, rgb(32 45 60 / .97), rgb(18 26 36 / .98));
  box-shadow: 0 30px 80px rgb(0 0 0 / .45), inset 0 1px 0 rgb(247 243 234 / .06);
}

.ob-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px }
.ob-count {
  margin: 0; color: var(--r-rose-soft, #e9bfcd);
  font: 600 11.5px/1 var(--font-mono, ui-monospace, monospace); letter-spacing: .08em; text-transform: uppercase;
}
.ob-dots { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none }
.ob-dots li { width: 16px; height: 4px; border-radius: 2px; background: rgb(247 243 234 / .16) }
.ob-dots li.is-done { background: rgb(217 152 174 / .5) }
.ob-dots li.is-current { width: 28px; background: var(--r-rose, #d998ae) }
.ob-close {
  display: grid; place-items: center; width: 44px; height: 44px; margin: -6px -10px -6px auto; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--r-muted, #aeb8c3);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.ob-close:hover { background: rgb(247 243 234 / .07); color: var(--r-paper, #f7f3ea) }

.ob-title {
  margin: 2px 0 12px; color: var(--r-paper, #f7f3ea);
  font-family: var(--font-display, Georgia, serif); font-weight: 500; font-size: clamp(24px, 20px + 1vw, 30px); line-height: 1.15; letter-spacing: -.01em;
  outline: none; border-radius: 6px;
}
.ob-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -8px; padding: 0 8px 2px }
.ob-text { margin: 0 0 12px; color: var(--r-paper-shade, #ebe4d6) }
.ob-note { margin: 12px 0 0; color: var(--r-muted, #aeb8c3); font-size: 13.5px }
.ob-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none }
.ob-list li { padding: 2px 0 2px 14px; border-left: 2px solid rgb(217 152 174 / .5); color: var(--r-paper-shade, #ebe4d6) }
.ob-list strong { color: var(--r-paper, #f7f3ea); font-weight: 600 }

/* The case sits on paper: ivory, ink and garnet, as in the reviewed first case. */
.ob-case { margin: 2px 0 0; padding: 16px 16px 14px; border-radius: 18px; background: #f7f3ea; color: #18222d; box-shadow: inset 0 0 0 1px rgb(24 34 45 / .08) }
.ob-case-label { margin: 0 0 8px; color: #8b1e3f; font: 600 11px/1.2 var(--font-mono, ui-monospace, monospace); letter-spacing: .08em; text-transform: uppercase }
.ob-case-facts { margin: 0 0 10px }
.ob-case-question { margin: 0 0 10px; font-family: var(--font-display, Georgia, serif); font-weight: 600; font-size: 17px }
.ob-options { display: grid; gap: 8px }
.ob-option {
  box-sizing: border-box; width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid #cfc6b4; border-radius: 12px; background: #fffdf8; color: #18222d;
  font: inherit; line-height: 1.4; text-align: left; cursor: pointer;
}
.ob-option:hover { border-color: #8b1e3f }
.ob-option[aria-pressed='true'] { font-weight: 600; box-shadow: inset 4px 0 0 currentColor }
.ob-option[data-tone='good'] { border-color: #2f7a52; background: #e7f4ec; color: #1d4d33 }
.ob-option[data-tone='gap'] { border-color: #a26a12; background: #fbf0dc; color: #5e3d08 }
.ob-option[data-tone='bad'] { border-color: #8b1e3f; background: #f8e3ea; color: #6d1731 }
.ob-feedback:empty { display: none }
.ob-feedback { margin-top: 12px; padding: 10px 12px; border-left: 4px solid #8b1e3f; border-radius: 4px 12px 12px 4px; background: #fffdf8 }
.ob-feedback[data-tone='good'] { border-left-color: #2f7a52; background: #e7f4ec }
.ob-feedback[data-tone='gap'] { border-left-color: #a26a12; background: #fbf0dc }
.ob-feedback[data-tone='bad'] { border-left-color: #8b1e3f; background: #f8e3ea }
.ob-verdict { display: block; margin-bottom: 2px; font-weight: 700 }
.ob-feedback[data-tone='good'] .ob-verdict { color: #276a46 }
.ob-feedback[data-tone='gap'] .ob-verdict { color: #7f520c }
.ob-feedback[data-tone='bad'] .ob-verdict { color: #8b1e3f }
.ob-feedback-text { margin: 0 }
.ob-extra { display: grid; gap: 12px; margin-top: 12px }
.ob-article { padding: 10px 12px; border: 1px solid #e3dccd; border-radius: 12px; background: #fffdf8 }
/* The interior paints open summaries ivory (details[open] > summary); on paper it must stay garnet. */
.onboarding .ob-article > summary { color: #8b1e3f; font-weight: 600; cursor: pointer }
.ob-article blockquote { margin: 8px 0 8px; padding-left: 12px; border-left: 3px solid #8b1e3f; font-family: var(--font-display, Georgia, serif); line-height: 1.55 }
.ob-bcn { color: #8b1e3f; font-weight: 600; text-decoration: underline; text-underline-offset: 3px }
.ob-map-figure { margin: 0 }
.ob-map-caption { margin: 0 0 8px; color: #56616d; font: 600 11px/1.2 var(--font-mono, ui-monospace, monospace); letter-spacing: .08em; text-transform: uppercase }
.ob-map { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none }
.ob-node { display: grid; align-content: start; gap: 2px; min-width: 0; padding: 8px 10px; border: 1px solid #cfc6b4; border-radius: 10px; background: #fffdf8 }
.ob-node[data-kind='Opción'] { border-color: #d7a6b6; background: #f8e3ea }
.ob-node[data-kind='Fuente'] { border-color: #8b1e3f }
.ob-node-kind { color: #8b1e3f; font: 600 10.5px/1.2 var(--font-mono, ui-monospace, monospace); letter-spacing: .06em; text-transform: uppercase }
.ob-node-value { font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere }

.ob-access { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0 }
.ob-access .credit-access-action {
  min-height: 44px; padding: 0 18px; border: 1px solid rgb(217 152 174 / .45); border-radius: 999px;
  background: transparent; color: var(--r-rose, #d998ae); font: 600 14px/1 var(--font-body, system-ui, sans-serif); cursor: pointer;
}
.ob-access .credit-access-action:first-child { border-color: rgb(233 191 205 / .35); background: linear-gradient(180deg, var(--r-wine-lit, #a8325a), var(--r-wine, #8b1e3f)); color: #fff }
.ob-access .credit-access-action:hover { background-color: rgb(217 152 174 / .12) }

.ob-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--r-line, rgb(247 243 234 / .1)) }
.ob-nav { display: flex; gap: 8px; margin-left: auto }
.ob-primary, .ob-quiet { min-height: 44px; border-radius: 999px; font: 600 14.5px/1 var(--font-body, system-ui, sans-serif); cursor: pointer }
.ob-primary {
  padding: 0 22px; border: 1px solid rgb(233 191 205 / .35);
  background: linear-gradient(180deg, var(--r-wine-lit, #a8325a), var(--r-wine, #8b1e3f)); color: #fff;
  box-shadow: 0 8px 22px rgb(139 30 63 / .32);
}
.ob-primary:hover { filter: brightness(1.08) }
.ob-quiet { padding: 0 16px; border: 1px solid var(--r-edge, rgb(247 243 234 / .14)); background: transparent; color: var(--r-paper-shade, #ebe4d6); font-weight: 500 }
.ob-quiet:hover { background: rgb(247 243 234 / .06); color: var(--r-paper, #f7f3ea) }
.ob-skip { padding: 0 6px; border-color: transparent; color: var(--r-muted, #aeb8c3); text-decoration: underline; text-underline-offset: 3px }
.ob-skip.ob-skip-end { padding: 0 16px; border-color: var(--r-edge, rgb(247 243 234 / .14)); text-decoration: none }

/* One visible focus, the interior's: a rose outline on the dark card, garnet on paper.
   The step title takes focus only so screen readers announce it; it is not a control. */
.onboarding :is(button, a[href], summary, [tabindex]:not([tabindex="-1"])):focus-visible { outline: 2px solid var(--r-rose, #d998ae); outline-offset: 2px }
.onboarding .ob-title:focus { outline: none; box-shadow: none }
.onboarding .ob-case :is(button, a[href], summary):focus-visible { outline-color: #8b1e3f; box-shadow: none }

@media (max-width: 800px) {
  .onboarding { place-items: end center; padding: 0 }
  .ob-card {
    width: 100%; max-height: 88vh; max-height: 88dvh; padding: 16px 16px max(14px, env(safe-area-inset-bottom));
    border-width: 1px 0 0; border-radius: 24px 24px 0 0;
  }
}
@media (max-width: 520px) {
  .ob-map { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .ob-title { font-size: 23px }
  .ob-skip { order: 2; margin: 0 auto }
  .ob-nav { order: 1; width: 100%; margin: 0 }
  .ob-nav .ob-primary { flex: 1 1 auto }
}

@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion='false']) .ob-spot { transition: left .32s var(--r-ease, ease), top .32s var(--r-ease, ease), width .32s var(--r-ease, ease), height .32s var(--r-ease, ease) }
  html:not([data-motion='false']) .ob-body.ob-enter { animation: ob-in .26s var(--r-ease, ease) both }
  html:not([data-motion='false']) .onboarding[open] .ob-card { animation: ob-rise .34s var(--r-ease, ease) both }
  html:not([data-motion='false']) .ob-option { transition: border-color .16s, background-color .16s }
}
@keyframes ob-in { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
@keyframes ob-rise { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) {
  .ob-spot, .ob-option { transition: none }
  .ob-body.ob-enter, .onboarding[open] .ob-card { animation: none }
}
html[data-motion='false'] .ob-body.ob-enter, html[data-motion='false'] .onboarding[open] .ob-card { animation: none }

@media (forced-colors: active) {
  .ob-card, .ob-case, .ob-option, .ob-primary, .ob-quiet, .ob-node, .ob-feedback { border: 1px solid CanvasText }
  .ob-spot { box-shadow: none; outline: 2px solid Highlight }
  .ob-option[aria-pressed='true'] { outline: 2px solid Highlight }
}
