/* === Gallery Layout === */
.gallery-main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    min-height: 100vh;
}

.gallery-main::before {
    display: none; /* override landing page ambient glow */
}

.gallery-content {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* === Header === */
.gallery-header {
    text-align: center;
    padding: 32px 0 40px;
}

.gallery-back {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s;
    display: inline-block;
    margin-bottom: 24px;
}

.gallery-back:hover {
    color: var(--text-muted);
}

.gallery-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 8px;
}

.gallery-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dim);
}

/* === Element Selector === */
.element-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.element-btn {
    font-family: 'Cinzel', serif;
    font-size: 0.88rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--bg-subtle);
    color: var(--text-muted);
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        background 0.2s ease,
        transform 0.12s ease;
}

.element-btn:hover {
    border-color: var(--el-color);
    color: var(--text);
    transform: translateY(-1px);
}

.element-btn.active {
    border-color: var(--el-color);
    background: var(--el-color);
    color: #0a0a0a;
}

/* Light and Air need dark text when active */
.element-btn[data-element="light"].active {
    color: #0a0a0a;
}

.element-btn[data-element="air"].active {
    color: #0a0a0a;
}

/* Dark elements need light text when active */
.element-btn[data-element="fire"].active,
.element-btn[data-element="water"].active,
.element-btn[data-element="earth"].active,
.element-btn[data-element="void"].active {
    color: #ffffff;
}

/* === Avatar Stage === */
.avatar-stage {
    min-height: 400px;
    position: relative;
}

.hidden {
    display: none !important;
}

/* === Pure Avatar View === */
.avatar-pure,
.avatar-comparison {
    text-align: center;
}

.avatar-name {
    font-family: 'Cinzel', serif;
    font-size: clamp(2rem, 6vw, 3.2rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1.1;
    margin-bottom: 6px;
    transition: color 0.3s ease;
}

.avatar-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 28px;
}

.avatar-image-wrap {
    max-width: 420px;
    margin: 0 auto 28px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--bg-subtle);
    position: relative;
}

.avatar-image-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.avatar-image {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.avatar-image.loaded {
    opacity: 1;
}

.avatar-description {
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.9rem, 1.8vw, 1rem);
    line-height: 1.8;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto;
    font-style: italic;
}

/* === Comparison Grid === */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 28px;
}

.comparison-card {
    text-align: center;
}

.comparison-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.comparison-image-wrap {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--bg-subtle);
    margin-bottom: 12px;
    position: relative;
}

.comparison-image-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.comparison-image {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.comparison-image.loaded {
    opacity: 1;
}

.comparison-description {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-muted);
    font-style: italic;
    padding: 0 4px;
}

/* === Secondary Section === */
.secondary-section {
    text-align: center;
    margin-bottom: 40px;
}

.secondary-prompt {
    font-family: 'Cinzel', serif;
    font-size: 0.92rem;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 14px;
}

.secondary-selector {
    margin-bottom: 0;
}

.secondary-selector .element-btn {
    font-size: 0.82rem;
    padding: 8px 16px;
}

/* === CTA === */
.gallery-cta {
    text-align: center;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.gallery-cta-btn {
    display: inline-block;
    font-family: 'Cinzel', serif;
    font-size: 0.92rem;
    letter-spacing: 0.06em;
    padding: 14px 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    color: var(--text-muted);
    text-decoration: none;
    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.12s ease;
}

.gallery-cta-btn:hover {
    border-color: rgba(255, 255, 255, 0.24);
    color: var(--text);
    transform: translateY(-1px);
}

/* === Fade-in animation === */
@keyframes galleryFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: galleryFadeIn 0.32s ease forwards;
}

/* === Responsive === */
@media (max-width: 700px) {
    .gallery-content {
        padding: 0 16px 60px;
    }

    .gallery-header {
        padding: 24px 0 32px;
    }

    .element-selector {
        gap: 6px;
    }

    .element-btn {
        font-size: 0.8rem;
        padding: 8px 14px;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }

    .comparison-description {
        font-size: 0.85rem;
    }

    .avatar-image-wrap {
        max-width: 320px;
    }
}

@media (max-width: 400px) {
    .element-selector {
        gap: 4px;
    }

    .element-btn {
        font-size: 0.74rem;
        padding: 7px 10px;
    }
}
