:root {
    /* Colors */
    --primary: #0f172a;
    /* Deep Navy - Trust, Authority */
    --accent: #0284c7;
    /* Medical Blue - Vibrant, Clear */
    --accent-dark: #0369a1;
    /* Hover state */
    --text-dark: #1e293b;
    /* Main text */
    /* Secondary text */
    --bg-light: #e2e8f0;
    /* Darker (slate-200) for evident contrast */
    --bg-white: #ffffff;

    /* Animation Classes */
    --reveal-distance: 30px;
    --white: #ffffff;

    /* --- Spacing --- */
    --container-padding: 1.5rem;
    /* Reduced container padding */
    --section-padding: 3rem 1.5rem;
    /* Standard */
    --section-padding-mobile: 2rem 1rem;
    /* Compact mobile padding */

    /* Effects */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background-color: var(--bg-white);
}

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

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

ul {
    list-style: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary);
}

.section-title {
    font-size: 2.25rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 3rem;
}

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

.text-white {
    color: var(--white) !important;
}

/* --- Testimonials Carousel --- */
.carousel-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
    padding: 1rem 0;
}

.testimonials-track {
    display: flex;
    flex-wrap: nowrap;
    /* Force single row */
    gap: 1.5rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.testimonials-track::-webkit-scrollbar {
    display: none;
}

.testi-card {
    flex: 0 0 100%;
    /* Force 100% width per card */
    min-width: 100%;
    scroll-snap-align: center;
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 320px;
}

@media (min-width: 768px) {
    .testi-card {
        padding: 3rem;
    }
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.dot {
    width: 10px;
    height: 10px;
    background-color: #cbd5e1;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.dot.active {
    background-color: var(--primary);
    transform: scale(1.1);
}

.stars {
    color: #fbbf24;
    letter-spacing: 2px;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.testi-text {
    font-style: italic;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: 1.05rem;
}

.testi-author {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
    border-top: 1px solid var(--bg-light);
    padding-top: 1rem;
}

.author-avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.author-info strong {
    display: block;
    font-size: 0.95rem;
    color: var(--primary);
}

.author-info span {
    font-size: 0.8rem;
    color: var(--text-light);
}

.google-icon {
    width: 20px;
    height: 20px;
    margin-left: auto;
    opacity: 0.8;
}

/* --- Mobile Navigation --- */
#btn-mobile {
    display: none;
    /* Hidden on desktop */
}

#btn-mobile-close {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    /* Highest Z-index */
}

#btn-mobile-close i {
    width: 32px;
    height: 32px;
}

/* --- Buttons --- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--accent);
    color: var(--white);
    padding: 0.875rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    border: 2px solid var(--accent);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--accent-dark);
    border-color: var(--accent-dark);
    transform: translateY(-2px);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: transparent;
    color: var(--primary);
    padding: 0.875rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    border: 2px solid var(--primary);
    cursor: pointer;
}

.btn-outline:hover {
    background-color: var(--primary);
    color: var(--white);
}

/* --- Header --- */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-sm);
}

.header-container {
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 1px;
}

#nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

#menu {
    display: flex;
    gap: 2rem;
}

#menu a {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 1rem;
}

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

.mobile-only {
    display: none;
}

/* --- Hero Section --- */
#hero {
    padding-top: 140px;
    /* Header height + space */
    padding-bottom: 4rem;
    min-height: 60vh;
    /* Allowed to be shorter */
    max-height: 750px;
    /* Strict cap for large screens */
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-text h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.hero-text p {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    max-width: 500px;
}

.badge {
    display: inline-block;
    background: rgba(2, 132, 199, 0.1);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

.hero-image-wrapper {
    position: relative;
}

.hero-image-placeholder img {
    border-radius: var(--radius);
    /* Fancy shape effect could go here */
    box-shadow: 20px 20px 0px rgba(2, 132, 199, 0.1);
    max-height: 600px;
    /* Increased to allow more vertical space */
    object-fit: cover;
    object-position: top;
    /* Ensures the head is never cut off */
    width: 100%;
}

.hero-bg-accent {
    position: absolute;
    top: -10%;
    right: -5%;
    width: 50%;
    height: 100%;
    background: radial-gradient(circle, rgba(2, 132, 199, 0.05) 0%, rgba(255, 255, 255, 0) 70%);
    z-index: 1;
}

/* --- About Section --- */
.section-padding {
    padding: var(--section-padding);
}

.bg-light {
    background-color: var(--bg-light);
}

.bg-dark {
    background-color: var(--primary);
}

#sobre {
    padding-top: 1rem;
    /* Moved UP significantly */
}

/* Ensure title is separated from the photo */
#sobre .section-header {
    margin-bottom: 4rem;
    /* Increased spacing between Title and Photo */
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    align-items: center;
    /* Keeping text centered as requested */
}

.about-image img {
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.doctor-name {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary);
    line-height: 1.1;
}

.crm {
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.about-text {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.credentials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.credential-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.credential-item i {
    color: var(--accent);
    width: 24px;
    height: 24px;
}

.credential-item strong {
    display: block;
    font-size: 0.9rem;
    color: var(--primary);
}

.credential-item span {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* --- Differentials Section --- */
.differentials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.diff-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Subtle border */
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.diff-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

/* Accent top line for cards */
.diff-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

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

.diff-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: var(--shadow-md);
}

.diff-card h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.diff-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* --- Specialties Section --- */
.specialties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.icon-box {
    width: 50px;
    height: 50px;
    background: rgba(2, 132, 199, 0.1);
    color: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* --- Timeline Section --- */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 2px;
    background: var(--bg-light);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    padding-left: 2rem;
}

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

.timeline-dot {
    position: absolute;
    left: -21px;
    /* Adjust based on line width/padding */
    top: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--white);
    box-shadow: 0 0 0 2px var(--accent);
}

.timeline-content .year {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.5rem;
}

/* --- Contact Section --- */
.contact-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.contact-list {
    margin: 2rem 0;
}

.contact-list li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.contact-list i {
    color: var(--accent);
    flex-shrink: 0;
}

.contact-map {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

/* --- Footer --- */
footer {
    background: #0b1120;
    /* Very dark navy */
    color: #94a3b8;
    padding: 3rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-brand h4 {
    color: var(--white);
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

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

.social-links a {
    color: var(--white);
    transition: 0.3s;
}

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

.mt-4 {
    margin-top: 1.5rem;
}

/* --- WhatsApp Float --- */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--accent);
    /* Matches site theme instead of generic green */
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transition: transform 0.3s;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    background-color: var(--accent-dark);
}

/* --- Responsiveness --- */
@media (max-width: 968px) {
    .container {
        padding: 0 1.5rem;
    }

    /* Ensure padding on tablets */
    /* Tighter Mobile Section Padding */
    .section-padding {
        padding: 2rem 1rem;
        /* Compact mobile padding */
    }

    /* Reduce gap specifically between Specialties and Experience */
    #especialidades {
        padding-bottom: 1rem;
    }

    #experiencia .section-header {
        margin-bottom: 1rem;
    }

    /* Section Header Compact */
    .section-header {
        margin-bottom: 1.5rem;
        /* Reduced from default */
    }

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

    .section-subtitle {
        margin: 0 auto 1.5rem;
        /* Tighter */
        font-size: 1rem;
    }

    .hero-text p {
        margin: 0 auto 1rem;
        /* Very tight for hero */
    }

    .hero-text h1 {
        font-size: 2.8rem;
    }

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

    .hero-buttons {
        justify-content: center;
    }

    .section-subtitle {
        margin: 0 auto 2rem;
        /* Reduced from 3rem */
    }

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

    .about-image {
        margin-bottom: 2rem;
    }

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

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

    /* Mobile Menu */
    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }

    /* Fix Header Z-Index and Layout */
    header {
        height: 70px;
    }

    .header-container {
        height: 70px;
    }

    #btn-mobile {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
        z-index: 1001;
        /* Ensure above everything */
        position: relative;
    }

    #menu {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 100%;
        /* Full width for overlay feel */
        background: var(--white);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1000;
        padding-top: 60px;
        /* Space for close button */
    }

    #menu.active {
        transform: translateX(0);
    }

    #btn-mobile-close {
        position: absolute;
        top: 20px;
        right: 20px;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 1002;
        /* Above menu */
        font-size: 1.5rem;
    }

    /* Hero Mobile Fixes */
    #hero {
        padding-top: 100px;
        /* Less top padding for mobile to pull content up */
        min-height: auto;
        /* Let content grow naturally */
        height: auto;
        max-height: none;
        /* Remove desktop height cap */
        display: block;
        /* Stack content */
    }

    .hero-content {
        display: flex;
        flex-direction: column-reverse;
        /* Image on top, text below (or vice versa? keeping standardized) */
        /* Actually standard is text then image, but let's keep grid behavior or just block */
        gap: 2rem;
    }

    .hero-image-wrapper {
        margin-bottom: 2rem;
    }

    .hero-text h1 {
        font-size: 2rem;
        /* Smaller font to fit screen */
        line-height: 1.2;
    }

    .hero-buttons {
        flex-direction: column;
        /* Stack buttons */
        width: 100%;
    }

    .btn-primary,
    .btn-outline {
        width: 100%;
        /* Full width buttons */
        justify-content: center;
    }

    /* Fix image height on mobile */
    .hero-image-placeholder img {
        max-height: 350px;
        object-position: top;
    }
}

/* --- Scroll Reveal Animation --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animation for cards inside sections */
.reveal .diff-card,
.reveal .card {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.reveal.active .diff-card,
.reveal.active .card {
    opacity: 1;
    transform: translateY(0);
}

/* Specific Delays */
.hero-image-wrapper.reveal {
    transition-delay: 0.2s;
}

/* Hero image comes after text */
.about-content.reveal {
    transition-delay: 0.2s;
}

/* Text comes after photo in about */

/* Delays for "wave" effect */
.reveal.active .diff-card:nth-child(1) {
    transition-delay: 0.1s;
}

.reveal.active .diff-card:nth-child(2) {
    transition-delay: 0.3s;
}

.reveal.active .diff-card:nth-child(3) {
    transition-delay: 0.5s;
}

.reveal.active .card:nth-child(1) {
    transition-delay: 0.1s;
}

.reveal.active .card:nth-child(2) {
    transition-delay: 0.2s;
}

.reveal.active .card:nth-child(3) {
    transition-delay: 0.3s;
}

.reveal.active .card:nth-child(4) {
    transition-delay: 0.4s;
}

/* --- Mobile Fixes Refined --- */
@media (max-width: 768px) {

    /* Hide Hamburger when menu is open to prevent overlap */
    #menu.active~#btn-mobile {
        display: none;
    }

    /* Optimizing Hero for "Above the Fold" */
    #hero {
        padding-top: 85px;
        padding-bottom: 0rem;
        /* Removed bottom padding to bring "Sobre" closer */
    }

    /* Reduce gap */
    .hero-content {
        gap: 1rem;
    }

    /* Fix About Section Spacing & Size */
    #sobre {
        padding-top: 3rem;
        /* Increased back from 1.5rem to let it breathe */
    }

    .about-image {
        margin-bottom: 0rem !important;
        /* Reduced from 1.5rem to close the gap */
    }

    .doctor-name {
        font-size: 2.2rem;
        /* Increased from 2rem */
        font-weight: 700;
        margin-bottom: 0.5rem;
        line-height: 1.2;
        color: var(--primary);
    }

    .crm {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    /* Crop image to focus on face and save vertical space */
    .hero-image-placeholder img {
        height: 220px;
        /* Reduced to ~220px for a rectangular landscape look */
        max-height: 220px;
        object-fit: cover;
        object-position: top center;
        /* Focus on the face, crop the body */
        border-radius: var(--radius);
        width: 100%;
        box-shadow: var(--shadow-md);
    }

    /* Stack credentials one below other */
    .credentials-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Compacting Cards (Differentials & Specialties) */
    .diff-card,
    .card {
        padding: 1.5rem;
        /* Reduced from 2.5rem/2rem */
    }

    .diff-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 1rem;
    }

    .icon-box {
        width: 48px;
        height: 48px;
        margin-bottom: 1rem;
    }

    .diff-card h3,
    .card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .diff-card p,
    .card p {
        font-size: 0.9rem;
    }

    /* Force Rectangular Image on Mobile */
    .hero-image-placeholder,
    .hero-image-placeholder img {
        height: 250px !important;
        max-height: 250px !important;
        width: 100% !important;
        object-fit: cover !important;
        object-position: top center !important;
        border-radius: var(--radius);
    }
}