/* anyhop landing.
   Quiet chrome around one interactive idea: ordered rules, first match wins.
   Palette follows the app (src/anyhop/assets/style.css). Fonts self-hosted.
   Appearance: html.dark retunes tokens; set before paint by the head script. */

@font-face {
  font-family: Archivo;
  src: url(fonts/archivo-var-latin.woff2) format("woff2");
  font-weight: 400 800;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url(fonts/plexmono-400-latin.woff2) format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url(fonts/plexmono-500-latin.woff2) format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url(fonts/plexmono-600-latin.woff2) format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light;

  --bg: #f4f6f5;
  --panel: #ffffff;
  --line: #d5dfde;
  --line-2: #a7b6b4;

  --text: #17201f;
  --muted: #4f5f5d;
  --faint: #6e7e7c;

  --brand: #3b82f6;
  --live: #007f73;
  --route: #6655df;
  --down: #bd332b;
  --on-brand: #ffffff;

  --shadow-soft: 0 1px 2px rgba(23, 32, 31, .04);
  --shadow-panel: 0 10px 28px -18px rgba(23, 32, 31, .18);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --display: Archivo, var(--sans);

  --max: 920px;
  --pad: clamp(20px, 4vw, 32px);
  --r: 12px;
}

/* Dark tokens — same roles as the app's :root.dark block. */
html.dark {
  color-scheme: dark;

  --bg: #0e1416;
  --panel: #1c2426;
  --line: #323c3e;
  --line-2: #4c5a5c;

  --text: #e7edf1;
  --muted: #9fb0ad;
  --faint: #7a8c89;

  --brand: #0a84ff;
  --live: #2bbd9e;
  --route: #9a86ff;
  --down: #e5665c;
  --on-brand: #ffffff;

  --shadow-soft: 0 1px 2px rgba(0, 0, 0, .28);
  --shadow-panel: 0 12px 32px -14px rgba(0, 0, 0, .55);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Cross-fade structural surfaces on theme change only. */
body,
.top,
.cmd,
.trace-row,
.chips button,
.rules,
.copy,
.theme-toggle {
  transition: background-color .2s ease, border-color .2s ease, color .2s ease,
    box-shadow .2s ease;
}
@media (prefers-reduced-motion: reduce) {
  body,
  .top,
  .cmd,
  .trace-row,
  .chips button,
  .rules,
  .copy,
  .theme-toggle {
    transition: none;
  }
}

h1, h2 {
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 92%;
  letter-spacing: -.03em;
  line-height: 1.08;
  text-wrap: balance;
  margin: 0;
}

p { margin: 0; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}
a:hover { text-decoration-color: currentColor; }

code {
  font-family: var(--mono);
  font-size: .86em;
  letter-spacing: -.01em;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--panel);
  color: var(--text);
  padding: 8px 12px;
  z-index: 100;
}
.skip:focus { left: var(--pad); top: 8px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

/* ---- top ---- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: calc(var(--max) + 2 * var(--pad));
  margin-inline: auto;
  padding: 14px var(--pad);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  position: relative;
}
.brand .word {
  display: block;
  height: 22px;
  width: auto;
}
.foot-mark {
  display: inline-flex;
  position: relative;
  height: 16px;
}
.foot-mark img {
  height: 16px;
  width: auto;
  display: block;
  opacity: .75;
}

/* Wordmarks: light SVG on light, dark SVG on dark. The compound selectors
   must outrank the .brand .word / .foot-mark img display rules above, or
   both wordmarks render in light appearance. */
.brand .word-dark,
.foot-mark .word-dark { display: none; }
html.dark .brand .word-light,
html.dark .foot-mark .word-light { display: none; }
html.dark .brand .word-dark,
html.dark .foot-mark .word-dark { display: block; }

.top-end {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-inline-start: auto;
}

.top nav {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--muted);
}
.top nav a { text-decoration: none; }
.top nav a:hover { color: var(--text); }

.theme-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--line-2);
}
.theme-toggle svg {
  display: block;
}

/* ---- hero ---- */

.hero {
  max-width: calc(var(--max) + 2 * var(--pad));
  margin-inline: auto;
  padding: clamp(56px, 10vw, 96px) var(--pad) 0;
}

.hero h1 {
  font-size: clamp(2.4rem, 6.5vw, 3.75rem);
  max-width: 14ch;
}

.lede {
  margin-top: 18px;
  max-width: 38ch;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.5;
  color: var(--muted);
}

.install {
  margin-top: 36px;
  max-width: 640px;
}

.cmd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}
.cmd code {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.copy {
  flex: none;
  min-height: 32px;
  min-width: 56px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  padding: 6px 10px;
}
.copy:hover { color: var(--text); border-color: var(--line-2); }
.copy[data-done] { color: var(--live); border-color: var(--live); }

.hint {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--muted);
}

/* ---- demo (signature) ---- */

.demo {
  max-width: calc(var(--max) + 2 * var(--pad));
  margin: clamp(48px, 8vw, 72px) auto 0;
  padding: 28px var(--pad);
}

.demo-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 28px 40px;
  align-items: start;
  margin-bottom: 28px;
}

.demo h2 {
  font-size: clamp(1.55rem, 3vw, 2rem);
}

.trace-row {
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}
.trace-row:focus-within { border-color: var(--brand); }
.trace-row input {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  background: none;
  border: 0;
  outline: 0;
  padding: 10px 0;
}
.trace-row input::placeholder { color: var(--faint); }

.chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}
.chips button {
  min-height: 28px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 99px;
  cursor: pointer;
  padding: 4px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chips button:hover { color: var(--text); border-color: var(--line-2); }
.chips button[aria-pressed="true"] {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 50%, var(--line));
  background: color-mix(in srgb, var(--brand) 6%, var(--panel));
}

.result {
  margin-top: 12px;
  min-height: 2.6em;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.result strong { color: var(--text); font-weight: 600; }
.result .hit { color: var(--route); font-weight: 600; }
.result .note { display: block; margin-top: 2px; color: var(--faint); }

.rules {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-panel);
}

.rule {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px 14px;
  align-items: center;
  padding: 14px 18px;
  transition: opacity .2s ease, background-color .2s ease, filter .2s ease;
}
.rule + .rule { border-top: 1px solid var(--line); }

.n {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--on-brand);
  background: var(--brand);
  border-radius: 5px;
  padding: 3px 0;
  line-height: 1.3;
}

.body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  min-width: 0;
}
.name {
  font-family: var(--display);
  font-weight: 600;
  font-stretch: 95%;
  letter-spacing: -.015em;
  font-size: 15px;
}
.body code {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 7px;
}

.via {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.via[data-tone="live"]  { color: var(--live); }
.via[data-tone="down"]  { color: var(--down); }
.via[data-tone="faint"] { color: var(--faint); }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.rule.win {
  background: color-mix(in srgb, var(--route) 12%, var(--panel));
  box-shadow: inset 3px 0 0 var(--route);
}
.rule.win .n { background: var(--route); }
.rule.skip { opacity: .5; filter: saturate(.45); }
.rule.idle { opacity: .32; filter: saturate(.35); }
html.dark .rule.skip { opacity: .42; }
html.dark .rule.idle { opacity: .28; }

.demo-foot {
  margin-top: 16px;
  font-size: 13.5px;
  color: var(--muted);
}

/* ---- points ---- */

.points {
  max-width: calc(var(--max) + 2 * var(--pad));
  margin: clamp(40px, 7vw, 64px) auto 0;
  padding: 0 var(--pad);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 32px;
}

.points h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.points p {
  font-size: 14.5px;
  color: var(--muted);
  max-width: 28ch;
}
.points code {
  font-size: 12.5px;
  color: var(--text);
}

/* ---- bar ---- */

.bar {
  max-width: calc(var(--max) + 2 * var(--pad));
  margin: clamp(40px, 7vw, 56px) auto 0;
  padding: 22px var(--pad);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  font-size: 13.5px;
  color: var(--muted);
}
.bar strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 6px;
}

/* ---- footer ---- */

.foot {
  max-width: calc(var(--max) + 2 * var(--pad));
  margin: 0 auto;
  padding: 28px var(--pad) 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}
.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-inline-start: auto;
  font-size: 13.5px;
  color: var(--muted);
}
.foot nav a { text-decoration: none; }
.foot nav a:hover { color: var(--text); }
.legal {
  flex-basis: 100%;
  font-size: 12.5px;
  color: var(--faint);
}

/* ---- responsive ---- */

@media (max-width: 820px) {
  .demo-head { grid-template-columns: 1fr; gap: 20px; }
  .points { grid-template-columns: 1fr; gap: 24px; }
  .points p { max-width: none; }
}

@media (max-width: 560px) {
  .rule {
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }
  .via {
    grid-column: 2;
    padding-top: 2px;
  }
  .cmd { flex-wrap: wrap; }
  .cmd code { flex-basis: 100%; }
  .top nav { gap: 14px; }
  .top-end { gap: 10px; }
}
