:root {
    --premium-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --premium-ring: rgba(129, 140, 248, 0.34);
    --premium-glow: rgba(99, 102, 241, 0.18);
}

/* Acabado óptico: conserva la identidad original, suma profundidad y precisión. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.022;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

.scroll-progress {
    background: var(--accent-gradient);
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.55);
    height: 2px;
    left: 0;
    position: fixed;
    top: 0;
    transform: scaleX(0);
    transform-origin: left center;
    width: 100%;
    z-index: 1100;
}

.experience-rail {
    align-items: flex-end;
    display: flex;
    flex-direction: column;
    gap: 13px;
    position: fixed;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900;
}

.experience-rail a {
    align-items: center;
    color: var(--text-color);
    display: flex;
    flex-direction: row-reverse;
    font-size: 0.62rem;
    font-weight: 700;
    gap: 9px;
    letter-spacing: 0.1em;
    text-decoration: none;
    text-transform: uppercase;
}

.experience-rail a::before {
    background: rgba(100, 116, 139, 0.38);
    border-radius: 99px;
    content: "";
    height: 6px;
    transition: background 300ms ease, box-shadow 300ms ease, height 420ms var(--premium-ease);
    width: 6px;
}

.experience-rail a span {
    opacity: 0;
    transform: translateX(7px);
    transition: opacity 280ms ease, transform 420ms var(--premium-ease);
}

.experience-rail a:hover span,
.experience-rail a:focus-visible span,
.experience-rail a[aria-current="true"] span {
    opacity: 1;
    transform: translateX(0);
}

.experience-rail a[aria-current="true"]::before {
    background: var(--secondary-color);
    box-shadow: 0 0 13px rgba(99, 102, 241, 0.6);
    height: 22px;
}

header {
    transition: background 300ms ease, box-shadow 300ms ease, transform 300ms ease;
}

header.is-scrolled {
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

.navbar-brand img {
    transform-origin: left center;
    transition: filter 300ms ease, transform 500ms var(--premium-ease);
}

.navbar-brand:hover img {
    transform: scale(1.025);
}

.nav-link {
    position: relative;
}

.nav-link::after {
    background: var(--accent-gradient);
    border-radius: 2px;
    bottom: 2px;
    content: "";
    height: 2px;
    left: 15px;
    position: absolute;
    right: 15px;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 420ms var(--premium-ease);
}

.nav-link:hover::after,
.nav-link[aria-current="true"]::after {
    transform: scaleX(1);
    transform-origin: left;
}

.btn-consult,
.btn-hero-secondary {
    isolation: isolate;
    overflow: hidden;
    position: relative;
}

.btn-consult::before,
.btn-hero-secondary::before {
    background: linear-gradient(105deg, transparent 25%, rgba(255,255,255,.38) 48%, transparent 72%);
    content: "";
    inset: 0;
    position: absolute;
    transform: translateX(-135%);
    transition: transform 700ms var(--premium-ease);
    z-index: -1;
}

.btn-consult:hover::before,
.btn-hero-secondary:hover::before {
    transform: translateX(135%);
}

.btn-consult:focus-visible,
.btn-hero-secondary:focus-visible,
.theme-toggle:focus-visible,
.nav-link:focus-visible {
    outline: 3px solid var(--premium-ring);
    outline-offset: 4px;
}

.jumbotron {
    background-position: center;
    isolation: isolate;
    overflow: hidden;
    position: relative;
}

.jumbotron::after {
    background: radial-gradient(520px circle at var(--pointer-x, 72%) var(--pointer-y, 38%), rgba(129,140,248,.13), transparent 58%);
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
    z-index: 0;
}

.jumbotron .hero-content {
    position: relative;
    z-index: 1;
}

.hero-eyebrow {
    animation: premiumReveal 900ms 100ms var(--premium-ease) both;
}

.jumbotron h1 {
    animation: premiumReveal 1000ms 180ms var(--premium-ease) both;
    text-wrap: balance;
}

.hero-summary {
    animation: premiumReveal 900ms 290ms var(--premium-ease) both;
}

.hero-actions {
    animation: premiumReveal 900ms 390ms var(--premium-ease) both;
}

.hero-note {
    animation: premiumReveal 900ms 480ms var(--premium-ease) both;
}

.hero-eyebrow::before {
    background: #818cf8;
    box-shadow: 0 0 18px rgba(129, 140, 248, 0.8);
    content: "";
    display: inline-block;
    height: 1px;
    margin-right: 14px;
    vertical-align: middle;
    width: 42px;
}

.trust-item i {
    filter: drop-shadow(0 0 10px rgba(129,140,248,.38));
    transition: transform 500ms var(--premium-ease);
}

.trust-item:hover i {
    transform: translateY(-3px) scale(1.08);
}

.profile-monogram {
    overflow: hidden;
    position: relative;
    transition: transform 650ms var(--premium-ease), box-shadow 650ms var(--premium-ease);
}

.profile-monogram::after {
    background: linear-gradient(120deg, transparent 20%, rgba(255,255,255,.16), transparent 75%);
    content: "";
    inset: -60%;
    position: absolute;
    transform: rotate(18deg) translateX(-55%);
    transition: transform 950ms var(--premium-ease);
}

.profile-monogram:hover {
    box-shadow: 0 34px 78px rgba(0,0,0,.34), 0 0 0 1px rgba(129,140,248,.14);
    transform: translateY(-7px) rotate(-1deg);
}

.profile-monogram:hover::after {
    transform: rotate(18deg) translateX(55%);
}

.profile-section {
    background:
        radial-gradient(circle at 13% 28%, rgba(99, 102, 241, .2), transparent 34%),
        radial-gradient(circle at 88% 82%, rgba(109, 40, 217, .12), transparent 30%),
        linear-gradient(135deg, #111827 0%, #0f172a 52%, #020617 100%);
    color: #fff;
    isolation: isolate;
    overflow: hidden;
    position: relative;
}

.profile-section::before {
    background-image:
        linear-gradient(rgba(148, 163, 184, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, .045) 1px, transparent 1px);
    background-size: 42px 42px;
    content: "";
    inset: 0;
    mask-image: linear-gradient(90deg, #000, transparent 70%);
    pointer-events: none;
    position: absolute;
}

.profile-section > .container {
    position: relative;
    z-index: 1;
}

.profile-layout {
    align-items: center;
    display: grid;
    gap: clamp(2.5rem, 6vw, 6rem);
    grid-template-columns: minmax(260px, .78fr) minmax(0, 1.35fr);
}

.profile-visual {
    position: relative;
}

.profile-visual::after {
    background: var(--accent-gradient);
    bottom: -18px;
    content: "";
    height: 2px;
    left: 50%;
    opacity: .8;
    position: absolute;
    transform: translateX(-50%);
    width: 72px;
}

.profile-portrait {
    margin-inline: auto;
    max-width: 330px;
    position: relative;
}

.profile-portrait-frame {
    background: #c9c5c2;
    border: 1px solid rgba(226, 232, 240, .2);
    border-radius: 4px;
    box-shadow: 0 18px 38px rgba(0, 0, 0, .24);
    overflow: hidden;
    position: relative;
}

.profile-portrait img {
    aspect-ratio: 5 / 6;
    display: block;
    height: auto;
    object-fit: cover;
    object-position: 50% 28%;
    width: 100%;
}

.profile-copy {
    max-width: 720px;
}

.profile-kicker {
    color: #a5b4fc !important;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .17em;
    margin-bottom: .6rem;
    text-transform: uppercase;
}

.profile-copy h2 {
    color: #fff !important;
    font-size: clamp(2.25rem, 4.7vw, 4.6rem);
    letter-spacing: -.055em;
    line-height: .98;
    margin-bottom: .85rem;
}

.profile-role {
    color: #c7d2fe !important;
    font-size: clamp(1rem, 1.7vw, 1.22rem);
    font-weight: 600;
    margin-bottom: 1.25rem;
}

.profile-intro {
    color: #cbd5e1 !important;
    font-size: clamp(1rem, 1.5vw, 1.14rem);
    line-height: 1.65;
    margin-bottom: 1.8rem;
    max-width: 650px;
}

.profile-credentials {
    border-bottom: 1px solid rgba(148, 163, 184, .18);
    border-top: 1px solid rgba(148, 163, 184, .18);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-credential {
    align-items: flex-start;
    display: flex;
    gap: .85rem;
    min-height: 112px;
    padding: 1.2rem 1rem 1.15rem 0;
}

.profile-credential:nth-child(2) {
    border-left: 1px solid rgba(148, 163, 184, .18);
    padding-left: 1.25rem;
}

.profile-credential-card {
    border-top: 1px solid rgba(148, 163, 184, .18);
    grid-column: 1 / -1;
    min-height: auto;
}

.profile-credential i {
    color: #a5b4fc;
    font-size: 1rem;
    margin-top: .25rem;
    width: 18px;
}

.profile-credential span,
.profile-credential strong,
.profile-credential small {
    display: block;
}

.profile-credential span {
    color: #94a3b8;
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .11em;
    margin-bottom: .3rem;
    text-transform: uppercase;
}

.profile-credential strong {
    color: #f8fafc;
    font-size: .96rem;
    line-height: 1.45;
}

.profile-credential small {
    color: #94a3b8;
    font-size: .82rem;
    margin-top: .18rem;
}

.profile-footer {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1.5rem;
    justify-content: flex-end;
    padding-top: 1.15rem;
}

.profile-footer a {
    font-size: .78rem;
    font-weight: 700;
}

.whatsapp-fab {
    align-items: center;
    background: #167b55;
    border: 1px solid rgba(255, 255, 255, .26);
    border-radius: 999px;
    bottom: max(22px, env(safe-area-inset-bottom));
    box-shadow: 0 14px 34px rgba(15, 23, 42, .28);
    color: #fff !important;
    display: flex;
    font-size: .82rem;
    font-weight: 750;
    gap: .58rem;
    letter-spacing: .01em;
    padding: .78rem 1.05rem;
    position: fixed;
    right: max(22px, env(safe-area-inset-right));
    text-decoration: none !important;
    transition: background-color 240ms ease, box-shadow 240ms ease, transform 240ms var(--premium-ease);
    z-index: 1050;
}

.whatsapp-fab i {
    font-size: 1.25rem;
}

.whatsapp-fab:hover,
.whatsapp-fab:focus-visible {
    background: #116846;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .36);
    color: #fff;
    transform: translateY(-3px);
}

.whatsapp-fab:focus-visible {
    outline: 3px solid rgba(165, 180, 252, .8);
    outline-offset: 3px;
}

.metro-tile {
    isolation: isolate;
    overflow: hidden;
    transform: translateZ(0);
    transition: transform 560ms var(--premium-ease), box-shadow 560ms var(--premium-ease), filter 560ms ease;
}

.metro-tile::before {
    background: radial-gradient(360px circle at var(--tile-x, 50%) var(--tile-y, 50%), rgba(255,255,255,.2), transparent 55%);
    content: "";
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transition: opacity 350ms ease;
    z-index: 0;
}

.metro-tile:hover {
    box-shadow: 0 28px 58px rgba(30, 41, 59, 0.2);
    filter: saturate(1.08);
    transform: translateY(-7px) scale(1.008);
    z-index: 3;
}

.metro-tile:hover::before {
    opacity: 1;
}

.metro-tile > * {
    position: relative;
    z-index: 1;
}

.service-visual,
.contact-card,
.process-card {
    transition: transform 650ms var(--premium-ease), box-shadow 650ms var(--premium-ease), border-color 350ms ease;
}

.service-visual-image {
    background:
        linear-gradient(180deg, rgba(2, 6, 23, 0.08) 20%, rgba(2, 6, 23, 0.9) 100%),
        var(--service-image) center/cover no-repeat !important;
}

.service-visual-image .service-visual-grid,
.service-visual-image .service-visual-orb {
    display: none;
}

.service-visual-image .service-visual-content {
    max-width: 72%;
}

.service-visual-image .service-visual-content i {
    filter: drop-shadow(0 5px 16px rgba(2, 6, 23, 0.65));
}

.service-visual:hover,
.contact-card:hover,
.process-card:hover {
    border-color: rgba(99, 102, 241, 0.28) !important;
    box-shadow: 0 30px 72px rgba(15, 23, 42, 0.13) !important;
    transform: translateY(-5px);
}

.service-showcase {
    isolation: isolate;
    overflow: hidden;
    position: relative;
}

.service-showcase::before {
    color: rgba(99, 102, 241, 0.055);
    content: attr(data-index);
    font-size: clamp(9rem, 18vw, 18rem);
    font-weight: 800;
    letter-spacing: -0.1em;
    line-height: 1;
    pointer-events: none;
    position: absolute;
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
    z-index: -1;
}

[data-theme="dark"] .service-showcase::before {
    color: rgba(129, 140, 248, 0.07);
}

.service-text h3 {
    position: relative;
}

.service-text h3::after {
    background: var(--accent-gradient);
    border-radius: 99px;
    content: "";
    display: block;
    height: 3px;
    margin-top: 18px;
    transform: scaleX(0.32);
    transform-origin: left;
    transition: transform 800ms var(--premium-ease);
    width: 86px;
}

.service-showcase.show .service-text h3::after {
    transform: scaleX(1);
}

.fade-in {
    filter: blur(5px);
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 850ms var(--premium-ease), transform 850ms var(--premium-ease), filter 850ms ease;
}

.fade-in.show {
    filter: blur(0);
    opacity: 1;
    transform: translateY(0);
}

.premium-stagger > * {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 650ms var(--premium-ease), transform 650ms var(--premium-ease);
}

.show .premium-stagger > *,
.premium-stagger.show > * {
    opacity: 1;
    transform: translateY(0);
}

.premium-stagger > *:nth-child(2) { transition-delay: 70ms; }
.premium-stagger > *:nth-child(3) { transition-delay: 140ms; }
.premium-stagger > *:nth-child(4) { transition-delay: 210ms; }

@keyframes premiumReveal {
    from { filter: blur(7px); opacity: 0; transform: translateY(24px); }
    to { filter: blur(0); opacity: 1; transform: translateY(0); }
}

@supports (animation-timeline: view()) {
    .service-showcase::before {
        animation: indexDrift linear both;
        animation-range: entry 0% exit 100%;
        animation-timeline: view();
    }

    @keyframes indexDrift {
        from { transform: translate3d(0, -36%, 0); }
        to { transform: translate3d(-4vw, -64%, 0); }
    }
}

@media (max-width: 1199px) {
    .experience-rail { display: none; }
}

@media (max-width: 767px) {
    .nav-link::after { left: 0; right: auto; width: 34px; }
    .jumbotron::after { display: none; }
    .metro-tile:hover,
    .service-visual:hover,
    .contact-card:hover,
    .process-card:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
    .fade-in, .premium-stagger > * { filter: none; opacity: 1; transform: none; }
}

/* Tema oscuro y navegación: cierre de consistencia entre todas las superficies. */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

.navbar-brand .brand-logo-dark { display: none; }

.navbar-brand .brand-logo-original {
    display: block;
    filter: brightness(0.4) contrast(1.65) saturate(1.35);
}

[data-theme="dark"] .navbar-brand .brand-logo-original {
    display: block;
    filter: brightness(1.08) contrast(1.12);
}

[data-theme="dark"] .navbar-brand .brand-logo-light { display: none; }

[data-theme="dark"] .navbar-brand .brand-logo-dark {
    display: block;
    filter: none;
}

[data-theme="dark"] header.is-scrolled {
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
}

[data-theme="dark"] .modern-dropdown {
    background: #0f172a !important;
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.48) !important;
}

[data-theme="dark"] .modern-dropdown .dropdown-item {
    color: #cbd5e1;
}

[data-theme="dark"] .modern-dropdown .dropdown-item:hover,
[data-theme="dark"] .modern-dropdown .dropdown-item:focus,
[data-theme="dark"] .modern-dropdown .dropdown-item:active {
    background: #1e293b;
    color: #a5b4fc;
}

[data-theme="dark"] .experience-rail a { color: #cbd5e1; }

[data-theme="dark"] .tiles-summary,
[data-theme="dark"] .service-showcase,
[data-theme="dark"] .process-section,
[data-theme="dark"] #faq-aeo {
    background: #020617 !important;
}

[data-theme="dark"] #perfil-direccion,
[data-theme="dark"] #casos-exito {
    background: #0f172a !important;
}

[data-theme="dark"] #perfil-direccion {
    background:
        radial-gradient(circle at 13% 28%, rgba(99, 102, 241, .18), transparent 34%),
        radial-gradient(circle at 88% 82%, rgba(109, 40, 217, .1), transparent 30%),
        linear-gradient(135deg, #0f172a 0%, #070b16 58%, #020617 100%) !important;
}

@media (max-width: 575.98px) {
    .profile-portrait {
        max-width: 264px;
    }

    .profile-credentials {
        grid-template-columns: 1fr;
    }

    .profile-credential {
        min-height: auto;
        padding: 1rem 0;
    }

    .profile-credential:nth-child(2) {
        border-left: 0;
        border-top: 1px solid rgba(148, 163, 184, .18);
        padding-left: 0;
    }

    .profile-credential-card {
        grid-column: auto;
    }

    .whatsapp-fab {
        border-radius: 50%;
        bottom: max(16px, env(safe-area-inset-bottom));
        height: 54px;
        justify-content: center;
        padding: 0;
        right: max(16px, env(safe-area-inset-right));
        width: 54px;
    }

    .whatsapp-fab i {
        font-size: 1.55rem;
    }

    .whatsapp-fab span {
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        height: 1px;
        overflow: hidden;
        position: absolute;
        white-space: nowrap;
        width: 1px;
    }
}

@media (max-width: 991.98px) {
    .profile-layout {
        gap: 3.2rem;
        grid-template-columns: 1fr;
    }

    .profile-copy {
        margin-inline: auto;
        max-width: 680px;
        width: 100%;
    }
}

[data-theme="dark"] #jurisdiccion {
    background: #111827 !important;
    border-color: rgba(148, 163, 184, 0.16) !important;
}

[data-theme="dark"] #jurisdiccion .badge {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .contact-card {
    background: #0f172a !important;
    border: 1px solid rgba(148, 163, 184, 0.16) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .custom-select {
    background-color: #111827 !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: #94a3b8;
    opacity: 1;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .custom-select:focus {
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.18) !important;
}

[data-theme="dark"] footer {
    background: #020617 !important;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

[data-theme="dark"] footer p { color: #94a3b8 !important; }

.professional-card {
    align-items: center;
    color: rgba(255, 255, 255, 0.92) !important;
    display: flex;
    font-size: 0.88rem !important;
    letter-spacing: 0.01em;
    margin: 0 0 0.65rem;
}

.professional-card i {
    color: #a5b4fc;
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--card-bg);
        border-top: 1px solid rgba(148, 163, 184, 0.18);
        box-shadow: 0 20px 36px rgba(15, 23, 42, 0.12);
        left: 0;
        padding: 18px 22px 24px;
        position: absolute;
        right: 0;
        top: var(--nav-height);
    }

    [data-theme="dark"] .navbar-collapse {
        background: #0f172a;
        box-shadow: 0 24px 42px rgba(0, 0, 0, 0.42);
    }

    .navbar-collapse .navbar-nav { align-items: stretch !important; }

    .navbar-collapse .nav-link {
        margin: 0;
        padding: 12px 4px;
        width: 100%;
    }

    .modern-dropdown,
    [data-theme="dark"] .modern-dropdown {
        background: transparent !important;
        border: 0;
        box-shadow: none !important;
        margin: 0;
        padding: 2px 0 8px 14px;
        position: static !important;
        transform: none !important;
        width: 100%;
    }

    .modern-dropdown .dropdown-item {
        border-left: 1px solid rgba(99, 102, 241, 0.28);
        padding: 9px 16px;
    }

    .modern-dropdown .dropdown-item:hover,
    [data-theme="dark"] .modern-dropdown .dropdown-item:hover {
        padding-left: 20px;
    }
}
