/* ===========================================
   HD4N0 — Color Palette & Design System
   Fonts: Roboto family (Apache 2.0 License)
   =========================================== */

:root {
    --bg: #0a0a0f;
    --bg-alt: #0e0e16;
    --surface: #141420;
    --surface-hover: #1c1c2e;
    --border: rgba(196, 62, 62, 0.15);
    --border-subtle: rgba(255, 255, 255, 0.06);

    --primary: #c43e3e;
    --primary-light: #d95555;
    --primary-dark: #8b2020;
    --accent: #e8943a;
    --accent-light: #f0a855;
    --blue: #4a6fa5;
    --blue-light: #6b8fc5;
    --purple: #6b4a8a;

    --text: #e8e4e0;
    --text-secondary: #9a9498;
    --text-muted: #5a5560;

    --glow-primary: rgba(196, 62, 62, 0.4);
    --glow-accent: rgba(232, 148, 58, 0.3);

    --radius: 12px;
    --radius-lg: 20px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* === Container === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* === Loading Screen === */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.loading-screen.loaded {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
}

.loading-eye {
    animation: loading-rotate 4s linear infinite;
}

.eye-outer {
    animation: eye-pulse 2s ease-in-out infinite;
}

.eye-middle {
    animation: eye-pulse 2s ease-in-out infinite 0.3s;
}

.eye-pupil {
    animation: pupil-glow 2s ease-in-out infinite;
}

.eye-ray {
    opacity: 0;
    animation: ray-appear 2s ease-in-out infinite;
}

.eye-ray.r1 { animation-delay: 0s; }
.eye-ray.r2 { animation-delay: 0.25s; }
.eye-ray.r3 { animation-delay: 0.5s; }
.eye-ray.r4 { animation-delay: 0.75s; }
.eye-ray.r5 { animation-delay: 1s; }
.eye-ray.r6 { animation-delay: 1.25s; }
.eye-ray.r7 { animation-delay: 1.5s; }
.eye-ray.r8 { animation-delay: 1.75s; }

@keyframes loading-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes eye-pulse {
    0%, 100% { stroke-opacity: 0.4; }
    50% { stroke-opacity: 1; }
}

@keyframes pupil-glow {
    0%, 100% { filter: drop-shadow(0 0 4px var(--accent)); r: 8; }
    50% { filter: drop-shadow(0 0 16px var(--accent)); r: 10; }
}

@keyframes ray-appear {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.8; }
}

.loading-text {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.4em;
    color: var(--primary);
    margin-bottom: 2rem;
}

.loading-bar {
    width: 200px;
    height: 2px;
    background: var(--border);
    margin: 0 auto;
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    animation: loading-progress 1.5s ease-in-out infinite;
    border-radius: 2px;
}

@keyframes loading-progress {
    0% { width: 0; transform: translateX(0); }
    50% { width: 70%; }
    100% { width: 100%; transform: translateX(0); }
}

/* === Animations === */
.fade-in {
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in:nth-child(2) { transition-delay: 0.1s; }
.fade-in:nth-child(3) { transition-delay: 0.2s; }
.fade-in:nth-child(4) { transition-delay: 0.3s; }

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* === Buttons === */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: 'Roboto', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    opacity: 0;
    transition: opacity var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--glow-primary);
    color: white;
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary span,
.btn-primary svg {
    position: relative;
    z-index: 1;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Roboto', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary-light);
    background: rgba(196, 62, 62, 0.08);
    transform: translateY(-2px);
}

/* === Hero Section === */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 2rem;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(196, 62, 62, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(232, 148, 58, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(74, 111, 165, 0.05) 0%, transparent 50%);
}

.hero-particles {
    position: absolute;
    inset: 0;
}

.particle {
    position: absolute;
    width: var(--s);
    height: var(--s);
    background: var(--primary);
    border-radius: 50%;
    left: calc(var(--x) * 1%);
    top: calc(var(--y) * 1%);
    opacity: 0;
    animation: particle-float var(--d) ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.2s);
}

@keyframes particle-float {
    0%, 100% {
        opacity: 0;
        transform: translateY(0) scale(0);
    }
    25% {
        opacity: 0.6;
        transform: translateY(-20px) scale(1);
    }
    75% {
        opacity: 0.3;
        transform: translateY(-60px) scale(0.5);
    }
}

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

.hero-badge {
    display: inline-block;
    padding: 0.4rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 50px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-title {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: clamp(5rem, 15vw, 12rem);
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.hero-title-accent {
    color: var(--primary);
    text-shadow: 0 0 40px var(--glow-primary), 0 0 80px rgba(196, 62, 62, 0.2);
    position: relative;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    margin-bottom: 3rem;
    font-weight: 300;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
}

.scroll-line {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, var(--primary), transparent);
    animation: scroll-hint 2s ease-in-out infinite;
}

@keyframes scroll-hint {
    0%, 100% { opacity: 0; transform: scaleY(0); transform-origin: top; }
    50% { opacity: 1; transform: scaleY(1); }
}

/* === Section Styles === */
.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    font-weight: 300;
}

.section-action {
    text-align: center;
    margin-top: 3rem;
}

/* === Page Title === */
.page-title {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

/* === Stats Section === */
.stats-section {
    padding: 6rem 0;
    background: var(--bg-alt);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.stat-card {
    text-align: center;
    padding: 2rem;
}

.stat-number {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px var(--glow-primary);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* === Featured Section === */
.featured-section {
    padding: 8rem 0;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.featured-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}

.featured-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.featured-image-wrapper {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--surface);
}

.featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.featured-card:hover .featured-image {
    transform: scale(1.08);
}

.featured-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10, 10, 15, 0.8) 0%, transparent 50%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity var(--transition);
}

.featured-card:hover .featured-overlay {
    opacity: 1;
}

.featured-view {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text);
    border-bottom: 1px solid var(--primary);
    padding-bottom: 2px;
}

/* === Categories Section === */
.categories-section {
    padding: 6rem 0 8rem;
    background: var(--bg-alt);
    border-top: 1px solid var(--border-subtle);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-decoration: none;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(196, 62, 62, 0.05), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    color: var(--text);
}

.category-card:hover::before {
    opacity: 1;
}

.category-icon {
    color: var(--primary);
    margin-bottom: 1.5rem;
    transition: color var(--transition);
}

.category-card:hover .category-icon {
    color: var(--accent);
}

.category-name {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.category-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 300;
}

/* === Gallery Page === */
.gallery-page {
    padding: 2rem 0 6rem;
}

.gallery-header {
    text-align: center;
    margin-bottom: 3rem;
}

.filter-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 3rem;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.4rem;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 50px;
    color: var(--text-secondary);
    font-family: 'Roboto', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--text);
    background: var(--surface-hover);
}

.filter-btn--active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.filter-btn--active:hover {
    background: var(--primary-light);
    color: white;
}

.filter-count {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.filter-btn--active .filter-count {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    transition: opacity 0.3s ease;
}

.gallery-grid--transitioning {
    opacity: 0;
    transform: translateY(10px);
}

.gallery-item {
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}

.gallery-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.gallery-image-wrapper {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--surface);
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover .gallery-image {
    transform: scale(1.1);
}

.gallery-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: var(--accent);
    color: var(--bg);
    font-family: 'Roboto Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 4px;
    z-index: 2;
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
    color: white;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* === Lightbox === */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(5, 5, 8, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition), transform var(--transition);
    z-index: 10001;
}

.lightbox-close:hover {
    color: var(--primary);
    transform: rotate(90deg);
}

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    animation: lightbox-zoom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
}

.lightbox-info {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

@keyframes lightbox-zoom {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* === About Page === */
.about-page {
    padding: 2rem 0 8rem;
}

.about-header {
    text-align: center;
    margin-bottom: 4rem;
}

.about-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 4rem;
    align-items: start;
    margin-bottom: 4rem;
}

.about-avatar {
    position: relative;
}

.avatar-frame {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border);
    position: relative;
    z-index: 1;
    transition: border-color var(--transition);
}

.avatar-frame:hover {
    border-color: var(--primary);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.avatar-frame:hover .avatar-image {
    transform: scale(1.05);
}

.avatar-glow {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--glow-primary) 0%, transparent 70%);
    opacity: 0.3;
    animation: float 6s ease-in-out infinite;
    z-index: 0;
}

.about-name {
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.about-role {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    letter-spacing: 0.05em;
}

.about-description {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 2rem;
}

.about-description p + p {
    margin-top: 1rem;
}

.about-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.skill-tag {
    padding: 0.4rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.skill-tag:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    padding: 3rem;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: 3rem;
}

.about-stat {
    text-align: center;
}

.about-stat-number {
    display: block;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.about-stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.about-cta {
    text-align: center;
}

/* === Responsive === */
@media (max-width: 900px) {
    .about-content {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .about-skills {
        justify-content: center;
    }

    .about-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

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

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

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .page-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .filter-bar {
        gap: 0.3rem;
    }

    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

/* === Blazor Error UI === */
#blazor-error-ui {
    color-scheme: light only;
    background: var(--primary-dark);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.4);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
}

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

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

/* === Selection === */
::selection {
    background: var(--primary);
    color: white;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}
