/* public/css/portal.css (Versiune Rafinată - Cadru Complet) */

/* Layout General */
.portal-space {
    position: fixed;
    inset: 0;
    background-color: #020205;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: auto;
    padding: 1rem;
}

.portal-background {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(200, 200, 220, 0.03) 0%, transparent 50%);
    transition: background-position 0.1s ease-out;
}

/* Header Text */
.portal-header {
    animation: fadeIn 2s ease-out;
    z-index: 5;
    max-width: 100%;
    padding: 0 1.5rem;
    margin-bottom: 1.5rem;
    margin-top: 2rem;
}

.portal-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.75rem, 7vw, 4rem);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.portal-narrative {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.9rem, 3.5vw, 1.3rem);
    line-height: 1.6;
    opacity: 0.85;
    margin: 1rem auto;
    max-width: 90%;
    padding: 0 0.5rem;
}

.portal-subtitle {
    font-family: 'Inter', sans-serif;
    font-style: italic;
    opacity: 0.7;
    font-size: clamp(0.8rem, 3vw, 1rem);
    margin-top: 1rem;
    letter-spacing: 0.01em;
}

/* Container pentru Alegeri - Mobile First */
.portal-choices {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-top: 2rem;
    z-index: 5;
    width: 100%;
    max-width: 400px;
    align-items: center;
    padding: 0 1rem;
    margin-bottom: 2rem;
}

.portal-gate {
    text-decoration: none;
    color: white;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.portal-gate:active {
    transform: scale(0.95);
}

.portal-story-title {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 200px;
    opacity: 1;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1rem, 4vw, 1.2rem);
    text-align: center;
    transition: opacity 0.4s ease, transform 0.4s ease;
    font-weight: 500;
    letter-spacing: 0.05em;
}

/* ================================== */
/* EFECT 1: CERC CU UNDE (RIPPLE)     */
/* ================================== */
.ripple-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.ripple-circle .ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: ripple-wave 4s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

.ripple-circle .ripple:nth-child(2) {
    animation-delay: -1.33s;
}

.ripple-circle .ripple:nth-child(3) {
    animation-delay: -2.66s;
}

#gate-dream .ripple {
    border-color: rgba(184, 91, 71, 0.15);
}

#gate-dream .portal-story-title {
    color: rgba(184, 91, 71, 0.95);
    text-shadow: 0 2px 8px rgba(184, 91, 71, 0.3);
}

/* ======================================================= */
/* EFECT 2: CADRU DREPTUNGHIULAR ANIMAT - COMPLET         */
/* ======================================================= */
.animated-frame {
    position: relative;
    width: 120px;
    height: 180px;
}

.animated-frame .frame-line {
    position: absolute;
    background-color: rgba(69, 123, 157, 0.4);
    transition: background-color 0.4s ease;
}

/* Linia de sus */
.animated-frame .frame-top {
    top: 0;
    left: 0;
    width: 0;
    height: 2px;
    animation: draw-horizontal 4s linear infinite;
}

/* Linia din dreapta */
.animated-frame .frame-right {
    top: 0;
    right: 0;
    width: 2px;
    height: 0;
    animation: draw-vertical 4s linear infinite 1s;
}

/* Linia de jos */
.animated-frame .frame-bottom {
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    animation: draw-horizontal 4s linear infinite 2s;
}

/* Linia din stânga */
.animated-frame .frame-left {
    bottom: 0;
    left: 0;
    width: 2px;
    height: 0;
    animation: draw-vertical 4s linear infinite 3s;
}

#gate-echoes:hover .frame-line {
    background-color: rgba(163, 177, 204, 1);
    animation-play-state: paused;
}

#gate-echoes .portal-story-title {
    color: rgba(69, 123, 157, 0.95);
    text-shadow: 0 2px 8px rgba(69, 123, 157, 0.3);
}

/* ================================== */
/* ANIMAȚII (KEYFRAMES)               */
/* ================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ripple-wave {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Animație pentru liniile orizontale (sus și jos) */
@keyframes draw-horizontal {
    0% { width: 0; }
    25% { width: 100%; }
    100% { width: 100%; }
}

/* Animație pentru liniile verticale (dreapta și stânga) */
@keyframes draw-vertical {
    0% { height: 0; }
    25% { height: 100%; }
    100% { height: 100%; }
}

/* ================================================= */
/* TRANZIȚIE CINEMATOGRAFICĂ                         */
/* ================================================= */
.portal-space.is-transitioning .portal-header,
.portal-space.is-transitioning .portal-gate:not(.is-clicked) {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

/* Stiluri pentru expansiunea cercului */
.ripple-circle.is-expanding {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(15);
    background-color: #B85B47;
    border: none;
    border-radius: 0;
    transition: transform 1s cubic-bezier(0.7, 0, 0.3, 1), background-color 0.5s ease;
    z-index: 1000;
}

.ripple-circle.is-expanding .ripple {
    opacity: 0;
}

/* Stiluri pentru expansiunea cadrului */
.animated-frame.is-expanding {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(15);
    background-color: #457B9D;
    transition: transform 1s cubic-bezier(0.7, 0, 0.3, 1), background-color 0.5s ease;
    z-index: 1000;
}

.animated-frame.is-expanding .frame-line {
    opacity: 0;
}

/* ================================== */
/* TABLET - 600px și peste            */
/* ================================== */
@media (min-width: 600px) {
    .portal-space {
        padding: 2rem;
    }

    .portal-header {
        margin-bottom: 2.5rem;
        margin-top: 4rem;
        padding: 0 2rem;
    }

    .portal-title {
        font-size: clamp(2.5rem, 6vw, 4rem);
    }

    .portal-narrative {
        max-width: 85%;
        font-size: clamp(1.1rem, 2.5vw, 1.3rem);
        margin: 2rem auto;
        line-height: 1.7;
    }

    .portal-choices {
        flex-direction: row;
        gap: 8vw;
        margin-top: 4rem;
        max-width: 700px;
        justify-content: center;
    }

    .portal-gate {
        width: 160px;
        height: 160px;
    }

    .animated-frame {
        width: 140px;
        height: 200px;
    }

    .portal-story-title {
        bottom: -45px;
        opacity: 0;
        font-size: 1.2rem;
    }

    .portal-gate:hover {
        transform: translateY(-8px);
    }

    .portal-gate:hover .portal-story-title {
        opacity: 1;
        transform: translateX(-50%) translateY(5px);
    }

    #gate-dream:hover .ripple {
        border-color: rgba(184, 91, 71, 0.6);
        animation-duration: 3s;
    }

    #gate-dream:hover .portal-story-title {
        color: rgba(184, 91, 71, 1);
        text-shadow: 0 0 15px rgba(184, 91, 71, 0.6);
    }

    #gate-echoes:hover .frame-line {
        background-color: rgba(163, 177, 204, 1);
        box-shadow: 0 0 10px rgba(163, 177, 204, 0.8);
    }

    #gate-echoes:hover .portal-story-title {
        color: rgba(69, 123, 157, 1);
        text-shadow: 0 0 15px rgba(69, 123, 157, 0.6);
    }
}

/* ================================== */
/* DESKTOP - 1024px și peste          */
/* ================================== */
@media (min-width: 1024px) {
    .portal-choices {
        gap: 10vw;
        margin-top: 5rem;
    }

    .portal-gate {
        width: 200px;
        height: 200px;
    }

    .animated-frame {
        width: 170px;
        height: 240px;
    }

    .portal-story-title {
        font-size: 1.3rem;
        bottom: -50px;
    }

    .portal-gate:hover .portal-story-title {
        transform: translateX(-50%) translateY(10px);
    }
}

/* ================================== */
/* REDUCE MOTION - Accesibilitate     */
/* ================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ================================== */
/* MESAJ AUDIO HINT                   */
/* ================================== */
.audio-hint {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
}

.audio-hint-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.audio-hint-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(100px);
}

.audio-hint-icon {
    color: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
}

.audio-hint-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
}

@media (max-width: 599px) {
    .audio-hint {
        bottom: 1rem;
        padding: 0.6rem 1.2rem;
        max-width: 90%;
    }
    
    .audio-hint-text {
        font-size: 0.85rem;
        white-space: normal;
        text-align: center;
    }
}