/* =============================================================================
   AI Architect — site.css (every page, after /ds/styles.css)
   Cross-page platform enhancements. Each rule is a progressive enhancement: a
   browser without the feature renders the page exactly as before.

   source: GoogleChrome/modern-web-guidance (skill version 2026_11_09-5bcc021b),
   guides cross-document-transitions and improve-text-layout-and-legibility. Baseline dates below are the guides'.
   ============================================================================= */

/* Cross-document view transitions: a cross-fade between two pages of the site.
   Both pages must opt in, hence the shared sheet. No-op in Firefox (limited
   availability); never runs for users who asked for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation-duration: .18s; }
}

/* In-page anchors: smooth only when motion is allowed, and never hidden under
   the sticky top nav. Replaces a scripted scroll that ignored reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
:target { scroll-margin-top: 84px; } /* source: sticky nav measured 69.75px at 1280px (Chromium, 2026-11-15), plus 14px of air */

/* Headings break into even lines; body copy avoids a last-line orphan.
   text-wrap: balance is Baseline since 2024-05-13. */
h1, h2, h3 { text-wrap: balance; }
p, li, figcaption { text-wrap: pretty; }

/* The DS exhibit label is one line by design; on a phone a long label would
   push the page sideways (measured: /zetetic overflowed by 6px at 390px,
   2026-11-15). It may wrap there. */
@media (max-width: 640px) {
  .aia-exhibit { white-space: normal; }
}

/* Product videos (partials/video_<slug>.<locale>.html, from tools/build-videos.py).
   The frame is 848x480; the width and height attributes reserve its box. */
.aia-video { max-width: 848px; margin: 32px auto; }
.prose .aia-video { width: min(848px, calc(100vw - 40px)); max-width: none; position: relative; left: 50%; translate: -50% 0; }
.aia-video video { display: block; width: 100%; height: auto; background: var(--surface-chip); border: 1px solid var(--border-strong); border-radius: var(--radius-md); }
.aia-video figcaption { margin-top: 12px; font-size: var(--text-sm); line-height: 1.55; color: var(--text-secondary); }
.aia-video figcaption strong { color: var(--text); font-weight: var(--weight-medium); }
.aia-video figcaption a { color: var(--accent-ink); border-bottom: 1px dashed var(--border-strong); }
.aia-video .mono { font-family: var(--font-mono); font-size: .92em; }
.aia-video__text { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; font-size: var(--text-sm); color: var(--text-secondary); }
.aia-video__text summary { cursor: pointer; color: var(--text); font-weight: var(--weight-medium); }
.aia-video__text ol { margin: 12px 0 0; padding-left: 22px; display: grid; gap: 8px; line-height: 1.55; }
.aia-video__text li strong { color: var(--text); font-weight: var(--weight-medium); }
.aia-video__sources { margin: 14px 0 0; font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; }
.aia-video + .aia-video { margin-top: 56px; }

/* Mobile drawer, closed state. Each page stylesheet repeats the drawer rule and
   leaves its shadow on while the drawer sits off-screen, so the shadow bleeds
   onto the right edge of the page; its links also stay reachable by Tab while
   invisible. One rule here, more specific than the copies, fixes both for
   every page. visibility flips after the slide-out so the animation is kept. */
@media (max-width: 980px) {
  .navlinks:not(.nav-open) {
    box-shadow: none;
    visibility: hidden;
    transition: transform .25s var(--ease), visibility 0s .25s; /* source: .25s is the drawer's own slide duration in the page stylesheets */
  }
}
