/* ==========================================================================
   Newsletter y «Qué correos quieres recibir» (Antonio, 25-oct-2026)

   «En el menú superior tenemos que añadir una nueva sección que sea
   NEWSLETTER: ahí aparecen los correos que se envían los miércoles (dudas) y
   los viernes… Y que aparezca una sección bien visible de preferencias.»

   Compacta y sin desbordes, con las medidas de Hábitos: tarjetas con 12 px
   de aire (16 en escritorio), títulos de 15-19 px, letra de 12-14 px y
   botones de 36-40 px. Va la última de las hojas: gana a styles.css y a
   movil.css sin tocarlas.
   ========================================================================== */

/* ── El bloque de preferencias (Newsletter y Mi perfil) ─────────────────── */
.pc { box-sizing: border-box; min-width: 0; }
.pc *, .pc *::before, .pc *::after { box-sizing: border-box; }
.pc-cab { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; min-width: 0; }
.pc-icono {
    flex: none; width: 36px; height: 36px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--brand-yellow-soft, #FFF5CC); color: #1d1d1f;
}
.pc-cab-txt { min-width: 0; }
.pc-titulo { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.25; color: var(--text, #1d1d1f); letter-spacing: -0.01em; }
.pc-ayuda { margin: 2px 0 0; font-size: 13px; line-height: 1.4; color: var(--text-secondary, #6e6e73); }
.pc-ayuda:empty { display: none; }

.pc-lista { display: grid; gap: 8px; }
.pc-fila {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "dia switch" "texto switch";
    column-gap: 12px; row-gap: 2px; align-items: center;
    min-height: 44px; padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, .08); border-radius: 12px;
    background: #fff; cursor: pointer;
    transition: border-color .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
}
.pc-fila.is-on { border-color: rgba(0, 0, 0, .14); }
.pc-fila.is-off { cursor: default; opacity: .6; }
.pc-dia {
    grid-area: dia;
    font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-tertiary, #8e8e93);
}
.pc-texto { grid-area: texto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pc-texto b { font-size: 14px; font-weight: 700; line-height: 1.3; color: var(--text, #1d1d1f); overflow-wrap: anywhere; }
.pc-texto small { font-size: 12px; line-height: 1.35; color: var(--text-secondary, #6e6e73); overflow-wrap: anywhere; }

/* El interruptor: un checkbox de verdad (role="switch"), invisible encima
   del dibujo, así funciona con el dedo, con el teclado y con el lector. */
.pc-switch { grid-area: switch; position: relative; display: block; width: 46px; height: 28px; flex: none; }
.pc-switch input {
    position: absolute; inset: 0; width: 100%; height: 100%;
    margin: 0; opacity: 0; cursor: pointer; z-index: 1;
    min-height: 0 !important; /* movil.css sube los campos a 44 px */
}
.pc-switch input:disabled { cursor: default; }
.pc-switch i {
    position: absolute; inset: 0; border-radius: 999px;
    background: #d1d1d6; transition: background .18s ease;
}
.pc-switch i::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 22px; height: 22px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .18s ease;
}
.pc-switch input:checked + i { background: #1d1d1f; }
.pc-switch input:checked + i::after { transform: translateX(18px); }
.pc-switch input:focus-visible + i { outline: 2px solid #FFCC00; outline-offset: 2px; }

.pc-aviso { min-height: 18px; margin: 8px 0 0; font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--text-secondary, #6e6e73); }
.pc-aviso:empty { display: none; }
.pc-aviso--ok { color: #15803d; }
.pc-aviso--error { color: #b91c1c; }
.pc-error {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
    margin: 10px 0 0; padding: 8px 10px 8px 12px;
    border-radius: 10px; background: #FEF2F2; color: #b91c1c;
    font-size: 13px; font-weight: 600; line-height: 1.4;
}
.pc-error span { flex: 1 1 180px; min-width: 0; }
.pc-reintentar {
    flex: none; min-height: 36px; padding: 0 14px;
    border: 1px solid #fecaca; border-radius: 999px; background: #fff; color: #b91c1c;
    font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.pc-reintentar:hover { background: #fff5f5; border-color: #b91c1c; }
.pc-baja {
    margin: 0; padding: 12px; border-radius: 12px;
    background: #F5F5F7; color: var(--text, #1d1d1f);
    font-size: 14px; line-height: 1.45;
}

/* Arriba de Newsletter: bien visible. */
#page-newsletter #nl-prefs {
    margin: 0 0 16px; padding: 12px;
    background: #FFFBEA;
    border: 1px solid #F5D24B; border-radius: 16px;
}
#page-newsletter #nl-prefs .pc-icono { background: #FFCC00; }

/* En Mi perfil, una tarjeta más de la rejilla, de lado a lado. */
#page-profile .profile-correos { display: block; grid-column: 1 / -1; }
#page-profile .profile-correos .pc-fila { background: #fafafa; }

@media (min-width: 768px) {
    .pc-lista { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    #page-newsletter #nl-prefs { padding: 16px; margin-bottom: 20px; }
    .pc-titulo { font-size: 17px; }
}

/* ── La página Newsletter ───────────────────────────────────────────────── */
#page-newsletter { min-width: 0; }
#page-newsletter .nl-header { margin: 0 0 12px; }
#page-newsletter .nl-title { font-size: 22px; margin: 0 0 2px; }
#page-newsletter .nl-sub { font-size: 13px; line-height: 1.45; max-width: 720px; }

#page-newsletter.nl-leyendo .nl-header,
#page-newsletter.nl-leyendo #nl-prefs,
#page-newsletter.nl-leyendo .nl-lista-cab { display: none; }

.nl-lista-cab {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 8px 12px; margin: 0 0 10px;
}
.nl-lista-titulo { margin: 0; font-size: 15px; font-weight: 700; color: var(--text, #1d1d1f); }
.nl-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.nl-chip {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 36px !important; padding: 0 12px;
    border: 1px solid rgba(0, 0, 0, .12); border-radius: 999px;
    background: #fff; color: var(--text, #1d1d1f);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.nl-chip:hover { border-color: #1d1d1f; }
.nl-chip.is-on { background: #1d1d1f; border-color: #1d1d1f; color: #fff; }
.nl-chip-n { font-size: 12px; font-weight: 700; opacity: .6; font-variant-numeric: tabular-nums; }

#page-newsletter .nl-list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
#page-newsletter .nl-list.hidden { display: none; }
#page-newsletter .nl-vacio {
    margin: 0; padding: 16px; border-radius: 14px; background: #F5F5F7;
    font-size: 14px; color: var(--text-secondary, #6e6e73); text-align: center;
}

#page-newsletter .nl-card {
    display: flex; flex-direction: column; min-width: 0;
    padding: 12px 14px; border-radius: 14px;
}
#page-newsletter .nl-card:focus-visible { outline: 2px solid #FFCC00; outline-offset: 2px; }
#page-newsletter .nl-card-meta {
    flex-wrap: wrap; gap: 4px 8px; margin: 0 0 6px;
    font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--text-secondary, #6e6e73);
}
#page-newsletter .nl-card-date { font-weight: 600; color: var(--text, #1d1d1f); }
#page-newsletter .nl-card-time { font-weight: 500; }
#page-newsletter .nl-card-title { font-size: 16px; font-weight: 700; line-height: 1.3; margin: 0 0 4px; overflow-wrap: anywhere; }
#page-newsletter .nl-card-preheader { font-size: 13px; margin: 0 0 6px; overflow-wrap: anywhere; }
#page-newsletter .nl-card-excerpt { font-size: 13px; margin: 0 0 10px; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
#page-newsletter .nl-card-cta {
    align-self: flex-start; margin-top: auto;
    min-height: 34px !important; padding: 0 14px; font-size: 13px;
}
#page-newsletter .nl-card--locked .nl-card-cta--locked { display: inline-flex; align-items: center; gap: 6px; }

/* El día, bien visible: una pastilla delante de la fecha. */
.nl-dia {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 1.5;
    white-space: nowrap;
}
.nl-dia--miercoles { background: #E0F2FE; color: #075985; }
.nl-dia--viernes { background: #FFF1B8; color: #6B4E00; }

/* El correo abierto: que no desborde en el móvil. */
#page-newsletter .nl-detail { min-width: 0; }
#page-newsletter .nl-post { min-width: 0; }
#page-newsletter .nl-post-meta { flex-wrap: wrap; gap: 4px 8px; }
#page-newsletter .nl-post-title { overflow-wrap: anywhere; }
#page-newsletter .nl-post-body { overflow-wrap: break-word; }
#page-newsletter .nl-post-body img { max-width: 100%; height: auto; }

@media (max-width: 600px) {
    /* En el móvil, la tarjeta sin el extracto: el día, la fecha, el asunto y
       la entradilla bastan para elegir. */
    #page-newsletter .nl-card-excerpt { display: none; }
    #page-newsletter .nl-card-preheader { margin-bottom: 10px; }
    #page-newsletter .nl-detail { padding: 14px 14px 24px; }
    #page-newsletter .nl-post-title { font-size: 22px; }
    #page-newsletter .nl-post-preheader { font-size: 15px; margin-bottom: 18px; padding-bottom: 14px; }
    #page-newsletter .nl-post-body { font-size: 16px; }
}

@media (min-width: 768px) {
    #page-newsletter .nl-title { font-size: 26px; }
    #page-newsletter .nl-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    #page-newsletter .nl-card { padding: 16px; }
    #page-newsletter .nl-card-title { font-size: 17px; }
}
@media (min-width: 1280px) {
    #page-newsletter .nl-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
    #page-newsletter .nl-card-title { font-size: 18px; }
}

/* ── «Escuchar correo» (25-oct-2026) ────────────────────────────────────── */
/* En la tarjeta, al lado de «Leer correo»; solo en los correos con audio. */
#page-newsletter .nl-card-acciones {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-top: auto; min-width: 0;
}
#page-newsletter .nl-card-acciones .nl-card-cta { margin-top: 0; }
.nl-card-escuchar,
.nl-audio-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 34px; padding: 0 14px;
    border: 1px solid rgba(0, 0, 0, .18); border-radius: 999px;
    background: #fff; color: #1d1d1f;
    font: inherit; font-size: 13px; font-weight: 700; line-height: 1.2;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.nl-card-escuchar:hover,
.nl-audio-btn:hover { border-color: #1d1d1f; }
.nl-card-escuchar:focus-visible,
.nl-audio-btn:focus-visible,
.nl-audio-player:focus-visible { outline: 2px solid #1d1d1f; outline-offset: 2px; }
.nl-audio-btn[disabled] { cursor: default; opacity: .6; }
.nl-audio-btn[aria-busy="true"] { opacity: 1; }

/* En el correo abierto: entre la entradilla y el texto. */
#page-newsletter .nl-audio {
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
    margin: -12px 0 24px; padding: 12px; min-width: 0;
    border-radius: 14px; background: #FFFBEA; border: 1px solid #F5D24B;
}
#page-newsletter .nl-audio[hidden] { display: none; }
.nl-audio-cab {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 700; color: #1d1d1f;
}
.nl-audio-player { display: block; width: 100%; max-width: 560px; height: 44px; border-radius: 999px; }
/* La velocidad, a la vista (25-oct-2026): 1× · 1,25× · 1,5× · 1,75× · 2×. */
.nl-audio-vel { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.nl-audio-vel-tit { font-size: 13px; font-weight: 700; color: #1d1d1f; margin-right: 2px; }
.nl-audio-vel-op {
    min-width: 52px; min-height: 36px; padding: 0 12px;
    border: 1px solid #e5d9a6; border-radius: 999px; background: #fff;
    font: inherit; font-size: 13.5px; font-weight: 700; color: #1d1d1f; cursor: pointer;
    font-variant-numeric: tabular-nums;
}
.nl-audio-vel-op:hover { border-color: #1d1d1f; }
.nl-audio-vel-op.is-on { background: #1d1d1f; border-color: #1d1d1f; color: #FFCC00; }
.nl-audio-vel-op:focus-visible { outline: 2px solid #1d1d1f; outline-offset: 2px; }
.nl-audio-aviso { margin: 0; font-size: 13px; line-height: 1.4; color: var(--text-secondary, #6e6e73); }
.nl-audio-aviso:empty { display: none; }
.nl-audio-aviso--error { color: #b91c1c; font-weight: 600; }

/* En la tarjeta, del mismo alto que «Leer correo» (34 px, como la deja
   esta hoja); en el correo abierto, 44 px en el móvil. */
#page-newsletter .nl-card-escuchar { min-height: 34px !important; }
@media (max-width: 1023px) {
    .nl-audio-btn { min-height: 44px; }
}
@media (max-width: 600px) {
    #page-newsletter .nl-audio { margin: -6px 0 18px; }
}
