/* ==========================================================================
   Packet.io components — v2 (editorial)
   Built only from tokens.css. Each block maps to a section in STYLE_GUIDE.md.
   ========================================================================== */

/* ---- Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: var(--body);
  font-size: var(--fs-body);
  line-height: 1.6;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01", "ss03";
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
p { color: var(--muted); }
h1, h2, h3, h4 { color: var(--ink); font-weight: var(--w-title); }
ul, ol { list-style: none; }
::selection { background: var(--tint); color: var(--deep); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

.container { width: min(var(--container), calc(100% - var(--gutter) * 2)); margin-inline: auto; position: relative; }
.container--wide { width: min(var(--container-wide), calc(100% - var(--gutter) * 2)); margin-inline: auto; position: relative; }
.section { padding-block: var(--section-y); position: relative; }
.section + .section { padding-top: 0; }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap); }

/* ---- Typography --------------------------------------------------------- */
.display {
  font-family: var(--display);
  font-size: var(--fs-display);
  font-weight: var(--w-display);
  line-height: 1;
  letter-spacing: -.038em;
}
.display .soft { color: var(--faint); }   /* use once per page: the hero */
.h2 {
  font-family: var(--display);
  font-size: var(--fs-h2);
  font-weight: var(--w-head);
  line-height: 1.04;
  letter-spacing: -.032em;
  text-wrap: balance;
}
.h3 {
  font-family: var(--display);
  font-size: var(--fs-h3);
  font-weight: var(--w-title);
  line-height: 1.2;
  letter-spacing: -.015em;
}
.lede { font-size: var(--fs-lede); line-height: 1.55; color: var(--muted); max-width: 40em; text-wrap: pretty; }
.small { font-size: var(--fs-small); }
.mono { font-family: var(--mono); }

/* Eyebrow: section index + name, mono, grey. Never blue. */
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: var(--fs-mono); font-weight: 500;
  text-transform: uppercase; letter-spacing: .12em; color: var(--faint);
}
.eyebrow b { font-weight: 500; color: var(--ink); display: inline-flex; align-items: center; gap: 12px; }
.eyebrow b::after { content: ""; width: 24px; height: 1px; background: var(--rule-strong); }

/* Mono label: small uppercase meta */
.label { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 500; }
.label--signal { color: var(--signal); }

/* Inline code / raw tag */
code, .tag {
  font-family: var(--mono); font-size: .84em; font-weight: 500;
  background: var(--tint); color: var(--deep);
  padding: 2px 6px; border-radius: var(--r-xs); white-space: nowrap;
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 44px; padding: 0 18px; border-radius: var(--r-md);
  font: 500 15px/1 var(--body); letter-spacing: -.005em; cursor: pointer; white-space: nowrap;
  border: 1px solid transparent;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1);
}
.btn svg { width: 14px; height: 14px; transition: transform var(--dur-2) var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #242a33; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--signal { background: var(--signal); color: #fff; }
.btn--signal:hover { background: var(--signal-hover); }
.btn--light { background: #fff; color: var(--ink); }
.btn--light:hover { background: var(--tint); }
.btn--sm { height: 36px; padding: 0 14px; font-size: 13.5px; }

.link { color: var(--ink); font-weight: 500; display: inline-flex; gap: 6px; align-items: center; border-bottom: 1px solid var(--rule-strong); padding-bottom: 2px; transition: border-color var(--dur-1); }
.link:hover { border-color: var(--ink); }

/* ---- Chips -------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--muted);
  padding: 5px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--rule); background: var(--panel);
}
.chip--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); }
.chip--ok::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.chip--tint { background: var(--tint); border-color: transparent; color: var(--deep); }

/* ---- Surfaces ----------------------------------------------------------- */
.card {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-lg);
  padding: var(--s-6); transition: border-color var(--dur-2);
}
.card--hover:hover { border-color: var(--rule-strong); }

.panel-grid {
  display: grid; background: var(--rule); gap: 1px;
  border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden;
}
.panel-grid > * { background: var(--panel); padding: var(--s-6); }

.frame { position: relative; border-radius: var(--r-xl); padding: 6px; background: var(--panel); border: 1px solid var(--rule); box-shadow: var(--shadow-3); }
.frame img { border-radius: calc(var(--r-xl) - 6px); }

.float {
  position: absolute; z-index: 2;
  background: rgba(255,255,255,.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--rule); border-radius: var(--r-md);
  box-shadow: var(--shadow-2); padding: 10px 12px; font-size: 13px;
}

/* Hairline grid texture — hero and dark band only */
.hairgrid {
  background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 80px 80px;
}

/* ---- Section head: index left, statement right -------------------------- */
.sh { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap); margin-bottom: clamp(48px, 6vw, 88px); }
.sh .eyebrow { grid-column: 1 / span 3; align-self: start; padding-top: .9em; }
.sh__body { grid-column: 4 / -1; }
.sh .lede { margin-top: 24px; }

/* ---- Stats -------------------------------------------------------------- */
.stat__value { font-family: var(--display); font-size: clamp(40px, 4.4vw, 60px); font-weight: var(--w-head); letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__label { margin-top: 10px; font-size: 14px; color: var(--muted); }

/* ---- Dark band ---------------------------------------------------------- */
.band-night { background: var(--night); color: var(--night-text); position: relative; isolation: isolate; overflow: hidden; }
.band-night::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: linear-gradient(var(--night-rule) 1px, transparent 1px), linear-gradient(90deg, var(--night-rule) 1px, transparent 1px);
  background-size: 80px 80px; background-position: center top;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%); mask-image: linear-gradient(180deg, #000, transparent 70%);
  opacity: .6;
}
.band-night h2, .band-night h3, .band-night h4 { color: #fff; }
.band-night p { color: var(--night-muted); }
.band-night .eyebrow { color: var(--night-muted); }
.band-night .eyebrow b { color: #fff; }
.band-night .eyebrow b::after { background: rgba(255,255,255,.2); }

/* ---- Nav ---------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,251,249,.82); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid transparent; transition: border-color var(--dur-2);
}
.nav.is-scrolled { border-bottom-color: var(--rule); }
.nav.is-dark { background: rgba(11,14,19,.78); border-bottom-color: var(--night-rule); }
.nav.is-dark .brand { color: #fff; }
.nav.is-dark .nav__links a { color: var(--night-muted); }
.nav.is-dark .nav__links a:hover { color: #fff; }
.nav, .nav .brand, .nav__links a { transition: background var(--dur-2), border-color var(--dur-2), color var(--dur-2); }
.nav__inner { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: -.02em; }
.brand img { width: 24px; height: 24px; border-radius: 6px; }
.nav__links { display: flex; align-items: center; gap: 32px; font-size: 14px; }
.nav__links a { color: var(--muted); transition: color var(--dur-1); }
.nav__links a:hover { color: var(--ink); }

/* ---- Footer ------------------------------------------------------------- */
.footer { border-top: 1px solid var(--rule); padding: 64px 0 32px; }
.footer__top { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--col-gap); row-gap: 40px; }
.footer__brand { grid-column: 1 / span 5; }
.footer__brand p { margin-top: 14px; font-size: 14px; max-width: 26em; }
.footer__col { grid-column: span 2; }
.footer__col .label { display: block; margin-bottom: 14px; }
.footer__col li { font-size: 14px; color: var(--muted); line-height: 2; }
.footer__col a:hover { color: var(--ink); }
.footer__bottom { margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---- Motion (opt-in; only for elements that earn it) -------------------- */
.reveal { opacity: 0; transition: opacity var(--dur-3) var(--ease); transition-delay: var(--d, 0s); }
.reveal.is-in { opacity: 1; }
.pulse { position: relative; }
.pulse::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid currentColor; animation: pulse 2s var(--ease) infinite; }
@keyframes pulse { from { transform: scale(.6); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transition: none; }
  .pulse::after { animation: none !important; }
}

/* ---- Utilities ---------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-5); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-5); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 960px) {
  .sh .eyebrow, .sh__body { grid-column: 1 / -1; }
  .sh .eyebrow { padding-top: 0; margin-bottom: 20px; }
  .nav__links { gap: 22px; }
  .nav__links a:not(:first-child):not(:last-child) { display: none; }
  .footer__brand { grid-column: 1 / -1; }
  .footer__col { grid-column: span 4; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  :root { --gutter: 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .card, .panel-grid > * { padding: var(--s-5); }
  .nav__links a:not(:last-child) { display: none; }
  .footer__col { grid-column: span 6; }
}
