/* ==========================================================================
   NameFonts — Base / Reset / Typography
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden; /* defensive: off-canvas mobile-nav (position:fixed + inset)
                         can otherwise register in scrollWidth even while
                         translated out of view */
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
svg { display: block; }

a { color: inherit; text-decoration: none; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 var(--space-3);
  font-weight: 800;
  color: var(--color-text);
}
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); }
h3 { font-size: 1.15rem; font-weight: 700; }

p { margin: 0 0 var(--space-4); color: var(--color-text); }

ul, ol { margin: 0; padding: 0; list-style: none; }

/* Text selection must never be blocked (Section 107) */
::selection { background: var(--color-primary-softest); color: var(--color-text); }

.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--space-7); }

/* Defensive fix for every grid/flex layout in this project (class ends in
   "-grid", or the header/generator flex rows): a grid or flex item's
   default min-width is "auto" (its content's min-content), which silently
   blocks its track/row from ever shrinking below that width -- the classic
   "flexbox/grid blowout" bug. Found and fixed for real during a full-matrix
   QA pass (320-1440px): several *-grid layouts and the generator's input
   row were overflowing past the viewport at narrow widths despite having
   correct column counts, because a long label/placeholder inside one item
   was silently forcing the whole row wider. Applying min-width:0 broadly
   here is cheaper and more auditable than hunting each instance by hand,
   and is safe: it only removes an unwanted default floor, never a size
   anything actually needs. */
[class*="-grid"] > *,
.generator-card > *,
.chip-row > * {
  min-width: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Skip link — keyboard accessibility */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -48px;
  background: var(--color-text);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 1000;
  transition: top var(--transition-fast);
}
.skip-link:focus { top: var(--space-3); }
