/* Shell compatibility aliases: all UI colours come from tokens.css. */
:root {
  --shell-bg: var(--surface);
  --shell-panel: var(--surface-raised);
  --shell-side: var(--surface);
  --shell-line: var(--line);
  --shell-hairline: var(--line);
  --shell-fg: var(--ink);
  --shell-muted: var(--ink-muted);
  --shell-current: var(--surface-muted);
  --shell-hover: var(--surface-muted);
  --shell-fill: var(--surface-muted);
  --shell-dark: var(--secondary);
  --shell-on-dark: var(--on-secondary);
  --shell-avatar: var(--secondary);
  --shell-quiet-line: var(--ink-muted);
  --shell-link: var(--ink);
  --shell-orange-text: var(--ink);
  --shell-pill-close: var(--surface-muted);
  --shell-pill-close-fg: var(--ink);
  --shell-float: color-mix(in srgb, var(--surface-raised) 94%, transparent);
  /* Protected map/status colours, matching SPEC §5, build_styles.py and Theme.swift. */
  --shell-blue: #0072B2;
  --shell-orange: #D55E00;
  --shell-map: #FBFAF5;
  --shell-casing: #FFFFFF;
  --shell-countable: #A9A59C;
}
/* The side menu (2 Nov 2026, "Inkt en helder"): ink by day, the full height of the page beside a white header; at
   night it keeps the slate of the page. */
:root {
  --nav-bg: var(--secondary);
  --nav-fg: #C9CFD6;
  --nav-fg-current: #FFFFFF;
  --nav-hover: rgb(255 255 255 / .06);
  --nav-current: #34414E;
  --nav-line: #34414E;
  --nav-icon-current: var(--primary);
  --nav-badge: var(--primary);
  --nav-badge-fg: var(--on-primary);
  --nav-focus: var(--primary);
}
:root[data-theme="night"] {
  --nav-bg: var(--surface);
  --nav-fg: var(--ink);
  --nav-fg-current: var(--ink);
  --nav-hover: var(--surface-muted);
  --nav-current: var(--surface-muted);
  --nav-line: var(--line);
  --nav-icon-current: currentColor;
  --nav-badge: var(--secondary);
  --nav-badge-fg: var(--on-secondary);
  --nav-focus: var(--focus-ring);
}
:root[data-theme="night"] {
  /* Protected map colours (SPEC §5). */
  --shell-map: #161C2A;
  --shell-casing: #161C2A;
  --shell-countable: #4F6A93;
}

* { box-sizing: border-box; }
html, body.shell { margin: 0; height: 100%; }
body.shell {
  display: flex; flex-direction: column;
  background: var(--shell-bg); color: var(--shell-fg);
  font: 15px/1.5 var(--font-sans); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- Header ---------- */

.shell-top {
  flex: 0 0 60px; display: flex; align-items: center; gap: 16px; padding: 0 16px 0 20px;
  background: var(--shell-panel); border-bottom: 1px solid var(--shell-line);
}
.shell-brand, .shell-nav-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.shell-brand img, .shell-nav-brand img { width: 48px; height: 48px; border-radius: var(--radius-md); display: block; flex: 0 0 auto; }
.shell-wordmark { display: inline-grid; line-height: 1; }
/* The wordmark as in the design system: "roadmarker" in ink, ".cc" in the brand orange, ExtraBold. */
.shell-wordmark-name { font: 800 22px/1 "Plus Jakarta Sans", sans-serif; letter-spacing: -0.02em; white-space: nowrap; }
/* The name sets the width (width 0, min-width 100%); justify spreads the slogan over exactly that width. */
.shell-wordmark-slogan {
  width: 0; min-width: 100%; margin-top: 5px; font: 600 13px/1 "Plus Jakarta Sans", sans-serif; letter-spacing: 0.02em;
  text-align: justify; text-align-last: justify; color: var(--shell-muted);
}
.shell-tld { color: var(--primary); }
.shell-grow { flex: 1; }
.shell-button {
  height: 40px; padding: 0 16px; border: 0; border-radius: var(--radius-sm);
  background: var(--shell-dark); color: var(--shell-on-dark); font-weight: 600; font-size: 15px;
}
.shell-account-wrap { position: relative; }
.shell-account {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 8px 0 4px; border: 0; border-radius: var(--radius-pill);
  background: transparent; color: inherit; font-size: 15px; font-weight: 500;
}
.shell-account:hover, .shell-account[aria-expanded="true"] { background: var(--shell-hover); }
.shell-avatar {
  width: 34px; height: 34px; border-radius: 17px; display: flex; align-items: center; justify-content: center;
  background: var(--shell-avatar); color: var(--on-secondary); font-size: 14px; font-weight: 700;
}
.shell-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: 6px;
  display: flex; flex-direction: column; border-radius: var(--radius-md); background: var(--shell-panel);
  box-shadow: var(--shadow-card);
}
.shell-menu-name { padding: 8px 12px 6px; font-weight: 600; border-bottom: 1px solid var(--shell-hairline); margin-bottom: 4px; }
.shell-menu a, .shell-menu button {
  display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); background: transparent;
  color: inherit; font-size: 15px; text-align: left; text-decoration: none;
}
.shell-menu a:hover, .shell-menu button:hover { background: var(--shell-hover); }

/* ---------- Side menu and the page ---------- */

.shell-body { flex: 1; min-height: 0; display: flex; }
/* On a computer the side menu is the whole frame: wordmark, pages, then the rider and day or night at the foot. */
.shell-nav {
  position: relative; z-index: 2; flex: 0 0 264px; display: flex; flex-direction: column; gap: 4px;
  padding: 14px 12px; overflow-y: auto; background: var(--nav-bg); color: var(--nav-fg);
}
:root[data-theme="night"] .shell-nav { border-right: 1px solid var(--shell-hairline); }
@media (min-width: 761px) { body.shell:has(.shell-nav) .shell-top { display: none; } }
.shell-nav-foot { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--nav-line); }
.shell-nav-foot .shell-account-wrap { flex: 1; min-width: 0; }
.shell-nav-foot .shell-account { width: 100%; color: var(--nav-fg-current); }
.shell-nav-foot .shell-account:hover, .shell-nav-foot .shell-account[aria-expanded="true"] { background: var(--nav-hover); }
.shell-nav-foot .shell-account-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.shell-nav-foot .shell-avatar { flex: none; background: var(--nav-badge); color: var(--nav-badge-fg); }
/* By day the side menu is ink: the switch gets the beams it has at night, so it shows. */
:root:not([data-theme="night"]) .shell-nav-foot .switch { --well: rgb(0 0 0 / .45); --beam-hi: rgb(255 255 255 / .3); --beam-lo: #F8F9F9; }
/* The menu opens upwards, inside the side menu. */
.shell-nav-foot .shell-menu { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; min-width: 200px; color: var(--ink); }
.shell-nav-brand { padding: 0 4px 20px; color: var(--nav-fg-current); }
.shell-nav-brand .shell-wordmark-slogan { color: var(--nav-fg); }
.shell-nav :focus-visible { outline-color: var(--nav-focus); }
.shell-link {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-md);
  color: inherit; text-decoration: none; font-size: 15px; font-weight: 500;
}
.shell-link:hover { background: var(--nav-hover); }
.shell-link[aria-current="page"] { background: var(--nav-current); color: var(--nav-fg-current); font-weight: 700; }
.shell-link[aria-current="page"] svg { color: var(--nav-icon-current); }
.shell-link-label { flex: 1; }
.shell-badge {
  min-width: 22px; padding: 0 7px; border-radius: var(--radius-sm); background: var(--nav-badge); color: var(--nav-badge-fg);
  font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums;
}
.shell-nav-gap { height: 1px; margin: 10px 4px; background: var(--nav-line); }
.shell-nav-grow { flex: 1; min-height: 16px; }
.shell-main { flex: 1; min-width: 0; min-height: 0; }

/* A scrolling page of tiles or a table (the Pagina template). */
.shell-page { overflow-y: auto; padding: 32px 40px 56px; }
.shell-page-in { max-width: 1600px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.shell-title { margin: 0; font: 700 32px/1.1 "Plus Jakarta Sans", sans-serif; letter-spacing: -0.015em; }
.shell-sub { margin: 4px 0 0; color: var(--shell-muted); }
.shell-tile {
  display: flex; flex-direction: column; gap: 12px; padding: var(--space-6); border-radius: var(--radius-lg);
  background: var(--shell-panel); border: 0; box-shadow: var(--shadow-card);
}
.shell-tile h2 { margin: 0; font-size: 18px; }
.shell-tile p { margin: 0; }
.shell-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--shell-muted); }
.shell-cta {
  display: flex; align-items: center; justify-content: center; height: 44px; margin-top: auto; padding: 0 16px;
  border-radius: var(--radius-sm); background: var(--shell-dark); color: var(--shell-on-dark); font-weight: 600; text-decoration: none;
}
.shell-cta.quiet { background: transparent; color: inherit; border: 1px solid var(--shell-quiet-line); }
.shell-link-more { margin-top: auto; font-weight: 600; color: inherit; }
.shell-muted { color: var(--shell-muted); }

/* On a phone the menu becomes a row under the header; the signed-in site is made for a computer. */
@media (max-width: 760px) {
  .shell-body { flex-direction: column; }
  .shell-nav { flex: 0 0 auto; margin-top: 0; flex-direction: row; gap: 4px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; border-right: 0; border-bottom: 1px solid var(--shell-hairline); }
  :root[data-theme="night"] .shell-nav { border-right: 0; }
  .shell-nav-gap, .shell-nav-grow, .shell-nav-brand, .shell-nav-foot { display: none; }
  .shell-link { flex-shrink: 0; }
  .shell-account-name { display: none; }
  .shell-page { padding: 24px 16px 48px; }
}

/* MapLibre's own buttons and credits at night. */
[data-theme="night"] .maplibregl-ctrl-group { background: var(--shell-panel); box-shadow: 0 0 0 1px var(--shell-line); }
[data-theme="night"] .maplibregl-ctrl-group button + button { border-top-color: var(--shell-line); }
[data-theme="night"] .maplibregl-ctrl-group button span { filter: invert(0.9); }
[data-theme="night"] .maplibregl-ctrl-attrib, [data-theme="night"] .maplibregl-ctrl-attrib.maplibregl-compact { background: var(--shell-float); color: var(--shell-muted); }
[data-theme="night"] .maplibregl-ctrl-attrib a { color: var(--shell-muted); }
[data-theme="night"] .maplibregl-ctrl-attrib-button { filter: invert(0.9); }

/* Quick search above a list (Kaart, Importeren): filters on the names of rides, routes and folders as you type. */
.quick-search {
  display: block; width: 100%; box-sizing: border-box; height: 36px; margin-top: 12px; padding: 0 var(--space-3);
  border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--shell-fg); font: inherit; font-size: 14px;
  background: var(--surface-muted);
}
.quick-search:focus { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.quick-search[hidden] { display: none; }

/* A percentage of a gemeente, provincie or the country (docs/gebieden.md): the name and the number, a bar of ridden
   road under it. On the Gebieden tile of Overzicht and the Gebieden tab of Kaart. */
.area { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.area-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.area-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-pct { font-weight: 700; font-variant-numeric: tabular-nums; }
.area-meta { font-size: 12.5px; color: var(--shell-muted); font-variant-numeric: tabular-nums; }
.area-bar { display: block; height: 6px; border-radius: var(--radius-pill); background: var(--surface-muted); overflow: hidden; }
.area-bar span { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--shell-orange); }
.area-link { display: block; margin: 0 -10px; padding: 6px 10px; border-radius: var(--radius-sm); color: inherit; text-decoration: none; }
.area-link:hover, .area-link:focus-visible { background: var(--shell-hover); }
.area-link:hover .area-name { text-decoration: underline; }

.quick-search:hover { border-color: var(--ink-muted); }
.quick-search:focus { border-color: var(--ink); }
