/* Shared tokens, fonts, and layout for every page of bolling.dev. */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/plex-sans-var.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #fcfbf8;
  --surface-2: #efece5;
  --ink: #16181b;
  --ink-2: #47494d;
  --ink-3: #66686c;
  --line: #dcd8cf;
  --line-strong: #c3beb2;
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --accent-soft: #e3edfb;
  --focus: #2a78d6;

  /* Chart roles (dataviz reference palette, light steps). */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --grid-line: #e6e2d9;

  /* Sequential blue ramp for knowledge grids, low to high. */
  --ramp-0: #fcfbf8;
  --ramp-1: #cde2fb;
  --ramp-2: #86b6ef;
  --ramp-3: #3987e5;
  --ramp-4: #1c5cab;
  --ramp-5: #0d366b;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 10px;
  --radius-s: 6px;
  --gutter: 16px;
  --shadow: 0 1px 2px rgb(20 20 20 / 0.05), 0 4px 16px rgb(20 20 20 / 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121313;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --ink-3: #a3a297;
    --line: #33332f;
    --line-strong: #4a4a44;
    --accent: #86b6ef;
    --accent-ink: #0d1520;
    --accent-soft: #1b2a3d;
    --focus: #6da7ec;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --grid-line: #2a2a27;
    --ramp-0: #1a1a19;
    --ramp-1: #184f95;
    --ramp-2: #2a78d6;
    --ramp-3: #5598e7;
    --ramp-4: #9ec5f4;
    --ramp-5: #e3effd;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.2);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121313;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --ink-3: #a3a297;
  --line: #33332f;
  --line-strong: #4a4a44;
  --accent: #86b6ef;
  --accent-ink: #0d1520;
  --accent-soft: #1b2a3d;
  --focus: #6da7ec;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --grid-line: #2a2a27;
  --ramp-0: #1a1a19;
  --ramp-1: #184f95;
  --ramp-2: #2a78d6;
  --ramp-3: #5598e7;
  --ramp-4: #9ec5f4;
  --ramp-5: #e3effd;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.2);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "ss02";
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 560;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
p {
  margin: 0 0 1em;
  text-wrap: pretty;
}
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
code,
kbd,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
kbd {
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 0.35em;
  background: var(--surface);
}
[hidden] {
  display: none !important;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: var(--radius-s);
  z-index: 100;
}
.skip-link:focus {
  top: 8px;
}

.wrap {
  width: min(1080px, 100% - 2 * var(--gutter));
  margin-inline: auto;
}
.wrap-wide {
  width: min(1320px, 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
}
.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
}
.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 6px 10px;
  border-radius: var(--radius-s);
  white-space: nowrap;
}
.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface-2);
}
.nav a.nav-play {
  color: var(--accent);
  font-weight: 500;
}
.theme-toggle {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.theme-toggle .icon-moon {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}
:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-moon {
    display: block;
  }
  :root:not([data-theme]) .theme-toggle .icon-sun {
    display: none;
  }
}
@media (max-width: 640px) {
  .brand-name {
    display: none;
  }
  .nav a {
    padding: 6px 7px;
    font-size: 0.88rem;
  }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.btn:hover {
  border-color: var(--ink-3);
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  border-color: var(--ink);
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-small {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  margin-top: 96px;
  border-top: 1px solid var(--line);
  padding: 32px 0 48px;
  color: var(--ink-3);
  font-size: 0.9rem;
}
.site-footer .bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
}
.site-footer a {
  color: var(--ink-2);
}
