/* ============================================================================
   IAR HOUSING HUB — COMPONENT GLOSSARY
   ============================================================================

   SURFACES / CONTAINERS
     .card             White surface for any content block. No min-height.
                       Use freely for panels, step containers, etc.
     .dashboard-card   .card + min-height:300. Dashboard metric grid cells only.
     .transparent-card .card with no background/shadow. Transparent grid cell.
     .card-header      Flex header row inside a .card (title left, link right).
     .glass            Frosted-glass surface (blur + white bg). Used in nav/subhead.
     .notice           Teal info banner. Protected-report alerts, general notices.
     .summary-box      Light grey inset box for AI-generated report summaries.

   BUTTONS
     button:not([class]) / .btn-primary
                       Primary teal-blue gradient CTA. Default for new buttons.
     .button-secondary Ghost button with blue tint. Secondary actions.
     .button-tertiary  Text-only link-style button. Inline tertiary actions.
     .btn-block        Full-width block modifier. Combines with any variant.
     .button-block     Colored card-link for inline story/learn CTAs.
                       Variants: .Report (teal), .Map (magenta), .More (blue),
                       .Link (purple), .godeeper (inline grid layout).
     .jump-link        Plain link for system nav. Used at the top of cards or for "All ____".
                       Often followed by right carrot.

   SELECT / DROPDOWN
     select / .dropbtn Canonical teal underline select used site-wide.
                       Teal bottom border, teal-trans bg, no outer border.
     select-block      Float wrapper for a label + select unit in Step 1.
     .dropdown         Custom searchable dropdown with floating panel.
     .form-parent      Show/hide wrapper per geo type in Step 1.

   VIEW MODE & COMPARISON (buildreport)
     .view-mode-toggle iOS-style segmented control (Single / Compare tabs).
     .mode-btn         Individual segment within the toggle.
     .comp-slot        Clickable geography card in the comparison panel.
     .comp-add-geo-btn Dashed-border ghost button to add a geography slot.
     .step2-cta        CTA buttons in Step 2: View Report, Compare, Table.
     #comp-modal-*     Modal for picking/editing a comparison geography.
     .comp-names       Comma-separated geography name list in report headers.

   CONTENT TAGS / CHIPS
     .stories .date / .category   Pill tags on story cards (teal default).
     .category.update             Blue variant.
     .category.Video              Magenta variant.
     .domain-tag                  ALL CAPS domain label on report viz blocks.
     .lessontag                   Small decorative tag on learn-page lessons.
     .filter-chip      Used for radio buttons (like geo/market type)

   REPORT CONTENT
     .viz              Single chart/stat block within a report view.
     .report           Report listing card on the reports index page.
     .story-card       Compact story preview card in the feed.
     .story            Full article / long-read page content (magazine layout).
     .statwrapper      Stat callout block (large number + label).
     .data-table       Fixed-layout tabular data in report views.
     .blog-table       Styled comparison table for blog/story content.

   MAP
     #map              Full-height Leaflet map container.
     #legend           Floating frosted legend panel (bottom-right on desktop).

   LEARN PAGE
     .lessongrid       3-up grid of lesson cards.
     .lesson           Individual lesson card (dotted border, hover = solid).

   LOADING ANIMATIONS
     .lds-ellipsis     Three-dot bouncing loader.
     .lds-grid         Nine-dot grid pulse loader.

   TYPOGRAPHY UTILITIES
     .text-xs / .text-sm   Font size: x-small / small.
     .semibold              font-weight: 600.
     .text-heading          color: --color-heading (teal-dark). Primary labels.
     .text-muted            color: --color-muted (teal-muted). Secondary text.
     .text-meta             x-small + muted. Hints, descriptions, sub-labels.
     .text-label            x-small + 600 + heading color + nowrap. Stat labels.
     .text-nowrap / .text-ellipsis  Overflow helpers.

   SIDEBAR
     .sidebar               Fixed sidebar container (200px, frosted on wide).
     .sidebar-card          Favorite/recent link card inside the sidebar.
     .sidebar-level-card    Level + XP progress card at the top of the sidebar.
     .sidebar-level-track/fill  Thin (6px) progress bar in the sidebar.
     .sidebar-badge-icon    Hexagon badge icon — green tint, 16px (smaller than
                            account .badge-icon which is indigo, 20px).

   LAYOUT SCAFFOLDING
     .center / .header Max-width 1200px centered content columns.
     #nav              Fixed top navigation bar (height = --navh).
     #subhead          Fixed sub-header toolbar (report controls).
     #main-content     Used on index instead of .center
     .footer           Full-width blue footer, auto-grid columns.
     hr.separator      Used to separate sections. Modern look with extra margin.

   PICKERS
     .pick-btn         Selectable list item: shared visual base (border/hover/selected).
                       Default flex-column layout. Use .is-selected for chosen state.
     .pick-name        Primary label text inside a .pick-btn.
     .pick-sub         Secondary/meta text inside a .pick-btn.
     .pick-list        Scrollable ul container for .pick-btn items.
     .pick-list--checkbox  Modifier: grid layout for checkbox + label items.

   UTILITIES
     .step             Card modifier: adds top margin, removes min-height.
     .page-subtle      Muted subtitle text (used on account/form pages).
     .hint             Helper text below fields and filtered lists.
     .searchbar        Search input wrapper — shared across picker/favorites/learn.
     .no-scrollbar     Hide scrollbar (cross-browser).
     .disabled         Greyed-out non-interactive state.
     .mobile/.nomobile Responsive visibility helpers.
     .for-print / .hide-print  Print-only visibility.
     .protected-True   Prepends a lock icon before member-only content.

   ============================================================================ */


/* ── 1. IMPORTS & FONTS ───────────────────────────────────────────────────── */

@import url(https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,300,400,500,600,700,900);
@import url(https://fonts.googleapis.com/css?family=Domine:300italic,400italic,700italic,300,400,500,600,700,900);

@font-face {
  font-family: "Tex Gyre Adventor Regular";
  src: url("fonts/texgyreadventor-regular.db360b27276e.otf") format("opentype"),
    local("TeX Gyre Adventor");
}

@font-face {
  font-family: "Tex Gyre Adventor Bold";
  src: url("fonts/texgyreadventor-bold.30312e77fb18.otf") format("opentype"),
    local("TeX Gyre Adventor Bold");
}


/* ── 2. DESIGN TOKENS ────────────────────────────────────────────────────── */

:root {
    --navh: 63px;

    /* Brand colors */
    --blue: #004b8b;
    --blue-light: #3498db;
    --blue-semitrans: #9fbbd3;
    --blue-trans: #dfe8f0;

    --orange: #e77c05;
    --orange-dark: #b96a12;
    --orange-semitrans: #f6cea1;
    --orange-trans: #fcefe0;

    --yellow: #ebb81f;
    --yellow-semitrans: #f7e4ab;
    --yellow-trans: #fcf6e3;

    --magenta: #95215e;
    --magenta-semitrans: #d7acc2;
    --magenta-trans: #f2e3eb;

    --red: #9d140d;
    --red-semitrans: #daa7a4;
    --red-trans: #f3e2e1;

    --teal: #00737e;
    --teal-dark: #14363a;
    --teal-muted: #718c90;
    --teal-semitrans: #9fcace;
    --teal-trans: #dfeeef;
    --teal-border: #e6f0f0;
    --teal-surface: #f9fdfd;
    --teal-hover: #eef8f8;      /* pick-btn hover, geo-btn hover */
    --teal-selected: #e9f6f6;   /* pick-btn selected, geo-btn selected */

    --purple: #433277;
    --purple-semitrans: #b8b2cc;
    --purple-trans: #e8e5ee;

    --indigo: #6d5bd0;          /* badge icon (in-progress) */
    --indigo-trans: #f3f0ff;    /* badge icon background */

    /* Typography — colors */
    --type: #444;
    --secondary-type: #6b7280;
    --color-heading: var(--teal-dark);   /* primary label / heading: #14363a */
    --color-body: var(--type);           /* body text: #444 */
    --color-muted: var(--teal-muted);    /* secondary / meta: #718c90 */

    /* Typography — size scale */
    --text-xs: 11px;    /* ~10px: chips, labels, hints, meta text */
    --text-sm: small;       /* ~13px: captions, notices, card subtitles */
    --text-base: 1em;       /* body copy */
    --text-lg: 1.125em;    /* viz subtitles, slightly larger body */
    --text-xl: 1.5em;       /* viz titles, report headings */

    /* Shape */
    --radius: 10px;
    --radius-sm: 8px;
    --radius-pill: 999px;

    /* Shadows */
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.2);
    --shadow-inset: inset 0 3px 6px rgba(0, 0, 0, 0.5);
}


/* ── 3. BASE & RESET ─────────────────────────────────────────────────────── */

body {
    font-family: "Open Sans";
    color: var(--type);
    background: #00737e09;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    width: 100%;
}

a:active, a {
    color: var(--teal);
}

a:visited {
    color: var(--teal);
}

/* Type utilities */
.secondary-type {
    color: var(--secondary-type);
}

.bold {
    font-weight: 700;
}

.medium {
    font-weight: 500;
}

/* Member lock icon — prepended to .protected-True elements */
.protected-True:before {
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    padding-right: 5px;
    font-family: "Font Awesome 5 Pro"; font-weight: 900; content: "\f023";
}

.user-logged-in .protected-True:before {
    content: "\f09c";
}


/* ── TYPOGRAPHY ─────────────────────────────────────────────────────────── */
/* Utility classes for text. Use these instead of bare size keywords or raw
   hex text colors in new code. Not tied to any component — usable anywhere. */

/* Font size */
.text-xs { font-size: var(--text-xs); }   /* labels, chips, hints, meta */
.text-sm { font-size: var(--text-sm); }   /* captions, notices, subtitles */

/* Font weight — fills the gap between .medium (500) and .bold (700) */
.semibold { font-weight: 600; }

/* Text color */
.text-heading { color: var(--color-heading); }  /* teal-dark: labels, primary text */
.text-muted   { color: var(--color-muted); }    /* teal-muted: secondary, meta */

/* Combined patterns — most common text treatments across the app */
.text-meta  {
    /* Secondary meta text: hints, descriptions, sub-labels */
    font-size: var(--text-xs);
    color: var(--color-muted);
}

.text-label {
    /* Compact stat/progress label: "23 / 20 XP", "3 badges tracked" */
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-heading);
    white-space: nowrap;
}

/* Overflow helpers */
.text-nowrap   { white-space: nowrap; }
.text-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ── 4. LAYOUT ───────────────────────────────────────────────────────────── */

/* Centered content columns — max 1200px, sidebar-aware on wide screens */
.center, .header {
    max-width: 1200px;
    margin: auto;
    padding: 0 45px;
}

/* Used on index page */
#main-content {
    padding: 2em;
}

@media only screen and (min-width: 1000px) {
    .center, .header {
        padding-left: calc(250px + 2em);
    }
    .sidebar { position: fixed; }
}

@media only screen and (max-width: 1000px) {
    .sidebar { display: none; }
}

.center {
    min-height: calc(100vh - 180px);
    padding-top: 2em;
}

/* Summary box — AI-generated report summary inset */
.summary-box {
    background: rgba(150, 150, 150, 0.1);
    padding: 1em;
    border-radius: 7px;
    margin-top: 1em;
    max-width: 832px;
}

.summary-box h4 {
    color: var(--teal);
    margin-top: 0;
    display: flex;
    font-size: small;
}

.summary-box h4 img {
    width: 15px;
    align-self: center;
}

/* Frosted glass surface — used in nav, subhead, mobile drawer */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 1);
    box-shadow: 1px 3px 8px 0px rgba(0, 0, 0, 0.1);
}

/* Sections */

hr.separator {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    #e5e7eb 20%,
    #e5e7eb 80%,
    transparent
  );
  margin: 3em 0;
}

/* ── 5. NAVIGATION ───────────────────────────────────────────────────────── */

#nav {
    background: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid #eee;
    padding: 1em;
    height: var(--navh);
    box-sizing: border-box;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
}

#spacer {
    height: var(--navh);
}

#nav a, #nav a:active, #nav a:visited {
    font-weight: 700;
    color: #444;
    text-decoration: none;
    margin-top: 6px;
    display: block;
    margin-right: 2em;
    float: left;
}

#nav a:hover {
    color: #333;
}

#logo {
    width: 100px;
}

#nav .mobile-nav-open {
    display: none;
}

/* Sub-header toolbar — fixed below nav, floated over report content */
#subhead {
    margin: 1em 3%;
    box-sizing: border-box;
    border-radius: 10px;
    clear: both;
    position: fixed;
    top: var(--navh);
    margin-left: 270px;
    padding: 1em;
    width: calc(98% - 270px);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 1px 3px 8px 0px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.7);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

#subhead > * {
    align-content: center;
}

#subhead-buttons {
    gap: 10px;
    display: flex;
    margin-left: auto;
}

#subhead label {
    display: none;
}

#subhead select {
    padding: 3px 10px;
    margin-top: 0;
    box-shadow: none;
}

#subhead p {
    margin: 0;
}

#subhead button, #subhead select {
}

#subhead button {
    margin-top: 0;
    padding: 5px 10px;
}

#subhead button i, .header button i {
    margin-right: 5px;
}

@media only screen and (max-width: 1200px) {
    #subhead-buttons {
        margin-left: 0;
    }
}

/* Header typography */
.header h1 {
    font-size: 42px;
    font-family: "Tex Gyre Adventor Bold";
    font-weight: normal;
}

.header h2 {
    font-family: "Open Sans";
    font-weight: normal;
}

/* #subhead.map-tools — map-specific variant */
#subhead.map-tools {
    top: 65px;
    z-index: 400;
    background: #ffffffaa;
    margin: 1em 1em;
    width: calc(100% - 2em);
}

.map-tools .fa-ellipsis {
    float: right;
    cursor: pointer;
    margin-top: 6px;
    color: gray;
    display: none;
}

#more-options {
    float: right;
}

/* ── 6. FOOTER ───────────────────────────────────────────────────────────── */

.footer {
    background-color: var(--blue);
    color: #fff;
    padding: 2em;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1em;
    margin-top: 8em;
    clear: both;
    position: absolute;
    width: 100%;
    box-sizing: border-box;
}

.footer .column p {
    line-height: 1.6;
}

.footer a {
    color: white;
}

body.map .footer { display: none; }

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */
/* All sidebar styles live here. The sidebar.html partial contains only
   markup. Responsive overrides (fixed positioning, mobile hide) are in
   section 18 (Responsive) alongside the other layout breakpoints.           */

.sidebar {
    width: 200px;
    padding: 1rem;
    background: linear-gradient(to bottom, #00737e15 0%, #00737e09 300px, transparent 600px);
    font-family: "Open Sans";
    margin: 1em;
    border-radius: 10px;
    box-shadow: 1px 3px 8px 0px rgba(0, 0, 0, 0.1);
    border-top: 1px solid white;
    border-left: 1px solid white;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    height: calc(100vh - var(--navh) - 4em);
    overflow-y: auto;
}

.sidebar ul, .sidebar p, .sidebar a {
    font-family: "Open Sans";
    font-size: var(--text-xs);
}

.sidebar ul, .sidebar p {
    margin: 0;
}

p.meta {
    font-size: 10px;
}

.sidebar h3 { margin-top: 0; }
.sidebar h4 { font-size: var(--text-sm); margin-top: 2em; }
.sidebar h4:first-of-type { margin-top: 2em; margin-bottom: 0; }
.sidebar h5 { font-size: var(--text-xs); opacity: 0.6; margin-bottom: 3px; }

.sidebar ul {
    list-style: none;
    padding-left: 0;
}

/* Sidebar favorite/recent link cards */
.sidebar-card {
    background: #00737e15;
    padding: 7px;
    border-radius: 3px;
    margin-bottom: 5px;
    display: block;
    text-decoration: none;
    transition: background .7s cubic-bezier(.22, 1, .36, 1);
    border: 1px solid var(--teal-trans);
}

.sidebar-card:hover {
    background: #00737e30;
}

#nav .sidebar a {
    color: var(--teal);
    text-decoration: underline;
    font-weight: normal;
}

#favorites-empty-state {
    font-size: .8em;
    color: rgba(0, 0, 0, 0.65);
    line-height: 1.4;
    margin-bottom: 1em;
}

/* Level card — shows current level + XP progress bar */
.sidebar-level-card {
    display: block;
    margin-top: 0.7rem;
    padding: 0.65rem 0.7rem;
    border-radius: 10px;
    background: var(--teal-hover);
    border: 1px solid var(--teal-border);
    text-decoration: none;
    color: inherit;
}

#nav .sidebar a.sidebar-level-card {
    text-decoration: none;
    font-weight: normal;
    color: inherit;
}

.sidebar-level-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-level-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-heading);
}

.sidebar-level-progress-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-heading);
    opacity: 0.85;
}

.sidebar-level-track {
    margin-top: 0.45rem;
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--teal-border);
    overflow: hidden;
}

.sidebar-level-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--teal);
}

/* Next badge preview row */
.sidebar-next-badge-row {
    margin-top: 0.55rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-badge-left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

/* Sidebar badge hexagon — green/earned tint (smaller than account .badge-icon) */
.sidebar-badge-icon {
    position: relative;
    width: 16px;
    height: calc(16px * 1.732);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 16px;
    background: #dcf3ea;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1;
    margin-left: .3em;
    margin-right: .3em;
}

.sidebar-badge-icon::before,
.sidebar-badge-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    border-radius: inherit;
}

.sidebar-badge-icon::before { transform: rotate(60deg); }
.sidebar-badge-icon::after  { transform: rotate(-60deg); }

.sidebar-badge-icon i {
    position: relative;
    z-index: 1;
}

.sidebar-next-badge-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-badge-copy {
    min-width: 0;
}

.sidebar-next-badge-progress {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-heading);
    opacity: 0.85;
    white-space: nowrap;
}

.chat-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Skeleton loading placeholders */
.sidebar-card-placeholder {
    pointer-events: none;
}

.sidebar-placeholder-line {
    border-radius: 3px;
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.06) 25%,
        rgba(0, 0, 0, 0.12) 50%,
        rgba(0, 0, 0, 0.06) 75%
    );
    background-size: 200% 100%;
    animation: sidebar-shimmer 2s infinite;
}

.sidebar-placeholder-title {
    height: 16px;
    width: 75%;
    margin-bottom: 10px;
}

.sidebar-placeholder-meta {
    height: 12px;
    width: 45%;
}

@keyframes sidebar-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ── 7. SURFACES ─────────────────────────────────────────────────────────── */

/* Generic white surface. No min-height — use freely for any content panel.   */
.card {
    background: white;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

/* Dashboard metric cell — min-height enforced for dashboard grid alignment.   */
/* Only use this on the market dashboard's metric grid.                        */
.dashboard-card {
    background: white;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 300px;
    box-sizing: border-box;
}

.card.transparent-card {
    background: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    box-sizing: border-box;
}

.card h2 {
    font-size: 0.8em;
}

.card h2, .card h3, .card h4, .card h5 {
    margin-top: 0;
    margin-bottom:.5em;
}

/* Card header — flex row: title on left, optional action link on right */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    margin: 0 0 1em;
}

.card-header a {
    text-decoration: none;
    font-size: small;
}

/* Notice banner — teal info box, used for protected-report alerts */
.notice {
    background: var(--teal-trans);
    color: var(--teal);
    border-radius: 5px;
    font-size: small;
    padding: 10px;
    display: flex;
}

.notice a {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
    display: inline-block;
    vertical-align: middle;
    font-weight: normal;
}

.notice i { margin: 3px 5px 0 0; vertical-align: middle; }
.notice p { margin: 0; vertical-align: middle; }

.highlight {
    font-size: small;
}

.highlight i {
    margin-right: 3px;
}


/* ── 8. BUTTONS ──────────────────────────────────────────────────────────── */

/* Primary button — teal-blue gradient.
   Use .btn-primary for new buttons. Bare button:not([class]) catches legacy
   unclassed buttons. Named semantic classes are opted in explicitly.          */
.report a,
button:not([class]),
.btn-primary,
button.primary-btn,
button.primary,
button.select-report-link {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1em;
    color: white;
    background: linear-gradient(to bottom, var(--blue-light), var(--blue));
    opacity: .98;
    border: 1px solid var(--blue);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
}

.btn-primary:hover,
button:not([class]):hover,
button.primary-btn:hover,
button.primary:hover,
button.select-report-link:hover {
    opacity: 0.9;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.3);
    transform: scale(1.02);
}

.btn-primary:active,
button:not([class]):active,
button.primary-btn:active,
button.primary:active,
button.select-report-link:active {
    opacity: 1.0;
    box-shadow: var(--shadow-inset);
    transform: scale(0.98);
}

/* Secondary button — ghost with blue tint */
a.button-secondary, .button-secondary {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1em;
    color: var(--blue);
    background: linear-gradient(to bottom, color-mix(in srgb, var(--blue-light) 12%, transparent), color-mix(in srgb, var(--blue) 25%, transparent));
    opacity: .98;
    border: 1px solid var(--blue-semitrans);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
    transition: all 0.2s ease-in-out;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.button-secondary > a {
    text-decoration: none;
    color: var(--blue);
}

.button-secondary:hover {
    opacity: 0.85;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    transform: scale(1.02);
    border-color: var(--blue-light);
}

.button-secondary:active {
    opacity: 1.0;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Tertiary button — text-style, no chrome */
.button-tertiary {
    background: transparent;
    border: none;
    display: inline-block;
    padding: 8px 0;
    font-size: 1em;
    color: var(--blue);
    opacity: .8;
    box-shadow: none;
    border-radius: var(--radius-sm);
    transition: opacity 0.05s;
    text-align: center;
    text-decoration: none;
    margin: 0 10px 0 0;
    cursor: pointer;
}

.button-tertiary:hover {
    opacity: 1;
}

/* Block modifier — full-width, large padding. Stacks with any button variant. */
.btn-block {
    display: block;
    width: 100%;
    padding: 14px 28px;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
    margin-top: 1em;
    text-align: center;
}

/* Disabled state */
.disabled {
    pointer-events: none;
    background: #eeeeee !important;
    border: #dddddd 1px solid !important;
    color: #777 !important;
}

/* Story-link card buttons — colored by content type.
   Used inline within story and learn content to link to reports/maps.        */
.button-block {
    border: 2px solid;
    padding: 10px;
    border-radius: 5px;
}

.button-block.Report, a.button-block.Report, a.button-block.Report:visited {
    background-color: var(--teal-trans);
    border-color: var(--teal-semitrans);
    color: var(--teal);
}

.button-block.Map, a.button-block.Map, a.button-block.Map:visited {
    background-color: var(--magenta-trans);
    border-color: var(--magenta-semitrans);
    color: var(--magenta);
}

.button-block.More, a.button-block.More, a.button-block.More:visited {
    background-color: var(--blue-trans);
    border-color: var(--blue-semitrans);
    color: var(--blue);
}

.button-block.Link, a.button-block.Link, a.button-block.Link:visited {
    background-color: var(--purple-trans);
    border-color: var(--purple-semitrans);
    color: var(--purple);
}

.button-block.godeeper {
    display: inline-grid;
    margin-bottom: 4px;
}

.button-block.godeeper:hover {
    box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.2);
}

.godeeper span {
    font-weight: bold;
    font-size: smaller;
    opacity: 0.5;
}

/* Plain links with a system nav function */
.report-link { /*old name for back compat*/
    font-size:small;
    font-weight:bold;
    text-decoration:none;
    margin-left:1em;
}

.jump-link {
    font-size:small;
    font-weight:bold;
    text-decoration:none;
}

/* Icon spacing inside buttons */
button i {
    margin-left: 10px;
}

.header button i {
    margin-left: 0;
}

/* Overflow actions menu — three-dot menu on report cards */
.actions {
    margin-left: auto;
    display: none;
}

.actions-btn {
    font-size: 20px;
    box-shadow: none;
    background: transparent;
    color: #333;
}

.actions-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
    transform: none;
}

.actions-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-width: 160px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.actions-menu a {
    display: block;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
}

.actions-menu a:hover {
    background: #f0f0f0;
}

.actions.show .actions-menu {
    display: block;
}

/* Chips */

.filter-chip { cursor:pointer; }
.filter-chip input { display:none; }
.filter-chip span{
    display:inline-block;
    padding:.4rem .7rem;
    border-radius: var(--radius-pill);
    border:1px solid var(--teal-border);
    background: var(--teal-surface);
    font-weight:600;
    color: var(--teal);
    font-size: var(--text-sm);
}
.filter-chip input:checked + span { background: var(--teal-trans); border-color: var(--teal-semitrans); }



/* ── 9. SELECT & DROPDOWN ────────────────────────────────────────────────── */

/* Canonical select style — teal underline, teal-trans background.
   Used in buildreport Step 1, map subhead, and index page.                   */
select, .dropbtn {
    cursor: pointer;
    font-size: 1em;
    padding: 1em;
    border-radius: 0;
    border: none;
    border-bottom: 3px solid var(--teal);
    background: var(--teal-trans);
    color: var(--teal);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    margin-top: 1em;
    box-shadow:
        0 2px 1px rgba(0, 0, 0, 0.03),
        0 4px 2px rgba(0, 0, 0, 0.03),
        0 8px 4px rgba(0, 0, 0, 0.03),
        0 16px 8px rgba(0, 0, 0, 0.01),
        0 32px 16px rgba(0, 0, 0, 0.01),
        -32px 32px 132px #004b8b15,
        32px 32px 132px #95215e10;
    transition: all .2s ease-out;
}

select:hover, .dropbtn:hover {
    box-shadow:
        0 2px 1px rgba(0, 0, 0, 0.10),
        0 4px 2px rgba(0, 0, 0, 0.07),
        0 8px 4px rgba(0, 0, 0, 0.05),
        0 16px 8px rgba(0, 0, 0, 0.03),
        0 32px 16px rgba(0, 0, 0, 0.03),
        -32px 32px 132px #004b8b15,
        32px 32px 132px #95215e10;
}

/* Float wrapper for label + select in Step 1 */
select-block {
    margin: 1em 3em 2em 0;
    display: block;
    float: left;
}

/* Dropdown button width */
.dropbtn {
    width: 100%;
}

.dropbtn:hover, .dropbtn:focus {
}

/* Custom searchable dropdown */
.dropdown {
    position: relative;
    display: inline-block;
    min-width: 230px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f7fafa;
    min-width: 230px;
    z-index: 1;
    box-shadow:
        0 2px 1px rgba(0, 0, 0, 0.03),
        0 4px 2px rgba(0, 0, 0, 0.03),
        0 8px 4px rgba(0, 0, 0, 0.03),
        0 16px 8px rgba(0, 0, 0, 0.01),
        0 32px 16px rgba(0, 0, 0, 0.01),
        -32px 32px 132px #004b8b15,
        32px 32px 132px #95215e10;
}

.dropdown input {
    box-sizing: border-box;
    background-position: 14px 12px;
    background-repeat: no-repeat;
    font-size: 16px;
    padding: 1em;
    border: none;
    border-bottom: 1px solid var(--teal-semitrans);
}

.dropdown-content input:focus {
    outline: 3px solid var(--teal-semitrans);
}

.dropdown-list {
    max-height: 300px;
    overflow-y: scroll;
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    cursor: pointer;
}

.dropdown-content a:hover {
    background-color: var(--teal-trans);
}

.show { display: block; }

/* Form parent — show/hide wrapper per geo type in Step 1 */
.form-parent { display: none; }
.form-parent:first-child { display: block; }
.form-parent-floatbar:first-child { display: inline-flex; }

/* Legacy single-view select blocks on old report pages */
#comparison-select-block {
    padding-left: 3em;
    border-left: 2px dotted var(--teal-semitrans);
    width: 300px;
}

#view-report-select-block {
    width: 300px;
}


/* ── 10. VIEW MODE & COMPARISON ──────────────────────────────────────────── */

/* iOS-style segmented control for switching Single / Compare mode */
.view-mode-toggle {
    display: inline-flex;
    border: 1px solid var(--teal-border);
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.04);
    padding: 3px;
    margin-bottom: 1.25rem;
    gap: 2px;
}

.mode-btn {
    background: none;
    border: none;
    padding: .45rem 1.1rem;
    font: inherit;
    font-size: .875em;
    font-weight: 500;
    color: var(--secondary-type);
    cursor: pointer;
    border-radius: var(--radius-pill);
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.mode-btn i {
    margin-left: .4rem !important;
    margin-right: 0 !important;
}

.mode-btn.mode-btn-active {
    background: white;
    color: var(--type);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* Comparison panel — column layout for geography slots */
.comp-columns {
    display: flex;
    gap: .85rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    align-items: stretch;
}

/* Geography slot card */
.comp-slot {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    background: white;
    border: 1px solid var(--teal-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.comp-slot-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .45rem .85rem;
    border-bottom: 1px solid var(--teal-border);
    background: var(--teal-surface);
    font-size: x-small;
    font-weight: 700;
    color: var(--teal-dark);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-radius: var(--radius) var(--radius) 0 0;
}

.comp-slot-remove {
    background: none;
    border: none;
    color: var(--teal-muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    margin: 0;
    opacity: .55;
    font-weight: 400;
}

.comp-slot-remove:hover { opacity: 1; color: var(--red); }

.comp-slot-body {
    padding: .85rem;
    flex: 1;
    cursor: pointer;
    transition: background 0.12s ease;
    border-radius: 0 0 var(--radius) var(--radius);
}

.comp-slot:hover .comp-slot-body {
    background: var(--teal-surface);
}

.comp-slot-geo-name {
    font-weight: 700;
    color: var(--teal-dark);
    margin-bottom: .2rem;
}

.comp-slot-geo-meta {
    font-size: small;
    color: var(--teal-muted);
}

/* Add geography ghost button */
.comp-add-geo {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    align-self: stretch;
    min-width: 150px;
}

.comp-add-geo-btn {
    background: none;
    border: 1.5px dashed var(--blue-semitrans);
    border-radius: var(--radius);
    padding: 1rem .85rem;
    color: var(--blue);
    font: inherit;
    font-size: .85em;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .5rem;
    transition: border-color 0.15s ease, background 0.15s ease;
    text-align: center;
    line-height: 1.4;
}

.comp-add-geo-btn:hover {
    border-color: var(--blue-light);
    background: color-mix(in srgb, var(--blue-light) 8%, transparent);
}

.comp-add-geo-btn i {
    font-size: 1.1rem;
    opacity: .65;
    margin: 0 !important;
}

/* Step 2 CTA buttons — View Report, Compare, Table */
.step2-cta {
    display: block;
    text-align: center;
    padding: 13px 28px;
    box-sizing: border-box;
    margin-bottom: .5rem;
}

/* Single panel: cap width so it doesn't sprawl full page */
#single-panel .step2-cta {
    max-width: 460px;
}

/* Compare panel: fit to card width */
#compare-panel {
    width: fit-content;
}

#compare-panel .step2-cta {
    width: 100%;
}

#comp-cta:disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Geography picker modal */
#comp-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

#comp-modal {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 420px;
    max-width: 92vw;
    overflow: hidden;
}

#comp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--teal-border);
    background: var(--teal-surface);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--teal-muted);
    cursor: pointer;
    padding: 0 .15rem;
    line-height: 1;
    opacity: .6;
}

.modal-close:hover { opacity: 1; color: var(--type); }

#comp-modal-body {
    padding: .5rem 1rem 0;
    display: flex;
    flex-direction: column;
}

.modal-field {
    display: flex;
    flex-direction: column;
}

/* Reset select margin inside modal so fields stack tighter */
#comp-modal-body select {
    margin-top: .35rem;
    width: 100%;
}

#comp-modal-footer {
    padding: .75rem 1rem 1.25rem;
}

#comp-modal-footer .btn-primary {
    display: block;
    width: 100%;
    text-align: center;
    padding: 13px 28px;
}

/* Comma-separated geography list in comparison report headers */
.comp-names > span::after {
    content: ", ";
}

.comp-names > span:last-child::after {
    content: "";
}

/* Sidepanel links */
.sidepanel a {
    text-decoration: none;
}


/* ── 11. CONTENT TAGS ────────────────────────────────────────────────────── */

/* Story card pill tags — teal default, with color variants */
.stories .date, .stories .category, .story .date, .story .category {
    display: inline-block;
    font-size: small;
    background: var(--teal-trans);
    color: var(--teal);
    padding: 2px 4px;
    border-radius: 4px;
}

.category.update {
    color: var(--blue);
    background: var(--blue-trans);
}

.category.Video {
    color: var(--magenta);
    background: var(--magenta-trans);
}

/* Report domain label — ALL CAPS, muted, on viz blocks */
.domain-tag {
    text-transform: uppercase;
    font-weight: bold;
    opacity: 0.6;
    margin: 0;
    font-size: 0.8em;
}

/* Learn-page lesson tag */
.lessontag {
    font-size: small;
    opacity: 0.7;
    display: inline;
}


/* ── 12. STORY & CONTENT ─────────────────────────────────────────────────── */

.stories.feed {
    max-width: 600px;
}

.stories.side {
    display: block;
}

.stories .report-title {
    font-size: large;
    margin-top: 1em;
}

/* Story card — compact preview in the feed */
.story-card {
    border-radius: 10px;
    box-shadow: 1px 3px 8px 0px rgba(0, 0, 0, 0.1);
    background: white;
    padding: 1em;
    margin: 1em 0;
}

.story-card.pinned {
    border: 1px solid var(--teal-semitrans);
}

.story-card .highlight {
    font-size: inherit;
    background: #00737e09;
    padding: 10px 15px;
    border-radius: 10px;
    margin-top: 1em;
    border: 1px solid #00737e20;
    line-height: 1.6em;
    width: 100%;
    box-sizing: border-box;
}

.story-card .highlight canvas {
    height: 300px;
    box-sizing: border-box;
}

.story-card .highlight .title {
    font-weight: 700;
}

.story-card a.action {
    margin-top: 1em;
    display: inline-block;
    color: var(--teal);
    font-weight: 500;
    text-decoration: none;
    padding: 2px 4px;
    margin-left: -4px;
    border-radius: 10px;
}

.story-card a.action:hover {
    background: #00737e09;
}

.story-card a.title-link, .story-card a.title-link:visited {
    color: var(--teal);
    text-decoration: none;
}

/* Full article / long-read layout */
.story.center {
    max-width: 800px;
    width: 80%;
    margin-bottom: 100px;
    margin-top: 100px;
    padding-left: 45px;
}

.story h1 {
    font-size: 2em;
}

.story h2, .story h3, .story h4, .story h5, .story h6 {
    margin-top: 3em;
    margin-bottom: 2em;
}

.story p, .story ul {
    font-size: 1.25em;
    line-height: 1.875em;
    font-family: Domine;
}

.story-meta {
    margin-bottom: 3em;
}

.story-meta span {
    display: inline-block;
    margin-right: 1em;
}

.story iframe, .story img {
    margin-top: 2em;
    margin-bottom: 2em;
    box-shadow: 0 0 16px rgba(0, 0, 0, 0.1);
    width: 100%;
    border: none;
}

.story p.wide, .story iframe.wide {
    margin: unset;
    max-width: unset;
}

.story p. caption {
    font-style: italic;
    font-size: 16px;
    color: #666;
    line-height: 1.5;
}

.story img {
    height: auto;
}

.story .caption, .story .narrow, .story h1, .story h2, .story h3, .story h4, .story h5, .story h6, .story p, .story ul, .story-meta {
    margin-left: calc((100% - 600px) / 2);
    max-width: 600px;
    box-sizing: border-box;
}

.story .caption {
    font-size: .875em;
    color: #666666;
}

.story .noshadow {
    box-shadow: none;
}

.story a, .story a:active, .story a:visited {
    color: var(--teal);
}

.story .big-banner {
    background: linear-gradient(#00737e, #00737e00);
    position: absolute;
    width: 100vw;
    height: 400px;
    left: 0;
    z-index: -1;
    margin-top: 4em;
}

.story .big-banner img {
    box-shadow: none;
    width: 100%;
    margin: 0;
}

.story .big-banner + h2 {
    font-size: 4em;
    color: white;
    margin-top: 3em;
}

/* Preview thumbnail */
.preview {
    margin-top: 1em;
}

.preview img { margin-top: 1em; }

/* Video embed */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
}

.Video .preview {
    margin-left: -1em;
    margin-right: -1em;
    margin-bottom: -1em;
}

.Video .action {
    display: none !important;
}


/* ── 13. REPORT CONTAINERS ───────────────────────────────────────────────── */

/* viz — a single chart/stat block within a report */
.viz, .report {
    margin: 100px 0;
    border: 0px solid #eee;
    border-radius: 10px;
    box-shadow: 1px 3px 8px 0px rgba(0, 0, 0, 0.1);
    padding: 2em;
    background: white;
}

.report {
    margin: 40px 0;
    display: flex;
    flex-direction: column;
}

.report button.select-report-link {
    margin-top: auto;
}

/* Brief report layout */
#brief-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 3em;
}

#brief-wrapper .report {
    margin-bottom: 0;
}

.brief-report { clear: both; }

.report.brief {
    background: var(--blue-trans);
}

/* noinspection CssInvalidPropertyValue */
.brief-report .domain {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-template-rows: masonry;
    grid-gap: 1em;
}

.brief-report .viz {
    margin: 0;
    padding: 2em;
}

.brief-report .viz_title, .brief-report .viz_subtitle {
    font-size: 1em;
}

/* Domain section divider */
.domain-header {
    margin-top: 100px;
    border-top: 4px solid;
    padding-top: 20px;
    font-size: 1.5em;
    clear: both;
}

/* Report typography */
.viz_title, .report-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-block-end: .5em;
    margin-block-start: 0;
}

.viz_subtitle {
    font-size: 1.125em;
    font-weight: normal;
    margin-block-start: .5em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 1.67em;
}

.viz_details {
    font-size: x-small;
    color: #777;
}

.viz-holder, .canvas-holder {
    height: 45vh;
    max-height: 400px;
}

.brief-report .viz-holder, .brief-report .canvas-holder {
    height: 30vh;
    max-height: 400px;
}

/* Blurb — report-level prose intro */
.blurb {
    font-size: 1em;
    font-weight: 500;
    margin-bottom: 2em;
}

/* Stat callout block */
.statwrapper {
    margin-right: 1em;
    padding: .5em 1em;
    margin-bottom: 2em;
    border-left: 3px solid;
    width: calc(33% - 3.33em);
    min-width: auto;
}

.statwrapper {
    border-left: 0;
    width: 100%;
    background: transparent;
    padding: 0px;
    border-radius: 7px;
}

.hide-print .statwrapper, .facts_strip .statwrapper {
    background: #f5f5f5;
    padding: 7px;
}

.statwrapper:last-child {
    margin-right: 0;
    border-right: 0;
}

.statlabel {
}

.stat {
    font-size: 1.5em;
    font-weight: 700;
}

.expected {
    font-size: .8em;
    padding-right: 1em;
}

/* Export buttons */
.export-buttons {
    gap: 1em;
    display: flex;
}

a.export:visited {
    color: #9aa3aa;
}

.export:hover {
    border: 1px solid #aaaaaa;
    box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.2);
    color: var(--teal);
}

/* Random stat block */
.random {
    border-top-width: 2px;
    border-top-style: solid;
    padding-top: 1em;
    margin: 1em 0;
}

.random-viz {
    height: 300px;
}

/* Slide / viz-only layout */
.viz_only { background: white; }
.viz_only #main { margin: 0; width: 100%; max-width: 100%; }
.viz_only .viz { margin: 0; box-shadow: none; }
.viz_only .statwrapper { width: calc(30% - 3.33em); }

/* Print holder — side-by-side chart + stats for print */
.print-holder {
    display: inline-block;
    width: 100%;
}

/* Data table — fixed-layout tabular data in reports */
.data-table {
    table-layout: fixed;
    width: 100%;
    max-width: 800px;
    border-collapse: collapse;
    margin-bottom: 100px;
}

.data-table td {
    padding: 5px;
    border-right: 1px solid silver;
    border-bottom: 1px solid silver;
}

.data-table button {
    padding: 5px;
    width: 100%;
}

/* Blog table — styled comparison table for story content */
table.blog-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1em;
    font-family: system-ui, sans-serif;
}

table.blog-table th {
    background-color: var(--teal-trans);
    padding: 8px 10px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
}

table.blog-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
}

table.blog-table th:first-child {
    text-align: left;
}

table.blog-table td:not(:first-child) {
    text-align: center;
}

table.blog-table tr:hover {
    background-color: var(--teal-trans);
}


/* ── 14. MAP ─────────────────────────────────────────────────────────────── */

#map {
    height: calc(100vh - 63px);
    top: 0;
}

#map-loader-text {
    color: #bbbbbb;
}

#map-loader {
    position: absolute;
    left: 50%;
    top: calc(50% + 100px);
    transform: translate(-50%, -50%);
    z-index: 500;
}

/* Floating frosted legend panel */
#legend {
    padding: 1em;
    margin-right: 3%;
    right: 0;
    bottom: 20px;
    background: #ffffffaa;
    border-radius: 5px;
    position: fixed;
    z-index: 500;
    backdrop-filter: blur(100px);
    -webkit-backdrop-filter: blur(100px);
    box-shadow:
        0 2px 1px rgba(0, 0, 0, 0.03),
        0 4px 2px rgba(0, 0, 0, 0.03),
        0 8px 4px rgba(0, 0, 0, 0.03),
        0 16px 8px rgba(0, 0, 0, 0.01),
        0 32px 16px rgba(0, 0, 0, 0.01),
        -32px 32px 132px #004b8b15,
        32px 32px 132px #95215e10;
}

#legendBar {
    height: 20px;
    margin-top: 10px;
}

.legendSlice {
    height: 20px;
    width: 2px;
    display: inline-block;
}

.legendLabel {
    font-size: small;
    width: 31.5%;
    display: inline-block;
}

#legendLabelMid {
    text-align: center;
}

#legendLabelHi {
    text-align: right;
}

#legendTitle, #legendSubtitle {
    font-size: small;
    display: inline-block;
}

#legendSubtitle {
    color: gray;
}

/* Popup list (map tooltips) */
.popup-list {
    margin-block-start: 0;
    margin-left: 0;
    padding-inline-start: 0;
    list-style-type: none;
}


/* ── 15. LEARN PAGE ──────────────────────────────────────────────────────── */

.lessongrid {
    display: grid;
    grid-template-columns: repeat(3, minmax(300px, 400px));
    column-gap: 1em;
    row-gap: 1em;
    margin-bottom: 3em;
}

.lesson {
    border-style: dotted;
    border-width: 1px;
    cursor: pointer;
    box-sizing: border-box;
    margin: 0 !important;
}

.lesson:hover {
    border-style: solid;
}

.lesson img.gif {
    display: none;
}

.lesson:hover img {
    mix-blend-mode: normal;
}

.lesson img {
    mix-blend-mode: multiply;
    border-radius: 5px;
}

.lesson p {
    margin-top: 0;
    margin-bottom: .5em;
}

.lesson p:nth-child(2) {
    font-weight: 700;
}

/* Grid container (market dashboard, comparison tables) */
.grid-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(300px, 1fr));
    column-gap: 3em;
    row-gap: 1em;
}


/* ── 16. UTILITIES ───────────────────────────────────────────────────────── */

/* Hide scrollbar — keeps element scrollable without visible bar */
.no-scrollbar, #nav {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar, #nav::-webkit-scrollbar {
    display: none;
}

/* Responsive visibility */
.for-mobile {
    display: none;
}

.hide-print { display: block; }
.for-print  { display: none;  }

td.center {
    text-align: center;
}

/* Step — card modifier for account/form flow pages. Adds top margin and
   removes any inherited min-height so cards size to their content.           */
.step {
    margin-top: 1em;
    min-height: 0;
}

/* Subtle page-level subtitle text */
.page-subtle {
    color: var(--teal-muted);
    margin: 0.25rem 0 0;
}

/* Hint — helper text below form fields and filtered lists */
.hint {
    color: var(--teal-muted);
    font-size: x-small;
    margin-top: .8em;
}

/* Search input — shared across market picker, favorites, learn page */
.searchbar {
    margin: .25rem 0 .5rem;
    font-size: var(--text-sm);
}

.searchbar input {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--teal-border);
    border-radius: var(--radius-sm);
    font: inherit;
    box-sizing: border-box;
}

.searchbar input:focus {
    outline: none;
    border-color: var(--teal-semitrans);
    box-shadow: 0 0 0 3px rgba(0, 115, 126, .08);
}


/* ── 16b. PICK BUTTON & LIST ─────────────────────────────────────────────── */

/* Selectable list item — shared visual base for market picker and favorites.
   Handles all visual states; layout (flex vs grid) set by context wrappers.
   JS should toggle .is-selected to mark the chosen item.                     */
.pick-btn {
    width: 100%;
    text-align: left;
    border: 1px solid var(--teal-border);
    background: var(--teal-surface);
    padding: .7rem .85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    transition: background .15s, border-color .15s, box-shadow .15s;
    box-shadow: none;
    margin: 0;
    box-sizing: border-box;
}

.pick-btn:hover {
    border-color: var(--teal-semitrans);
    background: var(--teal-hover);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
    transform: none;
}

.pick-btn.is-selected {
    border-color: var(--teal-semitrans);
    background: var(--teal-selected);
    box-shadow: 0 0 0 2px rgba(0, 115, 126, .08) inset;
}

.pick-btn.is-selected:hover {
    border-color: var(--teal-semitrans);
    background: var(--teal-selected);
    box-shadow: 0 0 0 2px rgba(0, 115, 126, .08) inset;
}

/* Text inside .pick-btn */
.pick-name {
    font-weight: 600;
    color: var(--teal-dark);
    font-size: var(--text-sm);
}

.pick-sub {
    color: var(--teal-muted);
    font-size: var(--text-xs);
}

/* Scrollable list container for pick-btn items */
.pick-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 280px;
    overflow: auto;
    display: grid;
    gap: .5rem;
    border-bottom: 1px solid var(--teal-border);
}

/* Favorites context: checkbox + text grid layout */
.pick-list--checkbox .pick-btn {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: .75rem;
    row-gap: .2rem;
    align-items: start;
}

.pick-list--checkbox .pick-name,
.pick-list--checkbox .pick-sub {
    grid-column: 2;
}


/* ── 17. PRINT STYLES ────────────────────────────────────────────────────── */

@media print {
    .footer { display: none; }
    body { background: none; }
    .center, .header { width: calc(100% - 90px); margin: 0; }
    #nav, select-block, #spacer, .sidebar { display: none; }
    .for-print  { display: block; }
    .hide-print { display: none !important; }
    #print-logo { width: 50px; float: right; }
    .header h1  { font-size: 1.1em; font-weight: normal; }
    .header h2  { font-size: small; font-weight: 700; }
    .viz { border: none; box-shadow: none; padding: 0; margin: 1em 0; }
    .viz_title    { font-size: 1em !important; }
    .viz_subtitle { font-size: small !important; }
    .viz img { margin-right: 30px; margin-bottom: 1.5em; }
    .viz p   { font-size: small; margin-bottom: 0; }
    .viz_details p { font-size: 7px; }
    .viz { page-break-inside: avoid; clear: both; }

    #subhead.map-tools {
        position: absolute;
        padding: 1em 1em 0 1em;
        background: white;
        max-width: 600px;
        width: auto;
        top: 35px;
        margin-left: 15px;
        font-size: 1.1em;
    }
    #subhead.map-tools select {
        background: none;
        border: none;
        width: auto;
        padding: 0 2px 0 7px;
        font-weight: bold;
    }
    #more-options { display: none; }
    #legend { background: white; box-shadow: none; }
    .leaflet-control-zoom { display: none; }
    #map { width: 100vw; height: 100vh; }
    #mapDataDownload { display: none; }

    #subhead {
        opacity: 1.0 !important;
        display: block !important;
        position: relative;
        box-shadow: none;
        padding: 0;
        margin: .5em 45px 2em;
        margin-block-end: 2em;
        font-size: small;
        font-weight: bold;
        top: 0;
    }
    #summary { font-size: small; }

    .summary-box {
        background: none;
        padding: 0;
    }
    .summary-box h4 { display: none; }
    #subhead p { margin-block-end: 1em; }
    #subhead select-block { display: none !important; }

    body:not(.viz_only) .statwrapper {
        clear: both;
        margin-bottom: .5em;
        width: 100%;
        margin-right: 0;
        padding: .2em 1em;
    }
    .statlabel, .expected { font-size: xx-small; }
    .stat { font-size: small; }
    .print-holder { display: flex; gap: 1em; }
    .domain-header { margin-top: 0; font-size: 1em; }

    .viz-holder, .canvas-holder, canvas {
        max-width: 500px;
        max-height: 180px;
    }
    .viz-holder { margin-bottom: 1em; }
    .stat-wrapper { min-width: 40%; }

    .brief-report .viz_title, .brief-report .viz_subtitle {
        border: none;
        margin-bottom: 0;
        padding: 0;
    }
    .brief-report .viz {
        border-top: 1px solid silver;
        border-radius: 0;
        padding: .5em 0;
    }
    #subhead p { float: none; }
    .brief-report .viz-holder {}
    .brief-report .viz-holder, .brief-report .canvas-holder, .brief-report canvas {
        max-width: 500px;
        max-height: 200px;
    }

    body[data-report_id="10"] #subhead { margin-block-end: 0px; }
    body[data-report_id="10"] .viz { margin: 0; }
    body[data-report_id="10"] .viz_title { font-size: small; }
    body[data-report_id="10"] .viz-holder { margin-bottom: 30px; }
    body[data-report_id="10"] .domain-header {
        border-top: none;
        border-left: 4px solid;
        padding-top: 0;
        padding-left: 10px;
    }
    body[data-report_id="10"] .domain:first-child .viz-holder,
    body[data-report_id="10"] .domain:first-child .canvas-holder,
    body[data-report_id="10"] .domain:first-child canvas {
        max-height: 150px;
    }
    body[data-report_id="10"] .viz { margin: 2em 0; }
    body[data-report_id="10"] .domain:first-child div.viz:nth-child(-n+3) { margin: 0; }

    .domain { page-break-before: always; }
    .domain:first-child { page-break-before: avoid; }

    body[data-report_id="10"] .viz_subtitle {
        padding-bottom: .5em;
        margin-block-end: .5em;
    }
    .brief-report .viz_title   { font-size: small; }
    .brief-report .viz_subtitle { font-size: small; margin: 0 0 .5em 0; }
    .brief-report .viz p       { font-size: small; }
    .brief-report .viz_details p { font-size: small; }
    .brief-report .viz .domain-tag { font-size: x-small; margin-top: 5px; }
    .brief-report .statlabel, .brief-report .expected { font-size: small; }
    .brief-report .stat         { font-size: small; }
    .brief-report .viz_details p { font-size: x-small; }
}


/* ── 18. RESPONSIVE ──────────────────────────────────────────────────────── */

/* ≥ 800px — stories grid */
@media only screen and (min-width: 800px) {
    .stories.center {
        display: grid;
        grid-template-columns: minmax(200px, 1.5fr) minmax(100px, 1fr);
        column-gap: 50px;
    }
    .stories.feed {
        max-width: calc(1200px - 455px);
    }
    .stories.side {
        display: block;
    }
}

/* ≥ 1000px — sidebar layout shift */
@media only screen and (min-width: 1000px) {
    .sidebar {
        background: rgba(255, 255, 255, 0.7);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 1);
        position: fixed;
        z-index: 2;
    }
    #subhead-buttons {
    }
}

/* ≤ 1000px — mobile nav and layout */
@media only screen and (max-width: 1000px) {
    .mobile  { display: initial; }
    .nomobile { display: none !important; }

    #subhead {
        margin: 1em 2%;
        width: 96%;
        top: 0px;
    }

    #brief-wrapper {
        grid-template-columns: 1fr;
        grid-gap: 0;
    }

    #nav {
        z-index: 2000;
        height: 95vh;
        width: auto;
        position: absolute;
        top: 0;
        transform: translate(-100%) scale(.95);
        transform-origin: top right;
        transition: transform .2s cubic-bezier(.22, 1, .36, 1);
    }

    #spacer { display: none; }

    #nav.open {
        overflow-y: scroll;
        overflow-x: hidden;
        transform: translate(0%);
        box-shadow: 1px 3px 8px 1px rgba(0, 0, 0, 0.2);
        margin: 1em;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.7);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 1);
    }

    #nav .mobile-nav-open {
        display: block;
        cursor: pointer;
        position: absolute;
        right: 0;
        top: 12px;
        transform: translate(26px);
    }

    #nav .mobile-nav-open .open  { display: block; }
    #nav .mobile-nav-open .close { display: none; }
    #nav.open .mobile-nav-open .open  { display: none; }
    #nav.open .mobile-nav-open .close { display: block; }

    #nav.open .mobile-nav-open { transform: translate(-10px); }

    #logo {
        width: 100%;
        max-width: 50px;
    }

    #nav a {
        display: block;
        width: 100%;
        text-decoration: underline !important;
        color: var(--teal) !important;
        box-sizing: border-box;
    }

    #nav * {
        clear: both;
        float: none !important;
    }

    #nav ul { margin: 0; }
    #nav a:nth-child(2) { margin-top: 1em !important; }

    .center, .header {
        margin-top: 2em;
        padding: 0 15px;
    }

    select-block {
        margin: 0 3em 1em 0;
    }

    #comparison-select-block {
        padding-left: 0;
        border-left: none;
        padding-top: 1.2em;
        margin-top: 1.2em;
        border-top: 2px dotted var(--teal-semitrans);
    }

    #comparison-select-block, #view-report-select-block, #comp-link {
        width: 100% !important;
    }

    .pop {
        display: table;
    }

    .header h1 { font-size: 2em; }
    .header h2 { font-size: 1.2em; }

    .domain-header {
        margin-top: 2em;
        padding-top: 1em;
    }

    .viz {
        margin: 1em 0;
        padding: 1.3em;
    }

    .export {
        margin-top: 1em;
        font-size: .8em;
        padding: 8px 11px;
    }

    .viz-details { font-size: xx-small; }

    #subhead p { float: none; }

    #subhead button:not(.actions-btn) {
        float: left;
        margin-right: 1em;
        margin-left: 0;
        margin-bottom: 0.8em;
    }

    .story img, .story iframe {
        margin-left: calc(10vw * -1);
        width: 100vw;
    }

    .story .caption, .story iframe, .story .narrow, .story h1, .story h2, .story h3, .story h4, .story h5, .story h6, .story p, .story ul, .story-meta {
        margin-left: auto;
        width: calc(100% - 0px);
        max-width: 600px;
    }

    .story .big-banner + h2 { font-size: 3em; }

    .story p, .story ul {
        font-size: 1.125em;
        line-height: 1.75em;
    }

    #subhead.map-tools {
        top: 24px;
        width: calc(100% - 24px);
        font-size: x-small;
    }

    .map-tools .fa-ellipsis {
        display: inline-block;
        font-size: small;
    }

    .leaflet-control-zoom { display: none; }

    #legend {
        margin-left: 3%;
        margin-right: auto;
        left: 0;
        right: initial;
    }

    #legend, #legenTitle, #legendSubtitle, .legendLabel {
        font-size: x-small;
    }

    #map { height: 100vh; }

    #more-options {
        float: none;
        max-height: 0;
        overflow: hidden;
    }

    #more-options.open { max-height: 100000px; }

    .grid-container {
        display: grid;
        grid-template-columns: repeat(1, minmax(300px, 1fr));
    }

    .lessongrid {
        grid-template-columns: repeat(2, minmax(250px, auto));
    }

    .header-buttons .button-secondary {
        margin: 1em 0 0 0;
        flex: 1;
        font-size: 14px;
    }

    #nav .sidebar {
        box-shadow: none;
        margin: 0;
        height: auto;
    }
}

/* ≤ 600px — small mobile */
@media only screen and (max-width: 600px) {

    .lessongrid {
        grid-template-columns: repeat(1, minmax(auto, auto));
    }

    #subhead { font-size: 0.8em; }

    .for-mobile { display: block; }
    .hide-mobile { display: none; }

    .hide-print .statwrapper {
        clear: both;
        width: 100%;
        border-right: 0;
        margin-right: 5px;
        margin-bottom: 1em;
        font-size: 1em;
        padding: 7px;
        border-radius: 7px;
        background: #f5f5f5;
    }

    .viz_title, report-title { font-size: medium; }
    .viz_subtitle             { font-size: small;  }
    .stat                     { font-size: medium; }
    .statlabel, .expected     { font-size: x-small; }

    row { display: block !important; }

    button.latest-reports {
        font-size: small;
        padding: 10px;
    }

    #bubble-legend-wrapper { right: 15px !important; }

    .stories.feed { padding: 0; }
    .story-card   { margin: 1em 0; }

    #map-loader-text { display: none !important; }
}


/* ── 19. ANIMATIONS ──────────────────────────────────────────────────────── */

/* Three-dot bouncing loader */
.lds-ellipsis {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
    translate: -50%;
    margin-left: 50%;
}

.lds-ellipsis div {
    position: absolute;
    top: 33px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--teal-semitrans);
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.lds-ellipsis div:nth-child(1) {
    left: 8px;
    animation: lds-ellipsis1 0.6s infinite;
}

.lds-ellipsis div:nth-child(2) {
    left: 8px;
    animation: lds-ellipsis2 0.6s infinite;
}

.lds-ellipsis div:nth-child(3) {
    left: 32px;
    animation: lds-ellipsis2 0.6s infinite;
}

.lds-ellipsis div:nth-child(4) {
    left: 56px;
    animation: lds-ellipsis3 0.6s infinite;
}

@keyframes lds-ellipsis1 {
    0%   { transform: scale(0); }
    100% { transform: scale(1); }
}

@keyframes lds-ellipsis3 {
    0%   { transform: scale(1); }
    100% { transform: scale(0); }
}

@keyframes lds-ellipsis2 {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(24px, 0); }
}

/* Nine-dot grid pulse loader */
.lds-grid {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.lds-grid div {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--teal);
    animation: lds-grid 1.2s linear infinite;
}

.lds-grid div:nth-child(1) { top: 8px;  left: 8px;  animation-delay: 0s;    }
.lds-grid div:nth-child(2) { top: 8px;  left: 32px; animation-delay: -0.4s; }
.lds-grid div:nth-child(3) { top: 8px;  left: 56px; animation-delay: -0.8s; }
.lds-grid div:nth-child(4) { top: 32px; left: 8px;  animation-delay: -0.4s; }
.lds-grid div:nth-child(5) { top: 32px; left: 32px; animation-delay: -0.8s; }
.lds-grid div:nth-child(6) { top: 32px; left: 56px; animation-delay: -1.2s; }
.lds-grid div:nth-child(7) { top: 56px; left: 8px;  animation-delay: -0.8s; }
.lds-grid div:nth-child(8) { top: 56px; left: 32px; animation-delay: -1.2s; }
.lds-grid div:nth-child(9) { top: 56px; left: 56px; animation-delay: -1.6s; }

@keyframes lds-grid {
    0%, 100% { opacity: 1;   }
    50%       { opacity: 0.5; }
}
