/* =========================================================
   Corrección responsive móvil - HenryAlcalay.com
   Evita desbordamiento horizontal y adapta cabecera/hero.
   ========================================================= */

html,
body {
    max-width: 100%;
    overflow-x: clip;
}

body {
    min-width: 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.page-shell,
.topbar,
.hero,
.intro,
.areas,
.principles,
.contact-card,
.footer {
    min-width: 0;
}

.topbar > *,
.hero > *,
.hero-copy,
.profile-wrap,
.intro > *,
.cards-grid > *,
.contact-card > * {
    min-width: 0;
}

img,
svg,
video,
iframe {
    max-width: 100%;
}

/* La marca puede encogerse de verdad dentro del flex */
.brand-logo {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.header-logo {
    width: auto;
    max-width: 100%;
}

/* Evita que textos largos fuercen el ancho */
.hero h1,
.hero-lead,
.section-heading h2,
.intro-copy,
.area-card,
.footer,
.footer-links {
    overflow-wrap: anywhere;
}

/* =========================================================
   Tablet / móvil
   ========================================================= */
@media (max-width: 640px) {
    .page-shell {
        width: calc(100% - 16px);
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    .topbar {
        width: 100%;
        max-width: 100%;
        display: flex;
        align-items: center;
        gap: 7px;
        padding: 9px;
        overflow: hidden;
    }

    .brand-logo {
        flex: 1 1 auto;
        min-width: 0;
        margin-right: 0;
    }

    .header-logo {
        display: block;
        width: 100%;
        height: auto;
        max-width: 155px;
        object-fit: contain;
        object-position: left center;
    }

    .theme-toggle {
        flex: 0 0 38px;
        width: 38px;
        height: 38px;
    }

    .topbar .btn-small {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 8px 11px;
        font-size: .78rem;
        white-space: nowrap;
    }

    .hero {
        width: 100%;
        max-width: 100%;
        padding-left: 20px;
        padding-right: 20px;
    }

    .hero-copy,
    .hero h1,
    .hero-lead,
    .hero-actions,
    .profile-wrap,
    .profile-card {
        width: 100%;
        max-width: 100%;
    }

    .hero h1 {
        /* Mantiene impacto visual sin forzar el ancho */
        font-size: clamp(2.65rem, 13.2vw, 4rem);
        line-height: .98;
        letter-spacing: -.045em;
    }

    .intro,
    .principles,
    .contact-card {
        width: 100%;
        max-width: 100%;
        padding-left: 22px;
        padding-right: 22px;
    }

    .cards-grid,
    .area-card,
    .contact-actions,
    .footer,
    .footer-links {
        max-width: 100%;
    }

    .footer-links {
        flex-wrap: wrap;
        row-gap: 10px;
    }
}

/* Pantallas especialmente estrechas */
@media (max-width: 390px) {
    .header-logo {
        max-width: 135px;
    }

    .topbar .btn-small {
        padding-left: 9px;
        padding-right: 9px;
        font-size: .75rem;
    }

    .hero h1 {
        font-size: clamp(2.5rem, 13vw, 3.5rem);
    }
}


/* =========================================================
   Sobre mí - foto más grande en móvil
   ========================================================= */
@media (max-width: 640px) {
    .intro-photo {
        width: 100%;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    .intro-photo img {
        width: 100%;
        max-width: none;
        height: auto;
        aspect-ratio: 4 / 5;
        object-fit: cover;
        object-position: center 20%;
        border-radius: 20px;
    }
}
