/* =========================================================
   Shared site navigation — header, mobile drawer, scroll offset
   Used by index.html, blog/*.html, and privacy-policy.html
   ========================================================= */

:root {
    --site-header-height: 72px;
}

@media (max-width: 1200px) {
    :root {
        --site-header-height: 60px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

[id] {
    scroll-margin-top: calc(var(--site-header-height) + 16px);
}

body.has-site-header {
    padding-top: var(--site-header-height);
}

body.nav-open {
    overflow: hidden;
}

#site-header-root {
    position: relative;
    z-index: 1200;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    height: var(--site-header-height);
    background: rgba(10, 24, 54, 0.55);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: var(--site-header-height);
    padding: 0 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.site-header__logo {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    line-height: 0;
}

.site-header__logo img {
    height: 30px;
    width: auto;
    display: block;
}

.site-header__nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1 1 auto;
}

.site-nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
    padding: 0.35rem 0.1rem;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.site-nav-link:hover {
    color: #ffffff;
    border-color: rgba(79, 158, 247, 0.6);
}

.site-header__actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-left: auto;
    flex: 0 0 auto;
}

.site-header__usecase.usecase-selector {
    padding: 0.25rem;
}

.site-header__usecase .usecase-option {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
}

.site-header .language-selector {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: auto !important;
    transform: none !important;
    margin: 0 !important;
}

.site-nav-lang {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.site-nav-lang:hover {
    background: rgba(255, 255, 255, 0.2);
}

.site-header__cta {
    background: #4f9ef7;
    color: #051026;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.55rem 1.2rem;
    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.15s ease;
}

.site-header__cta:hover {
    background: #6fb0ff;
    transform: translateY(-1px);
}

.site-header__menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    position: relative;
    flex: 0 0 auto;
}

.site-header__menu-icon,
.site-header__menu-icon::before,
.site-header__menu-icon::after {
    content: '';
    position: absolute;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}

.site-header__menu-icon {
    left: 10px;
    right: 10px;
    top: 19px;
}

/* ::before/::after are positioned relative to the icon span itself (which
   already establishes its own containing block via position:absolute), so
   they need left/right:0 here rather than re-inheriting the span's 10px
   inset — otherwise the two insets stack and collapse them to 0 width. */
.site-header__menu-icon::before,
.site-header__menu-icon::after {
    left: 0;
    right: 0;
}

.site-header__menu-icon::before {
    top: -7px;
}

.site-header__menu-icon::after {
    top: 7px;
}

.site-header.is-open .site-header__menu-icon {
    background: transparent;
}

.site-header.is-open .site-header__menu-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.site-header.is-open .site-header__menu-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

.site-nav-drawer {
    position: fixed;
    top: var(--site-header-height);
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    z-index: 1199;
    background: rgba(8, 18, 42, 0.94);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    transition: max-height 0.3s ease;
}

.site-header.is-open .site-nav-drawer {
    max-height: calc(100vh - var(--site-header-height));
    overflow-y: auto;
}

.site-nav-drawer__inner {
    padding: 1.25rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.site-nav-drawer .usecase-selector {
    width: 100%;
    justify-content: space-between;
}

.site-nav-drawer .usecase-option {
    flex: 1;
    text-align: center;
}

.site-nav-drawer__links {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.site-nav-drawer__links .site-nav-link {
    font-size: 1.05rem;
    padding: 0.85rem 0.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.site-nav-drawer__cta {
    text-align: center;
    padding: 0.85rem 1.2rem;
}

/* Compact desktop: tighten spacing so 7 nav links + pills + lang + CTA fit
   at common 1280px laptop widths, even with the longest (Japanese) labels. */
@media (max-width: 1400px) and (min-width: 1201px) {
    .site-header__inner {
        gap: 1rem;
        padding: 0 1rem;
    }

    .site-header__nav {
        gap: 0.8rem;
    }

    .site-nav-link {
        font-size: 0.8rem;
    }

    .site-header__usecase.usecase-selector {
        padding: 0.2rem;
    }

    .site-header__usecase .usecase-option {
        padding: 0.3rem 0.5rem;
        font-size: 0.72rem;
    }

    .site-nav-lang {
        font-size: 0.75rem;
        padding: 0.35rem 0.7rem;
    }

    .site-header__cta {
        font-size: 0.78rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Home mode: full nav + audience pills + CTA needs more room, so switch to
   the hamburger earlier (below 1200px). */
@media (max-width: 1200px) {
    #site-header-root[data-nav-mode="home"] .site-header__nav,
    #site-header-root[data-nav-mode="home"] .site-header__usecase,
    #site-header-root[data-nav-mode="home"] .site-header__cta {
        display: none;
    }

    #site-header-root[data-nav-mode="home"] .site-header__menu-btn {
        display: block;
    }
}

@media (min-width: 1201px) {
    #site-header-root[data-nav-mode="home"] .site-nav-drawer {
        display: none;
    }
}

/* Article/utility modes: a lightweight 3-link nav (no pills or CTA) fits
   comfortably down to much narrower widths, so keep it inline longer. */
@media (max-width: 640px) {
    #site-header-root:not([data-nav-mode="home"]) .site-header__nav {
        display: none;
    }

    #site-header-root:not([data-nav-mode="home"]) .site-header__menu-btn {
        display: block;
    }
}

@media (min-width: 641px) {
    #site-header-root:not([data-nav-mode="home"]) .site-nav-drawer {
        display: none;
    }
}

/* Nav-link visibility mirrors the body.usecase-* pattern in styles.css */
body.usecase-industry [data-nav-hide-industry] {
    display: none !important;
}

body:not(.usecase-industry) [data-nav-industry-only] {
    display: none !important;
}

/* Bilingual labels for pages that don't already load styles.css (blog articles) */
body.japanese .site-header [data-lang="en"] {
    display: none;
}

body:not(.japanese) .site-header [data-lang="ja"] {
    display: none;
}

/* ── Privacy Policy (light theme) overrides ── */
body.privacy-policy-page .site-header {
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Logo gradient is tuned for dark backgrounds; recolor to brand blue for contrast on white */
body.privacy-policy-page .site-header__logo img {
    filter: brightness(0) saturate(100%) invert(20%) sepia(80%) saturate(2000%) hue-rotate(210deg);
}

body.privacy-policy-page .site-nav-link {
    color: #2C56B5;
}

body.privacy-policy-page .site-nav-link:hover {
    color: #1c3f86;
    border-color: #2C56B5;
}

body.privacy-policy-page .site-header__menu-btn {
    background: rgba(44, 86, 181, 0.08);
    border-color: rgba(44, 86, 181, 0.3);
}

body.privacy-policy-page .site-header__menu-icon,
body.privacy-policy-page .site-header__menu-icon::before,
body.privacy-policy-page .site-header__menu-icon::after {
    background: #2C56B5;
}

body.privacy-policy-page .site-nav-drawer {
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.privacy-policy-page .site-nav-drawer .site-nav-link {
    color: #2C56B5;
    border-bottom-color: rgba(0, 0, 0, 0.08);
}
