/* ------------------------------------------------------------ */
/* dark theme */
/* ------------------------------------------------------------ */

/* builds on bootstrap 5.3's dark colour mode (data-bs-theme="dark" on <html>) */
/* and recolours it "fight night" style: charcoal surfaces, light text and a crimson accent */

/* ------------------------------------------------------------ */
/* colours */
/* ------------------------------------------------------------ */

/* our own colour names, used all through this file */
:root[data-bs-theme="dark"] {
    --gf-bg: #111114;            /* page background */
    --gf-bar: #0A0A0C;           /* navbar and footer */
    --gf-card: #1C1C21;          /* cards, panels, map controls */
    --gf-line: #2E2E36;          /* borders */
    --gf-text: #ECECEF;          /* body text */
    --gf-muted: #A1A1AA;         /* secondary text */
    --gf-accent: #F43F5E;        /* crimson accent for text and links (4.6:1 or better on every surface) */
    --gf-accent-hover: #FB7185;
    --gf-fill: #E11D48;          /* deeper crimson behind white text, e.g. buttons (4.7:1) */
    --gf-fill-hover: #BE123C;


    /* point bootstrap's own colour settings at ours */
    --bs-body-bg: var(--gf-bg);
    --bs-body-color: var(--gf-text);
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-emphasis-color: #FAFAFA;
    --bs-heading-color: #FAFAFA;
    --bs-secondary-color: var(--gf-muted);
    --bs-secondary-bg: var(--gf-card);
    --bs-tertiary-bg: var(--gf-card);
    --bs-border-color: var(--gf-line);
    --bs-link-color: var(--gf-accent);
    /* the same colours as numbers, for bootstrap's see-through versions */
    --bs-link-color-rgb: 244, 63, 94;
    --bs-link-hover-color: var(--gf-accent-hover);
    --bs-link-hover-color-rgb: 251, 113, 133;
    --bs-primary: var(--gf-fill);
    --bs-primary-rgb: 225, 29, 72;
    --bs-focus-ring-color: rgba(244, 63, 94, 0.45);
    /* dark scrollbars and form controls from the browser */
    color-scheme: dark;
}

/* ------------------------------------------------------------ */
/* typography */
/* ------------------------------------------------------------ */

/* headings use space grotesk */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .navbar-brand {
    font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
    letter-spacing: -0.01em;
}

/* ------------------------------------------------------------ */
/* navbar and footer */
/* ------------------------------------------------------------ */

/* the top bar */
.app-navbar {
    background: var(--gf-bar);
    border-bottom: 1px solid var(--gf-card);
}
/* the site name, the links and the menu button on small screens */
.app-navbar .navbar-brand { font-weight: 700; color: #FAFAFA; }
.app-navbar .brand-accent { color: var(--gf-accent); }
.app-navbar .nav-link { color: #D4D4D8; }
.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus-visible { color: #FAFAFA; }
.app-navbar .nav-link.active { color: var(--gf-accent); font-weight: 500; }
.app-navbar .navbar-toggler { border-color: var(--gf-line); }

/* the bottom bar */
.app-footer {
    background: var(--gf-bar);
    border-top: 1px solid var(--gf-card);
    color: var(--gf-muted);
}

/* ------------------------------------------------------------ */
/* cards, tables, lists */
/* ------------------------------------------------------------ */

/* panels with rounded corners on the charcoal card colour */
.card {
    --bs-card-bg: var(--gf-card);
    --bs-card-border-color: var(--gf-line);
    --bs-card-border-radius: 12px;
    --bs-card-inner-border-radius: 11px;
}
/* no shadows on the dark background */
.card.shadow-sm { box-shadow: none !important; }
/* tables and lists blend into the card behind them */
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--gf-line); }
.list-group { --bs-list-group-bg: #17171B; --bs-list-group-border-color: var(--gf-line); }

/* ------------------------------------------------------------ */
/* buttons */
/* ------------------------------------------------------------ */

/* main buttons: white text on crimson, darker when hovered and pressed */
.btn-primary {
    --bs-btn-bg: var(--gf-fill);
    --bs-btn-border-color: var(--gf-fill);
    --bs-btn-color: #FFFFFF;
    --bs-btn-hover-bg: var(--gf-fill-hover);
    --bs-btn-hover-border-color: var(--gf-fill-hover);
    --bs-btn-hover-color: #FFFFFF;
    --bs-btn-active-bg: #9F1239;
    --bs-btn-active-border-color: #9F1239;
    --bs-btn-active-color: #FFFFFF;
    --bs-btn-focus-shadow-rgb: 244, 63, 94;
    font-weight: 500;
}
/* link-style buttons */
.btn-link { --bs-btn-color: var(--gf-accent); --bs-btn-hover-color: var(--gf-accent-hover); }
/* grey outline buttons, e.g. clear and reset */
.btn-outline-secondary {
    --bs-btn-color: #D4D4D8;
    --bs-btn-border-color: #3F3F46;
    --bs-btn-hover-bg: var(--gf-line);
    --bs-btn-hover-border-color: #71717A;
    --bs-btn-hover-color: #FAFAFA;
}

/* ------------------------------------------------------------ */
/* forms */
/* ------------------------------------------------------------ */

/* inputs sit on the page colour with a crimson border when focused */
.form-control, .form-select { background-color: var(--gf-bg); border-color: #3F3F46; }
.form-control:focus, .form-select:focus { border-color: var(--gf-accent); }
/* ticked checkboxes */
.form-check-input:checked { background-color: var(--gf-fill); border-color: var(--gf-fill); }
/* the radius slider (chrome and firefox each need their own rule) */
.form-range::-webkit-slider-thumb { background: var(--gf-accent); }
.form-range::-moz-range-thumb { background: var(--gf-accent); }
.form-range::-webkit-slider-runnable-track { background: #3F3F46; }
.form-range::-moz-range-track { background: #3F3F46; }

/* ------------------------------------------------------------ */
/* leaflet map controls, popups and tooltips */
/* ------------------------------------------------------------ */

/* zoom buttons, the layer picker and the legend */
.leaflet-bar a,
.leaflet-control-layers,
.map-legend {
    background: var(--gf-card) !important;
    color: var(--gf-text) !important;
    border-color: var(--gf-line) !important;
}
.leaflet-bar a:hover { background: var(--gf-line) !important; }
.leaflet-bar a.leaflet-disabled { color: #71717A !important; }
/* the layers icon is a dark picture, so flip it to light */
.leaflet-control-layers-toggle { filter: invert(0.85); }
.leaflet-control-layers-expanded label { color: var(--gf-text); }
.map-legend-toggle { color: var(--gf-text); }
/* the openstreetmap credit in the corner */
.leaflet-control-attribution {
    background: rgba(17, 17, 20, 0.85) !important;
    color: #D4D4D8 !important;
}
.leaflet-control-attribution a { color: var(--gf-accent) !important; }
/* gym popups */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--gf-card);
    color: var(--gf-text);
    box-shadow: 0 0 0 1px var(--gf-line);
}
.leaflet-popup-content a { color: var(--gf-accent); }
.leaflet-container a.leaflet-popup-close-button { color: var(--gf-muted); }
/* hover labels, with the little arrow matching on every side */
.leaflet-tooltip {
    background: var(--gf-card);
    color: var(--gf-text);
    border-color: var(--gf-line);
}
.leaflet-tooltip-top::before { border-top-color: var(--gf-card); }
.leaflet-tooltip-bottom::before { border-bottom-color: var(--gf-card); }
.leaflet-tooltip-left::before { border-left-color: var(--gf-card); }
.leaflet-tooltip-right::before { border-right-color: var(--gf-card); }
/* a thin border round the map */
#map { border: 1px solid var(--gf-line); }

/* ------------------------------------------------------------ */
/* analytics */
/* ------------------------------------------------------------ */

/* the big numbers on the summary cards */
.stat-tile .value { color: var(--gf-accent); font-family: "Space Grotesk", "Inter", sans-serif; }
/* the bar chart bars and the grey track behind them */
.bar-track { background: var(--gf-line) !important; }
.bar-fill { background: var(--gf-fill) !important; }

/* ------------------------------------------------------------ */
/* progressive web app */
/* ------------------------------------------------------------ */

/* the "you're offline" strip that sticks to the top of the page */
.offline-banner { position: sticky; top: 0; z-index: 2000; padding: .35rem 1rem; text-align: center;
                  background: var(--gf-fill); color: #FFFFFF; font-size: .85rem; font-weight: 600; }
.offline-banner[hidden] { display: none; }
