/* ============================================
   PROFESSIONAL PORTFOLIO REDESIGN
   Global visual system applied after legacy CSS
   ============================================ */

:root {
    --color-bg-primary: #0e1116;
    --color-bg-secondary: #141922;
    --color-bg-tertiary: #1b2230;
    --color-surface: #171d27;
    --color-surface-strong: #202838;

    --color-text-primary: #f7f8fb;
    --color-text-secondary: #c6cedb;
    --color-text-muted: #8994a7;
    --color-border: rgba(198, 206, 219, 0.18);

    --color-primary: #32d6a0;
    --color-secondary: #ffb454;
    --color-accent: #6fb7ff;
    --color-accent-primary: var(--color-primary);
    --color-accent-secondary: var(--color-secondary);
    --color-btn-text: #0d1117;

    --glass-bg: rgba(23, 29, 39, 0.86);
    --glass-border: var(--color-border);
    --glass-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
    --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 16px 34px rgba(0, 0, 0, 0.22);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.28);
    --shadow-glow: 0 0 0 4px rgba(50, 214, 160, 0.14);

    --gradient-primary: linear-gradient(135deg, #32d6a0 0%, #ffb454 100%);
    --gradient-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
    --gradient-border: linear-gradient(135deg, rgba(50, 214, 160, 0.35), rgba(255, 180, 84, 0.12));

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 8px;
    --radius-2xl: 8px;
    --container-max-width: 1180px;
    --section-padding: 5rem;
}

[data-theme="light"] {
    --color-bg-primary: #f6f9ff;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #eaf2ff;
    --color-surface: #ffffff;
    --color-surface-strong: #eef5ff;

    --color-text-primary: #0b1220;
    --color-text-secondary: #27364d;
    --color-text-muted: #64748b;
    --color-border: rgba(37, 99, 235, 0.18);

    --color-primary: #2563eb;
    --color-secondary: #06b6d4;
    --color-accent: #7c3aed;
    --color-accent-primary: var(--color-primary);
    --color-accent-secondary: var(--color-secondary);
    --color-btn-text: #ffffff;

    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: var(--color-border);
    --glass-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
    --shadow-glow: 0 0 0 4px rgba(37, 99, 235, 0.14);
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    --gradient-surface: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(246, 249, 255, 0.96));
    --gradient-border: linear-gradient(135deg, rgba(37, 99, 235, 0.32), rgba(6, 182, 212, 0.16));
}

html {
    scroll-padding-top: 96px;
}

body {
    background:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        var(--color-bg-primary);
    background-size: 48px 48px;
}

[data-theme="light"] body {
    background:
        linear-gradient(rgba(37, 99, 235, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.055) 1px, transparent 1px),
        var(--color-bg-primary);
    background-size: 48px 48px;
}

.bg-animation {
    background:
        radial-gradient(circle at 50% 0%, rgba(50, 214, 160, 0.09), transparent 34rem),
        linear-gradient(180deg, var(--color-bg-primary), var(--color-bg-primary));
}

.bg-animation::before,
.bg-shape {
    display: none;
}

.container {
    width: min(100% - 2rem, var(--container-max-width));
    padding: 0;
}

.section {
    padding: var(--section-padding) 0;
}

.section-header {
    text-align: left;
    max-width: 760px;
    margin: 0 0 2.6rem;
}

.section-title,
.text-gradient {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--color-text-primary);
}

.section-title {
    font-size: clamp(2rem, 4vw, 3.8rem);
    letter-spacing: 0;
}

.section-title::after {
    content: "";
    display: block;
    width: 72px;
    height: 4px;
    margin-top: 18px;
    background: var(--gradient-primary);
    border-radius: 999px;
}

.section-subtitle {
    margin: 0;
    max-width: 680px;
    color: var(--color-text-secondary);
}

.navbar {
    top: 16px;
    width: min(100% - 2rem, 1220px);
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: var(--glass-shadow);
}

.navbar.scrolled {
    top: 0;
    width: 100%;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
}

.navbar .container {
    width: 100%;
    gap: 1rem;
}

.navbar-logo {
    margin-right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 38px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text-primary);
    -webkit-text-fill-color: currentColor;
}

.navbar-menu {
    gap: 4px;
}

.navbar-link {
    border-radius: 7px;
    padding: 10px 12px;
    font-size: 0.93rem;
}

.navbar-link:hover,
.navbar-link.active {
    background: var(--color-surface-strong);
    color: var(--color-text-primary) !important;
    box-shadow: none;
}

.navbar-link.active::after {
    bottom: 4px;
    width: 18px;
    height: 2px;
    background: var(--gradient-primary);
    box-shadow: none;
}

.theme-toggle,
.social-link {
    border-radius: 8px;
    background: var(--color-surface);
}

.btn {
    min-height: 44px;
    border-radius: 8px;
    padding: 0.78rem 1.05rem;
    box-shadow: none;
}

.btn:hover,
.social-link:hover,
.skill-badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--color-btn-text);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

.view-all-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.view-all-actions .btn {
    justify-content: center;
    text-align: center;
}

.section-header .view-all-actions {
    width: min(calc(100vw - 2rem), var(--container-max-width));
    max-width: var(--container-max-width);
}

.card,
.skill-category,
.contact-form,
.contact-item,
.stat-item {
    background: var(--gradient-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.card::before {
    display: none;
}

.card:hover,
.skill-category:hover {
    transform: translateY(-5px);
    border-color: rgba(50, 214, 160, 0.45);
    box-shadow: var(--shadow-md);
    background: var(--color-surface);
}

.card-image,
.news-grid img,
.news-grid video {
    border-radius: 6px;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: var(--color-bg-tertiary);
}

.card-title {
    font-size: clamp(1.25rem, 2vw, 1.55rem);
    letter-spacing: 0;
}

.card-description {
    color: var(--color-text-secondary);
}

.card-tag,
.skill-badge,
.timeline-date,
.badge-date {
    border: 1px solid rgba(50, 214, 160, 0.2);
    border-radius: 999px;
    background: rgba(50, 214, 160, 0.1);
    color: var(--color-primary);
}

[data-theme="light"] .card-tag,
[data-theme="light"] .skill-badge,
[data-theme="light"] .timeline-date,
[data-theme="light"] .badge-date {
    border-color: rgba(37, 99, 235, 0.18);
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-primary);
}

.badge-category,
.category-badge {
    border-radius: 999px;
    background: var(--color-surface-strong) !important;
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

.hero {
    min-height: 92vh;
    padding-top: 9rem;
    background:
        linear-gradient(110deg, rgba(50, 214, 160, 0.12), transparent 42%),
        linear-gradient(180deg, transparent, rgba(255, 180, 84, 0.04));
}

.hero::before,
.hero::after {
    display: none;
}

.hero-content {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: clamp(2rem, 7vw, 5rem);
}

.hero-badge {
    border-radius: 999px;
    background: rgba(50, 214, 160, 0.1);
    color: var(--color-primary);
}

[data-theme="light"] .hero {
    background:
        linear-gradient(110deg, rgba(37, 99, 235, 0.14), transparent 42%),
        linear-gradient(180deg, transparent, rgba(6, 182, 212, 0.08));
}

[data-theme="light"] .hero-badge {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.22);
}

.hero-text h1 {
    font-size: clamp(3rem, 8vw, 5.6rem);
    line-height: 1.02;
    letter-spacing: 0;
}

.hero-text h2 {
    font-size: clamp(1.4rem, 3vw, 2.15rem);
    color: var(--color-text-secondary);
}

.hero-text .typing-text {
    color: var(--color-primary);
    border-right-color: var(--color-secondary);
}

.hero-text p {
    max-width: 660px;
    font-size: clamp(1rem, 1.6vw, 1.12rem);
}

.hero-image {
    animation: none;
}

.hero-image::before {
    content: "";
    position: absolute;
    inset: 16px -16px -16px 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    z-index: 0;
}

.hero-image img {
    border-radius: 8px !important;
    box-shadow: var(--shadow-lg);
}

.about,
.projects,
.contact,
.footer,
section[style*="var(--color-bg-secondary)"] {
    background: rgba(20, 25, 34, 0.72) !important;
}

[data-theme="light"] .about,
[data-theme="light"] .projects,
[data-theme="light"] .contact,
[data-theme="light"] .footer,
[data-theme="light"] section[style*="var(--color-bg-secondary)"] {
    background: rgba(255, 255, 255, 0.72) !important;
}

.about-content,
.contact-content {
    align-items: start;
}

.about-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-number {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--color-primary);
}

.collage-grid {
    gap: 8px;
}

.collage-item {
    border-radius: 8px;
}

.skills-grid {
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
}

.skill-category-title {
    align-items: flex-start;
}

.projects-grid,
.news-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.project-card,
.news-grid > .card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.project-card .card-links,
.news-grid .card-links,
.news-grid div[style*="display: flex"][style*="gap"] {
    margin-top: auto;
}

.timeline {
    padding-left: 2rem;
}

.timeline::before {
    background: linear-gradient(180deg, var(--color-primary), var(--color-secondary));
}

.timeline-item::before {
    background: var(--color-bg-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 5px rgba(50, 214, 160, 0.12);
}

[data-theme="light"] .timeline-item::before {
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12);
}

.contact-item:hover {
    transform: translateX(4px);
}

.contact-item-icon {
    border-radius: 8px;
    background: var(--gradient-primary);
    color: var(--color-btn-text);
}

.form-input,
.form-textarea {
    border-radius: 8px;
    background: var(--color-bg-primary);
    border-color: var(--color-border);
}

.footer-content {
    grid-template-columns: minmax(0, 1.4fr) 0.8fr 0.8fr;
}

.footer-bottom {
    text-align: left;
}

.view-all-actions {
    display: flex;
    align-items: center;
}

#projects-hero,
#news-hero,
#certificates-hero {
    min-height: 46vh !important;
    padding-top: 8.5rem !important;
    display: flex;
    align-items: end;
}

#projects-hero .section-header,
#news-hero .section-header,
#certificates-hero .section-header {
    margin-bottom: 0;
}

.news-grid > .card {
    padding: 0 !important;
    overflow: hidden;
}

.news-grid > .card > div:last-child,
.news-grid > .card > div[style*="padding"] {
    padding: 1.35rem !important;
}

.news-grid h2 {
    font-size: 1.35rem !important;
    line-height: 1.3 !important;
    letter-spacing: 0;
    font-weight: 700 !important;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-md) !important;
}

.news-grid p,
.news-grid li {
    color: var(--color-text-secondary) !important;
}

.news-grid [style*="font-size: 80px"] {
    color: var(--color-btn-text) !important;
}

@media (max-width: 1150px) {
    .navbar-menu {
        background: var(--color-bg-primary);
    }

    .navbar-link {
        font-size: 1.3rem;
    }
}

@media (max-width: 1024px) {
    .projects-grid,
    .news-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #updates-grid,
    #skills-grid {
        display: flex;
        grid-template-columns: none;
        gap: 1rem;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        overscroll-behavior-inline: contain;
        padding: 2px 0 1rem;
        -webkit-overflow-scrolling: touch;
    }

    #updates-grid .card,
    #skills-grid .skill-category {
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    #updates-grid .card {
        flex: 0 0 min(82vw, 360px);
        min-width: min(82vw, 360px);
        max-width: min(82vw, 360px);
    }

    #skills-grid .skill-category {
        flex: 0 0 min(80vw, 340px);
        min-width: min(80vw, 340px);
        max-width: min(80vw, 340px);
    }

    #updates-grid::-webkit-scrollbar,
    #skills-grid::-webkit-scrollbar {
        height: 8px;
    }

    #updates-grid::-webkit-scrollbar-track,
    #skills-grid::-webkit-scrollbar-track {
        background: var(--color-bg-tertiary);
        border-radius: 999px;
    }

    #updates-grid::-webkit-scrollbar-thumb,
    #skills-grid::-webkit-scrollbar-thumb {
        background: var(--gradient-primary);
        border-radius: 999px;
    }
}

@media (max-width: 768px) {
    :root {
        --section-padding: 3.4rem;
    }

    .container {
        width: min(100% - 1.25rem, var(--container-max-width));
    }

    .section-header {
        margin-bottom: 2rem;
    }

    .hero {
        min-height: auto;
        padding: 7.5rem 0 3.5rem;
    }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .hero-image {
        order: 0;
    }

    .hero-buttons {
        justify-content: flex-start;
    }

    .view-all-actions {
        justify-content: center;
        text-align: center;
        width: 100%;
    }

    .view-all-actions .btn {
        justify-content: center;
        width: min(100%, 320px);
    }

    .social-links {
        flex-wrap: wrap;
    }

    .about-stats,
    .projects-grid,
    .news-grid,
    .footer-content {
        grid-template-columns: 1fr;
    }

    .contact-content {
        grid-template-columns: 1fr;
    }

    #updates-grid .card {
        flex-basis: min(86vw, 340px);
        min-width: min(86vw, 340px);
        max-width: min(86vw, 340px);
    }

    #skills-grid .skill-category {
        flex-basis: min(84vw, 320px);
        min-width: min(84vw, 320px);
        max-width: min(84vw, 320px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
