/* ===== Responsive Design ===== */

/* Tablet (768px - 1024px) */
@media (width <= 1024px) {
    .card-detail-content {
        grid-template-columns: 1fr;
    }

    .card-image-section {
        position: relative;
    }
}

/* Mobile (320px - 767px) */
@media (width <= 767px) {
    :root {
        --text-base: 1.125rem;  /* 18px - larger for mobile readability */
        --text-3xl: 1.5rem;
        --text-2xl: 1.25rem;
    }

    .entry-gate {
        width: 100%;
        max-width: 100%;
        padding: var(--space-6);
    }

    .modal-header h2 {
        font-size: var(--text-2xl);
    }

    .subtitle {
        font-size: var(--text-base);
    }

    .header-logo h1 {
        font-size: var(--text-xl);
    }

    .controls-container {
        gap: var(--space-3);
    }

    .month-filters {
        gap: var(--space-2);
    }

    .filter-pill {
        font-size: var(--text-xs);
        padding: 8px 14px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .search-bar input {
        height: 44px;
        font-size: 1rem;
    }

    .card-grid-section {
        padding: var(--space-4) 0;
    }

    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
        padding: 0 var(--space-2);
    }

    .card-detail {
        width: 100%;
        padding: var(--space-4);
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .card-detail-content {
        gap: var(--space-4);
        grid-template-columns: 1fr; /* Stack vertically on mobile */
    }

    /* Mobile carousel adjustments */
    .carousel-arrow {
        width: 36px;
        height: 36px;
    }

    .carousel-arrow svg {
        width: 22px;
        height: 22px;
    }

    .carousel-arrow--prev {
        left: var(--space-2);
    }

    .carousel-arrow--next {
        right: var(--space-2);
    }

    /* Adjust thumbnail icon row on mobile */
    .thumbnail-grid {
        gap: 4px;
        padding: var(--space-2) 0;
    }

    .thumbnail-item {
        max-width: 64px; /* Smaller icons on mobile to fit 9 in a row */
    }

    /* Download button fixed to viewport bottom on mobile */
    .card-download-section {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--color-cream);
        padding: var(--space-4);
        margin: 0;
        box-shadow: 0 -4px 6px -1px rgb(0 0 0 / 10%);
        z-index: var(--z-modal); /* Above modal content */
    }

    /* Add padding to modal content to prevent text showing below sticky button */
    .modal-content {
        padding-bottom: calc(var(--space-4) * 4); /* Extra space for sticky button */
    }

    /* Make close button more visible on mobile and keep it fixed while scrolling */
    .modal-close {
        position: fixed;
        width: 48px;
        height: 48px;
        background: rgb(255 255 255 / 95%);
        border: 2px solid rgb(0 0 0 / 30%);
        box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
        top: var(--space-3);
        right: var(--space-3);
        z-index: var(--z-modal-above);
    }

    .modal-close:hover {
        background: rgb(255 255 255 / 100%);
    }

    .card-text-section h2 {
        font-size: var(--text-2xl);
    }

    .toast {
        left: var(--space-4);
        right: var(--space-4);
        bottom: var(--space-4);
    }
}

/* Small Mobile (< 400px) */
@media (width <= 400px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-2);
    }

    .card {
        border-radius: var(--radius-md);
    }

    .card-content {
        padding: var(--space-2);
    }

    .card-title {
        font-size: 0.8125rem;
        line-height: 1.3;
    }

    .card-event {
        font-size: 0.6875rem;
    }

    .card-meta {
        gap: var(--space-1);
        flex-wrap: wrap;
    }

    .theme-badge,
    .status-badge {
        font-size: 0.625rem;
        padding: 2px 6px;
    }

    .controls-section {
        padding: var(--space-4) var(--space-3);
    }

    .month-filters {
        gap: var(--space-1);
    }

    .filter-pill {
        font-size: 0.6875rem;
        padding: 6px 10px;
        min-height: 36px;
    }
}
