html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #191970;
    /* Midnight Blue */
    --secondary-color: #C2B280;
    /* Sand/Wood */
    --accent-color: #25D366;
    /* WhatsApp Green */
    --text-color: #333;
    --text-muted: #666;
    --bg-light: #f9f9f9;
    --white: #ffffff;
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Open Sans', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 10px 40px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--white);
}

h1,
h2,
h3 {
    font-family: var(--font-heading);
    color: var(--primary-color);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

ul {
    list-style: none;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.section {
    padding: 30px 0 60px 0;
    /* Padding superior reducido para acercar el título */
    min-height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top: 1px solid #e0e0e0;
    /* Línea divisoria suave */
}

#hero {
    border-top: none;
}

.section-title {
    text-align: center;
    font-size: clamp(2rem, 5vw, 2.5rem);
    margin-bottom: 50px;
    position: relative;
    padding-bottom: 20px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--secondary-color);
}

/* Sticky Header Component */
.sticky-header-group {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    width: 100%;
    z-index: 9999 !important;
    background-color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.sticky-header-group.at-hero {
    background-color: #f5f5f5 !important;
    box-shadow: none;
}

.sticky-header-group.at-hero #header {
    background-color: transparent;
}

.sticky-header-group.at-hero .logo,
.sticky-header-group.at-hero .nav-list a {
    color: var(--primary-color);
}

.sticky-header-group.at-hero .logo-img {
    filter: brightness(0);
}

.sticky-header-group.at-hero .btn-nav {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: var(--white) !important;
}

.sticky-header-group.at-hero .bar {
    background-color: var(--primary-color) !important;
}

/* Top Bar */
.top-bar {
    background-color: #333;
    color: #eee;
    height: 35px;
    /* Fixed height for sticky calculation */
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    font-family: var(--font-body);
    transition: margin-top 0.3s ease, opacity 0.3s ease;
}

.top-bar.hidden {
    margin-top: -35px;
    opacity: 0;
    pointer-events: none;
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.contact-info span {
    margin-right: 20px;
}

.contact-info i,
.social-icons i {
    color: var(--secondary-color);
    margin-right: 8px;
}

.social-icons a {
    margin-left: 15px;
    font-size: 1rem;
}

.social-icons a:hover {
    color: var(--secondary-color);
}

/* Header */
#header {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 10px 0;
    background-color: var(--primary-color);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Oswald', sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 15px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.logo-img {
    height: 45px;
    /* Adjust height based on header padding */
    width: auto;
    object-fit: contain;
}

.logo .subtitle {
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: 300;
    color: var(--secondary-color);
    margin-left: 5px;
}

.nav-list {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-list a {
    color: var(--white);
    font-weight: 400;
}

.nav-list a:hover {
    color: var(--secondary-color);
}

.btn-nav {
    background-color: var(--white);
    color: var(--primary-color) !important;
    border: 2px solid var(--white);
    padding: 8px 20px;
    border-radius: 5px;
    font-weight: 700;
}

.btn-nav:hover {
    background-color: transparent;
    color: var(--white) !important;
}

/* Hero */
.hero {
    min-height: 100vh;
    background-color: var(--primary-color);
    background-image: url('hero_bg_new.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    padding-top: 65vh;
    padding-right: 15%;
    text-align: right;
    color: var(--white);
    transition: var(--transition);
}

@media (max-width: 991px) {
    .hero {
        align-items: center;
        padding-right: 0;
        text-align: center;
        padding-top: 55vh;
    }
}



.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3.5rem;
    color: var(--white);
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero p {
    font-size: 1.5rem;
    margin-bottom: 40px;
    font-weight: 300;
}

.btn-hero {
    background-color: #25D366;
    /* WhatsApp Green */
    color: var(--white);
    padding: 15px 30px;
    font-size: 1.2rem;
    border-radius: 50px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Asegura centrado del texto */
    gap: 10px;
    animation: btnPulse 2s infinite 1.6s;
    /* Starts after fadeInUp */
    text-decoration: none;
    transition: all 0.3s ease;
    opacity: 0;
    /* Base state for fadeInUp */
}

@keyframes btnPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

.btn-hero:hover {
    background-color: #1a9e4d;
    color: var(--white);
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    animation: none;
    opacity: 1 !important;
}

/* Bio */
.bio-section {
    background-color: #fdfdfd;
    /* Gris extremadamente suave sugerido */
}

.bio-container {
    display: flex;
    align-items: flex-start;
    gap: 60px;
    max-width: 1100px;
    margin: 0 auto;
}

.bio-image {
    flex: 0 0 320px;
    position: sticky;
    top: 150px;
    /* Aligned with sticky header */
}

.bio-image img {
    width: 100%;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 5px solid var(--white);
}

.bio-text {
    flex: 1;
    text-align: left;
    font-size: clamp(1rem, 2vw, 1.1rem);
    line-height: 1.8;
    color: #444;
}

.bio-text p {
    margin-bottom: 25px;
}

.bio-text strong {
    color: var(--primary-color);
    font-weight: 600;
}

@media (max-width: 991px) {
    .bio-container {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    .bio-image {
        position: static;
        flex: 0 0 auto;
        max-width: 300px;
    }

    .bio-text {
        text-align: center;
    }
}

/* Services */
.services-section {
    background-color: var(--bg-light);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--white);
    padding: 2.5rem 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 4px solid var(--secondary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.service-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.service-card:hover i {
    color: var(--secondary-color);
    transform: scale(1.1);
}

.service-card h3 {
    margin-bottom: 1rem;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
}

.service-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    flex-grow: 1;
    margin-bottom: 20px;
}

/* FAQ Accordion */
.faq-accordion {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--white);
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #eee;
    transition: all 0.3s ease;
}

.faq-item:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.faq-header {
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background-color: var(--white);
    transition: background-color 0.3s ease;
}

.faq-header h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 600;
}

.faq-header i {
    font-size: 0.9rem;
    color: var(--secondary-color);
    transition: transform 0.3s ease;
}

.faq-content {
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0, 1, 0, 1);
    background-color: #fafafa;
}

.faq-content p {
    padding: 20px 25px;
    margin: 0;
    line-height: 1.7;
    color: #555;
    font-size: 1rem;
}

/* Active State */
.faq-item.active .faq-header {
    background-color: #f8f9fa;
}

.faq-item.active .faq-header i {
    transform: rotate(45deg);
    color: #e74c3c;
    /* Indicar cierre */
}

.faq-item.active .faq-content {
    max-height: 1000px;
    transition: all 0.4s cubic-bezier(1, 0, 1, 0);
}

/* Contact */
.contact-section {
    background-color: var(--white);
}

.contact-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: 700;
    color: var(--primary-color);
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: var(--font-body);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-submit {
    background-color: #25D366;
    /* WhatsApp Green */
    color: var(--white);
    padding: 15px;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-submit:hover {
    background-color: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 40px 0;
    text-align: center;
}

.social-links {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.social-links a {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.social-links a:hover {
    color: var(--white);
}

/* WhatsApp Float */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #25d366;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: transform 0.3s ease;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(37, 211, 102, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

.whatsapp-float:hover {
    transform: scale(1.1);
    animation: none;
}

/* Testimonials Section Styles */
.testimonials-section {
    background-color: var(--bg-light);
}

.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.testimonial-card {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: transform 0.3s ease;
}

.testimonial-card:hover {
    transform: translateY(-5px);
}

.stars {
    color: #f1c40f;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.testimonial-card p {
    font-style: italic;
    color: #555;
    margin-bottom: 20px;
    font-size: 1rem;
}

.client-name {
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

/* Logos Section */
.logos-section {
    background-color: #fcfcfc;
    padding: 60px 0;
    border-top: 1px solid #eee;
}

.logos-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
    gap: 40px;
}

@media (max-width: 768px) {
    .logos-container {
        grid-template-columns: 1fr;
        gap: 50px;
    }
}

.logo-item {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-item img {
    height: auto;
    width: 100%;
    max-width: 180px;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.6;
    transition: var(--transition);
    margin: 0 auto;
}

.logo-item img:hover {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.05);
}

/* Logo del Colegio de Abogados siempre en color */
.logo-colegio {
    filter: grayscale(0%) !important;
    opacity: 1 !important;
}





/* Mobile Nav */
.hamburger {
    display: none;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 10px;
}

.bar {
    display: block;
    width: 25px;
    height: 2px;
    margin: 6px 0;
    transition: var(--transition);
    background-color: var(--white);
    border-radius: 2px;
}

.hamburger.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Media Queries */

/* Tablets (1024px and below) */
@media (max-width: 1024px) {
    .container {
        width: 92%;
    }

    .hero h1 {
        font-size: 2.8rem;
    }

    .services-grid,
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

/* Mobile Devices (768px and below) */
@media (max-width: 768px) {
    html {
        scroll-padding-top: 70px;
        /* Alineado con el header fixed */
    }

    .section {
        padding: 50px 0;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 25px;
    }

    .top-bar {
        display: none;
        /* Ocultar barra de contacto superior en móviles */
    }

    .sticky-header-group {
        position: fixed !important;
        top: 0 !important;
        left: 0;
        width: 100% !important;
        z-index: 9999 !important;
        background-color: var(--primary-color);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        overflow: hidden;
        /* Prevent horizontal scroll from inner elements */
    }

    .container {
        width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        max-width: 100vw;
        overflow: hidden;
    }

    .header-container {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    #header {
        padding: 10px 0;
    }

    .logo {
        font-size: 1.2rem;
    }

    .logo-img {
        height: 40px;
    }

    .hamburger {
        display: block;
        z-index: 3002;
        padding: 5px;
        cursor: pointer;
    }

    .bar {
        background-color: var(--white) !important;
        /* Forzar visibilidad */
    }

    .nav-list {
        position: fixed;
        left: -100%;
        top: 0;
        flex-direction: column;
        justify-content: center;
        background-color: var(--primary-color);
        width: 100%;
        height: 100vh;
        transition: 0.3s ease-in-out;
        z-index: 3001;
    }

    .nav-list.active {
        left: 0;
    }

    .nav-list li {
        margin: 15px 0;
    }

    .nav-list li a {
        font-size: 1.3rem;
        color: var(--white);
    }

    .hero {
        padding-top: 45vh;
        min-height: 55vh;
        /* Reduced height by ~20% as requested */
        display: flex;
        justify-content: center;
        align-items: center;
        padding-right: 0;
        background-size: 90% auto;
        /* Smaller image width */
        background-position: center 15%;
        background-repeat: no-repeat;
    }

    .hero h1 {
        font-size: clamp(1.5rem, 8vw, 2.2rem);
        line-height: 1.3;
        margin-bottom: 15px;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 25px;
        text-align: center;
        padding: 0 10px;
    }

    .btn-hero {
        width: calc(100% - 40px);
        /* Margen lateral en móvil */
        margin: 0 auto;
        padding: 18px 20px;
        font-size: 1.3rem;
        justify-content: center;
        box-sizing: border-box;
    }

    .bio-container {
        flex-direction: column;
        text-align: center;
    }

    .bio-image {
        width: 180px;
        margin: 0 auto 20px;
        position: static;
    }

    .services-grid,
    .testimonials-grid {
        grid-template-columns: 1fr;
    }

    .contact-form {
        padding: 0 10px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .logos-container {
        gap: 30px;
    }

    .logo-item img {
        height: 150px;
        width: 150px;
    }
}

/* Phones (480px and below) */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.6rem;
    }

    .logo span {
        font-size: 1rem;
    }

    .logo .subtitle {
        display: none;
    }

    .btn-hero {
        width: 100%;
        font-size: 0.9rem;
        padding: 15px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scroll Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hero Animations (On Load) */
.hero h1 {
    animation: fadeInUp 1s ease-out forwards;
}

.hero p {
    animation: fadeInUp 1s ease-out 0.3s forwards;
    /* Delay for subtitle */
    opacity: 0;
    /* Important: Start hidden for delay to work visually */
}

.btn-hero {
    animation: fadeInUp 1s ease-out 0.6s forwards;
}

/* Staggered Service Cards Animation */
.service-card {
    /* Existing styles remain, just ensure transition for hover matches */
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease, transform 0.5s ease;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 40px;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideIn 0.3s;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

#modalBody h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
}

#modalBody h3 {
    margin-top: 20px;
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.3rem;
}

#modalBody p {
    margin-bottom: 15px;
    line-height: 1.8;
}

#modalBody ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 20px;
}

#modalBody li {
    margin-bottom: 10px;
}

.clickable {
    cursor: pointer;
}

.btn-more {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 20px;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
}




@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}