/* --- CSS VARIABLES & RESET --- */
:root {
    /* Modern Gradient Color Palette for HR/Marketing */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-warm: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --gradient-cool: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);

    /* Solid Colors */
    --primary: #667eea;
    --primary-dark: #5568d3;
    --accent: #f5576c;
    --accent-dark: #e04458;
    --success: #00f2fe;
    --bg-dark: #0f0c29;
    --bg-darker: #0a0714;
    --bg-light: #f7f8fc;
    --bg-white: #ffffff;
    --text-main: #1a1a2e;
    --text-light: #ffffff;
    --text-muted: #6b7280;
    --text-accent: #667eea;

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);

    /* Shadows & Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 30px rgba(102, 126, 234, 0.4);
    --shadow-glow-accent: 0 0 30px rgba(245, 87, 108, 0.4);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    /* Transitions */
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

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

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

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-main);
    background: rgb(255, 255, 255);
    line-height: 1.7;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(245, 87, 108, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

h1,
h2,
h3,
h4 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-base);
}

ul {
    list-style: none;
}

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

/* --- LAYOUT UTILS --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.section {
    padding: 100px 0;
    position: relative;
}

.section-title {
    font-size: 2.75rem;
    margin-bottom: 60px;
    text-align: center;
    position: relative;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.8s ease-out;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 5px;
    background: var(--gradient-accent);
    margin: 20px auto 0;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(245, 87, 108, 0.5);
}

/* --- HEADER / HERO --- */
header {
    background: var(--gradient-hero);
    background-size: 200% 200%;
    animation: gradient 15s ease infinite;
    padding: 120px 0 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
    pointer-events: none;
}

header .container {
    position: relative;
    z-index: 1;
}

.hero-avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 30px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 8px rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(0, 0, 0, 0.1);
    background-color: #ddd;
    transition: var(--transition-slow);
    animation: float 6s ease-in-out infinite;
}

.hero-avatar:hover {
    transform: scale(1.05);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.4),
        0 0 0 12px rgba(255, 255, 255, 0.15),
        inset 0 0 30px rgba(0, 0, 0, 0.15);
}

.hero-name {
    font-size: 3.5rem;
    margin-bottom: 16px;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-subtitle {
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    margin-bottom: 40px;
    letter-spacing: 0.5px;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.btn {
    display: inline-block;
    padding: 16px 48px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-bounce);
    border: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(-1px) scale(1.02);
}

/* --- ABOUT --- */
#about {
    background: white;
    position: relative;
}

#about::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.about-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 50px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(245, 87, 108, 0.05));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
    backdrop-filter: blur(6px);
    animation: fadeInUp 0.8s ease-out;
    text-align: center;
}

.about-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 1.2rem;
}

.about-block {
    margin: 35px 0;
    padding-left: 10px;
    /* border-left: 4px solid var(--primary); */
}

.about-block h3 {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.about-block p {
    margin: 0;
    color: var(--text-muted);
}

/* --- SKILLS --- */
#skills {
    text-align: center;
    background: linear-gradient(135deg, #f7f8fc 0%, #ffffff 100%);
}

.skills-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
}

.skill-badge {
    background: white;
    padding: 14px 28px;
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    font-weight: 600;
    color: var(--text-main);
    border: 2px solid transparent;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.skill-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition-base);
    z-index: -1;
}

.skill-badge:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-lg);
    color: white;
}

.skill-badge:hover::before {
    opacity: 1;
}

/* --- BRANDS GALLERY --- */
#brands {
    background: white;
    position: relative;
}

.brands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    align-items: center;
    justify-items: center;
}

.brand-item {
    width: 100%;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffffff 0%, #f7f8fc 100%);
    border-radius: var(--radius-md);
    padding: 24px;
    cursor: pointer;
    transition: var(--transition-base);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.brand-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition-base);
    z-index: 0;
}

.brand-item:hover::before {
    opacity: 0.05;
}

.brand-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px) scale(1.02);
}

.brand-item img {
    max-height: 100%;
    opacity: 0.7;
    transition: var(--transition-base);
    position: relative;
    z-index: 1;
}

.brand-item:hover img {
    opacity: 1;
    transform: scale(1.1);
}

/* --- PROJECTS --- */
#projects {
    background: linear-gradient(135deg, #f7f8fc 0%, #e9ecf5 100%);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
}

/* Cuando hay un solo project-card, centrarlo */
.project-card:only-child {
    grid-column: 1 / -1;
    max-width: 400px;
    margin: 0 auto;
}

.project-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition-slow);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition-base);
}

.project-card:hover::before {
    transform: scaleX(1);
}

.project-card:hover {
    transform: translateY(-12px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.project-img {
    height: 240px;
    background: linear-gradient(135deg, #eee 0%, #f5f5f5 100%);
    object-fit: cover;
    width: 100%;
    transition: var(--transition-slow);
}

.project-card:hover .project-img {
    transform: scale(1.05);
}

.project-info {
    padding: 32px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-size: 1.5rem;
    margin-bottom: 12px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.project-desc {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    flex-grow: 1;
    line-height: 1.8;
}

.project-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 12px 28px;
    font-size: 0.9rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.3px;
    transition: var(--transition-base);
    cursor: pointer;
    width: fit-content;
    margin: 0 auto;
    text-decoration: none;
}

.project-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Glass Button Unified Style */
.btn-glass {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 12px 28px;
    font-size: 0.9rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: 0.3px;
    transition: var(--transition-base);
    cursor: pointer;
    width: fit-content;
    margin: 0 auto;
    text-decoration: none;
    border-width: 1px;
    border-style: solid;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

#contact .btn-glass {
    font-family: 'Inter', 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: rgba(123, 61, 154, 0.6);
}

/* --- CONTACT --- */
#contact {
    background: linear-gradient(180deg, #9B59B6 0%, #B77FD1 100%);
    background-size: 200% 200%;
    animation: gradient 15s ease infinite;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

#contact::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

#contact .container {
    position: relative;
    z-index: 1;
}

#contact .section-title {
    color: white;
    -webkit-text-fill-color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

#contact .section-title::after {
    background: white;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-size: 1.0rem;
    margin-bottom: 40px;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    background: rgba(123, 61, 154, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition-base);
    max-width: 500px;
    margin: 0 auto;
    font-weight: 700;
}

.contact-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.contact-item span {
    font-size: 1.0rem;
}

#contact .btn {
    padding: 12px 28px;
    font-size: 0.9rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: 0.3px;
    width: fit-content;
}

#contact .btn-small {
    padding: 12px 28px;
    font-size: 0.9rem;
}

#contact .btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.btn-small {
    padding: 12px 28px !important;
    font-size: 0.9rem !important;
    text-transform: capitalize !important;
    letter-spacing: 0.3px !important;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 40px;
}

.social-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-weight: 700;
    font-size: 1.1rem;
}

.social-icon:hover {
    background: white;
    color: var(--primary);
    transform: translateY(-8px) scale(1.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* --- FOOTER --- */
footer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 32px;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- LIGHTBOX --- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeInUp 0.3s ease-out;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.4s ease-out;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    user-select: none;
    transition: var(--transition-base);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg) scale(1.1);
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .hero-name {
        font-size: 2.5rem;
    }

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

    .section {
        padding: 60px 0;
    }

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

    .brands-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Centrar la última marca si es impar */
    .brand-item:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        max-width: 50%;
        margin: 0 auto;
    }

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

    .btn {
        padding: 14px 32px;
        font-size: 0.9rem;
    }

    .about-content {
        padding: 28px;
        font-size: 1.05rem;
    }
}

@media (max-width: 480px) {
    .hero-name {
        font-size: 2rem;
    }

    .hero-avatar {
        width: 140px;
        height: 140px;
    }

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

    .skill-badge {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* --- THEME TOGGLE (Dark Mode) --- */
/* Override variables for Dark Mode */
body.dark-mode {
    --bg-light: #161625;
    --bg-white: #1f1f35;
    --text-main: #e2e8f0;
    --text-muted: #a0aec0;
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 100%);
}

body.dark-mode .section-title {
    /* Brighter gradient for dark background */
    --gradient-primary: linear-gradient(135deg, #a5b4fc 0%, #c084fc 100%);
}

body.dark-mode .project-card,
body.dark-mode .brand-item,
body.dark-mode .skill-badge,
body.dark-mode #about,
body.dark-mode #brands,
body.dark-mode .project-card {
    background: var(--bg-white);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .brand-item {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .brand-item img {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

body.dark-mode .brand-item:hover img {
    opacity: 1;
}

body.dark-mode .project-img {
    opacity: 0.8;
}

body.dark-mode .contact-item,
body.dark-mode .social-icon {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

body.dark-mode .contact-item a {
    color: var(--text-main);
}

body.dark-mode .skill-badge {
    color: var(--text-main);
}

body.dark-mode .skill-badge:hover {
    color: #fff;
}

/* Toggle Button Styling */
.theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
    cursor: pointer;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    color: #fff;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(10deg);
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.3);
}

/* Dark mode state for button */
body.dark-mode .theme-toggle {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fbbf24;
}

.theme-icon {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.5s ease;
}

/* Animation for icon switch */
.theme-icon.sun {
    display: none;
}

.theme-icon.moon {
    display: block;
}

body.dark-mode .theme-icon.sun {
    display: block;
    animation: rotateIn 0.5s forwards;
}

body.dark-mode .theme-icon.moon {
    display: none;
}

@keyframes rotateIn {
    from {
        transform: rotate(-90deg) scale(0.5);
        opacity: 0;
    }

    to {
        transform: rotate(0) scale(1);
        opacity: 1;
    }
}

/* --- PROJECT MODAL --- */
.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.project-gallery-item {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    cursor: pointer;
}

.project-gallery-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* Ensure modal content scrolls if necessary */
/* Ensure modal content scrolls if necessary */
.project-modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

.project-modal.active {
    display: flex;
}

.project-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

.project-modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.project-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
    z-index: 10;
    color: var(--text-main);
}

.project-modal-close:hover {
    background: var(--primary);
    color: white;
    transform: rotate(90deg);
}

.project-modal-header {
    padding: 50px 60px 15px;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: relative;
    overflow: hidden;
}

.project-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
    pointer-events: none;
}

.project-modal-title {
    font-size: 2.5rem;
    margin-bottom: 0px;
    color: white;
    position: relative;
    z-index: 1;
}

.project-modal-subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.project-modal-body {
    padding: 40px 60px 60px;
}

.project-modal-media {
    width: 100%;
    min-height: 650px;
    /* Enough for phone frame + padding */
    height: auto;
    background: transparent;
    border-radius: var(--radius-md);
    overflow: visible;
    /* Don't crop the phone */
    margin-bottom: 40px;
    position: relative;
}

.project-modal-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-modal-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.project-modal-info {
    display: grid;
    gap: 35px;
}

.project-modal-section h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.project-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.project-objectives,
.project-services {
    display: grid;
    gap: 12px;
    padding-left: 0;
}

.project-objectives li,
.project-services li {
    padding-left: 30px;
    position: relative;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.project-objectives li::before {
    content: '🎯';
    position: absolute;
    left: 0;
    font-size: 1.1rem;
}

.project-services li::before {
    content: '✓';
    position: absolute;
    left: 0;
    font-size: 1.3rem;
    font-weight: bold;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.project-results {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(245, 87, 108, 0.05) 100%);
    padding: 30px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(102, 126, 234, 0.1);
}

.project-results h3 {
    margin-bottom: 25px;
}

.project-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.result-item {
    text-align: center;
    padding: 25px 20px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.result-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.result-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.result-label {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Modal Responsive */
@media (max-width: 768px) {
    .project-modal-content {
        max-height: 95vh;
        margin: 10px;
    }

    .project-modal-header {
        padding: 40px 30px 25px;
    }

    .project-modal-title {
        font-size: 1.8rem;
    }

    .project-modal-subtitle {
        font-size: 1rem;
    }

    .project-modal-body {
        padding: 30px 25px 40px;
    }

    .project-modal-media {
        /* height: 250px; Removed fixed height on mobile to let it grow */
        height: auto;
        min-height: 250px;
    }

    .project-modal-section h3 {
        font-size: 1.2rem;
    }

    .project-results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .result-value {
        font-size: 2rem;
    }

    .project-modal-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .project-modal-title {
        font-size: 1.5rem;
    }

    .project-results-grid {
        grid-template-columns: 1fr;
    }

    .project-modal-info {
        gap: 25px;
    }
}

/* --- CAROUSEL & PHONE FRAME --- */
.phone-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px 0;
}

.phone-frame {
    width: 280px;
    height: 580px;
    background: #1a1a1a;
    border-radius: 40px;
    box-shadow:
        0 0 0 3px #333,
        0 0 0 8px #1a1a1a,
        0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    padding: 12px;
    /* Use padding instead of border for the bezel */
    margin: 0 auto;
    flex-shrink: 0;
}

/* Notch */
.phone-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 25px;
    background: #000;
    border-radius: 0 0 16px 16px;
    z-index: 20;
    pointer-events: none;
}

.carousel-grid {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 24px;
    width: 100%;
    flex-wrap: wrap;
    /* Allow wrapping instead of scrolling */
    padding: 20px 0;
}

.carousel-container {
    position: relative;
    /* Changed to relative since phone-frame now uses padding */
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    border-radius: 28px;
}

.carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.carousel-slide {
    width: 100%;
    /* Ensure full width */
    min-width: 100%;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.carousel-media {
    max-width: 100%;
    /* Allow scaling down */
    max-height: 100%;
    /* Allow scaling down */
    width: auto;
    /* Maintain aspect ratio */
    height: auto;
    /* Maintain aspect ratio */
    object-fit: contain;
    object-position: center center;
}

/* Indicators */
.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s;
}

.carousel-dot.active {
    background: white;
    transform: scale(1.4);
}

/* --- HORIZONTAL CAROUSEL MODAL --- */
.horizontal-modal-media {
    width: 100%;
    min-height: 500px;
    height: auto;
    background: transparent;
    border-radius: var(--radius-md);
    overflow: visible;
    margin-bottom: 40px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.horizontal-carousel-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px 0;
}

.horizontal-carousel-frame {
    width: 850px;
    max-width: 95%;
    height: 480px;
    background: #f5f5f5;
    border-radius: 20px;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
}

.horizontal-carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    border-radius: 20px;
}

.horizontal-carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.horizontal-carousel-slide {
    width: 100%;
    min-width: 100%;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.horizontal-carousel-media {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center center;
}

@media (max-width: 1100px) {
    .carousel-grid {
        flex-direction: column;
        /* Stack vertically on smaller screens */
        gap: 40px;
    }

    .phone-frame {
        width: 260px;
        height: 540px;
        padding: 10px;
    }

    .horizontal-carousel-frame {
        height: 400px;
    }
}

@media (max-width: 480px) {
    .phone-frame {
        width: 240px;
        height: 480px;
        padding: 8px;
    }

    .project-modal-media {
        min-height: auto;
    }

    .horizontal-carousel-frame {
        height: 300px;
    }

    .horizontal-modal-media {
        min-height: 350px;
    }
}

.brands-note {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 40px;
    font-style: italic;
    animation: fadeInUp 0.8s ease-out;
}