/*
 * Residue website. One dark theme, the colours of the Residue apps.
 * No external fonts, scripts or styles: everything is served from this site.
 */

:root {
  --bg: #121019;
  --card: #1b1825;
  --sunk: #15121e;
  --fg: #ebe8f4;
  --muted: #a39dba;
  --line: #2f2a40;
  --accent: #a586ff;
  --accent-ink: #171226;
  --high: #f08a84;
  --high-bg: #3b1d1b;
  --medium: #f0b45a;
  --medium-bg: #3a2a12;
  --info: #7fb2f0;
  --info-bg: #16283f;
  --good: #86cf92;
  --good-bg: #18301c;
  --selection: #3a2a6e;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, Menlo, monospace;
  --wrap: 1120px;
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

::selection { background: var(--selection); color: var(--fg); }

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

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

.wrap { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 20;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; font-weight: 600;
}
.skip:focus { top: 12px; }

/* Header */

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 700; font-size: 18px; }
.brand img { width: 30px; height: 30px; }
.site-nav { display: flex; gap: 20px; margin-left: auto; flex-wrap: wrap; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.site-nav a:hover { color: var(--fg); }

/* Sections */

section { padding: 72px 0; scroll-margin-top: 60px; }
section + section { border-top: 1px solid var(--line); }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(34px, 5.4vw, 56px); font-weight: 800; }
h2 { font-size: clamp(26px, 3.4vw, 36px); font-weight: 750; }
h3 { font-size: 19px; font-weight: 650; }
p { margin: 0; }
.lead { font-size: clamp(18px, 2vw, 21px); color: var(--muted); max-width: 62ch; }
.section-head { display: grid; gap: 12px; margin-bottom: 36px; }
.section-head p { color: var(--muted); max-width: 70ch; }

/* Hero */

.hero { padding: 80px 0 56px; }
.hero .wrap { display: grid; gap: 22px; justify-items: start; }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--medium); background: var(--medium-bg); border-radius: 999px; padding: 5px 12px;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.hero h1 span { color: var(--accent); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); font: inherit; font-weight: 600; text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.hero-shot {
  margin-top: 26px; width: 100%;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card);
  box-shadow: 0 30px 80px -40px rgba(165, 134, 255, 0.45);
}
.note { font-size: 14px; color: var(--muted); }

/* Cards and grids */

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px;
  display: grid; gap: 8px; align-content: start;
}
.card p { color: var(--muted); font-size: 16px; }
.card .num { font-family: var(--mono); font-size: 13px; color: var(--accent); }

.steps { counter-reset: step; }
.steps .card::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  font-family: var(--mono); font-size: 13px; color: var(--accent);
}

/* Parts table */

.parts { width: 100%; border-collapse: collapse; margin-top: 28px; font-size: 16px; }
.parts th, .parts td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.parts th { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.parts td:first-child { font-weight: 650; white-space: nowrap; }
.parts td { color: var(--muted); }
.parts td:first-child { color: var(--fg); }
.table-scroll { overflow-x: auto; }

/* Screens */

.shots { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); list-style: none; padding: 0; margin: 0; }
.shot { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: grid; }
.shot button {
  all: unset; cursor: zoom-in; display: block; background: var(--sunk); border-bottom: 1px solid var(--line);
}
.shot button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.shot img { width: 100%; aspect-ratio: 2880 / 1904; object-fit: cover; object-position: top left; }
.shot .caption { padding: 14px 16px 16px; display: grid; gap: 4px; }
.shot .caption p { color: var(--muted); font-size: 15px; }

dialog.viewer {
  border: 1px solid var(--line); border-radius: 12px; padding: 0; background: var(--card); color: var(--fg);
  width: min(1500px, 96vw); max-height: 94vh;
}
dialog.viewer::backdrop { background: rgba(8, 6, 14, 0.82); }
dialog.viewer header { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
dialog.viewer header strong { margin-right: auto; }
dialog.viewer img { width: 100%; }
dialog.viewer .scroll { overflow: auto; max-height: calc(94vh - 56px); }

/* Collected / never collected */

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.list li { position: relative; padding-left: 24px; color: var(--muted); font-size: 16px; }
.list li::before { content: ""; position: absolute; left: 4px; top: 0.62em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.list.never li::before { background: var(--high); border-radius: 2px; }
.list.optin li::before { background: var(--medium); }
.card.never { border-color: color-mix(in srgb, var(--high) 40%, var(--line)); }

.pill {
  display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  padding: 2px 9px; border-radius: 999px;
}
.pill.high { color: var(--high); background: var(--high-bg); }
.pill.medium { color: var(--medium); background: var(--medium-bg); }
.pill.info { color: var(--info); background: var(--info-bg); }

/* Limits */

.limits { background: var(--sunk); }
.limits .card { background: var(--bg); }

/* Download */

.downloads { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.download { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: grid; gap: 10px; align-content: start; }
.download p { color: var(--muted); font-size: 15px; }
.download .req { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.btn[aria-disabled="true"] {
  cursor: not-allowed; color: var(--muted); background: var(--sunk); border-style: dashed; margin-top: 6px; justify-self: start;
}
.btn[aria-disabled="true"]:hover { border-color: var(--line); }

/* Footer */

.site-footer { border-top: 1px solid var(--line); padding: 36px 0 56px; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: grid; gap: 10px; }
.site-footer p { max-width: 90ch; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  section { padding: 52px 0; }
  .site-nav { display: none; }
  .site-header .wrap { justify-content: space-between; }
  .parts td:first-child { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  .site-header, .actions, dialog { display: none; }
  body { background: #fff; color: #000; }
}
