/* ============================================
   LXE — SITE ENHANCEMENTS (shared, additive)
   Scroll progress · back-to-top · gallery lightbox
   selection & focus states · page fade-in
   ============================================ */

/* ── Brand text selection ─────────────────── */
::selection {
    background: rgba(152, 123, 88, 0.85);
    color: #F5EFE6;
}

/* ── Visible keyboard focus (a11y) ────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
    outline: 1.5px solid #987B58;
    outline-offset: 3px;
    border-radius: 2px;
}

/* ── Skip link ────────────────────────────── */
.skip-link {
    position: fixed;
    top: -60px;
    left: 16px;
    z-index: 10000;
    background: #0F0D0A;
    color: #987B58;
    padding: 10px 22px;
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    text-decoration: none;
    border: 1px solid rgba(152, 123, 88, 0.4);
    transition: top 0.25s ease;
}
.skip-link:focus {
    top: 16px;
}

/* ── Scroll progress bar ──────────────────── */
.lxe-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 9999;
    pointer-events: none;
    background: transparent;
}
.lxe-progress span {
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, rgba(152,123,88,0.55), #987B58);
    transform-origin: 0 50%;
    transform: scaleX(0);
    will-change: transform;
}

/* ── Back to top ──────────────────────────── */
.lxe-top-btn {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 46px;
    height: 46px;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 13, 10, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(152, 123, 88, 0.35);
    border-radius: 50%;
    color: #987B58;
    cursor: pointer;
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    /* Out of the tab order while hidden, not just transparent. */
    visibility: hidden;
    transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.3s ease, background 0.3s ease, visibility 0s linear 0.4s;
}
.lxe-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.3s ease, background 0.3s ease, visibility 0s;
}
.lxe-top-btn:hover {
    border-color: #987B58;
    background: rgba(15, 13, 10, 0.8);
}
.lxe-top-btn svg {
    width: 15px;
    height: 15px;
}
@media (max-width: 768px) {
    /* Smaller and translucent at rest on mobile: with content scrolling
       continuously beneath a persistent fixed button, full opacity means
       it inevitably sits squarely on top of text or photography at some
       point. Full brightness returns on touch so it's still unmistakably
       a control, not a decoration. */
    .lxe-top-btn { right: 14px; bottom: 14px; width: 36px; height: 36px; }
    .lxe-top-btn.visible { opacity: 0.5; }
    .lxe-top-btn:active {
        opacity: 1;
        background: rgba(15, 13, 10, 0.8);
    }
}

/* ── Gallery lightbox ─────────────────────── */
.lxe-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 9, 7, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    /* Closed viewer leaves the tab order and accessibility tree. */
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
.lxe-lightbox.open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.35s ease, visibility 0s;
}
.lxe-lightbox img {
    max-width: 88vw;
    max-height: 84vh;
    object-fit: contain;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    transform: scale(0.96);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    user-select: none;
}
.lxe-lightbox.open img {
    transform: scale(1);
}
.lxe-lb-close,
.lxe-lb-prev,
.lxe-lb-next {
    position: absolute;
    background: none;
    border: 1px solid rgba(152, 123, 88, 0.35);
    color: #987B58;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: border-color 0.3s ease, color 0.3s ease;
}
.lxe-lb-close:hover, .lxe-lb-prev:hover, .lxe-lb-next:hover {
    border-color: #987B58;
    color: #F5EFE6;
}
.lxe-lb-close { top: 24px; right: 24px; }
.lxe-lb-prev  { left: 24px; top: 50%; transform: translateY(-50%); }
.lxe-lb-next  { right: 24px; top: 50%; transform: translateY(-50%); }
.lxe-lb-counter {
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(245, 239, 230, 0.55);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
}
@media (max-width: 768px) {
    .lxe-lb-prev { left: 10px; }
    .lxe-lb-next { right: 10px; }
    .lxe-lightbox img { max-width: 96vw; }
}

/* Zoom-in affordance on gallery images */
.g-item img,
.image-pair-wrap img,
.project-full-image img {
    cursor: zoom-in;
}

/* ── Page fade-in (non-index pages) ───────── */
body.project-page,
body.contact-page,
body.pall-page {
    animation: lxePageFade 0.7s ease both;
}
@keyframes lxePageFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    body.project-page, body.contact-page, body.pall-page { animation: none; }
    .lxe-lightbox, .lxe-lightbox img, .lxe-top-btn { transition: none; }
}

/* ── Footer social icons ─────────────────────
   Replaces the bare "IG" / "LI" abbreviations with proper marks in
   hairline gold circles. !important only where it has to beat the
   older text-link rules in footer.css / layout.css. */
.footer-social { gap: 0.75rem; margin-top: 1rem; }
.footer-social a {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(152, 123, 88, 0.45) !important;
    color: #D9C3A0 !important;
    opacity: 0.85 !important;
    transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease, transform 0.35s ease, opacity 0.35s ease !important;
}
.footer-social a:hover,
.footer-social a:focus-visible {
    opacity: 1 !important;
    color: #0F0D0A !important;
    background-color: #987B58;
    border-color: #987B58 !important;
    transform: translateY(-2px);
}
.footer-social svg { display: block; }

/* ── Nav over the hero video ─────────────────
   Before the glass nav engages, the home page nav sits on night
   photography where the page gold (#987B58) all but disappears. Lift it to
   champagne there only; cream-topped pages and the scrolled glass state
   keep the original gold. (:has() is progressive: unsupported browsers
   simply keep the gold.) */
body:has(#hero-video) #lxe-nav:not(.glass-active) .nav-links a,
body:has(#hero-video) #lxe-nav:not(.glass-active) .lxe-logo-main,
body:has(#hero-video) #lxe-nav:not(.glass-active) .lxe-logo-sub {
    color: #E9D7B8;
    transition: color 0.5s ease;
}
body:has(#hero-video) #lxe-nav:not(.glass-active) .lxe-logo-sub { opacity: 0.85; }
body:has(#hero-video) #lxe-nav:not(.glass-active) .nav-hamburger {
    border-color: rgba(233, 215, 184, 0.55);
    background: rgba(15, 13, 10, 0.18);
}
body:has(#hero-video) #lxe-nav:not(.glass-active) .nav-hamburger span { background: #E9D7B8; }

/* ── Expertise hint copy ─────────────────────
   "Select" on pointer devices, "Tap" on touch. */
.hint-touch { display: none; }
@media (hover: none), (max-width: 768px) {
    .hint-pointer { display: none; }
    .hint-touch { display: inline; }
}

/* ── Mobile expertise: anchor label + hint to the card ──
   They used to sit at fixed screen offsets (11vh from the top, 4vh from
   the bottom), leaving dead gaps around the card on tall phones and the
   hint colliding with the back-to-top button. --xp-card-h is set by
   sizeMobileStage() in js/scene.js. */
@media screen and (max-width: 768px) {
    .xp-head {
        top: var(--xp-head-top, calc(50% - var(--xp-card-h, 60vh) / 2 - 5.6rem));
        left: 5vw;
        right: 5vw;
        text-align: center;
    }
    .xp-chapter { justify-content: center; }
    .xp-hint {
        top: var(--xp-hint-top, calc(50% + var(--xp-card-h, 60vh) / 2 + 1.8rem));
        bottom: auto;
        left: 0;
        right: 0;
        justify-content: center;
        white-space: nowrap;
    }
}

/* ── Page transition veil (js/luxe.js) ─────── */
.lxe-veil {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5EFE6;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.65, 0, 0.35, 1), visibility 0.5s;
}
.lxe-veil.is-leaving { opacity: 1; visibility: visible; pointer-events: auto; }
.lxe-veil-mark {
    font-size: 2.6rem;
    letter-spacing: 0.08em;
    color: #987B58;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.45s ease 0.12s, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.12s;
}
.lxe-veil.is-leaving .lxe-veil-mark { opacity: 1; transform: none; }

/* ── Portfolio curtain reveal (js/luxe.js) ─── */
.lxe-curtains .project-track .project-card {
    clip-path: inset(100% 0 0 0);
    transition: clip-path 1.3s cubic-bezier(0.77, 0, 0.18, 1);
}
.lxe-curtains .project-track .project-card.is-revealed { clip-path: inset(0 0 0 0); }
.lxe-curtains .project-track .project-card img {
    transform: scale(1.16);
    transition: transform 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.lxe-curtains .project-track .project-card.is-revealed img { transform: scale(1.04); }
.lxe-curtains .project-track .project-card.is-revealed:hover img { transform: scale(1.08); }

/* ── Current page in the nav (js/luxe.js) ──── */
.nav-links a[aria-current="page"] { color: var(--lxe-dark-gold); }
.nav-links a[aria-current="page"]::after { width: 100%; }
.mobile-menu ul li a[aria-current="page"] { color: var(--lxe-gold); opacity: 1; }
.mobile-menu ul li a[aria-current="page"]::after { width: 100%; }

/* ── Hero scroll cues on phones ──────────────
   The projects and contact heroes pin their "Scroll" cue absolutely to the
   bottom-right corner. On a phone the intro paragraph runs the full width
   of that corner, so the cue sat on top of the text. Below 768px it joins
   the normal flow beneath the paragraph as a horizontal cue instead. */
@media screen and (max-width: 768px) {
    .pall-hero-scroll,
    .contact-hero-scroll {
        position: static;
        flex-direction: row;
        align-self: flex-start;
        gap: 1rem;
        margin-top: 2.6rem;
    }
    .pall-hero-scroll .hero-scroll-line {
        width: 40px;
        height: 1px;
    }
    .pall-hero-scroll .hero-scroll-line::after {
        top: 0;
        left: -100%;
        animation: scrollLineMove 1.5s ease-in-out infinite;
    }
    .pall-hero-scroll p { writing-mode: horizontal-tb; transform: none; }
}

/* Keep the gold ring flourish centred on the card, not on the (now
   full-height) stage. */
@media screen and (max-width: 768px) {
    .scene-ring { top: calc(var(--xp-card-top, 40vh) + var(--xp-card-h, 20vh) / 2); }
}

/* ── Bottom-anchored heroes vs. Safari's toolbar ──
   On iPhone, 100vh is the LARGE viewport (as if the toolbars were hidden),
   so headlines anchored to the bottom of a 100vh hero - every project
   page, the projects index and contact - had their last line sitting
   behind Safari's floating bottom bar. 100svh is the height that stays
   clear of it; the home hero already used it. */
@media screen and (max-width: 768px) {
    .project-hero { height: 100vh; height: 100svh; }
    .pall-hero,
    .contact-hero { min-height: 100vh; min-height: 100svh; }
}

/* ── Touch hit areas ─────────────────────────
   Several text links are only 15-24px tall: the footer links, "Begin a
   Project", the projects page CTAs, the contact details and, on a touch
   iPad, the top nav. On touch screens each gets an invisible hit area
   that reaches past its edges, so the visible design is untouched (their
   underlines are drawn from their own bottom edge, which padding would
   have pushed away). Vertical reach is sized so neighbours never overlap. */
@media (pointer: coarse) {
    .footer-col > a,
    .footer-cta,
    .pall-cta,
    .nav-links a,
    .contact-detail-cell .cell-value a,
    .contact-cta-bar a { position: relative; }

    .footer-col > a::before,
    .footer-cta::before,
    .pall-cta::before,
    .nav-links a::before,
    .contact-detail-cell .cell-value a::before,
    .contact-cta-bar a::before {
        content: '';
        position: absolute;
        inset: -12px -6px;
    }
    /* Footer links sit 14px apart: reach 7px so adjacent areas just meet. */
    .footer-col > a::before { inset: -7px 0; }
}

/* ── Section links on phones ─────────────────
   "Process" and "Projects" links land with the section's top edge at the
   top of the screen, which on a phone put the "03 - Our Process" label
   flush against the 80px nav and the portfolio heading partly beneath it.
   The margin (less than the nav's height, so nothing of the previous
   section shows) is honoured by #hash links from other pages natively and
   by the home page's own smooth-scroll links in js/animations.js. */
@media screen and (max-width: 768px) {
    #process-section,
    #portfolio-section { scroll-margin-top: 44px; }
}
