/* Routrix Accounts. Tokens copied from routrix.tech (site/index.html): light is
   the base, dark is an opt-in toggle. theme.js sets data-theme before first
   paint; with JavaScript off the prefers-color-scheme block below applies.
   Layout is fluid: gutters in %, type and spacing in rem, breakpoints in em. */

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

:root {
  --paper: #f7f6f2;
  --paper-2: #efede7;
  --ink: #1b1f24;
  --ink-2: #3d434b;
  --muted: #5d636c;
  --rule: rgb(67 53 22 / 0.15);
  --rule-soft: rgb(67 53 22 / 0.09);
  --blue: #0068ef;
  --blue-ink: #0055c4;
  --blue-wash: #e6eefb;
  --hk-paper: #f3f0eb;
  --hk-ink: #1e1a16;
  --hk-muted: #5e554b;
  --hk-amber: #ff9f43;
  --hk-rule: rgb(130 100 55 / 0.15);
  --card: #fbfaf7;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --gutter: 5%;
  --header-bg: rgba(247, 246, 242, 0.94);
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121417;
  --paper-2: #1b1e22;
  --ink: #e8eaed;
  --ink-2: #c3c8cf;
  --muted: #9aa1aa;
  --rule: rgb(198 220 243 / 0.15);
  --rule-soft: rgb(198 220 243 / 0.095);
  --blue: #1f6feb;
  --blue-ink: #79b3ff;
  --blue-wash: #14243d;
  --hk-paper: #1d1c1a;
  --hk-ink: #f3f0eb;
  --hk-muted: #a39c93;
  --hk-rule: rgb(222 208 199 / 0.15);
  --card: #171a1e;
  --header-bg: rgba(18, 20, 23, 0.92);
}

/* No JavaScript: follow the system setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #121417;
    --paper-2: #1b1e22;
    --ink: #e8eaed;
    --ink-2: #c3c8cf;
    --muted: #9aa1aa;
    --rule: rgb(198 220 243 / 0.15);
    --rule-soft: rgb(198 220 243 / 0.095);
    --blue: #1f6feb;
    --blue-ink: #79b3ff;
    --blue-wash: #14243d;
    --hk-paper: #1d1c1a;
    --hk-ink: #f3f0eb;
    --hk-muted: #a39c93;
    --hk-rule: rgb(222 208 199 / 0.15);
    --card: #171a1e;
    --header-bg: rgba(18, 20, 23, 0.92);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.062rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
main { flex: 1 0 auto; }

a { color: var(--blue-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--blue-ink); outline-offset: 3px; border-radius: 3px; }

.skip {
  position: absolute; left: 1rem; top: -3.75rem; background: var(--ink); color: var(--paper);
  padding: 0.625rem 0.875rem; border-radius: 0.375rem; z-index: 100; font-size: 0.9375rem;
}
.skip:focus { top: 0.75rem; }

.wrap { max-width: none; margin: 0; padding: 0 var(--gutter); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--header-bg);
  border-bottom: 1px solid var(--rule); background-clip: padding-box;
}
@supports (backdrop-filter: blur(0.375rem)) {
  .site-header { backdrop-filter: saturate(1.2) blur(0.375rem); }
}
.site-header .wrap { display: flex; align-items: center; gap: 2rem; height: 4.25rem; }
.logo {
  display: inline-flex; align-items: center; gap: 0.6875rem;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.125rem;
  letter-spacing: -0.01em; white-space: nowrap; margin-right: auto;
}
.logo img { width: 1.875rem; height: auto; display: block; }
@media (max-width: 30em) { .logo-rest { display: none; } }

/* ---------- document ---------- */
.doc { padding-top: 4rem; padding-bottom: 4rem; max-width: 100%; }
.doc > * { max-width: 46rem; }
.doc h1 {
  font-size: clamp(1.9rem, 1.2rem + 3vw, 2.9rem);
  line-height: 1.12; letter-spacing: -0.02em; margin: 1.25rem 0 1.25rem; font-weight: 600;
}
.doc p { margin: 0 0 1rem; color: var(--ink-2); font-size: 1.1875rem; }
.doc .lede { color: var(--ink); }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; font-family: var(--mono); font-size: 0.9375rem; color: var(--muted); }
.tag {
  display: inline-block; font-family: var(--mono); font-size: 0.8125rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 0.25rem 0.625rem; border-radius: 999px;
}
.tag-soon { background: var(--hk-amber); color: var(--hk-ink); }
:root[data-theme="dark"] .tag-soon { color: #1f1206; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .tag-soon { color: #1f1206; } }

.links { list-style: none; padding: 0; margin: 1.75rem 0 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 500; font-size: 1rem; line-height: 1; padding: 0.75rem 1.125rem; border-radius: 0.4375rem;
  text-decoration: none; border: 1px solid var(--rule); color: var(--ink); background: transparent;
  transition: border-color .15s ease, transform .1s ease-out;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: scale(0.97); }

.env-note {
  margin-top: 2rem; padding: 0.75rem 1rem; border: 1px dashed var(--rule); border-radius: 0.5rem;
  font-family: var(--mono); font-size: 0.9375rem; color: var(--muted); background: var(--paper-2);
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: 1.5rem 0 2rem; }
.site-footer p { margin: 0; font-size: 0.9375rem; color: var(--muted); }

/* ---------- light/dark pill ---------- */
.theme-pill {
  position: relative; flex: none; display: inline-flex; align-items: center;
  padding: 0.25rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper-2); background-clip: padding-box;
  transition: border-color .15s ease;
}
.theme-pill:hover { border-color: var(--ink-2); }
.tp-opt {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: center;
  width: 2.375rem; height: 2.375rem; border-radius: 50%; color: var(--muted); transition: color .2s ease;
}
.tp-opt svg { width: 1.35rem; height: 1.35rem; display: block; }
.tp-thumb {
  position: absolute; top: 0.25rem; left: 0.25rem; width: 2.375rem; height: 2.375rem; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 0 0 1px rgba(0, 0, 0, .04);
  transition: transform .25s ease-in-out, width .15s ease-out, background-color .25s ease;
}
@media (prefers-reduced-motion: no-preference) {
  .theme-pill:active .tp-thumb { width: 2.66rem; }
  :root[data-theme="dark"] .theme-pill:active .tp-thumb { transform: translateX(2.09rem); }
}
:root:not([data-theme="dark"]) .tp-sun { color: #b45309; }
:root[data-theme="dark"] .tp-moon { color: #9cc4ff; }
:root[data-theme="dark"] .tp-thumb { transform: translateX(2.375rem); background: #2c3138; box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
@media (max-width: 35em) {
  .site-header .wrap { gap: 0.625rem; }
  .tp-opt, .tp-thumb { width: 2rem; height: 2rem; }
  :root[data-theme="dark"] .tp-thumb { transform: translateX(2rem); }
  .theme-pill:active .tp-thumb { width: 2.24rem; }
  :root[data-theme="dark"] .theme-pill:active .tp-thumb { transform: translateX(1.76rem); }
}
@media (prefers-reduced-motion: reduce) { .tp-thumb, .tp-opt { transition: none; } }
/* The toggle needs JavaScript; hide it when there is none. */
@media (scripting: none) { .theme-pill { display: none; } }
