/* RDS-026 satellite articles index.
   Uses only the tokens the satellite pages already define (--navy, --accent, --bg-light,
   --bg-white, --text, --text-muted, --border, --font). No new font, no new palette.
   Cards keep the .blog-card hook the site's existing spotlight script selects on. */

.ai-wrap { max-width: 1200px; margin: 0 auto; padding: 0 2.5rem; }

/* ---------------------------------------------------------------- controls */
.ai-controls {
  position: sticky; top: 64px; z-index: 90;
  /* Opaque, not a translucent blur panel. At 94% the grid heading ghosted through the bar
     as it scrolled under, which reads as a rendering fault rather than as a style. */
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 0 1rem;
}
.ai-controls-inner { max-width: 1200px; margin: 0 auto; padding: 0 2.5rem; }
.ai-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ai-row + .ai-row { margin-top: 0.85rem; }

.ai-chips { display: flex; gap: 0.5rem; flex: 1 1 auto; min-width: 0; }
.ai-chip {
  font: inherit; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 0.5rem 1.05rem; border-radius: 50px; cursor: pointer; white-space: nowrap;
  background: #fff; color: var(--text-muted); border: 1px solid var(--border);
  transition: background .18s cubic-bezier(.22,.61,.36,1), color .18s, border-color .18s;
}
.ai-chip:hover { color: var(--text); border-color: #C9D2DB; }
.ai-chip[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.ai-chip .ai-chip-n { opacity: .6; margin-left: .4rem; font-weight: 500; }

.ai-field { position: relative; display: flex; align-items: center; }
.ai-field label {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.ai-select, .ai-search {
  font: inherit; font-size: 0.84rem; color: var(--text);
  background-color: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 0.58rem 0.85rem; transition: border-color .18s, box-shadow .18s;
}
.ai-select { cursor: pointer; padding-right: 2rem;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%235A6878' stroke-width='1.6' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right .75rem center;
}
.ai-search { min-width: 15rem; flex: 1 1 15rem; }
.ai-select:hover, .ai-search:hover { border-color: #C9D2DB; }
.ai-select:focus, .ai-search:focus, .ai-chip:focus-visible, .ai-more-btn:focus-visible,
.ai-clear:focus-visible, .ai-card > a:focus-visible, .ai-empty-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.ai-search:focus, .ai-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(42,157,143,.14); }

.ai-count {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); margin-left: auto; white-space: nowrap;
}
.ai-clear {
  font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--accent);
  background: none; border: none; cursor: pointer; padding: 0.4rem 0.2rem;
  text-decoration: underline; text-underline-offset: 3px; white-space: nowrap;
}
.ai-clear[hidden] { display: none; }
.ai-clear:hover { color: var(--accent-hover); }

/* ---------------------------------------------------------------- grid + featured

   ONE card list, in strict newest-first document order, so a crawler and a JS-off reader
   both get the archive in the right order. The featured block is pure CSS placement over
   that list: the featured card is hoisted with `order:-1` and spans 2 columns and 3 rows,
   and the three cards marked at build time as compact fill the column beside it. Nothing is
   duplicated and nothing moves in the DOM, so activating a filter only has to drop the
   --featured class and hide the cards that do not match. */

.ai-grid-section { padding: 2.5rem 0 1rem; }
.ai-grid-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.ai-grid-head[hidden] { display: none; }
.ai-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; }

.ai-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  transition: transform .18s cubic-bezier(.22,.61,.36,1), box-shadow .18s, border-color .18s; }
.ai-card > a { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.ai-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(27,42,74,.09); border-color: #D4DCE4; }
.ai-card .ai-body { padding: 1.15rem 1.25rem 1.35rem; display: flex; flex-direction: column; flex: 1; }
.ai-card .ai-title { font-size: 1.05rem; font-weight: 700; line-height: 1.32; letter-spacing: -0.01em;
  color: var(--text); margin: 0.45rem 0 0.5rem; }

/* the large card */
.ai-grid--featured .is-featured {
  order: -1; grid-column: span 2; grid-row: span 3; border-radius: 14px;
}
.ai-grid--featured .is-featured .ai-media { aspect-ratio: 16 / 8.5; }
.ai-grid--featured .is-featured .ai-body { padding: 1.75rem 1.9rem 2rem; }
.ai-grid--featured .is-featured .ai-title {
  font-size: clamp(1.5rem, 2.6vw, 2.05rem); line-height: 1.22; letter-spacing: -0.02em;
  margin: 0.7rem 0 0.6rem;
}
.ai-grid--featured .is-featured .ai-excerpt { font-size: 0.95rem; -webkit-line-clamp: 3; line-clamp: 3; }
.ai-grid--featured .is-featured:hover { box-shadow: 0 14px 40px rgba(27,42,74,.10); }

/* the three beside it */
.ai-grid--featured .is-compact > a { display: grid; grid-template-columns: 104px 1fr; gap: 0.9rem; align-items: stretch; }
.ai-grid--featured .is-compact .ai-media { aspect-ratio: auto; height: 100%; min-height: 104px; }
.ai-grid--featured .is-compact .ai-body { padding: 0.8rem 1rem 0.8rem 0; }
.ai-grid--featured .is-compact .ai-title { font-size: 0.95rem; line-height: 1.32; margin: 0.3rem 0 0; }
.ai-grid--featured .is-compact .ai-excerpt,
.ai-grid--featured .is-compact .ai-readmore,
.ai-grid--featured .is-compact .ai-topic { display: none; }

.ai-media { display: block; overflow: hidden; background: var(--bg-light); aspect-ratio: 16 / 9; }
.ai-media img { width: 100%; height: 100%; object-fit: cover;
  transition: transform .45s cubic-bezier(.22,.61,.36,1); }
.ai-card:hover .ai-media img { transform: scale(1.035); }

/* No hero exists for the evergreen Q&A pages. Nothing is invented: the panel carries the
   topic, set in the page's own type, on a tint of the brand navy. */
.ai-media--none {
  display: flex; align-items: flex-end; padding: 0.9rem 1rem;
  background:
    linear-gradient(135deg, rgba(27,42,74,.06), rgba(42,157,143,.08)),
    repeating-linear-gradient(135deg, transparent 0 11px, rgba(27,42,74,.035) 11px 12px);
}
.ai-media--none span {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--navy); opacity: .62;
}

.ai-tags { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ai-type {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  padding: 0.24rem 0.55rem; border-radius: 4px; color: #fff; background: var(--navy);
}
.ai-type--data { background: #1F7D72; }
.ai-type--question { background: #43547A; }
.ai-topic { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; color: var(--text-muted); }

.ai-meta { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-muted); margin-top: 0.55rem; }
.ai-meta .ai-sep { margin: 0 0.45rem; opacity: .5; }
.ai-excerpt { font-size: 0.88rem; line-height: 1.6; color: var(--text-muted); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ai-readmore { margin-top: auto; padding-top: 0.9rem; font-size: 0.8rem; font-weight: 600; color: var(--accent); }

/* ---------------------------------------------------------------- more + empty */
.ai-more { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; padding: 2.75rem 0 1rem; }
.ai-more[hidden] { display: none; }
.ai-more-btn {
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  padding: 0.85rem 2.25rem; border-radius: 50px; color: var(--navy);
  background: #fff; border: 1.5px solid var(--navy);
  transition: background .18s cubic-bezier(.22,.61,.36,1), color .18s;
}
.ai-more-btn:hover { background: var(--navy); color: #fff; }
.ai-more-note { font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.02em; }

.ai-empty { padding: 3.5rem 0 3rem; max-width: 34rem; }
.ai-empty[hidden] { display: none; }
.ai-empty h3 { font-size: 1.35rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; margin-bottom: 0.6rem; }
.ai-empty p { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 1.4rem; }
.ai-empty-btn {
  font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer;
  padding: 0.7rem 1.7rem; border-radius: 50px; color: #fff;
  background: var(--accent); border: none; transition: background .18s;
}
.ai-empty-btn:hover { background: var(--accent-hover); }

.ai-hidden { display: none !important; }

/* ---------------------------------------------------------------- motion */
.ai-card { animation: ai-in .3s cubic-bezier(.22,.61,.36,1) both; }
@keyframes ai-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .ai-card, .ai-media img, .ai-chip, .ai-more-btn, .ai-select, .ai-search {
    animation: none !important; transition: none !important;
  }
  .ai-card:hover { transform: none; }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1040px) {
  .ai-grid--featured .is-featured { grid-column: span 3; grid-row: auto; }
  .ai-grid--featured .is-compact > a { grid-template-columns: 1fr; }
  .ai-grid--featured .is-compact .ai-media { aspect-ratio: 16 / 9; height: auto; min-height: 0; }
  .ai-grid--featured .is-compact .ai-body { padding: 0.85rem 1rem 1rem; }
  .ai-grid--featured .is-compact .ai-topic { display: inline; }
}

@media (max-width: 860px) {
  .ai-grid { grid-template-columns: repeat(2, 1fr); }
  .ai-grid--featured .is-featured { grid-column: span 2; }
}

@media (max-width: 720px) {
  .ai-wrap, .ai-controls-inner { padding: 0 1.15rem; }
  .ai-controls { padding: 0.85rem 0 0.9rem; }
  .ai-grid-section { padding-top: 1.75rem; }
  .ai-grid { grid-template-columns: 1fr; gap: 1.1rem; }
  .ai-grid--featured .is-featured { grid-column: span 1; }

  /* Chips scroll sideways; the row is bled to the gutter so the last chip is not clipped. */
  .ai-chips {
    overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1.15rem; padding: 0.15rem 1.15rem; scroll-padding-left: 1.15rem;
  }
  .ai-chips::-webkit-scrollbar { display: none; }
  .ai-chip { min-height: 44px; display: inline-flex; align-items: center; }

  .ai-row--pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .ai-row--pickers .ai-field { display: block; }
  .ai-select { width: 100%; min-height: 44px; }
  /* The search shares the pickers row, so without this it is a grid item in a two-column
     track and renders at half width beside nothing. Topic and sort sit side by side; search
     spans the full row beneath them, as the brief specifies. */
  .ai-row--search { display: block; grid-column: 1 / -1; }
  .ai-search { width: 100%; min-width: 0; min-height: 44px; }
  .ai-row--meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: nowrap; }
  .ai-count { margin-left: 0; }
  .ai-clear { min-height: 44px; display: inline-flex; align-items: center; }
  .ai-more-btn { min-height: 44px; width: 100%; }
  .ai-grid--featured .is-featured .ai-body { padding: 1.25rem 1.25rem 1.5rem; }
}
