/* ============================================================
   Metalargentum Gallery — frontend CSS
   ============================================================ */

.mag-gallery,
.mag-gallery *,
.mag-gallery *::before,
.mag-gallery *::after { box-sizing: border-box; }

.mag-gallery {
    --mag-radius: 12px;
    --mag-gap: 14px;
    --mag-accent: #ff6b35;
    --mag-transition: cubic-bezier(.22, 1, .36, 1);
    margin: 16px 0;
}

/* ============================================================
   ITEM base
   ============================================================ */
.mag-gallery .mag-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--mag-radius);
    cursor: pointer;
    background: #1a1a1f;
    display: block;
    text-decoration: none;
    transition: transform 0.4s var(--mag-transition), box-shadow 0.4s var(--mag-transition);
}
.mag-gallery .mag-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s var(--mag-transition), filter 0.4s var(--mag-transition);
}

/* ============================================================
   LAYOUT: Masonry
   ============================================================ */
.mag-gallery.mag-layout-masonry {
    column-count: 3;
    column-gap: var(--mag-gap);
}
@media (max-width: 900px) { .mag-gallery.mag-layout-masonry { column-count: 2; } }
@media (max-width: 540px) { .mag-gallery.mag-layout-masonry { column-count: 1; } }
.mag-gallery.mag-layout-masonry .mag-item {
    break-inside: avoid;
    margin-bottom: var(--mag-gap);
}

/* ============================================================
   LAYOUT: Mosaico (Bento)
   ============================================================ */
.mag-gallery.mag-layout-mosaic {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 140px;
    gap: var(--mag-gap);
}
.mag-gallery.mag-layout-mosaic .mag-item:nth-child(7n+1) { grid-column: span 2; grid-row: span 2; }
.mag-gallery.mag-layout-mosaic .mag-item:nth-child(7n+2) { grid-column: span 2; grid-row: span 1; }
.mag-gallery.mag-layout-mosaic .mag-item:nth-child(7n+3) { grid-column: span 1; grid-row: span 1; }
.mag-gallery.mag-layout-mosaic .mag-item:nth-child(7n+4) { grid-column: span 1; grid-row: span 2; }
.mag-gallery.mag-layout-mosaic .mag-item:nth-child(7n+5) { grid-column: span 2; grid-row: span 1; }
.mag-gallery.mag-layout-mosaic .mag-item:nth-child(7n+6) { grid-column: span 1; grid-row: span 1; }
.mag-gallery.mag-layout-mosaic .mag-item:nth-child(7n+7) { grid-column: span 2; grid-row: span 2; }
@media (max-width: 720px) {
    .mag-gallery.mag-layout-mosaic { grid-template-columns: repeat(2, 1fr); }
    .mag-gallery.mag-layout-mosaic .mag-item:nth-child(n) { grid-column: span 1; grid-row: span 1; }
    .mag-gallery.mag-layout-mosaic .mag-item:nth-child(3n+1) { grid-column: span 2; grid-row: span 2; }
}

/* ============================================================
   LAYOUT: Justified rows
   ============================================================ */
.mag-gallery.mag-layout-justified {
    display: flex;
    flex-wrap: wrap;
    gap: var(--mag-gap);
}
.mag-gallery.mag-layout-justified .mag-item {
    flex-grow: 1;
    height: 240px;
    flex-basis: 240px;
}
.mag-gallery.mag-layout-justified .mag-item[data-aspect="0.5"],
.mag-gallery.mag-layout-justified .mag-item[data-aspect="0.6"],
.mag-gallery.mag-layout-justified .mag-item[data-aspect="0.66"],
.mag-gallery.mag-layout-justified .mag-item[data-aspect="0.7"],
.mag-gallery.mag-layout-justified .mag-item[data-aspect="0.75"] { flex-basis: 180px; }
.mag-gallery.mag-layout-justified .mag-item[data-aspect="1"],
.mag-gallery.mag-layout-justified .mag-item[data-aspect="1.0"] { flex-basis: 240px; }
.mag-gallery.mag-layout-justified .mag-item[data-aspect="1.33"],
.mag-gallery.mag-layout-justified .mag-item[data-aspect="1.3"] { flex-basis: 320px; }
.mag-gallery.mag-layout-justified .mag-item[data-aspect="1.5"] { flex-basis: 360px; }
.mag-gallery.mag-layout-justified .mag-item[data-aspect="1.78"],
.mag-gallery.mag-layout-justified .mag-item[data-aspect="1.77"] { flex-basis: 426px; }
.mag-gallery.mag-layout-justified .mag-item[data-aspect="2"],
.mag-gallery.mag-layout-justified .mag-item[data-aspect="2.0"] { flex-basis: 480px; }

/* ============================================================
   LAYOUT: Hexagonal
   ============================================================ */
.mag-gallery.mag-layout-hex {
    --hex-w: 200px;
    --hex-h: 230px;
    --hex-margin: 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 30px;
    margin-bottom: -60px;
}
.mag-gallery.mag-layout-hex .mag-item {
    width: var(--hex-w);
    height: var(--hex-h);
    margin: var(--hex-margin) calc(var(--hex-margin) + 4px);
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    border-radius: 0;
    transition: transform 0.4s var(--mag-transition);
}
.mag-gallery.mag-layout-hex .mag-item:nth-child(7n+5),
.mag-gallery.mag-layout-hex .mag-item:nth-child(7n+6),
.mag-gallery.mag-layout-hex .mag-item:nth-child(7n+7) { margin-top: -52px; }
.mag-gallery.mag-layout-hex .mag-item img { border-radius: 0; }
.mag-gallery.mag-layout-hex .mag-item:hover { transform: scale(1.06); z-index: 2; }
@media (max-width: 720px) {
    .mag-gallery.mag-layout-hex { --hex-w: 130px; --hex-h: 150px; }
    .mag-gallery.mag-layout-hex .mag-item:nth-child(7n+5),
    .mag-gallery.mag-layout-hex .mag-item:nth-child(7n+6),
    .mag-gallery.mag-layout-hex .mag-item:nth-child(7n+7) { margin-top: -34px; }
}

/* ============================================================
   LAYOUT: Slider
   ============================================================ */
.mag-gallery.mag-layout-slider .mag-slider {
    position: relative;
    border-radius: var(--mag-radius);
    overflow: hidden;
    background: #1a1a1f;
}
.mag-gallery.mag-layout-slider .mag-slider-track {
    position: relative;
    aspect-ratio: 16 / 9;
    width: 100%;
    background: #000;
}
@media (max-width: 540px) {
    .mag-gallery.mag-layout-slider .mag-slider-track { aspect-ratio: 4 / 3; }
}
.mag-gallery.mag-layout-slider .mag-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.7s var(--mag-transition);
    cursor: zoom-in;
}
.mag-gallery.mag-layout-slider .mag-slide.is-active { opacity: 1; z-index: 1; }
.mag-gallery.mag-layout-slider .mag-slide img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.mag-gallery.mag-layout-slider .mag-slide-cap {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 32px 28px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 10%, rgba(0,0,0,0));
    color: white;
}
.mag-gallery.mag-layout-slider .mag-slide-cap h3 {
    margin: 0 0 4px;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
}
.mag-gallery.mag-layout-slider .mag-slide-cap p {
    margin: 0;
    color: rgba(255,255,255,0.75);
    font-size: 0.9rem;
}
.mag-gallery.mag-layout-slider .mag-slider-nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 3;
    line-height: 1;
}
.mag-gallery.mag-layout-slider .mag-slider-nav:hover { background: rgba(0,0,0,0.75); }
.mag-gallery.mag-layout-slider .mag-slider-prev { left: 16px; }
.mag-gallery.mag-layout-slider .mag-slider-next { right: 16px; }
.mag-gallery.mag-layout-slider .mag-slider-dots {
    position: absolute;
    left: 0; right: 0; bottom: 18px;
    display: flex;
    gap: 8px;
    justify-content: center;
    z-index: 3;
}
.mag-gallery.mag-layout-slider .mag-slider-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, width 0.3s;
}
.mag-gallery.mag-layout-slider .mag-slider-dot.is-active {
    background: white;
    width: 28px;
    border-radius: 999px;
}
.mag-gallery.mag-layout-slider .mag-slider-progress {
    position: absolute;
    top: 0; left: 0;
    height: 3px;
    background: var(--mag-accent);
    width: 0;
    z-index: 4;
    transition: width linear;
}
.mag-gallery.mag-layout-slider .mag-slider-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    overflow-x: auto;
    padding-bottom: 6px;
}
.mag-gallery.mag-layout-slider .mag-slider-thumb {
    width: 90px; height: 60px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.25s, transform 0.25s;
    border: 2px solid transparent;
}
.mag-gallery.mag-layout-slider .mag-slider-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.mag-gallery.mag-layout-slider .mag-slider-thumb:hover { opacity: 0.85; }
.mag-gallery.mag-layout-slider .mag-slider-thumb.is-active {
    opacity: 1;
    border-color: var(--mag-accent);
    transform: translateY(-2px);
}

/* ============================================================
   EFECTOS HOVER
   ============================================================ */

/* default */
.mag-gallery.fx-none .mag-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px -12px rgba(0,0,0,0.55);
}
.mag-gallery.fx-none .mag-item:hover img { transform: scale(1.06); }

/* SEEMO */
.mag-gallery.fx-seemo .mag-item .mag-fx-cap {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 18px 16px 14px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 30%, transparent);
    color: white;
    transform: translateY(100%);
    transition: transform 0.45s var(--mag-transition);
}
.mag-gallery.fx-seemo .mag-item:hover .mag-fx-cap { transform: translateY(0); }
.mag-gallery.fx-seemo .mag-item:hover img { transform: scale(1.04); }

/* LENS */
.mag-gallery.fx-lens .mag-item .mag-fx-cap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.mag-gallery.fx-lens .mag-item .mag-fx-cap::before {
    content: "+";
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    color: #111;
    font-size: 32px;
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: transform 0.4s var(--mag-transition);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.mag-gallery.fx-lens .mag-item:hover img { filter: brightness(0.65); transform: scale(1.04); }
.mag-gallery.fx-lens .mag-item:hover .mag-fx-cap::before { transform: scale(1); }

/* OSCAR */
.mag-gallery.fx-oscar .mag-item .mag-fx-cap {
    position: absolute;
    inset: 0;
    background: rgba(20,20,30,0.7);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.4s var(--mag-transition);
}
.mag-gallery.fx-oscar .mag-item .mag-fx-cap::after {
    content: "";
    width: 0;
    height: 2px;
    background: var(--mag-accent);
    margin-top: 12px;
    transition: width 0.5s var(--mag-transition) 0.1s;
}
.mag-gallery.fx-oscar .mag-item:hover .mag-fx-cap { opacity: 1; }
.mag-gallery.fx-oscar .mag-item:hover .mag-fx-cap::after { width: 60px; }

/* LAYLA */
.mag-gallery.fx-layla .mag-item .mag-fx-cap {
    position: absolute;
    inset: 18px;
    border: 1px solid rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    padding: 14px;
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.45s var(--mag-transition), opacity 0.45s var(--mag-transition);
}
.mag-gallery.fx-layla .mag-item:hover img { transform: scale(1.08); filter: brightness(0.7); }
.mag-gallery.fx-layla .mag-item:hover .mag-fx-cap { transform: scale(1); opacity: 1; }

/* SADIE */
.mag-gallery.fx-sadie .mag-item .mag-fx-cap {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,107,53,0.85), rgba(255,107,53,0.55));
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.4s var(--mag-transition);
}
.mag-gallery.fx-sadie .mag-item .mag-fx-cap > * {
    transform: translateY(14px);
    transition: transform 0.5s var(--mag-transition);
}
.mag-gallery.fx-sadie .mag-item:hover .mag-fx-cap { opacity: 1; }
.mag-gallery.fx-sadie .mag-item:hover .mag-fx-cap > * { transform: translateY(0); }

/* APOLLO */
.mag-gallery.fx-apollo .mag-item img { filter: grayscale(100%) contrast(1.05); }
.mag-gallery.fx-apollo .mag-item:hover img { filter: grayscale(0%); transform: scale(1.05); }
.mag-gallery.fx-apollo .mag-item .mag-fx-cap {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 14px 16px;
    background: rgba(0,0,0,0.6);
    color: white;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.35s var(--mag-transition), transform 0.45s var(--mag-transition);
}
.mag-gallery.fx-apollo .mag-item:hover .mag-fx-cap { opacity: 1; transform: translateY(0); }

/* MILO */
.mag-gallery.fx-milo .mag-item img { transition: transform 0.5s var(--mag-transition), filter 0.5s; }
.mag-gallery.fx-milo .mag-item:hover img { transform: scale(1.1) translateX(-12px) rotate(-2deg); }
.mag-gallery.fx-milo .mag-item .mag-fx-cap {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 50%;
    background: rgba(20,20,25,0.92);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 18px 22px;
    transform: translateX(100%);
    transition: transform 0.5s var(--mag-transition);
}
.mag-gallery.fx-milo .mag-item:hover .mag-fx-cap { transform: translateX(0); }
.mag-gallery.fx-milo .mag-item:hover { box-shadow: 0 18px 40px -12px rgba(0,0,0,0.6); }

/* ZOE */
.mag-gallery.fx-zoe .mag-item .mag-fx-cap {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.95);
    color: #111;
    padding: 14px 16px;
    transform: translateY(100%);
    transition: transform 0.4s var(--mag-transition);
}
.mag-gallery.fx-zoe .mag-item .mag-fx-cap h4 {
    margin: 0 0 2px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #111;
}
.mag-gallery.fx-zoe .mag-item .mag-fx-cap p {
    margin: 0; font-size: 0.8rem; color: #555;
}
.mag-gallery.fx-zoe .mag-item:hover .mag-fx-cap { transform: translateY(0); }
.mag-gallery.fx-zoe .mag-item:hover img { transform: scale(1.04); }

/* caption text shared */
.mag-gallery .mag-fx-cap h4 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
}
.mag-gallery .mag-fx-cap p {
    margin: 0;
    font-size: 0.82rem;
    opacity: 0.85;
    color: white;
}

/* ============================================================
   LIGHTBOX (global, único en la página)
   ============================================================ */
.mag-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(8, 8, 10, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s var(--mag-transition);
    --mag-transition: cubic-bezier(.22, 1, .36, 1);
    --mag-accent: #ff6b35;
}
.mag-lightbox.is-open { opacity: 1; pointer-events: auto; }
.mag-lb-stage {
    position: relative;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 80px;
    overflow: hidden;
}
@media (max-width: 720px) { .mag-lb-stage { padding: 60px 12px; } }
.mag-lb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 30px 90px rgba(0,0,0,0.5);
    cursor: zoom-in;
    transition: transform 0.4s var(--mag-transition), opacity 0.25s ease;
    user-select: none;
    -webkit-user-drag: none;
}
.mag-lb-img.is-zoomed { cursor: zoom-out; transform: scale(2); }
.mag-lb-img.is-loading { opacity: 0.3; }
.mag-lb-controls {
    position: absolute; top: 16px; right: 16px;
    display: flex; gap: 8px; z-index: 5;
}
.mag-lb-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: white;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    line-height: 1;
}
.mag-lb-btn:hover { background: rgba(255,255,255,0.18); transform: scale(1.05); }
.mag-lb-btn:active { transform: scale(0.95); }
.mag-lb-nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 5;
    line-height: 1;
}
.mag-lb-nav:hover { background: rgba(255,255,255,0.18); }
.mag-lb-prev { left: 20px; }
.mag-lb-next { right: 20px; }
.mag-lb-info {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 24px 32px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    text-align: center;
    pointer-events: none;
    color: white;
}
.mag-lb-title {
    margin: 0 0 4px;
    font-weight: 600;
    font-size: 1.05rem;
    color: white;
}
.mag-lb-counter {
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    margin: 0;
}
.mag-lb-spinner {
    position: absolute;
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: mag-spin 0.8s linear infinite;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.mag-lb-spinner.is-visible { opacity: 1; }
@keyframes mag-spin { to { transform: rotate(360deg); } }
body.mag-lb-open { overflow: hidden; }
