/**
 * Layout: header, hero, section pages, footer, contact
 */

/* ----- Sticky header: darker green, gold border ----- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-h);
    background: rgba(7, 47, 45, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(200, 154, 90, 0.4);
    transition: background var(--transition), border-color var(--transition);
}

.header-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 2rem;
}

.header-inner .logo-link {
    justify-self: start;
}
.header-inner .nav-main {
    justify-self: center;
}
.header-inner .header-right {
    justify-self: end;
}

.logo-link {
    display: flex;
    align-items: center;
    color: #ffffff;
    transition: color var(--transition);
}
.logo-link:hover {
    color: var(--brand-gold);
}
.logo-img {
    max-height: 44px;
    width: auto;
}
.logo-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.06em;
}

.nav-main {
    display: flex;
    gap: 2.5rem;
}
.nav-main a {
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    position: relative;
    transition: color var(--transition);
}
.nav-main a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 1px;
    background: var(--brand-gold);
    transition: width var(--transition);
}
.nav-main a:hover,
.nav-main a:hover::after {
    color: var(--brand-gold);
    width: 100%;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.header-phone {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: color var(--transition);
}
.header-phone:hover {
    color: var(--brand-gold);
}
.lang-flag {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.3rem 0.5rem;
    border: 1px solid rgba(200, 154, 90, 0.35);
    border-radius: var(--radius-sm);
    letter-spacing: 0.05em;
}

.header-mini-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

.header-lang-flags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.header-lang-flag {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 20px;
    border-radius: 2px;
    overflow: hidden;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.header-lang-flag:hover {
    opacity: 0.9;
}
.header-lang-flag svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.header-lang-flag-text {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.02em;
}

.nav-toggle {
    display: none;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    color: var(--text-light);
}
/* 3-line hamburger: top + middle (box-shadow) + bottom */
.nav-toggle::before,
.nav-toggle::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: currentColor;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.25s ease, color 0.2s ease;
}
.nav-toggle::before {
    top: 12px;
    box-shadow: 0 10px 0 currentColor;
}
.nav-toggle::after {
    bottom: 12px;
}
.nav-toggle:hover {
    color: var(--brand-gold);
}
.nav-toggle:hover::before,
.nav-toggle:hover::after {
    color: var(--brand-gold);
}
/* Open state: morph into X */
.nav-toggle.is-open {
    color: var(--brand-gold);
}
.nav-toggle.is-open::before {
    top: 50%;
    margin-top: -1px;
    box-shadow: none;
    transform: rotate(45deg);
}
.nav-toggle.is-open::after {
    bottom: auto;
    top: 50%;
    margin-top: -1px;
    transform: rotate(-45deg);
}
.nav-toggle.is-open:hover {
    color: var(--brand-gold-light);
}

/* ----- Home hero: full-screen, cinematic ----- */
/* Homepage one-screen fit: body flex column 100vh, main + footer fill without scroll */
body.page-home {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}
body.page-home .main-content {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
body.page-home .hero-fullscreen {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-fullscreen {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}
.hero-bg img,
.hero-bg video {
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.hero-bg .slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1.2s ease-out;
}
.hero-bg .slide.active {
    opacity: 1;
    z-index: 1;
}
.hero-bg .slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero-bg .hero-fallback {
    background: linear-gradient(145deg, var(--brand-green-dark) 0%, var(--brand-green) 45%, var(--brand-green-dark) 100%);
}

/* Hero video: hold poster / brand placeholder until media is ready (avoids black frame) */
.hero-bg .hero-media-placeholder {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(145deg, var(--brand-green-dark) 0%, var(--brand-green) 45%, var(--brand-green-dark) 100%);
}
.hero-bg--media-loading .hero-video {
    position: relative;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.45s ease;
}
.hero-bg:not(.hero-bg--media-loading) .hero-video {
    position: relative;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.45s ease;
}

/* Cinematic overlay: dark neutral + subtle deep green tint for readability and mood */
.hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.25) 45%, rgba(0, 0, 0, 0.5) 100%),
        linear-gradient(180deg, rgba(7, 47, 45, 0.35) 0%, rgba(7, 47, 45, 0.28) 50%, rgba(5, 35, 33, 0.6) 100%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: var(--header-h) 2rem 4rem;
    max-width: 900px;
}

/* Tighter hero spacing on homepage so header + hero + cards + footer fit in 100vh */
body.page-home .hero-content {
    padding: 0.5rem 2rem 0.75rem;
    max-width: 880px;
}
body.page-home .hero-headline {
    margin-bottom: 0.75rem;
    font-size: clamp(2.25rem, 5vw, 3.75rem);
}
body.page-home .hero-subheadline {
    margin-bottom: 1.5rem;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
}
body.page-home .hero-buttons {
    gap: 1.5rem;
}
body.page-home .hero-card {
    min-height: 180px;
    padding: 2rem 1.75rem;
}

/* Homepage value strip (service area + CTA) */
.home-value-strip {
    padding: 2.5rem 2rem;
    background: var(--brand-green-dark);
    border-top: 1px solid rgba(200, 154, 90, 0.25);
}
.value-strip-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    text-align: center;
}
.value-strip-lead {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    color: var(--text-light);
}
.value-strip-lead strong {
    color: var(--brand-gold);
}
.value-strip-sub {
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
    color: var(--color-text-muted);
    max-width: 36em;
    margin-left: auto;
    margin-right: auto;
}
.value-strip-cta {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--brand-gold);
    color: var(--brand-green-dark);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition);
}
.value-strip-cta:hover {
    background: var(--brand-gold-light);
    color: var(--brand-green-dark);
}

/* Premium hero typography: strong white, legibility, refined spacing */
.hero-headline {
    font-family: 'Playfair Display', var(--font-display), Georgia, serif;
    font-size: clamp(2.75rem, 6vw, 4.5rem);
    font-weight: 600;
    line-height: 1.12;
    margin: 0 0 1.25rem;
    letter-spacing: 0.045em;
    color: #ffffff;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.2);
}

.hero-subheadline {
    font-family: 'Inter', var(--font-body), sans-serif;
    font-size: clamp(1.05rem, 1.9vw, 1.2rem);
    font-weight: 400;
    letter-spacing: 0.025em;
    color: rgba(255, 255, 255, 0.92);
    margin: 0 0 3rem;
    line-height: 1.65;
    max-width: 32em;
    margin-left: auto;
    margin-right: auto;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.3);
}

/* Hero entrance animations: cinematic title → subtitle → cards */
@keyframes heroFadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes heroFadeInDelayed {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes heroCardEnter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.hero-content.animate-in {
    opacity: 1;
}
.hero-content.animate-in .hero-headline {
    animation: heroFadeInUp 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.15s forwards;
    opacity: 0;
}
.hero-content.animate-in .hero-subheadline {
    animation: heroFadeInDelayed 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) 0.4s forwards;
    opacity: 0;
}
.hero-content.animate-in .hero-buttons {
    animation: heroCardEnter 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) 0.7s forwards;
    opacity: 0;
}

/* Hero cards: premium glass, icon, watermark, hover ----- */
.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    align-items: stretch;
}

.hero-card {
    --card-w: 320px;
    width: var(--card-w);
    min-height: 240px;
    padding: 2.5rem 2.5rem;
    background: rgba(7, 47, 45, 0.62);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(200, 154, 90, 0.45);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-light);
    transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.08);
}
/* Very subtle watermark (logo icon) inside card */
.hero-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--hero-watermark, none);
    background-size: 140px;
    background-repeat: no-repeat;
    background-position: center 42%;
    opacity: 0.05;
    pointer-events: none;
}
.hero-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--brand-gold), transparent);
    opacity: 0.65;
    transition: opacity 0.35s ease;
}
.hero-card:hover {
    transform: translateY(-8px);
    border-color: rgba(200, 154, 90, 0.7);
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.4), 0 0 24px rgba(200, 154, 90, 0.08);
    background: rgba(7, 47, 45, 0.78);
}
.hero-card:hover::after {
    opacity: 1;
}

.hero-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 26px;
    position: relative;
    z-index: 1;
    padding: 0 1.5rem;
}
.hero-card-icon img {
    width: 200px;
    max-width: 68%;
    height: auto;
    object-fit: contain;
    opacity: 0.95;
    filter: drop-shadow(0 0 10px rgba(200, 154, 90, 0.25));
    transition: transform 0.35s ease, filter 0.35s ease, opacity 0.35s ease;
}
.hero-card:hover .hero-card-icon img {
    transform: scale(1.04);
    opacity: 1;
    filter: drop-shadow(0 0 12px rgba(200, 154, 90, 0.3));
}

.hero-card .title {
    font-family: 'Playfair Display', var(--font-display), Georgia, serif;
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 0.5em;
    letter-spacing: 0.04em;
    color: #ffffff;
    position: relative;
    z-index: 1;
    transition: color 0.35s ease, text-shadow 0.35s ease;
}
.hero-card:hover .title {
    text-shadow: 0 0 24px rgba(255, 255, 255, 0.06);
}
.hero-card .sub {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.78);
    margin: 0;
    position: relative;
    z-index: 1;
}

/* Custom image CTA buttons (CMS-uploaded) */
.hero-cta-image {
    --cta-w: 320px;
    width: var(--cta-w);
    min-height: 200px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(200, 154, 90, 0.45);
    background: rgba(7, 47, 45, 0.5);
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.35);
    text-decoration: none;
    transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}
.hero-cta-image:hover {
    transform: translateY(-8px);
    border-color: rgba(200, 154, 90, 0.7);
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.4), 0 0 24px rgba(200, 154, 90, 0.08);
}
.hero-cta-image img {
    width: 100%;
    height: 100%;
    min-height: 200px;
    object-fit: contain;
    object-position: center;
    display: block;
}
body.page-home .hero-cta-image {
    min-height: 180px;
}
body.page-home .hero-cta-image img {
    min-height: 180px;
}

/* ----- Section pages: hero as fixed background behind sidebar + gallery ----- */
.section-hero.section-hero-bg {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    overflow: hidden;
}

.section-hero .hero-bg,
.section-hero .hero-overlay {
    position: absolute;
    inset: 0;
}
.section-hero .hero-bg img,
.section-hero .hero-bg video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.section-hero .hero-bg .slide,
.section-hero .hero-bg .slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.section-hero .hero-bg .slide {
    position: absolute;
    inset: 0;
}
.section-hero .hero-bg .slide img {
    display: block;
}
.section-hero .hero-fallback {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, var(--brand-green-dark) 0%, var(--brand-green) 40%, var(--brand-green-dark) 100%);
}
.section-hero .hero-overlay {
    background: var(--color-overlay-gradient);
    z-index: 1;
}

.section-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto auto;
    gap: 0;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--header-h) 1.5rem 0 1.5rem;
}

.section-layout-header-wrap {
    grid-column: 1 / -1;
}
.section-layout-header {
    text-align: center;
    padding: 2.5rem 2rem 1.5rem;
}
.section-layout-title {
    font-family: 'Playfair Display', var(--font-display), Georgia, serif;
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 600;
    margin: 0 0 0.35rem;
    letter-spacing: 0.02em;
    color: #ffffff;
}
.section-layout-subtitle {
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    line-height: 1.5;
}

.section-layout-content {
    grid-column: 1 / -1;
    position: relative;
    margin: 0 auto 0.5rem;
    max-width: 100%;
    padding: 0;
    background: rgba(7, 47, 45, 0.62);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* ----- Floating category flyout (Residential / Commercial): tab "Explore Projects" + panel on hover ----- */
.gallery-categories-flyout {
    --flyout-tab-w: 58px;
    --flyout-panel-max-w: min(86vw, 300px);
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 45;
    max-height: 78vh;
    pointer-events: none;
}
.gallery-categories-flyout .gallery-flyout-inner {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    pointer-events: auto;
    transform: translateX(calc(-100% + var(--flyout-tab-w)));
    transition: transform 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: drop-shadow(4px 0 20px rgba(0, 0, 0, 0.35));
}
/* Sin :focus-within: al salir el ratón el menú se cierra (no queda abierto por foco en enlaces) */
.gallery-categories-flyout.is-open .gallery-flyout-inner {
    transform: translateX(0);
}
@media (hover: hover) and (pointer: fine) {
    .gallery-categories-flyout:hover .gallery-flyout-inner {
        transform: translateX(0);
    }
}
.gallery-flyout-panel {
    width: var(--flyout-panel-max-w);
    flex-shrink: 0;
    max-height: 78vh;
    overflow: hidden;
    background: rgba(5, 35, 33, 0.96);
    border: 1px solid rgba(200, 154, 90, 0.35);
    border-right: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
.gallery-flyout-panel-inner {
    max-height: 78vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.gallery-flyout-tab {
    flex-shrink: 0;
    width: var(--flyout-tab-w);
    min-height: 168px;
    margin: 0;
    padding: 0.65rem 0.3rem;
    border: 1px solid rgba(200, 154, 90, 0.55);
    border-left: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: rgba(7, 47, 45, 0.92);
    color: rgba(255, 255, 255, 0.92);
    font-family: 'Playfair Display', var(--font-display), Georgia, serif;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}
/* Texto vertical en la pestaña "Explore Projects" (color hereda del botón: blanco → dorado al hover) */
.gallery-flyout-tab-label {
    display: block;
    white-space: nowrap;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: clamp(0.82rem, 1.15vw, 0.98rem);
    line-height: 1.2;
}
.gallery-flyout-tab:hover,
.gallery-flyout-tab:focus-visible {
    color: var(--brand-gold-light);
    border-color: rgba(200, 154, 90, 0.85);
    background: rgba(10, 55, 52, 0.95);
    outline: none;
}
.gallery-flyout-sidebar.sidebar-menu {
    position: static;
    left: auto;
    top: auto;
    bottom: auto;
    width: 100%;
    max-height: none;
    min-height: 0;
    height: auto;
    padding: 1.25rem 1.15rem 1.5rem;
    border: none;
    border-radius: 0;
    overflow: visible;
}
.gallery-flyout-sidebar .gallery-flyout-sidebar-title {
    margin-top: 0;
}

@media (prefers-reduced-motion: reduce) {
    .gallery-categories-flyout .gallery-flyout-inner {
        transition: none;
    }
}

/* Gallery panel: sin recuadro verde/cristal — la rejilla vive sobre el hero */
.section-gallery-content-panel.section-layout-content {
    min-height: 0;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    border-radius: 0;
    border: none;
    overflow: visible;
    margin-bottom: 0.75rem;
}

body.page-residential .section-gallery-content-panel.section-layout-content,
body.page-commercial .section-gallery-content-panel.section-layout-content {
    padding: 0;
}

/* Contenedor de galería: sin altura mínima forzada; sin estirar el main al paginar (HTMX) */
body.page-residential #gallery-container,
body.page-commercial #gallery-container {
    min-height: 0;
    justify-content: flex-start;
    /* Panel motion: calm deceleration, no overshoot (luxury interior / architectural, not SaaS) */
    --gallery-motion-ease: cubic-bezier(0.18, 0.89, 0.32, 1);
    --gallery-motion-duration: 0.52s;
}

body.page-residential #gallery-container > .gallery-frame,
body.page-commercial #gallery-container > .gallery-frame,
body.page-residential #gallery-container > #gallery-area,
body.page-commercial #gallery-container > #gallery-area {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity var(--gallery-motion-duration) var(--gallery-motion-ease),
        transform var(--gallery-motion-duration) var(--gallery-motion-ease);
}

/* Salida suave: ligero descenso + desvanecimiento (AJAX: nuevo fragmento sube al quitar --busy) */
#gallery-container.gallery-container--busy > .gallery-frame,
#gallery-container.gallery-container--busy > #gallery-area {
    opacity: 0.86;
    transform: translateY(8px);
}

/* Con o sin marco: columna compacta (no space-between rejilla↔paginación) */
body.page-residential #gallery-container .gallery-area,
body.page-commercial #gallery-container .gallery-area {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex: 0 0 auto;
    min-height: 0;
}

body.page-residential #gallery-container .gallery-grid,
body.page-commercial #gallery-container .gallery-grid {
    flex-grow: 0;
}

/* Textos vacíos legibles sobre el fondo */
body.page-residential .gallery-area .gallery-empty,
body.page-commercial .gallery-area .gallery-empty {
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 34rem;
    margin-left: auto;
    margin-right: auto;
    padding: 0.5rem 1rem 1.5rem;
}
body.page-residential .gallery-area .gallery-empty--pick-subcategory,
body.page-commercial .gallery-area .gallery-empty--pick-subcategory {
    max-width: 28rem;
}

/* Paginación sin “caja”; línea muy suave */
body.page-residential .gallery-area .pagination-container,
body.page-commercial .gallery-area .pagination-container {
    border-top-color: rgba(255, 255, 255, 0.1);
    background: transparent;
}

/* ----- Marco dorado animado + botón cerrar (galería con categoría) ----- */
.gallery-frame {
    --gallery-frame-radius: 16px;
    position: relative;
    z-index: 2;
    isolation: isolate;
    border-radius: var(--gallery-frame-radius);
    margin-top: 0.35rem;
    margin-bottom: 0.35rem;
    box-shadow:
        0 0 0 1px rgba(200, 154, 90, 0.38),
        0 0 18px rgba(200, 154, 90, 0.09),
        inset 0 0 0 1px rgba(255, 236, 200, 0.06);
}

.gallery-frame-glow {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 0;
    pointer-events: none;
    padding: 2px;
    box-sizing: border-box;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    overflow: hidden;
}

.gallery-frame-glow-spin {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 200%;
    height: 200%;
    margin: -100% 0 0 -100%;
    /* Brillo muy suave en el borde fino: sin blancos duros */
    background: conic-gradient(
        from 0deg,
        rgba(200, 154, 90, 0.06) 0deg,
        rgba(200, 154, 90, 0.1) 38deg,
        rgba(230, 205, 160, 0.32) 50deg,
        rgba(255, 242, 220, 0.38) 54deg,
        rgba(230, 205, 160, 0.28) 60deg,
        rgba(200, 154, 90, 0.12) 88deg,
        rgba(200, 154, 90, 0.05) 130deg,
        rgba(220, 190, 145, 0.18) 200deg,
        rgba(200, 154, 90, 0.07) 270deg,
        rgba(200, 154, 90, 0.06) 360deg
    );
    animation: gallery-frame-glow-orbit 14s linear infinite;
    will-change: transform;
    filter: blur(1.1px);
    opacity: 0.72;
}

@keyframes gallery-frame-glow-orbit {
    to {
        transform: rotate(1turn);
    }
}

/* Fondo: “reflectores” muy tenues, sin forma cuadrada definida */
.gallery-frame::before {
    content: '';
    position: absolute;
    inset: -32%;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 90% 70% at 18% 28%, rgba(255, 248, 238, 0.16) 0%, transparent 52%),
        radial-gradient(ellipse 75% 85% at 88% 72%, rgba(255, 236, 214, 0.12) 0%, transparent 48%),
        radial-gradient(ellipse 65% 50% at 52% 12%, rgba(240, 224, 200, 0.1) 0%, transparent 42%),
        radial-gradient(ellipse 80% 60% at 70% 45%, rgba(255, 252, 245, 0.08) 0%, transparent 55%);
    filter: blur(28px);
    opacity: 0.62;
    animation: gallery-frame-reflector-drift 16s ease-in-out infinite alternate;
}

@keyframes gallery-frame-reflector-drift {
    0% {
        transform: translate(-1.5%, 1%) scale(1);
        opacity: 0.48;
        filter: blur(26px);
    }
    33% {
        transform: translate(2%, -1.5%) scale(1.04);
        opacity: 0.72;
        filter: blur(32px);
    }
    66% {
        transform: translate(0.5%, 2%) scale(0.98);
        opacity: 0.55;
        filter: blur(30px);
    }
    100% {
        transform: translate(-1%, -0.5%) scale(1.02);
        opacity: 0.65;
        filter: blur(28px);
    }
}

.gallery-frame-inner {
    position: relative;
    z-index: 2;
    border-radius: calc(var(--gallery-frame-radius) - 3px);
}

.gallery-frame-close {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 15;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(200, 154, 90, 0.78);
    background: rgba(5, 35, 33, 0.9);
    color: rgba(255, 245, 220, 0.98);
    font-size: 1.65rem;
    line-height: 1;
    font-family: var(--font-body), system-ui, sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 236, 200, 0.12);
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.gallery-frame-close:hover,
.gallery-frame-close:focus-visible {
    background: rgba(200, 154, 90, 0.28);
    color: #fff;
    border-color: rgba(255, 236, 200, 0.95);
    transform: scale(1.06);
    outline: none;
    box-shadow: 0 0 32px rgba(200, 154, 90, 0.38), 0 4px 22px rgba(0, 0, 0, 0.42);
}

.gallery-frame-close-icon {
    display: block;
    position: relative;
    top: -1px;
    font-weight: 300;
}

.gallery-area.gallery-area--framed {
    padding-top: 0.5rem;
}

/* Entrada (popstate + caché, sin --busy): asentamiento suave desde abajo, misma curva que el panel */
.gallery-frame.gallery-panel--enter-in,
#gallery-container > #gallery-area.gallery-panel--enter-in {
    opacity: 0;
    transform: translateY(12px);
    transition: none;
}
.gallery-frame.gallery-panel--enter-in.gallery-panel--enter-in-active,
#gallery-container > #gallery-area.gallery-panel--enter-in.gallery-panel--enter-in-active {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity var(--gallery-motion-duration) var(--gallery-motion-ease),
        transform var(--gallery-motion-duration) var(--gallery-motion-ease);
}

@media (prefers-reduced-motion: reduce) {
    body.page-residential #gallery-container > .gallery-frame,
    body.page-commercial #gallery-container > .gallery-frame,
    body.page-residential #gallery-container > #gallery-area,
    body.page-commercial #gallery-container > #gallery-area {
        transition: opacity 0.28s cubic-bezier(0.33, 0, 0.67, 1);
    }
    #gallery-container.gallery-container--busy > .gallery-frame,
    #gallery-container.gallery-container--busy > #gallery-area {
        transform: none;
    }
    .gallery-frame.gallery-panel--enter-in,
    #gallery-container > #gallery-area.gallery-panel--enter-in {
        transform: none;
    }
    .gallery-frame.gallery-panel--enter-in.gallery-panel--enter-in-active,
    #gallery-container > #gallery-area.gallery-panel--enter-in.gallery-panel--enter-in-active {
        transition: opacity 0.3s cubic-bezier(0.33, 0, 0.67, 1);
    }
    .gallery-frame-glow-spin,
    .gallery-frame::before {
        animation: none !important;
    }
    .gallery-frame-glow-spin {
        transform: none;
        filter: none;
        opacity: 0.45;
    }
    .gallery-frame::before {
        opacity: 0.4;
    }
}

#gallery-container {
    opacity: 1;
    transition: opacity 0.2s ease;
}
#gallery-container.is-loading {
    opacity: 0.42;
    pointer-events: none;
}
#gallery-container.is-ready {
    opacity: 1;
}
#gallery-panel.is-loading {
    opacity: 0.42;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.gallery-item.is-filter-hidden {
    display: none;
}

/* Sidebar dentro del flyout (no posición absoluta en el panel principal) */
.sidebar-menu {
    position: relative;
    left: auto;
    top: auto;
    bottom: auto;
    width: 100%;
    padding: 2rem 1.5rem 2rem;
    margin: 0;
    background: transparent;
    border: none;
    border-right: none;
    border-radius: 0;
    box-shadow: none;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
}

/* Galería a ancho completo del panel de contenido */
.gallery-area {
    padding-top: 1.25rem;
    padding-bottom: 1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    margin-left: 0;
}
.gallery-area.has-pagination {
    padding-top: 4rem;
    padding-bottom: 2.25rem;
}

/* Dejar hueco para la pestaña fija del flyout; mismo inset derecho para centrar ópticamente el marco */
@media (min-width: 993px) {
    body.page-residential .gallery-area,
    body.page-commercial .gallery-area {
        padding-left: calc(58px + 1rem);
        padding-right: calc(58px + 1rem);
    }
}

/* ----- Section pages (Residential / Commercial): viewport-fit, no scroll (desktop only) ----- */
@media (min-width: 993px) {
    body.page-residential,
    body.page-commercial {
        height: 100vh;
        overflow: hidden;
    }
    body.page-residential .main-content,
    body.page-commercial .main-content {
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }
    body.page-residential .main-content .section-layout,
    body.page-commercial .main-content .section-layout {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: var(--header-h) 1.5rem 0.5rem 1.5rem;
        gap: 0;
    }
    /* Header wrap: takes all space above green block and centers the title+subtitle vertically */
    body.page-residential .section-layout-header-wrap,
    body.page-commercial .section-layout-header-wrap {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    body.page-residential .section-layout-header,
    body.page-commercial .section-layout-header {
        flex: 0 0 auto;
        padding: 0 2rem;
        text-align: center;
    }
    /* Match home hero typography: title = .hero-headline */
    body.page-residential .section-layout-title,
    body.page-commercial .section-layout-title {
        font-family: 'Playfair Display', var(--font-display), Georgia, serif;
        font-size: clamp(2.75rem, 6vw, 4.5rem);
        font-weight: 600;
        line-height: 1.12;
        margin: 0 0 1.25rem;
        letter-spacing: 0.045em;
        color: #ffffff;
        text-shadow: 0 2px 20px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.2);
    }
    /* Match home hero typography: subtitle = .hero-subheadline */
    body.page-residential .section-layout-subtitle,
    body.page-commercial .section-layout-subtitle {
        font-family: 'Inter', var(--font-body), sans-serif;
        font-size: clamp(1.05rem, 1.9vw, 1.2rem);
        font-weight: 400;
        letter-spacing: 0.025em;
        color: rgba(255, 255, 255, 0.92);
        margin: 0 0 3rem;
        line-height: 1.65;
        max-width: 32em;
        margin-left: auto;
        margin-right: auto;
        text-shadow: 0 1px 12px rgba(0, 0, 0, 0.3);
    }
    /* Panel de galería anclado al pie del viewport-flex */
    body.page-residential .section-gallery-content-panel,
    body.page-commercial .section-gallery-content-panel {
        flex: 0 0 auto;
        margin-top: auto;
        margin-bottom: 0.5rem;
    }
}

.sidebar-menu h2 {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 1.25rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid rgba(200, 154, 90, 0.3);
}

.sidebar-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-menu li {
    margin: 0 0 0.15rem;
}
.sidebar-menu a {
    display: block;
    padding: 0.7rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition-fast);
    border-left: 3px solid transparent;
    margin-left: -3px;
}
.sidebar-menu a:hover {
    color: var(--brand-gold-light);
    background: rgba(200, 154, 90, 0.12);
    border-left-color: rgba(200, 154, 90, 0.5);
    transform: translateX(4px);
}
.sidebar-menu a.active {
    color: var(--brand-gold);
    background: rgba(200, 154, 90, 0.12);
    border-left-color: var(--brand-gold);
    font-weight: 500;
}
.sidebar-menu .sidebar-empty {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    padding: 0.7rem 1rem;
    display: block;
}
.sidebar-menu .sidebar-category-parent {
    margin-bottom: 0.25rem;
}
.sidebar-menu .category-parent-row {
    display: flex;
    align-items: stretch;
    gap: 0;
}
/* Padre con hijos: solo despliega subcategorías (sin enlace a galería) */
.sidebar-menu .category-parent-toggle {
    flex: 1;
    min-width: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 0.65rem 0.7rem 1rem;
    margin: 0 0 0 -3px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    border-radius: var(--radius);
    text-align: left;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition-fast);
}
.sidebar-menu .category-parent-toggle-label {
    flex: 1;
    min-width: 0;
}
.sidebar-menu .category-parent-toggle:hover {
    color: var(--brand-gold-light);
    background: rgba(200, 154, 90, 0.12);
    border-left-color: rgba(200, 154, 90, 0.5);
    transform: translateX(4px);
}
.sidebar-menu .category-parent-toggle.active {
    color: var(--brand-gold);
    background: rgba(200, 154, 90, 0.12);
    border-left-color: var(--brand-gold);
    font-weight: 500;
}
.sidebar-menu .category-parent-toggle .category-toggle-icon {
    flex-shrink: 0;
    display: block;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-bottom: 0.2rem;
    margin-right: 0.15rem;
    transition: transform 0.2s;
    opacity: 0.85;
}
.sidebar-menu .sidebar-category-parent.is-expanded .category-parent-toggle .category-toggle-icon {
    transform: rotate(-135deg);
    margin-bottom: -0.2rem;
}
.sidebar-menu .sidebar-subcategory-list {
    list-style: none;
    margin: 0 0 0 0.5rem;
    padding: 0 0 0 0.75rem;
    border-left: 1px solid rgba(200, 154, 90, 0.25);
    display: none;
}
.sidebar-menu .sidebar-category-parent.is-expanded .sidebar-subcategory-list {
    display: block;
}
.sidebar-menu .sidebar-subcategory-list li {
    margin: 0;
}
.sidebar-menu .category-link-child {
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
    opacity: 0.95;
}

/* ----- Contact page ----- */
.contact-page {
    padding-top: calc(var(--header-h) + 4rem);
    padding-bottom: 5rem;
    max-width: 800px;
    margin: 0 auto;
    padding-left: 2rem;
    padding-right: 2rem;
}
.contact-hero {
    margin-bottom: 2.5rem;
}
.contact-page h1 {
    font-family: 'Playfair Display', var(--font-display), Georgia, serif;
    font-size: clamp(2.25rem, 4vw, 3rem);
    font-weight: 600;
    margin: 0 0 0.5rem;
    letter-spacing: 0.02em;
    color: var(--text-light);
}
.contact-tagline {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-text-muted);
}
.contact-cta-block {
    margin-bottom: 2.5rem;
    padding: 2rem;
    background: var(--glass-bg);
    border: 1px solid rgba(200, 154, 90, 0.35);
    border-radius: var(--radius);
    text-align: center;
}
.contact-cta-lead {
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.contact-cta-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}
.btn-contact {
    display: inline-block;
    padding: 0.85rem 1.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition), transform var(--transition-fast);
}
.btn-contact-phone,
.btn-contact-email {
    background: var(--brand-gold);
    color: var(--brand-green-dark);
    border: 1px solid var(--brand-gold);
}
.btn-contact-phone:hover,
.btn-contact-email:hover {
    background: var(--brand-gold-light);
    color: var(--brand-green-dark);
}
.btn-contact-whatsapp {
    background: transparent;
    color: var(--brand-gold);
    border: 1px solid var(--brand-gold);
}
.btn-contact-whatsapp:hover {
    background: rgba(200, 154, 90, 0.15);
    color: var(--brand-gold-light);
}
.contact-details {
    display: grid;
    gap: 1.75rem;
}
.contact-empty {
    color: var(--color-text-muted);
    font-style: italic;
}
.contact-block {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(200, 154, 90, 0.35);
    border-radius: var(--radius);
    padding: 2.25rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.contact-block h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--brand-gold);
    letter-spacing: 0.04em;
}
.contact-block p {
    margin: 0 0 0.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
}
.contact-block a {
    color: var(--text-light);
}
.contact-block a:hover {
    color: var(--brand-gold);
}

/* ----- Sticky footer on inner pages (Residential, Commercial, Contact) ----- */
body:not(.page-home) {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
body:not(.page-home) .main-content {
    flex: 1 0 auto;
}
body:not(.page-home) .site-footer {
    flex: 0 0 auto;
}

/*
 * Residential / Commercial en móvil: sin flex-grow en <main>.
 * Si main tiene flex: 1 0 auto con body min-height 100vh, el main se estira a toda la vista aunque
 * el contenido sea bajo → hueco enorme (fondo hero) y el footer queda “flotando” con scroll vacío debajo.
 * margin-top: auto en el footer rellena hasta el pie del viewport sin inflar el main.
 */
@media (max-width: 992px) {
    body.page-residential .main-content,
    body.page-commercial .main-content {
        flex: 0 1 auto;
    }
    body.page-residential #gallery-container,
    body.page-commercial #gallery-container {
        min-height: 0 !important;
    }
}

/* ----- Footer (compact) ----- */
.site-footer {
    position: relative;
    z-index: 10;
    background: var(--brand-green-dark);
    border-top: 1px solid rgba(200, 154, 90, 0.3);
    padding: 1.25rem 2rem 0.75rem;
    margin-top: auto;
    text-align: center;
}
.site-footer .footer-copyright {
    margin: 0;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.02em;
}
body.page-home .site-footer {
    padding: 1rem 2rem 0.5rem;
}
body.page-home .footer-bottom {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
}

.footer-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto auto auto auto;
    gap: 1.5rem;
    align-items: center;
}
.footer-brand .footer-logo-link {
    display: inline-block;
    color: inherit;
}
.footer-logo-img {
    display: block;
    max-height: 36px;
    width: auto;
    object-fit: contain;
}
.footer-logo-text {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.04em;
}
.footer-tagline {
    margin: 0.25rem 0 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}
.footer-brand .footer-logo-link + .footer-tagline {
    margin-top: 0.25rem;
}
.footer-contact,
.footer-address,
.footer-social {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.footer-contact h3,
.footer-address h3,
.footer-social h3 {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 0.35rem;
}
.footer-contact p,
.footer-address p,
.footer-social .social-links {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
}
.footer-contact p + p,
.footer-address p + p {
    margin-top: 0.15rem;
}
.footer-address {
    text-align: center;
}
.footer-address p {
    max-width: 12em;
    margin-left: auto;
    margin-right: auto;
}
.footer-social .social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.footer-social .social-links a {
    color: rgba(255, 255, 255, 0.8);
}
.footer-social .social-links a:hover {
    color: var(--brand-gold);
}
.footer-bottom {
    max-width: var(--content-max);
    margin: 0.75rem auto 0;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(200, 154, 90, 0.25);
    text-align: center;
}
.footer-bottom p {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.02em;
}

.no-social {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* ----- Responsive: 1200 | 992 | 768 | 576 | 420 ----- */

@media (max-width: 1200px) {
    .hero-content {
        max-width: 820px;
        padding-left: 1.75rem;
        padding-right: 1.75rem;
    }
    .section-layout-header {
        padding-left: 1.75rem;
        padding-right: 1.75rem;
    }
    .gallery-area {
        padding-left: 1.35rem;
        padding-right: 1.35rem;
    }
}

@media (max-width: 992px) {
    /* ----- Mobile header: logo left, hamburger right ----- */
    .site-header {
        height: var(--header-h-mobile, 64px);
    }
    .header-inner {
        grid-template-columns: 1fr auto;
        padding: 0 1rem; /* 16px safe area */
        gap: 1rem;
    }
    .header-inner .nav-main {
        justify-self: auto;
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 999;
        background: rgba(5, 35, 33, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(200, 154, 90, 0.4);
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        visibility: hidden;
        pointer-events: none;
        grid-column: 1 / -1;
        padding: 0 1.25rem;
        gap: 0;
        transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease, visibility 0s linear 0.4s;
    }
    .header-inner .nav-main.is-open {
        max-height: 80vh;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        padding: 1.25rem 1.5rem 1.5rem;
        gap: 0.25rem;
        transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease, visibility 0s;
    }
    .header-inner .nav-main.is-open a {
        color: #ffffff;
        font-size: 1.1rem;
        font-weight: 500;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        padding: 1rem 1rem;
        min-height: var(--tap-min, 48px);
        display: flex;
        align-items: center;
        border-radius: var(--radius);
        transition: color 0.2s ease, background 0.2s ease;
    }
    .header-inner .nav-main.is-open a:hover,
    .header-inner .nav-main.is-open a:focus {
        color: var(--brand-gold);
        background: rgba(200, 154, 90, 0.1);
    }
    .header-inner .nav-main.is-open a::after {
        display: none;
    }
    .header-inner .header-right {
        display: none;
    }
    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: var(--tap-min, 44px);
        min-height: var(--tap-min, 44px);
        width: 44px;
        height: 44px;
        padding: 0;
    }
    .logo-img {
        max-height: 40px;
    }

    .section-layout-header {
        padding: 2rem 1.5rem 1rem;
    }
    .section-layout-title {
        font-size: clamp(1.85rem, 4.5vw, 2.75rem);
    }
    .section-layout-subtitle {
        font-size: clamp(0.9rem, 1.8vw, 1.05rem);
    }
}

@media (max-width: 1024px) {
    /* Flyout: categorías en columna (no el layout horizontal antiguo del sidebar embebido) */
    .gallery-categories-flyout {
        top: auto;
        bottom: 6rem;
        transform: none;
        max-height: min(70vh, 520px);
    }
    .gallery-flyout-tab {
        min-height: 120px;
    }
    .gallery-flyout-tab-label {
        font-size: clamp(0.78rem, 2.6vw, 0.92rem);
    }
    .gallery-area {
        margin-left: 0;
        padding: 1.25rem 1.15rem 1.25rem;
    }
}

/* Short viewport or mobile: scroll si el contenido supera el viewport; main+hero rellenan hasta el footer (sin franja verde) */
@media (max-height: 700px), (max-width: 768px) {
    body.page-home {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }
    body.page-home .main-content {
        flex: 1 1 0;
        min-height: 0;
    }
    body.page-home .hero-fullscreen {
        flex: 1;
        min-height: 0;
    }
    body.page-home .hero-content {
        padding: var(--header-h-mobile, var(--header-h)) 1rem 0.9rem;
    }
    body.page-home .hero-headline {
        font-size: clamp(1.85rem, 6vw, 2.75rem);
        margin-bottom: 0.4rem;
        line-height: 1.15;
    }
    body.page-home .hero-subheadline {
        font-size: clamp(0.875rem, 2vw, 0.95rem);
        margin-bottom: 0.85rem;
        line-height: 1.5;
    }
    body.page-home .hero-buttons {
        gap: 0.85rem;
    }
    body.page-home .hero-card {
        min-height: 180px;
        padding: 1.75rem 1.75rem;
    }
    body.page-home .hero-cta-image {
        min-height: 180px;
        width: 100%;
        max-width: 320px;
    }
    body.page-home .hero-cta-image img {
        min-height: 180px;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 0 1rem; /* 16px safe area from edge */
    }
    .logo-img {
        max-height: 36px;
    }
    .header-inner .nav-main.is-open {
        padding: 1rem 1.25rem 1.25rem;
        gap: 0.35rem;
        transition: max-height 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease, visibility 0s;
    }
    .header-inner .nav-main.is-open a {
        padding: 0.9rem 1rem;
        font-size: 1.05rem;
        min-height: 48px;
    }
    .hero-content {
        padding: var(--header-h-mobile, 64px) 1rem 1.5rem;
        max-width: 100%;
    }
    .hero-headline {
        font-size: clamp(1.75rem, 8vw, 2.5rem);
        margin-bottom: 0.5rem;
    }
    .hero-subheadline {
        font-size: clamp(0.875rem, 2.5vw, 1rem);
        margin-bottom: 1.25rem;
    }
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    .hero-card {
        width: 100%;
        max-width: 320px;
        min-height: 160px;
        padding: 1.75rem 1.25rem;
    }
    .hero-cta-image {
        width: 100%;
        max-width: 320px;
        min-height: 160px;
    }
    .hero-cta-image img {
        min-height: 160px;
    }
    .hero-card .title {
        font-size: 1.65rem;
    }
    .hero-card .sub {
        font-size: 0.7rem;
    }
    .hero-card-icon {
        margin-bottom: 1rem;
        padding: 0 1rem;
    }
    .hero-card-icon img {
        width: 140px;
        max-width: 68%;
        height: auto;
    }
    .gallery-area {
        padding: 1.25rem 0.85rem 1.25rem;
    }
    .footer-inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 0.9rem;
        align-items: center;
        padding: 0 1rem;
    }
    .footer-contact,
    .footer-address,
    .footer-social {
        text-align: center;
    }
    .footer-contact h3,
    .footer-address h3,
    .footer-social h3 {
        margin-top: 0.35rem;
        font-size: 0.65rem;
    }
    .footer-contact p,
    .footer-address p {
        font-size: 0.85rem;
    }
    .footer-social .social-links {
        justify-content: center;
        gap: 0.75rem;
    }
    .footer-bottom {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .contact-page {
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: calc(var(--header-h-mobile, 64px) + 2.5rem);
        padding-bottom: 3rem;
    }
    .contact-block {
        padding: 1.5rem 1.25rem;
    }
    .section-hero.section-hero-bg {
        top: var(--header-h-mobile, 64px);
    }
    .section-layout {
        padding-top: var(--header-h-mobile, 64px);
    }
    .section-layout-header {
        padding: 2rem 1.25rem 1rem;
    }
    .section-layout-title {
        font-size: clamp(1.65rem, 6vw, 2.25rem);
    }
    .section-layout-subtitle {
        font-size: 0.95rem;
    }
    .section-layout {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 576px) {
    .header-inner {
        padding: 0 0.75rem; /* 12px min safe area */
    }
    body.page-home .hero-content {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        padding-bottom: 0.75rem;
    }
    body.page-home .hero-headline {
        font-size: clamp(1.6rem, 7.5vw, 2rem);
        margin-bottom: 0.35rem;
    }
    body.page-home .hero-subheadline {
        font-size: 0.875rem;
        margin-bottom: 0.75rem;
    }
    body.page-home .hero-buttons {
        gap: 0.75rem;
    }
    body.page-home .hero-card {
        min-height: 150px;
        padding: 1.5rem 1.25rem;
        max-width: 100%;
    }
    body.page-home .hero-cta-image {
        min-height: 150px;
    }
    body.page-home .hero-cta-image img {
        min-height: 150px;
    }
    .hero-content {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        padding-bottom: 1.25rem;
    }
    .hero-headline {
        margin-bottom: 0.4rem;
    }
    .hero-subheadline {
        margin-bottom: 1rem;
    }
    .hero-buttons {
        gap: 0.85rem;
    }
    .hero-card .title {
        font-size: 1.5rem;
    }
    .gallery-area {
        padding: 1rem 0.65rem 1rem;
    }
    .sidebar-menu {
        padding: 1rem 1.25rem;
        gap: 0.5rem;
    }
    .sidebar-menu a {
        padding: 0.65rem 0.9rem;
        min-height: 44px;
    }
    .footer-inner {
        gap: 0.75rem;
    }
    .contact-page {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .section-layout-header {
        padding: 1.5rem 0.75rem 0.75rem;
    }
    .section-layout-title {
        font-size: clamp(1.5rem, 6.5vw, 2rem);
    }
    .section-layout-subtitle {
        font-size: 0.9rem;
    }
}

@media (max-width: 420px) {
    .hero-headline {
        font-size: clamp(1.5rem, 8.5vw, 1.85rem);
    }
    .hero-subheadline {
        font-size: 0.85rem;
    }
    .hero-card {
        padding: 1.25rem 1.25rem;
    }
    .hero-card-icon img {
        width: 120px;
        max-width: 70%;
    }
    .nav-main.is-open a {
        padding: 0.65rem 0.75rem;
    }
    .section-layout-title {
        font-size: clamp(1.4rem, 8vw, 1.75rem);
    }
    .section-layout-subtitle {
        font-size: 0.85rem;
    }
}
