/* ==========================================================================
   capas.css — lo que se abre encima: buscador, secciones, guardadas e historias
   ========================================================================== */

dialog.capa {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; color: var(--tinta); overflow: hidden;
}
dialog.capa:not([open]) { display: none; }
dialog.capa::backdrop { background: rgba(5, 3, 27, .66); }
.capa-in { display: flex; flex-direction: column; background: var(--fondo); color: var(--tinta); min-height: 0; }
.capa-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px var(--margen); flex: none; }
.capa-t { display: flex; align-items: center; gap: .5em; font-size: 1.375rem; font-weight: 820; letter-spacing: -.02em; }
.capa-t .i { color: var(--celeste); width: .7em; height: .7em; }

@media (prefers-reduced-motion: no-preference) {
  dialog.capa[open]::backdrop { animation: velo .25s ease both; }
  dialog.capa.cerrando::backdrop { animation: velo .2s ease reverse both; }
  .capa-buscar[open] .capa-in { animation: baja .3s var(--suave) both; }
  .capa-menu[open] .capa-in { animation: sube .34s var(--suave) both; }
  .capa-lado[open] .capa-in { animation: sube .34s var(--suave) both; }
  .capa-hist[open] .hist { animation: crece .3s var(--suave) both; }
  dialog.capa.cerrando .capa-in, dialog.capa.cerrando .hist { animation: sale .18s ease both; }
}
@keyframes velo { from { opacity: 0; } to { opacity: 1; } }
@keyframes baja { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: none; } }
@keyframes sube { from { opacity: 0; transform: translateY(32px); } to { opacity: 1; transform: none; } }
@keyframes desde-izq { from { opacity: 0; transform: translateX(-32px); } to { opacity: 1; transform: none; } }
@keyframes desde-der { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: none; } }
@keyframes crece { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes sale { to { opacity: 0; } }

/* ---------- buscador ---------- */
.capa-buscar .capa-in { width: 100%; height: 100%; }
.bq-campo { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px var(--margen); border-bottom: 2px solid var(--tinta); flex: none; }
.bq-campo > .i { color: var(--acento); width: 18px; height: 18px; }
.bq-campo input {
  flex: 1; min-width: 0; height: 48px; border: 0; background: none; color: var(--tinta);
  font-size: 1.25rem; font-weight: 700; letter-spacing: -.015em;
}
.bq-campo input::placeholder { color: var(--tinta-3); font-weight: 500; }
.bq-campo input:focus-visible { outline: none; }
.bq-campo input::-webkit-search-cancel-button { display: none; }
.bq-x { padding: 0 10px; color: var(--tinta-2); font-size: .8125rem; }
.bq-x kbd { display: none; }
.bq-temas { display: flex; align-items: center; gap: 12px; padding: 10px var(--margen); border-bottom: 1px solid var(--linea); flex: none; min-width: 0; }
.bq-temas .rot { flex: none; color: var(--acento); }
.bq-temas ul { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.bq-temas ul::-webkit-scrollbar { display: none; }
.bq-temas button { height: 32px; padding: 0 10px; white-space: nowrap; border: 1px solid var(--linea-2); border-radius: var(--radio); background: none; font-size: .8125rem; font-weight: 650; color: var(--tinta); transition: border-color .18s, background-color .18s; }
.bq-temas button:hover { border-color: var(--tinta); background: var(--fondo-2); }
.bq-estado { padding: 12px var(--margen) 6px; font-size: .75rem; font-weight: 650; color: var(--tinta-3); flex: none; }
.bq-estado b { color: var(--tinta); }
.bq-res { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 12px; }
.bq-o a { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 14px; align-items: center; padding: 9px 8px; border-radius: 3px; }
.bq-o.es-act a, .bq-o a:hover { background: var(--fondo-2); }
.bq-o.es-act a { box-shadow: inset 3px 0 0 var(--celeste); }
.bq-f { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 2px; background: var(--fondo-3); }
.bq-f img { width: 100%; height: 100%; object-fit: cover; }
.bq-f.es-cifra { display: grid; place-items: center; background: var(--cifra-fondo); color: #fff; font-size: .875rem; font-weight: 850; font-stretch: 112%; letter-spacing: -.03em; }
.bq-f.es-cifra .i { color: var(--celeste); width: 22px; height: 22px; }
.bq-c { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bq-s { color: var(--tinta-3); font-size: .625rem; }
.bq-t { font-size: 1rem; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.bq-vacio { padding: 36px var(--margen); text-align: left; color: var(--tinta-2); }
.bq-vacio b { display: block; font-size: 1.25rem; color: var(--tinta); margin-bottom: 4px; letter-spacing: -.015em; }
.bq-ayuda { display: none; }

/* ---------- secciones ---------- */
.capa-menu .capa-in {
  width: 100%; height: 100%; background: var(--noche); color: #fff; overflow-y: auto; overscroll-behavior: contain;
  --tinta: #f4f6fc; --tinta-2: #c3c7e0; --tinta-3: #979cbd; --linea: #272163; --foco: #6dd0ec;
}
.capa-menu .capa-h { position: sticky; top: 0; z-index: 2; background: var(--noche); border-bottom: 1px solid var(--linea); }
.logo-capa { height: 22px; width: auto; color: #fff; }
.mn-c { padding: 6px var(--margen) 40px; }
.mn-clima { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 12px 0; font-size: .8125rem; color: var(--tinta-2); }
.mn-clima .i { color: var(--celeste); }
.mn-clima .rot, .mn-clima b { color: #fff; }
.mn-l > li { border-top: 1px solid var(--linea); }
.mn-s { display: flex; align-items: center; gap: 12px; min-height: 54px; font-size: 1.375rem; font-weight: 800; font-stretch: 104%; letter-spacing: -.022em; }
.mn-s .dardo { width: 12px; height: 12px; transition: transform .22s var(--suave); }
.mn-s:hover .dardo { transform: translateX(4px); }
.mn-s:hover { color: var(--celeste-luz); }
.mn-sub { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0 0 14px 24px; margin-top: -4px; }
.mn-sub a { display: inline-flex; align-items: center; min-height: 32px; font-size: .9375rem; font-weight: 600; color: var(--tinta-2); }
.mn-sub a:hover { color: #fff; }
.mn-x { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; padding-top: 18px; border-top: 2px solid #fff; }
.mn-x a { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 12px; border: 1px solid var(--linea); border-radius: var(--radio); font-size: .875rem; font-weight: 700; transition: border-color .18s, background-color .18s; }
.mn-x a:hover { border-color: var(--celeste); background: var(--noche-2); }
.mn-x .i { color: var(--celeste); }
.mn-p { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.mn-seg { margin-top: 24px; color: var(--tinta-3); }
.redes-mn { margin: 8px 0 0 -8px; }
.redes-mn a { width: 44px; height: 44px; }
.redes-mn .i { width: 18px; height: 18px; }

/* ---------- guardadas ---------- */
.capa-lado { display: flex; align-items: flex-end; }
.capa-lado:not([open]) { display: none; }
.capa-lado .capa-in { width: 100%; max-height: 88dvh; border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: var(--sombra); }
.capa-lado .capa-h { border-bottom: 1px solid var(--linea); }
.gdl { overflow-y: auto; overscroll-behavior: contain; padding: 4px var(--margen); min-height: 0; }
.gdl li { display: grid; grid-template-columns: 84px minmax(0, 1fr) 34px; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--linea); }
.gdl .bq-t { font-size: .9375rem; }
.gdl .gd { margin: 0; }
.gdl-vacia { padding: 28px var(--margen) 8px; color: var(--tinta-2); font-size: 1rem; line-height: 1.5; }
.gdl-vacia .i { display: inline-block; vertical-align: -.1em; color: var(--acento); }
.gdl-vacia[hidden] { display: none; }
.gdl-nota { padding: 14px var(--margen) 18px; font-size: .75rem; color: var(--tinta-3); }

/* ---------- las 5 del día, a pantalla completa ---------- */
.capa-hist { background: #05031b; }
.hist { position: relative; display: grid; place-items: center; width: 100%; height: 100%; overflow: hidden; color: #fff; --foco: #6dd0ec; --tinta: #fff; --tinta-3: #c3c7e0; --acento: #49bcdf; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.hist-marco { position: relative; width: 100%; height: 100%; }
.hist-top { position: absolute; left: 0; right: 0; top: 0; z-index: 6; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 28px; background: linear-gradient(180deg, rgba(5, 3, 27, .8), rgba(5, 3, 27, 0)); }
.hs-barras { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.hs-b { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.hs-b i { display: block; height: 100%; background: #fff; transform: scaleX(0); transform-origin: left; }
.hs-b.lista i { transform: scaleX(1); }
.hist-cab { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.logo-hist { height: 15px; width: auto; color: #fff; }
.hist-cab h2 { margin-right: auto; margin-left: 6px; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, .35); color: var(--celeste-luz); }
.hp-1 { display: none; }
[data-hs-pausa][aria-pressed="true"] .hp-0 { display: none; }
[data-hs-pausa][aria-pressed="true"] .hp-1 { display: block; }
.hist-esc { position: absolute; inset: 0; overflow: hidden; background: #09062a; }
.hs { position: absolute; inset: 0; display: flex; flex-direction: column; isolation: isolate; }
.hs[hidden] { display: none; }
.hs-fondo { position: absolute; inset: -48px; z-index: -2; background-size: cover; background-position: center; filter: blur(30px) brightness(.36) saturate(1.25); }
.hs-foto { position: relative; flex: 0 0 50%; overflow: hidden; }
.hs-foto img { width: 100%; height: 100%; object-fit: cover; }
.hs-foto::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5, 3, 27, .25) 0%, rgba(5, 3, 27, 0) 30%, rgba(5, 3, 27, 0) 58%, rgba(5, 3, 27, .9) 100%); }
@media (prefers-reduced-motion: no-preference) {
  .hs:not([hidden]) .hs-foto img { animation: acerca 9s ease-out both; }
  .hs:not([hidden]) .hs-txt > * { animation: sube .5s var(--suave) both; }
  .hs:not([hidden]) .hs-txt > :nth-child(2) { animation-delay: .06s; }
  .hs:not([hidden]) .hs-txt > :nth-child(3) { animation-delay: .12s; }
  .hs:not([hidden]) .hs-txt > :nth-child(4) { animation-delay: .18s; }
}
@keyframes acerca { from { transform: scale(1); } to { transform: scale(1.09); } }
.hs-txt { position: relative; z-index: 7; flex: 1; display: flex; flex-direction: column; gap: 12px; margin-top: -58px; padding: 0 20px calc(22px + env(safe-area-inset-bottom, 0px)); pointer-events: none; }
.hs-n { display: flex; align-items: flex-end; gap: 12px; }
.hs-n b { font-size: 5.5rem; font-weight: 880; font-stretch: 125%; line-height: .78; letter-spacing: -.06em; color: var(--celeste); }
.hs-n .rot { padding-bottom: 4px; color: #fff; }
.hs-tit { font-size: clamp(1.5rem, 1.1rem + 2vw, 2rem); font-weight: 820; line-height: 1.07; letter-spacing: -.026em; text-wrap: balance; }
.hs-baj { color: #dfe2f3; font-size: 1rem; line-height: 1.45; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; }
.hs-acc { display: flex; align-items: center; gap: 12px; margin-top: auto; pointer-events: auto; }
.hs-acc .bt { min-height: 48px; padding: 0 20px; }
.gd-hs { width: 48px; height: 48px; margin: 0; border: 1px solid rgba(255, 255, 255, .4); color: #fff; }
.gd-hs .i { width: 17px; height: 17px; }
.hs-min { margin-left: auto; font-size: .75rem; color: #c3c7e0; }
.hist-nav { position: absolute; top: 0; bottom: 0; z-index: 5; width: 32%; padding: 0; border: 0; background: none; color: transparent; -webkit-tap-highlight-color: transparent; }
.hist-ant { left: 0; }
.hist-sig { right: 0; width: 68%; }
.hist-nav:focus-visible { outline-offset: -6px; }
.hist-nav .i { display: none; }

/* ==========================================================================
   desde 700 px
   ========================================================================== */
@media (min-width: 700px) {
  .capa-buscar { display: block; }
  .capa-buscar .capa-in { width: min(760px, 100% - 48px); height: auto; max-height: min(720px, 100dvh - 96px); margin: 48px auto 0; border-radius: 6px; box-shadow: var(--sombra); overflow: hidden; }
  .bq-campo { padding: 12px 10px 12px 20px; }
  .bq-campo input { font-size: 1.375rem; height: 52px; }
  .bq-x kbd { display: inline-block; }
  .bq-temas, .bq-estado { padding-inline: 20px; }
  .bq-res { padding: 0 12px 12px; }
  .bq-ayuda { display: flex; gap: 18px; padding: 10px 20px; border-top: 1px solid var(--linea); font-size: .75rem; color: var(--tinta-3); flex: none; }
  .bq-ayuda span { display: inline-flex; align-items: center; gap: 5px; }

  .capa-menu .capa-in { width: 440px; }
  @media (prefers-reduced-motion: no-preference) {
    .capa-menu[open] .capa-in { animation-name: desde-izq; }
    .capa-lado[open] .capa-in { animation-name: desde-der; }
  }
  .capa-lado { align-items: stretch; justify-content: flex-end; }
  .capa-lado .capa-in { width: 440px; max-height: none; height: 100%; border-radius: 0; }
  .capa-lado .capa-h { padding-left: 24px; }
  .gdl, .gdl-vacia, .gdl-nota { padding-inline: 24px; }
  .gdl { flex: 1; }

  /* las historias en compu: una pantalla vertical en el centro */
  .hist-marco { width: min(430px, calc((100dvh - 48px) * 9 / 16)); height: auto; aspect-ratio: 9 / 16; }
  .hist-esc { border-radius: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
  .hist-top { border-radius: 10px 10px 0 0; }
  .hs-fondo { display: none; }
  .hist-nav { top: 50%; bottom: auto; width: 52px; height: 52px; margin-top: -26px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35); color: #fff; background: rgba(9, 6, 42, .6); transition: background-color .18s, border-color .18s, color .18s; }
  .hist-nav:hover { background: var(--celeste); border-color: var(--celeste); color: var(--noche); }
  .hist-nav .i { display: block; width: 16px; height: 16px; margin: auto; }
  .hist-ant { left: -76px; }
  .hist-sig { right: -76px; width: 52px; }
  .hs-n b { font-size: 4.5rem; }
  .hs-tit { font-size: 1.625rem; }
  .hs-baj { font-size: .9375rem; -webkit-line-clamp: 4; }
}
