/* Shared site shell: header, navigation, flash messages, skip link.
   Loaded by base.html on every page, before each page's own stylesheet. */

:root {
    --gdl-blue-deep: #123d73;
    --gdl-blue-mid: #1f5d9d;
    --gdl-blue-bright: #0b91d0;
    --gdl-blue-surface: #153f73;
    --gdl-text-light: #ffffff;
    --gdl-border-soft: rgba(255, 255, 255, 0.46);
    --header-height: 72px;
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;

    /* --- Shared design system (additive; consumed by indicator pages) --- */
    /* Type scale (16px base) */
    --fs-2xs: 0.6875rem;
    --fs-xs: 0.75rem;
    --fs-sm: 0.8125rem;
    --fs-base: 0.875rem;
    --fs-md: 1rem;
    --fs-lg: 1.25rem;
    --fs-xl: 1.5rem;
    --fs-2xl: clamp(1.5rem, 2.2vw, 1.95rem);

    /* Spacing scale (4px base) */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 20px;
    --s-6: 24px;
    --s-8: 32px;

    /* Radii */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-pill: 999px;

    /* Elevation (3 levels) */
    --shadow-1: 0 1px 2px rgba(17, 49, 94, 0.06), 0 2px 8px rgba(17, 49, 94, 0.05);
    --shadow-2: 0 4px 14px rgba(17, 49, 94, 0.08);
    --shadow-3: 0 12px 28px rgba(17, 49, 94, 0.14);

    /* Focus ring */
    --focus-ring: 0 0 0 3px rgba(36, 148, 211, 0.35);
}

/* Screen-reader-only utility (visible to assistive tech, hidden visually) */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip-to-content link: first focusable element, visible on focus */
.skip-link {
    position: absolute;
    top: -100px;
    left: var(--space-2);
    z-index: 2000;
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    background: #ffffff;
    color: var(--gdl-blue-deep);
    font-weight: 600;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 20px rgba(6, 23, 54, 0.28);
    transition: top 0.18s ease;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--gdl-blue-bright);
    outline-offset: 2px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: #f4f7fb;
    color: var(--gdl-text-light);
    font-family: "Poppins", sans-serif;
    font-weight: 400;
}

h1,
h2,
h3 {
    font-family: "Poppins", sans-serif;
    font-weight: 700;
}

h4,
h5,
h6 {
    font-family: "Poppins", sans-serif;
    font-weight: 600;
}

p,
li,
label,
input,
textarea,
small {
    font-family: "Poppins", sans-serif;
    font-weight: 400;
}

a,
button {
    font-family: "Poppins", sans-serif;
    font-weight: 500;
}

b,
strong {
    font-weight: 600;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    isolation: isolate;
    background: linear-gradient(180deg, rgba(18, 61, 115, 0.96) 0%, rgba(13, 53, 104, 0.96) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 1px 0 rgba(6, 23, 54, 0.16);
    transition: box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

@supports ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
    .site-header {
        background: linear-gradient(180deg, rgba(18, 61, 115, 0.82) 0%, rgba(13, 53, 104, 0.82) 100%);
        -webkit-backdrop-filter: saturate(160%) blur(12px);
        backdrop-filter: saturate(160%) blur(12px);
    }
}

.scroll-progress-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    pointer-events: none;
}

.scroll-progress-bar {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ffffff 0%, #62c5ec 100%);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.16s linear, opacity 0.18s ease;
    opacity: 0.88;
}

body:not(.is-landing) .scroll-progress-track {
    display: none;
}

.site-header.is-scrolled {
    border-bottom-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 28px rgba(6, 23, 54, 0.3);
}

.nav-shell {
    width: 100%;
    min-height: var(--header-height);
    padding: 0 var(--space-4);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-4);
}

.logo-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
    padding-right: var(--space-2);
}

.logo-wrapper img {
    height: 40px;
    width: auto;
    object-fit: contain;
    display: block;
}

.brand-wordmark {
    display: inline-flex;
    flex-direction: column;
    gap: 0.05rem;
    line-height: 1.1;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.brand-name {
    display: inline-block;
    white-space: nowrap;
    color: #ffffff;
    font-size: 1.06rem;
    font-weight: 700;
    letter-spacing: 0.015em;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(6, 23, 54, 0.35);
    background: linear-gradient(95deg, #ffffff 0%, #dff0fb 55%, #bfe3f9 100%);
    background-clip: text;
    -webkit-background-clip: text;
}

@supports ((background-clip: text) or (-webkit-background-clip: text)) {
    .brand-name {
        color: transparent;
        -webkit-text-fill-color: transparent;
        text-shadow: none;
    }
}

.logo-wrapper:hover .brand-name,
.logo-wrapper:focus-visible .brand-name {
    background: linear-gradient(95deg, #ffffff 0%, #ffffff 100%);
    background-clip: text;
    -webkit-background-clip: text;
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.45);
    transform: translateY(-1px);
}

.mobile-menu-btn:focus-visible {
    outline: 2px solid rgba(127, 210, 243, 0.7);
    outline-offset: 2px;
}

.nav-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 6px;
    flex-wrap: nowrap;
}

.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.25;
    padding: 10px 14px;
    border-radius: 999px;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.nav-link::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 6px;
    height: 2px;
    background: linear-gradient(90deg, #66cef4, #a8e6ff);
    border-radius: 999px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.22s ease;
}

.nav-link:focus-visible {
    outline: 2px solid rgba(128, 208, 255, 0.82);
    outline-offset: 0.16rem;
}

.nav-link.is-active::after,
.nav-link:hover::after,
.nav-link:focus-visible::after {
    transform: scaleX(1);
}

.nav-link.is-active,
.nav-link:hover,
.nav-link:focus-visible {
    color: #ffffff;
}

.nav-link:hover,
.nav-link:focus-visible {
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.is-active {
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-feedback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 8.75rem;
    min-height: 2.75rem;
    padding: 0.45rem 1.4rem;
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--gdl-blue-deep);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    background: linear-gradient(135deg, #ffffff, #e8f4fc);
    box-shadow: 0 8px 18px rgba(6, 23, 54, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn-feedback:hover,
.btn-feedback:focus-visible {
    background: linear-gradient(135deg, #ffffff, #d9edfa);
    box-shadow: 0 14px 26px rgba(6, 23, 54, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.95);
    transform: translateY(-2px);
}

.btn-feedback:active {
    transform: translateY(0);
}

.btn-feedback:focus-visible {
    outline: 2px solid rgba(127, 210, 243, 0.9);
    outline-offset: 2px;
}

/* Mobile drawer backdrop: dims and blurs the page behind the open menu. */
.nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(6, 23, 54, 0.44);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}

@media (min-width: 901px) {
    .nav-backdrop {
        display: none;
    }
}

.nav-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Prevent the page from scrolling while the drawer is open. */
body.nav-open {
    overflow: hidden;
}

main {
    width: 100%;
}

.flash-messages {
    position: sticky;
    top: var(--header-height);
    z-index: 999;
    display: grid;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-4) 0;
    pointer-events: none;
}

.flash-message {
    pointer-events: auto;
    max-width: 720px;
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 12px 14px;
    font-size: 0.95rem;
    line-height: 1.35;
    box-shadow: 0 6px 14px rgba(6, 23, 54, 0.16);
}

.flash-message.success {
    background: #e8f5e9;
    border-color: #b7dfbe;
    color: #0f5132;
}

.flash-message.error {
    background: #fdecea;
    border-color: #f6c3bb;
    color: #a63b2f;
}

.flash-message.info {
    background: #eaf3ff;
    border-color: #b7d4ff;
    color: #1f4c9d;
}

main section[id] {
    scroll-margin-top: calc(var(--header-height) + var(--space-2));
}

@media (max-width: 1280px) {
    :root {
        --header-height: 64px;
    }

    .nav-shell {
        padding: 0 var(--space-3);
        min-height: var(--header-height);
    }

    .logo-wrapper img {
        height: 34px;
    }

    .brand-wordmark {
        padding-left: 0.55rem;
    }

    .nav-right {
        gap: var(--space-2);
    }

    .nav-links {
        gap: var(--space-2);
    }

    .nav-link {
        font-size: 0.95rem;
        padding: 10px 10px;
    }

    .btn-feedback {
        font-size: 0.92rem;
        min-width: 7.8rem;
        min-height: 2.75rem;
        padding: 0.4rem 1rem;
    }
}

@media (max-width: 900px) {
    :root {
        --header-height: 64px;
    }

    .nav-shell {
        position: relative;
        flex-wrap: nowrap;
        gap: var(--space-1);
        padding: 0 var(--space-2);
        min-height: var(--header-height);
    }

    main section[id] {
        scroll-margin-top: 4.5rem;
    }

    .flash-messages {
        top: var(--header-height);
        padding: var(--space-1) var(--space-2) 0;
    }

    .flash-message {
        font-size: 0.9rem;
        padding: 10px 12px;
    }

    .logo-wrapper img {
        height: 34px;
    }

    .mobile-menu-btn {
        display: inline-flex;
        margin-left: auto;
        position: relative;
        z-index: 1001;
    }

    .nav-right {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 999;
        width: min(100%, 320px);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: var(--space-2);
        display: flex;
        padding: calc(var(--header-height) + var(--space-2)) var(--space-3) var(--space-3);
        background: linear-gradient(180deg, #123d73 0%, #0d3568 100%);
        border-left: 1px solid rgba(255, 255, 255, 0.14);
        box-shadow: -24px 0 48px rgba(4, 20, 44, 0.45);
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.32s cubic-bezier(0.22, 0.9, 0.3, 1), visibility 0.32s;
        overflow-y: auto;
    }

    .nav-right.show {
        transform: translateX(0);
        visibility: visible;
    }

    .nav-links {
        width: 100%;
        flex-direction: column;
        gap: var(--space-1);
        align-items: stretch;
        justify-content: flex-start;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-link {
        font-size: 1.05rem;
        line-height: 1.4;
        width: 100%;
        padding: 12px var(--space-2);
        justify-content: flex-start;
        border-radius: 10px;
    }

    .nav-link::after {
        display: none;
    }

    .nav-link.is-active,
    .nav-link:hover,
    .nav-link:focus-visible {
        background: rgba(255, 255, 255, 0.14);
        transform: none;
    }

    .btn-feedback {
        align-self: stretch;
        font-size: 0.95rem;
        min-width: 0;
        min-height: 46px;
        padding: 0.5rem var(--space-2);
        margin-top: var(--space-2);
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header,
    .scroll-progress-bar,
    .mobile-menu-btn,
    .nav-backdrop,
    .nav-right,
    .nav-link,
    .btn-feedback,
    .skip-link {
        transition: none;
    }
}
