/* meshvpn website.
   Layout: a lab-bench grid. Wide pages have a 12-column body with a measured text column; tutorials put a
   sticky step list beside the text. Color: the grey-green of an ESD bench mat, a deep teal for links and
   actions, amber only for booking states (the one thing that is "taken"). Type: Archivo (expanded, the
   lettering of instrument panels) for display, IBM Plex Sans for text, IBM Plex Mono for commands. */
:root {
  --bg: #f2f5f3;
  --bg-2: #e8ede9;
  --card: #fbfcfb;
  --fg: #12201c;
  --muted: #586a64;
  --line: #d3dcd7;
  --accent: #0b6b5c;
  --accent-ink: #ffffff;
  --accent-soft: #d6ebe5;
  --amber: #c96a1c;
  --amber-soft: #f6e3d0;
  --code-bg: #14211d;
  --code-fg: #dfeae5;
  --code-dim: #8fa69e;
  --code-hl: #7fd6c2;
  --ok: #1e7f4f;

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --text: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --s-1: 0.8125rem;  /* captions, labels */
  --s0: 1rem;        /* body */
  --s1: 1.1875rem;   /* lead */
  --s2: 1.5rem;      /* h3 */
  --s3: 2rem;        /* h2 */
  --s4: clamp(2.4rem, 5.2vw, 3.9rem); /* h1 */

  --wrap: 1180px;
  --measure: 68ch;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1513; --bg-2: #131c19; --card: #16201d; --fg: #e2eae6; --muted: #93a59f; --line: #263430;
    --accent: #45c2a8; --accent-ink: #06231d; --accent-soft: #173a33; --amber: #f0a055; --amber-soft: #3d2a17;
    --code-bg: #0a100e; --code-fg: #dfeae5; --code-dim: #7d948c; --code-hl: #7fd6c2; --ok: #4cc58a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1513; --bg-2: #131c19; --card: #16201d; --fg: #e2eae6; --muted: #93a59f; --line: #263430;
  --accent: #45c2a8; --accent-ink: #06231d; --accent-soft: #173a33; --amber: #f0a055; --amber-soft: #3d2a17;
  --code-bg: #0a100e; --code-fg: #dfeae5; --code-dim: #7d948c; --code-hl: #7fd6c2; --ok: #4cc58a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 var(--s0)/1.6 var(--text);
  padding-inline: 16px;
}
img, svg, canvas { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.12; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--s4); font-weight: 800; font-stretch: 112%; }
h2 { font-size: var(--s3); font-weight: 750; font-stretch: 108%; }
h3 { font-size: var(--s2); font-weight: 700; font-stretch: 104%; }
h4 { font-size: var(--s1); font-weight: 700; }
p { margin: 0; }
code, kbd { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code { background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px; padding: 0.05em 0.35em; overflow-wrap: anywhere; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.35em; background: var(--card); }
.wrap { max-width: var(--wrap); margin-inline: auto; }
.eyebrow { font: 600 var(--s-1)/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.lead { font-size: var(--s1); color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 1rem; }
.stack-lg { display: grid; gap: 1.6rem; }

/* Header */
.site-head {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  margin-inline: -16px; padding-inline: 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; gap: 1.25rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--fg); text-decoration: none; font: 800 1.15rem/1 var(--display); font-stretch: 115%; }
.brand svg { width: 28px; height: 28px; }
.brand small { font: 500 var(--s-1)/1 var(--mono); color: var(--muted); letter-spacing: 0.02em; }
.nav { display: flex; gap: 0.15rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--fg); text-decoration: none; padding: 0.45rem 0.7rem; border-radius: var(--radius); font-weight: 500; }
.nav a:hover { background: var(--bg-2); }
.nav a[aria-current="page"] { color: var(--accent); }
.nav .gh { font-family: var(--mono); font-size: var(--s-1); border: 1px solid var(--line); }
.theme-btn, .menu-btn { background: none; border: 1px solid var(--line); color: var(--fg); border-radius: var(--radius); width: 38px; height: 38px; cursor: pointer; display: grid; place-items: center; }
.theme-btn svg, .menu-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; margin-left: auto; }
@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 64px; flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); padding: 0.5rem 16px 1rem; }
  .nav.open { display: flex; }
  .nav a { padding: 0.7rem 0.5rem; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.1rem; border-radius: var(--radius); font-weight: 600; text-decoration: none; border: 1px solid var(--line); color: var(--fg); background: var(--card); }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* Sections */
section { padding-block: clamp(3rem, 7vw, 5.5rem); }
section + section { border-top: 1px solid var(--line); }
.section-head { display: grid; gap: 0.8rem; margin-bottom: 2.2rem; max-width: 62ch; }

/* Code blocks */
.code { position: relative; background: var(--code-bg); color: var(--code-fg); border-radius: var(--radius); min-width: 0; }
.code pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; font: 400 0.875rem/1.65 var(--mono); }
.code .c { color: var(--code-dim); }
.code .p { color: var(--code-hl); user-select: none; }
.code .o { color: var(--code-dim); }
.code .label { position: absolute; top: 0; left: 1.1rem; transform: translateY(-50%); font: 600 0.6875rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; background: var(--accent); color: var(--accent-ink); padding: 0.3rem 0.5rem; border-radius: 3px; }
.code .label + pre { padding-top: 1.35rem; }
.copy { position: absolute; top: 0.5rem; right: 0.5rem; font: 500 0.75rem/1 var(--mono); color: var(--code-dim); background: transparent; border: 1px solid color-mix(in srgb, var(--code-dim) 45%, transparent); border-radius: 4px; padding: 0.35rem 0.5rem; cursor: pointer; }
.copy:hover { color: var(--code-fg); border-color: var(--code-fg); }

/* Grids */
.grid { display: grid; gap: 1.25rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.grid > * { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; display: grid; gap: 0.6rem; align-content: start; }
.card h3 { font-size: var(--s1); }
.card .tag { justify-self: start; }
a.card { color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--accent); }
a.card .more { color: var(--accent); font-weight: 600; margin-top: 0.3rem; }
.tag { display: inline-block; font: 600 0.6875rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; padding: 0.3rem 0.45rem; border-radius: 3px; background: var(--accent-soft); color: var(--accent); }
.tag.ent { background: var(--amber-soft); color: var(--amber); }

/* Feature list with leading mark */
.feat { display: grid; gap: 0.4rem; padding-top: 1rem; border-top: 2px solid var(--fg); }
.feat h3 { font-size: var(--s1); }
.feat p { color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 600 var(--s-1)/1.3 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* Prose (tutorials, docs) */
.prose { max-width: var(--measure); display: grid; gap: 1.1rem; }
.prose h2 { font-size: var(--s2); margin-top: 1.6rem; }
.prose h3 { font-size: var(--s1); margin-top: 0.8rem; }
.prose ul, .prose ol { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.4rem; }
.note { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 0.85rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; }
.note.warn { border-color: var(--amber); background: var(--amber-soft); }
.note strong:first-child { font-family: var(--display); }

/* Page hero for inner pages */
.page-hero { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 2.5rem); display: grid; gap: 1rem; }
.page-hero + section { border-top: 1px solid var(--line); }

/* Tutorial layout: steps beside the text */
.tut { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 3rem; padding-block: 2.5rem 4rem; }
.tut-nav { position: sticky; top: calc(84px + env(safe-area-inset-top, 0px)); align-self: start; display: grid; gap: 0.2rem; font-size: 0.9375rem; }
.tut-nav a { color: var(--muted); text-decoration: none; padding: 0.3rem 0 0.3rem 0.8rem; border-left: 2px solid var(--line); }
.tut-nav a:hover, .tut-nav a.on { color: var(--fg); border-left-color: var(--accent); }
.tut-nav .eyebrow { margin-bottom: 0.5rem; }
.step { display: grid; gap: 1rem; }
.step-n { font: 700 var(--s-1)/1 var(--mono); color: var(--accent); letter-spacing: 0.06em; margin-bottom: -0.5rem; }
.prose .step > h2 { margin-top: 0; }
.meta-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; font: 500 var(--s-1)/1.4 var(--mono); color: var(--muted); }
@media (max-width: 900px) { .tut { grid-template-columns: 1fr; gap: 1.5rem; } .tut-nav { position: static; } }
.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 1.5rem; margin-top: 1rem; }

/* Footer */
.site-foot { border-top: 1px solid var(--line); margin-inline: -16px; padding: 3rem 16px 2.5rem; background: var(--bg-2); }
.site-foot .wrap { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 2rem; }
.site-foot h4 { font: 600 var(--s-1)/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.8rem; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.site-foot a { color: var(--fg); text-decoration: none; }
.site-foot a:hover { color: var(--accent); }
.site-foot .fine { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 1.2rem; color: var(--muted); font-size: var(--s-1); display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
@media (max-width: 760px) { .site-foot .wrap { grid-template-columns: 1fr 1fr; } .site-foot .wrap > :first-child { grid-column: 1 / -1; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.prose section, .step { padding: 0; border: 0; }
section.step + section.step { border-top: 0; padding-top: 1rem; }

/* Landing page */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; padding-block: clamp(2.5rem, 6vw, 5rem); }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .stack-lg { align-content: center; }
@media (max-width: 960px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.hero > * { min-width: 0; }

/* The booking board: devices down, hours across */
.board { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); font: 600 var(--s-1)/1.2 var(--mono); color: var(--muted); }
.board-head b { color: var(--fg); }
.board-body { padding: 0.75rem 1rem 1rem; overflow-x: auto; }
.lanes { display: grid; grid-template-columns: 112px minmax(260px, 1fr); row-gap: 0.45rem; column-gap: 0.75rem; font: 500 0.8125rem/1 var(--mono); }
.lanes .hours { display: grid; grid-template-columns: repeat(12, 1fr); color: var(--muted); font-size: 0.6875rem; }
.lanes .dev { display: flex; align-items: center; gap: 0.45rem; white-space: nowrap; }
.lanes .dev i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.lanes .dev i.off { background: var(--line); }
.lane { position: relative; height: 26px; background: repeating-linear-gradient(90deg, var(--bg-2) 0 calc(100% / 12 - 1px), var(--line) calc(100% / 12 - 1px) calc(100% / 12)); border-radius: 3px; }
.bk { position: absolute; top: 3px; bottom: 3px; border-radius: 3px; display: flex; align-items: center; padding-inline: 0.45rem; font-size: 0.6875rem; overflow: hidden; white-space: nowrap; color: var(--accent-ink); background: var(--accent); }
.bk.shared { background: repeating-linear-gradient(135deg, var(--accent) 0 6px, color-mix(in srgb, var(--accent) 78%, var(--card)) 6px 12px); }
.bk.agent { background: var(--amber); color: #fff; }
.now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--fg); left: 33.3%; }
.board .code { border-radius: 0; }
.board .code pre { font-size: 0.8125rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; padding: 0 1rem 0.9rem; font: 500 0.6875rem/1 var(--mono); color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.35rem; vertical-align: -1px; background: var(--accent); }
.legend .s::before { background: repeating-linear-gradient(135deg, var(--accent) 0 3px, var(--accent-soft) 3px 6px); }
.legend .a::before { background: var(--amber); }

.editions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1.25rem; }
.edition { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; display: grid; gap: 0.9rem; background: var(--card); align-content: start; }
.edition.ent { border-color: var(--amber); }
.edition ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.35rem; }
.diagram { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; overflow-x: auto; }
.diagram svg { display: block; min-width: 620px; width: 100%; height: auto; }
.diagram text { font-family: var(--mono); font-size: 12px; fill: var(--fg); }
.diagram .dim { fill: var(--muted); }
.steps3 { counter-reset: s; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.steps3 > div { display: grid; gap: 0.6rem; align-content: start; min-width: 0; }
.steps3 > div::before { counter-increment: s; content: counter(s); font: 800 2.4rem/1 var(--display); color: var(--accent); }
.quote-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 1rem; }
.fact { display: grid; gap: 0.25rem; }
.fact b { font: 800 1.9rem/1 var(--display); font-stretch: 110%; }
.fact span { color: var(--muted); font-size: 0.9375rem; }

/* Pricing */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1rem; }
.plan { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; display: grid; gap: 0.7rem; grid-template-rows: auto auto auto auto 1fr auto; min-width: 0; }
.plan.featured { border: 2px solid var(--accent); }
.plan .tag { justify-self: start; }
.plan h3 { font-size: var(--s1); }
.price { font: 800 2rem/1.1 var(--display); font-stretch: 108%; }
.price small { font: 500 var(--s-1)/1 var(--text); color: var(--muted); }
.plan ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.35rem; align-content: start; font-size: 0.9375rem; }
.plan .btn { justify-content: center; }
.faq { display: grid; gap: 0.6rem; max-width: 80ch; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 0.9rem 1.1rem; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin-top: 0.6rem; color: var(--muted); }

/* Tabs (download) */
.tabs { display: flex; gap: 0.4rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.tab { font: 600 var(--s0)/1 var(--text); color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.8rem 0.4rem; margin-bottom: -1px; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tabpanel { padding-bottom: 3rem; }
.legend .n::before { width: 2px; background: var(--fg); }

/* Developer experience section; queued jobs on the board */
.ws { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(2rem, 4vw, 3.5rem); align-items: start; }
@media (max-width: 960px) { .ws { grid-template-columns: minmax(0, 1fr); } }
.bk.job { background: var(--accent-soft); color: var(--accent); border: 1px dashed var(--accent); }
.legend .j::before { background: var(--accent-soft); outline: 1px dashed var(--accent); outline-offset: -1px; }

/* Version comparison */
.compare td.y { color: var(--accent); font-weight: 700; text-align: center; }
.compare td.n { color: var(--muted); text-align: center; }
.compare th:not(:first-child), .compare td:not(:first-child) { text-align: center; }
.compare tr.grp td { font: 600 var(--s-1)/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); }
.compare td:first-child { min-width: 260px; }

/* Trial application */
.trial-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 2rem; align-items: start; margin: 1rem 0 4rem; }
@media (max-width: 860px) { .trial-grid { grid-template-columns: minmax(0, 1fr); } }
.apply { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.apply .field { margin-bottom: 1.1rem; }
.apply label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.apply input, .apply textarea { width: 100%; box-sizing: border-box; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.7rem; }
.apply input:focus, .apply textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.apply input:disabled, .apply textarea:disabled { opacity: 0.6; }
.apply .hint { font-size: var(--s-1); color: var(--muted); margin: 0.35rem 0 0; }
.apply .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.apply button[disabled] { opacity: 0.6; cursor: progress; }
.form-msg { min-height: 1.5em; margin: 0.8rem 0 0; font-weight: 600; }
.form-msg.ok { color: var(--accent); }
.form-msg.bad { color: var(--amber); }
.trial-next { padding: 0.5rem 0; }
.trial-next h3 { margin-top: 0; }
.steps-mini { padding-left: 1.2rem; }
.steps-mini li { margin-bottom: 0.9rem; }
.steps-mini .code { margin: 0.5rem 0; }
.nav .trial-cta { background: var(--accent); color: var(--accent-ink); }
.nav .trial-cta:hover { background: var(--accent); filter: brightness(1.08); }

/* Changelog page */
.changelog .release { display: grid; gap: 0.8rem; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.changelog .release h2 { margin-top: 0; }
.changelog .release h2 a { color: inherit; text-decoration: none; }
.changelog .release h2 .muted { font-size: var(--s0); font-weight: 400; margin-left: 0.4rem; }
.changelog .release h3 { margin-top: 0.4rem; }
.diagram.fit { overflow: visible; }
.diagram.fit svg { min-width: 0; }
