/* A town's own chrome (plan 24, S19): header, menu, footer, ribbon.

   EVERY RULE IS SCOPED UNDER .site-shell, which only the town's chrome renders (MainLayout), so
   loading this file on every page changes nothing on the product's pages.

   Colours come from theme.css and nowhere else. The header band is the sidebar ramp
   (--ti-sidebar-top/-bottom/-text), which is already hand-tuned per accent and per mode for text
   on it; the body is the product's surfaces and accent. A town picks one of the four vetted
   accents (TownBranding) and gets its header and links in it, legible in both modes — the same
   trade the product makes, for the same reason.

   Phone first. Below 768px the menu folds behind "Menu" and its groups are accordions; from 768px
   it is a bar with drop-down groups. Nothing here may make the page wider than a 360px screen. */

.site-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-shell .site-container {
    width: 100%;
    max-width: 72rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.site-shell .site-main {
    flex: 1 0 auto;
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

/* --- Ribbon: what this site is not --- */
.site-shell .site-ribbon {
    background: #fff4d6;
    color: #3d2a00;              /* 12.5:1 on the ribbon */
    border-bottom: 1px solid #e6c766;
    font-size: 0.9rem;
    padding: 0.45rem 0;
}
:root[data-bs-theme="dark"] .site-shell .site-ribbon {
    background: #3a2c08;
    color: #fbecc0;              /* 11.6:1 on the ribbon */
    border-bottom-color: #6b5214;
}
.site-shell .site-ribbon p + p { margin-top: 0.15rem; }

/* --- Header --- */
.site-shell .site-header {
    background-color: var(--ti-sidebar-top);
    background-image: linear-gradient(180deg, var(--ti-sidebar-top) 0%, var(--ti-sidebar-bottom) 100%);
    color: var(--ti-sidebar-text);
}

.site-shell .site-utility {
    background: var(--ti-sidebar-topbar);
    font-size: 0.875rem;
}
.site-shell .site-utility-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}
.site-shell .site-utility-links ul,
.site-shell .site-footer-links ul,
.site-shell .site-nav-list,
.site-shell .site-nav-panel {
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-shell .site-utility-links ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
}
.site-shell .site-account {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    margin-left: auto;
}
.site-shell .site-account form { margin: 0; }

/* Links on the dark band use the band's text colour, never the accent: the accent is tuned for
   the light surfaces, not for the ramp under it. */
.site-shell .site-header a:not(.btn),
.site-shell .site-header summary {
    color: var(--ti-sidebar-text);
}
.site-shell .site-header a:not(.btn):hover { color: #fff; }

/* Bootstrap's grey outline button is ~2:1 on the band; Sign out takes the band's text colour. */
.site-shell .site-utility .btn-outline-secondary {
    --bs-btn-color: var(--ti-sidebar-text);
    --bs-btn-border-color: var(--ti-sidebar-text);
    --bs-btn-hover-color: var(--ti-sidebar-topbar);
    --bs-btn-hover-bg: var(--ti-sidebar-text);
    --bs-btn-hover-border-color: var(--ti-sidebar-text);
}

/* The appearance controls were built for the light top row; on the band they sit on a plate. */
.site-shell .site-utility .theme-switch .seg { background: var(--ti-surface); }

.site-shell .site-brand-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}
.site-shell .site-wordmark {
    display: inline-flex;
    flex-direction: column;
    text-decoration: none;
    min-width: 0;
}
.site-shell .site-wordmark-name {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.site-shell .site-tagline {
    font-size: 0.95rem;
    opacity: 0.9;
}
.site-shell .site-brand-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.site-shell .site-ask {
    background: var(--ti-surface);
    color: var(--ti-text);
    border: 1px solid var(--ti-border);
}
.site-shell .site-ask:hover { background: var(--ti-surface-2); color: var(--ti-text); }

/* --- Menu (a disclosure; site-nav.js adds Escape, outside click and close-after-navigation) --- */
.site-shell .site-nav {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.site-shell .site-nav summary { cursor: pointer; list-style: none; }
.site-shell .site-nav summary::-webkit-details-marker { display: none; }
.site-shell .site-nav summary::after {
    content: "";
    display: inline-block;
    margin-left: 0.4em;
    width: 0.45em;
    height: 0.45em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-0.15em) rotate(45deg);
}
.site-shell .site-nav details[open] > summary::after {
    transform: translateY(0.1em) rotate(-135deg);
}

.site-shell .site-menu-toggle {
    display: inline-block;
    padding: 0.6rem 0;
    font-weight: 600;
}
.site-shell .site-nav-link,
.site-shell .site-nav-panel a {
    display: block;
    padding: 0.55rem 0.75rem;
    text-decoration: none;
    border-radius: 0.3rem;
}
.site-shell .site-nav-link:hover,
.site-shell .site-nav-panel a:hover {
    background: rgba(255, 255, 255, 0.12);
}
.site-shell .site-nav a[aria-current="page"],
.site-shell .site-nav-group.is-current > summary {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.3em;
    font-weight: 600;
}

/* Focus on the band: the accent focus ring can sit close to the ramp, so the band gets white. */
.site-shell .site-header a:focus-visible,
.site-shell .site-header summary:focus-visible,
.site-shell .site-header button:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* Phone: the list folds behind "Menu"; groups are accordions in the flow. */
@media (max-width: 767.98px) {
    .site-shell .site-nav-list { padding-bottom: 0.5rem; }
    .site-shell .site-nav-panel { padding-left: 1rem; }
}

/* Wider: a bar. The "Menu" summary is hidden and the outer disclosure stays open (rendered open;
   site-nav.js re-opens it if the window grows). Groups drop down over the page. */
@media (min-width: 768px) {
    .site-shell .site-menu-toggle { display: none; }
    .site-shell .site-nav-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.1rem 0.25rem;
        padding: 0.3rem 0;
    }
    .site-shell .site-nav-item { position: relative; }
    .site-shell .site-nav-group > .site-nav-panel {
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 1050;
        min-width: 15rem;
        max-width: min(24rem, 90vw);
        padding: 0.4rem;
        background: var(--ti-surface);
        border: 1px solid var(--ti-border);
        border-radius: var(--ti-radius);
        box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.18);
    }
    /* The panel is on the page's surface, so its links are the page's. */
    .site-shell .site-header .site-nav-group > .site-nav-panel a {
        color: var(--ti-accent);
    }
    .site-shell .site-header .site-nav-group > .site-nav-panel a:hover {
        background: var(--ti-surface-2);
        color: var(--ti-accent-hover);
    }
    .site-shell .site-header .site-nav-group > .site-nav-panel a:focus-visible {
        outline-color: var(--ti-focus);
    }
}

/* --- Footer --- */
.site-shell .site-footer {
    background: var(--ti-surface-2);
    border-top: 1px solid var(--ti-border);
    padding: 2rem 0 1.5rem;
    margin-top: 2rem;
}
.site-shell .site-footer-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 3rem;
    margin-bottom: 1.25rem;
}
.site-shell .site-footer-contact { min-width: 0; overflow-wrap: anywhere; }
.site-shell .site-footer-contact address { font-style: normal; }
.site-shell .site-footer-links ul {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.site-shell .site-footer-status { font-weight: 600; margin-bottom: 0.25rem; }
.site-shell .site-credit { color: var(--ti-muted); font-size: 0.9rem; }

.site-shell .site-external {
    display: inline-block;
    margin-left: 0.2em;
    font-size: 0.85em;
}
