/* Warmer design system: tokens, fonts, base elements, nav, buttons, footer. */

@font-face {
  font-family: "Outfit";
  src: url("/fonts/outfit.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Light site */
  --bg: #f6f6fa;
  --surface: #ffffff;
  --surface-2: #efeff6;
  --ink: #16152b;
  --ink-2: #47465f;
  --ink-3: #636280;
  --line: #e2e2ec;
  --line-strong: #cdcddb;

  /* Brand */
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-ink: #3730a3;
  --brand-soft: #eef0ff;
  --on-brand: #ffffff;

  /* Meaning */
  --hot: #e8590c;
  --cold: #1c7ed6;
  --good: #1e7b45;
  --good-soft: #e5f5eb;
  --warn: #8f5300;
  --warn-soft: #fff3d6;
  --bad: #b4232a;
  --bad-soft: #fde7e7;

  /* Dark workspace (code editor) */
  --ws: #12131f;
  --ws-2: #1a1c2b;
  --ws-3: #23263a;
  --ws-line: #2c2f47;
  --ws-ink: #ececf6;
  --ws-ink-2: #a7a9c2;
  --ws-brand: #a5b4fc;

  --font-display: "Outfit", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 2px rgb(22 21 43 / 6%), 0 1px 1px rgb(22 21 43 / 4%);
  --shadow-2: 0 18px 40px -18px rgb(22 21 43 / 28%), 0 2px 6px rgb(22 21 43 / 6%);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Theme-dependent helpers */
  --nav-bg: rgb(255 255 255 / 90%);
  --meter-mid: #e4e0ee;
  --brand-muted: #b9bdf4;
  --code-bg: #f4f4f9;
  --accent-text: #4f46e5;
}

/* Dark theme. theme.js sets data-theme on <html> before first paint. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0e0f16;
  --surface: #161722;
  --surface-2: #1e202e;
  --ink: #ececf6;
  --ink-2: #b9bacd;
  --ink-3: #9596ad;
  --line: #272938;
  --line-strong: #3a3c52;

  --brand: #5b55ea;
  --brand-hover: #6d68f0;
  --brand-ink: #a9b3fd;
  --brand-soft: #22234a;
  --on-brand: #ffffff;

  --hot: #ff7a3d;
  --cold: #4aa3f0;
  --good: #4ade80;
  --good-soft: #13301f;
  --warn: #fbbf24;
  --warn-soft: #362a0c;
  --bad: #f87171;
  --bad-soft: #3a191c;

  --ws: #0a0b12;
  --ws-2: #11121c;
  --ws-3: #1b1d2b;
  --ws-line: #252739;

  --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-2: 0 18px 44px -18px rgb(0 0 0 / 70%), 0 2px 6px rgb(0 0 0 / 30%);

  --nav-bg: rgb(14 15 22 / 86%);
  --meter-mid: #3b3d55;
  --brand-muted: #3f4380;
  --code-bg: #11121c;
  --accent-text: #8f8cf8;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
a {
  color: var(--brand-ink);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
select,
summary {
  touch-action: manipulation;
}
button,
summary,
select {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
}
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}
code,
kbd,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
/* Show != and == as typed, not as ≠ or joined glyphs. !important because
   the font shorthand used by component rules resets feature settings. */
code,
kbd,
pre,
samp {
  font-feature-settings: "liga" 0, "calt" 0 !important;
}
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.4em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8em;
  line-height: 1.6;
  text-align: center;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  z-index: 100;
  left: 16px;
  top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  transform: translateY(-160%);
}
.skip-link:focus {
  transform: none;
}
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* Navigation */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--nav-bg);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-nav-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: 1240px;
  min-height: 64px;
  margin: auto;
  padding: 0 24px;
}
.site-nav.wide .site-nav-inner {
  max-width: 1720px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font: 700 19px/1 var(--font-display);
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--brand);
  color: var(--on-brand);
  font: 800 18px/1 var(--font-display);
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / 18%);
}
.nav-links {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.nav-links a[aria-current="page"] {
  color: var(--brand-ink);
  background: var(--brand-soft);
}
.nav-end {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
}
.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}
.status-pill.connected::before {
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-soft);
}
.status-pill.offline::before {
  background: var(--bad);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
}
.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 20%), var(--shadow-1);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--ink-3);
}
.btn-lg {
  min-height: 52px;
  padding: 0 24px;
  font-size: 16px;
}
.text-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand-ink);
  font-weight: 600;
  font-size: 14px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.text-button:hover {
  color: var(--brand-hover);
}

/* Cards and badges */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-easy,
.difficulty-easy {
  color: var(--good);
  background: var(--good-soft);
}
.badge-medium,
.difficulty-medium {
  color: var(--warn);
  background: var(--warn-soft);
}
.badge-hard,
.difficulty-hard {
  color: var(--bad);
  background: var(--bad-soft);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  max-width: 1240px;
  margin: auto;
  padding: 28px 24px;
  color: var(--ink-3);
  font-size: 14px;
}
.site-footer.wide .site-footer-inner {
  max-width: 1720px;
}
.site-footer a {
  color: var(--ink-2);
  font-weight: 500;
}
.site-footer nav {
  display: flex;
  gap: 20px;
}

@media (max-width: 720px) {
  .site-nav-inner {
    gap: 12px;
    padding: 0 16px;
  }
  .nav-links a {
    padding: 0 8px;
    font-size: 14px;
  }
  .nav-end .btn {
    display: none;
  }
  /* Keep only the colored dot on phones; the text stays for screen readers. */
  .status-pill {
    gap: 0;
    padding: 0 11px;
    font-size: 0;
  }
}
@media (max-width: 420px) {
  .brand-name {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Focus rings need a lighter color to stay visible on dark workspaces. */
.editor-panel :focus-visible,
.step-sample:focus-visible {
  outline-color: var(--ws-brand);
}

/* Theme toggle */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-toggle:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.theme-toggle .icon {
  width: 18px;
  height: 18px;
}
.theme-toggle .icon-sun,
[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}
[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}
/* Screenshots come in a light and a dark version. */
[data-theme="dark"] .shot-light,
:root:not([data-theme="dark"]) .shot-dark {
  display: none;
}

/* Legal pages (Terms, Privacy) */
.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 72px;
  color: var(--ink-2);
  line-height: 1.65;
}
.legal h1 {
  margin: 0 0 4px;
  color: var(--ink);
}
.legal h2 {
  margin: 32px 0 8px;
  color: var(--ink);
  font-size: 20px;
}
.legal-updated {
  margin: 0 0 24px;
  color: var(--ink-3);
  font-size: 14px;
}
.legal ul {
  padding-left: 22px;
}
.legal li {
  margin: 6px 0;
}
.legal a {
  text-decoration: underline;
}
