/* The look every page on the site shares: colors, type, the site bar with its theme switch,
   and segmented pickers. Each page keeps its own data colors (parties, gains and losses) and layout.
   data-theme is set before the page draws, by /shared/theme.js in <head>. */

:root {
  color-scheme: light;
  --bg: #fafaf9;
  --fg: #1c1917;
  --secondary: #44403c;
  --muted: #78716c;
  --rule: #e7e5e4;
  --card: #ffffff;
  --hover: #f3f2f0;
  --accent: #3b48c9;    /* blueprint indigo: links, focus rings, the sorted column */
  --on-accent: #ffffff;

  /* Two faces: Inter for everything read, IBM Plex Mono for numbers in tables and small uppercase labels. */
  --sans: Inter, "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0a09;
  --fg: #f5f5f4;
  --secondary: #d6d3d1;
  --muted: #a8a29e;
  --rule: #292524;
  --card: #161413;
  --hover: #1c1a18;
  --accent: #8d97ff;
  --on-accent: #0c0a09;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
}
/* Inter's optical sizes (opsz) give big headlines its tighter display cut. */
h1 {
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
/* Section labels: small mono capitals. */
.label {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- site bar: the theme switch, at the right ----------------------------- */
.site-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.site-bar .theme { margin-left: auto; }
/* A link home with the mark, on no page yet. To show it, start the site bar with
   <a class="home" href="https://liamlangert.com/"><span class="mark" aria-hidden="true"></span>Liam Langert</a> */
.site-bar .home {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--secondary);
  text-decoration: none;
}
.site-bar .home:hover { color: var(--fg); }
.site-bar .mark {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  background: var(--fg);
}
/* The two linked L's (/shared/mark.svg), cut out of the square in the page's color. */
.site-bar .mark::before {
  content: "";
  width: 100%;
  height: 100%;
  background: var(--bg);
  -webkit-mask: url(/shared/mark.svg) center / contain no-repeat;
  mask: url(/shared/mark.svg) center / contain no-repeat;
}

/* System / light / dark: three icons on a track, a thumb that slides to the pick. */
.theme {
  position: relative;
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 3px;
}
.theme .thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 32px;
  height: 31px;
  border-radius: 7px;
  background: var(--rule);
  transition: transform 0.2s ease;
}
:root[data-theme-pick="light"] .theme .thumb { transform: translateX(32px); }
:root[data-theme-pick="dark"] .theme .thumb { transform: translateX(64px); }
.theme label {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 31px;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
}
.theme label:hover, .theme label:has(:checked) { color: var(--fg); }
.theme label:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.theme input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.theme svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (prefers-reduced-motion: reduce) { .theme .thumb { transition: none; } }

/* ---- segmented pickers: radio labels or buttons, the pick inked solid ------ */
.seg {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 3px;
  font-family: var(--sans);
}
.seg label, .seg button {
  position: relative;
  border: 0;
  background: none;
  padding: 0.4375rem 1.125rem;
  border-radius: 7px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.seg label:hover, .seg button:hover { color: var(--fg); }
.seg label:has(:checked), .seg button.on { background: var(--fg); color: var(--bg); }
.seg label:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
