/* CSS Variables for Lumon Theme */
:root {
    --primary-color: #00FF41;
    /* Classic Terminal Green */
    --bg-dark: #000000;
    /* Pure Black for OLED/CRT feel */
    --text-dim: rgba(0, 255, 65, 0.6);
    --glow-spread: 8px;
    --font-ui: 'Public Sans', sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Global Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.theme-lumon {
    background-color: var(--bg-dark);
    color: var(--primary-color);
    font-family: var(--font-mono);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    /* Hide scrollbars initially for loading, but allow later */
    overflow-x: hidden;
    overflow-y: auto;
    text-shadow: 0 0 calc(var(--glow-spread) / 2) var(--text-dim);
}

/* Loading Screen Overlay */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-dark);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease-in-out, visibility 1s;
}

#loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.lumon-logo-container {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lumon-logo {
    max-width: 300px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(0, 255, 65, 0.5));
}

@keyframes drip-pulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(0, 255, 65, 0.5));
    }

    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 20px rgba(0, 255, 65, 0.8));
    }
}

.boot-sequence {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--primary-color);
}

#boot-text {
    margin-bottom: 1rem;
    height: 1.5rem;
    letter-spacing: 0.1rem;
}

.loading-bar-container {
    width: 100%;
    height: 2px;
    background-color: rgba(0, 255, 65, 0.1);
    position: relative;
    overflow: hidden;
}

#loading-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    transition: width 0.2s ease-out;
}

/* Hide main container initially */
::selection {
    background: var(--text-dim);
    color: var(--bg-dark);
    text-shadow: none;
}

/* -------------------- */
/* CRT Screen Effects   */
/* -------------------- */

/* Scanlines Array Overlay */
body::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0) 50%,
            rgba(0, 255, 65, 0.03) 50%);
    background-size: 100% 4px;
    z-index: 50;
    pointer-events: none;
}

/* Radial Vignette */
body::after {
    content: " ";
    display: block;
    position: fixed;
    /* Fixed to cover screen correctly on scroll */
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: radial-gradient(circle, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.4) 110%);
    z-index: 51;
    pointer-events: none;
}

/* Screen Flicker Animation */
@keyframes flicker {
    0% {
        opacity: 0.98;
    }

    5% {
        opacity: 0.92;
    }

    10% {
        opacity: 0.98;
    }

    15% {
        opacity: 1;
        text-shadow: 0 0 calc(var(--glow-spread)) var(--primary-color);
    }

    100% {
        opacity: 1;
    }
}

/* Apply flicker only to the text and UI elements, not the structural containers or images */
h1,
h2,
h3,
h4,
p,
span,
a,
button,
.system-status,
.gallery-caption,
.gallery-img-placeholder {
    animation: flicker 0.15s infinite;
}

/* Explicitly stop images and their immediate containers from flickering and lift them above scanlines */
img,
video,
.gallery-item,
.profile-pic,
.profile-pic-border,
.btn-flip {
    animation: none !important;
    opacity: 1 !important;
    position: relative;
    z-index: 600; /* Lift above body::before (50) and body::after (51) */
}


/* -------------------- */
/* UI Components        */
/* -------------------- */

/* Macrodata Refinement Background Canvas */
canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.15;
}

.container {
    width: 100%;
    max-width: 520px;
    /* Constrain width like Linktree mobile view */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Vertically center content */
    padding: 2rem;
    position: static; /* Prevent stacking context */
    z-index: auto;
}

.container.visible {
    opacity: 1;
}

/* Header */
header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 3rem;
    width: 100%;
}

.system-status {
    width: 100%;
    border-bottom: 1px solid var(--primary-color);
    padding-bottom: 0.5rem;
    font-size: 0.75rem;
    /* ~12px */
    display: flex;
    justify-content: space-between;
    padding: 0 1rem 0.5rem 1rem;
}

/* Animated Pulse/Blink Utility */
.blink {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Profile Section */
.profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2.5rem;
}

.profile-pic-border {
    width: 7.5rem;
    /* 120px */
    height: 7.5rem;
    border: 1px solid var(--primary-color);
    padding: 0.25rem;
    /* Gives the double inner border effect */
    margin-bottom: 1rem;
}

.profile-pic {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    /* Translates Tailwind: grayscale contrast-150 brightness-75 sepia-[0.5] hue-rotate-[100deg] */
    filter: grayscale(100%) contrast(150%) brightness(75%) sepia(50%) hue-rotate(100deg);
}

.profile-info {
    text-align: center;
}

.site-title {
    font-size: 1.1rem;
    letter-spacing: 0.2em;
    margin-bottom: 0.4rem;
    color: #fff;
    text-shadow: 0 0 8px var(--primary-color);
}

.profile-summary,
.gallery-description {
    font-size: 0.8rem;
    line-height: 1.6;
    color: rgba(0, 255, 65, 0.82);
    max-width: 38rem;
    margin: 0.8rem auto 0;
}

.employee-status {
    font-size: 0.625rem;
    /* 10px */
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 0.25rem;
}

.id-ref {
    font-size: 0.875rem;
    /* 14px */
}

/* Link Items */
.links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    margin-bottom: 3rem;
}

/* 3D Flip Button Effect */
.btn-flip {
    opacity: 1;
    outline: 0;
    color: transparent;
    /* Hide original text, using pseudo-elements */
    height: 100%;
    width: 100%;
    position: relative;
    text-align: center;
    letter-spacing: 1px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    text-transform: uppercase;
    transition: 0.3s;
    perspective: 1000px;
    background: var(--bg-dark);
    z-index: 10;
}


.btn-flip:hover:after {
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

.btn-flip:hover:before {
    opacity: 0;
    transform: translateY(50%) rotateX(90deg);
}

.btn-flip:after {
    top: 0;
    left: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    color: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.5s;
    position: absolute;
    background: var(--primary-color);
    content: attr(data-back);
    transform: translateY(-50%) rotateX(90deg);
    pointer-events: none;
    border: 1px solid var(--primary-color);
    /* Same border as front to match width */
}

.btn-flip:before {
    top: 0;
    left: 0;
    opacity: 1;
    color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 1rem;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    transition: 0.5s;
    position: absolute;
    /* Using absolute for both ensures perfect alignment */
    background: var(--bg-dark);
    border: 1px solid var(--primary-color);
    content: attr(data-front);
    transform: translateY(0) rotateX(0);
}

/* Link Items Adjustment */
.link-item {
    border: none;
    /* Removed original border to let btn-flip handle it */
    padding: 0;
    display: block;
    height: 3rem;
}

.link-title,
.link-tag {
    display: none;
    /* Hide original spans, using data attributes */
}

.link-title {
    font-size: 0.875rem;
    /* 14px */
    letter-spacing: 0.1em;
}

.link-tag {
    font-size: 0.75rem;
    /* 12px */
}

/* Toggle Switch Bottom Bar */
.toggle-section {
    margin-top: 3rem;
    /* Changed from auto to center the whole block vertically */
    width: 100%;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 255, 65, 0.3);
}

.toggle-container {
    border: 1px solid var(--primary-color);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-info {
    font-size: 0.75rem;
    /* 12px */
}

.toggle-title {
    font-weight: bold;
    margin-bottom: 0.25rem;
    letter-spacing: 0.1em;
}

.toggle-status {
    opacity: 0.7;
}

.highlight {
    color: #fff;
    /* White text creates the bright green impact against the text-shadow */
    text-shadow: 0 0 4px var(--primary-color);
    opacity: 1;
}

.hover-glow:hover {
    background-color: var(--primary-color);
    color: var(--bg-dark);
    text-shadow: none;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
}

.toggle-btn {
    font-size: 0.75rem;
    border: 1px solid var(--primary-color);
    padding: 0.25rem 0.5rem;
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

/* Footer Section */
footer {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.footer-content {
    font-size: 0.625rem;
    /* 10px */
    color: var(--primary-color);
    opacity: 0.6;
}

.essential-msg {
    letter-spacing: 0.5em;
    margin-bottom: 0.5rem;
}

.script-name {
    margin-bottom: 1rem;
}

.copy-info {
    font-size: 0.5rem;
    /* 8px */
    letter-spacing: -0.05em;
    line-height: 1.5;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
    }

    .system-status {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .hex-grid {
        display: none;
        /* Hide decorative hexes on small screens */
    }
}

/* -------------------- */
/* Gallery Page Styles  */
/* -------------------- */

.gallery-container {
    max-width: 1200px;
    opacity: 1;
    /* override fade-in if no js */
}

.gallery-header {
    display: grid;
    grid-template-columns: 100px 1fr 100px;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(0, 255, 65, 0.3);
    padding-bottom: 1rem;
    width: 100%;
}

.gallery-title-container {
    grid-column: 2;
    text-align: center;
}

.header-home-btn {
    grid-column: 1;
    width: 80px;
    height: 2rem;
    font-size: 0.75rem;
}


.gallery-title {
    font-size: 1.25rem;
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    text-shadow: 0 0 8px var(--primary-color);
}

.gallery-subtitle {
    font-size: 0.75rem;
    opacity: 0.7;
    letter-spacing: 0.1em;
}

.gallery-grid {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 3rem;
    width: 100%;
    align-items: flex-start;
}

.gallery-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}

.gallery-item {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    border: 1px solid rgba(0, 255, 65, 0.5);
    background: rgba(0, 255, 65, 0.05);
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    z-index: 60; /* Lift above body::before scanlines (z-index: 50) */
}

@media (max-width: 480px) {
    .gallery-header {
        grid-template-columns: 80px 1fr 80px;
        margin-bottom: 1.5rem;
    }
    .header-home-btn {
        width: 70px;
    }
}

@media (max-width: 360px) {
    .gallery-header {
        grid-template-columns: 60px 1fr 60px;
    }
    .header-home-btn {
        width: 60px;
        font-size: 0.65rem;
    }
}


.gallery-item:hover {
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Base style for the play icon */
/* Note: Original play-icon styles removed because user added custom project-specific styles at the bottom of the file */

.gallery-item img,
.gallery-item video {
    width: 100%;
    /* remove fixed height assumption from original grid */
    height: auto;
    object-fit: contain;
    /* ensures complete image is shown without cropping */
    max-height: 400px;
    /* limits extreme heights in justified rows */
    display: block;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(0, 255, 65, 0.3);
    /* Make inserted media match the green tint style */
    filter: grayscale(100%) contrast(150%) brightness(75%) sepia(50%) hue-rotate(100deg);
    /* completely disable CRT flicker for the individual picture */
    animation: none !important;
}

.gallery-item:hover img,
.gallery-item:hover video {
    filter: none;
    /* remove tint on hover */
    animation: none;
    /* ensure no CRT hover flicker */
}

@media (hover: none), (max-width: 768px) {
    .gallery-item.is-centered {
        box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
        border-color: var(--primary-color);
    }

    .gallery-item.is-centered img,
    .gallery-item.is-centered video {
        filter: none;
    }

    .gallery-item.is-centered .play-icon {
        border-color: var(--primary-color);
        box-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
    }

    .gallery-item.is-centered .play-icon::after {
        opacity: 1;
    }
}

.gallery-img-placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-linear-gradient(45deg,
            rgba(0, 255, 65, 0.05),
            rgba(0, 255, 65, 0.05) 10px,
            rgba(0, 0, 0, 0) 10px,
            rgba(0, 0, 0, 0) 20px);
    border: 1px solid rgba(0, 255, 65, 0.3);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: rgba(0, 255, 65, 0.6);
}

.gallery-caption {
    font-size: 0.75rem;
    text-align: center;
    word-break: break-all;
    padding: 0.25rem 0;
    letter-spacing: 0.05em;
    border-top: 1px dashed rgba(0, 255, 65, 0.3);
}

.gallery-back {
    margin-top: auto;
    max-width: 300px;
    align-self: center;
}

@media (max-width: 768px) {
    /* JS handles the column count dynamically via resize listener */
}

@media (max-width: 480px) {
    .gallery-grid {
        flex-direction: column;
    }
}

/* -------------------- */
/* Lightbox Styles      */
/* -------------------- */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    backdrop-filter: blur(5px);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-img,
.lightbox-video {
    position: relative;
    z-index: 10005; /* Lift above .lightbox (10000) */
    animation: none !important;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-video {
    width: 90vw;
    height: 50.625vw;
    /* 16:9 aspect ratio */
    max-height: 90vh;
    max-width: 160vh;
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
    background: #000;
    display: none;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: var(--primary-color);
    font-size: 1.2rem;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 0.1em;
    transition: all 0.2s ease;
}

.lightbox-close:hover {
    color: #fff;
    text-shadow: 0 0 10px var(--primary-color);
}

/* Projects Specific */
.gallery-project {
    margin-bottom: 4rem;
    width: 100%;
}

.project-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed rgba(0, 255, 65, 0.4);
    letter-spacing: 0.1em;
    text-shadow: 0 0 8px var(--primary-color);
}

/* Video Containers */
.video-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(0, 255, 65, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 610; /* Lift above media (600) */
    transition: all 0.3s ease;
}

.gallery-item:hover .play-icon {
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
}

.play-icon::after {
    content: '';
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 14px solid var(--primary-color);
    margin-left: 3px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .play-icon::after {
    opacity: 1;
}

/* Video Preview Styles */
.video-preview-iframe {
    position: absolute;
    top: 1px;
    left: 1px;
    width: calc(100% - 2px);
    height: calc(100% - 2px);
    border: none;
    pointer-events: none;
    z-index: 605; /* Lift above media (600) */
    opacity: 0;
    transition: opacity 0.5s ease;
}

.video-container.preview-active .video-preview-iframe {
    opacity: 1;
}

.video-container.preview-active img,
.video-container.preview-active .play-icon {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Lightbox Navigation */
.lightbox-nav-container {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 2rem;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10001;
}

.lightbox-nav {
    color: var(--primary-color);
    font-family: var(--font-mono);
    font-size: 1.2rem;
    cursor: pointer;
    pointer-events: auto;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 65, 0.3);
    transition: all 0.2s ease;
    user-select: none;
}

.lightbox-nav:hover {
    color: #fff;
    background: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color);
    text-shadow: none;
}

@media (max-width: 768px) {
    .lightbox-nav-container {
        top: auto;
        bottom: 2rem;
        transform: none;
        justify-content: center;
        gap: 2rem;
    }
}
