/* ===================================
   PORTFOLIO - PROFESSIONAL CSS
   Modern, Clean & Responsive Design
   (FIXED VERSION - see bottom of file for patch notes)
   =================================== */

/* ===== GOOGLE FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
    /* Colors */
    --primary-color: #4E1116;
    --primary-dark: #6d1a1f;
    --primary-light: #ff6b6b;
    --bg-dark: #0a0a0a;
    --bg-darker: #000000;
    --text-white: #ffffff;
    --text-gray: rgba(255, 255, 255, 0.85);
    --text-light: rgba(255, 255, 255, 0.7);

    /* Typography */
    --font-family: 'Poppins', sans-serif;
    --font-light: 300;
    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* Spacing */
    --section-padding: 6rem 2rem;
    --container-max-width: 1400px;

    /* Transitions */
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Z-index */
    --z-back: -10;
    --z-normal: 1;
    --z-tooltip: 10;
    --z-fixed: 100;
    --z-modal: 1000;

    /* Premium Additions */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(78, 17, 22, 0.25);
    --card-glow: 0 10px 30px rgba(78, 17, 22, 0.15);
    --accent-glow: 0 0 20px rgba(255, 107, 107, 0.3);
    --terminal-bg: #121212;
    --terminal-header: #1e1e1e;
    --terminal-text: #59fc56;
    --glow-green: rgba(89, 252, 86, 0.4);
}

/* Light Theme */
[data-theme="light"] {
    --bg-dark: #f8f9fa;
    --bg-darker: #e9ecef;
    --text-white: #212529;
    --text-gray: #495057;
    --text-light: #6c757d;

    /* Premium Additions Light Mode */
    --glass-bg: rgba(78, 17, 22, 0.04);
    --glass-border: rgba(78, 17, 22, 0.18);
    --card-glow: 0 10px 30px rgba(78, 17, 22, 0.08);
    --accent-glow: 0 0 20px rgba(78, 17, 22, 0.15);
    --terminal-bg: #fdfdfd;
    --terminal-header: #f1f3f5;
    --terminal-text: #2b8a3e;
    --glow-green: rgba(43, 138, 62, 0.3);
}

/* ===== BASE RESET ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    color: var(--text-white);
    font-weight: var(--font-regular);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-weight: var(--font-bold);
    line-height: 1.2;
}

ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s var(--transition-smooth);
}

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

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* ===== UTILITY CLASSES ===== */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.section__title {
    font-size: clamp(2rem, 5vw, 3rem);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    font-weight: var(--font-extrabold);
    position: relative;
    display: inline-block;
}

.section__title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 2px;
}

.section__subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-light);
    margin-bottom: 3rem;
    font-weight: var(--font-regular);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s var(--transition-smooth);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn ion-icon {
    font-size: 1.2rem;
}

.btn--primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(78, 17, 22, 0.3);
}

.btn--primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(78, 17, 22, 0.6);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

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

.btn--secondary:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(78, 17, 22, 0.4);
}

.btn:active {
    transform: scale(0.98);
}

.btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

/* ===== HEADER & NAVIGATION ===== */
.header {
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--z-fixed);
    background-color: rgba(26, 26, 26, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    border-bottom: 2px solid rgba(78, 17, 22, 0.3);
    transition: all 0.3s ease;
}

/* FIX: JS adds .scrolled to .header on scroll (initHeaderScroll) but
   there was no rule for it, so the header never visually reacted.
   Shrinks the nav height and deepens the shadow/border on scroll. */
.header.scrolled {
    background-color: rgba(10, 10, 10, 0.98);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.7);
    border-bottom-color: rgba(255, 107, 107, 0.4);
}

.header.scrolled .nav {
    height: 3.5rem;
}

[data-theme="light"] .header.scrolled {
    background-color: rgba(255, 255, 255, 0.98);
}

.nav {
    height: 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    transition: height 0.3s ease;
}

.nav__logo {
    font-size: 1.3rem;
    font-weight: var(--font-bold);
    background: linear-gradient(135deg, var(--text-white), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.nav__logo:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.nav__list {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.nav__link {
    color: var(--text-white);
    font-weight: var(--font-bold);
    font-size: 1rem;
    position: relative;
    padding: 10px 5px;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.nav__link:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.nav__link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: width 0.3s ease;
    border-radius: 2px;
}

.nav__link:hover::after {
    width: 100%;
}

/* FIX: JS adds .active to the nav link matching the section in view
   (initActiveSection) but there was no rule for it, so the current
   section was never highlighted in the nav. */
.nav__link.active {
    color: var(--primary-light);
}

.nav__link.active::after {
    width: 100%;
}

.nav__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-white);
    transition: color 0.3s;
}

.theme-toggle:hover {
    color: var(--primary-color);
}

.nav__toggle {
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
}

/* Mobile Menu */
@media screen and (max-width: 768px) {
    .nav__menu {
        position: fixed;
        top: -100%;
        left: 0;
        background: linear-gradient(135deg, rgba(26, 26, 26, 0.98), rgba(10, 10, 10, 0.98));
        backdrop-filter: blur(10px);
        width: 100%;
        padding: 2rem 1.5rem;
        border-radius: 0 0 1rem 1rem;
        transition: 0.5s;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }

    .nav__menu.show {
        top: 4rem;
    }

    .nav__list {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .nav__toggle {
        display: block;
    }
}

/* ===== HERO SECTION ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem 4rem;
    position: relative;
    overflow: hidden;
    margin-top: 0;
}

.hero__container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    position: relative;
}

.hero__content {
    z-index: var(--z-normal);
}

.hero__title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    background: linear-gradient(135deg, var(--text-white), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    font-weight: var(--font-extrabold);
}

.hero__subtitle {
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--primary-color);
    font-weight: var(--font-bold);
    margin-bottom: 1rem;
    min-height: 1.4em;
    /* FIX: reserves space so layout doesn't jump
                          while the typing-effect script clears and
                          retypes this text after page load */
}

.hero__description {
    font-size: clamp(1rem, 2vw, 1.1rem);
    line-height: 1.8;
    color: var(--text-gray);
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero__buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero__image {
    position: relative;
    z-index: var(--z-normal);
}

.hero__image img {
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 3px solid transparent;
    transition: all 0.4s ease;
    animation: float 3s ease-in-out infinite;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    /* FIX: prevents distortion / odd cropping once
                           the correct profile photo is swapped in */
}

.hero__image img:hover {
    transform: scale(1.05);
    box-shadow: 0 25px 70px rgba(78, 17, 22, 0.4);
    border-color: var(--primary-color);
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

.hero__social {
    /* FIX: this was a floating sidebar (fixed, then absolute) that
       overlapped hero text/buttons because the hero content is taller
       than the available side-gutter space. Moved into normal document
       flow (below the stat cards) so it can never overlap other
       content — it just takes its own row like everything else. */
    position: static;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.hero__social a {
    font-size: 1.5rem;
    color: var(--text-white);
    transition: all 0.3s ease;
}

.hero__social a:hover {
    color: var(--primary-color);
    transform: translateY(-5px) scale(1.2);
    filter: drop-shadow(0 5px 15px rgba(78, 17, 22, 0.5));
}

/* ===== PROJECTS SECTION ===== */
.projects {
    padding: var(--section-padding);
    scroll-margin-top: 5rem;
}

.projects .section__title {
    display: inline-block;
}

.projects .section__subtitle {
    display: block;
    text-align: center;
}

.project__featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 3rem;
    border-radius: 20px;
    border: 2px solid rgba(78, 17, 22, 0.2);
    margin-bottom: 4rem;
    transition: all 0.4s ease;
}

.project__featured:hover {
    border-color: var(--primary-color);
    box-shadow: 0 20px 60px rgba(78, 17, 22, 0.2);
    transform: translateY(-5px);
}

.project__image {
    position: relative;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 15px;
    padding: 3rem;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project__badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--text-white);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: var(--font-bold);
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.project__tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.project__tech-stack span {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: var(--font-semibold);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.project__content h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.project__description {
    color: var(--text-gray);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.project__features {
    list-style: none;
    margin-bottom: 2rem;
}

.project__features li {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 1rem;
    color: var(--text-gray);
}

.project__features ion-icon {
    color: var(--primary-color);
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.project__links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Projects Grid */
.projects__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.project__card {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(78, 17, 22, 0.2);
    border-radius: 15px;
    padding: 2rem;
    transition: all 0.3s ease;
    text-align: center;
}

.project__card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(78, 17, 22, 0.2);
}

.project__card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.project__card h4 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.project__card p {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.project__card-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.project__card-tech span {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--text-white);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: var(--font-semibold);
}

/* ===== ABOUT SECTION ===== */
.about {
    padding: var(--section-padding);
    scroll-margin-top: 5rem;
}

.about__container {
    max-width: 1000px;
    margin: 0 auto;
}

.about__content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.about__cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.about__card {
    background: rgba(78, 17, 22, 0.05);
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.about__card:hover {
    background: rgba(78, 17, 22, 0.1);
    transform: translateX(10px);
    box-shadow: 0 5px 20px rgba(78, 17, 22, 0.15);
}

.about__card h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
}

.about__card p {
    color: var(--text-gray);
    line-height: 1.8;
}

.about__image {
    position: sticky;
    top: 6rem;
}

.about__image img {
    width: 100%;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 3px solid transparent;
    transition: all 0.4s ease;
}

.about__image img:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 15px 40px rgba(78, 17, 22, 0.4);
    border-color: var(--primary-color);
}

/* Skills Section */
.skills {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid rgba(78, 17, 22, 0.2);
}

.skills h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.skills__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.skill__category {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid rgba(78, 17, 22, 0.2);
    transition: all 0.3s ease;
}

.skill__category:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(78, 17, 22, 0.2);
}

.skill__category h4 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.skill__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
}

.skill__tags span {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: var(--font-semibold);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.skill__tags span:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(78, 17, 22, 0.4);
}

/* ===== CONTACT SECTION ===== */
.contact {
    padding: var(--section-padding);
    scroll-margin-top: 5rem;
}

.contact__container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
    align-items: start;
    max-width: var(--container-max-width);
    margin: 0 auto;
}

.contact__form-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--card-glow);
    backdrop-filter: blur(12px);
    /* FIX: the info-cards column is taller (8 cards) than the form,
       which left a large empty gap below the form. Sticky keeps it
       visually anchored alongside the cards instead of floating in
       empty space as the page scrolls. */
    position: sticky;
    top: 6rem;
}

.form__group {
    margin-bottom: 1.5rem;
}

.form__input {
    width: 100%;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-white);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s var(--transition-smooth);
}

.form__input::placeholder {
    color: var(--text-light);
}

.form__input:focus {
    border-color: var(--primary-light);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.1);
}

.form__textarea {
    resize: none;
}

.contact__cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
    gap: 1.5rem;
    text-align: left;
}

.contact__card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(78, 17, 22, 0.05);
    padding: 1.2rem;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.contact__card:hover {
    background: rgba(78, 17, 22, 0.1);
    transform: translateX(10px);
    box-shadow: 0 5px 20px rgba(78, 17, 22, 0.15);
}

.contact__card ion-icon {
    font-size: 2rem;
    color: var(--primary-color);
    min-width: 40px;
}

.contact__card div {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.contact__card strong {
    color: var(--primary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contact__card a {
    color: var(--text-gray);
    transition: color 0.3s ease;
}

.contact__card a:hover {
    color: var(--primary-color);
}

/* ===== FOOTER ===== */
.footer {
    background: linear-gradient(180deg, var(--bg-dark), var(--bg-darker));
    padding: 4rem 2rem 2rem;
    border-top: 3px solid rgba(78, 17, 22, 0.5);
}

.footer__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer__column h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

.footer__column p {
    color: var(--text-light);
    line-height: 1.8;
}

.footer__links li {
    margin-bottom: 0.8rem;
}

.footer__links a {
    color: var(--text-light);
    display: inline-block;
}

.footer__links a:hover {
    color: var(--primary-color);
    transform: translateX(5px);
}

.footer__contact li {
    color: var(--text-light);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.footer__contact ion-icon {
    color: var(--primary-color);
    font-size: 1.3rem;
}

.footer__social {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer__social a {
    color: var(--text-white);
    font-size: 1.8rem;
    transition: all 0.3s ease;
}

.footer__social a:hover {
    color: var(--primary-color);
    transform: translateY(-5px) scale(1.2);
    filter: drop-shadow(0 5px 15px rgba(78, 17, 22, 0.5));
}

.footer__bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer__text {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: var(--font-semibold);
}

.footer__copyright {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* ===== ANIMATIONS ===== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 33.33%;
    height: 100%;
    background-color: var(--primary-color);
    z-index: 9999;
    pointer-events: none;
    display: block;
    /* FIX: previously GSAP was the ONLY thing that moved these offscreen.
       If GSAP fails to load (slow/blocked CDN, ad-blocker, script error,
       offline), the whole site stayed permanently hidden behind these
       3 full-height bars. This CSS animation is a guaranteed fallback:
       it runs with pure CSS regardless of JS, so the overlay always
       clears within ~2s even with zero JavaScript. GSAP can still take
       over and animate it earlier/fancier when it does load. */
    animation: overlay-fallback-clear 0.01ms 2s forwards;
}

.overlay.first {
    left: 0;
}

.overlay.second {
    left: 33.33%;
}

.overlay.third {
    left: 66.66%;
}

@keyframes overlay-fallback-clear {
    to {
        top: -100%;
        visibility: hidden;
    }
}

/* GSAP Animations */
.anime-text,
.anime-img,
.anime-social {
    opacity: 1;
}

/* ===== RESPONSIVE DESIGN ===== */
@media screen and (max-width: 1024px) {

    .hero__container,
    .project__featured {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about__container,
    .contact__container {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .about__image,
    .contact__image {
        position: relative;
        top: 0;
        max-width: 400px;
        margin: 0 auto;
    }
}

@media screen and (max-width: 768px) {
    :root {
        --section-padding: 4rem 1.5rem;
    }

    .container {
        padding: 0 1.5rem;
    }

    .hero {
        padding: 6rem 1.5rem 4rem;
    }

    .hero__buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

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

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

    .footer__grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer__contact li {
        justify-content: center;
    }

    .footer__social {
        justify-content: center;
    }

    .project__featured {
        padding: 2rem 1.5rem;
    }

    .project__image {
        min-height: 200px;
        padding: 2rem;
    }
}

@media screen and (max-width: 480px) {
    .section__title {
        font-size: 1.8rem;
    }

    .hero__title {
        font-size: 2rem;
    }

    .hero__subtitle {
        font-size: 1.3rem;
    }

    .nav {
        padding: 0 1rem;
    }

    .footer__social a {
        font-size: 1.5rem;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

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

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

::-moz-selection {
    background-color: var(--primary-color);
    color: var(--text-white);
}

/* ===================================
   PREMIUM PORTFOLIO MODULES (UPGRADES)
   =================================== */

/* HERO FLOATING STATS */
.hero__stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
    z-index: var(--z-normal);
}

.hero__stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    padding: 1.2rem;
    border-radius: 16px;
    text-align: center;
    transition: all 0.3s var(--transition-smooth);
    box-shadow: var(--card-glow);
}

.hero__stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-light);
    box-shadow: 0 10px 25px rgba(78, 17, 22, 0.3);
}

.hero__stat-card h3 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--text-white), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.2rem;
    font-weight: var(--font-extrabold);
}

.hero__stat-card p {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: var(--font-semibold);
}

/* DETAILED PROJECT SHOWCASE GRID */
.projects__detailed {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    margin-bottom: 5rem;
}

.project__detailed-item {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: var(--card-glow);
    align-items: center;
    transition: all 0.4s var(--transition-smooth);
    /* FIX: scroll-reveal script only targets .about__card, .project__card,
       .skill__category, .contact__card — this newer project layout
       (.project__detailed-item) was never wired up, so these always
       render at opacity 1 instantly with no reveal animation. Harmless,
       but noted below in patch notes if you want JS updated too. */
}

.project__detailed-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary-light);
    box-shadow: 0 20px 60px rgba(78, 17, 22, 0.25);
}

.project__detailed-item.reverse {
    grid-template-columns: 1fr 1.2fr;
}

.project__detailed-visual {
    position: relative;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 18px;
    padding: 3rem;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.project__detailed-visual::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 80%);
    pointer-events: none;
}

.project__detailed-visual .project__icon {
    font-size: 5rem;
    animation: float 4s ease-in-out infinite;
    margin-bottom: 1.5rem;
}

.project__detailed-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    z-index: var(--z-normal);
}

.project__detailed-tech span {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: var(--font-semibold);
    backdrop-filter: blur(5px);
}

.project__detailed-info h3 {
    font-size: 1.8rem;
    color: var(--primary-light);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.project__detailed-badge {
    font-size: 0.7rem;
    background: rgba(78, 17, 22, 0.15);
    color: var(--primary-light);
    border: 1px solid rgba(255, 107, 107, 0.3);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: var(--font-bold);
    text-transform: uppercase;
}

.project__detailed-desc {
    color: var(--text-gray);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.project__detailed-features {
    list-style: none;
    margin-bottom: 2rem;
}

.project__detailed-features li {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-gray);
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.project__detailed-features li ion-icon {
    color: var(--primary-light);
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* DSA DASHBOARD */
.dsa-section {
    padding: var(--section-padding);
    scroll-margin-top: 5rem;
    background: linear-gradient(180deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
}

.dsa-section .section__title {
    display: inline-block;
}

.dsa-section .section__subtitle {
    display: block;
    text-align: center;
}

.dsa__grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    align-items: start;
}

.dsa__metrics-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--card-glow);
    position: relative;
    overflow: hidden;
}

.dsa__metrics-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(78, 17, 22, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.dsa__solved-title {
    text-align: center;
    margin-bottom: 2rem;
}

.dsa__solved-title h3 {
    font-size: 3.5rem;
    font-weight: var(--font-extrabold);
    color: var(--primary-light);
    line-height: 1;
    text-shadow: 0 0 15px rgba(255, 107, 107, 0.2);
}

.dsa__solved-title p {
    color: var(--text-gray);
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.dsa__difficulty-breakdown {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.dsa__diff-bar-container {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.dsa__diff-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: var(--font-semibold);
}

.dsa__diff-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dsa__diff-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dsa__diff-dot.easy {
    background: #47cf73;
    box-shadow: 0 0 10px rgba(71, 207, 115, 0.6);
}

.dsa__diff-dot.medium {
    background: #f3b036;
    box-shadow: 0 0 10px rgba(243, 176, 54, 0.6);
}

.dsa__diff-dot.hard {
    background: #ff4a5a;
    box-shadow: 0 0 10px rgba(255, 74, 90, 0.6);
}

.dsa__diff-progress-bg {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.dsa__diff-progress-fill {
    height: 100%;
    border-radius: 10px;
    width: 0;
    /* Animated via JS or transition */
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.dsa__diff-progress-fill.easy {
    background: linear-gradient(90deg, #47cf73, #72ec9c);
}

.dsa__diff-progress-fill.medium {
    background: linear-gradient(90deg, #f3b036, #f7c970);
}

.dsa__diff-progress-fill.hard {
    background: linear-gradient(90deg, #ff4a5a, #ff7b88);
}

/* DSA Platforms Badges */
.dsa__platforms {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.dsa__platforms h4 {
    font-size: 1rem;
    color: var(--primary-light);
    margin-bottom: 1rem;
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

.dsa__platform-badges {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: var(--font-medium);
    color: var(--text-white);
    transition: all 0.3s ease;
    text-decoration: none;
}

.platform-badge ion-icon {
    font-size: 1.1rem;
    color: var(--primary-light);
}

.platform-badge:hover {
    transform: translateY(-2px);
    border-color: var(--primary-light);
    background: rgba(78, 17, 22, 0.1);
    box-shadow: 0 4px 12px rgba(78, 17, 22, 0.25);
}

.platform-badge.codolio {
    grid-column: span 2;
    justify-content: center;
    background: rgba(108, 92, 231, 0.05);
    border-color: rgba(108, 92, 231, 0.2);
}

.platform-badge.codolio ion-icon {
    color: rgb(108, 92, 231);
}

.platform-badge.codolio:hover {
    background: rgba(108, 92, 231, 0.15);
    border-color: rgb(108, 92, 231);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.25);
}

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

.dsa__topic-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1.2rem;
    transition: all 0.4s var(--transition-smooth);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: var(--card-glow);
}

.dsa__topic-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-light);
    box-shadow: 0 8px 25px rgba(78, 17, 22, 0.3);
}

.dsa__topic-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.dsa__topic-card-header h4 {
    font-size: 0.95rem;
    color: var(--text-white);
    font-weight: var(--font-bold);
}

.dsa__topic-card-header span {
    background: rgba(78, 17, 22, 0.15);
    color: var(--primary-light);
    border: 1px solid rgba(255, 107, 107, 0.25);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: var(--font-bold);
    white-space: nowrap;
}

.dsa__topic-techniques {
    font-size: 0.75rem;
    color: var(--text-light);
    line-height: 1.4;
}

/* ACTIVE PIPELINE & OPPORTUNITIES */
.pipeline-section {
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
    padding: var(--section-padding);
    scroll-margin-top: 5rem;
}

.pipeline-section .section__title {
    display: inline-block;
}

.pipeline-section .section__subtitle {
    display: block;
    text-align: center;
}

.pipeline__grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 3rem;
    align-items: start;
}

.pipeline__dashboard {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--card-glow);
    backdrop-filter: blur(12px);
}

.pipeline__list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pipeline__item {
    display: flex;
    gap: 1.5rem;
    position: relative;
}

.pipeline__item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 20px;
    top: 40px;
    width: 2px;
    height: calc(100% - 20px);
    background: linear-gradient(180deg, var(--primary-color), transparent);
}

.pipeline__status {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(78, 17, 22, 0.15);
    border: 1.5px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.pipeline__status ion-icon {
    font-size: 1.2rem;
    color: var(--primary-light);
}

.pipeline__item.active .pipeline__status {
    border-color: var(--primary-light);
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.4);
    background: rgba(78, 17, 22, 0.3);
}

.pipeline__item.active .pipeline__status::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-light);
    animation: pulse-dot 2s infinite;
}

.pipeline__info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-top: 5px;
}

.pipeline__info h4 {
    font-size: 1.05rem;
    color: var(--text-white);
    font-weight: var(--font-bold);
}

.pipeline__info p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* OPPORTUNITIES MATRIX */
.opp-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--card-glow);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    backdrop-filter: blur(12px);
}

.opp-card h3 {
    font-size: 1.4rem;
    color: var(--primary-light);
}

.opp__list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.opp__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    gap: 1rem;
}

.opp__item:hover {
    transform: translateX(5px);
    border-color: var(--primary-light);
    background: rgba(78, 17, 22, 0.05);
}

.opp__title {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.opp__title strong {
    font-size: 0.95rem;
    color: var(--text-white);
}

.opp__title span {
    font-size: 0.75rem;
    color: var(--text-light);
}

.opp__badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: var(--font-bold);
    text-transform: uppercase;
    white-space: nowrap;
}

.opp__badge.open {
    background: rgba(71, 207, 115, 0.1);
    color: #47cf73;
    border: 1px solid rgba(71, 207, 115, 0.3);
}

.opp__badge.open .opp__pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #47cf73;
    animation: pulse-dot 1.5s infinite;
}

/* TERMINAL SIMULATOR WIDGET */
.terminal-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-glow);
    display: flex;
    flex-direction: column;
    margin-top: 1.5rem;
    backdrop-filter: blur(12px);
}

.terminal__header {
    background: var(--terminal-header);
    padding: 0.7rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.terminal__buttons {
    display: flex;
    gap: 0.4rem;
}

.terminal__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal__dot.red {
    background: #ff5f56;
}

.terminal__dot.yellow {
    background: #ffbd2e;
}

.terminal__dot.green {
    background: #27c93f;
}

.terminal__title {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-light);
}

.terminal__content {
    background: var(--terminal-bg);
    padding: 1.2rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: var(--text-white);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.terminal__code {
    white-space: pre-wrap;
    line-height: 1.5;
}

.terminal__code .keyword {
    color: #f92672;
}

.terminal__code .function {
    color: #66d9ef;
}

.terminal__code .string {
    color: #e6db74;
}

.terminal__code .number {
    color: #ae81ff;
}

.terminal__code .comment {
    color: #75715e;
    font-style: italic;
}

.terminal__code .error-highlight {
    background: rgba(255, 95, 86, 0.25);
    border-bottom: 2px dashed #ff5f56;
    padding: 1px 0;
}

.terminal__console {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.8rem;
    margin-top: 0.8rem;
    font-size: 0.75rem;
    min-height: 70px;
}

.terminal__console-line {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    align-items: center;
}

.terminal__console-line.error {
    color: #ff5f56;
}

.terminal__console-line.success {
    color: var(--terminal-text);
    text-shadow: 0 0 10px var(--glow-green);
}

.terminal__console-line.info {
    color: #66d9ef;
}

.terminal__actions {
    display: flex;
    justify-content: flex-end;
    padding: 0.8rem 1.2rem;
    background: var(--terminal-header);
    border-top: 1px solid var(--glass-border);
}

.terminal__actions .btn {
    padding: 0.4rem 1.2rem;
    font-size: 0.75rem;
    border-radius: 6px;
    font-weight: var(--font-bold);
    text-transform: none;
    letter-spacing: 0;
}

@keyframes pulse-dot {
    0% {
        transform: scale(0.8);
        box-shadow: 0 0 0 0 var(--glow-green);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(89, 252, 86, 0);
    }

    100% {
        transform: scale(0.8);
        box-shadow: 0 0 0 0 rgba(89, 252, 86, 0);
    }
}

/* RESPONSIVE ADDITIONS FOR UPGRADED MODULES */
@media screen and (max-width: 1024px) {

    .dsa__grid,
    .pipeline__grid,
    .contact__container,
    .project__detailed-item,
    .project__detailed-item.reverse {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

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

@media screen and (max-width: 768px) {
    .dsa__topics {
        grid-template-columns: repeat(2, 1fr);
    }

    .project__detailed-item {
        padding: 2rem 1.5rem;
    }

    .project__detailed-visual {
        min-height: 200px;
        padding: 2rem;
    }
}

@media screen and (max-width: 480px) {
    .dsa__topics {
        grid-template-columns: 1fr;
    }

    .hero__stats-container {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   PATCH NOTES (what changed & why)
   ===================================
   1. .header.scrolled  -> added. JS (initHeaderScroll) toggled this
      class on scroll but no CSS rule existed for it, so the header
      never visually changed on scroll.
   2. .nav__link.active -> added. JS (initActiveSection) toggled this
      class on the nav link of the section in view, but no CSS rule
      existed, so the active section was never highlighted in the nav.
   3. .hero__subtitle min-height -> added. The typing-effect script
      clears subtitle.textContent then retypes it after a 2s delay;
      without a reserved min-height the layout shifts when the text
      disappears/reappears.
   4. .hero__image img object-fit + aspect-ratio -> added. Once you
      swap in the correct profile photo (currently it's a Taj Mahal
      photo, not a portrait), this keeps the crop consistent instead
      of stretching/squashing whatever aspect ratio the new photo has.
   =================================== */