/* Dar al-Adl — Depth Covenant page styles. Layered on styles.css tokens. */

.depth-page .api-page-hero {
  align-items: center;
}

/* ---------- Section 1: Hero stat counters ---------- */
.depth-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 28px 0 8px;
}
.depth-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 18px 16px;
}
.depth-stat dt {
  font-family: var(--font-mono);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 700;
  color: var(--ink-strong);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.depth-stat dd {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--muted-strong);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Section 2: Interactive demo ---------- */
.depth-demo {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: clamp(18px, 3vw, 28px);
}
.depth-demo-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.depth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.depth-field label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-strong);
}
.depth-demo textarea,
.depth-demo select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  resize: vertical;
}
.depth-demo textarea:focus,
.depth-demo select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.depth-demo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.depth-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.depth-chip {
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: var(--paper-muted);
  color: var(--muted-strong);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  cursor: pointer;
}
.depth-chip:hover {
  border-color: var(--accent);
  color: var(--ink-strong);
}

/* result block */
.depth-result {
  margin-top: 22px;
  border-top: 1px solid var(--line-soft);
  padding-top: 22px;
}
.depth-result-head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: baseline;
  justify-content: space-between;
}
.depth-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.depth-metric .v {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.depth-metric .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.depth-verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 700;
  font-size: 0.9rem;
}
.depth-verdict.safe {
  background: color-mix(in srgb, var(--success) 14%, var(--paper));
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 40%, transparent);
}
.depth-verdict.delegate {
  background: color-mix(in srgb, var(--warning) 12%, var(--paper));
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
}
.depth-reason {
  margin: 14px 0 0;
  color: var(--muted-strong);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ---------- Horizon bar ---------- */
.horizon-bar {
  margin-top: 20px;
}
.horizon-track {
  position: relative;
  height: 30px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--success) 22%, var(--paper)) 0%,
    color-mix(in srgb, var(--success) 22%, var(--paper)) var(--zone, 50%),
    color-mix(in srgb, var(--warning) 22%, var(--paper)) var(--zone, 50%),
    color-mix(in srgb, var(--warning) 22%, var(--paper)) 100%
  );
  border: 1px solid var(--line);
}
.horizon-dstar {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--ink-strong);
  transform: translateX(-1px);
  transition: left 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.horizon-dstar::after {
  content: "d*";
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-strong);
}
.horizon-marker {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper-raised);
  border: 3px solid var(--ink-strong);
  transform: translate(-50%, -50%);
  transition: left 0.5s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.4s;
  z-index: 2;
}
.horizon-marker.delegate {
  border-color: var(--warning);
}
.horizon-marker.safe {
  border-color: var(--success);
}
.horizon-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---------- Section 3: Horizon table ---------- */
.horizon-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table.horizon-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.horizon-table th,
.horizon-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.horizon-table th {
  background: var(--paper-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-strong);
  cursor: pointer;
  user-select: none;
}
.horizon-table th[aria-sort="ascending"]::after { content: " ▲"; }
.horizon-table th[aria-sort="descending"]::after { content: " ▼"; }
.horizon-table td:first-child { font-family: var(--font-mono); }
.horizon-table td.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.horizon-table tr:last-child td { border-bottom: none; }
.horizon-table tr[data-default] td:first-child { color: var(--muted); }

/* ---------- Section 5: Steps timeline ---------- */
.depth-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  counter-reset: step;
}
.depth-step {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 20px 18px;
}
.depth-step::before {
  counter-increment: step;
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink-strong);
  color: var(--paper);
  font-family: var(--font-mono);
  font-weight: 700;
  margin-bottom: 12px;
}
.depth-step h3 { margin: 0 0 6px; font-size: 1.02rem; }
.depth-step p { margin: 0; color: var(--muted-strong); font-size: 0.9rem; line-height: 1.5; }

/* ---------- Section 4: CTA ---------- */
.depth-cta {
  margin-top: 8px;
  border: 1px solid var(--ink-strong);
  border-radius: var(--radius);
  background: var(--ink-strong);
  color: var(--paper);
  padding: clamp(24px, 4vw, 40px);
  text-align: center;
}
.depth-cta h2 { margin: 0 0 10px; color: var(--paper); }
.depth-cta p { margin: 0 auto 20px; max-width: 56ch; color: color-mix(in srgb, var(--paper) 80%, var(--ink)); }
.depth-cta .button-primary {
  background: var(--paper);
  color: var(--ink-strong);
  border-color: var(--paper);
}

@media (max-width: 820px) {
  .depth-stats { grid-template-columns: 1fr; }
  .depth-demo-row { grid-template-columns: 1fr; }
  .depth-steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .depth-steps { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .horizon-dstar, .horizon-marker { transition: none; }
}
