/* RR Wiki. Device first: big codename cards on the home page, a red band and tabs on each phone,
   a working checklist on the install guide. Colors and fonts match the main site. */
:root {
  color-scheme: dark;
  --bg: #0c0809;
  --surface: #181113;
  --surface-hi: #211719;
  --fg: #f7eff1;
  --muted: #b9a5aa;
  --line: #2b1e22;
  --line-hi: #3d2b30;
  --accent: #ff4d73;
  --code: #0f0a0b;
  --warn: #ffb020;
  --warn-bg: rgba(255, 176, 32, 0.13);
  --band: #c60029;
  --band-ink: #ffffff;
  --mark: #ff003f;
  --font-display: "Poppins", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-body: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #fbf6f7;
    --surface: #ffffff;
    --surface-hi: #f4ebed;
    --fg: #1c1114;
    --muted: #6e585d;
    --line: #eadde0;
    --line-hi: #dccbcf;
    --accent: #c20029;
    --code: #f7eff1;
    --warn: #8a5000;
    --warn-bg: rgba(163, 95, 0, 0.10);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fbf6f7;
  --surface: #ffffff;
  --surface-hi: #f4ebed;
  --fg: #1c1114;
  --muted: #6e585d;
  --line: #eadde0;
  --line-hi: #dccbcf;
  --accent: #c20029;
  --code: #f7eff1;
  --warn: #8a5000;
  --warn-bg: rgba(163, 95, 0, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.band a:focus-visible, .band button:focus-visible, .phone a:focus-visible { outline-color: #ffffff; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; text-wrap: balance; }
h1 { margin: 0; font-weight: 800; font-size: clamp(36px, 6vw, 68px); letter-spacing: -.01em; }
h2 { margin: 0; font-weight: 700; font-size: 26px; }
h3 { margin: 0; font-weight: 600; font-size: 19px; }
p { margin: 0; }

code, pre { font-family: var(--font-mono); }
code { font-size: .88em; overflow-wrap: anywhere; }
pre { margin: 0; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 960px; }

.top { padding-top: 18px; }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--fg); font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand svg { width: 32px; height: 24px; flex: none; fill: var(--mark); }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; margin-left: auto; font-size: 15px; }
.top nav a { display: flex; align-items: center; min-height: 44px; color: var(--fg); }
.theme { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--fg); cursor: pointer; }
.theme:hover { background: var(--surface-hi); }
.theme svg { width: 20px; height: 20px; }
html:not(.js) .theme { display: none; }

/* Home */
.home { display: flex; flex-direction: column; gap: 40px; padding-top: 28px; padding-bottom: 64px; }
.phones { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 20px; }
.phone { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 22px; padding: 28px; border-radius: 26px; background: var(--band); color: var(--band-ink); }
.phone .ghost { position: absolute; right: -60px; bottom: -70px; width: 420px; height: 307px; fill: #ffffff; opacity: .13; }
.phone .row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 18px; font-weight: 600; }
.badge { padding: 2px 12px; border-radius: 99px; background: #ffffff; color: #9b0020; font-size: 13px; font-weight: 600; white-space: nowrap; }
.phone h2 { position: relative; font-weight: 800; font-size: clamp(56px, 9vw, 112px); line-height: 1; letter-spacing: -.02em; overflow-wrap: anywhere; }
.phone h2 a { color: inherit; }
.tasks { position: relative; display: flex; flex-wrap: wrap; gap: 8px; }
.task { display: flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 99px; background: rgba(255, 255, 255, .16); color: #ffffff; font-weight: 500; font-size: 15px; }
.task:hover { background: rgba(255, 255, 255, .28); text-decoration: none; }

.which { display: flex; flex-direction: column; gap: 10px; padding: 18px 22px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.which .head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.which strong { font-weight: 600; }
.which ul { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 15px; }

.section { display: flex; flex-direction: column; gap: 14px; }
.section > h2 { font-size: 22px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--fg); }
.card:hover { border-color: var(--line-hi); background: var(--surface-hi); text-decoration: none; }
.card strong { font-weight: 600; }
.card span { color: var(--muted); font-size: 15px; }

/* A phone's pages */
.band { position: relative; overflow: hidden; background: var(--band); color: var(--band-ink); }
.band .ghost { position: absolute; right: 2%; top: -40px; width: 340px; height: 249px; fill: #ffffff; opacity: .13; }
.band .wrap { position: relative; display: flex; flex-direction: column; gap: 22px; padding-top: 18px; }
.band a { color: #ffffff; }
.band .up { align-self: flex-start; display: flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 500; }
.band .title { display: flex; flex-direction: column; gap: 2px; }
.band .title p { font-size: 18px; font-weight: 600; }
.band h1 { font-size: clamp(52px, 8vw, 88px); line-height: 1.05; letter-spacing: -.02em; overflow-wrap: anywhere; }
.band h1.small { font-size: clamp(36px, 6vw, 64px); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs a { display: flex; align-items: center; min-height: 46px; padding: 0 18px; border-radius: 12px 12px 0 0; font-weight: 500; }
.tabs a:hover { background: rgba(255, 255, 255, .14); text-decoration: none; }
.tabs a[aria-current="page"] { background: var(--bg); color: var(--fg); font-weight: 600; }
.band .pad { height: 22px; }

.page { display: flex; flex-direction: column; gap: 22px; padding-top: 32px; padding-bottom: 72px; }
.lead { max-width: 68ch; color: var(--muted); }
.spread { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; }
.count { color: var(--muted); font-variant-numeric: tabular-nums; }
html:not(.js) .count { display: none; }

.warn { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 14px 16px; border: 1px solid var(--warn); border-radius: 12px; background: var(--warn-bg); }
.warn strong { color: var(--warn); font-weight: 600; }

/* Checklist */
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; margin: 0; padding: 0; list-style: none; }
.rail li { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.rail li::before { content: ""; height: 6px; border-radius: 3px; background: var(--line-hi); }
.rail li.done, .rail li.now { color: var(--fg); }
.rail li.done::before, .rail li.now::before { background: var(--mark); }
.rail li.now { font-weight: 600; }
html:not(.js) .rail { display: none; }

.steps { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.step { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.step.now { border-color: var(--mark); }
.step.done > *:not(.step-head) { opacity: .72; }
.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.dot { flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-hi); font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.step.now .dot, .step.done .dot { background: var(--band); color: #ffffff; }
.step-head h3 { flex: 1 1 200px; }
.mark-done { min-height: 44px; padding: 0 16px; border: 1px solid var(--line-hi); border-radius: 12px; background: transparent; color: var(--fg); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; }
.mark-done:hover { background: var(--surface-hi); }
html:not(.js) .mark-done { display: none; }
.step p { max-width: 68ch; }

.cmd { display: flex; align-items: flex-start; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 12px; background: var(--code); border: 1px solid var(--line); }
.cmd pre { flex: 1; min-width: 0; padding-top: 6px; overflow-x: auto; font-size: 14px; line-height: 1.7; }
.copy { flex: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-hi); border-radius: 10px; background: transparent; color: var(--fg); font: inherit; font-size: 14px; cursor: pointer; }
.copy:hover { background: var(--surface-hi); }
html:not(.js) .copy { display: none; }

/* Written pages */
.prose { display: flex; flex-direction: column; gap: 16px; }
.prose h2 { margin-top: 18px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 8px; }
.prose ol, .prose ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.prose p, .prose li { max-width: 72ch; }
.note { padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font-weight: 600; background: var(--surface); white-space: nowrap; }

.prose .issues { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.issues li { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.issues strong { font-weight: 600; }
.issues span { color: var(--muted); max-width: 72ch; }

.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details { padding: 4px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.faq summary { min-height: 44px; display: flex; align-items: center; padding: 8px 0; font-weight: 600; cursor: pointer; }
.faq details > div { display: flex; flex-direction: column; gap: 10px; padding: 0 0 14px; color: var(--muted); }

/* Search */
.search-box { display: flex; flex-direction: column; gap: 6px; }
.search-box label { font-weight: 600; }
.search-box input { width: 100%; min-height: 52px; padding: 0 16px; border: 1px solid var(--line-hi); border-radius: 14px; background: var(--surface); color: var(--fg); font: inherit; font-size: 18px; }
.results { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }

.bottom { margin-top: auto; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.bottom .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 20px; padding-top: 14px; padding-bottom: 18px; }
.bottom nav { display: flex; flex-wrap: wrap; gap: 0 18px; }
.bottom a { display: flex; align-items: center; min-height: 44px; color: var(--muted); }

@media (max-width: 560px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .phone { padding: 22px; border-radius: 22px; }
  .top nav { margin-left: 0; width: 100%; }
  .rail { gap: 4px; }
  .rail li { font-size: 0; gap: 0; }
  .step { padding: 16px; }
  .cmd { flex-direction: column; }
  .cmd pre { width: 100%; padding-top: 0; }
}
