/* ============================================================
   Namily — landing for a privacy-first VPN
   Design system per DESIGN.md: research-journal aesthetic,
   warm stone, ink contrast. Light + dark themes via tokens.
   No external resources: fonts and styles are same-origin.
   ============================================================ */

/* ---------- Tokens ---------- */

/* Theme handling: native light-dark() + color-scheme.
   script.js sets html[data-theme] when the user picks a theme
   explicitly; without JS the OS preference applies (nojs mirror). */
:root {
  color-scheme: light dark;
}

html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }

:root {
  /* Core palette per DESIGN.md */
  --c-ink:      light-dark(#141413, #F0EEE9);   /* primary */
  --c-bg:       light-dark(#FAF9F6, #161513);   /* secondary — warm stone */
  --c-success:  #16A34A;
  --c-warning:  #D97706;
  --c-danger:   #DC2626;
  --c-surface:  light-dark(#FFFFFF, #1E1D1A);

  /* Derived tints for rules and secondary text */
  --c-text:       light-dark(#111827, #E5E3DD);
  --c-muted:      light-dark(rgba(17, 24, 39, 0.66), rgba(229, 227, 221, 0.66));
  --c-faint:      light-dark(rgba(20, 20, 19, 0.55), rgba(229, 227, 221, 0.48));
  --c-rule:       light-dark(rgba(20, 20, 19, 0.15), rgba(229, 227, 221, 0.17));
  --c-rule-soft:  light-dark(rgba(20, 20, 19, 0.08), rgba(229, 227, 221, 0.09));
  --c-header-bg:  light-dark(rgba(250, 249, 246, 0.92), rgba(22, 21, 19, 0.92));

  /* Semantic accents (translucent washes on both themes) */
  --c-good-bg:     light-dark(rgba(22, 163, 74, 0.05), rgba(22, 163, 74, 0.1));
  --c-good-border: light-dark(rgba(22, 163, 74, 0.32), rgba(22, 163, 74, 0.42));
  --c-bad-bg:      light-dark(rgba(220, 38, 38, 0.05), rgba(220, 38, 38, 0.1));
  --c-bad-border:  light-dark(rgba(220, 38, 38, 0.3), rgba(220, 38, 38, 0.4));
  --c-warn-bg:     light-dark(rgba(217, 119, 6, 0.05), rgba(217, 119, 6, 0.1));
  --c-warn-border: light-dark(rgba(217, 119, 6, 0.35), rgba(217, 119, 6, 0.45));
  --c-highlight:   light-dark(rgba(22, 163, 74, 0.16), rgba(22, 163, 74, 0.22));

  /* Typography: "Anthropic Sans" is not publicly available —
     Inter is the closest open analog, then system fonts */
  --font-sans: "Anthropic Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", monospace;

  /* Type scale 12/14/16/20/24/32 */
  --fs-12: 0.75rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-32: 2rem;

  /* Spacing scale 4/8/12/16/24/32 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* Radii 4/8 */
  --r-sm: 4px;
  --r-md: 8px;

  --container: 1100px;
  --header-h: 64px;
}

/* ---------- Base ---------- */

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

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--c-ink);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-32); }
h2 { font-size: var(--fs-24); }
h3 { font-size: var(--fs-20); font-weight: 500; }

p { margin: 0; }

a {
  color: var(--c-ink);
  text-decoration-color: var(--c-rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { text-decoration-color: var(--c-ink); }

::selection {
  background: var(--c-ink);
  color: var(--c-bg);
}

:focus-visible {
  outline: 2px solid var(--c-ink);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

code {
  font-family: var(--font-mono);
  font-size: var(--fs-14);
}

/* Skip link — visible only to keyboard users */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: var(--sp-4);
  z-index: 100;
  transform: translateY(-200%);
  background: var(--c-ink);
  color: var(--c-bg);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
}

.skip-link:focus { transform: none; }

/* ---------- Layout utilities ---------- */

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

.section {
  padding-block: calc(var(--sp-6) * 2.5);
  border-top: 1px solid var(--c-rule-soft);
  scroll-margin-top: calc(var(--header-h) + var(--sp-4));
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--sp-5) calc(var(--sp-6) * 1.5);
  align-items: end;
  margin-bottom: calc(var(--sp-6) * 1.75);
}

.section-head .lead {
  color: var(--c-muted);
  font-size: var(--fs-16);
}

/* Small caps eyebrow: "01 — The problem" */
.kicker {
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-faint);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.kicker::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--c-rule);
}

.kicker .num { color: var(--c-ink); }

/* Footnotes — the editorial journal detail */
.footnote {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-rule-soft);
  font-size: var(--fs-12);
  line-height: 1.6;
  color: var(--c-faint);
}

.footnote .mark { color: var(--c-muted); }

.mt-32 { margin-top: var(--sp-6); }

/* ---------- Header (identical on every page) ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--c-header-bg);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--c-rule);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--fs-16);
  letter-spacing: -0.01em;
  color: var(--c-ink);
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: block;
}

.brand .brand-tag {
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-faint);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex-wrap: wrap;
}

.site-nav a {
  font-size: var(--fs-14);
  color: var(--c-muted);
  text-decoration: none;
}

.site-nav a:hover { color: var(--c-ink); }

/* Separator between the internal pages and the external services
   (Cabinet / Wiki / Docs) in the header nav. */
.nav-sep {
  color: var(--c-faint);
  user-select: none;
}

.site-nav a[aria-current="page"] {
  color: var(--c-ink);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.theme-toggle {
  display: none;
}

html.js .theme-toggle {
  display: inline-flex;
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  color: var(--c-muted);
  background: transparent;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  padding: var(--sp-1) var(--sp-3);
  cursor: pointer;
}

html.js .theme-toggle:hover {
  color: var(--c-ink);
  border-color: var(--c-ink);
}

/* Menu button — only shown with JS on narrow screens */
.nav-toggle {
  display: none;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--c-ink);
  color: var(--c-bg);
}

.btn-ghost {
  border-color: var(--c-rule);
  color: var(--c-ink);
  background: transparent;
}

.btn-ghost:hover { border-color: var(--c-ink); }

.btn .arr { font-weight: 400; }

/* ---------- Hero ---------- */

.hero {
  padding-block: calc(var(--sp-6) * 3) calc(var(--sp-6) * 2.5);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: calc(var(--sp-6) * 2);
  align-items: start;
}

.hero h1 em {
  font-style: normal;
  box-shadow: inset 0 -0.32em 0 var(--c-highlight);
}

.hero-lead {
  margin-top: var(--sp-5);
  max-width: 34em;
  color: var(--c-muted);
  font-size: var(--fs-16);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

/* Side meta panel — like a journal article colophon */
.hero-aside {
  border-top: 2px solid var(--c-ink);
  padding-top: var(--sp-4);
}

.meta-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: var(--sp-4);
  padding-block: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--c-rule-soft);
  font-size: var(--fs-14);
}

.meta-row:last-of-type { border-bottom: none; }

.meta-row dt {
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-faint);
  padding-top: 2px;
}

.meta-row dd {
  margin: 0;
  color: var(--c-text);
}

.meta-row dd .ok {
  color: var(--c-success);
  font-family: var(--font-mono);
  font-size: var(--fs-14);
}

/* ---------- Comparison table (DPI) ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  background: var(--c-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-14);
  min-width: 640px;
}

thead th {
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-faint);
  text-align: left;
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--c-rule);
}

tbody td {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-rule-soft);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr.dim { color: var(--c-muted); }

.proto-name {
  font-weight: 500;
  color: var(--c-ink);
  white-space: nowrap;
}

/* Verdicts: restrained colored labels */
.verdict {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
  border: 1px solid;
  white-space: nowrap;
}

.verdict::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.verdict-bad  { color: var(--c-danger);  border-color: var(--c-bad-border);  background: var(--c-bad-bg); }
.verdict-good { color: var(--c-success); border-color: var(--c-good-border); background: var(--c-good-bg); }

tr.hl { background: var(--c-good-bg); }

/* ---------- Cards ---------- */

.cards {
  display: grid;
  gap: var(--sp-4);
}

.cards.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Full-width card directly after a card grid (e.g. the Anthrill
   financing block on the client page). */
.cards + .card { margin-top: var(--sp-4); }

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.card h3 { font-size: var(--fs-20); }

.card p { color: var(--c-muted); font-size: var(--fs-14); }

.card .card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}

.card .card-top h3 { flex: 1; }

.card .card-top .badge { margin-top: 2px; }

/* Card badge */
.badge {
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px var(--sp-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--c-rule);
  color: var(--c-muted);
  white-space: nowrap;
}

.badge-warn { color: var(--c-warning); border-color: var(--c-warn-border); background: var(--c-warn-bg); }
.badge-ok   { color: var(--c-success); border-color: var(--c-good-border); background: var(--c-good-bg); }

/* Card service line (host / project name) */
.card .service-host {
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--c-faint);
}

.card .service-host a { color: var(--c-muted); }

/* ---------- OS chips ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.chip {
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--c-ink);
  background: var(--c-bg);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-sm);
  padding: var(--sp-1) var(--sp-3);
}

/* ---------- Code block ---------- */

.code {
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  background: var(--c-surface);
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--c-rule-soft);
  background: var(--c-rule-soft);
}

.code-head .fname {
  font-size: var(--fs-14);
  color: var(--c-faint);
}

.copy-btn {
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-muted);
  background: transparent;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-sm);
  padding: 2px var(--sp-2);
  cursor: pointer;
}

.copy-btn:hover { color: var(--c-ink); border-color: var(--c-ink); }

.copy-btn[data-copied="1"] { color: var(--c-success); border-color: var(--c-good-border); }

.code pre {
  margin: 0;
  padding: var(--sp-4);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-14);
  line-height: 1.7;
  color: var(--c-text);
}

/* Hand-rolled static JSON highlighting: restrained, journal-like */
.code .k { color: var(--c-faint); }
.code .s { color: var(--c-text); }
.code .none { color: var(--c-success); font-weight: 500; }
.code .cmt { color: var(--c-faint); font-style: italic; }

/* ---------- Bold statement (logs policy) ---------- */

.literal {
  border-block: 1px solid var(--c-rule);
  padding-block: calc(var(--sp-6) * 1.5);
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  gap: calc(var(--sp-6) * 2);
  align-items: center;
}

.literal-code {
  font-family: var(--font-mono);
  font-size: var(--fs-24);
  line-height: 1.5;
  color: var(--c-ink);
}

.literal-code .none { color: var(--c-success); }

.literal-text {
  color: var(--c-muted);
  font-size: var(--fs-16);
  max-width: 34em;
}

.literal-text strong { color: var(--c-text); font-weight: 500; }

/* ---------- Pricing ---------- */

.price-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-3);
}

.price-line .price-period { font-weight: 400; }

.price {
  font-size: var(--fs-32);
  font-weight: 700;
  color: var(--c-ink);
  letter-spacing: -0.02em;
}

.price-note { color: var(--c-muted); font-size: var(--fs-14); max-width: 36em; }

.pay-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

/* ---------- Steps (CTA) ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4);
  counter-reset: step;
  margin-bottom: var(--sp-6);
}

.step {
  border-top: 2px solid var(--c-ink);
  padding-top: var(--sp-4);
}

.step::before {
  counter-increment: step;
  content: "0" counter(step);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--c-faint);
  display: block;
  margin-bottom: var(--sp-2);
}

.step h3 { font-size: var(--fs-16); margin-bottom: var(--sp-1); font-weight: 600; }

.step p { font-size: var(--fs-14); color: var(--c-muted); }

/* ---------- Site privacy band ---------- */

.site-privacy {
  border-top: 1px solid var(--c-rule);
  border-bottom: 1px solid var(--c-rule);
  padding-block: calc(var(--sp-6) * 1.5);
  background: var(--c-surface);
}

.site-privacy .list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4) calc(var(--sp-6) * 1.5);
  margin-top: var(--sp-5);
  list-style: none;
  padding: 0;
}

.site-privacy .list li {
  font-size: var(--fs-14);
  color: var(--c-muted);
  padding-left: var(--sp-4);
  position: relative;
}

.site-privacy .list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--c-faint);
}

/* ---------- CTA block ---------- */

.cta {
  padding-block: calc(var(--sp-6) * 2.5);
  text-align: left;
}

.cta h2 { max-width: 20em; }

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--c-rule);
  padding-block: calc(var(--sp-6) * 1.5) var(--sp-6);
  font-size: var(--fs-14);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: calc(var(--sp-6) * 2);
}

.footer-about p {
  margin-top: var(--sp-3);
  color: var(--c-muted);
  font-size: var(--fs-14);
  max-width: 26em;
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4) var(--sp-5);
}

.footer-nav h4 {
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-faint);
  margin-bottom: var(--sp-3);
}

.footer-nav ul { list-style: none; margin: 0; padding: 0; }

.footer-nav li { margin-bottom: var(--sp-2); }

.footer-nav a { color: var(--c-muted); text-decoration: none; font-size: var(--fs-14); }

.footer-nav a:hover { color: var(--c-ink); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: calc(var(--sp-6) * 1.5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-rule-soft);
  font-size: var(--fs-12);
  letter-spacing: 0.06em;
  color: var(--c-faint);
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .hero-grid,
  .section-head,
  .literal,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .section-head { align-items: start; }

  .cards.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .steps { grid-template-columns: 1fr; }

  .site-privacy .list { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  html.js .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-rule);
    padding: var(--sp-4) var(--sp-5) var(--sp-5);
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-3);
  }

  html.js.nav-open .site-nav { display: flex; }

  .header-inner { position: relative; }

  html.js .nav-toggle {
    display: inline-flex;
    align-items: center;
    font-size: var(--fs-14);
    color: var(--c-ink);
    background: transparent;
    border: 1px solid var(--c-rule);
    border-radius: var(--r-md);
    padding: var(--sp-1) var(--sp-3);
    cursor: pointer;
  }

  .cards.cols-2,
  .cards.cols-3 { grid-template-columns: 1fr; }

  .hero { padding-block: calc(var(--sp-6) * 1.5); }

  .footer-nav { grid-template-columns: 1fr 1fr; }
}
