/* Portal Styles - Fixed Version without white overlay */

/* Portal-specific CSS Variables */
:root {
    --primary-blue: #0271FC;
    --secondary-blue: #5BC9DE;
    --text-primary: #f9f9f9;
    --text-secondary: #b0b0b0;
}

/* Portal Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes blinkCursor {
    50% { border-color: transparent; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes cardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Portal Body Styles - FIXED: Removed body::before overlay */
body {
    font-family: 'Montserrat', sans-serif;
    background: #000000; /* Solid black background */
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    padding-bottom: 120px; /* Space for fixed footer */
}

main {
    position: relative;
    z-index: 1;
}

/* Video Background - FIXED: Increased opacity */
.video-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
}

.video-bg video {
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: cover;
    opacity: 0.5; /* Increased from 0.66 */
}

.video-bg iframe {
    position: absolute; 
    top: 50%;
    left: 50%;
    min-width: 130%;
    min-height: 130%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    border: none;
    opacity: 0.5; /* FIXED: Increased from 0.3 - this was causing the washed out white look */
    pointer-events: none; 
}

/* Matrix Rain Canvas */
#matrix {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.35;
}

/* Portal Header */
.portal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 30px 20px 40px;
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
    animation-delay: 0.2s;
    position: relative;
    z-index: 1;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.portal-logo {
    width: 80px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(2, 113, 252, 0.8));
    animation: float 3s ease-in-out infinite;
    margin: 0 10px; 
}

.portal-header h1 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: clamp(36px, 5vw, 48px);
    color: var(--text-primary); 
    text-shadow: 0 0 30px rgba(249, 249, 249, 0.5); 
    margin-bottom: 10px;
}

.portal-header h1 span {
    font-weight: 300;
}

.portal-header p {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 8px;
}

/* Founders LED Insignia */
.founders-led-insignia {
    position: fixed;
    top: 20px;
    right: calc(50% - 700px + 20px);
    z-index: 99;
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
    animation-delay: 1.5s;
}

@media (max-width: 1400px) {
    .founders-led-insignia {
        right: 20px;
    }
}

/* Community LED Insignia */
.community-led-insignia {
    position: fixed;
    top: 110px;
    right: calc(50% - 700px + 20px);
    z-index: 99;
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
    animation-delay: 1.7s;
}

@media (max-width: 1400px) {
    .community-led-insignia {
        right: 20px;
    }
}

/* Community LED Brown Theme */
.led-insignia-container.community-led {
    border: 2px solid rgba(201, 169, 97, 0.6);
    box-shadow: 
        0 0 20px rgba(201, 169, 97, 0.4),
        inset 0 0 20px rgba(201, 169, 97, 0.1),
        0 4px 15px rgba(0, 0, 0, 0.7);
}

.led-insignia-container.community-led::before {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(201, 169, 97, 0.3),
        transparent
    );
}

.led-label.community-label {
    color: rgba(201, 169, 97, 0.7);
    text-shadow: 0 0 8px rgba(201, 169, 97, 0.5);
}

.led-name.community-name {
    color: rgba(212, 175, 55, 1);
    text-shadow: 
        0 0 10px rgba(212, 175, 55, 0.8),
        0 0 20px rgba(212, 175, 55, 0.6),
        0 0 30px rgba(212, 175, 55, 0.4);
    animation: communityNameGlow 1.5s ease-in-out infinite;
}

@keyframes communityNameGlow {
    0%, 100% { 
        text-shadow: 
            0 0 10px rgba(212, 175, 55, 0.8),
            0 0 20px rgba(212, 175, 55, 0.6);
    }
    50% { 
        text-shadow: 
            0 0 15px rgba(212, 175, 55, 1),
            0 0 30px rgba(212, 175, 55, 0.8),
            0 0 45px rgba(212, 175, 55, 0.6);
    }
}

.led-dot.community-dot {
    background: rgba(201, 169, 97, 0.3);
    box-shadow: 0 0 8px rgba(201, 169, 97, 0.3);
}

.led-dot.community-dot.active {
    background: rgba(212, 175, 55, 1);
    box-shadow: 
        0 0 10px rgba(212, 175, 55, 0.8),
        0 0 20px rgba(212, 175, 55, 0.6);
}

.led-insignia-container {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid rgba(2, 113, 252, 0.6);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 
        0 0 20px rgba(2, 113, 252, 0.4),
        inset 0 0 20px rgba(2, 113, 252, 0.1),
        0 4px 15px rgba(0, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

.led-insignia-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(2, 113, 252, 0.3),
        transparent
    );
    animation: ledScan 3s ease-in-out infinite;
}

@keyframes ledScan {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}

.led-label {
    font-family: 'Courier New', monospace;
    font-size: 8px;
    letter-spacing: 2px;
    color: rgba(2, 113, 252, 0.7);
    text-transform: uppercase;
    margin-bottom: 6px;
    text-align: center;
    text-shadow: 0 0 8px rgba(2, 113, 252, 0.5);
    animation: ledLabelPulse 2s ease-in-out infinite;
}

@keyframes ledLabelPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.led-display {
    text-align: center;
    margin-bottom: 8px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.led-name {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    color: rgba(2, 113, 252, 1);
    text-shadow: 
        0 0 10px rgba(2, 113, 252, 0.8),
        0 0 20px rgba(2, 113, 252, 0.6),
        0 0 30px rgba(2, 113, 252, 0.4);
    animation: ledNameGlow 1.5s ease-in-out infinite;
    text-transform: uppercase;
    transition: opacity 0.3s ease;
}

@keyframes ledNameGlow {
    0%, 100% { 
        text-shadow: 
            0 0 10px rgba(2, 113, 252, 0.8),
            0 0 20px rgba(2, 113, 252, 0.6);
    }
    50% { 
        text-shadow: 
            0 0 15px rgba(2, 113, 252, 1),
            0 0 30px rgba(2, 113, 252, 0.8),
            0 0 45px rgba(2, 113, 252, 0.6);
    }
}

.led-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.led-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(2, 113, 252, 0.3);
    box-shadow: 0 0 8px rgba(2, 113, 252, 0.3);
    transition: all 0.3s ease;
}

.led-dot.active {
    background: rgba(2, 113, 252, 1);
    box-shadow: 
        0 0 10px rgba(2, 113, 252, 0.8),
        0 0 20px rgba(2, 113, 252, 0.6);
    animation: ledDotPulse 1s ease-in-out infinite;
}

@keyframes ledDotPulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .founders-led-insignia {
        top: 15px;
        right: 15px;
    }
    
    .community-led-insignia {
        top: 95px;
        right: 15px;
    }
    
    .led-insignia-container {
        padding: 11px 14px;
        min-width: 130px;
    }
    
    .led-name {
        font-size: 13px;
        letter-spacing: 2.5px;
    }
    
    .led-label {
        font-size: 7.5px;
        letter-spacing: 1.5px;
    }
    
    .led-display {
        min-height: 22px;
        margin-bottom: 7px;
    }
    
    .led-dot {
        width: 5.5px;
        height: 5.5px;
    }
    
    .led-dots {
        gap: 5px;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .founders-led-insignia {
        top: 10px;
        right: 10px;
    }
    
    .community-led-insignia {
        top: 85px;
        right: 10px;
    }
    
    .led-insignia-container {
        padding: 10px 12px;
        min-width: 120px;
        max-width: 140px;
    }
    
    .led-name {
        font-size: 12px;
        letter-spacing: 2px;
    }
    
    .led-label {
        font-size: 7px;
        letter-spacing: 1px;
        margin-bottom: 5px;
    }
    
    .led-display {
        min-height: 20px;
        margin-bottom: 6px;
    }
    
    .led-dot {
        width: 5px;
        height: 5px;
    }
    
    .led-dots {
        gap: 4px;
    }
}

/* Responsive - Small Mobile */
@media (max-width: 480px) {
    .founders-led-insignia {
        top: 8px;
        right: 8px;
    }
    
    .community-led-insignia {
        top: 75px;
        right: 8px;
    }
    
    .led-insignia-container {
        padding: 8px 10px;
        min-width: 100px;
        max-width: 120px;
        border-radius: 6px;
    }
    
    .led-name {
        font-size: 10px;
        letter-spacing: 1.5px;
    }
    
    .led-label {
        font-size: 6px;
        letter-spacing: 0.5px;
        margin-bottom: 4px;
    }
    
    .led-display {
        min-height: 18px;
        margin-bottom: 5px;
    }
    
    .led-dot {
        width: 4px;
        height: 4px;
    }
    
    .led-dots {
        gap: 3px;
    }
}

/* Responsive - Extra Small Mobile */
@media (max-width: 360px) {
    .founders-led-insignia {
        top: 5px;
        right: 5px;
    }
    
    .community-led-insignia {
        top: 70px;
        right: 5px;
    }
    
    .led-insignia-container {
        padding: 6px 8px;
        min-width: 90px;
        max-width: 110px;
    }
    
    .led-name {
        font-size: 9px;
        letter-spacing: 1px;
    }
    
    .led-label {
        font-size: 5.5px;
        letter-spacing: 0.5px;
        margin-bottom: 3px;
    }
    
    .led-display {
        min-height: 16px;
        margin-bottom: 4px;
    }
    
    .led-dot {
        width: 3.5px;
        height: 3.5px;
    }
    
    .led-dots {
        gap: 2.5px;
    }
    
    /* Ensure header doesn't overlap with badges on very small screens */
    .portal-header {
        padding-right: 120px;
        padding-top: 25px;
    }
}

/* Portal Footer */
.portal-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px 10px;
    color: var(--text-secondary);
    font-size: 13px;
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
    animation-delay: 1.2s;
    z-index: 100;
    
    /* Glassmorphism */
    background: rgba(20, 20, 20, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(2, 113, 252, 0.3);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.portal-footer a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all var(--transition-normal);
}

.portal-footer a:hover {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
    text-shadow: 0 0 10px rgba(2, 113, 252, 0.5);
}
.subtitle {
    font-size: 14px;
    font-family: 'Eagle Lake', cursive;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 10px;
}
/* Portal Cards Container */


.cards-container {
    opacity: 1; 
    display: flex;
    justify-content: center;
    align-items: stretch;
    height: 50vh;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 20px;
    position: relative;
    z-index: 1;
}

/* Portal Card */
.portal-card {
    position: relative;
    flex: 1;
    min-width: 120px;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    
    background-color: rgba(20, 20, 20, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(2, 113, 252, 0.2);
    
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    
    opacity: 0;
    transform: translateY(20px);
    animation: cardFadeIn 0.5s ease-out forwards;
}

.portal-card.delay-1 { animation-delay: 0.3s; }
.portal-card.delay-2 { animation-delay: 0.5s; }
.portal-card.delay-3 { animation-delay: 0.7s; }

.portal-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.66;
    z-index: 0;
    transition: opacity 0.6s ease;
}

.card-library::after { 
    background-image: url('https://media.xdripia.com/assets/banners/tales_library_brad_cover.webp'); 
}

.card-tales::after { 
    background-image: url('https://media.xdripia.com/assets/banners/tales_mystic_look_eyes.webp'); 
}

.card-codex::after { 
    background-image: url('https://media.xdripia.com/assets/banners/xdrip_brad_xdripian_cube.webp'); 
}

.portal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.4) 100%);
    transition: all 0.6s ease;
    z-index: 1;
}

.portal-card:hover::before {
    background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.3) 100%);
}

.portal-card:hover::after {
    opacity: 1;
    filter: brightness(1.1) contrast(1.1) saturate(1.2) hue-rotate(10deg) drop-shadow(0 20px 40px rgba(2, 113, 252, 0.35));
    transition: opacity 0.6s ease-out, filter 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.portal-card.expanded::before {
    background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.45) 100%);
}

.portal-card.expanded::after {
    opacity: 0.9;
    transition: opacity 0.6s ease-out, filter 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.portal-card.expanded:hover::after {
    opacity: 1;
    filter: brightness(1.1) contrast(1.1) saturate(1.2) hue-rotate(10deg) drop-shadow(0 20px 40px rgba(2, 113, 252, 0.35));
}

.portal-card.expanded {
    flex: 4;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(2, 113, 252, 0.4);
    background-color: rgba(20, 20, 20, 0.4);
}

.portal-card.collapsed {
    flex: 0.5;
}

/* Card Content */
.card-content {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 40px;
    z-index: 2;
    align-items: flex-start;
}

/* Card Title (COMPRESSO/VERTICALE) */
.card-title {
    font-family: 'Eagle Lake', cursive;
    font-weight: 400;
    font-size: clamp(24px, 3vw, 32px);
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(249, 249, 249, 0.5);
    writing-mode: vertical-rl;
    position: absolute;
    bottom: 40px;
    left: 50%;
    text-orientation: mixed;
    transform: translateX(-50%) rotate(180deg);
    margin: 0 auto;
    transition: all 0.6s ease;
    white-space: nowrap; 
}

/* Card Title (ESPANSO/ORIZZONTALE) */
.portal-card.expanded .card-title {
    writing-mode: horizontal-tb;
    transform: translateX(-0%)rotate(0);
    position:relative;
    bottom: 0px;
    left: 0%;
    text-align: left;
    align-self: flex-start;
    font-size: 38px;
    margin: 0 0 20px 0; 
    color: var(--text-primary);
}

/* Card Description (COMPRESSO/NASCOSTO) */
.card-description {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary); 
    margin-bottom: 30px;
    text-align: left;
}

/* Card Description (ESPANSO con Typewriter) */
.portal-card.expanded .card-description {
    opacity: 1;
    max-height: 200px;
    color: var(--text-primary);
    text-align: left;
    overflow: visible;
}

/* Typewriter effect container */
.typewriter-text {
    display: inline-block;
    border-right: 2px solid var(--primary-blue);
    animation: blinkCursor 0.75s step-end infinite;
}

.typewriter-text.typing-complete {
    border-right: none;
    animation: none;
    white-space: normal;
}

/* Cinzel Decorative per Tales of Xdripia */
.card-tales .card-title {
    font-family: 'Cinzel Decorative', cursive;
    font-weight: 500;
}

.card-tales.expanded .card-title {
    font-family: 'Cinzel Decorative', cursive;
}          

.card-button {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
    display: inline-block;
    padding: 15px 40px;
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.15),
        rgba(255, 255, 255, 0.05)
    );
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    align-self: flex-start;
}

.portal-card.expanded .card-button {
    opacity: 1;
    transform: translateY(0);
}

.card-button:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 10px 20px rgba(2, 113, 252, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    background: linear-gradient(
        145deg,
        rgba(2, 113, 252, 0.25), 
        rgba(255, 255, 255, 0.1)
    );
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border-gold);
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.7),
        var(--shadow-glow-gold);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    border-radius: 50%;
}

.modal-close:hover {
    color: var(--cosmic-gold);
    background: rgba(251, 191, 36, 0.1);
    transform: rotate(90deg);
}

.modal-title {
    font-family: 'Cinzel Decorative', cursive;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    color: var(--cosmic-gold);
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.modal-message {
    font-family: 'EB Garamond', serif;
    font-size: clamp(1rem, 2vw, 1.125rem);
    color: var(--text-primary);
    line-height: 1.8;
    text-align: center;
    margin-bottom: 30px;
}

.modal-button {
    display: block;
    width: 100%;
    padding: 15px 30px;
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--obsidian-black);
    background: linear-gradient(135deg, var(--cosmic-gold), var(--gilded-matte));
    border: 1px solid var(--cosmic-gold);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-glow-gold);
}

.modal-button:hover {
    background: linear-gradient(135deg, var(--gilded-matte), var(--gold-sand));
    transform: translateY(-2px);
    box-shadow: 
        var(--shadow-glow-gold),
        0 10px 30px rgba(251, 191, 36, 0.4);
}

.modal-button:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 1024px) {
    .cards-container { flex-direction: column; height: auto; gap: 15px; }
    .portal-card { min-height: 150px; }
    .portal-card.expanded { min-height: 400px; }
    .card-title { writing-mode: horizontal-tb; transform: rotate(0); font-size: 24px; }
    .portal-card.expanded .card-title { font-size: 36px; }
    
    .modal-content {
        padding: 30px 20px;
        max-width: 90%;
    }
}