/* ════════════════════════════════════════════════════════════════════
   Qoyla. Trust & Compliance Center
   Document + hub styles, built entirely on marketing.css OKLCH tokens.
   No raw colors. Reading layout (sticky TOC + prose), status board,
   subprocessor table, postmortem timeline, certification badges.
   ════════════════════════════════════════════════════════════════════ */

/* ─────────── Document header (legal / policy pages) ─────────── */
.breadcrumb { white-space: nowrap; flex-wrap: wrap; }
.doc-hero { padding-block: clamp(34px, 5vw, 60px) clamp(22px, 3vw, 36px); }
.doc-hero .display { font-size: clamp(30px, 4vw, 46px); }
.doc-meta {
  display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 24px;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-muted);
}
.doc-meta .mi { display: inline-flex; align-items: center; gap: 8px; }
.doc-meta .mi svg { width: 14px; height: 14px; opacity: 0.7; }
.doc-meta b { color: var(--ink); font-weight: 600; }

/* status pill (effective / draft / in progress) */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.04em; padding: 5px 12px; border-radius: var(--r-pill);
}
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.status-live { background: var(--success-subtle); color: var(--success-text); }
.status-progress { background: var(--gold-subtle); color: var(--gold-text); }
.status-planned { background: var(--surface-inset); color: var(--ink-muted); }

/* ─────────── Two-column reading layout ─────────── */
.doc-layout { display: grid; grid-template-columns: 240px 1fr; gap: clamp(32px, 5vw, 76px); align-items: start; }
.doc-toc { position: sticky; top: 132px; }
.doc-toc .toc-label { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-subtle); margin-bottom: 14px; }
.doc-toc nav { display: flex; flex-direction: column; gap: 1px; border-left: 1px solid var(--border-hairline); }
.doc-toc a { padding: 8px 16px; margin-left: -1px; border-left: 2px solid transparent; font-size: 13.5px; line-height: 1.4; color: var(--ink-muted); transition: color 130ms, border-color 130ms; }
.doc-toc a:hover { color: var(--ink); }
.doc-toc a.active { color: var(--primary); border-left-color: var(--primary); font-weight: 600; }

/* ─────────── Prose ─────────── */
.prose { max-width: 70ch; }
.prose > section { scroll-margin-top: 120px; padding-top: clamp(28px, 4vw, 44px); }
.prose > section:first-child { padding-top: 0; }
.prose h2 { font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -0.025em; margin-bottom: 16px; }
.prose h2 .sec-no { font-family: var(--font-mono); font-size: 0.6em; font-weight: 500; color: var(--primary); margin-right: 12px; vertical-align: middle; letter-spacing: 0; }
.prose h3 { font-size: 17.5px; margin: 28px 0 10px; letter-spacing: -0.015em; }
.prose p { font-size: 16px; line-height: 1.7; color: var(--ink-2); margin-bottom: 16px; text-wrap: pretty; }
.prose p + p { margin-top: -4px; }
.prose a:not(.btn):not(.btn-text) { color: var(--primary); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--primary-tint); }
.prose a:not(.btn):not(.btn-text):hover { text-decoration-color: var(--primary); }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 4px; display: flex; flex-direction: column; gap: 10px; list-style: none; }
.prose li { position: relative; padding-left: 26px; font-size: 16px; line-height: 1.65; color: var(--ink-2); }
.prose ul > li::before { content: ""; position: absolute; left: 6px; top: 11px; width: 6px; height: 6px; border-radius: 999px; background: var(--primary); opacity: 0.55; }
.prose ol { counter-reset: li; }
.prose ol > li { counter-increment: li; }
.prose ol > li::before { content: counter(li); position: absolute; left: 0; top: 0; font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--primary); width: 18px; text-align: right; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose .lead { font-size: 18px; line-height: 1.6; color: var(--ink-muted); }

/* callout */
.callout { display: flex; gap: 14px; padding: 18px 20px; border-radius: var(--r-card); background: var(--surface-inset); border: 1px solid var(--border-hairline); margin: 4px 0 20px; }
.callout .ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--primary-tint); color: var(--primary); flex: none; }
.callout .ico svg { width: 18px; height: 18px; }
.callout p { margin: 0; font-size: 14.5px; line-height: 1.6; }
.callout.gold .ico { background: var(--gold-subtle); color: var(--gold-text); }
.callout.green .ico { background: var(--success-subtle); color: var(--success-text); }

/* definition / key-value rows inside prose */
.kv-table { width: 100%; border-collapse: collapse; margin: 4px 0 22px; }
.kv-table th, .kv-table td { text-align: left; padding: 13px 16px; font-size: 14.5px; vertical-align: top; border-bottom: 1px solid var(--border-hairline); }
.kv-table thead th { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-subtle); }
.kv-table tbody th { font-weight: 600; color: var(--ink); width: 32%; }
.kv-table td { color: var(--ink-2); line-height: 1.55; }
.kv-table tr:last-child th, .kv-table tr:last-child td { border-bottom: 0; }

/* ─────────── Hub: card directory ─────────── */
.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-20); }
@media (max-width: 940px) { .trust-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .trust-grid { grid-template-columns: 1fr; } }
.trust-card { display: flex; flex-direction: column; gap: 12px; }
.trust-card .top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.trust-card h3 { font-size: 17px; }
.trust-card p { font-size: 14px; color: var(--ink-muted); line-height: 1.55; flex: 1; }
.trust-card .foot { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--primary); margin-top: 2px; }
.trust-card .foot svg { width: 15px; height: 15px; transition: transform 140ms var(--ease); }
.card-link:hover .trust-card .foot svg { transform: translateX(3px); }

/* ─────────── Status board (status.qoyla.ai) ─────────── */
.status-banner { display: flex; align-items: center; gap: 16px; padding: clamp(20px, 3vw, 28px); border-radius: var(--r-card-lg); }
.status-banner.ok { background: var(--success-subtle); border: 1px solid oklch(0.62 0.15 152 / 0.25); }
.status-banner.degraded { background: var(--gold-subtle); border: 1px solid oklch(0.72 0.135 82 / 0.3); }
.status-banner .dot { width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; flex: none; }
.status-banner.ok .dot { background: var(--success-text); color: var(--on-dark); }
.status-banner.degraded .dot { background: var(--gold-text); color: var(--on-dark); }
.status-banner .dot svg { width: 24px; height: 24px; }
.status-banner h2 { font-size: clamp(20px, 2.2vw, 26px); margin: 0; }
.status-banner.ok h2 { color: var(--success-text); }
.status-banner.degraded h2 { color: var(--gold-text); }
.status-banner .sub { font-family: var(--font-mono); font-size: 12.5px; margin-top: 4px; }
.status-banner.ok .sub { color: var(--success-text); }
.status-banner.degraded .sub { color: var(--gold-text); }

.status-list { border: 1px solid var(--border-hairline); border-radius: var(--r-card); overflow: hidden; background: var(--surface-card); }
.status-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border-hairline); }
.status-row:last-child { border-bottom: 0; }
.status-row .name { font-weight: 600; color: var(--ink); font-size: 15px; flex: 1; }
.status-row .name .d { display: block; font-weight: 400; font-size: 13px; color: var(--ink-muted); margin-top: 2px; }
.status-row .state { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; }
.status-row .state::before { content: ""; width: 8px; height: 8px; border-radius: 999px; }
.state.operational { color: var(--success-text); } .state.operational::before { background: var(--success-text); }
.state.degraded { color: var(--gold-text); } .state.degraded::before { background: var(--gold-text); }
.state.maintenance { color: oklch(0.45 0.1 235); } .state.maintenance::before { background: oklch(0.45 0.1 235); }

/* 90-day uptime bars */
.uptime-bars { display: flex; gap: 2px; height: 30px; align-items: stretch; }
.uptime-bars i { flex: 1; border-radius: 2px; background: var(--success-text); opacity: 0.85; }
.uptime-bars i.deg { background: var(--gold-text); }
.uptime-bars i.down { background: oklch(0.6 0.2 25); }
.uptime-legend { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--ink-subtle); margin-top: 8px; }

/* ─────────── Postmortem timeline ─────────── */
.pm-list { display: flex; flex-direction: column; gap: var(--s-16); }
.pm-card { display: block; padding: clamp(20px, 3vw, 28px); }
.pm-card .head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pm-card .sev { font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-badge); letter-spacing: 0.04em; }
.sev.sev2 { background: var(--gold-subtle); color: var(--gold-text); }
.sev.sev3 { background: oklch(0.6 0.2 25 / 0.12); color: oklch(0.52 0.19 25); }
.sev.resolved { background: var(--success-subtle); color: var(--success-text); }
.pm-card h3 { font-size: 19px; margin-bottom: 6px; }
.pm-card .date { font-family: var(--font-mono); font-size: 12px; color: var(--ink-subtle); }
.pm-card p { font-size: 14.5px; color: var(--ink-muted); line-height: 1.6; }

.timeline { display: flex; flex-direction: column; gap: 0; margin: 4px 0 8px; }
.timeline .ev { display: grid; grid-template-columns: 96px 1fr; gap: 18px; padding: 12px 0; border-top: 1px solid var(--border-hairline); }
.timeline .ev:first-child { border-top: 0; }
.timeline .t { font-family: var(--font-mono); font-size: 12.5px; color: var(--primary); font-weight: 500; padding-top: 1px; }
.timeline .ev p { margin: 0; font-size: 14.5px; color: var(--ink-2); }

/* ─────────── Subprocessor table ─────────── */
.table-wrap { border: 1px solid var(--border-hairline); border-radius: var(--r-card); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 14px 18px; font-size: 14px; vertical-align: top; }
.data-table thead th { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-subtle); background: var(--surface-inset); border-bottom: 1px solid var(--border-hairline); }
.data-table tbody td { border-bottom: 1px solid var(--border-hairline); color: var(--ink-2); line-height: 1.5; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .co { font-weight: 600; color: var(--ink); }
.data-table .region { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-muted); }
@media (max-width: 720px) { .data-table thead { display: none; } .data-table tbody td { display: block; border: 0; padding: 4px 18px; } .data-table tbody tr { display: block; padding: 14px 0; border-bottom: 1px solid var(--border-hairline); } .data-table .co { padding-top: 12px; } }

/* ─────────── Certification badge grid ─────────── */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-16); }
.cert-badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 28px 20px; }
.cert-badge .seal { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-inset); color: var(--ink-muted); }
.cert-badge .seal svg { width: 30px; height: 30px; }
.cert-badge.done .seal { background: var(--success-subtle); color: var(--success-text); }
.cert-badge.progress .seal { background: var(--gold-subtle); color: var(--gold-text); }
.cert-badge .name { font-weight: 600; color: var(--ink); font-size: 15px; }

/* compliance principle / control cards */
.ctrl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-16); }
@media (max-width: 720px) { .ctrl-grid { grid-template-columns: 1fr; } }
.ctrl { display: flex; gap: 16px; padding: 22px; }
.ctrl .icon-tile { width: 40px; height: 40px; }
.ctrl h3 { font-size: 16px; margin-bottom: 6px; }
.ctrl p { font-size: 14px; color: var(--ink-muted); line-height: 1.55; }

/* doc-page responsive */
@media (max-width: 860px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-toc { position: static; top: auto; padding: 16px 18px; background: var(--surface-inset); border-radius: var(--r-card); border: 1px solid var(--border-hairline); }
  .doc-toc nav { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-left: 0; }
  .doc-toc a { border-left: 0; padding: 7px 4px; }
  .doc-toc a.active { border-left: 0; }
}
@media (max-width: 480px) { .doc-toc nav { grid-template-columns: 1fr; } }
