/*
  The page shell: a sticky top bar, a 240 px side menu beside the main area on wide screens,
  and below 992 px a drawer the menu button opens. The spacing scale is 4, 8, 12, 16, 20, 24
  and 32 px.

  This file follows OAP Lizzard's layout.css (copied 2026-11-13 and adapted), so Still
  Questing has the family's shell. Colours come from tokens.css.
*/

/*
  Bootstrap's own colour variables, set from the site's roles so its parts (buttons, form
  fields, tables, cards) follow the chosen appearance. Bootstrap's file is loaded first.
*/
:root, :root[data-theme] {
    --bs-body-bg: var(--page);
    --bs-body-color: var(--text);
    --bs-emphasis-color: var(--text);
    --bs-border-color: var(--border);
    --bs-secondary-color: var(--text-2);
    --bs-secondary-bg: var(--surface-2);
    --bs-tertiary-bg: var(--surface-2);
    --bs-link-color: var(--accent);
    --bs-link-hover-color: var(--accent-strong);
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 84px; }  /* anchors land below the sticky top bar */

body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font: 1rem/1.6 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/*
  Bootstrap's parts draw their own focus as a faint see-through glow and turn
  the outline off (its .nav-link, .btn, .form-control and .form-select rules
  outrank the line above). The site's own ring replaces it, so
  focus is always seen (the pack: 3:1).
*/
.nav-link:focus-visible, .btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible {
    outline: 3px solid var(--focus); outline-offset: 2px; box-shadow: none;
}

.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 30; }
.skip-link:focus { left: 16px; background: var(--surface); padding: 8px 16px; border-radius: 8px; }

/* Top bar */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 20px;
    min-height: 68px; padding: 12px 28px;
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; min-width: 0; }
.brand:hover { color: var(--text); }
.brand img { width: 50px; height: 50px; flex: none; }
.brand-name { font-size: 1.3rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.brand-tagline { color: var(--text-2); font-size: .8rem; border-left: 1px solid var(--border); padding-left: 16px; margin-left: 4px; white-space: nowrap; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 28px; }
.edition { color: var(--text-2); font-size: .7rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; white-space: nowrap; }
.utility-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 8px; color: var(--text); text-decoration: none;
}
.utility-link:hover, .utility-link[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* The menu button shows only with scripts (early.js marks <html class="js">). */
.menu-button {
    display: none; width: 44px; height: 44px; padding: 0; flex: none;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); cursor: pointer;
}
.js .menu-button { display: inline-flex; align-items: center; justify-content: center; }
.menu-icon, .menu-icon::before, .menu-icon::after {
    display: block; width: 20px; height: 2px; background: currentColor; border-radius: 1px; position: relative;
}
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }

/* Sidebar and main area */
.shell { display: flex; align-items: flex-start; }
.sidebar {
    position: sticky; top: 68px; flex: 0 0 240px; width: 240px;
    height: calc(100vh - 68px); overflow-y: auto;   /* its own scroll when the window is short */
    display: flex; flex-direction: column;
    padding: 32px 16px; background: var(--surface); border-right: 1px solid var(--border);
}
.sidebar-hidden .sidebar { display: none; }
.nav-heading { margin: 0 16px 16px; color: var(--text-2); font-size: .7rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
/* A second group in the menu sits a little apart from the one above it. */
.nav-heading-next { margin-top: 28px; }
.nav-list { list-style: none; margin: 0; padding: 0; }
/* Sections: roomy targets, a soft fill and a fine border on the one shown. */
.nav-link {
    display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 12px 16px; margin-bottom: 6px;
    border: 1px solid transparent; border-radius: 8px; color: var(--text-2); text-decoration: none;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); border-color: var(--border); color: var(--accent); font-weight: 650; }
.nav-symbol { width: 24px; font-size: 1.15rem; text-align: center; }
/* The Pootler's cup, in one colour: the picture is only a shape (img/pootler-mark.png, made from
   the hub's logo), filled with the link's own text colour so it follows hover and the theme.
   The ?v= number is raised when the picture changes, so browsers fetch the new one
   (v=2: the hub's upright cup, 2026-11-16). */
.nav-symbol-pootler {
    height: 24px; background: currentColor;
    -webkit-mask: url("../img/pootler-mark.png?v=2") center / contain no-repeat;
    mask: url("../img/pootler-mark.png?v=2") center / contain no-repeat;
}
/* A section's own pages, indented under it on a thin line (Progress). */
.nav-children { list-style: none; margin: 0 0 16px 28px; padding: 0 0 0 12px; border-left: 1px solid var(--border); }
.nav-children a { display: block; padding: 10px 12px; border-radius: 6px; color: var(--text-2); text-decoration: none; font-size: .875rem; }
.nav-children a:hover { background: var(--surface-2); color: var(--text); }
.nav-children a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.sidebar-note { margin: auto 16px 0; padding-top: 48px; color: var(--text-2); font-size: .85rem; }
.sidebar-note .nav-heading { margin: 0; }
.sidebar-note p { margin: 12px 0; }

.main-column { flex: 1 1 auto; min-width: 0; }
/* The main area uses all the width beside the sidebar (design guide, "Layout");
   only prose is held to a reading width. */
.main { padding: 24px 32px 32px; }
.main:focus { outline: none; }
.drawer-backdrop { display: none; }

.site-footer { margin: 0 32px; padding: 24px 0; border-top: 1px solid var(--border); color: var(--text-2); font-size: .8rem; }
.footer-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.footer-row span span { margin: 0 8px; }
.site-footer .small-note { margin: 12px 0 0; max-width: 70ch; }

/* Narrow screens: with scripts, the sidebar becomes a drawer from the left.
   Without scripts, it sits above the content in the normal page flow. */
@media (max-width: 1199.98px) {
    .brand-tagline { display: none; }
    .topbar { padding-inline: 20px; }
    .main { padding-inline: 20px; }
    .site-footer { margin-inline: 20px; }
}

@media (max-width: 991.98px) {
    .edition { display: none; }
    .shell { display: block; }
    .sidebar { position: static; width: auto; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar-note { display: none; }
    .js .sidebar {
        position: fixed; z-index: 25; top: 0; left: 0; bottom: 0; width: min(300px, 85vw); height: auto;
        border-right: 1px solid var(--border); border-bottom: 0;
        transform: translateX(-105%); visibility: hidden;
        /* Closing: slide out, then hide (so it can't be tabbed into). */
        transition: transform .2s ease, visibility 0s linear .2s;
    }
    /* Opening: visible at once, so the script can move focus into it straight away. */
    .js.drawer-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease, visibility 0s; }
    .js.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 24; background: rgba(0, 0, 0, .45); }
    .sidebar-hidden .sidebar { display: flex; }  /* the desktop "hidden" choice doesn't apply to the drawer */
    .brand-tagline { display: none; }
}

@media (max-width: 575.98px) {
    .topbar { padding: 8px 16px; gap: 12px; }
    .main { padding: 20px 16px; }
    .site-footer { margin-inline: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .js .sidebar { transition: none; }
}
