/* Shared design tokens + theme toggle. Dark is the default; light via [data-theme="light"]. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b14;
  --surface: #0e1522;
  --surface-2: #131c2c;
  --hover: rgba(255, 255, 255, .045);
  --text: #f2f5fb;
  --muted: #9aa9bf;
  --dim: #71829b;
  --line: rgba(130, 150, 182, .2);
  --accent: #35c6a3;
  --accent-hover: #67d9b7;
  --accent-ink: #06130f;
  --accent-text: #35c6a3;
  --accent-soft: rgba(53, 198, 163, .1);
  --violet: #9a90ff;
  --violet-soft: rgba(143, 132, 255, .1);
  --amber: #e3b341;
  --grad-a: #fff1d6;
  --grad-b: #d9ccff;
  --header-bg: rgba(7, 11, 20, .72);
  --glow-a: rgba(53, 198, 163, .14);
  --glow-b: rgba(102, 87, 217, .24);
  --grid: rgba(130, 150, 182, .08);
  --shadow: 0 30px 70px rgba(0, 0, 0, .4);
  --code-bg: #05070d;
  --code-text: #dfe6f0;
}
:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f9;
  --hover: rgba(15, 30, 60, .045);
  --text: #0b1220;
  --muted: #45546b;
  --dim: #66758c;
  --line: rgba(20, 35, 64, .13);
  --accent: #14b08e;
  --accent-hover: #0f9a7b;
  --accent-ink: #03201a;
  --accent-text: #08785f;
  --accent-soft: rgba(20, 176, 142, .1);
  --violet: #5a49d6;
  --violet-soft: rgba(90, 73, 214, .08);
  --amber: #b7791f;
  --grad-a: #5a49d6;
  --grad-b: #0a8a6d;
  --header-bg: rgba(245, 247, 251, .78);
  --glow-a: rgba(20, 176, 142, .16);
  --glow-b: rgba(90, 73, 214, .16);
  --grid: rgba(20, 35, 64, .07);
  --shadow: 0 24px 60px rgba(30, 45, 80, .13);
  --code-bg: #0b1220;
  --code-text: #dfe6f0;
}

body { background: var(--bg); color: var(--text); transition: background .25s ease, color .25s ease; }

/* logo swap: two <img>s, one per theme */
html[data-theme="dark"] img.logo-dark { display: block !important; }
html:not([data-theme="dark"]) img.logo-dark { display: none !important; }
html[data-theme="dark"] img.logo-light { display: none !important; }

.theme-toggle { display: inline-grid; width: 38px; height: 38px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.theme-toggle:hover { background: var(--hover); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .i-moon { display: none; }
html:not([data-theme="dark"]) .theme-toggle .i-sun { display: none; }
html:not([data-theme="dark"]) .theme-toggle .i-moon { display: block; }

/* shared footer */
.rg-footer { margin-top: 40px; border-top: 1px solid var(--line); background: linear-gradient(180deg, transparent, var(--surface-2)); color: var(--muted); }
.rg-footer-inner { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: 56px; width: min(1120px, calc(100% - 60px)); margin: 0 auto; padding: 56px 0 44px; }
.rg-foot-brand .brand { display: inline-flex; margin-bottom: 18px; }
.rg-foot-brand .brand img { width: 112px; height: auto; }
.rg-foot-brand p { max-width: 300px; margin: 0 0 22px; font-size: 14px; line-height: 1.7; }
.rg-foot-cta { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; transition: border-color .18s ease, transform .18s ease; }
.rg-foot-cta:hover { border-color: var(--accent); transform: translateY(-2px); }
.rg-foot-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.rg-foot-cols h4 { margin: 0 0 16px; color: var(--text); font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; }
.rg-foot-cols a { display: block; padding: 5px 0; color: var(--muted); font-size: 14px; transition: color .15s ease, transform .15s ease; }
.rg-foot-cols a:hover { color: var(--accent-text); transform: translateX(2px); }
.rg-footer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; width: min(1120px, calc(100% - 60px)); margin: 0 auto; padding: 20px 0 28px; border-top: 1px solid var(--line); color: var(--dim); font-size: 13px; }
.rg-footer-bar .rg-top { color: var(--muted); }
.rg-footer-bar .rg-top:hover { color: var(--accent-text); }
@media (max-width: 860px) {
  .rg-footer-inner { grid-template-columns: 1fr; gap: 36px; padding: 44px 0 32px; }
}
@media (max-width: 560px) {
  .rg-footer-inner, .rg-footer-bar { width: calc(100% - 40px); }
  .rg-foot-cols { grid-template-columns: 1fr 1fr; gap: 28px 20px; }
  .rg-foot-cols > div:first-child { grid-column: 1 / -1; }
  .rg-footer-bar { flex-direction: column; align-items: flex-start; }
}
