:root {
    --primary-blue: #3A5FCD;
    --accent-color: #800020;
    --deep-blue: #004080;
    --high-contrast-blue: #4da6ff; /* Bright blue for readability on dark backgrounds */
    --gold-border: #D4AF37;
    --burgundy-accent: #800020;
    --burgundy-hover: #660019;
    --light-text: #E6E2DD;
    --soft-text: #E6E2DD;
    --dark-text: #2C241B;

    /* Frosted glass background for cards */
    --card-bg-dark: rgba(0, 0, 0, 0.3);
    --card-bg-light: rgba(255, 255, 255, 0.6);
}

/* Enable smooth scrolling for navbar clicks */
html {
    scroll-behavior: smooth;
    min-height: 100%;
}

body {
    background-color: #0d0d0d;
    /* Removed the background image from the body */
    color: var(--soft-text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
    margin: 0;
    padding: 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.site-content {
    flex: 1 0 auto;
    min-width: 0;
}

/* --- New Fixed Background Layer --- */
.fixed-bg {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    overflow: hidden;
    contain: paint;
    pointer-events: none;
    z-index: -1;
}

.fixed-bg__image {
    position: absolute;
    inset: 0;
    background-image: url('../img/davidBackground.jpeg');
    background-size: cover;
    background-position: center center;
    will-change: transform;
    animation: deepSpacePulse 12s infinite ease-in-out;
}

#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1; /* Sits above the image, below the rest of the site */
    pointer-events: none;
}

/* Base intro styling */
.intro {
    color: white;
    z-index: 3;
}

.hero-logo {
    width: 180px;
    filter: drop-shadow(0px 8px 12px rgba(0,0,0,0.6));
}

.hero-motto {
    font-size: 2.8rem;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
    max-width: 900px;
}

/* Regular Content Sections */
.content-section {
    width: 100%;
    min-height: 100vh;
    min-height: 100svh;
    padding: 100px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* !important prevents the background from ever turning black */
    background-color: transparent !important;
    scroll-margin-top: 70px;
}

.text-accent { color: var(--accent-color); }

/* Custom Card Styling */
.custom-card {
    background-color: rgba(31, 41, 55, 0.85);
    border: 1px solid var(--gold-border);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    transition: transform 0.3s ease;
}

#technology .custom-card {
    min-height: 450px;
}

.custom-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.4);
}

.card-img-container {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-img-container img {
    max-height: 100%;
    max-width: 100%;
    object-fit: cover;
}

.profile-img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border: 3px solid var(--deep-blue);
}

.section-title {
    border-bottom: 2px solid var(--gold-border);
    padding-bottom: 10px;
    margin-bottom: 30px;
}

.subsection-title {
    border-bottom: 2px solid var(--gold-border);
    padding-bottom: 10px;
    margin-left: auto;
    margin-right: auto;
    max-width: 300px; /* Forces the line to be narrower than the full section titles */
}

/* --- Admin Panel / Login --- */
#login {
    color: var(--light-text) !important;
    padding-top: 80px;
    min-height: 100vh;
}

#login label {
    color: var(--light-text) !important;
}

/* Navbar */
.custom-navbar {
    background-color: rgba(13, 13, 13, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 1050;
    width: 100%;
}

.custom-navbar .navbar-brand, .custom-navbar .nav-link {
    color: var(--light-text) !important;
}

.custom-navbar .nav-link:hover,
.custom-navbar .nav-link.active {
    color: var(--deep-blue) !important;
}


/* Footer */
footer {
    background-color: rgba(13, 13, 13, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--light-text);
    text-align: center;
    padding: 15px 0;
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    z-index: 10;
}

@media (max-width: 768px) {
    .hero-motto {
        font-size: 1.8rem;
    }
}

/* --- Navigation Active States --- */
.navbar-nav .nav-link {
    position: relative;
    transition: color 0.3s ease;
}

/* Use the accent color for active navigation text */
.navbar-nav .nav-link.active {
    color: var(--deep-blue) !important;
}

/* The accent underline */
.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0px;
    width: 100%;
    height: 2px;
    background-color: var(--deep-blue);
}

/* --- Icon & Link Hover Effects --- */
.hover-gold {
    color: #f8f9fa;
    transition: color 0.3s ease;
}

.hover-gold:hover {
    color: var(--accent-color) !important;
}

/* --- CodePen Side Navigation --- */
.section-navigate {
    position: fixed;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    z-index: 1031;
}

.section-navigate__items {
    position: relative;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* The vertical connecting line */
.section-navigate__items::before {
    content: '';
    width: 2px;
    height: 100%;
    background: linear-gradient(transparent 0, rgba(212, 175, 55, 0.3) 15%, rgba(212, 175, 55, 0.3) 85%, transparent);
    position: absolute;
    top: 0;
    left: 100%;
    transform: translateX(-10px);
    z-index: -1;
}

.section-navigate__items li {
    margin: 25px 0;
}

.section-navigate__link {
    text-decoration: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* The Navigation Dot */
.section-navigate__link::after {
    content: '\25CF';
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    margin-left: 15px;
    transition: all 0.3s ease;
}

/* Dot Hover and Active States */
.section-navigate__link:hover::after,
.section-navigate__link.active::after {
    color: var(--deep-blue);
    font-size: 22px;
}

/* The Section Name Label */
.section-navigate__name {
    color: white;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0;
    transition: all 0.3s ease;
    position: absolute;
    right: 35px;
    white-space: nowrap;
}

/* Only show the section name when the user physically hovers over the dot */
.section-navigate__link:hover .section-navigate__name {
    opacity: 1;
    color: var(--deep-blue);
}

/* Only hide cards on the main homepage sections so the login form stays visible */
#mission .custom-card,
#technology .custom-card,
#team .custom-card {
    opacity: 0;
}

/* --- Custom Animation Physics --- */

/* Slows Animate.css effects down to 70% speed (1.4 seconds) */
.slower-anim {
    --animate-duration: 1.4s;
}

/* Custom Flip Animation with 50% less wiggle */
@keyframes customFlipInY {
    from {
        transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
        animation-timing-function: ease-in;
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotate3d(0, 1, 0, -10deg);
        animation-timing-function: ease-in;
    }
    60% {
        transform: perspective(400px) rotate3d(0, 1, 0, 5deg);
        opacity: 1;
    }
    80% {
        transform: perspective(400px) rotate3d(0, 1, 0, -2.5deg);
    }
    to {
        transform: perspective(400px);
        opacity: 1;
    }
}

.custom-flip {
    animation-name: customFlipInY;
    animation-duration: 1.4s;
    animation-fill-mode: both;
    backface-visibility: visible !important;
}

/* --- Split-screen Portfolio --- */
.portfolio-body {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.portfolio-body .site-content {
    flex: 1 1 auto;
    min-height: 0;
}

.portfolio-body footer {
    display: none;
}

.split-container {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
    gap: 1rem;
    padding: 1rem;
}

.left-panel,
.right-panel {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    background: rgba(13, 13, 13, 0.7);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.left-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar {
    display: none;
}

.left-panel {
    flex: 3 1 60%;
    padding: clamp(1.5rem, 4vw, 4rem);
}

.right-panel {
    flex: 2 1 40%;
    padding: clamp(1.25rem, 2.5vw, 2.5rem);
}

.project-detail-content {
    width: min(100%, 960px);
    margin: 0 auto;
    animation: portfolioFadeIn 0.35s ease both;
}

.project-detail-content[hidden] {
    display: none;
}

.project-full-description {
    color: var(--light-text);
    font-size: 1.1rem;
    line-height: 1.8;
    white-space: pre-line;
}

.project-gallery {
    display: grid;
    gap: 1.25rem;
}

.project-gallery-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--gold-border);
    border-radius: 10px;
}

.project-list {
    display: grid;
    gap: 1rem;
}

.project-list-item {
    width: 100%;
    padding: 1.25rem;
    cursor: pointer;
    color: var(--light-text);
    text-align: left;
    background: rgba(13, 13, 13, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.project-list-item:hover,
.project-list-item:focus-visible {
    color: #ffffff;
    border-color: var(--gold-border);
    background: rgba(13, 13, 13, 0.85);
    transform: translateX(-4px);
    outline: none;
}

.project-list-item.active {
    color: #ffffff !important;
    border-color: var(--accent-color);
    background: var(--accent-color);
}

.project-list-name,
.project-list-snippet {
    display: block;
}

.project-list-name {
    margin-bottom: 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.project-list-snippet {
    color: var(--soft-text);
    font-size: 0.95rem;
    line-height: 1.5;
}

.portfolio-empty-state {
    display: grid;
    min-height: 100%;
    place-content: center;
    text-align: center;
}

@keyframes portfolioFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .split-container {
        flex-direction: column;
    }

    .left-panel {
        flex: 3 1 60%;
    }

    .right-panel {
        flex: 2 1 40%;
    }
}

@keyframes deepSpacePulse {
    0%, 100% { opacity: 1; filter: brightness(1); }
    50% { opacity: 0.75; filter: brightness(1.15); }
}

.btn-warning, .bg-warning {
    background-color: var(--burgundy-accent) !important;
    color: #ffffff !important;
    border: none !important;
}

.btn-warning:hover {
    background-color: var(--burgundy-hover) !important;
    color: #ffffff !important;
}

.btn-outline-warning {
    color: var(--burgundy-accent) !important;
    border-color: var(--burgundy-accent) !important;
}

.btn-outline-warning:hover {
    background-color: var(--burgundy-accent) !important;
    border-color: var(--burgundy-accent) !important;
    color: #ffffff !important;
}

.text-warning {
    color: var(--high-contrast-blue) !important;
}

.border-warning {
    border-color: var(--accent-color) !important;
}

.navbar-brand strong {
    font-size: 1.8rem;
}

.navbar-nav .nav-link {
    font-size: 1.15rem;
}

/* White outline button on the active card */
.project-list-item.active .btn-outline-warning {
    color: #ffffff !important;
    border-color: #ffffff !important;
}

/* Use the gold accent on hover while retaining high-contrast text */
.project-list-item.active .btn-outline-warning:hover {
    background-color: var(--gold-border) !important;
    border-color: var(--gold-border) !important;
    color: #ffffff !important;
}
