@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@300;400;700&display=swap');

* {
    box-sizing: border-box;
    font-family: 'Comic Neue', cursive;
}

/* ============================================================
   VARIABLES
============================================================ */
:root {
    --pub-blue: #001f3f;
    --pub-blue-2: #123f78;
    --pub-red: #ff4136;
    --pub-gold: #daa520;
    --pub-white: #ffffff;
    --pub-bg: #f4f7fb;
    --pub-text: #4f5d70;
    --pub-muted: #7d8898;
    --pub-border: #e3e9f2;
    --pub-shadow: 0 18px 45px rgba(0, 31, 63, 0.12);
    --pub-radius: 28px;
}

/* ============================================================
   NAV ACTIVO
============================================================ */
.nav-item.active > a {
    color: var(--pub-red);
}

/* ============================================================
   HERO
============================================================ */
.pub-hero {
    position: relative;
    min-height: 480px;
    background: var(--pub-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pub-hero-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.pub-hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.05);
    animation: pubHeroZoom 13s ease-in-out infinite alternate;
}

@keyframes pubHeroZoom {
    from {
        transform: scale(1.05);
    }

    to {
        transform: scale(1.12);
    }
}

.pub-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        linear-gradient(90deg, rgba(0, 31, 63, 0.9) 0%, rgba(0, 31, 63, 0.68) 48%, rgba(0, 31, 63, 0.35) 100%),
        radial-gradient(circle at 85% 25%, rgba(255, 65, 54, 0.28), transparent 35%);
}

.pub-hero::after {
    content: "";
    position: absolute;
    right: -140px;
    bottom: -150px;
    width: 430px;
    height: 430px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    z-index: 2;
}

.pub-hero-content {
    position: relative;
    z-index: 3;
    width: min(1180px, calc(100% - 40px));
    padding: 145px 0 90px;
    color: var(--pub-white);
}

.pub-hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: var(--pub-white);
    font-weight: 800;
    font-size: 0.98rem;
    margin-bottom: 18px;
    backdrop-filter: blur(5px);
}

.pub-hero-tag i {
    color: var(--pub-gold);
}

.pub-hero-content h1 {
    font-size: clamp(3rem, 7vw, 5.8rem);
    line-height: 1;
    margin: 0 0 18px;
    font-weight: 800;
    color: var(--pub-white);
    text-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

.pub-hero-content p {
    max-width: 790px;
    margin: 0;
    color: rgba(255, 255, 255, 0.94);
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    line-height: 1.85;
}

/* ============================================================
   BREADCRUMB
============================================================ */
.breadcrumb {
    background: var(--pub-white);
    border-bottom: 1px solid var(--pub-border);
}

.breadcrumb-container {
    width: min(1320px, calc(100% - 32px));
    margin: 0 auto;
    padding: 15px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.96rem;
    color: var(--pub-muted);
}

.breadcrumb-container a {
    color: var(--pub-blue);
    text-decoration: none;
    font-weight: 800;
}

.breadcrumb-container i {
    font-size: 0.72rem;
    color: #a1aabc;
}

/* ============================================================
   BASE
============================================================ */
.pub-main {
    background:
        radial-gradient(circle at 10% 10%, rgba(255, 65, 54, 0.06), transparent 32%),
        radial-gradient(circle at 92% 20%, rgba(0, 31, 63, 0.08), transparent 30%),
        linear-gradient(180deg, #f9fbfe 0%, #eef3f9 100%);
    padding: 56px 0 86px;
    overflow: hidden;
}

.pub-container {
    width: min(1320px, calc(100% - 32px));
    margin: 0 auto;
}

.pub-title-line {
    width: 76px;
    height: 4px;
    background: var(--pub-gold);
    border-radius: 999px;
    margin: 0 auto 22px;
}

/* ============================================================
   REVEAL
============================================================ */
.pub-reveal {
    opacity: 0;
    transform: translateY(34px);
    transition: opacity 0.75s ease, transform 0.75s ease;
}

.pub-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   INTRO
============================================================ */
.pub-intro {
    text-align: center;
    margin-bottom: 48px;
}

.pub-intro h2 {
    color: var(--pub-blue);
    font-size: clamp(2.1rem, 4vw, 3.25rem);
    font-weight: 800;
    line-height: 1.1;
    margin: 0 0 12px;
}

.pub-intro h2 span {
    color: var(--pub-red);
}

.pub-intro p {
    max-width: 900px;
    margin: 0 auto;
    color: var(--pub-text);
    font-size: 1.08rem;
    line-height: 1.85;
}

/* ============================================================
   PUBLICACIÓN DESTACADA
============================================================ */
.pub-featured {
    margin-bottom: 62px;
}

.featured-book {
    position: relative;
    display: grid;
    grid-template-columns: 0.82fr 1.18fr;
    gap: 34px;
    background: var(--pub-white);
    border: 1px solid var(--pub-border);
    border-radius: 34px;
    padding: 34px;
    box-shadow: var(--pub-shadow);
    overflow: hidden;
}

.featured-book::before {
    content: "";
    position: absolute;
    top: -110px;
    right: -110px;
    width: 260px;
    height: 260px;
    background: rgba(255, 65, 54, 0.09);
    border-radius: 50%;
}

.featured-book::after {
    content: "";
    position: absolute;
    bottom: -120px;
    left: -120px;
    width: 270px;
    height: 270px;
    background: rgba(0, 31, 63, 0.07);
    border-radius: 50%;
}

.featured-book-cover,
.featured-book-content {
    position: relative;
    z-index: 2;
}

.featured-book-cover {
    min-height: 480px;
    border-radius: 28px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--pub-blue), var(--pub-blue-2));
    box-shadow: 0 22px 48px rgba(0, 31, 63, 0.22);
}

.featured-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.55s ease;
}

.featured-book-cover:hover img {
    transform: scale(1.045);
}

.featured-book-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 16px 8px;
}

.featured-book-content h2 {
    color: var(--pub-blue);
    font-size: clamp(2.1rem, 4vw, 3.2rem);
    font-weight: 800;
    line-height: 1.12;
    margin: 0 0 16px;
}

.featured-book-content p {
    color: var(--pub-text);
    font-size: 1.08rem;
    line-height: 1.85;
    margin: 0 0 22px;
}

.featured-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 26px;
}

.featured-meta div {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f5f7fb;
    border: 1px solid var(--pub-border);
    color: var(--pub-blue);
    font-size: 0.95rem;
    font-weight: 800;
    padding: 9px 14px;
    border-radius: 999px;
}

.featured-meta i {
    color: var(--pub-red);
}

/* ============================================================
   CATEGORÍAS
============================================================ */
.pub-category {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 800;
    margin-bottom: 14px;
}

.pub-category.memoria {
    color: var(--pub-blue);
    background: rgba(0, 31, 63, 0.1);
}

.pub-category.cultura {
    color: #0f6b50;
    background: rgba(25, 168, 120, 0.13);
}

.pub-category.buen-trato {
    color: var(--pub-red);
    background: rgba(255, 65, 54, 0.12);
}

.pub-category.metodologia {
    color: #7b4d00;
    background: rgba(218, 165, 32, 0.18);
}

/* ============================================================
   BOTONES
============================================================ */
.pub-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pub-btn {
    border: none;
    outline: none;
    cursor: pointer;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 13px 20px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.98rem;
    font-weight: 800;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}

.pub-btn.primary {
    background: var(--pub-red);
    color: var(--pub-white);
    box-shadow: 0 12px 24px rgba(255, 65, 54, 0.24);
}

.pub-btn.primary:hover {
    transform: translateY(-3px);
    background: #e5372e;
    box-shadow: 0 18px 32px rgba(255, 65, 54, 0.32);
}

.pub-btn.secondary {
    background: #eef3f9;
    color: var(--pub-blue);
    border: 1px solid var(--pub-border);
}

.pub-btn.secondary:hover {
    transform: translateY(-3px);
    background: var(--pub-blue);
    color: var(--pub-white);
}

.pub-btn.closing-btn {
    background: var(--pub-white);
    color: var(--pub-blue);
}

.pub-btn.closing-btn:hover {
    transform: translateY(-3px);
    background: var(--pub-red);
    color: var(--pub-white);
}

/* ============================================================
   TOOLS
============================================================ */
.pub-tools {
    margin-bottom: 34px;
}

.pub-tools-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 28px;
    margin-bottom: 24px;
}

.pub-tools-header h2 {
    color: var(--pub-blue);
    font-size: clamp(1.85rem, 3vw, 2.65rem);
    font-weight: 800;
    line-height: 1.1;
    margin: 0 0 8px;
}

.pub-tools-header p {
    color: var(--pub-text);
    font-size: 1.02rem;
    line-height: 1.6;
    margin: 0;
}

.pub-search {
    position: relative;
    width: min(390px, 100%);
}

.pub-search i {
    position: absolute;
    top: 50%;
    left: 17px;
    transform: translateY(-50%);
    color: var(--pub-muted);
    font-size: 0.98rem;
}

.pub-search input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--pub-border);
    border-radius: 999px;
    background: var(--pub-white);
    color: var(--pub-blue);
    padding: 0 18px 0 45px;
    font-size: 1rem;
    font-weight: 700;
    outline: none;
    box-shadow: 0 10px 26px rgba(0, 31, 63, 0.06);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.pub-search input:focus {
    border-color: rgba(255, 65, 54, 0.55);
    box-shadow: 0 14px 28px rgba(255, 65, 54, 0.1);
}

.pub-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-btn {
    border: 1px solid var(--pub-border);
    background: var(--pub-white);
    color: var(--pub-blue);
    padding: 11px 18px;
    border-radius: 999px;
    font-size: 0.98rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.22s ease, background-color 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}

.filter-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 65, 54, 0.5);
    color: var(--pub-red);
}

.filter-btn.active {
    background: var(--pub-blue);
    color: var(--pub-white);
    border-color: var(--pub-blue);
}

/* ============================================================
   GRID
============================================================ */
.pub-catalog {
    margin-bottom: 66px;
}

.pub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.pub-card {
    display: flex;
    flex-direction: column;
    background: var(--pub-white);
    border: 1px solid var(--pub-border);
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 14px 34px rgba(0, 31, 63, 0.1);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.pub-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 22px 45px rgba(0, 31, 63, 0.16);
}

.pub-card-cover {
    position: relative;
    height: 370px;
    background: linear-gradient(135deg, var(--pub-blue), var(--pub-blue-2));
    overflow: hidden;
}

.pub-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.55s ease, filter 0.55s ease;
}

.pub-card:hover .pub-card-cover img {
    transform: scale(1.055);
    filter: saturate(1.08);
}

.pub-card-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0, 31, 63, 0.38));
    pointer-events: none;
}

.pub-year {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    background: var(--pub-white);
    color: var(--pub-blue);
    padding: 7px 13px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.pub-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 26px 24px 24px;
}

.pub-card-body h3 {
    color: var(--pub-blue);
    font-size: 1.45rem;
    line-height: 1.22;
    font-weight: 800;
    margin: 0 0 12px;
}

.pub-card-body p {
    color: var(--pub-text);
    font-size: 0.99rem;
    line-height: 1.72;
    margin: 0 0 18px;
}

.pub-card-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--pub-muted);
    font-size: 0.92rem;
    font-weight: 700;
    margin-top: auto;
    margin-bottom: 20px;
}

.pub-card-info span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pub-card-info i {
    color: var(--pub-red);
}

/* ============================================================
   FALLBACK SI NO HAY PORTADA
============================================================ */
.book-fallback {
    display: none;
}

.pub-card-cover.no-cover,
.featured-book-cover.no-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.pub-card-cover.no-cover .book-fallback,
.featured-book-cover.no-cover .book-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--pub-white);
    text-align: center;
    gap: 14px;
}

.pub-card-cover.no-cover .book-fallback i,
.featured-book-cover.no-cover .book-fallback i {
    font-size: 4rem;
    color: var(--pub-gold);
}

.pub-card-cover.no-cover .book-fallback span,
.featured-book-cover.no-cover .book-fallback span {
    font-size: 1.4rem;
    font-weight: 800;
}

/* ============================================================
   EMPTY
============================================================ */
.pub-empty {
    display: none;
    text-align: center;
    background: var(--pub-white);
    border: 1px solid var(--pub-border);
    border-radius: 28px;
    padding: 46px 22px;
    color: var(--pub-text);
    box-shadow: 0 14px 34px rgba(0, 31, 63, 0.08);
}

.pub-empty.show {
    display: block;
}

.pub-empty i {
    font-size: 2.8rem;
    color: var(--pub-red);
    margin-bottom: 16px;
}

.pub-empty h3 {
    color: var(--pub-blue);
    font-size: 1.55rem;
    font-weight: 800;
    margin: 0 0 8px;
}

.pub-empty p {
    margin: 0;
    font-size: 1rem;
}

/* ============================================================
   CIERRE
============================================================ */
.pub-closing {
    margin-top: 20px;
}

.pub-closing-box {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    background:
        linear-gradient(135deg, rgba(0, 31, 63, 0.94), rgba(18, 63, 120, 0.94)),
        url("img/6.jpg") center/cover no-repeat;
    color: var(--pub-white);
    border-radius: 34px;
    padding: 44px 42px;
    box-shadow: 0 20px 48px rgba(0, 31, 63, 0.22);
}

.pub-closing-box::before {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    right: -95px;
    top: -110px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.09);
}

.pub-closing-box::after {
    content: "";
    position: absolute;
    width: 200px;
    height: 200px;
    left: -80px;
    bottom: -95px;
    border-radius: 50%;
    background: rgba(255, 65, 54, 0.22);
}

.pub-closing-box > * {
    position: relative;
    z-index: 2;
}

.pub-closing-box h2 {
    color: var(--pub-white);
    font-size: clamp(1.8rem, 3vw, 2.65rem);
    line-height: 1.15;
    font-weight: 800;
    margin: 0 0 10px;
}

.pub-closing-box p {
    max-width: 760px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.05rem;
    line-height: 1.75;
    margin: 0;
}

/* ============================================================
   MODAL PDF
============================================================ */
.pdf-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
}

.pdf-modal.show {
    display: flex;
}

.pdf-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 11, 26, 0.78);
    backdrop-filter: blur(6px);
}

.pdf-modal-content {
    position: relative;
    z-index: 2;
    width: min(1120px, 100%);
    height: min(88vh, 850px);
    background: var(--pub-white);
    border-radius: 26px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
    transform: translateY(20px) scale(0.98);
    animation: modalIn 0.25s ease forwards;
}

@keyframes modalIn {
    to {
        transform: translateY(0) scale(1);
    }
}

.pdf-modal-header {
    min-height: 78px;
    padding: 18px 22px;
    background: linear-gradient(135deg, var(--pub-blue), var(--pub-blue-2));
    color: var(--pub-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.pdf-modal-header span {
    display: block;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.88rem;
    font-weight: 800;
    margin-bottom: 3px;
}

.pdf-modal-header h3 {
    color: var(--pub-white);
    font-size: clamp(1.1rem, 2vw, 1.55rem);
    line-height: 1.2;
    font-weight: 800;
    margin: 0;
}

.pdf-close {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: var(--pub-white);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.22s ease, transform 0.22s ease;
}

.pdf-close:hover {
    background: var(--pub-red);
    transform: rotate(90deg);
}

.pdf-frame-wrap {
    flex: 1;
    background: #e9eef5;
}

.pdf-frame-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.pdf-modal-footer {
    min-height: 72px;
    padding: 14px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--pub-white);
    border-top: 1px solid var(--pub-border);
}

/* ============================================================
   RESPONSIVE TABLET
============================================================ */
@media (max-width: 1100px) {
    .featured-book {
        grid-template-columns: 1fr;
    }

    .featured-book-cover {
        min-height: 520px;
    }

    .pub-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pub-tools-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .pub-search {
        width: 100%;
    }

    .pub-closing-box {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ============================================================
   RESPONSIVE MOBILE
============================================================ */
@media (max-width: 768px) {
    .pub-hero {
        min-height: 420px;
    }

    .pub-hero-content {
        width: calc(100% - 32px);
        padding: 125px 0 76px;
        text-align: center;
    }

    .pub-hero-tag {
        margin-left: auto;
        margin-right: auto;
    }

    .pub-main {
        padding: 42px 0 70px;
    }

    .pub-container,
    .breadcrumb-container {
        width: calc(100% - 24px);
    }

    .pub-intro {
        margin-bottom: 38px;
    }

    .featured-book {
        padding: 22px;
        border-radius: 26px;
        gap: 24px;
    }

    .featured-book-cover {
        min-height: 430px;
        border-radius: 22px;
    }

    .featured-book-content {
        padding: 0;
    }

    .featured-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .pub-grid {
        grid-template-columns: 1fr;
    }

    .pub-card {
        border-radius: 26px;
    }

    .pub-card-cover {
        height: 420px;
    }

    .pub-card-body {
        padding: 24px 20px;
    }

    .pub-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .pub-btn {
        width: 100%;
    }

    .pub-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 6px;
    }

    .filter-btn {
        white-space: nowrap;
    }

    .pub-closing-box {
        padding: 38px 24px;
        border-radius: 26px;
        text-align: center;
        align-items: center;
    }

    .pdf-modal {
        padding: 10px;
    }

    .pdf-modal-content {
        height: 92vh;
        border-radius: 20px;
    }

    .pdf-modal-header {
        min-height: auto;
        padding: 15px 16px;
    }

    .pdf-modal-footer {
        flex-direction: column;
        padding: 12px;
    }
}

/* ============================================================
   RESPONSIVE SMALL MOBILE
============================================================ */
@media (max-width: 480px) {
    .pub-hero {
        min-height: 380px;
    }

    .pub-hero-content {
        padding: 112px 0 62px;
    }

    .pub-hero-content h1 {
        font-size: clamp(2.7rem, 13vw, 4rem);
    }

    .pub-hero-content p,
    .pub-intro p,
    .featured-book-content p,
    .pub-tools-header p,
    .pub-card-body p,
    .pub-closing-box p {
        font-size: 0.98rem;
        line-height: 1.72;
    }

    .featured-book-cover {
        min-height: 360px;
    }

    .pub-card-cover {
        height: 350px;
    }

    .pub-category {
        font-size: 0.82rem;
    }

    .pdf-close {
        width: 40px;
        height: 40px;
    }
}

/* ============================================================
   REDUCIR MOVIMIENTO
============================================================ */
@media (prefers-reduced-motion: reduce) {
    .pub-hero-bg img {
        animation: none;
    }

    .pub-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .pub-card,
    .pub-card-cover img,
    .featured-book-cover img,
    .pub-btn,
    .filter-btn,
    .pdf-close {
        transition: none;
    }

    .pdf-modal-content {
        animation: none;
        transform: none;
    }
}