/* 65Nation Celebrations Widget — Card Grid + Modal */

/* ── Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── Base ── */
html {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: transparent;
    min-height: 100%;
    color: #2D2D2D;
    font-size: 17px;
    line-height: 1.7;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Container ── */
.celebrations-container {
    width: 100%;
    max-width: 100%;
    padding: 24px 20px;
}

/* ── Fade-in ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══ Header ═══ */
.celebrations-header {
    margin-bottom: 28px;
    animation: fadeIn 0.4s ease-out;
}

.header-top {
    margin-bottom: 14px;
}

.header-logo {
    height: 36px;
    width: auto;
    display: block;
}

.header-accent-bar {
    width: 56px;
    height: 4px;
    background: #E8634A;
    border-radius: 2px;
    margin-bottom: 14px;
}

.header-title-row h1 {
    font-family: Georgia, serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.25;
    margin-bottom: 4px;
}

.date-display {
    font-size: 0.9rem;
    color: #E8634A;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ═══ Card Grid ═══ */
.celebrations-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ═══ Grid Card (compact thumbnail) ═══ */
.grid-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #E8E8E8;
    cursor: pointer;
    transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
    animation: fadeIn 0.4s ease-out both;
}

.grid-card:nth-child(1) { animation-delay: 0.05s; }
.grid-card:nth-child(2) { animation-delay: 0.1s; }
.grid-card:nth-child(3) { animation-delay: 0.15s; }
.grid-card:nth-child(4) { animation-delay: 0.2s; }
.grid-card:nth-child(5) { animation-delay: 0.25s; }
.grid-card:nth-child(6) { animation-delay: 0.3s; }

.grid-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: #D0D0D0;
    transform: translateY(-2px);
}

.grid-card.featured {
    border-color: #E8634A;
    border-width: 2px;
}

.grid-card-image {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    display: block;
    background: #F5F0EB;
}

.grid-card-placeholder {
    width: 100%;
    aspect-ratio: 3 / 2;
    background: linear-gradient(135deg, #FFF0ED 0%, #FDEAE5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.grid-card-body {
    padding: 14px 16px;
}

.grid-card-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    background: #FFF0ED;
    color: #E8634A;
}

.grid-card-badge.official {
    background: #EAF4F7;
    color: #2A7D8B;
}

.grid-card-badge.featured-badge {
    background: #E8634A;
    color: #fff;
}

.grid-card-name {
    font-family: Georgia, serif;
    font-size: 1rem;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grid-card-tagline {
    font-size: 0.8rem;
    color: #E8634A;
    font-style: italic;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ═══ Modal Overlay ═══ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.25s ease-out;
    overflow-y: auto;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideUp 0.3s ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* No image close button gets dark styling */
.modal-content:not(:has(.modal-image-wrap)) .modal-close {
    background: rgba(0, 0, 0, 0.08);
    color: #333;
}

.modal-content:not(:has(.modal-image-wrap)) .modal-close:hover {
    background: rgba(0, 0, 0, 0.15);
}

/* Modal image */
.modal-image-wrap {
    width: 100%;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
}

.modal-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Scroll hint — sticky overlay at bottom of modal */
.modal-scroll-hint {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    text-align: center;
    padding: 16px 20px 18px;
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.35) 60%, transparent 100%);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    animation: bounceDown 1.5s ease-in-out infinite;
    transition: opacity 0.4s ease;
    pointer-events: none;
    border-radius: 0 0 16px 16px;
}

.scroll-icon {
    display: inline-block;
    font-size: 1.3rem;
    margin-right: 6px;
    vertical-align: middle;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

/* Modal body */
.modal-body {
    padding: 28px 28px 32px;
}

.modal-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    background: #FFF0ED;
    color: #E8634A;
}

.modal-badge.official {
    background: #EAF4F7;
    color: #2A7D8B;
}

.modal-name {
    font-family: Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.3;
    margin-bottom: 6px;
}

.modal-tagline {
    font-size: 1rem;
    color: #E8634A;
    font-weight: 600;
    font-style: italic;
    margin-bottom: 14px;
}

.modal-description {
    font-size: 1rem;
    color: #4A4A4A;
    line-height: 1.7;
    margin-bottom: 20px;
}

/* How to celebrate */
.modal-how-to {
    background: #FDF8F6;
    border: 1px solid #F0E6E0;
    padding: 20px 24px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.modal-how-to h4 {
    font-family: Georgia, serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #1A1A1A;
    margin-bottom: 12px;
}

.modal-how-to ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.modal-how-to li {
    font-size: 0.95rem;
    color: #4A4A4A;
    padding: 4px 0 4px 26px;
    position: relative;
    line-height: 1.5;
}

.modal-how-to li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    top: 4px;
    color: #E8634A;
    font-weight: 700;
    font-size: 1rem;
}

/* History */
.modal-history {
    padding-top: 16px;
    border-top: 1px solid #EDEDED;
    font-size: 0.95rem;
    color: #5A5A5A;
    line-height: 1.7;
    margin-bottom: 20px;
}

/* Hashtags */
.modal-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modal-hashtag {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #E8634A;
    background: #FFF0ED;
    padding: 4px 12px;
    border-radius: 20px;
}

/* ═══ Loading ═══ */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
    grid-column: 1 / -1;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #F0E6E0;
    border-top-color: #E8634A;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: #888;
    font-size: 0.95rem;
}

/* ═══ Empty / Error ═══ */
.no-celebrations,
.error {
    text-align: center;
    padding: 64px 24px;
    background: #FFFFFF;
    border-radius: 12px;
    border: 1px solid #E8E8E8;
    grid-column: 1 / -1;
}

.no-celebrations h2,
.error h2 {
    font-family: Georgia, serif;
    font-size: 1.3rem;
    color: #1A1A1A;
    margin-bottom: 8px;
}

.no-celebrations p,
.error p {
    color: #888;
    font-size: 1rem;
}

.error {
    border-color: #E8634A;
}

.error h2 {
    color: #E8634A;
}

/* ═══ Footer ═══ */
.celebrations-footer {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid #E8E8E8;
    text-align: center;
}

.celebrations-footer p {
    font-size: 0.85rem;
    color: #999;
}

.celebrations-footer a {
    color: #E8634A;
    text-decoration: none;
    font-weight: 600;
}

.celebrations-footer a:hover {
    text-decoration: underline;
}

/* ═══ Responsive ═══ */

/* Small phones — single column */
@media (max-width: 480px) {
    .celebrations-container {
        padding: 16px;
    }

    .header-title-row h1 {
        font-size: 1.35rem;
    }

    .celebrations-content {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .grid-card-body {
        padding: 10px 12px;
    }

    .grid-card-name {
        font-size: 0.9rem;
    }

    .modal-content {
        max-height: 90vh;
        border-radius: 12px;
    }

    .modal-body {
        padding: 20px 18px 24px;
    }

    .modal-name {
        font-size: 1.3rem;
    }

    .modal-overlay {
        padding: 12px;
    }
}

/* Tablets */
@media (min-width: 600px) {
    .celebrations-content {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }

    .modal-how-to ul {
        grid-template-columns: 1fr 1fr;
        gap: 8px 24px;
    }
}

/* Desktop */
@media (min-width: 768px) {
    .celebrations-container {
        padding: 28px 36px;
    }

    .header-title-row h1 {
        font-size: 1.85rem;
    }

    .grid-card-name {
        font-size: 1.05rem;
    }
}

/* Large screens */
@media (min-width: 1024px) {
    .celebrations-content {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .celebrations-container {
        padding: 32px 48px;
    }
}
