/*
 * AI Agent Security Range — design system (Step 2).
 * Palette tokens are locked in the Tailwind config (index.html). This file
 * holds the reusable component layer: severity badges, the card component, and
 * collapsible styling. Steps 4–6 reuse these classes instead of re-typing
 * utility strings, so the "design system" stays centralized here.
 */

/* ── Base ─────────────────────────────────────────────────────────────────── */

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  /* Also disable component transitions for reduced-motion users. */
  .collapsible__content,
  .collapsible__chevron {
    transition: none !important;
  }
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Consistent focus ring for keyboard users across custom components. */
:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Active nav link (scroll-spy, Step 6). */
.nav-link.is-active {
  color: #38bdf8;                       /* accent — current section */
  font-weight: 600;
}

/* ── Severity badges ──────────────────────────────────────────────────────── */
/* Three distinct hues, contrast-checked on the dark surface:
   Critical = rose, High = orange, Medium = amber/yellow. */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.4;
}

/* A small dot before the label reinforces severity for non-color cues. */
.badge::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: currentColor;
}

.badge--critical {
  color: #fb7185;                       /* rose-400 */
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
}

.badge--high {
  color: #fb923c;                       /* orange-400 */
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.35);
}

.badge--medium {
  color: #fcd34d;                       /* amber-300 */
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.35);
}

/* ── Card component ───────────────────────────────────────────────────────── */

.card {
  background: #111823;                  /* panel */
  border: 1px solid #1e2a3a;            /* hairline */
  border-radius: 0.875rem;
  padding: 1.25rem 1.375rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.card:hover {
  border-color: #2a3a4f;
  background: #151f2c;                  /* panel-hover */
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.card__title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #f1f5f9;                       /* slate-100 */
}

.card__eyebrow {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;                       /* slate-500 */
  margin-bottom: 0.25rem;
}

/* ── Collapsible (vanilla JS driven) ──────────────────────────────────────── */
/* Markup contract (wired in script.js):
     <div class="collapsible" data-collapsible>
       <button class="collapsible__trigger" data-collapsible-trigger aria-expanded="false">
         Label <span class="collapsible__chevron">▾</span>
       </button>
       <div class="collapsible__content" data-collapsible-content hidden>…</div>
     </div>
*/

.collapsible__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: none;
  color: #cbd5e1;                       /* slate-300 */
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0;
}

.collapsible__trigger:hover {
  color: #f1f5f9;
}

.collapsible__chevron {
  display: inline-block;
  transition: transform 0.2s ease;
  color: #64748b;
  font-size: 0.75rem;
}

.collapsible__trigger[aria-expanded="true"] .collapsible__chevron {
  transform: rotate(180deg);
}

.collapsible__content {
  color: #94a3b8;                       /* slate-400 */
  font-size: 0.9375rem;
  line-height: 1.6;
  padding-top: 0.25rem;
}

.collapsible__content[hidden] {
  display: none;
}

/* ── Reference card fields (Step 4) ───────────────────────────────────────── */
/* Labeled sub-sections inside a card's expandable "technical detail" region. */

.field + .field {
  margin-top: 0.875rem;
}

.field-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7dd3fc;                       /* sky-300 */
  margin-bottom: 0.25rem;
}

.field ul {
  list-style: disc;
  padding-left: 1.15rem;
  margin: 0;
}

.field li {
  margin-top: 0.25rem;
}

/* Defanged example payloads: monospace, inset, clearly "code, not prose". */
.example {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #cbd5e1;                       /* slate-300 */
  background: #0b0f14;                  /* surface */
  border: 1px solid #1e2a3a;            /* hairline */
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
}
