/* ============================================================================
   Link to NetEra light prototype: base.css
   Reset, typography, layout primitives, a11y foundations.
   All values come from design-tokens.css.
   ============================================================================ */

/* ---- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--sp-10);
}
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--text);
  /* --page, not --surface: --surface is the CARD colour. Painting the body with
     it collapsed page and card onto one value in both themes. */
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
::selection { background: var(--accent-soft); color: var(--ink-900); }

/* ---- Typography ----------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600; /* weight contrast, not heaviness */
  line-height: var(--lh-snug);
  letter-spacing: var(--track-tight);
  color: var(--text);
  text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
p  { max-width: 68ch; }
.lead {
  font-size: var(--fs-md);
  color: var(--text-muted);
  line-height: var(--lh-body);
}
small, .text-sm { font-size: var(--fs-sm); }
strong { font-weight: 600; }
code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
/* inline code on light surfaces */
p code, li code, td code {
  background: var(--paper-mist);
  border: 1px solid var(--border);
  border-radius: calc(var(--r-sm) / 2);
  padding: 1px 5px;
  color: var(--ink-800);
  white-space: nowrap;
}
/* On a phone a multi-word command ("switchport trunk allowed vlan add 30")
   is wider than the screen; there it may wrap at its spaces. Single tokens: 
   an address, a port, still never break. */
@media (max-width: 479px) {
  p code, li code { white-space: normal; }
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Focus & accessibility ------------------------------------------------ */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-sm);
}
.skip-link {
  position: absolute;
  left: var(--sp-2);
  top: -100px;
  z-index: calc(var(--z-header) + 10);
  background: var(--ink-900);
  color: var(--paper);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
  font-weight: 500;
}
.skip-link:focus { top: var(--sp-2); }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* ---- Layout primitives ------------------------------------------------------ */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: calc(var(--container-narrow) + 2 * var(--gutter)); }

.section { padding-block: var(--section-pad); }
.section--alt { background: var(--section-band); }
.section--flush-top { padding-top: 0; }
/* Schematic-grid wash (2026-07-19): reuses the hero's own --grid-paper token
   at low opacity so one section mid-page breaks the plain white/gray
   alternation without introducing a new visual motif. Border top/bottom keep
   the wash from bleeding into its neighbors. */
.section--grid {
  position: relative;
  background-image: var(--grid-paper);
  background-size: var(--grid-size);
  border-block: 1px solid var(--border);
}

/* Section header pattern: mono eyebrow + title + optional lead.
   Three layouts so pages don't read as one repeated template:
   default (left stack), --center, and --row (title left, action link right). */
.section-head { margin-bottom: var(--sp-6); max-width: 720px; }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .eyebrow { justify-content: center; }
.section-head .lead { margin-top: var(--sp-2); }
.section-head--row {
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
}
.section-head--row > div { max-width: 720px; }
.section-head--row .link-more { flex: none; margin-bottom: 6px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-2);
}
.eyebrow::before {
  content: "";
  width: var(--sp-3);
  height: 2px;
  background: var(--accent-decor);
  border-radius: var(--r-pill);
}

/* Simple grid helpers (mobile-first: stack, then split) */
.grid { display: grid; gap: var(--sp-3); }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Icon sizing (inline SVG, stroke inherits currentColor) --------------- */
.icon {
  width: 24px;
  height: 24px;
  flex: none;
}
.icon--sm { width: 18px; height: 18px; }
.icon--xs { width: 16px; height: 16px; }

/* Node-dot list bullets: topology motif */
.node-list li {
  position: relative;
  padding-left: var(--sp-3);
  margin-bottom: var(--sp-1);
}
.node-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--paper);
  border: 2px solid var(--accent-decor);
}

/* ---- Motion: scroll reveals ------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--t-slow), transform var(--t-slow);
  transition-delay: var(--d, 0s);
}
.reveal.is-in { opacity: 1; transform: none; }

/* Directional reveal variants (2026-07-19): same JS (IntersectionObserver
   toggles .is-in on any .reveal element, direction-agnostic), different
   starting transform. Opt in with a second class alongside .reveal so a long
   page can vary entrances per section instead of every element fading up
   identically. .reveal.is-in above already resets transform to none, so these
   need no extra rule for the settled state. */
.reveal--left  { transform: translateX(-32px); }
.reveal--right { transform: translateX(32px); }
.reveal--scale { transform: scale(.94); }
.reveal--pop   { transform: translateY(14px) scale(.96); }

/* Narrow screens: drop the HORIZONTAL part of the entrance.
   Caught by the Playwright mobile run: on a 393px viewport the homepage
   leaderboard is .reveal--right, so before it animates in it sits 32px to the
   right of where it belongs and widens the document past the viewport. Wider
   layouts have gutter to absorb that; phones do not. body{overflow-x:hidden}
   was masking the symptom rather than preventing it, which is fragile: it also
   silently clips anything else that overhangs. Vertical entrances read the same
   at this size, so nothing is lost. */
@media (max-width: 720px) {
  .reveal--left,
  .reveal--right { transform: translateY(18px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Tables (comparison content, AEO-friendly) ----------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  background: var(--surface);
}
table.data caption {
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--sp-2);
  border-bottom: 1px solid var(--border);
}
table.data th, table.data td {
  text-align: left;
  padding: var(--sp-1) var(--sp-2);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data thead th {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-sm);
  background: var(--paper-soft);
  white-space: nowrap;
}
table.data tbody tr:last-child th,
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td code { white-space: nowrap; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
