/* SPDX-License-Identifier: AGPL-3.0-only */
/* Copyright (c) 2026 sol pbc */

.drawer {
  margin-top: var(--space-6);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--cream-bright);
}

.drawer > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  box-sizing: border-box;
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
}

.drawer > summary::-webkit-details-marker {
  display: none;
}

.drawer > summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius);
}

.drawer-chev {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.drawer[open] .drawer-chev {
  transform: rotate(45deg);
}

.drawer-summary-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px var(--space-2);
  min-width: 0;
}

.drawer-label {
  font-size: 14px;
  font-weight: var(--weight-medium);
}

.drawer-line {
  font-size: 12.5px;
  color: var(--ink-faint-paper);
}

.drawer-line b {
  font-weight: var(--weight-medium);
  color: var(--ink-soft);
}

.drawer-chip {
  justify-self: end;
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: var(--weight-medium);
  color: var(--ink-soft-paper);
}

.drawer-chip--warn {
  color: var(--warn);
}

.drawer-chip--danger {
  color: var(--danger);
}

.drawer-body {
  border-top: 1px solid var(--hairline);
  padding: var(--space-4);
}

.drawer-empty {
  margin: 0;
  font-size: 14px;
  color: var(--ink-faint-paper);
}

.drawer-evidence {
  display: grid;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.drawer-evidence-row {
  display: grid;
  gap: 2px;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--hairline);
}

.drawer-evidence-row:last-child {
  border-bottom: 0;
}

.drawer-evidence-title {
  color: var(--ink);
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}

.ev-meta {
  font-size: 12px;
  color: var(--ink-faint-paper);
}

.drawer-provenance {
  margin: var(--space-3) 0 0;
  font-size: 12px;
  color: var(--ink-faint-paper);
}

.drawer-kv {
  display: grid;
  grid-template-columns: minmax(10ch, max-content) minmax(0, 1fr);
  column-gap: var(--space-4);
  row-gap: var(--space-2);
  margin: 0;
}

.drawer-kv dt {
  color: var(--ink-soft-paper);
}

.drawer-kv dd {
  margin: 0;
  min-width: 0;
  color: var(--ink);
}

.gate-row {
  display: grid;
  grid-template-columns: minmax(10ch, max-content) minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  align-items: baseline;
  margin-bottom: var(--space-2);
}

.gate-row > span:first-child {
  color: var(--ink-soft-paper);
}

.gate-row > span:last-child {
  min-width: 0;
  color: var(--ink);
}

.gate-need {
  color: var(--ink-faint-paper);
}

.gate-bar {
  height: 6px;
  margin: var(--space-2) 0 var(--space-3);
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.gate-bar > span {
  display: block;
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: var(--ink-soft-paper);
}

.gate-next {
  margin: var(--space-3) 0 0;
  font-size: 12.5px;
  color: var(--ink-faint-paper);
}

@media (max-width: 640px) {
  .drawer > summary {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .drawer-chip {
    grid-column: 2;
    justify-self: start;
  }

  .drawer-kv {
    grid-template-columns: 1fr;
  }

  .gate-row {
    grid-template-columns: 1fr;
  }
}
