/* ============================================================
   Emirae.Pro Design System — BASE  (Phase 1 migration)
   Element resets + reusable .uaec-* primitives, ALL scoped under
   `.uaec-ds` so they neither leak to the rest of the site nor
   clobber the theme's pre-existing global .uaec-* component classes.
   ============================================================ */

/* Element resets are wrapped in :where() so they carry ZERO specificity —
   exactly like the design system's original bare-element resets. This keeps
   component rules (.navlink, .aud__t, .mlink, …) winning the cascade instead
   of being overridden by the scope prefix. */
:where(.uaec-ds, .uaec-ds *, .uaec-ds *::before, .uaec-ds *::after) { box-sizing: border-box; }

.uaec-ds {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:where(.uaec-ds) :is(h1, h2, h3, h4, h5, h6, p, figure) { margin: 0; }
/* Headings inherit their section's colour (dark on light bands, white on navy
   bands) — overrides the theme's global heading colour that would otherwise
   break the design's inheritance model. Component classes still win. */
:where(.uaec-ds) :is(h1, h2, h3, h4, h5, h6) { color: inherit; }
:where(.uaec-ds) a { color: inherit; text-decoration: none; }
:where(.uaec-ds) :is(img, svg) { display: block; max-width: 100%; }
:where(.uaec-ds) button { font: inherit; color: inherit; cursor: pointer; }
:where(.uaec-ds) :focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---- Layout ---- */
.uaec-ds .uaec-container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* ---- Eyebrow / section labels ---- */
.uaec-ds .uaec-eyebrow {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--accent);
}

/* ---- Headings ---- */
.uaec-ds .uaec-h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: var(--fw-bold); letter-spacing: var(--tracking-tight); color: var(--text-strong); }
.uaec-ds .uaec-h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--fw-bold); letter-spacing: var(--tracking-tight); color: var(--text-strong); }
.uaec-ds .uaec-h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: var(--fw-medium); color: var(--text-strong); }

/* ---- Buttons ---- */
.uaec-ds .uaec-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2); height: 40px; padding-inline: var(--space-5);
  border: 1px solid transparent; border-radius: var(--radius-md);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: 1; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              transform var(--dur-fast) var(--ease);
}
.uaec-ds .uaec-btn:active { transform: translateY(1px); }
.uaec-ds .uaec-btn--primary { background: var(--accent); color: var(--accent-on); box-shadow: var(--shadow-accent); }
.uaec-ds .uaec-btn--primary:hover { background: var(--accent-hover); }
.uaec-ds .uaec-btn--primary:active { background: var(--accent-pressed); }
.uaec-ds .uaec-btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.uaec-ds .uaec-btn--secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.uaec-ds .uaec-btn--ghost { background: transparent; color: var(--text-secondary); }
.uaec-ds .uaec-btn--ghost:hover { background: var(--surface-alt); color: var(--text-strong); }
.uaec-ds .uaec-btn--lg { height: 48px; padding-inline: var(--space-6); font-size: var(--fs-body); }
.uaec-ds .uaec-btn--sm { height: 34px; padding-inline: var(--space-4); }
.uaec-ds .uaec-btn--block { width: 100%; }

/* ---- Badges & tags ---- */
.uaec-ds .uaec-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: var(--radius-pill); font-size: var(--fs-2xs); font-weight: var(--fw-medium); line-height: 1.4;
}
.uaec-ds .uaec-badge--accent  { background: var(--accent-soft);  color: var(--accent-hover); }
.uaec-ds .uaec-badge--success { background: var(--success-50);   color: var(--success-700); }
.uaec-ds .uaec-badge--warning { background: var(--warning-50);   color: var(--warning-700); }
.uaec-ds .uaec-badge--neutral { background: var(--surface-alt);  color: var(--text-secondary); }
.uaec-ds .uaec-tag {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--radius-sm);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); background: var(--accent-soft); color: var(--accent-hover);
}
.uaec-ds .uaec-tag--muted { background: var(--surface-alt); color: var(--text-secondary); }

/* ---- Cards ---- */
.uaec-ds .uaec-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); }
.uaec-ds .uaec-card--flat { box-shadow: none; }
.uaec-ds .uaec-card--pad { padding: var(--space-6); }

/* ---- Icon container ---- */
.uaec-ds .uaec-icon-box {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-lg);
  background: var(--accent-soft); color: var(--accent);
}
.uaec-ds .uaec-icon-box--navy { background: var(--navy-800); color: var(--white); }
.uaec-ds .uaec-icon-box--sm { width: 36px; height: 36px; border-radius: var(--radius-md); }

/* ---- Screen-reader-only helper (a11y) ---- */
.uaec-ds .uaec-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;
}

/* ---- <picture> layout neutrality ----
   Deliberately NOT scoped to .uaec-ds: uaematch_img_enhance() can wrap an <img>
   anywhere on the site, and the wrapper must never become a box of its own.
   display:contents removes the <picture> from layout, so the <img> keeps the
   exact position it had as a direct child (flex item, absolute overlay, etc.).
   Selector matching is unaffected by this - descendant selectors still reach the
   img; direct-child selectors are why post-content images are left unwrapped. */
picture { display: contents; }
