/* DMR Dato Mata Relato — estilo Medium */

:root {
    --c: #168fa3;
    --c-hover: #127a8c;
    --c-soft: rgba(22, 143, 163, 0.1);
    --c2: #168fa3;
    --bg: #ffffff;
    --card: #ffffff;
    --text: #242424;
    --muted: #6b6b6b;
    --border: rgba(0, 0, 0, 0.1);
    --border-light: rgba(0, 0, 0, 0.05);
    --top-bg: rgba(255, 255, 255, 0.97);
    --nav-bg: rgba(255, 255, 255, 0.98);
    --surface-muted: #f2f2f2;
    --surface-elevated: #ffffff;
    --hover-bg: rgba(0, 0, 0, 0.05);
    --modal-backdrop: rgba(0, 0, 0, 0.35);
    --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --max-content: 728px;
    --max-reading: 680px;
    --nav: 52px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
    --featured-bg: #1a1d21;
    --featured-text: #f3f4f5;
    --featured-muted: rgba(243, 244, 245, 0.68);
    --featured-badge-bg: rgba(78, 196, 212, 0.18);
    --featured-badge-text: #7ad4e0;
}

html {
    font-size: 16px;
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color-scheme: light;
}

html[data-font-size="small"] { font-size: 14px; }
html[data-font-size="large"] { font-size: 18px; }

[data-theme="dark"] {
    color-scheme: dark;
    --c: #4ec4d4;
    --c-hover: #6ed4e0;
    --c-soft: rgba(78, 196, 212, 0.15);
    --bg: #141414;
    --card: #1c1c1c;
    --text: #ececec;
    --muted: #a3a3a3;
    --border: rgba(255, 255, 255, 0.12);
    --border-light: rgba(255, 255, 255, 0.06);
    --top-bg: rgba(20, 20, 20, 0.97);
    --nav-bg: rgba(20, 20, 20, 0.98);
    --surface-muted: #2a2a2a;
    --surface-elevated: #1c1c1c;
    --hover-bg: rgba(255, 255, 255, 0.08);
    --modal-backdrop: rgba(0, 0, 0, 0.65);
    --featured-bg: #050505;
    --featured-text: #f3f4f5;
    --featured-muted: rgba(243, 244, 245, 0.7);
    --featured-badge-bg: rgba(78, 196, 212, 0.22);
    --featured-badge-text: #8adce6;
}

*, *::before, *::after { box-sizing: border-box; }

body.app {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    padding-bottom: calc(var(--nav) + var(--safe-b) + 8px);
    font-size: 1rem;
    line-height: 1.5;
}

/* —— Header (Medium: blanco, borde fino) —— */
.top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: calc(.65rem + var(--safe-t)) max(1rem, env(safe-area-inset-left)) .65rem max(1rem, env(safe-area-inset-right));
    background: var(--top-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.top__brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    min-width: 0;
    flex-shrink: 0;
}

.top__menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin-right: .15rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}

.top__menu-btn .material-symbols-outlined {
    font-size: 1.25rem;
    line-height: 1;
}

.top__menu-btn:focus-visible {
    outline: 2px solid var(--c);
    outline-offset: 2px;
}

.top__brand-text {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 0;
}

.top__brand-wordmark {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1;
}

.top__brand-tagline {
    font-size: .625rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 9.5rem;
}

@media (min-width: 480px) {
    .top__brand-tagline { max-width: none; }
}

.top__tabs {
    display: none;
    align-items: center;
    gap: .15rem;
    margin-left: .25rem;
}

.top__tab {
    padding: .35rem .65rem;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
}

.top__tab:hover { color: var(--text); }

.top__tab--on {
    color: var(--c);
    background: var(--c-soft);
}

.top__actions {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-left: auto;
    flex-shrink: 0;
}

.top__display {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.top__font {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    background: var(--surface-muted);
}

.top__display-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.65rem;
    height: 1.65rem;
    padding: 0 .35rem;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.top__display-btn + .top__display-btn {
    border-left: 1px solid var(--border);
}

.top__display-btn:hover {
    color: var(--text);
    background: var(--hover-bg);
}

.top__display-btn--on,
.top__display-btn--on:hover {
    background: var(--c-soft);
    color: var(--c);
}

.top__display-btn--fs-sm { font-size: .65rem; }
.top__display-btn--fs-md { font-size: .8rem; }
.top__display-btn--fs-lg { font-size: 1rem; }

.top__display-btn--icon {
    min-width: 1.85rem;
    width: 1.85rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
}

.top__display-btn--icon .material-symbols-outlined {
    font-size: 1.05rem;
    line-height: 1;
}

.top__info-mark {
    font-size: .95rem;
    font-weight: 700;
    line-height: 1;
}

.top__display-btn--icon + .top__display-btn--icon {
    border-left: 1px solid var(--border);
}

.top__display-btn:focus-visible {
    outline: 2px solid var(--c);
    outline-offset: 2px;
}

.top__install {
    display: none;
    align-items: center;
    justify-content: center;
    padding: .15rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    line-height: 0;
    transition: opacity .15s, transform .15s;
}

.top__install:not([hidden]) {
    display: inline-flex;
}

.top__install:hover {
    opacity: .88;
    transform: scale(1.04);
}

.top__install:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.top__install-icon {
    display: block;
    width: 1.65rem;
    height: 1.65rem;
}

.top__admin {
    display: none;
    align-items: center;
    padding: .45rem .9rem;
    border-radius: 999px;
    border: 1px solid var(--text);
    background: transparent;
    color: var(--text);
    font-size: .8125rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.top__admin:not([hidden]) {
    display: inline-flex;
}

.top__admin:hover {
    border-color: var(--c);
    color: var(--c);
}

@media (min-width: 640px) {
    .top__tabs { display: flex; }
}

@media (max-width: 420px) {
    .top__admin-text { font-size: .75rem; }
    .top__admin { padding: .4rem .65rem; }
    .top__install-icon { width: 1.5rem; height: 1.5rem; }
    .top__display-btn { min-width: 1.5rem; height: 1.5rem; }
    .top__display-btn--icon { min-width: 1.7rem; width: 1.7rem; }
}

/* —— Contenedor principal —— */
.app-content {
    background: var(--bg);
    min-height: 50vh;
}

.main { min-height: 60vh; }

.wrap {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 1.25rem max(1rem, env(safe-area-inset-left)) 1.5rem max(1rem, env(safe-area-inset-right));
}

.wrap--center { text-align: center; }

.lead {
    color: var(--muted);
    margin: 0 0 1.25rem;
    font-size: 1.05rem;
    line-height: 1.55;
}

.page-title {
    margin: 0 0 .5rem;
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -.02em;
}

/* —— Búsqueda y filtros —— */
.search {
    width: 100%;
    padding: .65rem 0;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    font: inherit;
    font-size: 1rem;
    margin-bottom: 1rem;
    background: transparent;
    color: var(--text);
}

.search::placeholder { color: #b3b3b3; }

.search:focus {
    outline: none;
    border-bottom-color: var(--text);
}

.muro-intro {
    margin: 0 0 1.25rem;
    padding: .85rem 1rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--c);
    border-radius: 6px;
    background: var(--c-soft);
    color: var(--text);
    font-size: .9375rem;
    line-height: 1.55;
}

.muro-search-row {
    display: flex;
    align-items: flex-end;
    gap: .65rem;
    margin-bottom: 1rem;
}

.muro-search-row__input {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.muro-info-modal[hidden] { display: none !important; }

body.muro-info-open { overflow: hidden; }

.muro-info-modal {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.muro-info-modal__backdrop {
    position: absolute;
    inset: 0;
    background: var(--modal-backdrop);
}

.muro-info-modal__panel {
    position: relative;
    width: min(100%, 42rem);
    max-height: min(92vh, 820px);
    overflow: auto;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: .75rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .18);
    padding: 1.35rem 1.25rem 1.15rem;
}

.muro-info-modal__x {
    position: absolute;
    top: .65rem;
    right: .65rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.muro-info-modal__x:hover {
    color: var(--text);
    background: var(--hover-bg);
}

.muro-info-modal__title {
    margin: 0 2rem .85rem 0;
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.muro-info-modal__body {
    font-size: .98rem;
    line-height: 1.65;
    color: var(--text);
}

.muro-info-modal__body p {
    margin: 0 0 .85rem;
}

.muro-info-modal__body p:last-child {
    margin-bottom: 0;
}

.muro-info-section + .muro-info-section {
    margin-top: 1.35rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.muro-info-section__title {
    margin: 0 0 .75rem;
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.muro-info-guide-intro {
    margin: 0 0 .85rem;
    font-size: .92rem;
    line-height: 1.55;
    color: var(--muted);
}

.muro-info-guide-figure {
    margin: 0 0 1rem;
}

.muro-info-guide-img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: .55rem;
    background: #f5f5f5;
}

[data-theme="dark"] .muro-info-guide-img {
    background: #1a1a1a;
}

.muro-info-guide-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .muro-info-guide-grid {
        grid-template-columns: 1fr 1fr;
        gap: .85rem;
    }
}

.muro-info-guide-col {
    padding: .85rem .9rem;
    border: 1px solid var(--border-light);
    border-radius: .55rem;
    background: var(--surface-muted);
}

.muro-info-guide-col__title {
    margin: 0 0 .65rem;
    font-size: .8125rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--c);
}

.muro-info-guide-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.muro-info-guide-item {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
}

.muro-info-guide-item__icon {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--c-soft);
    color: var(--c);
    font-size: 1rem !important;
}

.muro-info-guide-item__title {
    display: block;
    margin: 0 0 .2rem;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.3;
}

.muro-info-guide-item__text {
    margin: 0;
    font-size: .8125rem;
    line-height: 1.45;
    color: var(--muted);
}

.muro-info-modal__ok {
    display: block;
    width: 100%;
    margin-top: 1.15rem;
    padding: .7rem 1rem;
    border: none;
    border-radius: 999px;
    background: var(--c);
    color: #fff;
    font: inherit;
    font-size: .9375rem;
    font-weight: 600;
    cursor: pointer;
}

.muro-info-modal__ok:hover {
    background: var(--c-hover);
}

.wrap--muro {
    max-width: var(--max-content);
}

.muro-layout {
    display: block;
}

.muro-main {
    min-width: 0;
}

.muro-filters__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--border);
}

.muro-filters__title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.muro-filters__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}

.muro-filters__close .material-symbols-outlined {
    font-size: 1.25rem;
    line-height: 1;
}

.muro-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    max-width: 9.5rem;
    height: 2.15rem;
    padding: 0 .75rem 0 .55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text);
    font: inherit;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    margin-bottom: .45rem;
    transition: background .15s, border-color .15s, color .15s;
}

.muro-filters-btn__icon {
    font-size: 1.1rem;
    line-height: 1;
}

.muro-filters-btn__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.muro-filters-btn--active {
    background: var(--c-soft);
    border-color: var(--c);
    color: var(--c);
}

.muro-filters-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--modal-backdrop);
    opacity: 0;
    transition: opacity .22s ease;
    pointer-events: none;
}

.muro-filters-backdrop:not([hidden]) {
    pointer-events: auto;
}

body.filters-offcanvas-open .muro-filters-backdrop {
    opacity: 1;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 0;
}

.chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .35rem .85rem;
    background: transparent;
    font: inherit;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

@media (hover: hover) {
    .chip:hover { border-color: var(--border); color: var(--text); }
}

.chip--on,
.chip--on:hover,
.chip--on:focus-visible,
.chip--trend.chip--on,
.chip--trend.chip--on:hover,
.chip--trend.chip--on:focus-visible {
    background: var(--c);
    border-color: var(--c);
    color: #fff;
    -webkit-text-fill-color: #fff;
}

/* Móvil: filtros como offcanvas derecho */
@media (max-width: 959px) {
    .muro-filters {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(18.5rem, 88vw);
        z-index: 61;
        display: flex;
        flex-direction: column;
        padding: calc(.85rem + var(--safe-t)) max(.85rem, env(safe-area-inset-right)) calc(.85rem + var(--safe-b)) max(.85rem, env(safe-area-inset-left));
        background: var(--card);
        color: var(--text);
        border-left: 1px solid var(--border);
        box-shadow: -8px 0 32px rgba(0, 0, 0, .12);
        transform: translateX(104%);
        transition: transform .24s ease;
        overflow-y: auto;
        overscroll-behavior: contain;
        pointer-events: none;
    }

    body.filters-offcanvas-open {
        overflow: hidden;
    }

    body.filters-offcanvas-open .muro-filters {
        transform: translateX(0);
        pointer-events: auto;
    }

    .muro-filters .chips {
        flex-direction: column;
        align-items: stretch;
        gap: .4rem;
    }

    .muro-filters .chip {
        width: 100%;
        text-align: left;
        border-radius: 999px;
        padding: .55rem .85rem;
    }
}

/* Desktop: columna sticky a la izquierda */
@media (min-width: 960px) {
    .wrap--muro {
        max-width: calc(13rem + 2rem + var(--max-content));
    }

    .muro-layout {
        display: grid;
        grid-template-columns: 13rem minmax(0, var(--max-content));
        gap: 2rem;
        align-items: start;
    }

    .muro-filters {
        position: sticky;
        top: calc(3.75rem + var(--safe-t));
        align-self: start;
        max-height: calc(100vh - 4.5rem - var(--safe-t));
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-top: .15rem;
    }

    .muro-filters__head {
        display: none;
    }

    .muro-filters-btn,
    .muro-filters-backdrop {
        display: none !important;
    }

    .muro-filters .chips {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: .4rem;
    }

    .muro-filters .chip {
        width: 100%;
        text-align: left;
        border-radius: 999px;
        padding: .5rem .85rem;
    }
}

.meta {
    font-size: .8125rem;
    color: var(--muted);
    margin: 0 0 .5rem;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 3rem 0;
    font-size: 1rem;
}

.empty[hidden] { display: none !important; }

/* —— Feed estilo Medium —— */
.feed {
    display: flex;
    flex-direction: column;
}

.card {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.75rem 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
}

.card:first-child { padding-top: .5rem; }

.card:focus-visible {
    outline: 2px solid var(--c);
    outline-offset: 4px;
}

.card__body {
    flex: 1;
    min-width: 0;
    padding: 0;
}

.card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    margin: 0 0 .5rem;
    font-size: .8125rem;
    color: var(--muted);
}

.card__cat { font-weight: 500; }

.card__dot { opacity: .6; }

.card__date { font-weight: 400; }

.card__title {
    margin: 0 0 .45rem;
    font-family: var(--font-serif);
    font-size: clamp(1.25rem, 4vw, 1.375rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.015em;
    color: var(--text);
}

.card__sum {
    margin: 0;
    font-size: .9375rem;
    color: var(--muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card__img {
    flex-shrink: 0;
    width: 8.125rem;
    aspect-ratio: 1 / 1;
    border-radius: 2px;
    overflow: hidden;
    background: var(--surface-muted);
}

.card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.badge {
    display: inline-block;
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--c-soft);
    color: var(--c-hover);
    padding: .15rem .45rem;
    border-radius: 2px;
    margin-bottom: .45rem;
}

.card--featured {
    margin: .85rem 0;
    padding: 1.15rem 1.1rem;
    border-bottom: none;
    border-radius: 12px;
    background: var(--featured-bg);
    color: var(--featured-text);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.card--featured:first-child {
    margin-top: .35rem;
    padding-top: 1.15rem;
}

.card--featured + .card {
    border-top: none;
    padding-top: 1.75rem;
}

.card--featured .card__title {
    color: var(--featured-text);
}

.card--featured .card__meta,
.card--featured .card__sum {
    color: var(--featured-muted);
}

.card--featured .badge {
    background: var(--featured-badge-bg);
    color: var(--featured-badge-text);
}

.card--featured .card__img {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
}

.card--featured:focus-visible {
    outline-color: var(--featured-badge-text);
}

.tags { display: none; }

.tag { display: none; }

@media (min-width: 768px) {
    .card__img {
        width: 11.875rem;
    }
}

/* —— En Positivo —— */
.links-section {
    text-align: left;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.links-section__title {
    margin: 0 0 .75rem;
    font-family: var(--font-serif);
    font-size: 1.125rem;
    font-weight: 700;
}

.links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0;
}

.link-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    color: inherit;
}

.link-card:hover .link-card__t { color: var(--c); }

.link-card__t {
    display: block;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.3;
}

.link-card__d {
    display: block;
    font-size: .875rem;
    color: var(--muted);
    margin-top: .15rem;
    line-height: 1.4;
}

.link-card__go {
    margin-left: auto;
    color: var(--muted);
    font-size: 1.1rem;
}

/* —— Modal / lectura (Medium article) —— */
.modal[hidden] { display: none !important; }

body.modal-open { overflow: hidden; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    background: var(--bg);
}

.modal__bg {
    position: fixed;
    inset: 0;
    background: var(--modal-backdrop);
}

.modal__panel {
    position: relative;
    width: 100%;
    max-width: var(--max-reading);
    margin: 0 auto;
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
    background: var(--card);
    border-radius: 0;
    padding: 2.5rem max(1.25rem, env(safe-area-inset-left)) 2rem max(1.25rem, env(safe-area-inset-right));
    box-shadow: none;
}

@media (min-width: 768px) {
    .modal {
        align-items: center;
        padding: 2rem 1rem;
    }

    .modal__panel {
        border-radius: 4px;
        box-shadow: 0 8px 40px rgba(0, 0, 0, .12);
        max-height: 92vh;
        overflow-y: auto;
    }
}

.modal__x {
    position: sticky;
    top: 0;
    float: right;
    width: 2rem;
    height: 2rem;
    margin: -.5rem -.25rem .5rem .5rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
}

.modal__x:hover { color: var(--text); background: var(--hover-bg); }

.modal__img {
    margin: 0 0 1.5rem;
    border-radius: 2px;
    overflow: hidden;
}

.modal__img img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    display: block;
}

.modal__meta {
    margin: 0 0 .75rem;
    font-size: .8125rem;
    color: var(--muted);
    text-transform: none;
    font-weight: 500;
}

.modal__title {
    margin: 0 0 .75rem;
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.02em;
}

.modal__subtitle {
    margin: 0 0 1.25rem;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: var(--muted);
    line-height: 1.35;
    font-weight: 400;
}

.modal__body {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 1.5rem;
    max-width: 100%;
    overflow-x: hidden;
}

.modal__body.post-content { white-space: normal; }

.modal__body.post-content > * {
    max-width: 100%;
}

.modal__link {
    color: var(--c);
    font-weight: 500;
    font-family: var(--font-sans);
    font-size: .9375rem;
}

.modal__link:hover { color: var(--c-hover); }

.modal__footer {
    margin-top: 2rem;
    padding-top: 1.35rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.post-engage {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.post-engage__stats {
    font-family: var(--font-sans);
    font-size: .8125rem;
    color: var(--muted);
    letter-spacing: .01em;
}

.post-engage__likes {
    display: flex;
}

.post-engage__like {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 4px;
    padding: .55rem .95rem;
    font: inherit;
    font-family: var(--font-sans);
    font-size: .875rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.post-engage__like:hover {
    color: var(--text);
    border-color: var(--text);
    background: var(--hover-bg);
}

.post-engage__like--on {
    background: var(--c-soft);
    border-color: var(--c);
    color: var(--c);
}

.post-engage__like--on:hover {
    color: var(--c-hover);
    border-color: var(--c-hover);
    background: var(--c-soft);
}

.post-engage__like-icon {
    font-size: 1rem;
    line-height: 1;
    color: inherit;
}

.post-engage__like-count {
    font-variant-numeric: tabular-nums;
    color: inherit;
}

.post-engage__reactions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.post-engage__react {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border: 1px solid transparent;
    background: var(--surface-muted);
    border-radius: 4px;
    padding: .4rem .65rem;
    font: inherit;
    font-family: var(--font-sans);
    font-size: .8125rem;
    cursor: pointer;
    color: var(--text);
    transition: background .15s, border-color .15s, color .15s;
}

.post-engage__react:hover {
    background: var(--hover-bg);
    border-color: var(--border);
}

.post-engage__react--on {
    background: var(--c-soft);
    border-color: var(--c);
}

.post-engage__react-emoji {
    font-size: 1rem;
    line-height: 1;
}

.post-engage__react-count {
    min-width: 1ch;
    color: var(--muted);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.post-engage__react--on .post-engage__react-count {
    color: var(--c);
}

.post-share__label {
    margin: 0 0 .65rem;
    font-family: var(--font-sans);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.post-share__row {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.post-share__btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem .85rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: transparent;
    font: inherit;
    font-family: var(--font-sans);
    font-size: .8125rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.post-share__btn svg {
    flex-shrink: 0;
    opacity: .85;
}

.post-share__btn:hover {
    color: var(--text);
    border-color: var(--text);
    background: var(--hover-bg);
}

.post-share__btn:hover svg {
    opacity: 1;
}

.post-share__btn--wa:hover,
.post-share__btn--wa:focus-visible {
    color: #128c7e;
    border-color: #25d366;
    background: rgba(37, 211, 102, 0.08);
}

.post-share__btn--fb:hover,
.post-share__btn--fb:focus-visible {
    color: #1877f2;
    border-color: #1877f2;
    background: rgba(24, 119, 242, 0.08);
}

.post-share__btn--tg:hover,
.post-share__btn--tg:focus-visible {
    color: #229ed9;
    border-color: #229ed9;
    background: rgba(34, 158, 217, 0.08);
}

.post-share__btn--ig:hover,
.post-share__btn--ig:focus-visible {
    color: #c13584;
    border-color: #c13584;
    background: rgba(193, 53, 132, 0.08);
}

.post-share__btn--wx:hover,
.post-share__btn--wx:focus-visible {
    color: #07c160;
    border-color: #07c160;
    background: rgba(7, 193, 96, 0.08);
}

.post-share__btn--copied,
.post-share__btn--copied:hover {
    color: var(--c);
    border-color: var(--c);
    background: var(--c-soft);
}

.modal__wa {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem .95rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}

.modal__wa:hover {
    color: #128c7e;
    border-color: #25d366;
    background: rgba(37, 211, 102, 0.08);
}

.modal__wa-icon {
    flex-shrink: 0;
}

@media (max-width: 420px) {
    .post-share__btn {
        flex: 1 1 calc(50% - .4rem);
        justify-content: center;
    }
    .post-engage__like {
        width: 100%;
        justify-content: center;
    }
}

/* —— Contenido enriquecido (lectura) —— */
.post-subtitle {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--muted);
    margin: 0 0 1.25rem;
    line-height: 1.45;
}

.post-h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin: 2rem 0 .75rem;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -.015em;
}

.post-h3 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    margin: 1.5rem 0 .5rem;
    line-height: 1.3;
    font-weight: 700;
}

.post-p { margin: 0 0 1.35rem; }

.post-inline-link {
    color: var(--c);
    text-decoration: underline;
    text-underline-offset: 0.12em;
    font-weight: 500;
}

.post-inline-link:hover {
    color: var(--c-hover);
}

.post-quote {
    margin: 1.75rem 0;
    padding-left: 1.25rem;
    border-left: 3px solid var(--text);
    font-style: italic;
}

.post-quote p { margin: 0; }

.post-quote__cite {
    margin: .65rem 0 0;
    font-size: .9375rem;
    color: var(--muted);
    font-style: normal;
}

.post-list {
    list-style: none;
    margin: 0 0 1.35rem;
    padding: 0;
    display: grid;
    gap: .65rem;
    font-family: var(--font-sans);
    font-size: 1rem;
}

.post-list--bullets,
.post-list--numbered {
    display: block;
    list-style: revert;
    padding-left: 1.35rem;
}

.post-list--bullets .post-list__item,
.post-list--numbered .post-list__item {
    display: list-item;
    margin: 0 0 .35rem;
}

.post-list__item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .55rem;
    align-items: start;
}

.post-list--bullets .post-list__item,
.post-list--numbered .post-list__item {
    grid-template-columns: 1fr;
}

.post-list__icon { color: var(--text); font-size: 1.2rem; line-height: 1.2; }

.post-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

.post-link-wrap {
    margin: 1.5rem 0;
}

.post-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .75rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--c);
    font-family: var(--font-sans);
    font-size: .9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}

.post-link:hover {
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.post-link__arrow {
    font-size: .875rem;
    line-height: 1;
}

.post-file-wrap {
    margin: 1.5rem 0;
}

.post-file {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s, background .15s;
}

.post-file:hover {
    border-color: var(--c);
    background: var(--c-soft);
}

.post-file__icon {
    flex-shrink: 0;
    font-size: 1.5rem;
    color: var(--c);
}

.post-file__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.post-file__label {
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
}

.post-file__meta {
    font-size: .8125rem;
    color: var(--muted);
}

.post-file__go {
    flex-shrink: 0;
    font-size: 1.25rem;
    color: var(--c);
}

.post-embed {
    margin: 1.75rem 0;
}

.post-embed--instagram {
    width: min(100%, 540px);
    margin-left: auto;
    margin-right: auto;
}

.post-embed--tiktok {
    width: min(100%, 400px);
    margin-left: auto;
    margin-right: auto;
}

.post-embed__ig-wrap {
    width: 100%;
    min-height: 580px;
}

.post-embed__ig-wrap .instagram-media {
    min-height: 580px;
}

.post-embed__ig-fallback {
    margin: .75rem 0 0;
    text-align: center;
    font-family: var(--font-sans);
    font-size: .875rem;
}

.post-embed__ig-fallback a {
    color: var(--c);
    font-weight: 600;
    text-decoration: none;
}

.post-embed__ig-fallback a:hover {
    text-decoration: underline;
}

.post-embed--trigger {
    border: 0;
    padding: 0;
}

.post-embed__teaser {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    width: 100%;
    margin: 0;
    padding: 1.25rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: linear-gradient(165deg, var(--surface-muted) 0%, var(--surface-elevated) 100%);
    cursor: pointer;
    font: inherit;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.post-embed__teaser:hover {
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

.post-embed__teaser:focus-visible {
    outline: 2px solid var(--c);
    outline-offset: 2px;
}

.post-embed__teaser--video {
    aspect-ratio: 16 / 9;
    max-height: 420px;
}

.post-embed__teaser--ig {
    aspect-ratio: 4 / 5;
    width: min(100%, 340px);
    max-height: 520px;
    margin: 0 auto;
    background: linear-gradient(165deg, #fdf2f8 0%, #fce7f3 45%, #fbcfe8 100%);
}

.post-embed__play {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 1.15rem;
    line-height: 1;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.post-embed--instagram .post-embed__play {
    width: 3.5rem;
    height: 3.5rem;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    box-shadow: 0 4px 18px rgba(188, 24, 136, 0.35);
}

.post-embed--instagram .post-embed__play::before {
    content: "";
    width: 1.35rem;
    height: 1.35rem;
    border: 2px solid #fff;
    border-radius: .35rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.post-embed__brand {
    font-size: .8125rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--muted);
}

.post-embed--instagram .post-embed__brand {
    color: #9d174d;
}

.post-embed__label {
    font-size: .9375rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.35;
    max-width: 16rem;
}

/* —— Modal multimedia (IG vertical / vídeo 16:9) —— */
.embed-modal[hidden] { display: none !important; }

body.embed-modal-open { overflow: hidden; }

.embed-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.embed-modal__bg {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
}

.embed-modal__panel {
    position: relative;
    width: min(100%, 960px);
    max-height: 92vh;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.embed-modal__panel--ig {
    width: min(100%, 420px);
}

.embed-modal__panel--video {
    width: min(100%, 960px);
}

.embed-modal__x {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 2;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.embed-modal__x:hover {
    background: rgba(0, 0, 0, 0.75);
}

.embed-modal__stage {
    width: 100%;
    background: #000;
}

.embed-modal__panel--video .embed-modal__stage {
    aspect-ratio: 16 / 9;
    max-height: calc(92vh - 1rem);
}

.embed-modal__panel--ig .embed-modal__stage {
    aspect-ratio: 4 / 5;
    min-height: min(75vh, 680px);
    max-height: 92vh;
}

.embed-modal__iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: inherit;
    border: 0;
    background: var(--card);
}

.embed-modal__video {
    display: block;
    width: 100%;
    height: 100%;
    max-height: calc(92vh - 1rem);
    background: #000;
}

.post-embed__ratio {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--surface-muted);
    overflow: hidden;
    border-radius: 2px;
}

.post-embed__ratio--ig {
    aspect-ratio: 4 / 5;
    min-height: 580px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--card);
}

.post-embed__ratio--tiktok {
    aspect-ratio: 9 / 16;
    min-height: 580px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
}

.post-embed__ratio--ig .post-embed__iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 580px;
    border: 0;
}

.post-embed__ratio--tiktok .post-embed__iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 580px;
    border: 0;
}

.post-embed__video {
    display: block;
    width: 100%;
    max-height: 480px;
    border-radius: 2px;
    background: #000;
}

.post-video-upload {
    width: 100%;
    max-width: 100%;
    margin: 1.75rem 0;
    padding: 0;
    border: 0;
    overflow: hidden;
}

.post-video-upload__player {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    background: #000;
    vertical-align: top;
}

.post-image {
    width: 100%;
    max-width: 100%;
    margin: 1.75rem 0;
    padding: 0;
    border: 0;
}

.post-image__img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 2px;
}

.post-image__caption {
    margin: .55rem 0 0;
    font-size: .875rem;
    line-height: 1.45;
    color: var(--muted);
    text-align: center;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}

/* —— Offcanvas (menú móvil) —— */
.offcanvas {
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
}

.offcanvas[hidden] {
    display: none !important;
}

.offcanvas:not([hidden]) {
    pointer-events: auto;
}

.offcanvas__backdrop {
    position: absolute;
    inset: 0;
    background: var(--modal-backdrop);
    opacity: 0;
    transition: opacity .22s ease;
}

.offcanvas__panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(18.5rem, 88vw);
    display: flex;
    flex-direction: column;
    background: var(--card);
    color: var(--text);
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 32px rgba(0, 0, 0, .12);
    transform: translateX(-104%);
    transition: transform .24s ease;
    padding: calc(.85rem + var(--safe-t)) max(.85rem, env(safe-area-inset-right)) calc(.85rem + var(--safe-b)) max(.85rem, env(safe-area-inset-left));
}

body.nav-offcanvas-open {
    overflow: hidden;
}

body.nav-offcanvas-open .offcanvas__backdrop {
    opacity: 1;
}

body.nav-offcanvas-open .offcanvas__panel {
    transform: translateX(0);
}

.offcanvas__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.offcanvas__brand {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}

.offcanvas__wordmark {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.1;
}

.offcanvas__tagline {
    font-size: .625rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}

.offcanvas__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}

.offcanvas__close .material-symbols-outlined {
    font-size: 1.2rem;
    line-height: 1;
}

.offcanvas__links {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.offcanvas__link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem .9rem;
    border-radius: .65rem;
    text-decoration: none;
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
}

.offcanvas__link:hover {
    background: var(--hover-bg);
}

.offcanvas__link--on {
    color: var(--c);
    background: var(--c-soft);
    font-weight: 600;
}

.offcanvas__icon {
    font-size: 1.25rem;
    line-height: 1;
    width: 1.5rem;
    text-align: center;
}

@media (max-width: 639px) {
    .top__menu-btn {
        display: inline-flex;
    }

    body.app {
        padding-bottom: calc(var(--safe-b) + 8px);
    }

    body.has-install-bar {
        padding-bottom: calc(var(--safe-b) + 96px);
    }

    body.has-install-bar.has-install-diag-open {
        padding-bottom: calc(var(--safe-b) + 160px);
    }

    .install-bar {
        bottom: calc(var(--safe-b) + 6px);
    }

    .feed-toast {
        bottom: calc(var(--safe-b) + 12px);
    }
}

/* —— Navegación inferior (legacy) —— */
.nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    height: calc(var(--nav) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: var(--nav-bg);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    box-shadow: none;
    z-index: 15;
}

.nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    font-size: .6875rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
}

.nav__item span { font-size: 1.15rem; line-height: 1; }

.nav__item--on { color: var(--c); font-weight: 600; }

@media (min-width: 640px) {
    .nav { display: none; }
    body.app { padding-bottom: var(--safe-b); }
}

/* —— PWA install bar —— */
body.has-install-bar {
    padding-bottom: calc(var(--nav) + var(--safe-b) + 96px);
}

body.has-install-bar.has-install-diag-open {
    padding-bottom: calc(var(--nav) + var(--safe-b) + 160px);
}

.install-bar {
    position: fixed;
    left: max(.65rem, env(safe-area-inset-left, 0px));
    right: max(.65rem, env(safe-area-inset-right, 0px));
    bottom: calc(var(--nav) + var(--safe-b) + 6px);
    z-index: 50;
    background: var(--card);
    color: var(--text);
    border-radius: 4px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, .1);
    overflow: hidden;
}

.install-bar--expanded .install-bar__main {
    border-bottom: 1px solid var(--border);
}

.install-bar[hidden] { display: none !important; }

.install-bar__main {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem .65rem;
    padding: .75rem 2.1rem .75rem .85rem;
}

.install-bar__close {
    position: absolute;
    top: .45rem;
    right: .45rem;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 50%;
    background: var(--hover-bg);
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.install-bar__close:hover { background: var(--border); }

.install-bar__copy { flex: 1 1 140px; min-width: 0; }

.install-bar__title {
    margin: 0 0 .15rem;
    font-size: .875rem;
    font-weight: 600;
}

.install-bar__hint {
    margin: 0;
    font-size: .78rem;
    line-height: 1.35;
    color: var(--muted);
}

.install-bar__btn {
    flex: 1 1 auto;
    border: none;
    border-radius: 999px;
    padding: .55rem 1rem;
    font: inherit;
    font-size: .8125rem;
    font-weight: 500;
    cursor: pointer;
}

.install-bar__btn--on {
    background: var(--c);
    color: #fff;
}

.install-bar__btn--on:hover { background: var(--c-hover); }

.install-bar__btn--off,
.install-bar__btn--waiting {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--text);
}

.install-bar__btn--installed {
    background: var(--surface-muted);
    color: var(--muted);
    cursor: default;
}

.install-diag {
    padding: .65rem .85rem .75rem;
    background: var(--surface-muted);
    color: var(--text);
    font-size: .75rem;
    line-height: 1.4;
    max-height: 42vh;
    overflow-y: auto;
}

.install-diag[hidden] { display: none !important; }

.install-diag__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .35rem;
}

.install-diag__close {
    flex-shrink: 0;
    width: 1.6rem;
    height: 1.6rem;
    border: none;
    border-radius: 50%;
    background: var(--hover-bg);
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.install-diag__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin: .65rem 0 .35rem;
}

.install-diag__retry,
.install-diag__reload,
.install-diag__dismiss {
    flex: 1 1 auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .45rem .75rem;
    font: inherit;
    font-size: .75rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--card);
    color: var(--text);
}

.install-diag__retry {
    background: var(--c);
    border-color: var(--c);
    color: #fff;
}

.install-diag__title {
    margin: 0;
    font-size: .78rem;
    font-weight: 600;
}

.install-diag__foot {
    margin: .5rem 0 0;
    color: var(--muted);
    font-size: .72rem;
}

.install-diag__list { margin: 0; padding: 0; list-style: none; }

.install-diag__item {
    display: flex;
    gap: .45rem;
    align-items: flex-start;
    padding: .35rem 0;
    border-bottom: 1px solid var(--border-light);
}

.install-diag__item:last-child { border-bottom: none; }

.install-diag__item--ok .install-diag__icon { color: var(--c); }
.install-diag__item--bad .install-diag__icon { color: #c94a4a; }
.install-diag__item--warn .install-diag__icon { color: #b8860b; }

.install-diag__label { font-weight: 600; margin: 0 0 .1rem; }
.install-diag__fix { margin: 0; color: var(--muted); font-size: .71rem; }

@media (max-width: 480px) {
    .install-bar__main { flex-direction: column; align-items: stretch; }
    .install-bar__btn { width: 100%; text-align: center; }
    body.has-install-bar { padding-bottom: calc(var(--nav) + var(--safe-b) + 108px); }
    body.has-install-bar.has-install-diag-open { padding-bottom: calc(var(--nav) + var(--safe-b) + 220px); }
}

/* —— Modal iOS —— */
.install-ios[hidden] { display: none !important; }

/* —— PWA: aviso centrado para instalar —— */
.install-prompt[hidden] { display: none !important; }

body.install-prompt-open {
    overflow: hidden;
}

.install-prompt {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1.25rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
}

.install-prompt__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .48);
}

.install-prompt__card {
    position: relative;
    width: min(100%, 22rem);
    background: var(--card);
    color: var(--text);
    border-radius: 14px;
    padding: 2rem 1.5rem 1.35rem;
    text-align: center;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .22);
}

.install-prompt__icon {
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 1rem;
    display: block;
    border-radius: 12px;
}

.install-prompt__title {
    margin: 0 0 .55rem;
    font-family: var(--font-serif);
    font-size: clamp(1.35rem, 5vw, 1.6rem);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.25;
}

.install-prompt__text {
    margin: 0 0 1.35rem;
    color: var(--muted);
    font-size: .9375rem;
    line-height: 1.5;
}

.install-prompt__btn {
    display: block;
    width: 100%;
    margin: 0 0 .6rem;
    padding: .9rem 1.25rem;
    border: none;
    border-radius: 999px;
    font: inherit;
    font-size: 1.0625rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.install-prompt__btn--primary {
    background: #2563eb;
    color: #fff;
}

.install-prompt__btn--primary:hover {
    background: #1d4ed8;
}

.install-prompt__btn--ghost {
    background: transparent;
    color: var(--muted);
    font-weight: 500;
    font-size: .9375rem;
    margin-bottom: 0;
    padding: .65rem 1rem;
}

.install-prompt__btn--ghost:hover {
    color: var(--text);
}

.install-ios {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.install-ios__bg {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
}

.install-ios__panel {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border-radius: 4px;
    padding: 1.25rem;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .15);
}

.install-ios__x {
    position: absolute;
    top: .65rem;
    right: .65rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .06);
    color: var(--muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.install-ios__title {
    margin: 0 2rem .75rem 0;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 700;
}

.install-ios__steps {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    line-height: 1.55;
    color: var(--text);
}

.install-ios__ok {
    width: 100%;
    border: none;
    border-radius: 999px;
    padding: .65rem;
    background: var(--c);
    color: #fff;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.install-ios__ok:hover { background: var(--c-hover); }

/* —— Splash —— */
.splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text);
}

.splash[hidden] { display: none !important; }

.splash__box { text-align: center; padding: 1.5rem; }

.splash__icon {
    display: block;
    margin: 0 auto;
    width: 96px;
    height: 96px;
    border-radius: 4px;
    animation: splash-pop .45s ease-out;
}

@keyframes splash-pop {
    from { transform: scale(.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.splash__title {
    margin: 1rem 0 .25rem;
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.splash__tagline {
    margin: 0;
    font-size: .9375rem;
    color: var(--muted);
}

.splash--out {
    opacity: 0;
    transition: opacity .35s ease;
}

/* —— Aviso de contenido nuevo (pull, no push) —— */
.feed-toast {
    position: fixed;
    left: max(1rem, env(safe-area-inset-left));
    right: max(1rem, env(safe-area-inset-right));
    bottom: calc(var(--nav) + var(--safe-b) + 12px);
    z-index: 45;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .65rem;
    padding: .85rem 1rem;
    border-radius: 12px;
    background: #242424;
    color: #fff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

.feed-toast[hidden] { display: none !important; }

.feed-toast__text {
    flex: 1 1 12rem;
    margin: 0;
    font-size: .875rem;
    line-height: 1.45;
}

.feed-toast__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-left: auto;
}

.feed-toast__btn {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    color: #fff;
    border-radius: 999px;
    padding: .35rem .75rem;
    font: inherit;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
}

.feed-toast__btn--primary {
    background: var(--c);
    border-color: var(--c);
}

.feed-toast__btn--ghost {
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    padding: .15rem .45rem;
    opacity: .85;
}

body.has-feed-toast .nav {
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}

body.splash-open { overflow: hidden; }
