/* ==========================================================
   ICON BALI DIGITAL — UX & ACCESSIBILITY STANDARD v1.0
   Phase 3 R1
   ========================================================== */

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 10000;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f8fafc;
    color: #06111d;
    font-weight: 700;
    transform: translateY(-160%);
    transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }

:where(a, button, [tabindex="0"]):focus-visible {
    outline: 3px solid #58d5ff;
    outline-offset: 3px;
}

#main-content:focus { outline: none; }

.mobile-toggle {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 4px;
    font: inherit;
}

body.nav-open,
body.lightbox-open { overflow: hidden; }

/* Architecture images are actionable only when Phase 3 JS is available. */
.architecture-zoomable {
    cursor: zoom-in;
}
.architecture-zoomable[role="button"]:focus-visible {
    border-radius: 12px;
    outline: 3px solid var(--product-accent, #58d5ff);
    outline-offset: 4px;
}

.architecture-zoom-hint {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.4;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(2, 8, 23, .94);
    backdrop-filter: blur(8px);
}
.image-lightbox.is-open { display: flex; }
.image-lightbox__dialog {
    position: relative;
    width: min(96vw, 1500px);
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.image-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: calc(94vh - 70px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.image-lightbox__caption {
    color: #cbd5e1;
    font-size: 14px;
    text-align: center;
}
.image-lightbox__close {
    position: absolute;
    top: -18px;
    right: -18px;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px;
    background: #0f172a;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 767px) {
    .image-lightbox { padding: 14px; }
    .image-lightbox__dialog { width: 100%; }
    .image-lightbox__image { max-height: calc(92vh - 64px); }
    .image-lightbox__close { top: 0; right: 0; }
}

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

/* ============================================================
   PHASE 3 R3 — RESPONSIVE & PERFORMANCE HARDENING v2
   Additive resilience layer. Does not replace approved homepage,
   product-media, or navigation corrective stylesheets.
   ============================================================ */

/* Prevent accidental horizontal overflow from wide media/content. */
html {
    overflow-x: clip;
    scrollbar-gutter: stable;
}

body {
    min-width: 320px;
}

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

.architecture-zoomable {
    max-width: 100%;
    height: auto;
}

/* Long labels/URLs must never force cards/navigation wider. */
.product-card,
.enterprise-box,
.talk-item,
.vdeck-card,
.ops-card,
.cy-card,
.work-card,
.arch-card,
.image-lightbox__caption {
    overflow-wrap: anywhere;
}

/* Improve touch ergonomics without changing mouse/desktop geometry. */
@media (pointer: coarse) {
    .mobile-toggle,
    .nav-menu > li > a,
    .dropdown-content a,
    .btn,
    .image-lightbox__close,
    .architecture-zoomable[role="button"] {
        min-height: 44px;
        touch-action: manipulation;
    }

    .mobile-toggle,
    .image-lightbox__close {
        min-width: 44px;
    }
}

/* Modern dynamic viewport support avoids mobile browser chrome clipping. */
@supports (height: 100dvh) {
    .image-lightbox {
        min-height: 100dvh;
        max-height: 100dvh;
    }

    .image-lightbox__dialog {
        max-height: calc(100dvh - 28px);
    }

    .image-lightbox__image {
        max-height: calc(100dvh - 98px);
    }
}

/* Short landscape screens need a tighter lightbox viewport. */
@media (max-height: 520px) and (orientation: landscape) {
    .image-lightbox {
        padding: 10px;
    }

    .image-lightbox__dialog {
        gap: 6px;
    }

    .image-lightbox__image {
        max-height: calc(100dvh - 46px);
    }

    .image-lightbox__caption {
        font-size: 12px;
    }
}

/* Defer lower-page rendering where supported. */
@supports (content-visibility: auto) {
    #products,
    #enterprise,
    #contact,
    .architecture-section,
    .vdeck-details,
    .benefits-detail,
    .cydeck-details,
    .workdeck-details {
        content-visibility: auto;
        contain-intrinsic-size: auto 820px;
    }
}

/* Narrow-screen resilience. */
@media (max-width: 420px) {
    h1,
    h2,
    h3,
    .hero-title,
    .section-title h2 {
        overflow-wrap: break-word;
    }

    .image-lightbox__caption {
        max-width: 92vw;
    }
}
