/* Minimalist tech design system for 404adicted.com */
:root {
    /* Dark Mode Defaults */
    --bg-main: #0a0a0a;
    --text-primary: #ffffff;
    --text-muted: #888888;
    --accent: #00ffff; /* Cyber Cyan */
    --accent-dim: rgba(0, 255, 255, 0.15);
    --border: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(255, 255, 255, 0.03);
    --modal-bg: rgba(15, 15, 20, 0.75);
    --modal-backdrop-bg: rgba(0, 0, 0, 0.7);
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

/* Light Mode Variables Override */
body.light-mode {
    --bg-main: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-muted: #6e6e73;
    --accent: #7c3aed; /* Premium Purple */
    --accent-dim: rgba(124, 58, 237, 0.12);
    --border: rgba(0, 0, 0, 0.08);
    --card-bg: rgba(0, 0, 0, 0.02);
    --modal-bg: rgba(255, 255, 255, 0.85);
    --modal-backdrop-bg: rgba(255, 255, 255, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, backdrop-filter 0.4s ease;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* 3D Canvas Background */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* UI Overlay Layer */
#ui-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    padding: 40px 40px 60px 40px; /* Increased bottom padding to 60px to give cards breathing room */
    pointer-events: none; /* Let clicks pass to 3D canvas unless on interactive cards */
    overflow-y: auto; /* Enable scrolling on desktop if height is constrained */
}

/* Header */
header {
    align-self: flex-start;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-primary);
}

.tagline {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 200;
    margin-top: 5px;
    letter-spacing: 1px;
}

/* Interactivity indicator */
.interaction-prompt {
    align-self: center;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    animation: pulse 2.5s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Portal Grid Layout */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    pointer-events: auto; /* Re-enable pointer events for interactive elements */
}

/* Portal Cards with Glassmorphism and Hover Glows */
.portal-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-decoration: none;
    color: var(--text-primary);
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s;
}

.portal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    opacity: 0.5;
    transition: opacity 0.3s;
}

.portal-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.portal-card:hover #card-circleburst {
    border-color: var(--accent);
}

.portal-card:hover .card-glow {
    opacity: 0.15;
}

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--accent) 0%, transparent 60%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
    mix-blend-mode: screen;
}

#card-youtube:hover .card-glow {
    background: radial-gradient(circle, rgba(255, 68, 68, 0.8) 0%, transparent 60%);
}

#card-circleburst:hover .card-glow {
    background: radial-gradient(circle, var(--accent) 0%, transparent 60%);
}

.card-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-category {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.card-content h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.card-content p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 200;
}

.card-action {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent);
    margin-top: auto;
    letter-spacing: 1px;
    transition: transform 0.3s;
}

#card-youtube .card-action {
    color: #9333ea;
}

.portal-card:hover .card-action {
    transform: translateX(5px);
}

/* Static Stats Card */
.static-card {
    pointer-events: none;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot.green {
    background-color: #00ff66;
    box-shadow: 0 0 8px #00ff66;
}

.status-text {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 500;
    color: #00ff66;
    letter-spacing: 1px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #ui-overlay {
        padding: 20px 20px 80px 20px; /* Generous bottom padding to clear mobile browser address/nav bars */
        overflow-y: auto;
    }
    .portal-grid {
        grid-template-columns: 1fr;
        margin-top: 360px; /* Push cards further down to create a massive interaction zone for the origami crane */
    }
    .interaction-prompt {
        display: none;
    }
    .logo {
        font-size: 1.5rem;
    }
}

/* Button Reset for Interactive Profile Card */
.interactive-btn-card {
    text-align: left;
    width: 100%;
    cursor: pointer;
    background: var(--card-bg);
    border: 1px solid var(--border);
    outline: none;
    font-family: inherit;
}

/* Modal Styling (Glassmorphism Modal) */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-backdrop-bg);
    backdrop-filter: blur(12px);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    padding: 20px;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    position: relative;
    background: var(--modal-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    max-height: 90vh;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 40px;
    right: 40px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    pointer-events: auto;
    backdrop-filter: blur(10px);
    transition: border-color 0.3s, transform 0.3s;
}

.theme-toggle:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--text-primary);
    transition: fill 0.3s;
}

/* Rotate and hide/show details in light mode */
.theme-toggle .sun-icon {
    display: none;
}

body.light-mode .theme-toggle .moon-icon {
    display: none;
}

body.light-mode .theme-toggle .sun-icon {
    display: block;
}

@media (max-width: 768px) {
    .theme-toggle {
        top: 20px;
        right: 20px;
    }
}
}

.modal-backdrop.open .modal-card {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 25px;
    right: 25px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-header {
    margin-bottom: 35px;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-top: 5px;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--text-primary), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-sub {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 200;
}

/* Modal Body Layout */
.modal-body-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

@media (max-width: 850px) {
    .modal-body-grid {
        grid-template-columns: 1fr;
    }
    .modal-card {
        padding: 30px 20px;
        max-height: none; /* Let backdrop handle full height scrolling on mobile */
        margin-bottom: 20px; /* Space at the bottom */
    }
    .modal-backdrop {
        align-items: flex-start;
        overflow-y: auto;
        padding: 40px 15px 90px 15px; /* Added 90px bottom padding to clear mobile navigation bars */
    }
}

.area-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.area-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.area-icon {
    font-size: 1.2rem;
}

.area-title h4 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.area-desc {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
    font-weight: 200;
    margin-bottom: 20px;
}

/* Skills tags list */
.skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.tag {
    font-size: 0.72rem;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    color: var(--text-primary);
    font-weight: 400;
    letter-spacing: 0.5px;
    transition: background 0.2s, border-color 0.2s;
}

.tag:hover {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.3);
    color: #00ffff;
}

/* ─── Light Mode Overrides ─────────────────────────────────────── */
body.light-mode .portal-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.07);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* Make card-glow visible on white background in light mode */
body.light-mode .card-glow {
    mix-blend-mode: normal;
    opacity: 0;
}

body.light-mode .portal-card:hover .card-glow {
    opacity: 0.12;
}

body.light-mode .portal-card:hover {
    border-color: rgba(124, 58, 237, 0.25);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.12);
}

body.light-mode .tag {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: #1d1d1f;
}

body.light-mode .tag:hover {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.3);
    color: #7c3aed;
}

body.light-mode .modal-card {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255,255,255,0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

body.light-mode .area-section {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255,255,255,0.9);
}
