/* ==========================================================================
   Base: reset, document rhythm, headings, links, focus, utilities
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h, 60px) + var(--sp-5));
  hanging-punctuation: first allow-end;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  font-feature-settings: 'cv05' 1, 'ss03' 1, 'tnum' 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

img, svg, video, canvas { display: block; max-width: 100%; }
svg.icon { width: 1em; height: 1em; fill: currentColor; stroke: none; flex: none; }
svg.icon [stroke-width] { stroke: currentColor; fill: none; }

input, button, select, textarea { font: inherit; color: inherit; }

/* ------------------------------------------------------------- headings */
h1, h2, h3, h4, h5 {
  font-weight: 600;
  line-height: var(--lh-snug);
  text-wrap: balance;
  letter-spacing: -0.011em;
}

h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-4xl);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
h1 em {
  font-style: italic;
  color: var(--accent);
}

h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-3xl);
  line-height: 1.06;
  letter-spacing: -0.015em;
}

h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p { text-wrap: pretty; }

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: from-font;
  transition: color var(--dur-fast) var(--ease-out),
              text-decoration-color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--accent-2); text-decoration-color: currentColor; }

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-variant-ligatures: none;
}

:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08em 0.34em;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

strong { font-weight: 650; color: var(--text); }

ul, ol { padding-left: 1.15em; }
li + li { margin-top: 0.3em; }

hr { border: 0; border-top: 1px solid var(--border); }

::selection {
  background: color-mix(in srgb, var(--accent-solid) 40%, transparent);
  color: var(--text);
}

/* ----------------------------------------------------------------- focus */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* Inputs get a ring rather than a shifted outline so layout never jumps. */
input:focus,
select:focus,
textarea:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

/* ------------------------------------------------------------- utilities */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: clamp(var(--sp-4), 4vw, var(--sp-7));
}

.skip-link {
  position: fixed;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: 200;
  transform: translateY(-160%);
  background: var(--accent-solid);
  color: var(--on-accent);
  padding: 0.6em 1em;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:nth-of-type(2) { left: 12.5rem; }
.skip-link:focus,
.skip-link:focus-visible { transform: translateY(0); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--sp-3);
}
.eyebrow__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) calc(var(--glow) * 34%), transparent);
}

.section-head { max-width: 54rem; margin-bottom: var(--sp-7); }
.section-lede {
  font-size: var(--fs-md);
  line-height: var(--lh-loose);
  color: var(--text-2);
  margin-top: var(--sp-4);
  max-width: 46rem;
}

.link-arrow {
  font-weight: 600;
  font-size: var(--fs-sm);
  text-decoration: none;
  display: inline-flex;
  gap: 0.4em;
  align-items: center;
}
.link-arrow span { transition: transform var(--dur-fast) var(--ease-out); }
.link-arrow:hover span { transform: translateX(3px); }

.sr-announce {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* --------------------------------------------------------- section rhythm */
main > section {
  padding-block: clamp(var(--sp-8), 9vw, var(--sp-10));
  position: relative;
}
main > section + section { border-top: 1px solid var(--border); }

.concepts { background: var(--bg-tint); }
.guides { background: var(--bg-tint); }

/* ----------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------- noscript */
.noscript {
  padding: var(--sp-7) 0;
  background: var(--amber-quiet);
  border-block: 1px solid var(--border);
}
.noscript h2 { font-size: var(--fs-xl); margin-bottom: var(--sp-3); }

/* ==========================================================================
   Narrow-viewport containment
   Grid and flex items default to `min-width: auto`, so a horizontally
   scrollable <pre> nested a few levels down still propagates its content width
   upward and forces the whole page to scroll sideways at 320px. Opting the
   layout containers into `min-width: 0` keeps the scroll where it belongs —
   inside the code block.
   ========================================================================== */
.guide,
.guide > *,
.concept,
.concept > *,
.installtabs,
.installtabs > *,
.clienttabs,
.clienttabs > *,
.tabpanel,
.tabpanel > *,
.codeblock,
.detail__section,
.detail__section > *,
.wirecard,
.wirecard > *,
.stackbox,
.stackbox > *,
.stack__export,
.stack__export > *,
.results,
.results > *,
.card,
.card > *,
.readout__detail,
.readout__steps,
.transcript__body,
.transcript__body > * { min-width: 0; }

.code { max-width: 100%; }
