/* ============================================
   SMARKET FULL-STACK GALLERY SPECIFIC STYLES
   (Shares design tokens from style.css)
   ============================================ */

.gallery-page {
    background: var(--bg-primary);
    min-height: 100dvh;
}

.gallery-section {
    padding: 120px var(--container-padding) var(--section-padding);
    max-width: var(--container-max);
    margin: 0 auto;
}

/* Optional intro line under the heading */
.gallery-intro {
    max-width: 680px;
    margin: 1.5rem auto 0;
    text-align: center;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.7;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
    margin-top: 3rem;
}

.gallery-card {
    background: var(--glass-bg);
    border: var(--pixel-border);
    border-radius: 0;
    overflow: hidden;
    transition: all var(--transition-normal);
    position: relative;
    animation: float 4s ease-in-out infinite;
    animation-delay: calc(var(--delay, 0) * 1s);
    box-shadow: inset -4px -4px 0px rgba(0, 0, 0, 0.3), var(--pixel-shadow);
}

.gallery-card:hover {
    transform: translate(-4px, -4px);
    border-color: var(--accent-pink);
    box-shadow: 10px 10px 0px rgba(0, 0, 0, 0.8);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 220px;
    /* Fixed height for consistent grid row alignment */
    overflow: hidden;
    cursor: pointer;
}

.card-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Fills container while maintaining aspect ratio */
    object-position: top center;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.card-inner:hover img {
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    opacity: 0;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
    color: var(--text-primary);
}

.card-inner:hover .card-overlay,
.card-inner:focus-visible .card-overlay {
    opacity: 1;
}

.card-inner:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

.card-overlay i {
    font-size: 2rem;
    color: var(--accent-cyan);
}

.card-info {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.card-info h4 {
    font-family: var(--font-display);
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 5vw, 4rem);
}

.lightbox.active {
    display: flex;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 25, 0.95);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
}

.lightbox-controls {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    gap: 1rem;
    z-index: 2010;
}

.nav-side-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2011;
    box-shadow: 0 0 20px rgba(124, 240, 255, 0.1);
}

#lightbox-prev-btn {
    left: 2rem;
}

#lightbox-next-btn {
    right: 2rem;
}

.ctrl-btn {
    width: 50px;
    height: 50px;
    border-radius: 0;
    background: var(--glass-bg);
    border: var(--pixel-border);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    box-shadow: inset -4px -4px 0px rgba(0, 0, 0, 0.3), var(--pixel-shadow);
}

.ctrl-btn:hover {
    background: var(--accent-cyan);
    color: var(--bg-primary);
    transform: translate(-2px, -2px);
    box-shadow: inset -4px -4px 0px rgba(0, 0, 0, 0.3), 8px 8px 0px rgba(0, 0, 0, 0.8);
}

.close-btn:hover {
    background: var(--accent-pink);
}

/* Mobile & Tablet Optimizations */

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.image-wrapper {
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#lightbox-img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease-out;
    filter: drop-shadow(0 0 30px rgba(0, 0, 0, 0.5));
}

.lightbox-caption {
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(0, 0, 0, 1);
}

/* Multi-image Badge */
.image-count-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(15, 23, 42, 0.8);
    color: var(--accent-cyan);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--glass-border);
    z-index: 5;
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px) scale(1.1);
    background: rgba(124, 240, 255, 0.1);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(124, 240, 255, 0.3);
}

.progress-ring {
    position: absolute;
    top: -1px;
    left: -1px;
    pointer-events: none;
    transform: rotate(-90deg);
}

.progress-ring__circle {
    stroke: var(--accent-cyan);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
    stroke-dasharray: 144.5;
    /* 2 * PI * r (23) */
    stroke-dashoffset: 144.5;
    filter: drop-shadow(0 0 5px var(--accent-cyan));
}