/* Homepage-only responsive refinement.
   Loaded after the approved page and shared component styles. */

body.homepage {
    overflow-x: visible;
}

body.homepage :where(main, section, article, div, figure, nav, ul, li) {
    min-width: 0;
}

body.homepage :where(img, iframe, svg) {
    max-width: 100%;
}

body.homepage :where(.body-copy, .section-narrative p, .formation-narrative p, .profile-narrative-copy p, .academic-narrative-copy p, .publications-copy p) {
    max-width: 72ch;
}

/* Keep the hero's supporting copy on the same loaded family as its metadata. */
body.homepage :where(.hero-meta, .hero-desc) {
    font-family: "Source Sans 3", Arial, sans-serif;
    font-size: 1rem;
    font-style: italic;
    line-height: 1.65;
}

body.homepage :where(.section-title, .formation-copy h2, .memberships-band h2) {
    text-wrap: balance;
}

body.homepage .contact-firm-card h2 {
    white-space: normal;
    text-wrap: balance;
}

body.homepage :where(.personal-contact-copy a, .firm-contact-copy a, .site-footer-contact-list a, .site-footer-firm-list a) {
    overflow-wrap: anywhere;
}

body.homepage .container {
    width: min(1180px, calc(100% - (2 * clamp(15px, 3.5vw, 32px))));
}

body.homepage :where(.section-light, .section-paper, .section-dark) {
    padding-block: clamp(4.25rem, 7vw, 6rem);
}

body.homepage :where(.button, .hero-whatsapp, .hero-card, .consulting-card, .specialty-card, .publication-card, .membership-logo-card, .org-strip a, .nav-items a) {
    touch-action: manipulation;
}

body.homepage .hero-section {
    min-height: 100svh;
}

body.homepage .hero-whatsapp {
    max-width: 100%;
}

/* Keep the original single marquee on larger screens. A second track is
   revealed by the tablet/mobile rule below and runs in the opposite direction. */
body.homepage .membership-marquee {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

body.homepage .membership-marquee-track--reverse {
    display: none;
}

@keyframes membership-marquee-reverse {
    from {
        transform: translateX(calc(-50% - 9px));
    }

    to {
        transform: translateX(0);
    }
}

body.homepage :where(.academic-split-image, .academic-narrative-image, .profile-narrative-image, .section-visual, .publications-visual) {
    overflow: hidden;
}

body.homepage :where(.academic-split-image img, .academic-narrative-image img, .profile-narrative-image img, .section-visual img, .publications-visual img) {
    display: block;
    width: 100%;
    object-fit: cover;
}

body.homepage :where(.nav-items a, .language-switcher a, .site-footer-links a, .site-footer-contact-list a, .site-footer-firm-list a, .personal-contact-copy a, .firm-contact-copy a) {
    min-height: 44px;
}

body.homepage :where(.site-footer-links a, .site-footer-contact-list a, .site-footer-firm-list a, .personal-contact-copy a, .firm-contact-copy a) {
    display: inline-flex;
    align-items: center;
}

body.homepage .site-footer-socials a {
    width: 44px;
    height: 44px;
}

body.homepage .nav-items .language-switcher a {
    min-height: 44px;
}

@media (hover: hover) and (pointer: fine) {
    body.homepage :where(.hero-card, .consulting-card, .specialty-card, .publication-card, .membership-logo-card):hover {
        will-change: transform;
    }
}

/* Compact desktop navigation before the drawer becomes necessary. */
@media (min-width: 981px) and (max-width: 1180px) {
    body.homepage .header-wrapper {
        gap: 16px;
    }

    body.homepage .nav-items {
        gap: clamp(9px, 1.15vw, 13px);
    }

    body.homepage .nav-items a {
        padding-inline: 2px;
        font-size: clamp(0.66rem, 0.75vw, 0.7rem);
        letter-spacing: 0.065em;
    }
}

@media (min-width: 981px) and (max-height: 900px) {
    body.homepage .hero-content-wrapper {
        padding-top: 72px;
        padding-bottom: 32px;
    }

    body.homepage .hero-copy {
        padding-top: 1vh;
    }

    body.homepage .hero-meta {
        margin-bottom: 9px;
    }

    body.homepage .hero-desc {
        margin-bottom: 18px;
        line-height: 1.55;
    }

    body.homepage .hero-whatsapp {
        min-height: 50px;
        margin: 0 0 16px;
        padding-block: 11px;
    }

    body.homepage .hero-cards {
        gap: 10px;
    }

    body.homepage .hero-card {
        min-height: 112px;
        padding: 16px 18px;
    }
}

/* The complete navigation first stops fitting here, so use the drawer. */
@media (max-width: 980px) {
    body.homepage.menu-open {
        overflow: hidden;
    }

    body.homepage #site_header {
        padding-top: env(safe-area-inset-top);
    }

    body.homepage .header-wrapper {
        width: calc(100% - 32px);
        height: 72px;
    }

    /* Keep the complete brand lockup legible from small phones through tablets. */
    body.homepage .brand-logo-link {
        gap: clamp(8px, 1.8vw, 16px);
    }

    body.homepage .brand-logo-link img {
        width: clamp(70px, 10vw, 92px);
        height: clamp(54px, 8vw, 74px);
        flex: 0 0 auto;
    }

    body.homepage .brand-text-box {
        width: clamp(166px, 24vw, 220px);
    }

    body.homepage .brand-text-box h3 {
        font-size: clamp(0.96rem, 2.2vw, 1.22rem);
        letter-spacing: 0.05em;
    }

    body.homepage .brand-text-box > span {
        display: grid;
        font-size: clamp(0.48rem, 1.2vw, 0.62rem);
        letter-spacing: 0.14em;
    }

    body.homepage .mobile-hamburger {
        display: inline-flex;
        flex: 0 0 44px;
        align-items: center;
        justify-content: center;
    }

    body.homepage .membership-marquee {
        gap: 14px;
    }

    body.homepage .membership-marquee-track--reverse {
        display: flex;
        animation-name: membership-marquee-reverse;
    }

    body.homepage .nav-items {
        display: none;
        position: fixed;
        top: calc(72px + env(safe-area-inset-top));
        right: auto;
        left: 0;
        width: 100%;
        height: calc(100dvh - 72px - env(safe-area-inset-top));
        flex-direction: column;
        align-items: center;
        gap: clamp(4px, 1.2vh, 10px);
        padding: clamp(20px, 4vh, 36px) clamp(20px, 6vw, 64px) max(30px, env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
        border-top: 1px solid var(--line);
        border-left: 0;
        background: var(--paper);
        box-shadow: 0 24px 60px rgba(9, 16, 24, 0.16);
        visibility: hidden;
        pointer-events: none;
        transform: translateX(105%);
        transition: transform 0.28s ease, visibility 0.28s ease;
    }

    body.homepage .nav-items.active {
        display: flex;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0);
    }

    body.homepage .nav-items > li {
        width: min(100%, 34rem);
    }

    body.homepage .nav-items a {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 44px;
        padding: 8px 16px;
        font-size: clamp(0.96rem, 2.5vw, 1.1rem);
        font-weight: 600;
        letter-spacing: 0.11em;
        text-align: center;
    }

    body.homepage .nav-items a::after {
        display: none;
    }

    body.homepage .nav-items .language-switcher {
        width: fit-content;
        margin-top: clamp(10px, 2vh, 18px);
        margin-inline: auto;
    }

    body.homepage .nav-items .language-switcher a {
        width: 52px;
        min-height: 44px;
        padding-inline: 7px;
    }
}

/*
   Preserve the desktop hero composition at 980px, then tighten it fluidly
   until the content intentionally drops below the portrait at 820px.
   This band is hero-only so the rest of the page keeps its existing rhythm.
*/
@media (min-width: 821px) and (max-width: 980px) {
    body.homepage .hero-background-image {
        background-position: center 18%;
        transform: translateX(-18%) scale(1.03);
    }

    body.homepage .hero-copy {
        width: clamp(31.75rem, 62vw, 37.5rem);
        margin-right: clamp(-10px, calc((100vw - 980px) * 0.063), 0px);
    }

    body.homepage .hero-name {
        font-size: clamp(2rem, 3.84vw, 2.35rem);
    }

    body.homepage .hero-title {
        font-size: clamp(1.32rem, 2.53vw, 1.55rem);
    }

    body.homepage .hero-desc {
        font-size: clamp(0.92rem, calc(0.61rem + 0.6vw), 0.98rem);
    }

    body.homepage .hero-card {
        min-height: clamp(108px, 12.65vw, 124px);
        padding: clamp(16px, 2vw, 20px) clamp(17px, 2.25vw, 22px);
    }
}

/* Tablet and small-laptop content: stack narrative splits, retain useful grids. */
@media (max-width: 1040px) {
    body.homepage .formation-copy .formation-arrow {
        display: block;
        width: 100%;
        text-align: center;
    }

    body.homepage .intro-grid {
        width: min(760px, calc(100% - (2 * clamp(20px, 5vw, 36px))));
        margin-inline: auto;
    }

    body.homepage :where(.academic-split-copy, .academic-narrative-copy, .profile-narrative-copy) {
        width: min(760px, 100%);
        margin-inline: auto;
        padding-inline: clamp(24px, 6vw, 56px);
    }

    body.homepage :where(.academic-split-image, .academic-narrative-image, .profile-narrative-image) {
        aspect-ratio: 16 / 9;
        min-height: 0;
    }

    body.homepage :where(.academic-split-image img, .academic-narrative-image img, .profile-narrative-image img) {
        width: 100%;
        height: 100%;
        min-height: 0;
    }

    body.homepage .academic-split-image img {
        object-position: center 44%;
    }

    body.homepage .academic-narrative-image img {
        object-position: center 50%;
    }

    body.homepage .profile-consulting-narrative .profile-narrative-image img {
        object-position: center 50%;
    }

    body.homepage .profile-institutional-narrative .profile-narrative-image img {
        object-position: center 40%;
    }

    body.homepage :where(.formation-detail-grid, .legal-excellence-grid) {
        gap: clamp(2rem, 6vw, 3.5rem);
    }

    body.homepage .contact-footer-grid {
        width: min(760px, calc(100% - (2 * clamp(18px, 4vw, 28px))));
    }
}

@media (max-width: 600px) {
    body.homepage .profile-consulting-narrative .profile-narrative-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    body.homepage .profile-consulting-narrative .profile-narrative-image {
        order: 2;
    }

    body.homepage .profile-consulting-narrative .profile-narrative-copy {
        order: 1;
        padding-bottom: clamp(32px, 8vw, 44px);
    }

    body.homepage .profile-consulting-narrative .profile-narrative-image img {
        min-height: 240px;
        object-position: center 34%;
    }

    body.homepage .formation-copy {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    body.homepage .formation-copy > * {
        width: 100%;
    }

    body.homepage .formation-copy .formation-arrow {
        width: fit-content;
        align-self: center;
        margin-inline: auto;
        text-align: center;
    }

    body.homepage .formation-photo {
        overflow: hidden;
    }

    body.homepage .formation-photo img {
        object-position: center 18%;
        transform: scale(1.08);
        transform-origin: center top;
    }

    body.homepage .org-strip {
        width: min(100%, 340px);
        margin-inline: auto;
        justify-items: center;
    }

    body.homepage .org-strip a {
        width: min(100%, 320px);
        justify-content: center;
        padding-inline: 10px;
        text-align: center;
    }
}

@media (max-width: 360px) {
    body.homepage .profile-consulting-narrative .profile-narrative-image img {
        min-height: 220px;
        object-position: center 30%;
    }

    body.homepage .formation-photo img {
        object-position: center 14%;
        transform: scale(1.12);
    }

    body.homepage .org-strip {
        width: min(100%, 320px);
    }
}

@media (min-width: 601px) and (max-width: 1040px) {
    body.homepage .intro-visual {
        width: min(100%, clamp(26rem, 69.2vw, 45rem));
        aspect-ratio: 4 / 3;
        justify-self: center;
        margin-inline: auto;
        overflow: hidden;
    }

    body.homepage .intro-visual img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center 24%;
    }

    body.homepage .media-frame.portrait {
        width: min(100%, clamp(26rem, 60vw, 39rem));
        aspect-ratio: 1122 / 1402;
        justify-self: center;
        margin-inline: auto;
        overflow: hidden;
    }

    body.homepage .media-frame.portrait img {
        width: 100%;
        height: 100%;
        min-height: 0;
        object-fit: cover;
        object-position: center center;
        animation-name: none !important;
        animation-timeline: auto !important;
        transform: none !important;
    }
}

/* Fluid homepage footer transition between the phone and desktop layouts. */
@media (min-width: 601px) and (max-width: 980px) {
    body.homepage :where(.site-footer-grid, .site-footer-bottom) {
        width: min(900px, calc(100% - (2 * clamp(20px, 4vw, 40px))));
    }

    body.homepage .site-footer-bottom {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        text-align: center;
    }

    body.homepage .site-footer-emblem {
        grid-column: 1;
        grid-row: auto;
        justify-self: center;
    }

    body.homepage .site-footer-credentials {
        padding-inline: 52px;
        text-align: center;
    }
}

/* One column is required until each footer column can hold its full lockup. */
@media (min-width: 561px) and (max-width: 720px) {
    body.homepage .site-footer-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 34px;
    }

    body.homepage .site-footer-brand {
        padding-right: 0;
    }

    body.homepage :where(.site-footer-nav, .site-footer-contact, .site-footer-firm) {
        padding-top: 28px;
        padding-left: 0;
        border-top: 1px solid rgba(184, 146, 93, 0.24);
        border-left: 0;
    }
}

/* Tablet grids should not collapse into a phone layout prematurely. */
@media (min-width: 561px) and (max-width: 820px) {
    body.homepage :where(.hero-cards, .consulting-grid, .specialty-grid, .publication-grid, .timeline) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.homepage .org-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    body.homepage .hero-section {
        min-height: max(42.5rem, 100svh);
    }

    body.homepage .hero-content-wrapper {
        width: min(680px, calc(100% - (2 * clamp(15px, 4vw, 24px))));
        padding-top: clamp(15.5rem, 42svh, 24rem);
        padding-bottom: clamp(2.25rem, 6vw, 3rem);
    }

    body.homepage .hero-name {
        font-size: clamp(1.72rem, 6.8vw, 3rem);
    }

    body.homepage .hero-title {
        font-size: clamp(1.3rem, 5.7vw, 2rem);
    }

    body.homepage .hero-whatsapp {
        min-height: 52px;
        padding: 12px 16px;
        margin: 2px 0 18px;
        font-size: 1.55rem;
    }

    body.homepage :where(.formation-copy h2, .memberships-band h2) {
        font-size: clamp(2rem, 7.5vw, 3.5rem);
    }

    body.homepage .scroll-top-btn {
        right: max(16px, env(safe-area-inset-right));
        bottom: max(16px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 600px) {
    body.homepage :where(.section-light, .section-paper, .section-dark, .legal-excellence, .formation-band, .formation-detail, .memberships-band) {
        padding-block: clamp(3.5rem, 14vw, 4.25rem);
    }

    body.homepage .location-map-frame {
        height: clamp(280px, 72vw, 420px);
    }

    body.homepage :where(.site-footer-links a, .site-footer-contact-list a, .site-footer-firm-list a) {
        padding-block: 8px;
    }
}

@media (max-width: 560px) {
    body.homepage :where(.hero-cards, .consulting-grid, .specialty-grid, .publication-grid, .timeline, .formation-list, .org-strip) {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Show more of the portrait through the 521px-to-560px transition range. */
@media (min-width: 521px) and (max-width: 560px) {
    body.homepage .hero-background-image {
        background-size: auto clamp(34.25rem, 105vw, 36.75rem);
        background-position: center top;
        background-repeat: no-repeat;
        transform: none;
    }
}

@media (max-width: 520px) {
    body.homepage .header-wrapper {
        width: calc(100% - 8px);
        height: 94px;
        gap: 0;
    }

    body.homepage .brand-logo-link {
        flex: 1 1 auto;
        gap: 6px;
        overflow: hidden;
    }

    body.homepage .brand-logo-link img {
        width: 90px;
        height: 70px;
    }

    body.homepage .brand-text-box {
        width: min(174px, calc(100vw - 146px));
    }

    body.homepage .brand-text-box h3 {
        font-size: 1.12rem;
        letter-spacing: 0;
    }

    body.homepage .brand-text-box > span {
        display: grid;
        font-size: 0.6rem;
        letter-spacing: 0.09em;
    }

    body.homepage .mobile-hamburger {
        width: 58px;
        min-width: 58px;
        height: 58px;
        flex: 0 0 58px;
        padding: 0;
        font-size: 1.625rem;
    }

    body.homepage .nav-items {
        top: calc(94px + env(safe-area-inset-top));
        height: calc(100dvh - 94px - env(safe-area-inset-top));
    }

    body.homepage .hero-background-image {
        background-size: auto clamp(26rem, 100vw, 32.5rem);
        background-position: center top;
        background-repeat: no-repeat;
        transform: none;
    }

    body.homepage .hero-content-wrapper {
        padding-bottom: 36px;
    }

    body.homepage .hero-name {
        white-space: normal;
    }

    body.homepage .hero-whatsapp {
        min-height: 50px;
        padding-inline: 15px;
    }

    body.homepage .hero-whatsapp span {
        font-size: 0.84rem;
        white-space: nowrap;
    }

    body.homepage :where(.hero-meta, .hero-desc, .body-copy, .section-narrative p, .profile-narrative-copy p, .academic-narrative-copy p, .formation-narrative p) {
        font-size: 1rem;
        line-height: 1.7;
    }

    body.homepage .section-title {
        font-size: clamp(1.85rem, 9vw, 2.55rem);
    }

    body.homepage :where(.legal-excellence-item, .practice-area, .consulting-card, .specialty-card, .publication-card, .timeline-item, .formation-list article) {
        padding: 22px 20px;
    }

    body.homepage .formation-list article {
        grid-template-columns: 28px minmax(0, 1fr);
        gap: 14px;
    }

    body.homepage .button {
        width: 100%;
        padding-inline: 16px;
        white-space: normal;
        text-align: center;
    }

    body.homepage .org-strip a {
        min-height: 72px;
        padding: 10px 8px;
    }

    body.homepage .membership-logo-card {
        width: min(190px, 62vw);
    }

    body.homepage .contact-footer-grid {
        width: calc(100% - 24px);
    }
}

@media (max-width: 360px) {
    body.homepage .hero-content-wrapper {
        width: calc(100% - 24px);
        padding-top: 15rem;
    }

    body.homepage .hero-kicker::after {
        width: 28px;
    }
}

/* Short landscape screens need a compact first fold, not portrait-height spacing. */
@media (max-width: 980px) and (max-height: 500px) and (orientation: landscape) {
    body.homepage .hero-section {
        min-height: 100svh;
    }

    body.homepage .hero-background-image {
        background-position: 24% top;
        transform: scale(1.04);
    }

    body.homepage .hero-section::after {
        background: linear-gradient(90deg, rgba(9, 15, 21, 0.18) 0%, rgba(9, 15, 21, 0.74) 48%, rgba(9, 15, 21, 0.98) 100%);
    }

    body.homepage .hero-content-wrapper {
        width: min(100% - 32px, 900px);
        padding-top: calc(72px + env(safe-area-inset-top) + 24px);
        padding-bottom: 32px;
    }

    body.homepage .hero-copy {
        width: min(62vw, 600px);
        margin-left: auto;
    }
}

@media (min-width: 1600px) {
    body.homepage .container {
        width: min(1400px, calc(100% - 8vw));
    }

    body.homepage :where(.header-wrapper, .hero-content-wrapper, .intro-grid) {
        width: min(1460px, calc(100% - 8vw));
    }

    body.homepage .trajectory-timeline-copy {
        width: min(1400px, calc(100% - 8vw));
    }

    body.homepage .hero-copy {
        width: min(100%, 680px);
    }
}

@media (min-width: 1920px) {
    body.homepage :where(.section-light, .section-paper, .section-dark) {
        padding-block: clamp(5rem, 5.5vw, 7rem);
    }
}

@media (hover: none), (pointer: coarse), (max-width: 980px) {
    body.homepage .motion-parallax {
        animation: none !important;
        transform: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.homepage *,
    body.homepage *::before,
    body.homepage *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
