/* ============================================================
   NAV PILL - centered horizontally and PINNED to the top of the viewport.

   Was position:absolute inside .hero-header, which meant it scrolled off
   with the hero after the first screen. It is now position:fixed so it
   stays visible for the whole page, and top lives in --nav-top so the
   one value is shared by the pill and the anchor offset below.

   Two things make `fixed` work here:
   - no ancestor between this and <html> has transform/filter/perspective/
     backdrop-filter/contain, so the viewport stays the containing block
     (a fixed element is therefore not clipped by .hero's overflow:hidden);
   - it keeps transform:translateX(-50%), because with left:50% the
     containing block is now the viewport rather than .hero-header.

   Behaviour (scroll-spy, the <=768px menu button, the --nav-h
   measurement) lives in components/Navbar/navbar.js.
   ============================================================ */

:root{
    /* Distance from the viewport top to the top of the pill. */
    --nav-top:22px;

    /* Height of the pill. navbar.js overwrites this with the measured
       value so it stays correct at every breakpoint; 60px is the desktop
       measurement and the fallback when scripting is unavailable. */
    --nav-h:60px;

    /* Where every anchor target lands: below the pinned pill plus a
       little air. Nothing else may use a hard-coded scroll offset. */
    --nav-offset:calc(var(--nav-top) + var(--nav-h) + 14px);
}

/* On phones the hero is short (it scales as a whole, hero.css), so the pill
   sits closer to the top edge. --nav-offset follows this value. */
@media screen and (max-width:768px){
    :root{
        --nav-top:8px;
    }
}

/* Smooth jumps between the nav targets, but only for visitors who have
   not asked the OS for reduced motion. Under prefers-reduced-motion the
   media query does not apply, so the same clicks scroll instantly. */
@media screen and (prefers-reduced-motion:no-preference){
    html{
        scroll-behavior:smooth;
    }
}

/* One rule for every nav target. The id selector beats the old
   class-based offsets in properties.css / responsive-base.css /
   best-units.css, so a target can never fall back to a magic number. */
#top,
#properties,
#highlightsSection{
    scroll-margin-top:var(--nav-offset);
}

.hero-nav{
    width:max-content;
    position:fixed;
    top:var(--nav-top);
    left:50%;
    transform:translateX(-50%);
    z-index:3;
    display:flex;
    align-items:center;
    justify-content:center;
    margin:0;
    padding:9px 30px;

    /* Ivory glass with a gold hairline */
    border:1px solid rgba(184,138,68,.38);
    border-radius:14px;
    background:rgba(251,248,242,.9);
    box-shadow:0 12px 32px rgba(42,26,16,.2), inset 0 1px 0 rgba(255,255,255,.7);
    backdrop-filter:blur(14px) saturate(1.15);
    -webkit-backdrop-filter:blur(14px) saturate(1.15);
    font-size:12.5px;
    white-space:nowrap;
}

/* The pill only holds the menu button and the link list, so the row gap
   belongs to the list (the button is display:none on desktop anyway). */
.hero-nav a,
.hero-nav button{
    color:var(--hero-ink);
    text-decoration:none;
    background:none;
    border:0;
    font:inherit;
    cursor:pointer;
}

.hero-nav-menu{
    display:flex;
    align-items:center;
    gap:clamp(22px,2.6vw,40px);
    list-style:none;
}

.hero-nav a{
    position:relative;
    display:block;
    padding:10px 0;
    font-size:12.5px;
    font-weight:600;
    letter-spacing:.12em;
    text-transform:uppercase;
    transition:color .2s ease;
}

.hero-nav a::after{
    content:'';
    position:absolute;
    left:0;
    right:0;
    bottom:2px;
    height:2px;
    border-radius:2px;
    background:var(--sg-gold);
    transform:scaleX(0);
    transition:transform .2s ease;
}

/* Hover, keyboard focus, and the section currently under the pill.
   The current one is set by navbar.js as aria-current="location"; only
   colour and the underline change, so nothing reflows. */
.hero-nav a:hover::after,
.hero-nav a:focus-visible::after,
.hero-nav a[aria-current="location"]::after{
    transform:scaleX(1);
}

.hero-nav a:hover,
.hero-nav a[aria-current="location"]{
    color:var(--sg-gold-deep);
}

/* Focus ring is an outline, so it never shifts the layout. */
.hero-nav a:focus-visible,
.hero-nav .hero-nav-toggle:focus-visible{
    outline:2px solid var(--sg-gold);
    outline-offset:3px;
    border-radius:4px;
}

/* MENU BUTTON - shown at <=768px only */

.hero-nav .hero-nav-toggle{
    display:none;
    align-items:center;
    justify-content:center;

    width:44px;
    height:44px;
    padding:0;

    border:1px solid rgba(184,138,68,.4);
    border-radius:10px;

    background:rgba(255,255,255,.6);
    color:var(--hero-ink);
}

.hero-nav-bars{
    display:flex;
    flex-direction:column;
    gap:4px;
    width:18px;
    height:14px;
}

.hero-nav-bars span{
    display:block;
    width:100%;
    height:2px;
    border-radius:2px;
    background:currentColor;
    transition:transform .2s ease, opacity .2s ease;
}

.hero-nav[data-open="true"] .hero-nav-bars span:nth-child(1){
    transform:translateY(6px) rotate(45deg);
}

.hero-nav[data-open="true"] .hero-nav-bars span:nth-child(2){
    opacity:0;
}

.hero-nav[data-open="true"] .hero-nav-bars span:nth-child(3){
    transform:translateY(-6px) rotate(-45deg);
}

/* MOBILE - compact pill + dropdown ----------------------------
   The pill keeps its place at the top center; the link row becomes an
   absolutely positioned dropdown. Absolute positioning means opening it
   never reflows the pill, so there is no layout shift. */
@media screen and (max-width:768px){

    /* Menu button in the top-right corner instead of centred. */
    .hero-nav{
        left:auto;
        right:12px;
        transform:none;
        padding:6px;
        border-radius:16px;
    }

    .hero-nav .hero-nav-toggle{
        display:inline-flex;
    }

    .hero-nav-menu{
        position:absolute;
        top:calc(100% + 10px);
        /* Opens under the button, aligned to the right edge. */
        right:0;
        left:auto;

        display:none;
        flex-direction:column;
        align-items:stretch;
        gap:2px;

        min-width:196px;
        padding:6px;

        border:1px solid rgba(184,138,68,.38);
        border-radius:16px;
        background:rgba(251,248,242,.98);
        box-shadow:0 18px 40px rgba(42,26,16,.28);
    }

    .hero-nav[data-open="true"] .hero-nav-menu{
        display:flex;
    }

    /* 44px minimum on every row, so thumb and switch users both land
       on the intended link. */
    .hero-nav-menu a{
        display:flex;
        align-items:center;
        min-height:44px;
        padding:0 16px;
        border-radius:10px;
    }

    /* A full-width row reads better with a tint than with the bottom
       underline, which would sit detached at the row edge. */
    .hero-nav-menu a::after{
        display:none;
    }

    .hero-nav-menu a:hover{
        background:var(--sg-cream);
    }

    .hero-nav-menu a[aria-current="location"]{
        background:rgba(184,138,68,.16);
    }

}

@media screen and (prefers-reduced-motion:reduce){
    .hero-nav-bars span{
        transition:none;
    }
}
