/*
  LibraScan — scan.libra.wiki
  Design references: the "one sentence, one figure" rhythm of Apple product pages,
  the typographic restraint of the Things 3 site, and the app icon itself —
  black QR modules on white. Monochrome ink on paper, a single system-blue accent
  (the app uses the default iOS accent), no gradients, no decoration for its own sake.
*/

:root {
  --paper: #f7f7f5;
  --card: #ffffff;
  --ink: #111111;
  --muted: #6b6b6b;
  --line: #e3e3df;
  --accent: #007aff;
  --accent-ink: #ffffff;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Noto Sans SC", Arial, sans-serif;
  --radius: 14px;
  --max: 1040px;
  --measure: 680px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e0e0e;
    --card: #171717;
    --ink: #f2f2f0;
    --muted: #9b9b98;
    --line: #2a2a28;
    --accent: #0a84ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
}
[lang="en"] { font-variant-numeric: tabular-nums; }
.l10n[hidden] { display: none !important; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.15em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
img, svg { max-width: 100%; height: auto; display: block; }
code, kbd { font-family: var(--mono); font-size: 0.92em; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 0.35em; background: var(--card); }

.wrap { width: min(var(--max), calc(100% - 2.5rem)); margin-inline: auto; }
.measure { max-width: var(--measure); }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

/* ---------- nav ---------- */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 0;
}
.brand { display: inline-flex; align-items: center; gap: 0.65rem; color: var(--ink); font-weight: 600; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1.4rem; margin: 0; padding: 0; list-style: none; }
.nav-links a { color: var(--ink); font-size: 0.95rem; }
.lang {
  font: inherit; font-size: 0.85rem; color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.25rem 0.7rem; cursor: pointer;
}
.lang:hover { color: var(--ink); border-color: var(--ink); }
@media (max-width: 640px) { .nav-links li:not(:last-child) { display: none; } }

/* ---------- hero ---------- */
.hero { padding: 4.5rem 0 3.5rem; border-top: 0; }
.hero .icon { width: 88px; height: 88px; border-radius: 22px; border: 1px solid var(--line); background: #fff; margin-bottom: 2rem; }
.hero h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.4rem); line-height: 1.08; letter-spacing: -0.025em;
  font-weight: 700; margin: 0 0 1.1rem; max-width: 14em;
}
.hero p.lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); max-width: var(--measure); margin: 0 0 2rem; }
.cta { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 48px;
  padding: 0 1.25rem; border-radius: 999px; font-weight: 600; font-size: 1rem;
  border: 1px solid var(--ink); color: var(--ink); background: transparent; line-height: 1.2;
}
/* Apple's App Store badge: official artwork, unmodified, ≥40px tall, clear space ≥ ¼ height (the .cta gap). */
.badge { display: inline-flex; line-height: 0; }
.badge:hover { text-decoration: none; opacity: 0.9; }
.badge img { height: 48px; width: auto; }
.badge[hidden], .coming[hidden] { display: none; }
.coming {
  display: inline-flex; align-items: center; height: 48px; padding: 0 1.1rem;
  border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 0.95rem;
}
.btn:hover { text-decoration: none; background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { opacity: 0.85; }
.btn[aria-disabled="true"] { opacity: 0.45; cursor: default; pointer-events: none; }
.btn .tag { font-weight: 500; font-size: 0.8em; opacity: 0.7; }
.fineprint { margin-top: 1rem; color: var(--muted); font-size: 0.85rem; }
.fineprint code { word-break: break-all; }

/* ---------- figure ---------- */
.figure { margin: 1rem 0 0; padding: 2rem 0 0; }
.figure svg { width: 100%; max-width: 760px; color: var(--ink); }
.figure figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.75rem; }
.caret { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } }

/* ---------- sections ---------- */
section { padding: 3.5rem 0; border-top: 1px solid var(--line); }
section h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 1.75rem; }
section h3 { font-size: 1.05rem; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
.grid { display: grid; gap: 1.5rem 2.5rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.steps { counter-reset: step; display: grid; gap: 1.5rem 2.5rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  display: block; font-family: var(--mono); font-size: 0.85rem; color: var(--muted); margin-bottom: 0.6rem;
}
.steps p, .grid p { margin: 0; color: var(--muted); }
.grid ul { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.grid li + li { margin-top: 0.3rem; }

/* ---------- requirements table ---------- */
table { border-collapse: collapse; width: 100%; max-width: var(--measure); font-size: 0.97rem; }
th, td { text-align: left; padding: 0.7rem 0.75rem 0.7rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; width: 8.5em; }

/* ---------- faq ---------- */
.faq details { border-bottom: 1px solid var(--line); padding: 0.9rem 0; max-width: var(--measure); }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0.6rem 0 0; color: var(--muted); }
.faq details ul { margin: 0.6rem 0 0; padding-left: 1.1rem; color: var(--muted); }
.faq details li + li { margin-top: 0.35rem; }

/* ---------- download card ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; max-width: var(--measure);
}
.card .row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.card dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; margin: 1rem 0 0; font-size: 0.9rem; }
.card dt { color: var(--muted); }
.card .tight { margin: 0; }
.card .sub { margin: 0.25rem 0 0; }
.card dd { margin: 0; }

/* ---------- prose pages ---------- */
.prose { padding: 3rem 0 4rem; max-width: var(--measure); }
.prose h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 0.5rem; }
.prose h2 { font-size: 1.25rem; margin: 2.2rem 0 0.6rem; letter-spacing: -0.01em; }
.prose p, .prose li { color: var(--ink); }
.prose .meta { color: var(--muted); margin-bottom: 2rem; }
.prose ul { padding-left: 1.2rem; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); padding: 2rem 0 3rem; color: var(--muted); font-size: 0.9rem; }
footer .row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; }
footer a { color: var(--muted); }
footer a:hover { color: var(--ink); }
