/* Dynamic site header: full brand at the top of the page, a floating glass pill once scrolling starts. */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    pointer-events: none;
}
.site-header.is-fixed { position: fixed; left: 0; right: 0; }

html { scroll-padding-top: 5.5rem; }

.header-shell {
    --ease: cubic-bezier(.2, .8, .2, 1);
    position: relative;
    pointer-events: auto;
    max-width: 100%;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 2px rgba(44, 36, 32, 0.06);
    transition:
        max-width .55s var(--ease),
        margin .55s var(--ease),
        border-radius .55s var(--ease),
        background-color .4s ease,
        box-shadow .4s ease,
        transform .45s var(--ease);
}

/* Brand block (logo + name) folds away */
.header-brand {
    max-height: 12rem;
    overflow: hidden;
    transition: max-height .5s var(--ease), opacity .3s ease, padding .5s var(--ease);
}

.site-header nav,
.header-mobile-row { transition: padding .5s var(--ease); }

/* Small logo that slides in next to the menu when compact */
.header-mini-logo {
    display: inline-flex;
    align-items: center;
    width: 0;
    opacity: 0;
    overflow: hidden;
    transform: scale(.6) rotate(-12deg);
    transition: width .5s var(--ease), opacity .35s ease, transform .5s var(--ease), margin .5s var(--ease);
}
.header-mini-logo img { height: 1.9rem; width: auto; max-width: none; }

/* Reading-progress line */
.header-progress {
    position: absolute;
    bottom: 0;
    left: 1.75rem;
    right: 1.75rem;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(to left, #C8614A, #C08A3A);
    transform: scaleX(var(--progress, 0));
    transform-origin: right;
    opacity: 0;
    transition: opacity .4s ease;
}

/* ---------- Compact state ---------- */
.site-header.is-compact .header-shell {
    max-width: min(58rem, calc(100% - 1.5rem));
    margin-top: .75rem;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.72);
    box-shadow:
        0 12px 32px -12px rgba(44, 36, 32, 0.28),
        inset 0 0 0 1px rgba(228, 213, 190, 0.7);
}
.site-header.is-compact .header-brand {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}
.site-header.is-compact nav { padding-top: .45rem; padding-bottom: .45rem; }
.site-header.is-compact .header-mobile-row { padding-top: .3rem; padding-bottom: .3rem; }
.site-header.is-compact .header-mini-logo {
    width: 1.9rem;
    opacity: 1;
    transform: none;
    margin-left: .75rem;
}
.site-header.is-compact .header-progress { opacity: 1; }

/* Open mobile menu inside the pill */
.site-header.is-compact .header-shell { overflow: hidden; }
.site-header.is-compact.menu-open .header-shell { border-radius: 1.5rem; }
.site-header.menu-open .header-progress { opacity: 0; }

/* Slide away while reading down, come back on scroll up */
.site-header.is-hidden .header-shell { transform: translateY(calc(-100% - 3rem)); }

@media (prefers-reduced-motion: reduce) {
    .header-shell,
    .header-brand,
    .header-mini-logo,
    .site-header nav,
    .header-mobile-row { transition: none; }
}
