/* Class Intro Screen - Screen Architecture Fit */
#screen-class-intro {
    /* Base Screen Position & Layering */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 100;

    /* Default visibility state (hidden/inactive) */
    display: none;
    opacity: 0;
    pointer-events: none;

    /* Center content */
    justify-content: center;
    align-items: center;
    overflow: hidden;

    /* Transition for smooth appearance */
    transition: opacity 0.5s ease-in-out;
}

/* Visibility Logic: Not hidden = Active/Visible */
#screen-class-intro:not(.hidden) {
    display: flex;
    opacity: 1;
    /* Make it visible! */
    pointer-events: auto;
    /* Enable clicks */
}

/* Video & Art Container */
.intro-content {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:
        radial-gradient(ellipse at center 72%, rgba(255, 184, 77, 0.13), transparent 38%),
        linear-gradient(180deg, #080b12 0%, #020305 100%);
}

/* Video Element */
#class-intro-video {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Fix: Fit to screen without cropping */
    z-index: 10;
    display: none;
    /* Controlled by JS via inline style */
}

/* Art Element (Fallback/Post-Video) */
#class-intro-art {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    z-index: 20;
    display: none;
    /* Controlled by JS via inline style */
    transform-origin: center bottom;
    transition: opacity 280ms ease-out, transform 360ms ease-out, filter 360ms ease-out;
    filter: drop-shadow(0 24px 28px rgba(0, 0, 0, 0.72));
}

#class-intro-art[data-phase="before"] {
    animation: class-art-before 700ms ease-out both;
}

#class-intro-art[data-phase="after"] {
    animation: class-art-after 580ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes class-art-before {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes class-art-after {
    from {
        opacity: .3;
        transform: translateY(8px) scale(.98);
        filter: brightness(1.7) drop-shadow(0 24px 42px rgba(255, 205, 86, .42));
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: brightness(1) drop-shadow(0 24px 28px rgba(0, 0, 0, .72));
    }
}

/* Overlay UI */
#class-intro-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    /* Boosted z-index */
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

/* Darkened Zones */
.left-panel,
.right-panel {
    width: clamp(300px, 34vw, 470px);
    height: 100%;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 80%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(32px, 4vw, 64px);
    box-sizing: border-box;
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 520ms ease-out, transform 520ms cubic-bezier(.2, .8, .2, 1);
    pointer-events: auto;
}

.right-panel {
    background: linear-gradient(-90deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 80%, transparent 100%);
    align-items: flex-end;
    transform: translateX(50px);
    text-align: right;
}

/* Active State for Panels (controlled by JS adding .visible) */
.left-panel.visible,
.right-panel.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Typography */
#intro-class-name {
    font-family: 'Cinzel', serif;
    font-size: clamp(2.5rem, 5vw, 5rem);
    color: var(--gold, #ffd700);
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    margin: 0 0 24px;
    line-height: 1.02;
    overflow-wrap: anywhere;
}

#intro-class-desc {
    font-size: 1.4rem;
    color: #eee;
    line-height: 1.6;
    max-width: 90%;
    border-left: 4px solid var(--accent, #ff9800);
    padding-left: 20px;
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 0 10px 10px 0;
    margin: 0;
    box-sizing: border-box;
}

/* Skills Grid */
#intro-skills-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    width: min(100%, 420px);
    margin: 0;
}

.intro-skill-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-height: 92px;
    padding: 12px;
    box-sizing: border-box;
    background: rgba(8, 11, 18, .72);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    text-align: right;
}

.intro-skill-icon {
    width: 64px;
    height: 64px;
    box-sizing: border-box;
    border: 2px solid #777;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
    object-fit: cover;
    grid-column: 2;
    grid-row: 1;
}

.skill-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
}

.intro-skill-name {
    width: 100%;
    min-height: 1.35em;
    font-weight: 700;
    line-height: 1.35;
}

.intro-skill-desc {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #b9beca;
    width: 100%;
    min-height: 2.8em;
}

/* Flash Animation Class */
#intro-flash {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: #fff;
    opacity: 0;
    pointer-events: none;
}

.flash-active {
    animation: flash-anim 720ms ease-out forwards;
}

@keyframes flash-anim {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* Close Button */
#btn-close-intro {
    margin-top: auto;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    padding: 15px 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 3px;
    pointer-events: auto;
    min-height: 48px;
    width: min(100%, 420px);
    box-sizing: border-box;
}

#btn-close-intro:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

#btn-close-intro:focus-visible {
    outline: 3px solid var(--gold, #ffd700);
    outline-offset: 4px;
}

@media (max-width: 900px) {
    .left-panel,
    .right-panel {
        width: min(42vw, 390px);
        padding: 28px 24px;
    }

    #intro-class-desc {
        max-width: 100%;
        font-size: 1rem;
    }

    .intro-skill-item {
        grid-template-columns: minmax(0, 1fr) 56px;
        min-height: 80px;
        padding: 10px;
    }

    .intro-skill-icon {
        width: 56px;
        height: 56px;
    }
}

@media (max-width: 680px) {
    #class-intro-art {
        height: 58%;
    }

    #class-intro-overlay {
        flex-direction: column;
        justify-content: flex-end;
        overflow-y: auto;
        background: linear-gradient(180deg, transparent 28%, rgba(0, 0, 0, .82) 54%, #050608 100%);
    }

    .left-panel,
    .right-panel {
        width: 100%;
        height: auto;
        padding: 20px;
        background: none;
        transform: translateY(20px);
    }

    .left-panel {
        justify-content: flex-end;
        padding-top: 44vh;
    }

    .right-panel {
        align-items: stretch;
        text-align: left;
    }

    #intro-class-name {
        font-size: 2rem;
        margin-bottom: 12px;
    }

    #intro-class-desc {
        padding: 14px 16px;
    }

    #intro-skills-grid,
    #btn-close-intro {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    #screen-class-intro,
    #class-intro-art,
    .left-panel,
    .right-panel,
    #btn-close-intro {
        transition-duration: 1ms !important;
        animation-duration: 1ms !important;
    }

    .flash-active {
        animation: flash-reduced 180ms ease-out forwards !important;
    }
}

@keyframes flash-reduced {
    0%, 100% { opacity: 0; }
    70% { opacity: .7; }
}
