/* Programmer Corner design tokens.
   Dark is the primary designed identity (a warm, lived-in "desk corner at
   night" feel — not a copy of GitHub's cool blue-black dark theme); light
   is a clean, utilitarian alternate, the way most dev tools treat their
   light theme as the secondary option. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-variable.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-variable.woff2") format("woff2");
}

:root {
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Signature RGB channel triad — used only for the conversion scan-line animation. */
  --chan-r: #e8695c;
  --chan-g: #5fd068;
  --chan-b: #5b9de0;

  /* Dark palette (default identity) */
  --bg: #16140f;
  --surface: #1e1a13;
  --surface-raised: #29241a;
  --border: #3d3524;
  --text: #f2ecdd;
  --text-muted: #a99c82;
  --accent: #5fd068;
  --accent-strong: #7fe888;
  --accent-contrast: #0d1a0e;
  --danger: #e8695c;
  --danger-bg: #2e1c17;
  --link: #7fc4e8;
}

:root[data-bs-theme="light"] {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-raised: #eef0f2;
  --border: #dcdfe3;
  --text: #1b1f23;
  --text-muted: #5c6570;
  --accent: #1e8e3e;
  --accent-strong: #197a35;
  --accent-contrast: #ffffff;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --link: #0969da;
}

@media (prefers-color-scheme: light) {
  :root:not([data-bs-theme="dark"]) {
    --bg: #f5f6f7;
    --surface: #ffffff;
    --surface-raised: #eef0f2;
    --border: #dcdfe3;
    --text: #1b1f23;
    --text-muted: #5c6570;
    --accent: #1e8e3e;
    --accent-strong: #197a35;
    --accent-contrast: #ffffff;
    --danger: #b3261e;
    --danger-bg: #fbe9e7;
    --link: #0969da;
  }
}

/* Remap Bootstrap's own root-level theme variables. Verified against the
   compiled bootstrap.min.css: .form-control/.form-select/.text-muted/
   .text-danger genuinely reference these live, so overriding them here is
   enough for those. .btn-* variants are NOT live references — Bootstrap
   bakes hardcoded per-component --bs-btn-* values into each class at build
   time, so those need direct overrides below instead. */
:root {
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--text-muted);
  --bs-border-color: var(--border);
  --bs-danger-rgb: 232, 105, 92;
  --bs-link-color: var(--link);
  --bs-link-hover-color: var(--accent-strong);
  --bs-font-sans-serif: var(--font-body);
  --bs-table-color: var(--text);
  --bs-table-bg: var(--surface);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--surface-raised);
}

.btn-primary {
  --bs-btn-color: var(--accent-contrast);
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: var(--accent-contrast);
  --bs-btn-hover-bg: var(--accent-strong);
  --bs-btn-hover-border-color: var(--accent-strong);
  --bs-btn-active-color: var(--accent-contrast);
  --bs-btn-active-bg: var(--accent-strong);
  --bs-btn-active-border-color: var(--accent-strong);
  --bs-btn-disabled-bg: var(--accent);
  --bs-btn-disabled-border-color: var(--accent);
}

.btn-success {
  --bs-btn-color: var(--accent-contrast);
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: var(--accent-contrast);
  --bs-btn-hover-bg: var(--accent-strong);
  --bs-btn-hover-border-color: var(--accent-strong);
  --bs-btn-active-color: var(--accent-contrast);
  --bs-btn-active-bg: var(--accent-strong);
  --bs-btn-active-border-color: var(--accent-strong);
}

.form-range::-webkit-slider-thumb {
  background-color: var(--accent);
}

.form-range::-moz-range-thumb {
  background-color: var(--accent);
}

.btn-outline-secondary {
  --bs-btn-color: var(--text-muted);
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-color: var(--text);
  --bs-btn-hover-bg: var(--surface-raised);
  --bs-btn-hover-border-color: var(--border);
  --bs-btn-active-color: var(--text);
  --bs-btn-active-bg: var(--surface-raised);
  --bs-btn-active-border-color: var(--border);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  transition: background-color 0.15s ease, color 0.15s ease;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

code, .mono {
  font-family: var(--font-mono);
}

a {
  color: var(--link);
}

::selection {
  background-color: var(--accent);
  color: var(--accent-contrast);
}
