/* ===== CSS Variables ===== */
:root {
    --accent: #0088ff;
    --accent-light: #33aaff;
    --accent-glow: rgba(0, 136, 255, 0.4);
    --accent-warm: #ff6b35;
    --accent-pink: #ff4d8d;
    --sunset-gradient: linear-gradient(135deg, #ff6b35 0%, #ff4d8d 50%, #0088ff 100%);
    --bg: #060d1f;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --text: #e8edf4;
    --text-muted: #7a8fa8;
    --border: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(0, 136, 255, 0.3);
    --footer-bg: #020810;
    --radius: 12px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Layering z-index scale */
    --z-bg-pattern: -2;
    --z-ambient-glow: -1;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ===== Layout ===== */
.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 6rem 4rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* ===== Top Navigation — Dark Glassmorphism ===== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(6, 13, 31, 0.75);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    border-bottom: 1px solid rgba(0, 136, 255, 0.15);
    transition: background var(--transition), box-shadow var(--transition);
}

/* Animated sunset gradient line at the bottom of the header */
.top-nav::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 136, 255, 0.6) 25%,
        rgba(255, 77, 141, 0.8) 50%,
        rgba(255, 107, 53, 0.6) 75%,
        transparent 100%);
    animation: navLine 4s ease-in-out infinite;
}

@keyframes navLine {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.top-nav.scrolled {
    background: rgba(6, 13, 31, 0.92);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.4), 0 0 40px rgba(0, 136, 255, 0.06);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent-warm) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.25rem 0;
    position: relative;
    transition: color var(--transition), text-shadow var(--transition);
}

.nav-link:hover {
    color: var(--text);
    text-shadow: 0 0 12px rgba(0, 136, 255, 0.6);
}

.nav-link.active {
    color: var(--accent-light);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-warm));
    border-radius: 1px;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Hamburger toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 1px;
    transition: transform var(--transition), opacity var(--transition), background var(--transition);
}

.nav-toggle:hover span {
    background: var(--accent-light);
}

.nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile overlay nav */
.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 13, 31, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.mobile-nav-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.mobile-nav-link {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: var(--accent);
}

/* ===== Hero Section ===== */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 70vh;
    padding: 4rem 0;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-headline {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent-light) 45%, var(--accent-warm) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 40px rgba(0, 136, 255, 0.2));
}

.hero-sub {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.hero-intro {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.8;
}

.hero-glow {
    position: absolute;
    top: -10%;
    right: -5%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 136, 255, 0.25) 0%, rgba(0, 136, 255, 0.05) 50%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: pulse 4s ease-in-out infinite;
}

/* ===== Page Sections ===== */
.page-section {
    padding: 2rem 0;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--sunset-gradient);
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(255, 107, 53, 0.5);
}

/* ===== About Page ===== */
.about-page {
    max-width: 900px;
}

.about-intro {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 3rem;
    max-width: 750px;
}

.about-section {
    margin-bottom: 3.5rem;
}

.section-heading {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

.about-section > p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Values grid */
.values-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.value-card {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
}

.value-card:hover {
    transform: translateY(-4px);
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    box-shadow: 0 8px 32px rgba(0, 136, 255, 0.15), 0 0 0 1px rgba(0, 136, 255, 0.1);
}

.value-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.value-card p {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-muted);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent), var(--accent-pink), var(--accent-warm));
    opacity: 0.5;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.25rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg);
    border: 3px solid var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.timeline-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.timeline-date {
    font-size: 0.82rem;
    color: var(--accent);
    font-weight: 600;
    display: block;
}

/* Skills section */
.skills-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.skill-group h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.about-personal p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-muted);
}

/* ===== Card Grid ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
}

.card:hover {
    transform: translateY(-6px);
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    box-shadow: 0 16px 48px rgba(0, 136, 255, 0.2), 0 0 0 1px rgba(0, 136, 255, 0.1);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-body {
    padding: 1.25rem;
    flex: 1;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.card-excerpt {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.card-tech {
    font-size: 0.85rem;
    color: var(--accent-light);
    margin-top: 0.75rem;
    font-weight: 500;
}

.card-tags {
    padding: 0 1.25rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ===== Tags ===== */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(0, 136, 255, 0.12);
    color: var(--accent-light);
    border: 1px solid rgba(0, 136, 255, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.tag:hover {
    background: rgba(0, 136, 255, 0.2);
    border-color: rgba(0, 136, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 136, 255, 0.2);
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
}

.skill-tag {
    padding: 0.4rem 1rem;
    background: rgba(0, 136, 255, 0.1);
    color: var(--accent-light);
    border: 1px solid rgba(0, 136, 255, 0.18);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.skill-tag:hover {
    background: rgba(0, 136, 255, 0.18);
    border-color: rgba(0, 136, 255, 0.35);
    box-shadow: 0 0 8px rgba(0, 136, 255, 0.18);
}

/* ===== Article/Detail Pages ===== */
.article-page {
    max-width: 800px;
}

.back-link {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1.5rem;
    transition: opacity var(--transition);
}

.back-link:hover {
    opacity: 0.7;
}

.article-hero {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    max-height: 400px;
    object-fit: cover;
}

.article-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.article-meta {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.tech-stack {
    color: var(--accent);
    font-weight: 500;
}

.article-body {
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.article-body h2, .article-body h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.article-body p {
    margin-bottom: 1rem;
}

.article-body img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 1.5rem 0;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.project-links {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, rgba(0, 119, 220, 1) 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 136, 255, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
    box-shadow: 0 6px 24px rgba(0, 136, 255, 0.5);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.btn-outline:hover {
    background: var(--accent);
    color: #fff;
}

/* ===== Utilities ===== */
.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
}

/* ===== Tech Grid Background ===== */
html::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: var(--z-bg-pattern);
    background-image:
        linear-gradient(rgba(0, 136, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 136, 255, 0.06) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* Floating circuit-node dots */
html::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: var(--z-bg-pattern);
    background-image:
        radial-gradient(circle, rgba(0, 136, 255, 0.12) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: 20px 20px;
    pointer-events: none;
}

/* Santa Monica ambient: sunset glow top-right merging into ocean depth bottom-left */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: var(--z-ambient-glow);
    background:
        radial-gradient(ellipse 60% 40% at 95% 0%, rgba(255, 107, 53, 0.13) 0%, transparent 65%),
        radial-gradient(ellipse 50% 40% at 0% 100%, rgba(0, 136, 255, 0.13) 0%, transparent 65%);
    pointer-events: none;
}

/* ===== Santa Monica Wave Divider ===== */
.wave-divider {
    width: 100%;
    overflow: hidden;
    line-height: 0;
    margin: 0;
}

.wave-divider svg {
    display: block;
    width: 100%;
    height: 48px;
}

.wave-divider .wave-fill {
    fill: var(--footer-bg);
}

/* ===== Footer ===== */
.site-footer {
    background: var(--footer-bg);
    color: rgba(255, 255, 255, 0.7);
    padding: 3rem 2rem 2rem;
    margin-top: auto;
    position: relative;
    overflow: hidden;
}

.site-footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* Sunset horizon glow at top of footer */
.site-footer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 107, 53, 0.5), rgba(255, 77, 141, 0.5), rgba(0, 136, 255, 0.5), transparent);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.footer-location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
}

.footer-location .location-icon {
    font-size: 1rem;
}

.footer-tagline {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.5rem;
    font-style: italic;
}

.footer-icons {
    display: flex;
    gap: 1.75rem;
    align-items: center;
}

.footer-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.footer-icon-item .icon-symbol {
    font-size: 1.5rem;
    line-height: 1;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.82rem;
}

.footer-copyright {
    color: rgba(255, 255, 255, 0.4);
}

.footer-signal {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.3);
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
}

.footer-signal .signal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    animation: signalPulse 2s ease-in-out infinite;
}

/* ===== Hero Enhancement — Sunset Accent ===== */
.hero-glow-warm {
    position: absolute;
    bottom: -20%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.2) 0%, rgba(255, 77, 141, 0.08) 40%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: pulse 5s ease-in-out infinite reverse;
}

/* ===== Animations ===== */
@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes signalPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .main-content {
        padding: 5rem 1.5rem 2rem;
    }

    .hero-glow {
        width: 300px;
        height: 300px;
        right: -15%;
    }

    .values-grid {
        grid-template-columns: 1fr;
    }

    .skills-section {
        grid-template-columns: 1fr;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .project-links {
        flex-direction: column;
    }

    .footer-top {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* ===== Error UI ===== */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: var(--radius);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* Loading progress */
.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}