/*
 * The ScoutProgress theme, in one file.
 *
 * Why it exists: the colours were stated inline in every page's :root, and
 * the pages had drifted. --navy meant one thing on Group Members and
 * Adventure Skills, another on Group Admin and a third on the Platform Admin
 * screens - three different navies under one variable name,
 * and Group Members had no navy at all in its older half - it was still on
 * the 2019 Material blue with a grey tab bar. Four opinions about one colour
 * is what made "make it navy" a change to six files.
 *
 * The old hex values are deliberately NOT quoted here. Phase 25 greps every
 * themed page and this file for them, and a comment naming one would pass
 * that check straight into a permanent failure.
 *
 * Peter's decision 12, 12 September 2026: navy #07073F, white, and a page
 * background of #EEF3FA. The greens go.
 *
 * Loaded FIRST by every themed page, before that page's own <style>, so a
 * page can still override something deliberately. The pages no longer
 * declare these colours themselves; if one of them starts to again, phase 25
 * of the test suite fails.
 *
 * Not loaded by index.html. That page is a compiled React bundle whose source
 * is not in this repository, so it cannot be re-themed here. Recovering that
 * source is separate work.
 */

:root {
    --navy: #07073F;        /* headers, primary buttons, the active nav tab */
    --navy-deep: #050530;   /* hover and pressed */
    --white: #FFFFFF;       /* cards, the nav pill, text on navy */
    --page-bg: #EEF3FA;     /* the page behind the cards */
    --ink: #1F2937;         /* body text */
    --muted: #64748B;       /* labels, help text */
    --line: #D8E2F0;        /* borders and rules, re-tinted from the green-grey */
    --red: #C9283E;         /* destructive only */

    /* Kept because pages still refer to them. --green and --paper are
       deliberately navy and white now rather than deleted: a page that still
       says var(--green) gets navy instead of falling back to nothing and
       rendering black on black. Phase 25 checks the pages for the green hex
       values; this is the safety net under that, not a substitute for it. */
    --green: #07073F;
    --paper: #FFFFFF;
    --cream: #EEF3FA;
    --gold: #F2B544;

    /* The height of the navigation bar, and how far below the top of the
       window it has to start. The offset is zero in production; local and
       staging put a fixed environment banner across the top of the window
       (sp-env.js) and a bar at top:0 would slide underneath it. sp-nav.js
       measures the banner and sets this. */
    --sp-nav-height: 56px;
    --sp-nav-offset: 0px;
}

/* =====================================================================
 * The navigation bar
 *
 * Fixed, not sticky. Peter's report was that the bars "jump around when
 * scrolling", which is what a sticky element does once it reaches the end of
 * its own parent's box - it stops being stuck and travels with the page
 * again. Fixed takes the bar out of the document entirely, so there is no
 * parent box to run out of, and the body carries padding to make room for it.
 *
 * One bar, one set of styles, one markup shape, on every page. A page opts in
 * with <div id="spNavMount"></div> and sp-nav.js, the same way it opts into
 * sp-logout.js.
 * ===================================================================== */

.sp-nav-bar {
    position: fixed;
    top: var(--sp-nav-offset);
    left: 0;
    right: 0;
    z-index: 40;            /* below every dialog on every page */
    background: var(--navy);
    box-shadow: 0 2px 10px rgba(7, 7, 63, .22);
}

.sp-nav {
    display: flex;
    align-items: stretch;
    gap: 4px;
    max-width: 1280px;
    height: var(--sp-nav-height);
    margin: 0 auto;
    padding: 6px 12px;
    box-sizing: border-box;
}

.sp-nav a {
    flex: 1 1 0;
    min-width: 0;           /* so a long label cannot prop the bar open */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 10px;
    border-radius: 9px;
    text-align: center;
    text-decoration: none;
    line-height: 1.2;
    color: rgba(255, 255, 255, .82);
    font: 600 .88rem Sora, Inter, system-ui, sans-serif;
}

.sp-nav a:hover {
    background: rgba(255, 255, 255, .12);
    color: var(--white);
    text-decoration: none;
}

/* The white pill for the page you are on. */
.sp-nav a[aria-current="page"] {
    background: var(--white);
    color: var(--navy);
}

.sp-nav a:focus-visible {
    outline: 2px solid var(--white);
    outline-offset: -3px;
}

/* The icon above the label on a phone. Hidden on desktop, where the bar is a
   row of words and a picture of a house adds nothing. */
.sp-nav a .sp-nav-icon { display: none; }

/* Room for the fixed bar.
 *
 * Keyed off a class sp-nav.js puts on <html> when it has actually rendered a
 * bar, not applied to every page that loads this file. help.html and
 * roadmap.html are public and carry no bar, and Group Members shows a sign-in
 * form before there is a session - none of them should open with 56px of
 * empty space at the top. */
html.sp-has-nav body {
    padding-top: calc(var(--sp-nav-height) + var(--sp-nav-offset));
}

/* ---------------------------------------------------------------------
 * On a phone the bar moves to the bottom.
 *
 * A leader is standing in a hall holding a phone in one hand. The four
 * destinations belong under the thumb, not at the top of a screen they have
 * scrolled a page and a half down.
 *
 * env(safe-area-inset-bottom) clears the iPhone home bar; without it the last
 * few pixels of the bar sit under the system gesture area and the tab is hard
 * to hit. Targets are 44px, which is Apple's minimum and about the width of
 * an adult fingertip.
 * --------------------------------------------------------------------- */
@media (max-width: 768px) {
    .sp-nav-bar {
        top: auto;
        bottom: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -2px 14px rgba(7, 7, 63, .26);
    }

    .sp-nav {
        gap: 2px;
        height: 58px;
        padding: 4px 6px;
    }

    .sp-nav a {
        min-height: 44px;
        padding: 0 4px;
        border-radius: 10px;
        font-size: .68rem;
        font-weight: 700;
        letter-spacing: .005em;
    }

    .sp-nav a .sp-nav-icon {
        display: block;
        font-size: 1.15rem;
        line-height: 1;
    }

    html.sp-has-nav body {
        /* Nothing above, and room below for the bar plus the home bar. */
        padding-top: var(--sp-nav-offset);
        padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    }
}

/* =====================================================================
 * The sticky primary button
 *
 * Home and the register screen both end in one action, and the register can
 * be twenty-five names long. Submit has to stay reachable without scrolling
 * past all of them.
 *
 * Bottom-anchored above the phone tab bar, and ordinary flow on desktop,
 * where the button is already on screen.
 * ===================================================================== */
.sp-sticky-action {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin: 18px -4px -4px;
    padding: 12px 4px;
    background: linear-gradient(to top, var(--page-bg) 70%, rgba(238, 243, 250, 0));
}

@media (max-width: 768px) {
    .sp-sticky-action {
        /* Clear of the tab bar, which is fixed over the bottom of the page. */
        bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    }
}

.sp-sticky-action button,
.sp-sticky-action .sp-button {
    width: 100%;
    min-height: 48px;
}

/* =====================================================================
 * Shared pieces, so the new pages do not each invent them
 * ===================================================================== */
.sp-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border: 0;
    border-radius: 12px;
    background: var(--navy);
    color: var(--white);
    font: 700 1rem Sora, Inter, system-ui, sans-serif;
    text-decoration: none;
    cursor: pointer;
}

.sp-button:hover { background: var(--navy-deep); color: var(--white); text-decoration: none; }
.sp-button:disabled { opacity: .45; cursor: not-allowed; }
.sp-button:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

.sp-button.secondary {
    background: var(--white);
    color: var(--navy);
    box-shadow: inset 0 0 0 2px var(--navy);
}
.sp-button.secondary:hover { background: var(--page-bg); color: var(--navy); }

.sp-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(7, 7, 63, .07);
}

/* A progress bar, used by the register tiles and the section tiles. */
.sp-meter {
    height: 8px;
    border-radius: 999px;
    background: var(--page-bg);
    overflow: hidden;
}
.sp-meter > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--navy);
}

/* A small label on a tile: a venue name, a lock, a date. */
.sp-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--page-bg);
    color: var(--navy);
    font: 600 .76rem Sora, Inter, system-ui, sans-serif;
    white-space: nowrap;
}
