/* NanoVPN — "Signal" design system (see docs/design/SIGNAL.md).
   Flat surfaces, 1px hairlines, small radii, one accent (signal amber)
   reserved for the primary action. No gradients, glows or blur. */

@font-face { font-family: "Plex Sans"; src: url("/assets/fonts/ibm-plex-sans-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("/assets/fonts/ibm-plex-sans-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("/assets/fonts/ibm-plex-sans-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/assets/fonts/ibm-plex-mono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/assets/fonts/ibm-plex-mono-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  color-scheme: light dark;
  /* Paper (light) */
  --ink: #F4F2EE;
  --surface: #FBFAF7;
  --surface-2: #EFECE6;
  --line: #DEDAD2;
  --line-2: #C9C4BA;
  --text: #16171A;
  --muted: #5C6068;
  --dim: #7E828A;
  --signal: #F2A000;
  --signal-ink: #16171A;
  --good: #2E7D4F;
  --bad: #C0392F;

  --f-sans: "Plex Sans", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", "Vazirmatn", sans-serif;
  --f-mono: "Plex Mono", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --wrap: 1120px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --t-fast: 150ms;
}
@media (prefers-color-scheme: dark) {
  :root {
    /* Graphite (dark) */
    --ink: #0E0F11;
    --surface: #17191C;
    --surface-2: #1D2024;
    --line: #24272B;
    --line-2: #34383E;
    --text: #ECEDEE;
    --muted: #8A8F98;
    --dim: #666B73;
    --signal: #FFB020;
    --signal-ink: #0E0F11;
    --good: #5DB37E;
    --bad: #E5534B;
  }
}

/* ---------- base ---------- */
*, *::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(--ink);
  color: var(--text);
  font: 400 1rem/1.6 var(--f-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: .2em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: var(--r-sm); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.15; }
h1 { font-size: clamp(2.1rem, 1.5rem + 2.6vw, 3.3rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); }
h3 { font-size: 1.05rem; letter-spacing: -0.005em; }
p { margin: 0 0 1rem; }
code, kbd { font-family: var(--f-mono); font-size: .9em; }
::selection { background: var(--signal); color: var(--signal-ink); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.eyebrow, .label {
  font: 500 .72rem/1.2 var(--f-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 1rem;
}
[dir="rtl"] .eyebrow, [dir="rtl"] .label { letter-spacing: 0; }

/* legacy decorative hooks from the previous design are neutralised */
.glow, canvas.mesh { display: none !important; }
.grad { color: inherit; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 44px; padding: .6rem 1.1rem;
  font: 600 .95rem/1 var(--f-sans);
  color: var(--signal-ink); background: var(--signal);
  border: 1px solid var(--signal); border-radius: var(--r-md);
  text-decoration: none; white-space: nowrap;
  transition: filter var(--t-fast) ease;
}
.btn:hover { filter: brightness(1.06); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.ghost, .btn.secondary { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover, .btn.secondary:hover { filter: none; border-color: var(--muted); }
.btn.sm { min-height: 36px; padding: .45rem .85rem; font-size: .88rem; }

/* ---------- header ---------- */
header.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand .mark { width: 22px; height: 22px; color: var(--text); }
.brand img { width: 22px; height: 22px; }
.nav { display: flex; align-items: center; gap: 1.6rem; font-size: .92rem; }
.nav a:not(.btn) { color: var(--muted); text-decoration: none; }
.nav a:not(.btn):hover, .nav a[aria-current="page"] { color: var(--text); }
@media (max-width: 720px) { .nav a:not(.btn) { display: none; } }

/* ---------- sections ---------- */
section.block { padding-block: clamp(3.5rem, 2.5rem + 4vw, 6rem); border-top: 1px solid var(--line); }
main > section.block:first-child, .doc-hero + section.block { border-top: 0; }
.head { max-width: 40rem; margin-bottom: 2.5rem; }
.head h2 { margin-bottom: .9rem; }
.head p { color: var(--muted); }
.head.center { margin-inline: auto; text-align: center; }

/* ---------- hero ---------- */
.hero { padding-block: clamp(2.5rem, 1.5rem + 5vw, 5.5rem) clamp(3rem, 2rem + 4vw, 5rem); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.hero h1 { margin-bottom: 1.25rem; max-width: 15ch; }
.hero .lede { font-size: 1.12rem; color: var(--muted); max-width: 34rem; margin-bottom: 2rem; }
.cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 2rem; }
.facts { display: flex; flex-wrap: wrap; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); max-width: 34rem; }
.facts li { flex: 1 1 33%; min-width: 9rem; padding: .9rem 0 0; font-size: .9rem; color: var(--muted); }
.facts b { display: block; font: 500 .72rem/1.2 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: .35rem; }
@media (max-width: 880px) {
  .hero .wrap { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { max-width: none; }
}

/* device frame holding a live recreation of the app's Connect screen (hero.js);
   the static screenshot inside .fallback is only shown without JavaScript. */
.device {
  justify-self: center;
  width: min(100%, 352px);
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 34px;
}
.device .screen { position: relative; aspect-ratio: 390 / 844; overflow: hidden; border-radius: 25px; border: 1px solid var(--line); background: var(--ink); }
.device .fallback img { width: 100%; height: 100%; object-fit: cover; }
.js .device .fallback, html:not(.js) .device .app, html:not(.js) .device .a-hit { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The app screen is laid out in Android dp at 390 x 844 (the reference phone)
   and scaled to the frame by hero.js through --k. Values mirror
   apps/mobile/lib/features/home/home_screen.dart and the Signal tokens. */
.app {
  --disc: var(--surface-2);
  --land: var(--text);
  position: absolute; top: 0; left: 0; width: 390px; height: 844px;
  transform: scale(var(--k, .7615)); transform-origin: 0 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 20px 0;
  color: var(--text); background: var(--ink);
  font: 400 14px/1.55 var(--f-sans);
  -webkit-user-select: none; user-select: none;
}
@media (prefers-color-scheme: dark) { .app { --disc: #363A40; --land: #0A0B0C; } }
.app svg { fill: currentColor; flex: none; }
.a-head { position: relative; width: 100%; height: 48px; display: flex; align-items: center; justify-content: center; }
.a-menu { position: absolute; left: 12px; top: 12px; width: 24px; height: 24px; }
.a-brand { display: inline-flex; align-items: center; gap: 10px; font: 600 17px/1.25 var(--f-sans); letter-spacing: -0.17px; }
.a-brand svg { width: 20px; height: 20px; }
.a-globe { width: 264px; height: 264px; margin-top: 40px; transition: transform var(--t-fast) ease-out; }
.a-globe.down { transform: scale(.97); }
.a-state { margin-top: 8px; display: flex; align-items: center; gap: 8px; font: 600 17px/1.25 var(--f-sans); letter-spacing: -0.17px; }
.a-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); display: none; }
.a-state.on .a-dot { display: block; }
.a-tag { margin-top: 8px; padding: 3px 8px; border: 1px solid var(--line-2); border-radius: 4px; font: 400 11px/1.4 var(--f-mono); letter-spacing: .5px; color: var(--muted); }
.a-timer { margin-top: 14px; font: 400 12.5px/1.4 var(--f-mono); color: var(--muted); white-space: nowrap; }
.a-swap { animation: a-fade 200ms ease-out; }
@keyframes a-fade { from { opacity: 0; } to { opacity: 1; } }
.a-card { align-self: stretch; margin-top: 20px; padding: 14px 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.a-card-t { font: 600 14px/1.3 var(--f-sans); }
.a-loc { margin-top: 13px; display: flex; align-items: center; }
.a-flag { width: 26px; display: flex; justify-content: center; }
.a-flag svg { width: 20px; height: 15px; border-radius: 2px; }
.a-city { flex: 1; min-width: 0; margin: 0 8px 0 10px; display: flex; flex-direction: column; }
.a-city b { font: 600 13px/1.3 var(--f-sans); }
.a-city small { margin-top: 2px; font: 400 11.5px/1.5 var(--f-sans); color: var(--dim); }
.a-badge { padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; font: 400 11px/1.4 var(--f-mono); letter-spacing: .5px; color: var(--muted); white-space: nowrap; }
.a-chev { width: 24px; height: 24px; margin-left: 4px; color: var(--dim); }
.a-stats { align-self: stretch; margin-top: 12px; padding: 14px 0; display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.a-stats[hidden] { display: none; }
.a-stats > div { flex: 1; display: flex; flex-direction: column; align-items: center; }
.a-stats > div + div { border-left: 1px solid var(--line); }
.a-ov { display: inline-flex; align-items: center; gap: 4px; font: 500 10.5px/1.2 var(--f-mono); letter-spacing: 1.05px; color: var(--dim); }
.a-ov svg { width: 13px; height: 13px; color: var(--muted); }
.a-stats b { margin-top: 6px; font: 500 20px/1.2 var(--f-mono); }
.a-nav { position: absolute; left: 0; right: 0; bottom: 0; height: 58px; display: flex; background: var(--surface); border-top: 1px solid var(--line); }
.a-nav span { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: 500 11px/1.2 var(--f-sans); color: var(--dim); }
.a-nav span.on { color: var(--text); font-weight: 600; }
.a-nav span.on::before { content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 2px; margin-left: -14px; background: var(--text); }
.a-nav svg { width: 22px; height: 22px; }
/* hit target = the globe plus its ring (176 + 24 dp), centred on the globe */
.a-hit {
  position: absolute; left: 50%; top: calc(233 / 844 * 100%); width: calc(200 / 390 * 100%); aspect-ratio: 1;
  transform: translate(-50%, -50%); margin: 0; padding: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; touch-action: pan-y; -webkit-tap-highlight-color: transparent;
}
.a-hit:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 50%; }
.device figcaption { font: 400 .72rem/1.3 var(--f-mono); letter-spacing: .06em; color: var(--dim); text-align: center; padding: .8rem 0 .2rem; text-transform: uppercase; }

/* ---------- feature spec list ---------- */
.spec { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.spec article { padding: 1.6rem 1.6rem 1.6rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 0 .9rem; }
.spec article:nth-child(odd) { border-inline-end: 1px solid var(--line); }
.spec article:nth-child(even) { padding-inline-start: 1.6rem; }
.spec .n { font: 500 .78rem/1.6 var(--f-mono); color: var(--dim); padding-top: .1rem; }
.spec h3 { margin-bottom: .45rem; }
.spec p { color: var(--muted); margin: 0; font-size: .95rem; }
@media (max-width: 760px) {
  .spec { grid-template-columns: minmax(0, 1fr); }
  .spec article, .spec article:nth-child(odd), .spec article:nth-child(even) { padding-inline: 0; border-inline-end: 0; }
}

/* ---------- protocol table & generic tables ---------- */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.4rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; min-width: 520px; }
th, td { text-align: start; padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font: 500 .72rem/1.2 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); background: var(--surface-2); }
td code, td .mono { font-family: var(--f-mono); font-size: .88em; }

/* ---------- privacy ledger ---------- */
.ledger { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.ledger .col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.5rem; }
.ledger h3 { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.ledger h3 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.ledger .kept h3 .dot { background: var(--muted); }
.ledger ul { list-style: none; margin: 0; padding: 0; }
.ledger li { padding: .65rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.ledger li:first-child { border-top: 0; padding-top: 0; }
@media (max-width: 760px) { .ledger { grid-template-columns: minmax(0, 1fr); } }

/* ---------- steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; counter-reset: step; border-top: 1px solid var(--line); }
.step { padding: 1.4rem 1.4rem 0 0; counter-increment: step; }
.step::before { content: "0" counter(step); display: block; font: 500 .78rem/1 var(--f-mono); color: var(--dim); margin-bottom: 1rem; }
.step h3 { margin-bottom: .45rem; }
.step p { color: var(--muted); margin: 0; font-size: .95rem; }
@media (max-width: 760px) { .steps { grid-template-columns: minmax(0, 1fr); } .step { padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); } }

/* ---------- download ---------- */
.download { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.dl h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.dl p { color: var(--muted); margin: 0; font-size: .95rem; }
.dl .btn { align-self: flex-start; }
.dl dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .5rem 1rem; font-size: .88rem; }
.dl dt { font: 500 .72rem/1.6 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.dl dd { margin: 0; font-family: var(--f-mono); overflow-wrap: anywhere; color: var(--text); }
.tag { font: 500 .7rem/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: .3rem .45rem; white-space: nowrap; }
@media (max-width: 760px) { .download { grid-template-columns: minmax(0, 1fr); } }

/* ---------- languages ---------- */
.langs { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.langs span { border: 1px solid var(--line); border-radius: var(--r-sm); padding: .35rem .7rem; font-size: .92rem; color: var(--muted); background: var(--surface); }

/* ---------- FAQ ---------- */
.faq { border-top: 1px solid var(--line); max-width: 48rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 0; font-weight: 600; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 1.2rem/1 var(--f-mono); color: var(--dim); }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { color: var(--muted); margin: 0 0 1.2rem; max-width: 42rem; }

/* ---------- cards (support / delete-account) ---------- */
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem; }
.bento > .card { grid-column: span 2; }
.bento > .card.wide { grid-column: span 3; }
.cards-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.4rem; }
.card h3 { margin: .9rem 0 .5rem; }
.card p { color: var(--muted); margin: 0; font-size: .95rem; }
.card .ico { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: var(--r-md); color: var(--text); }
.card .ico svg { width: 18px; height: 18px; stroke-width: 1.6; }
.card .mail { font-family: var(--f-mono); font-size: .92em; color: var(--text); }
ol.big { margin: 1rem 0 0; padding: 0; list-style: none; counter-reset: big; display: grid; gap: .8rem; }
ol.big li { counter-increment: big; display: grid; grid-template-columns: 1.8rem minmax(0, 1fr); gap: .6rem; color: var(--muted); }
ol.big li::before { content: counter(big); font: 500 .8rem/1.7 var(--f-mono); color: var(--text); width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: var(--r-sm); }
@media (max-width: 900px) { .bento { grid-template-columns: minmax(0, 1fr); } .bento > .card, .bento > .card.wide { grid-column: auto; } }
@media (max-width: 760px) { .cards-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- documents (privacy / terms) ---------- */
.doc-hero { padding: clamp(2.5rem, 2rem + 3vw, 4rem) 0 2rem; border-bottom: 1px solid var(--line); }
.doc-hero h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 3rem); margin: 0 0 .8rem; }
.doc-hero p { color: var(--muted); margin: 0; }
.doc { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 3.5rem; padding-top: 3rem; padding-bottom: 4rem; }
.toc { position: sticky; top: 88px; align-self: start; font-size: .88rem; }
.toc p { font: 500 .72rem/1.2 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin: 0 0 .8rem; }
.toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: .1rem; border-inline-start: 1px solid var(--line); }
.toc a { display: block; padding: .25rem 0 .25rem .9rem; color: var(--muted); text-decoration: none; }
[dir="rtl"] .toc a { padding: .25rem .9rem .25rem 0; }
.toc a:hover { color: var(--text); }
@media (max-width: 900px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .toc { position: static; padding: 1.1rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
}
.prose { max-width: 46rem; }
.prose section { margin-bottom: 2.6rem; scroll-margin-top: 88px; }
.prose h2 { font-size: 1.35rem; margin-bottom: .9rem; }
.prose h3 { font-size: 1.02rem; margin: 1.4rem 0 .5rem; }
.prose p, .prose li { color: var(--muted); }
.prose ul, .prose ol { padding-inline-start: 1.2rem; }
.prose li { margin-bottom: .4rem; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--text); }
.prose code { background: var(--surface-2); padding: .1em .35em; border-radius: var(--r-sm); }

/* ---------- footer ---------- */
footer.site { border-top: 1px solid var(--line); margin-top: 0; padding-top: 3rem; font-size: .9rem; }
footer.site > .wrap { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 2rem; padding-bottom: 2.5rem; }
footer.site address { font-style: normal; color: var(--muted); margin-top: 1rem; line-height: 1.6; }
footer.site h4 { font: 500 .72rem/1.2 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: .9rem; }
footer.site ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
footer.site ul a { color: var(--muted); text-decoration: none; }
footer.site ul a:hover, footer.site ul a[aria-current="page"] { color: var(--text); }
.legal-line { border-top: 1px solid var(--line); padding: 1.1rem 0 1.4rem; color: var(--dim); font-size: .8rem; }
.legal-line .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; }
@media (max-width: 760px) { footer.site > .wrap { grid-template-columns: 1fr 1fr; } footer.site .about { grid-column: 1 / -1; } }
