/* Router — "Signal" design system, mirrored from app/src/main/java/com/drey/router/ui/theme/Color.kt.
   Thick outlines and hard shadows in "ink": dark ink on paper in light mode, cream on night in dark
   mode, exactly as the app does. Fonts are self-hosted so every platform renders the same.
   Translucent ink is written as rgba(var(--ink-rgb), a) rather than color-mix() so iOS 15 and other
   older engines draw the same hairlines. */

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800; font-display: swap;
}

:root {
  --bg: #fff4e0;
  --bg-rgb: 255, 244, 224;
  --surface: #ffffff;
  --surface-2: #fbebd0;
  --text: #14121a;
  --text-2: #4a4452;
  --ink: #14121a;            /* outlines + hard shadows */
  --ink-rgb: 20, 18, 26;
  --link: #5b3df0;
  --code-bg: rgba(124, 92, 255, .12);
  --violet: #7c5cff;
  --button: #6e50f5;         /* violet darkened just enough for 5:1 white text */
  --lime: #c8f560;
  --sun: #ffd23f;
  --sky: #8fd3ff;
  --mint: #7de3c3;
  --pink: #ffa8d5;
  --on-accent: #14121a;
  --on-accent-2: #2c2733;

  --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bw: 2.5px;               /* outline width */
  --sh: 4px;                 /* hard shadow offset */
  --radius: 16px;
  --gutter: 16px;
  --section: 56px;
  --header: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15121c;
    --bg-rgb: 21, 18, 28;
    --surface: #221d2b;
    --surface-2: #2d2738;
    --text: #f6eedd;
    --text-2: #c7bfd3;
    --ink: #f6eedd;
    --ink-rgb: 246, 238, 221;
    --link: #b9a8ff;
    --code-bg: rgba(185, 168, 255, .14);
    color-scheme: dark;
  }
}

@media (min-width: 720px) {
  :root { --bw: 3px; --sh: 5px; --gutter: 24px; --section: 88px; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
@media (min-width: 720px) { body { font-size: 17px; } }
/* Keep the footer at the bottom of short pages (404) on tall screens. */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }

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

h1, h2, h3 { font-family: var(--display); color: var(--text); text-wrap: balance; margin: 0; line-height: 1.15; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1.5px; -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 6px; }
code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); padding: .1em .4em; border-radius: 6px; white-space: nowrap; }
img, svg { max-width: 100%; }
img { display: block; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }

.tag { font: 600 11.5px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); }
.tag.dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); border: 1.5px solid var(--ink); margin-right: 8px; vertical-align: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid rgba(var(--ink-rgb), .14);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header {
    background: rgba(var(--bg-rgb), .94);
    -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  }
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; min-height: var(--header); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: inherit; text-decoration: none; font: 700 20px/1 var(--display); letter-spacing: -.01em; margin-right: auto; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.site-nav { display: none; gap: 2px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: none; font: 600 14px/1 var(--sans); padding: 0 12px; border-radius: 10px; }
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { background: var(--surface-2); }
@media (min-width: 760px) { .site-nav { display: flex; } }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--button); --btn-fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: var(--bw) solid var(--ink); border-radius: 14px;
  box-shadow: var(--sh) var(--sh) 0 var(--ink);
  font: 700 17px/1 var(--display); letter-spacing: -.005em; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: calc(var(--sh) + 1px) calc(var(--sh) + 1px) 0 var(--ink); }
.btn:active { transform: translate(var(--sh), var(--sh)); box-shadow: 0 0 0 var(--ink); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.ghost { --btn-bg: var(--surface); --btn-fg: var(--text); }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 15px; border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); }
.btn.small:active { transform: translate(3px, 3px); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

.actions { display: flex; flex-direction: column; gap: 14px; }
.actions .btn { width: 100%; }
@media (min-width: 560px) {
  .actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .actions .btn { width: auto; }
}

/* ---------- Hero ---------- */
.hero { padding: 28px 0 8px; }
.hero-grid { display: grid; gap: 32px; align-items: center; }
.hero h1 { font-size: clamp(38px, 10.5vw, 72px); line-height: .98; letter-spacing: -.035em; font-weight: 700; margin: 14px 0 16px; }
.hero .lede { font-size: clamp(17px, 2.1vw, 20px); line-height: 1.55; color: var(--text-2); margin: 0 0 26px; max-width: 34em; }
.hero .meta { font: 500 12.5px/1.5 var(--mono); color: var(--text-2); margin: 14px 0 0; }

.status {
  background: var(--surface); border: var(--bw) solid var(--ink); border-radius: 20px;
  box-shadow: var(--sh) var(--sh) 0 var(--ink);
  padding: 16px; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center;
}
.orb {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--lime); border: var(--bw) solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  display: grid; place-items: center; color: var(--on-accent);
}
.orb svg { width: 34px; height: 34px; }
.status .tag { display: block; margin-bottom: 6px; }
.status .state { font: 700 20px/1.1 var(--display); margin-bottom: 8px; }
.routes { list-style: none; margin: 0; padding: 0; font: 500 12.5px/1.7 var(--mono); color: var(--text-2); }
.routes b { color: var(--text); font-weight: 600; }

@media (min-width: 720px) {
  .hero { padding-top: 48px; }
  .hero-grid { grid-template-columns: 1.3fr 1fr; gap: 40px; }
  .hero h1 { font-size: clamp(44px, 6.4vw, 72px); }
  .status { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 28px 20px; gap: 18px; border-radius: 24px; }
  .orb { width: 120px; height: 120px; box-shadow: var(--sh) var(--sh) 0 var(--ink); }
  .orb svg { width: 50px; height: 50px; }
}
@media (min-width: 1024px) {
  .hero { padding-top: 64px; }
  .hero-grid { gap: 56px; }
  .status { padding: 32px 28px; gap: 20px; }
  .orb { width: 160px; height: 160px; }
  .orb svg { width: 64px; height: 64px; }
  .status .state { font-size: 24px; }
  .routes { font-size: 13.5px; }
}

/* ---------- Sections ---------- */
section { padding: var(--section) 0 0; }
.section-head { margin-bottom: 24px; max-width: 40em; }
.section-head h2 { font-size: clamp(28px, 6.5vw, 44px); line-height: 1.05; letter-spacing: -.03em; font-weight: 700; margin-top: 10px; }
.section-head p { color: var(--text-2); margin: 12px 0 0; }

.card {
  background: var(--surface); border: var(--bw) solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--sh) var(--sh) 0 var(--ink); padding: 20px;
}
.card.flat { box-shadow: none; }

.features { display: grid; gap: 16px; }
@media (min-width: 600px) and (max-width: 959px) {
  .features .feature { display: grid; grid-template-columns: 180px 1fr; column-gap: 24px; align-items: start; }
  .features .feature .tag { grid-column: 1; }
  .features .feature h3 { grid-column: 1; grid-row: 2; }
  .features .feature p { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}
@media (min-width: 960px) { .features { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.feature { color: var(--on-accent); }
.feature .tag { color: var(--on-accent-2); }
.feature h3 { font-size: 21px; line-height: 1.2; letter-spacing: -.015em; margin: 10px 0 8px; color: var(--on-accent); }
.feature p { margin: 0; color: var(--on-accent-2); }
.feature code { background: rgba(20, 18, 26, .1); }
.feature.sky { background: var(--sky); }
.feature.sun { background: var(--sun); }
.feature.mint { background: var(--mint); }

/* ---------- Download ---------- */
.download { display: grid; gap: 24px; padding: 22px; }
@media (min-width: 880px) { .download { grid-template-columns: 1fr 1.15fr; gap: 40px; padding: 32px; align-items: start; } }
.download .version { font: 700 clamp(30px, 7vw, 40px)/1 var(--display); letter-spacing: -.03em; margin: 6px 0 10px; }
.download .summary { color: var(--text-2); margin: 0 0 20px; }
.facts { margin: 0; display: grid; gap: 14px; }
.fact { display: grid; gap: 4px; min-width: 0; }
.fact dt { font: 600 11px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); }
.fact dd { margin: 0; font: 500 14px/1.5 var(--sans); min-width: 0; }
.hash {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border-radius: 10px; padding: 8px 8px 8px 12px;
}
.hash code {
  flex: 1; min-width: 0; background: none; padding: 0; font-size: 12px; line-height: 1.6; color: var(--text);
  white-space: normal; word-break: normal; overflow-wrap: anywhere; letter-spacing: .02em;
}
.copy {
  flex: none; align-self: stretch; max-height: 48px; min-width: 64px; min-height: 40px;
  border: 1.5px solid rgba(var(--ink-rgb), .35); background: var(--surface);
  color: var(--text); border-radius: 8px; font: 600 13px/1 var(--sans); padding: 0 12px; cursor: pointer;
}
.copy:hover { border-color: var(--ink); }
.copy.done { background: var(--lime); color: var(--on-accent); border-color: var(--ink); }
@media (pointer: coarse) { .copy { min-height: 44px; } }

.scan { display: none; }
@media (min-width: 880px) and (hover: hover) and (pointer: fine) {
  .scan { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding-top: 18px; border-top: 1.5px dashed rgba(var(--ink-rgb), .25); }
  .scan img { width: 92px; height: 92px; border-radius: 8px; background: #fff; padding: 6px; border: 2px solid var(--ink); }
  .scan p { margin: 0; font-size: 14px; color: var(--text-2); }
  .scan strong { display: block; color: var(--text); font-family: var(--display); font-size: 16px; }
}

.verify { margin: 18px 0 0; font-size: 14px; color: var(--text-2); }
.verify p { margin: 0 0 8px; }
.cmd {
  display: block; margin: 0 0 6px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2); color: var(--text); font: 500 12.5px/1.5 var(--mono);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.cmd::before { content: "$ "; color: var(--text-2); }

/* ---------- Install steps ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: step; }
@media (min-width: 880px) { .steps { grid-template-columns: repeat(2, 1fr); gap: 16px; } .steps li:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.steps li {
  counter-increment: step; position: relative;
  background: var(--surface); border: var(--bw) solid var(--ink); border-radius: var(--radius);
  padding: 18px 18px 18px 64px;
}
.steps li::before {
  content: counter(step); position: absolute; left: 16px; top: 16px;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sun); color: var(--on-accent); border: 2px solid var(--ink);
  font: 700 15px/1 var(--mono);
}
.steps strong { display: block; font: 700 17px/1.3 var(--display); margin-bottom: 4px; }
.steps span { color: var(--text-2); font-size: 15px; }

/* ---------- Limits ---------- */
.limits { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 880px) {
  .limits { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .limits li:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.limits li {
  background: var(--surface); border: 1.5px solid rgba(var(--ink-rgb), .3);
  border-left: 5px solid var(--sun); border-radius: 12px; padding: 14px 16px; font-size: 15px; color: var(--text-2);
}

/* ---------- Changelog ---------- */
.releases { display: grid; gap: 16px; }
@media (min-width: 880px) { .releases { grid-template-columns: repeat(2, 1fr); gap: 20px; align-items: start; } }
.release {
  background: var(--surface); border: var(--bw) solid var(--ink); border-radius: var(--radius);
  padding: 20px;
}
.release.latest { box-shadow: var(--sh) var(--sh) 0 var(--ink); }
.release-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding-bottom: 14px; margin-bottom: 4px;
  border-bottom: 1.5px dashed rgba(var(--ink-rgb), .25);
}
.release-head h3 { font-size: 28px; line-height: 1; letter-spacing: -.03em; }
.badge {
  font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em;
  background: var(--lime); color: var(--on-accent); border: 2px solid var(--ink);
  border-radius: 999px; padding: 5px 9px; white-space: nowrap;
}
.badge.muted-badge { background: transparent; color: var(--text-2); border-color: rgba(var(--ink-rgb), .35); }
.release-date { font: 500 12.5px/1 var(--mono); color: var(--text-2); margin-left: auto; white-space: nowrap; }
@media (max-width: 519px) { .release-date { flex-basis: 100%; margin: 2px 0 0; } }
.changes { list-style: none; margin: 0; padding: 0; }
.changes li {
  display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: start;
  padding: 12px 0; font-size: 15px; line-height: 1.55; color: var(--text-2);
}
.changes li + li { border-top: 1px solid rgba(var(--ink-rgb), .12); }
.changes li:last-child { padding-bottom: 0; }
.kind {
  font: 600 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; text-align: center;
  color: var(--on-accent); border-radius: 6px; padding: 5px 0; margin-top: 1px;
}
.kind.new { background: var(--mint); }
.kind.improved { background: var(--sky); }
.kind.fixed { background: var(--sun); }

/* ---------- Prose pages ---------- */
.page { padding: 36px 0 0; }
.page h1 { font-size: clamp(36px, 9vw, 56px); line-height: 1; letter-spacing: -.035em; font-weight: 700; margin: 10px 0 12px; }
.prose { max-width: 44em; }
.prose h2 { font-size: clamp(22px, 5vw, 28px); line-height: 1.2; letter-spacing: -.02em; margin: 36px 0 10px; }
.prose p, .prose li { color: var(--text-2); }
.prose strong { color: var(--text); }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 8px; }
.muted { font: 500 13px/1.6 var(--mono); color: var(--text-2); margin: 0; }
.muted span { display: inline-block; }

.components { display: grid; gap: 12px; margin: 22px 0 0; }
@media (min-width: 760px) { .components { grid-template-columns: repeat(2, 1fr); } }
.component { padding: 16px 18px; }
.component h3 { font-size: 18px; margin-bottom: 8px; }
.component dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.component dt { font: 600 11px/1.9 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); }
.component dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.component dd code { white-space: normal; }

.archive { margin: 18px 0 0; padding: 18px; display: grid; gap: 14px; }
.archive h3 { font-size: 18px; }
.archive p { margin: 0; font-size: 14px; color: var(--text-2); }
.prose .links, .links { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.links li { margin: 0; }
.links a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; }

/* ---------- 404 ---------- */
.lost { padding: 12vh 0 4vh; text-align: center; }
.lost .orb { margin: 0 auto 24px; width: 96px; height: 96px; background: var(--sun); font: 700 28px/1 var(--display); }
.lost h1 { font-size: clamp(32px, 8vw, 52px); letter-spacing: -.03em; margin-bottom: 12px; }
.lost p { color: var(--text-2); margin: 0 auto 28px; max-width: 30em; }
.lost .actions { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer { margin-top: var(--section); padding: 24px 0 calc(28px + env(safe-area-inset-bottom)); border-top: var(--bw) solid var(--ink); }
.site-footer .wrap { display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--text-2); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 20px; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; color: var(--text); text-decoration: none; font-weight: 600; }
.site-footer a:hover { text-decoration: underline; }
@media (min-width: 960px) { .site-footer .wrap { flex-direction: row; justify-content: space-between; align-items: center; } }
