/* ==========================================================================
   MUSEUMS CSS - REFACTORED VERSION
   ========================================================================== */

/* CSS Variables */
:root {
    --london-blue: #041429;
    --paper: #fff;
    --ink: #0d1117;
    --card-r: 18px;
    --pad: 24px;
    --text: #000000;
    --muted: rgba(0, 0, 0, 0.7);
    --chip-bd: rgba(0, 0, 0, 0.2);
    --overlay-bg: rgba(255, 255, 255, 0.72);
    --overlay-blur: blur(16px) saturate(120%);
    --grad-1: linear-gradient(135deg, #f8fafc 0%, #eef2ff 50%, #e5e7eb 100%);
    --grad-2: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 50%, #f3e8ff 100%);
    --grad-3: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 50%, #a7f3d0 100%);
}

/* ==========================================================================
   MUSEUM GRID LAYOUT (museums.html)
   ========================================================================== */

.museums-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
}

.museums-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
}

.museums-filters {
    margin-bottom: 30px;
    padding: 20px 0;
}

.search-section {
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #000;
    border-radius: 0;
    font-size: 1rem;
    font-family: 'Arial', sans-serif;
    background: #fff;
    color: #000;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: #333;
}

.search-input::placeholder {
    color: #999;
}

.badge-filters {
    margin-top: 20px;
}

.filter-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0 0 15px 0;
    color: #000;
}

.badge-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.badge-filter-btn {
    padding: 8px 16px;
    border: 2px solid #000;
    background: #fff;
    color: #000;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Arial', sans-serif;
}

.badge-filter-btn:hover {
    background: #f0f0f0;
}

.badge-filter-btn.active {
    background: #ff0000;
    color: #fff;
}

.museums-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
    gap: 20px !important;
    margin-bottom: 40px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.museums-no-results {
    text-align: center;
    padding: 40px;
    font-size: 1.1rem;
    color: #666;
    border: 2px dashed #ccc;
    margin: 20px 0;
}

/* ==========================================================================
   MUSEUM CARDS (shared between museums.html and museum.html)
   ========================================================================== */

.museum-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.museum-card {
    border: 2px solid #000 !important;
    background: #fff !important;
    transition: transform 0.2s ease !important;
    position: relative !important;
    overflow: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
    aspect-ratio: 2/1 !important;
}

.museum-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.museum-image-container {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    border-bottom: 1px solid #000 !important;
    box-sizing: border-box !important;
}

.museum-image,
.museum-detail-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    max-width: 100% !important;
}

.museum-image.no-image,
.museum-detail-image.no-image {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.museum-badges,
.museum-detail-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.museum-detail-badges {
    top: 15px;
    left: 15px;
    gap: 8px;
}

.museum-badge {
    background: #000;
    color: #fff;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: bold;
    border: 1px solid #000;
    white-space: nowrap;
}

.museum-badge.free {
    background: #00aa00;
    border-color: #00aa00;
}

.museum-badge.category {
    background: #000;
    border-color: #000;
}

.museum-popularity,
.museum-detail-popularity {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fff;
    color: #000;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: bold;
    border: 1px solid #000;
}

.museum-detail-popularity {
    top: 15px;
    right: 15px;
    padding: 6px 12px;
    font-size: 1rem;
    border: 2px solid #000;
}

.museum-name-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    max-width: calc(100% - 20px);
}

.museum-name-overlay .museum-name {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    padding: 6px 10px;
    margin: 0;
    font-size: 0.9rem;
    font-weight: bold;
    border: 1px solid #000;
    display: inline-block;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    line-height: 1.2;
}

/* ==========================================================================
   MUSEUM DETAIL PAGE (museum.html)
   ========================================================================== */

.museum-header {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    border-bottom: 2px solid #000;
    padding-bottom: 30px;
}

.museum-image-section {
    position: relative;
    flex-shrink: 0;
    width: 400px;
    height: 300px;
    border: 2px solid #000;
    overflow: hidden;
}

.museum-header-info {
    flex: 1;
}

.museum-summary {
    font-size: 1.1rem;
    line-height: 1.6;
    color: white;
    margin: 0 0 30px 0;
}

.museum-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.museum-link {
    display: inline-block;
    padding: 12px 20px;
    background: #000;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    border: 2px solid #000;
    transition: all 0.2s ease;
}

.museum-link:hover {
    background: #fff;
    color: #000;
}

.museum-section {
    margin-bottom: 40px;
    border-bottom: 1px solid #000;
    padding-bottom: 30px;
}

.section-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 0 0 20px 0;
    color: #000;
}

/* Opening Hours */
.opening-hours {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.opening-hours--single {
    max-width: fit-content;
}

.opening-day {
    white-space: nowrap;
    padding: 8px 12px;
    background: #f8f8f8;
    border: 1px solid #000;
    font-family: monospace;
    font-size: 0.9rem;
    color: black;
}

/* Admissions */
.admissions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    max-width: fit-content;
}

.admission-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f8f8;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    min-width: 150px;
    flex: 0 0 auto;
}

.admission-category {
    font-weight: 500;
    color: #333;
    margin-right: 16px;
}

.admission-price {
    font-weight: bold;
    color: #000;
    font-size: 1.1rem;
}

/* Weekend Suggestions */
.weekend-suggestions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.weekend-link {
    display: inline-block;
    padding: 15px 25px;
    background: #000;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    border: 2px solid #000;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.weekend-link:hover {
    background: #fff;
    color: #000;
}

.museum-not-found {
    text-align: center;
    padding: 60px 20px;
}

.museum-not-found h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #000;
}

.back-link {
    display: inline-block;
    padding: 12px 20px;
    background: #000;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    border: 2px solid #000;
    transition: all 0.2s ease;
}

.back-link:hover {
    background: #fff;
    color: #000;
}

/* ==========================================================================
   HIGHLIGHTS SECTION (museum.html)
   ========================================================================== */

.highlights {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-top: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
    font-size: 20px;
}

.highlights-card {
    position: relative;
    flex: 0 0 auto;
    min-width: 300px;
    max-width: 600px;
    width: auto;
    border-radius: var(--card-r);
    overflow: visible;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--grad-1);
    background-size: 100% 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    padding: var(--pad);
    margin: 20px 0;
    margin-left: 0 !important;
}

.highlights-card:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 4px;
}

.highlights-card:nth-child(2n) {
    background: var(--grad-2);
}

.highlights-card:nth-child(3n) {
    background: var(--grad-3);
}

.highlights-card:hover,
.highlights-card:focus {
    background-size: 104% 104%;
}

.highlights-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-bg);
    backdrop-filter: var(--overlay-blur);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(25%);
}

.highlights-card:hover .highlights-card-overlay,
.highlights-card:focus .highlights-card-overlay {
    opacity: 1;
    transform: translateY(0);
}

.highlights-card>* {
    position: relative;
    z-index: 2;
    color: var(--text);
}

.highlights-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--pad);
    padding-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.highlights-card-title {
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
}

.highlights-card-desc {
    line-height: 1.5;
    margin: 0;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
}

.highlights-tip-icon {
    color: #666;
    margin: 8px 0;
    padding: 8px 12px;
    background: #f8f9fa;
    border-left: 3px solid #007bff;
    border-right: 3px solid #007bff;
    display: block;
    line-height: 1.4;
}

.highlights-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--pad) var(--pad);
    margin-top: auto;
    gap: 12px;
}

.highlights-card-location {
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    text-align: center;
    margin: 0;
}

.highlights-tag {
    display: inline-block;
    font-weight: 500;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
    flex-shrink: 0;
    text-align: center;
}

/* ==========================================================================
   SURPRISE FACTS SECTION (museum.html)
   ========================================================================== */

.numberlist {
    margin: 1rem 0;
    margin-left: auto;
}

.numberlist ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: flex-end;
}

.numberlist li {
    position: relative;
    background: var(--paper);
    color: var(--ink);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 0, 0, .06);
    border-left: 6px solid var(--london-blue);
    overflow: hidden;
    width: fit-content;
}

.numberlist li::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0 60%, rgba(0, 0, 0, .035) 60% 100%);
    pointer-events: none;
}

.numberlist .fact-text {
    display: block;
    line-height: 1.55;
    font-size: 1rem;
    color: #111827;
}

.numberlist .fact-text::first-letter {
    float: left;
    font-size: 2.6em;
    line-height: .88;
    margin: .02em .28em 0 0;
    font-weight: 900;
    color: var(--london-blue);
    letter-spacing: -0.02em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
    font-family: "Gill Sans", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

.numberlist .fact-text::after {
    content: "";
    display: table;
    clear: both;
}

.fact-source {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    font-style: italic;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 1200px) {
    .highlights-card {
        min-width: 280px;
        max-width: 350px;
    }
}

@media (max-width: 900px) {
    .highlights-card {
        min-width: 250px;
        max-width: 320px;
    }
}

@media (max-width: 768px) {
    .museums-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .museum-card {
        aspect-ratio: 2/1 !important;
    }

    .badge-buttons {
        gap: 8px;
    }

    .badge-filter-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .places .container,
    .museum-page .container {
        text-align: left !important;
        padding: 20px;
        height: auto !important;
        min-height: auto !important;
    }

    .museum-header {
        flex-direction: column;
        gap: 24px;
    }

    .museum-image-section {
        width: 100%;
        height: 250px;
    }

    .museum-summary {
        font-size: 16px;
        line-height: 1.6;
    }

    .museum-links {
        flex-direction: column;
        gap: 12px;
    }

    .weekend-suggestions {
        flex-direction: column;
        gap: 12px;
    }

    .opening-hours {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .admissions {
        flex-direction: column;
        gap: 12px;
    }

    .admission-item {
        min-width: auto;
        width: 100%;
        padding: 10px 14px;
    }

    .section-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .museum-section {
        margin-bottom: 30px;
        display: block !important;
    }

    .museum-header-info {
        width: 100%;
    }

    .museum-links {
        width: 100%;
    }

    .highlights {
        flex-direction: column;
        --pad: 20px;
        gap: 24px;
        overflow-x: visible;
    }

    .highlights-card {
        width: 100%;
        margin-left: 0 !important;
        min-height: 200px;
        min-width: auto;
        max-width: 100%;
    }

    .highlights-card-desc {
        -webkit-line-clamp: 4;
        line-clamp: 4;
        line-height: 1.6;
    }

    .highlights-card-bottom {
        padding: 0 var(--pad) var(--pad);
        gap: 16px;
        flex-wrap: wrap;
    }

    .numberlist {
        max-width: 100%;
    }

    .numberlist li {
        padding: .6em .6em .6em 2.2em;
        margin: 1em 0;
    }

    .fact-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .museum-card {
        aspect-ratio: 2/1 !important;
    }

    .museum-badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }

    .museum-popularity {
        font-size: 0.7rem;
        padding: 3px 6px;
    }

    .museum-badges {
        gap: 3px;
    }

    .museum-name-overlay .museum-name {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    .places .container,
    .museum-page .container {
        height: auto !important;
        min-height: auto !important;
        min-width: auto !important;
    }
}

/* ==========================================================================
   ACCESSIBILITY & MOTION PREFERENCES
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .highlights-card,
    .highlights-card-overlay {
        transition: none;
    }

    .highlights-card:hover,
    .highlights-card:focus {
        background-size: 100% 100%;
    }

    .highlights-card-overlay {
        opacity: 0.3;
        transform: none;
    }

    .numberlist li,
    .numberlist li::after {
        transition: none;
    }
}

@media (prefers-color-scheme: dark) {
    .numberlist li {
        background: #2974B9;
        color: #e5e7eb;
        box-shadow: 0 6px 18px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .25);
    }

    .numberlist .fact-text {
        color: #e5e7eb;
    }

    .numberlist li::after {
        background: linear-gradient(120deg, transparent 0 60%, rgba(255, 255, 255, .04) 60% 100%);
    }
}
