/* HIDway+ download site. Palette from the app (client/src/main.c, W_ colours). */

:root {
  --bg: rgb(23, 24, 27);
  --rail: rgb(17, 18, 20);
  --surface: rgb(31, 33, 37);
  --surface-2: rgb(39, 42, 47);
  --line: rgb(46, 49, 55);
  --line-2: rgb(59, 63, 70);
  --text: rgb(236, 237, 239);
  --text-2: rgb(174, 177, 184);
  --text-3: rgb(130, 134, 142);   /* only on --bg / --rail: AA there, not on surfaces */
  --arm: rgb(44, 134, 68);
  --arm-border: rgb(69, 167, 94);
  --arm-hover: rgb(52, 150, 78);
  --live: rgb(63, 185, 80);
  --warn: rgb(229, 83, 75);
  --focus: rgb(236, 237, 239);
  --panel-top: rgb(36, 38, 43);
  --panel-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 1px 0 rgba(0, 0, 0, 0.35), 0 14px 30px -18px rgba(0, 0, 0, 0.75);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --gutter: 20px;
  --max: 1120px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p, ul, ol, figure { margin: 0; }

a { color: var(--text); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text-2); }

code, kbd {
  font-family: var(--mono);
  font-size: 0.875em;
}
code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}
kbd {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 0.4em;
  line-height: 1.5;
  color: var(--text);
}

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 10;
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
}
.skip:focus { top: 12px; }

[hidden] { display: none !important; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.prose > * { max-width: 44rem; }

/* Header */

.site-header {
  background: var(--rail);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 60px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 1.0625rem;
}
.bm-bg { fill: var(--surface-2); stroke: var(--line-2); }
.bm-h { fill: var(--text); }
.bm-bar { fill: var(--live); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}
.site-nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.9375rem;
  padding: 4px 0;
}
.site-nav a:hover { color: var(--text); }

/* Hero */

.hero { padding: 56px 0 64px; }
.hero-grid {
  display: grid;
  gap: 40px;
  align-items: start;
}
.hero h1 {
  font-size: 2.5rem;
  letter-spacing: -0.02em;
}
.lede {
  margin-top: 14px;
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--text-2);
  max-width: 36em;
}
.lede { text-wrap: balance; }
.section-lede,
.dl-help,
.dl-meta { text-wrap: pretty; }
.hero-shot img {
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: var(--rail);
  width: 100%;
}

/* Download card */

.download {
  margin-top: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.dl-status {
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.download .dl-status { border-color: var(--line-2); border-left-width: 3px; background: var(--surface-2); }
.download .dl-status.is-error { border-left-color: var(--warn); }
.dl-status.is-error { border-left-color: var(--warn); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 22px;
  background: var(--arm);
  border: 1px solid var(--arm-border);
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.btn-primary:hover { background: var(--arm-hover); }
.btn-primary:active { background: var(--arm); }
.btn-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dl-meta {
  margin-top: 10px;
  color: var(--text-2);
  font-size: 0.9375rem;
}
.dl-meta-sub { display: block; padding-left: 17px; }
.dl-verify-link { white-space: nowrap; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--text-3); }

/* Hash row */

.hash {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "label copy" "value value";
  align-items: center;
  gap: 6px 12px;
  background: var(--rail);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.hash-label {
  grid-area: label;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.hash-value {
  grid-area: value;
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-all;
  user-select: all;
  max-width: 32ch;
}
.btn-copy {
  grid-area: copy;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 3px 12px;
  min-height: 30px;
  cursor: pointer;
}
.btn-copy:hover { border-color: var(--text-3); }
.btn-copy.is-done { color: var(--live); border-color: var(--line-2); }

.dl-help {
  margin-top: 14px;
  font-size: 0.875rem;
  color: var(--text-2);
}
.dl-help a { color: var(--text-2); }
.dl-help a:hover { color: var(--text); }

/* Sections */

.section {
  padding: 72px 0;
  border-top: 1px solid var(--line);
}
.section h2 { font-size: 1.625rem; }
.section-lede {
  margin-top: 12px;
  color: var(--text-2);
  max-width: 44em;
}
.section .prose p { margin-top: 12px; color: var(--text-2); }
.section .prose strong { color: var(--text); font-weight: 600; }

/* Diagram */

.diagram { margin: 36px 0 0; }
.diagram-wide { width: 100%; height: auto; }
.diagram-tall { display: none; width: 100%; max-width: 320px; height: auto; }
.d-node rect { fill: var(--surface); stroke: var(--line-2); stroke-width: 1.5; }
.d-target rect { fill: var(--rail); stroke-dasharray: 5 5; }
.d-step { fill: var(--text-2); font: 600 13px var(--mono); }
.d-title { fill: var(--text); font: 600 19px var(--font); }
.d-sub { fill: var(--text-2); font: 400 14px var(--font); }
.d-link line { stroke: var(--text-3); stroke-width: 1.5; }
.d-head { fill: var(--text-3); }
.d-label text { fill: var(--text-3); font: 500 13px var(--mono); letter-spacing: 0.04em; }

@media (prefers-reduced-motion: no-preference) {
  .d-link line {
    stroke-dasharray: 6 5;
    animation: flow 1.6s linear infinite;
  }
}
@keyframes flow { to { stroke-dashoffset: -22; } }

.parts {
  list-style: none;
  padding: 0;
  margin-top: 36px;
  display: grid;
  gap: 16px;
  counter-reset: part;
}
.parts li {
  counter-increment: part;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.parts h3 { font-size: 1.0625rem; }
.parts h3::before {
  content: counter(part);
  display: inline-block;
  margin-right: 10px;
  font: 600 0.8125rem var(--mono);
  color: var(--text-2);
}
.parts p { margin-top: 8px; color: var(--text-2); font-size: 0.9375rem; }

.facts {
  list-style: none;
  padding: 0;
  margin-top: 36px;
  display: grid;
  gap: 14px 40px;
}
.facts li {
  color: var(--text-2);
  padding-left: 16px;
  border-left: 2px solid var(--line-2);
}
.facts strong { color: var(--text); font-weight: 600; }

/* What you need / Get started */

.two-col {
  display: grid;
  gap: 56px;
}
.need {
  list-style: none;
  padding: 0;
  margin-top: 20px;
}
.need li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
}
.need li:first-child { border-top: 1px solid var(--line); }
.need-name { color: var(--text); font-weight: 600; }

.steps {
  list-style: none;
  padding: 0;
  margin-top: 20px;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 20px 44px;
  color: var(--text-2);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  font: 600 0.8125rem var(--mono);
  color: var(--text);
  background: var(--surface);
}
.steps strong { color: var(--text); font-weight: 600; display: block; }
.note {
  margin-top: 4px;
  font-size: 0.9375rem;
  color: var(--text-2);
}

/* Firmware */

.fw-list {
  list-style: none;
  padding: 0;
  margin-top: 28px;
  display: grid;
  gap: 16px;
}
.fw-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 14px;
  align-content: start;
}
.fw-item .hash { margin-top: 0; }
.fw-board { font-size: 1.0625rem; }
.fw-meta { margin-top: 4px; font-size: 0.875rem; color: var(--text-2); overflow-wrap: anywhere; }
.fw-link { justify-self: start; }
#fw-status { margin-top: 28px; }

/* Footer */

.site-footer {
  background: var(--rail);
  border-top: 1px solid var(--line);
  padding: 32px 0 40px;
}
.footer-row { display: grid; gap: 8px; }
.footer-name { font-weight: 600; }
.footer-name span { color: var(--text-3); font-weight: 400; font-family: var(--mono); font-size: 0.875rem; margin-left: 6px; }
.footer-note { color: var(--text-3); font-size: 0.875rem; max-width: 46em; }

/* Verify */

.verify-card {
  margin-top: 28px;
  max-width: 720px;
  padding: 20px;
  display: grid;
  gap: 14px;
}
.verify-card .hash { margin-top: 0; }
.verify-card .dl-help { margin-top: 0; }
#vf-status { margin-top: 28px; }
.dl-verify-link { color: var(--text-2); white-space: nowrap; }

/* Panels: a lighter surface, a thin edge and a faint top highlight, like the
   app's tiles. */

.download,
.parts li,
.fw-item,
.verify-card {
  background: linear-gradient(180deg, var(--panel-top), var(--surface) 64px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
}
.hero-shot img {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 0 rgba(0, 0, 0, 0.4), 0 22px 44px -24px rgba(0, 0, 0, 0.85);
}
.hash { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35); }
.d-node rect { fill: var(--panel-top); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35)); }
.d-target rect { fill: var(--rail); filter: none; }

/* Hover and press for things that can be clicked */

.btn-primary,
.btn-secondary,
.btn-copy {
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.btn-primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 0 rgba(0, 0, 0, 0.4); }
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 6px 14px -8px rgba(0, 0, 0, 0.8);
}
.btn-secondary,
.btn-copy { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.btn-secondary:hover,
.btn-copy:hover {
  transform: translateY(-1px);
  border-color: var(--text-3);
  background: rgb(45, 48, 54);
}
.btn-primary:active,
.btn-secondary:active,
.btn-copy:active { transform: none; }

/* Live dot beside the release line, like the app's status dot */

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 9px 1px 1px;
  border-radius: 50%;
  background: var(--live);
  vertical-align: middle;
}

/* Reveal on scroll. Only active while site.js has set html.reveal-on. */

.reveal-on .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-on .reveal.is-in { opacity: 1; transform: none; }
.reveal-on .reveal-d1 { transition-delay: 0.09s; }
.reveal-on .reveal-d2 { transition-delay: 0.18s; }

@media (prefers-reduced-motion: no-preference) {
  .live-dot { animation: live 3.2s ease-in-out infinite; }
}
@keyframes live {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.35); }
  50% { opacity: 0.55; box-shadow: 0 0 0 4px rgba(63, 185, 80, 0); }
}

/* 404 */

.notfound { padding: 96px 0; }
.notfound h1 { font-size: 2rem; }
.notfound p { margin-top: 12px; color: var(--text-2); }
.notfound .btn-secondary { margin-top: 24px; }

/* Layout steps */

@media (max-width: 599px) {
  :root { --gutter: 16px; }
  .hero { padding: 36px 0 48px; }
  .hero h1 { font-size: 2.125rem; }
  .lede { font-size: 1.0625rem; }
  .download { padding: 18px; }
  .btn-primary { width: 100%; }
  .section { padding: 56px 0; }
  .section h2 { font-size: 1.4375rem; }
  .site-nav { gap: 2px 16px; }
  .site-nav a { font-size: 0.875rem; }
}

@media (max-width: 899px) {
  .diagram-wide { display: none; }
  .diagram-tall { display: block; }
}

@media (min-width: 900px) {
  .parts { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 720px) {
  .facts { grid-template-columns: repeat(2, 1fr); }
  .fw-list { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .two-col { grid-template-columns: 1fr 1fr; gap: 64px; }
}

@media (min-width: 1040px) {
  .hero { padding: 80px 0 88px; }
  /* The picture spans from the cap height of the heading to the bottom of the
     download card. It is sized by whichever limit is reached first, the
     column's width or that height, always keeping its 875:540 ratio, and sits
     against the right gutter, so it never hangs lower than the card. */
  .hero { --h1: 3rem; --cap: calc(var(--h1) * 0.305); }
  .hero-grid { grid-template-columns: 23.5rem minmax(0, 1fr); gap: 44px; align-items: stretch; }
  .hero .lede { font-size: 1.125rem; }
  .hero .download { padding: 20px; }
  .hero h1 { font-size: var(--h1); }
  .hero-shot { position: relative; min-height: 0; }
  .hero-shot img {
    position: absolute;
    top: var(--cap);
    right: 0;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100% - var(--cap));
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
