/**
 * Artist World Portal Styles
 * Full-page portal homepage layout and modules
 *
 * @package ArtistWorld
 */

/* ==========================================================================
   PORTAL FULL-PAGE LAYOUT
   ========================================================================== */

/* Hide body scroll when portal is present - portal handles its own scroll */
body:has(.aw-portal) {
    overflow: hidden;
    background: var(--aw-bg-darker, #0a0a0f);
}

.aw-portal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: transparent;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 3;
}

.aw-portal-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-position: center;
    opacity: 0.3;
    filter: blur(2px);
    z-index: 1;
    pointer-events: none;
}

.aw-portal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    /* Color and opacity set inline from Customizer */
}

.aw-portal-scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

/* ==========================================================================
   SCANLINE EFFECTS
   ========================================================================== */

/* Classic Scan (with static lines) */
.aw-scan-classic {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 136, 0.03) 2px,
        rgba(0, 255, 136, 0.03) 4px
    );
}

.aw-scan-classic::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to bottom, transparent, var(--aw-primary), transparent);
    opacity: 0.15;
    animation: aw-scan-classic 8s linear infinite;
}

@keyframes aw-scan-classic {
    0% { top: -4px; }
    100% { top: 100%; }
}

/* Dual Lines */
.aw-scan-dual::before,
.aw-scan-dual::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--aw-primary);
    opacity: 0.1;
}

.aw-scan-dual::before {
    animation: aw-scan-dual-1 6s linear infinite;
}

.aw-scan-dual::after {
    animation: aw-scan-dual-2 6s linear infinite;
    animation-delay: -3s;
}

@keyframes aw-scan-dual-1 {
    0% { top: -2px; opacity: 0.1; }
    50% { opacity: 0.2; }
    100% { top: 100%; opacity: 0.1; }
}

@keyframes aw-scan-dual-2 {
    0% { top: -2px; opacity: 0.1; }
    50% { opacity: 0.2; }
    100% { top: 100%; opacity: 0.1; }
}

/* Grid Pulse */
.aw-scan-grid {
    background-image:
        linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: aw-scan-grid 4s ease-in-out infinite;
}

.aw-scan-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, transparent 50%, rgba(0, 255, 136, 0.05) 100%);
    animation: aw-scan-grid-pulse 3s ease-in-out infinite;
}

@keyframes aw-scan-grid {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes aw-scan-grid-pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* Glitch */
.aw-scan-glitch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 136, 0.03) 2px,
        rgba(0, 255, 136, 0.03) 4px
    );
    animation: aw-scan-glitch 0.1s steps(1) infinite;
}

.aw-scan-glitch::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: linear-gradient(to bottom,
        transparent,
        rgba(255, 0, 102, 0.2),
        rgba(0, 255, 136, 0.2),
        transparent
    );
    animation: aw-scan-glitch-bar 3s steps(20) infinite;
}

@keyframes aw-scan-glitch {
    0% { opacity: 0.8; }
    25% { opacity: 1; }
    50% { opacity: 0.6; }
    75% { opacity: 0.9; }
    100% { opacity: 0.8; }
}

@keyframes aw-scan-glitch-bar {
    0% { top: -8px; }
    100% { top: 100%; }
}

/* Wave */
.aw-scan-wave::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 200%;
    height: 200px;
    background: linear-gradient(to bottom,
        transparent,
        rgba(0, 255, 136, 0.05) 50%,
        transparent
    );
    transform: translateY(-50%);
    animation: aw-scan-wave 10s ease-in-out infinite;
}

.aw-scan-wave::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 4px,
        rgba(0, 255, 136, 0.02) 4px,
        rgba(0, 255, 136, 0.02) 8px
    );
}

@keyframes aw-scan-wave {
    0%, 100% {
        transform: translateY(-50%) translateX(-25%) skewY(-2deg);
    }
    50% {
        transform: translateY(-50%) translateX(0%) skewY(2deg);
    }
}

/* Matrix */
.aw-scan-matrix {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 136, 0.02) 2px,
        rgba(0, 255, 136, 0.02) 4px
    );
}

.aw-scan-matrix::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 20px,
            rgba(0, 255, 136, 0.02) 20px,
            rgba(0, 255, 136, 0.02) 21px
        );
    animation: aw-matrix-flicker 0.15s steps(2) infinite;
}

.aw-scan-matrix::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            180deg,
            transparent 0%,
            transparent 50%,
            rgba(0, 255, 136, 0.03) 50%,
            rgba(0, 255, 136, 0.08) 51%,
            transparent 52%,
            transparent 100%
        );
    background-size: 100% 200px;
    animation: aw-matrix-fall 4s linear infinite;
}

@keyframes aw-matrix-flicker {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.9; }
}

@keyframes aw-matrix-fall {
    0% { background-position: 0 -200px; }
    100% { background-position: 0 100%; }
}

/* ==========================================================================
   PORTAL CONTENT
   ========================================================================== */

.aw-portal-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 900px;
    padding: var(--aw-space-lg);
    padding-top: var(--aw-space-xl);
    padding-bottom: var(--aw-space-xl);
    margin: auto;
    text-align: center;
}

/* Branding */
.aw-portal-brand {
    margin-bottom: var(--aw-space-md);
}

.aw-portal-brand .custom-logo-link img {
    max-height: 120px;
    width: auto;
}

.aw-portal-title {
    font-size: 4rem;
    color: var(--aw-text-bright);
    text-shadow: 0 0 30px var(--aw-primary);
    margin-bottom: var(--aw-space-sm);
}

.aw-portal-tagline {
    font-family: var(--aw-font-mono);
    font-size: 1rem;
    color: var(--aw-text-muted);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

/* ==========================================================================
   MODULES GRID
   ========================================================================== */

.aw-portal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--aw-space-md);
}

@media (max-width: 900px) {
    .aw-portal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .aw-portal-grid {
        grid-template-columns: 1fr;
    }
}

.aw-portal-module {
    display: flex;
    align-items: center;
    gap: var(--aw-space-sm);
    padding: var(--aw-space-md) var(--aw-space-md);
    background: var(--aw-bg-card);
    border: 1px solid var(--aw-border);
    border-radius: var(--aw-radius);
    text-decoration: none;
    transition: all var(--aw-transition);
    position: relative;
    overflow: hidden;
    /* Start hidden for entrance animation */
    opacity: 0;
    transform: translateY(20px);
}

.aw-portal-module.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger slide variant — bigger Y offset */
.entrance-slide .aw-portal-module {
    transform: translateY(60px);
}
.entrance-slide .aw-portal-module.is-visible {
    transform: translateY(0);
}

.aw-portal-module::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--module-color);
    opacity: 0.5;
    transition: all var(--aw-transition);
}

.aw-portal-module:hover {
    border-color: var(--module-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 0 20px color-mix(in srgb, var(--module-color) 20%, transparent);
}

.aw-portal-module:hover::before {
    width: 100%;
    opacity: 0.1;
}

.aw-module-icon {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--module-color);
}

.aw-module-icon svg {
    width: 32px;
    height: 32px;
}

.aw-module-info {
    flex: 1;
    text-align: left;
}

.aw-module-title {
    font-family: var(--aw-font-display);
    font-size: 1.25rem;
    color: var(--aw-text-bright);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.1;
}

.aw-module-desc {
    font-size: 0.85rem;
    color: var(--aw-text-muted);
    margin: 0;
    line-height: 1.2;
}

.aw-module-arrow {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: var(--aw-text-muted);
    opacity: 0;
    transform: translateX(-10px);
    transition: all var(--aw-transition);
}

.aw-portal-module:hover .aw-module-arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--module-color);
}

.aw-module-arrow svg {
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* 2 columns */
@media (max-width: 900px) {
    .aw-portal-content {
        padding: var(--aw-space-md);
    }

    .aw-portal-brand {
        margin-bottom: var(--aw-space-sm);
    }

    .aw-portal-brand .custom-logo-link img {
        max-height: 80px;
    }

    .aw-portal-title {
        font-size: 2.5rem;
    }

    .aw-portal-tagline {
        font-size: 0.85rem;
        letter-spacing: 0.1em;
    }

    .aw-module-arrow {
        display: none;
    }
}

/* 1 column */
@media (max-width: 600px) {
    .aw-portal-title {
        font-size: 2rem;
    }

    .aw-portal-grid {
        gap: var(--aw-space-sm);
    }

    .aw-portal-module {
        min-height: 64px;
    }

    .aw-module-icon {
        width: 36px;
        height: 36px;
    }

    .aw-module-icon svg {
        width: 24px;
        height: 24px;
    }

    .aw-module-title {
        font-size: 1.1rem;
    }

    .aw-module-desc {
        font-size: 0.8rem;
    }
}

/* ==========================================================================
   SECTION HEADINGS — Visual dividers that group modules
   ========================================================================== */

.aw-portal-section-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: var(--aw-space-md);
    padding: var(--aw-space-sm) 0;
    margin: var(--aw-space-sm) 0;
}

.aw-section-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        color-mix(in srgb, var(--section-color) 50%, transparent) 20%,
        color-mix(in srgb, var(--section-color) 50%, transparent) 80%,
        transparent
    );
}

.aw-section-title {
    font-family: var(--aw-font-display);
    font-size: 0.85rem;
    color: var(--section-color);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    white-space: nowrap;
    opacity: 0.8;
}

/* Admin bar adjustment */
.admin-bar .aw-portal {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .aw-portal {
        top: 46px;
    }
}

/* ==========================================================================
   LOCKED MODULES
   ========================================================================== */

.aw-portal-module.aw-module-locked {
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.5);
}

.aw-portal-module.aw-module-locked.is-visible {
    opacity: 0.45;
}

/* Re-enable pointer events for tooltip on hover */
@media (hover: hover) {
    .aw-portal-module.aw-module-locked {
        pointer-events: auto;
    }
    .aw-portal-module.aw-module-locked:hover {
        transform: none;
        opacity: 0.55;
    }
}

/* ============================================
   Radar Ping Dot (active moments indicator)
   ============================================ */
.aw-radar-ping {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    z-index: 2;
    pointer-events: none;
}

.aw-radar-ping::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    transform: translate(-50%, -50%);
    background: var(--aw-primary);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--aw-primary);
}

.aw-radar-ping::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border: 2px solid var(--aw-primary);
    border-radius: 50%;
    animation: aw-radar-ping 1.5s ease-out infinite;
}

@keyframes aw-radar-ping {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}
