/* ============================================================
   Marathon Gallery — Public Styles
   Font: Montserrat | Primary: #953056
   ============================================================ */

:root {
    --mg-primary:      #953056;
    --mg-primary-dark: #7a2445;
    --mg-primary-light:#bf4070;
    --mg-primary-bg:   #fdf2f6;
    --mg-text:         #1e1e1e;
    --mg-text-muted:   #6b7280;
    --mg-bg:           #f8f9fa;
    --mg-card-bg:      #ffffff;
    --mg-border:       #e5e7eb;
    --mg-radius:       12px;
    --mg-radius-sm:    8px;
    --mg-shadow:       0 2px 16px rgba(0,0,0,0.08);
    --mg-shadow-lg:    0 12px 40px rgba(0,0,0,0.15);
    --mg-transition:   all 0.25s ease;
    --font-main:       'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
}

.mg-gallery-wrap,
.mg-album-wrap {
    font-family: var(--font-main);
    color: var(--mg-text);
    line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════════
   ALBUMS GRID (page principale galerie)
═══════════════════════════════════════════════════════════════ */

.mg-albums-grid {
    display: grid;
    gap: 24px;
}

.mg-albums-grid.mg-columns-2 { grid-template-columns: repeat(2, 1fr); }
.mg-albums-grid.mg-columns-3 { grid-template-columns: repeat(3, 1fr); }
.mg-albums-grid.mg-columns-4 { grid-template-columns: repeat(4, 1fr); }
.mg-albums-grid.mg-columns-5 { grid-template-columns: repeat(5, 1fr); }

/* ── Album Folder Card ─────────────────────────────────────── */
.mg-album-folder {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--mg-text);
    background: var(--mg-card-bg);
    border-radius: var(--mg-radius);
    overflow: hidden;
    box-shadow: var(--mg-shadow);
    transition: var(--mg-transition);
    border: 1px solid var(--mg-border);
}

.mg-album-folder:hover {
    transform: translateY(-5px);
    box-shadow: var(--mg-shadow-lg);
    border-color: var(--mg-primary);
    text-decoration: none;
    color: var(--mg-text);
}

.mg-album-folder__cover {
    position: relative;
    padding-top: 65%;
    background: var(--mg-bg);
    overflow: hidden;
}

.mg-album-folder__cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.mg-album-folder:hover .mg-album-folder__cover img {
    transform: scale(1.06);
}

.mg-album-folder__badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-main);
    backdrop-filter: blur(4px);
    letter-spacing: 0.3px;
}

.mg-album-folder__meta {
    padding: 16px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mg-album-folder__title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    color: var(--mg-text);
    transition: var(--mg-transition);
    line-height: 1.3;
}

.mg-album-folder:hover .mg-album-folder__title {
    color: var(--mg-primary);
}

.mg-album-folder__desc {
    font-size: 13px;
    color: var(--mg-text-muted);
    margin: 0;
    line-height: 1.5;
}

.mg-album-folder__count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--mg-primary);
    margin-top: auto;
}

.mg-no-albums {
    text-align: center;
    padding: 60px 24px;
    color: var(--mg-text-muted);
    font-size: 16px;
}

/* ══════════════════════════════════════════════════════════════
   ALBUM SINGLE PAGE
═══════════════════════════════════════════════════════════════ */

/* ── Breadcrumb ────────────────────────────────────────────── */
.mg-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-family: var(--font-main);
    margin-bottom: 20px;
    color: var(--mg-text-muted);
}

.mg-breadcrumb a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--mg-primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--mg-transition);
}
.mg-breadcrumb a:hover {
    text-decoration: underline;
}

/* ── Album Hero ────────────────────────────────────────────── */
.mg-album-hero {
    position: relative;
    border-radius: var(--mg-radius);
    overflow: hidden;
    margin-bottom: 28px;
    min-height: 280px;
    display: flex;
    align-items: flex-end;
    background-image: var(--cover);
    background-size: cover;
    background-position: center;
}

.mg-album-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 60%, transparent 100%);
}

.mg-album-hero__content {
    position: relative;
    z-index: 2;
    padding: 28px 32px;
    color: #fff;
}

.mg-album-hero__content h1 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 8px;
    color: #fff;
    line-height: 1.2;
    font-family: var(--font-main);
}

.mg-album-hero__content p {
    font-size: 15px;
    opacity: 0.85;
    margin: 0 0 14px;
}

.mg-album-hero__meta {
    display: flex;
    gap: 16px;
}

.mg-album-hero__meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(6px);
    border-radius: 20px;
    padding: 4px 14px;
}

.mg-album-title-bar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.mg-album-title-bar h1 {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: var(--font-main);
    margin: 0;
    color: var(--mg-text);
}

.mg-photo-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--mg-text-muted);
    flex-shrink: 0;
}

/* ── Toolbar ───────────────────────────────────────────────── */
.mg-album-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 14px 18px;
    background: var(--mg-card-bg);
    border-radius: var(--mg-radius-sm);
    border: 1px solid var(--mg-border);
    flex-wrap: wrap;
    gap: 12px;
}

.mg-photo-counter {
    font-size: 14px;
    font-weight: 600;
    color: var(--mg-text-muted);
}

.mg-btn--download-zip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: var(--mg-primary);
    color: #fff;
    border: none;
    border-radius: var(--mg-radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: var(--mg-transition);
    text-decoration: none;
}

.mg-btn--download-zip:hover {
    background: var(--mg-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(149,48,86,0.3);
    color: #fff;
}

.mg-btn--download-zip.mg-loading svg {
    animation: mg-spin 0.8s linear infinite;
}

/* ── Photos Grid ───────────────────────────────────────────── */
.mg-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.mg-photo-item {
    cursor: pointer;
    border-radius: var(--mg-radius-sm);
    overflow: hidden;
    box-shadow: var(--mg-shadow);
    transition: var(--mg-transition);
}

.mg-photo-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--mg-shadow-lg);
}

.mg-photo-item__inner {
    position: relative;
    padding-top: 75%;
    background: var(--mg-bg);
    overflow: hidden;
}

.mg-photo-item__inner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.mg-photo-item:hover .mg-photo-item__inner img {
    transform: scale(1.05);
}

.mg-photo-item__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.55) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 10px;
    opacity: 0;
    transition: var(--mg-transition);
}

.mg-photo-item:hover .mg-photo-item__overlay {
    opacity: 1;
}

.mg-photo-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--mg-primary);
    border-radius: 8px;
    text-decoration: none;
    transition: var(--mg-transition);
    border: 2px solid rgba(255,255,255,0.25);
}

.mg-photo-download-btn:hover {
    background: #fff;
    transform: scale(1.1);
}

.mg-photo-download-btn:hover svg path {
    stroke: var(--mg-primary);
}

/* ── Album Empty ───────────────────────────────────────────── */
.mg-album-empty {
    text-align: center;
    padding: 80px 24px;
    background: var(--mg-bg);
    border-radius: var(--mg-radius);
    border: 2px dashed var(--mg-border);
    color: var(--mg-text-muted);
    font-size: 15px;
}
.mg-album-empty svg { margin-bottom: 16px; }

/* ══════════════════════════════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════════════════════════════ */

.mg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s;
    font-family: var(--font-main);
}

.mg-lightbox.is-open {
    visibility: visible;
    opacity: 1;
}

.mg-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    cursor: pointer;
}

.mg-lightbox__container {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ── Lightbox buttons ──────────────────────────────────────── */
.mg-lb-btn {
    position: absolute;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--mg-transition);
    backdrop-filter: blur(8px);
    color: #fff;
}

.mg-lb-btn:hover {
    background: var(--mg-primary);
    border-color: var(--mg-primary);
    transform: scale(1.1);
}

.mg-lb-close {
    top: 20px;
    right: 20px;
}

.mg-lb-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}
.mg-lb-prev:hover { transform: translateY(-50%) scale(1.1); }

.mg-lb-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}
.mg-lb-next:hover { transform: translateY(-50%) scale(1.1); }

/* ── Image wrap ────────────────────────────────────────────── */
.mg-lb-image-wrap {
    position: relative;
    max-width: calc(100vw - 160px);
    max-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mg-lb-img {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 80px rgba(0,0,0,0.6);
    transition: opacity 0.2s ease;
    display: block;
}

.mg-lb-img.mg-loading-img { opacity: 0; }

.mg-lb-loader {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
}

.mg-lb-loader.is-loading { display: flex; }

.mg-lb-loader svg {
    animation: mg-spin 0.8s linear infinite;
}

/* ── Lightbox footer ───────────────────────────────────────── */
.mg-lb-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 18px 70px;
    background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mg-lb-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mg-lb-title {
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    font-weight: 600;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mg-lb-counter {
    color: rgba(255,255,255,0.55);
    font-size: 13px;
    font-weight: 500;
}

.mg-lb-download {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--mg-primary);
    color: #fff;
    border-radius: var(--mg-radius-sm);
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--mg-transition);
    font-family: var(--font-main);
}

.mg-lb-download:hover {
    background: var(--mg-primary-dark);
    transform: translateY(-1px);
    color: #fff;
}

/* ── Swipe indicator ───────────────────────────────────────── */
@media (hover: none) {
    .mg-lb-prev, .mg-lb-next {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATION
═══════════════════════════════════════════════════════════════ */

.mg-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e1e1e;
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-main);
    z-index: 9999999;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: var(--mg-shadow-lg);
    pointer-events: none;
}

.mg-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.mg-toast--success { background: #065f46; }
.mg-toast--error   { background: #991b1b; }
.mg-toast--info    { background: var(--mg-primary); }

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════════════════════ */

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

@keyframes mg-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mg-photo-item {
    animation: mg-fade-in 0.4s ease both;
}

.mg-photo-item:nth-child(1)  { animation-delay: 0.02s }
.mg-photo-item:nth-child(2)  { animation-delay: 0.04s }
.mg-photo-item:nth-child(3)  { animation-delay: 0.06s }
.mg-photo-item:nth-child(4)  { animation-delay: 0.08s }
.mg-photo-item:nth-child(5)  { animation-delay: 0.10s }
.mg-photo-item:nth-child(6)  { animation-delay: 0.12s }
.mg-photo-item:nth-child(7)  { animation-delay: 0.14s }
.mg-photo-item:nth-child(8)  { animation-delay: 0.16s }
.mg-photo-item:nth-child(n+9){ animation-delay: 0.18s }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .mg-albums-grid.mg-columns-4,
    .mg-albums-grid.mg-columns-5 {
        grid-template-columns: repeat(3, 1fr);
    }
    .mg-photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .mg-albums-grid.mg-columns-3,
    .mg-albums-grid.mg-columns-4,
    .mg-albums-grid.mg-columns-5 {
        grid-template-columns: repeat(2, 1fr);
    }
    .mg-album-hero {
        min-height: 200px;
    }
    .mg-album-hero__content h1 {
        font-size: 1.5rem;
    }
    .mg-lb-footer {
        padding: 14px 20px;
    }
    .mg-lb-title { display: none; }
    .mg-lb-image-wrap {
        max-width: 100vw;
        max-height: calc(100vh - 100px);
    }
    .mg-photos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .mg-album-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .mg-albums-grid.mg-columns-2,
    .mg-albums-grid.mg-columns-3,
    .mg-albums-grid.mg-columns-4,
    .mg-albums-grid.mg-columns-5 {
        grid-template-columns: 1fr;
    }
    .mg-lb-btn {
        width: 38px;
        height: 38px;
    }
    .mg-lb-prev { left: 8px; }
    .mg-lb-next { right: 8px; }
}
