/* Self-hosted so every device renders the same. PT Serif is metrically within
   0.1% of Georgia at the hero size (870px vs 871px for the same string at
   80px), so swapping it in did not rewrap any headline. Latin subsets only;
   the site is es-CL. */
@font-face {
    font-family: "Inter";
    src: url("/fonts/inter-latin-italic-100-900.woff2") format("woff2");
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter";
    src: url("/fonts/inter-latin-normal-100-900.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "PT Serif";
    src: url("/fonts/pt-serif-latin-normal-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "PT Serif";
    src: url("/fonts/pt-serif-latin-normal-700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
            --primary: #243447;
            --accent: #4f7cff;
            --bg: #eef2f7;
            --card-bg: rgba(255, 255, 255, 0.94);
            --surface: #ffffff;
            --surface-soft: #f6f8fb;
            --text: #2a3441;
            --text-muted: #667085;
            --border: #dce3ec;
            --status-available-bg: #edf7ef;
            --status-available-text: #2e7d32;
            --status-loaned-bg: #fdecee;
            --status-loaned-text: #b42318;
            --badge-available: #2e7d32;
            --badge-loaned: #c62828;
        }

        * { box-sizing: border-box; margin: 0; padding: 0; }
        body {
            font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background:
                radial-gradient(circle at top, rgba(79, 124, 255, 0.08), transparent 28%),
                linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%);
            color: var(--text);
            padding: 1.5rem 1rem 2rem;
            line-height: 1.5;
        }
        
        header {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.9rem;
            margin-bottom: 1rem;
            padding: 0.35rem 0 0.7rem;
            text-align: left;
            border-bottom: 1px solid rgba(220, 227, 236, 0.7);
        }
        .brand {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 0.85rem;
            min-width: 0;
        }
        .brand-logo {
            width: 54px;
            height: 54px;
            object-fit: contain;
            flex: 0 0 auto;
        }
        .brand-text {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 0.3rem;
            min-width: 0;
        }
        h1 {
            color: var(--primary);
            font-size: clamp(1.45rem, 3vw, 1.9rem);
            line-height: 1.08;
            margin: 0;
            letter-spacing: -0.03em;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
        }

        .container { margin: 0 auto; }

        .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 210px)); gap: 1.25rem; justify-content: center; justify-items: stretch; }
        
        .card { 
            background: var(--card-bg);
            border: 1px solid rgba(220, 227, 236, 0.8);
            border-radius: 16px;
            padding: 0.95rem;
            box-shadow: 0 8px 24px rgba(36, 52, 71, 0.06);
            text-align: center;
            transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
            cursor: pointer;
            position: relative;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            backdrop-filter: blur(6px);
            width: 100%;
        }
        .card:hover { 
            transform: translateY(-3px);
            box-shadow: 0 12px 28px rgba(36, 52, 71, 0.11);
            border-color: rgba(79, 124, 255, 0.28);
        }

        .cover-wrapper { position: relative; width: 100%; height: 245px; margin-bottom: 0.85rem; border-radius: 12px; overflow: hidden; background: #edf1f5; }
        .card img { width: 100%; height: 100%; object-fit: cover; }

        .card .title { font-weight: 700; font-size: 0.98rem; color: var(--primary); margin-top: 0.2rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 2.8em; }
        .card .author { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

        /* Status Pills */
        .status-pill {
            position: absolute;
            top: 10px;
            right: 10px;
            padding: 4px 10px;
            border-radius: 999px;
            font-size: 0.7rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            box-shadow: 0 2px 8px rgba(0,0,0,0.12);
            z-index: 2;
        }
        .status-pill.available { background-color: var(--badge-available); color: white; }
        .status-pill.loaned { background-color: var(--badge-loaned); color: white; }

        /* Modal Styles */
        .modal-overlay {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(18, 24, 38, 0.5);
            backdrop-filter: blur(10px);
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.25s ease;
            z-index: 1000;
            padding: 1rem;
        }
        .modal-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

        .modal {
            background: rgba(255, 255, 255, 0.97);
            border: 1px solid rgba(220, 227, 236, 0.9);
            border-radius: 20px;
            max-width: 920px;
            width: 100%;
            max-height: 92vh;
            overflow-y: auto;
            box-shadow: 0 18px 40px rgba(18, 24, 38, 0.18);
            position: relative;
            transform: scale(0.97);
            transition: transform 0.25s ease;
            padding: 1.8rem;
        }
        .modal-overlay.active .modal {
            transform: scale(1);
        }

        .close-btn {
            position: absolute;
            top: 14px;
            right: 16px;
            background: #f5f7fa;
            border: 1px solid #e2e8f0;
            width: 36px;
            height: 36px;
            border-radius: 999px;
            font-size: 1.1rem;
            cursor: pointer;
            color: #52606d;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s, border-color 0.2s, color 0.2s;
        }
        .close-btn:hover { background: #edf2f7; border-color: #cbd5e1; color: #1f2937; }

        .modal-body {
            display: flex;
            gap: 1.5rem;
            flex-wrap: wrap;
        }

        .modal-cover-column {
            flex: 0 0 220px;
            display: flex;
            flex-direction: column;
            align-items: center;
            margin: 0 auto;
        }

        .modal-cover {
            width: 220px;
            height: 320px;
            border-radius: 14px;
            object-fit: cover;
            box-shadow: 0 10px 24px rgba(36, 52, 71, 0.15);
            background: #eef2f7;
            margin-bottom: 0.8rem;
        }

        .modal-info { flex: 1; min-width: 300px; }

        .modal-title { font-size: 1.65rem; font-weight: 700; color: var(--primary); margin-bottom: 0.3rem; line-height: 1.2; letter-spacing: -0.02em; }
        .modal-author { font-size: 1rem; color: var(--text-muted); margin-bottom: 1rem; font-weight: 500; }

        .status-banner {
            width: 100%;
            padding: 0.55rem 0.8rem;
            border-radius: 12px;
            font-weight: 700;
            font-size: 0.84rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.4rem;
            text-align: center;
            margin-bottom: 0.65rem;
        }
        .status-banner.loaned {
            background-color: var(--status-loaned-bg);
            color: var(--status-loaned-text);
            border: 1px solid rgba(180, 35, 24, 0.12);
        }
        .status-banner.available {
            background-color: var(--status-available-bg);
            color: var(--status-available-text);
            border: 1px solid rgba(46, 125, 50, 0.12);
        }

        .meta-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.8rem;
            background: var(--surface-soft);
            padding: 1rem;
            border-radius: 14px;
            font-size: 0.88rem;
            margin-bottom: 1.2rem;
            border: 1px solid rgba(220, 227, 236, 0.9);
        }
        .meta-item span { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.04em; }
        .meta-item strong { color: var(--primary); }

        .modal-description-title { font-weight: 700; font-size: 0.95rem; color: var(--primary); margin-bottom: 0.4rem; }
        .modal-description { font-size: 0.95rem; color: #3f4a56; line-height: 1.7; max-height: 300px; overflow-y: auto; padding-right: 5px; }

        /* Buscador */
        .search-section {
            max-width: 620px;
            margin: 0 auto 1.8rem auto;
            background: rgba(255, 255, 255, 0.72);
            border: 1px solid rgba(220, 227, 236, 0.85);
            border-radius: 18px;
            padding: 1rem 1rem 0.85rem;
            box-shadow: 0 8px 24px rgba(36, 52, 71, 0.05);
            backdrop-filter: blur(10px);
        }

        .search-wrapper {
            position: relative;
            display: flex;
            align-items: center;
            background: #f6f8fb;
            border: 1px solid #e2e8f0;
            border-radius: 999px;
            overflow: hidden;
        }

        .search-icon {
            position: absolute;
            left: 1rem;
            color: #7b8794;
            pointer-events: none;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .search-input {
            width: 100%;
            padding: 0.88rem 2.8rem 0.88rem 2.85rem;
            font-size: 1rem;
            font-family: inherit;
            border: none;
            background: transparent;
            color: var(--text);
            outline: none;
            box-shadow: none;
            transition: none;
        }

        .search-input:focus {
            outline: none;
        }

        .search-clear {
            position: absolute;
            right: 0.75rem;
            background: #dde3ea;
            border: none;
            color: #52606d;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            font-size: 1rem;
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            transition: background 0.15s, color 0.15s;
        }

        .search-clear:hover {
            background: #ccd5df;
            color: #1f2937;
        }

        .search-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.85rem;
            color: var(--text-muted);
            margin-top: 0.65rem;
            padding: 0 0.15rem;
        }

        /* Estado vacío */
        .empty-state {
            grid-column: 1 / -1;
            text-align: center;
            padding: 3.25rem 1rem;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 16px;
            border: 1px dashed var(--border);
        }

        .empty-state h3 {
            font-size: 1.2rem;
            color: var(--primary);
            margin-bottom: 0.4rem;
        }

        .empty-state p {
            color: var(--text-muted);
            font-size: 0.95rem;
            margin-bottom: 1.2rem;
        }

        .btn-reset {
            background: var(--accent);
            color: white;
            border: none;
            padding: 0.55rem 1.3rem;
            border-radius: 999px;
            font-size: 0.88rem;
            font-weight: 600;
            cursor: pointer;
            transition: transform 0.18s ease, opacity 0.18s ease;
        }

        .btn-reset:hover {
            opacity: 0.94;
            transform: translateY(-1px);
        }

        .footer {
            margin-top: 2rem;
            background: #060606;
            color: #f4f4f5;
            border-top: 1px solid rgba(255, 255, 255, 0.08);
            padding: 1.4rem 1.25rem;
        }

        .footer-inner {
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            align-items: center;
            text-align: center;
        }

        .footer-title {
            font-size: 1rem;
            font-weight: 700;
            letter-spacing: -0.01em;
            line-height: 1.35;
        }

        .footer-text {
            font-size: 0.92rem;
            color: rgba(244, 244, 245, 0.82);
            line-height: 1.55;
            max-width: 900px;
        }

        .footer-links {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 0.45rem;
            font-size: 0.92rem;
            line-height: 1.4;
        }

        .footer-links .footer-link-sep {
            color: rgba(244, 244, 245, 0.45);
        }

        .footer-link {
            color: #9ec5ff;
            text-decoration: none;
            font-weight: 600;
        }

        .footer-link:hover {
            text-decoration: underline;
        }

        /* Diseño adaptado del catálogo de referencia */
        :root {
            --primary: #245c43;
            --accent: #245c43;
            --bg: #f7f4ed;
            --card-bg: #fffdf8;
            --surface: #fffdf8;
            --surface-soft: #f5f2e9;
            --text: #15231d;
            --text-muted: #66726b;
            --border: #dcd8ce;
            --status-available-bg: #e9f2ec;
            --status-available-text: #245c43;
            --status-loaned-bg: #f8e9e5;
            --status-loaned-text: #9b352d;
            --badge-available: #245c43;
            --badge-loaned: #9b352d;
        }
        body {
            padding: 0;
            background: var(--bg);
            color: var(--text);
            font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        }
        html { overflow-x: clip; }
        .container { width: min(calc(100% - 40px), 1220px); max-width: 1220px; padding: 0; }
        header {
            min-height: 240px;
            width: 100vw;
            margin: 0 calc(50% - 50vw) 1.75rem;
            padding: 32px clamp(20px, 5vw, 76px);
            justify-content: flex-start;
            text-align: left;
            border: 0;
            background: linear-gradient(90deg, rgba(16,43,31,.93) 0%, rgba(16,43,31,.9) 68%, rgba(16,43,31,.42) 100%), url('/hero-background.webp') center / cover;
            color: white;
        }
        .brand { width: 100%; max-width: 1320px; margin: 0 auto; gap: 20px; }
        .brand-text { gap: 0; }
        .brand-logo { width: 76px; height: 76px; border-radius: 50%; background: rgba(255,255,255,.94); padding: 5px; }
        h1 {
            color: #fffdf8;
            font: 500 clamp(2rem, 4.3vw, 3.5rem)/1.05 "PT Serif", Georgia, "Times New Roman", serif;
            letter-spacing: -.02em;
            margin: 0 0 7px;
            white-space: normal;
        }
        .search-section {
            max-width: none;
            margin: 0 auto 1.5rem;
            padding: .9rem 1rem;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            box-shadow: 0 5px 18px rgba(21,35,29,.06);
            backdrop-filter: none;
        }
        .search-wrapper { background: #fff; border-color: var(--border); border-radius: 10px; }
        .search-input { color: var(--text); }
        .search-icon { color: var(--text-muted); }
        .grid {
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 16px;
            justify-content: stretch;
            margin-bottom: 2rem;
        }
        .card {
            min-height: 335px;
            padding: 16px;
            background: var(--card-bg);
            border: 1px solid var(--border);
            border-radius: 16px;
            box-shadow: 0 2px 0 rgba(21,35,29,.02);
            backdrop-filter: none;
            text-align: left;
            transition: transform .2s ease, box-shadow .2s ease;
        }
        .card:hover {
            transform: translateY(-4px);
            border-color: #b9c7bc;
            box-shadow: 0 18px 50px rgba(28,47,38,.10);
        }
        .card:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
        .cover-area { display: flex; width: 100%; height: 320px; align-items: center; justify-content: center; margin-bottom: 16px; border-radius: 10px; }
        .cover-wrapper { width: 100%; height: 100%; border-radius: 10px; background: transparent; display: flex; align-items: center; justify-content: center; }
        .card img {
            display: block;
            width: auto;
            height: auto;
            max-width: min(100%, 320px);
            max-height: 320px;
            object-fit: contain;
            border-radius: 3px;
            box-shadow: 0 5px 14px rgba(21,35,29,.14);
        }
        .card .title {
            color: var(--text);
            font: 500 1.5rem/1.12 "PT Serif", Georgia, "Times New Roman", serif;
            letter-spacing: 0;
            margin: 0;
            height: auto;
            min-height: 0;
            order: 2;
        }
        .book-meta { display: contents; }
        .card .author { color: var(--text-muted); font-size: .9rem; }
        .book-year { order: 1; color: #66726b; font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; }
        .card .author { order: 3; }
        .book-categories { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }
        .book-categories { order: 4; }
        .book-category { padding: 5px 9px; border: 0; border-radius: 99px; background: #e9f0eb; color: #245c43; font: 400 .72rem/1.2 Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
        .book-category:hover { background: #d9e8dd; }
        .book-category:focus-visible, .author-filter:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
        .author-filter { padding: 0; border: 0; background: transparent; color: #245c43; font: inherit; text-align: left; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
        .author-filter:hover { color: #143d2b; }
        .status-pill { top: 12px; right: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
        .modal-overlay { background: rgba(16,47,35,.52); }
        .modal { background: #fffdf8; border-color: var(--border); }
        .modal-cover {
            width: auto;
            height: auto;
            max-width: 220px;
            max-height: min(420px, 58vh);
            object-fit: contain;
            background: transparent;
        }
        .modal-title { color: var(--text); font: 500 clamp(1.8rem, 5.5vw, 3.1rem)/1.12 "PT Serif", Georgia, "Times New Roman", serif; }
        .modal-description-title { color: var(--primary); }
        .meta-grid { background: #f7f4ed; border-color: var(--border); }
        .footer { background: #102f23; color: #fffdf8; border: 0; padding: 36px clamp(20px, 5vw, 76px); }
        .footer-inner { max-width: 1220px; flex-direction: column; flex-wrap: wrap; justify-content: center; gap: 12px; text-align: center; }
        .footer-title, .footer-text { width: 100%; }
        .footer-text { color: rgba(255,253,248,.72); font-size: .84rem; }
        .footer-links { justify-content: center; font-size: .84rem; gap: 9px; }
        .footer-link { color: #e3c37f; }
        @media (min-width: 601px) and (max-width: 1071px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
        @media (max-width: 600px) {
            .container { padding: 0; }
            header { min-height: 160px; margin-bottom: 1.2rem; padding: 20px; background-image: linear-gradient(90deg, rgba(16,43,31,.94) 0%, rgba(16,43,31,.9) 68%, rgba(16,43,31,.62) 100%), url('/hero-background.webp'); }
            .brand { gap: 13px; }
            .brand-logo { width: 52px; height: 52px; }
            h1 { font-size: clamp(1.7rem, 7vw, 2.35rem); }
            .grid { grid-template-columns: 1fr; gap: 12px; }
            .card { min-height: 0; }
            .cover-area { height: 180px; }
            .card img { max-width: 180px; max-height: 180px; }
            .modal-cover { max-width: 180px; max-height: 260px; }
            .footer { padding: 28px 16px; }
            .footer-inner { flex-direction: column; align-items: center; gap: 10px; text-align: center; }
            .footer-text { margin: 0; }
        }

        /* Barra institucional compartida y hero del catálogo */
        .site-header {
            position: sticky;
            top: 0;
            z-index: 20;
            min-height: 76px;
            background: rgba(247,244,237,.96);
            border-bottom: 1px solid rgba(220,216,206,.9);
            backdrop-filter: blur(12px);
        }
        .site-header-inner {
            width: min(calc(100% - 40px), 1220px);
            min-height: 76px;
            margin: 0 auto;
            padding: 8px 0;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 20px;
        }
        .site-brand { display: flex; align-items: center; flex: 0 0 auto; text-decoration: none; }
        .site-logo { display: block; width: auto; max-width: 256px; height: 56px; object-fit: contain; object-position: left center; }
        .main-navigation { margin-left: auto; }
        .main-navigation > ul, .main-navigation ul ul { list-style: none; }
        .main-navigation > ul { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 3px 6px; }
        .main-navigation li { position: relative; }
        .main-navigation a {
            display: flex; min-height: 40px; align-items: center; padding: 6px 10px; border: 0; border-radius: 8px;
            background: transparent; color: #15231d; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14.4px; font-weight: 650; line-height: 1.3;
            text-decoration: none;
        }
        .main-navigation a:hover, .main-navigation button:hover { background: #e9f0eb; color: #143d2b; }
        .main-navigation .nav-item-link { display: flex; align-items: center; }
        .main-navigation .nav-parent-trigger, .main-navigation .nav-submenu-toggle { display: inline-flex; min-height: 40px; align-items: center; gap: .55em; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: #15231d; font: 650 14.4px/1.3 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; cursor: pointer; }
        .main-navigation .nav-submenu-toggle { width: 32px; justify-content: center; }
        .main-navigation .nav-parent-trigger span, .main-navigation .nav-submenu-toggle span { width: .4em; height: .4em; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform 160ms ease; }
        .main-navigation [aria-expanded="true"] span { transform: rotate(225deg); }
        .main-navigation ul ul[hidden] { display: none !important; }
        .main-navigation ul ul {
            display: grid; position: absolute; top: calc(100% - 2px); left: 0; min-width: 210px;
            padding: 8px; background: #fffdf8; border: 1px solid #dcd8ce; border-radius: 12px;
            box-shadow: 0 18px 50px rgba(28,47,38,.16);
        }
        .main-navigation ul ul ul { top: 0; left: 100%; }
        .menu-disclosure { display: none; position: relative; margin-left: auto; }
        .menu-toggle {
            display: flex; min-height: 44px; align-items: center; gap: 9px; padding: 8px 12px;
            border: 1px solid #dcd8ce; border-radius: 10px; background: #fffdf8;
            color: #143d2b; font: 700 14px/1.2 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
            cursor: pointer; list-style: none;
        }
        .menu-toggle::-webkit-details-marker { display: none; }
        .menu-icon { position: relative; display: inline-flex; width: 18.4px; height: 14px; flex: 0 0 18.4px; flex-direction: column; justify-content: space-between; }
        .menu-icon span { display: block; width: 18.4px; height: 2px; border-radius: 2px; background: currentColor; transition: transform 160ms ease, opacity 160ms ease; }
        .menu-disclosure[open] .menu-icon span:first-child { transform: translateY(6px) rotate(45deg); }
        .menu-disclosure[open] .menu-icon span:nth-child(2) { opacity: 0; }
        .menu-disclosure[open] .menu-icon span:last-child { transform: translateY(-6px) rotate(-45deg); }
        .menu-disclosure > nav {
            position: absolute; z-index: 25; top: calc(100% + 8px); right: 0; width: min(224px, calc(100vw - 40px));
            margin: 0; padding: 8px; border: 1px solid #dcd8ce; border-radius: 14px;
            background: #fffdf8; box-shadow: 0 18px 50px rgba(28,47,38,.16);
        }
        .menu-disclosure .main-navigation > ul { display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
        .menu-disclosure .main-navigation li { width: 100%; }
        .menu-disclosure .main-navigation .nav-item-link:has([aria-expanded="true"]) { background: #e9f0eb; }
        .menu-disclosure .main-navigation .nav-item-link > a { flex: 1; width: auto; min-height: 40px; padding: 6px 10px; border-radius: 8px; }
        .menu-disclosure .main-navigation .nav-parent-trigger { width: 100%; justify-content: space-between; }
        .menu-disclosure .main-navigation ul ul {
            display: grid; position: static; min-width: 0; margin-top: 4px; padding: 6px;
            border: 0; border-radius: 10px; box-shadow: none; background: rgba(36, 92, 67, 0.06); gap: 2px;
        }
        /* The second selector exists only to outrank `.menu-disclosure .main-navigation
           .nav-item-link > a` (3,1), which also matches submenu rows and forced
           min-height 40px on them. Adding `li .nav-item-link >` makes this (4,4)
           so the 36px actually applies. */
        .menu-disclosure .main-navigation ul ul a,
        .menu-disclosure .main-navigation ul ul li .nav-item-link > a { min-height: 36px; padding: 6px 8px; font-size: 14px; }
        .menu-disclosure .main-navigation ul ul a:hover,
        .menu-disclosure .main-navigation ul ul li .nav-item-link > a:hover { background: rgba(36, 92, 67, 0.12); color: #143d2b; }
        :where(.site-header a, .site-header button, .menu-toggle):focus-visible { outline: 3px solid rgba(36,92,67,.45); outline-offset: 3px; }
        @media (prefers-reduced-motion: reduce) { .menu-icon span { transition: none; } }
        .container { padding-top: 0; }
        /* The hero is a sibling of .container, not a child, so it spans the viewport
           exactly. Escaping a narrower container with `width: 100vw` made the box
           include the vertical scrollbar and sit half a scrollbar off-centre,
           which shifted and rescaled the background image. */
        header.hero {
            min-height: 240px; width: auto; margin: 0 0 1.75rem;
            padding: 32px 0; justify-content: flex-start; text-align: left;
            border: 0; background: linear-gradient(90deg, rgba(16,43,31,.93) 0%, rgba(16,43,31,.9) 68%, rgba(16,43,31,.42) 100%), url('/hero-background.webp') center / cover;
            color: white;
        }
        /* Matches the other UCB apps (norma-grafica): the 1320px cap includes the
           horizontal padding. The nested 1220px cap is gone so the hero title
           lands on the same left margin across all four applications. */
        .hero-copy {
            width: min(100%, 1320px);
            margin-inline: auto;
            padding-inline: clamp(20px, 5vw, 76px);
        }
        header.hero h1 { margin-bottom: 7px; }
        @media (max-width: 900px) {
            .site-header-inner { gap: 8px; padding: 10px 0; }
            .site-logo { height: 44.8px; max-width: min(192px, 55vw); }
            .desktop-navigation { display: none; }
            .menu-disclosure { display: block; }
            .menu-disclosure .main-navigation { margin: 0; }
        }
        @media (max-width: 600px) {
            header.hero {
                min-height: 160px;
                padding: 20px 0;
                margin: 0 0 1.5rem;
                background-image: linear-gradient(90deg, rgba(16,43,31,.94) 0%, rgba(16,43,31,.9) 68%, rgba(16,43,31,.62) 100%), url('/hero-background.webp');
            }
        }

        @media (max-width: 550px) {
            body { padding: 1rem 0.75rem 1.5rem; }
            header { gap: 0.5rem; padding: 0.4rem 0 0.65rem; }
            .brand { gap: 0.65rem; }
            .brand-logo { width: 46px; height: 46px; }
            h1 { font-size: 1.25rem; }
            .search-section { padding: 0.9rem; margin-bottom: 1.35rem; }
            .grid { gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
            .modal { padding: 1.25rem; border-radius: 18px; }
            .modal-body { flex-direction: column; align-items: center; }
            .modal-info { width: 100%; min-width: 0; }
            .modal-cover-column { flex: 0 0 auto; }
            .modal-cover { width: 180px; height: 260px; }
            .meta-grid { grid-template-columns: 1fr; }
            .footer { padding: 1.2rem 1rem; }
            .footer-title { font-size: 0.95rem; }
            .footer-text { font-size: 0.86rem; }
            .footer-links { font-size: 0.84rem; gap: 0.35rem; }
        }
        @media (max-width: 600px) {
            body { padding: 0; }
            .container { padding: 0; }
            header { min-height: 160px; padding: 20px; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
            .brand { gap: 13px; }
            .grid { grid-template-columns: 1fr; }
            .brand-logo { width: 52px; height: 52px; }
            h1 { font-size: clamp(1.7rem, 7vw, 2.35rem); }
            .footer { padding: 28px 16px; }
            .modal-title { font-size: clamp(1.55rem, 7.5vw, 2rem); }
        }
        .search-section {
            max-width: none;
            display: grid;
            gap: 12px;
            margin: 0 auto 12px;
            padding: 0;
            background: transparent;
            border: 0;
            border-radius: 0;
            box-shadow: none;
            backdrop-filter: none;
        }
        .toolbar-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; gap: 10px; align-items: end; }
        .search-wrapper { min-width: 0; min-height: 48px; padding: 6px; background: #fff; border: 0; border-radius: 12px; box-shadow: 0 18px 50px rgba(28,47,38,.10); overflow: visible; }
        .search-wrapper:focus-within { outline: 3px solid var(--primary); outline-offset: 3px; }
        .search-input { min-width: 0; padding: 9px 14px; font-size: .9rem; }
        .search-clear { position: relative; right: auto; flex: 0 0 24px; margin-right: 8px; }
        .search-submit {
            flex: 0 0 auto;
            min-height: 36px;
            margin: 0;
            padding: 9px 18px;
            border: 0;
            border-radius: 8px;
            background: #245c43;
            color: #fff;
            font: 700 .875rem/1.1 Inter, ui-sans-serif, system-ui, sans-serif;
            cursor: pointer;
        }
        .search-submit:hover { background: #143d2b; }
        .toolbar-controls { display: contents; }
        .sort-control, .view-control { display: flex; flex-direction: column; gap: 5px; }
        .sort-control label, .view-control label, .filter-field label { color: #66726b; font-size: .7rem; font-weight: 700; line-height: 1.2; }
        .sort-control select, .filter-field select {
            min-width: 165px;
            min-height: 36px;
            padding: 7px 28px 7px 9px;
            border: 1px solid #dcd8ce;
            border-radius: 7px;
            background: #fff;
            color: #15231d;
            font: 400 .85rem/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
        }
        .view-buttons { display: flex; gap: 4px; }
        .view-button { min-height: 36px; padding: 7px 9px; border: 1px solid #dcd8ce; border-radius: 7px; background: transparent; color: #66726b; font: 700 .78rem/1 Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
        .view-button.active, .view-button:hover { border-color: #245c43; background: #e9f0eb; color: #143d2b; }
        .filter-toggle { width: 82px; height: 36px; padding: 7px 8px; border: 1px solid #dcd8ce; border-radius: 8px; background: #fff; color: #15231d; font: 700 .78rem/1 Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
        .filter-toggle[aria-expanded="true"] { border-color: #245c43; background: #e9f0eb; color: #143d2b; }
        .filter-toggle[aria-expanded="true"]:hover { background: #e2ebe4; }
        .filters-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 8px; }
        .filters-panel[hidden] { display: none; }
        .filter-field { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
        .filter-field select { width: 100%; }
        .search-meta { margin: 0; padding: 0 4px; font-size: .8rem; }
        .search-meta span:last-child { text-align: right; }
        .clear-action { display: none; justify-self: end; padding: 4px; border: 0; background: transparent; color: #245c43; font: 400 .84rem/1.4 Inter, ui-sans-serif, system-ui, sans-serif; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
        .clear-action:hover { color: #143d2b; }
        .grid.list-view { grid-template-columns: 1fr; gap: 10px; }
        .list-view .card { display: grid; grid-template-columns: minmax(0,1fr) auto; min-height: 0; padding: 14px; border-radius: 9px; background: #fff; gap: 6px 14px; }
        .list-view .status-pill { position: static; grid-column: 2; grid-row: 1; justify-self: end; align-self: start; }
        .list-view .cover-area { display: none; }
        .list-view .card .title { grid-column: 1; grid-row: 1; margin: 0; }
        .list-view .card .title { font: 700 1rem/1.4 Inter, ui-sans-serif, system-ui, sans-serif; }
        .list-view .book-meta { grid-column: 1 / -1; grid-row: 2; display: flex; min-width: 0; flex-wrap: wrap; align-items: baseline; gap: 0 10px; margin-top: -6px; color: #66726b; font-size: .84rem; line-height: 1.5; }
        .list-view .book-year, .list-view .card .author { margin: 0; }
        .list-view .book-year { letter-spacing: normal; text-transform: none; }
        .list-view .card .author { white-space: normal; }
        .list-view .author-filter { color: #66726b; }
        .list-view .author-filter:hover { color: #245c43; }
        .list-view .book-categories { display: inline-flex; gap: 4px; padding: 0; }
        .list-view .book-category { padding: 2px 7px; }
        .list-view .card:hover { border-color: #aabcae; background: #f3f7f3; box-shadow: none; transform: none; }
        @media (min-width: 685px) and (max-width: 1071px) { .cover-area { height: 300px; } .card img { max-height: 300px; } }
        @media (min-width: 1072px) { .cover-area { height: 320px; } }
        @media (min-width: 601px) and (max-width: 1239px) {
            .toolbar-row { grid-template-columns: minmax(0,1fr) auto auto; row-gap: 8px; }
            .search-wrapper { grid-column: 1 / -1; }
            .sort-control select { width: 100%; }
        }
        @media (min-width: 601px) and (max-width: 745px) { .toolbar-row { column-gap: 6px; } }
        @media (max-width: 600px) {
            .search-section { padding: 0; }
            .search-section { row-gap: 4px; }
            .toolbar-row { grid-template-columns: minmax(0,1fr) auto auto 82px; column-gap: 4px; row-gap: 4px; }
            .search-wrapper { grid-column: 1 / -1; }
            .search-submit { padding-inline: 13px; }
            .sort-control { grid-column: 1 / 2; gap: 3px; }
            .sort-control select { min-width: 0; width: 100%; }
            .view-control { grid-column: 2 / 4; gap: 5px; }
            .filter-toggle { grid-column: 4 / 5; }
            .filters-panel { grid-template-columns: 1fr; }
            .search-meta { align-items: flex-start; gap: 4px 12px; flex-wrap: wrap; }
            .search-meta span:last-child { text-align: left; }
            .list-view .card { grid-template-columns: 1fr; gap: 6px; }
            .list-view .status-pill { grid-column: 1; grid-row: auto; }
            .list-view .card .title { grid-column: 1; grid-row: auto; margin: 0; }
            .list-view .book-meta { grid-column: 1; grid-row: auto; margin-top: -6px; }
            .list-view .status-pill { justify-self: start; }
            .list-view .book-categories { justify-content: flex-start; }
        }

        /* Pie institucional compartido */
        :root { --footer-color: #102f23; --gold: #c99745; }
        .footer {
            margin-top: 2rem;
            padding: 48px 0 20px;
            border: 0;
            background: var(--footer-color);
            color: rgba(255,255,255,.68);
            font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
            font-size: 13.4px;
            font-weight: 400;
            line-height: 1.5;
        }
        .footer-inner {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 32px clamp(32px, 5vw, 80px);
            align-items: stretch;
            width: min(calc(100% - 40px), 1220px);
            max-width: 1220px;
            margin: 0 auto;
            text-align: left;
        }
        .footer-column { min-width: 0; }
        .visually-hidden {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }
        .footer-heading {
            margin: 0 0 16px;
            color: #fff;
            font-size: 14.4px;
            font-weight: 700;
            letter-spacing: .035em;
            line-height: 1.3;
            text-transform: uppercase;
        }
        .footer-brand {
            display: block;
            width: 100%;
            max-width: 208px;
            max-height: 80px;
            margin: 0 0 16px;
            object-fit: contain;
            object-position: left center;
        }
        .footer-text { max-width: 360px; margin: 0; color: rgba(255,255,255,.68); font-size: 13.4px; line-height: 20px; }
        .social-links { display: flex; gap: 10px; margin-top: 18px; }
        .social-links a {
            display: grid;
            width: 40px;
            height: 40px;
            place-items: center;
            border-radius: 10px;
            background: #1e3349;
            color: #9aabc0;
        }
        .social-links a:hover { background: #29445e; color: #fff; }
        .social-links a:focus-visible, .footer a:focus-visible { outline: 3px solid rgba(201,151,69,.9); outline-offset: 3px; }
        .social-links svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
        .social-links svg .icon-fill { fill: currentColor; stroke: none; }
        .footer-link-list, .footer-link-list ul { margin: 0; padding: 0; list-style: none; }
        .footer-link-list { display: grid; gap: 9px; }
        .footer-link-list ul { display: grid; gap: 9px; padding-left: 14px; }
        .footer-link { color: rgba(255,255,255,.86); text-decoration: none; }
        .footer-link:hover { text-decoration: underline; text-underline-offset: 3px; }
        .footer-link-list a { display: inline-block; font-weight: 400; }
/* Columna de contacto del pie. Valores de la norma grafica; el sitio principal es
   la implementacion de referencia. */
.footer-contact-list { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.footer-contact-item { display: grid; grid-template-columns: 19px minmax(0, 1fr); align-items: start; gap: 11px; }
.footer-contact-icon { color: #c99745; padding-top: 2px; }
.footer-contact-item .footer-icon { display: block; width: 19px; height: 19px; }
.footer-contact-item h3 { margin: 0 0 2px; color: rgba(255,255,255,0.86); font-size: 13.4px; font-weight: 700; line-height: 1.5; }
.footer-contact-item p { margin: 0; }
.footer-contact-item a { color: inherit; text-decoration: none; }
.footer-contact-item a:hover { color: #fff; text-decoration: underline; }
        .footer-contact-status { color: rgba(255,255,255,.68); font-size: 13px; }
        .footer-bottom {
            grid-column: 1 / -1;
            padding-top: 16px;
            border-top: 1px solid rgba(255,255,255,.16);
            color: rgba(255,255,255,.68);
        }
        @media (max-width: 900px) {
            .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .footer-message { grid-column: 1 / -1; }
        }
        @media (max-width: 600px) {
            .footer { padding-bottom: 20px; }
            .footer-inner { grid-template-columns: 1fr; gap: 28px; }
            .footer-message { grid-column: auto; }
        }
