/* =========================================================== */
/* AG Defensive v1.0 — first stylesheet (CANONICAL DROP-IN)    */
/* The AG System Defaults Discipline (core/AG-DNA.md) + web-css rule, as one    */
/* defensive base. Load FIRST, before tokens and components. Prevents the       */
/* recurring box-model / overflow / text / tap / motion bugs.                   */
/* Promoted 2026-06-26 from the scaffold (closes the "ag-defensive was a        */
/* documented-but-uncreated canonical" gap, Learning Log 2026-06-20).           */
/* =========================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;             /* no horizontal blowout */
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100svh;
  overflow-wrap: break-word;      /* long words never overflow */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  background: var(--paper, #fafafa);
  color: var(--text-primary, #0a0a0a);
  font-family: var(--font-body, system-ui, sans-serif);
}

/* Media never overflows its container */
img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }

/* Form elements inherit type */
input, button, textarea, select { font: inherit; color: inherit; }

/* Orphan prevention (AG-DNA) */
h1, h2, h3, h4, h5, h6 { text-wrap: balance; line-height: 1.1; }
p, li, blockquote, figcaption { text-wrap: pretty; }

/* Interactive defaults */
a, button, [role="button"], input, label[for], select, summary {
  touch-action: manipulation;     /* removes the 300ms tap delay */
}
a { color: inherit; text-decoration: none; }
button { background: none; border: 0; cursor: pointer; }

/* Visible keyboard focus everywhere */
:focus-visible { outline: 3px solid var(--accent, #c9a861); outline-offset: 3px; }

/* Skip link (revealed on focus) */
.ag-skip-link {
  position: absolute; left: 7px; top: -100px; z-index: 2147483647;
  padding: 10px 18px; border-radius: 8px;
  background: var(--ink, #0a0a0a); color: var(--paper, #fafafa);
  transition: top var(--duration-quick, 0.3s) var(--ease-satisfying, cubic-bezier(0.16, 1, 0.3, 1));
}
.ag-skip-link:focus-visible { top: 7px; }

/* Global reduced-motion guard (components also honor it individually) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
