/* DOSSIER components — use with dossier-tokens.css */

.is-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.dossier-noise::after {
  content: '';
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.dossier-noise--off::after { display: none; }

.dossier-vignette {
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, transparent 40%, color-mix(in srgb, var(--bg) 40%, black) 100%);
}

.dossier-frame {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface-1);
}
.dossier-frame::before,
.dossier-frame::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--text-muted);
  border-style: solid;
  pointer-events: none;
}
.dossier-frame::before {
  top: 6px;
  left: 6px;
  border-width: 1px 0 0 1px;
}
.dossier-frame::after {
  bottom: 6px;
  right: 6px;
  border-width: 0 1px 1px 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-out);
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary {
  background: var(--signal);
  border-color: var(--signal);
  color: var(--bg);
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn--secondary {
  background: transparent;
  border-color: var(--line);
}
.btn--secondary:hover:not(:disabled) {
  border-color: var(--text-secondary);
  background: var(--surface-2);
}
.btn--ghost {
  background: transparent;
  border-color: transparent;
}
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn--danger {
  border-color: var(--status-error);
  color: var(--status-error);
}
.btn--loading { pointer-events: none; opacity: 0.7; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.field__input,
.search-bar {
  min-height: 44px;
  padding: 0 12px;
  font-size: var(--text-md);
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.field__input:focus,
.search-bar:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: var(--focus-ring);
}
.field__hint { font-size: var(--text-xs); color: var(--text-muted); }

/* Chips & tags */
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  border: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.chip--active {
  border-color: var(--signal);
  color: var(--text);
  background: var(--signal-dim);
}
.tag {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  border: 1px solid var(--line);
  color: var(--text-secondary);
}
.tag--status { color: var(--data); border-color: var(--data-dim); }
.tag--signal { color: var(--signal); border-color: var(--signal-dim); }

/* Segmented control */
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
}
.seg button {
  min-height: 36px;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-1);
  border: none;
  border-right: 1px solid var(--line);
  color: var(--text-secondary);
  cursor: pointer;
}
.seg button:last-child { border-right: none; }
.seg button[aria-selected='true'] {
  background: var(--signal-dim);
  color: var(--text);
}

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); }
.tabs button {
  min-height: 44px;
  padding: 0 16px;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px;
}
.tabs button[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--signal);
}

/* Dossier card */
.dossier-card {
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface-1);
}
.dossier-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.dossier-card__title {
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: 500;
}
.dossier-card__id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--data);
}
.dossier-card__grid {
  display: grid;
  gap: 10px;
}
.dossier-kv {
  display: grid;
  grid-template-columns: minmax(0, 120px) 1fr;
  gap: 8px;
  font-size: var(--text-sm);
}
.dossier-kv dt {
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dossier-kv dd {
  margin: 0;
  font-family: var(--font-mono);
  word-break: break-word;
}

/* Skeleton (redaction) */
.dossier-skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dossier-skeleton__bar {
  height: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  animation: dossier-reveal var(--motion-base) var(--ease-out) forwards;
}
.dossier-skeleton__bar:nth-child(1) { width: 92%; }
.dossier-skeleton__bar:nth-child(2) { width: 70%; }
.dossier-skeleton__bar:nth-child(3) { width: 85%; }
@keyframes dossier-reveal {
  to { opacity: 0.35; }
}

/* Toast */
.toast {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: var(--text-sm);
  max-width: 360px;
}
.toast--error { border-left: 3px solid var(--status-error); }

/* Modal / sheet */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 30%, black);
  z-index: 100;
}
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100vw - 32px));
  max-height: min(80vh, 640px);
  overflow: auto;
  z-index: 101;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--surface-1);
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 101;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface-1);
  transform: translateY(100%);
  transition: transform var(--motion-base) var(--ease-out);
}
.sheet.is-open { transform: translateY(0); }

/* Online indicator */
.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-ok);
  box-shadow: 0 0 0 2px var(--surface-1);
}

/* Styleguide layout */
.sg-layout {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 1024px) {
  .sg-layout {
    grid-template-columns: 240px 1fr;
  }
}
.sg-nav {
  border-bottom: 1px solid var(--line);
  padding: 16px;
  background: var(--surface-1);
}
@media (min-width: 1024px) {
  .sg-nav {
    border-bottom: none;
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow: auto;
  }
}
.sg-main { padding: 20px 16px 48px; max-width: 960px; }
.sg-section { margin-bottom: 40px; }
.sg-section h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.sg-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.sg-swatch {
  width: 72px;
  height: 48px;
  border: 1px solid var(--line);
  font-size: 10px;
  display: flex;
  align-items: flex-end;
  padding: 4px;
  font-family: var(--font-mono);
}

:root {
  --trust-high: #2ecc71;
  --trust-medium: #f1c40f;
  --trust-low: #e67e22;
  --trust-unverified: #95a5a6;
}
.trust-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 6px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: var(--surface-2, rgba(255,255,255,0.04));
}
.trust-level-high { color: var(--trust-high); border-color: var(--trust-high); }
.trust-level-medium { color: var(--trust-medium); border-color: var(--trust-medium); }
.trust-level-low { color: var(--trust-low); border-color: var(--trust-low); }
.trust-level-unverified { color: var(--trust-unverified); border-color: var(--trust-unverified); }
.trust-coverage {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: var(--text-sm, 13px);
}
.trust-source-list { list-style: none; margin: 8px 0 0; padding: 0; }
.trust-source-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; }
