/* TrigGuard Technical Specification  -  GitHub-standard Infrastructure-Dark */
:root {
  --spec-bg: #0d1117;
  --spec-border: #30363d;
  --spec-text: #c9d1d9;
  --spec-code-bg: #161b22;
  --spec-accent: #2ecc71;
}

/* Protocol + TG spec pages: same horizontal shell as .container (main.css --content-max + 24px) */
.spec-page .page-content {
  padding: 0 0 clamp(48px, 6vw, 80px);
}

.spec-page .spec-container {
  max-width: var(--content-max, 1200px);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: clamp(32px, 4vw, 48px) 24px clamp(40px, 6vw, 64px);
  box-sizing: border-box;
  background: transparent;
  color: var(--spec-text, #e0e0e0);
  line-height: 1.6;
  font-family: var(--sans), 'Inter', sans-serif;
}

/* TG-01 spec: title + metadata  -  border only, no nested “card” */
.spec-page .spec-node-header {
  border-bottom: 1px solid var(--spec-border);
  padding: 0 0 1.25rem;
  margin: 0 0 2rem;
  font-family: var(--mono), 'JetBrains Mono', monospace;
  background: transparent;
  box-shadow: none;
}

.spec-page .spec-metadata {
  display: grid;
  grid-template-columns: minmax(88px, 120px) 1fr;
  gap: 10px 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.52);
}

/* Protocol page classification block  -  flat separator */
.spec-page .spec-meta {
  padding: 0 0 1.5rem;
  margin: 0 0 2.5rem;
  border-bottom: 1px solid var(--spec-border, #30363d);
  font-family: var(--mono), monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.45);
  background: transparent;
}

.spec-meta-line {
  margin: 4px 0;
}

/* Vertical rhythm: one scale site-wide */
.spec-page .spec-section {
  margin: 0 0 72px;
}

.spec-page .spec-section:last-child {
  margin-bottom: 0;
}

.spec-page .spec-section h2 {
  font-family: var(--mono), 'JetBrains Mono', monospace;
  text-transform: uppercase;
  border-bottom: 1px solid var(--spec-border, #30363d);
  padding-bottom: 10px;
  color: var(--spec-accent, #2ecc71);
  font-size: 1rem;
  margin: 0 0 24px;
  letter-spacing: 0.04em;
}

.spec-page .spec-section h3 {
  margin: 32px 0 12px;
  font-size: 0.9rem;
}

.spec-page .spec-section p {
  margin: 0 0 12px;
  max-width: min(72ch, 100%);
  line-height: 1.7;
}

.spec-page .spec-section p:last-child {
  margin-bottom: 0;
}

.spec-page .spec-list {
  margin: 16px 0 0;
  padding-left: 24px;
  max-width: min(72ch, 100%);
}

.spec-page .spec-list li {
  margin-bottom: 8px;
  line-height: 1.65;
}

.spec-bento .bento-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 24px;
  box-sizing: border-box;
}

@media (min-width: 769px) {
  .spec-bento .bento-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .spec-page .spec-container {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .spec-page .spec-section h2 {
    font-size: 0.95rem;
  }
  .spec-page .spec-section p,
  .spec-page .spec-list {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .spec-page .spec-container {
    padding-left: 16px;
    padding-right: 16px;
  }
}

.bento-card {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(46, 204, 113, 0.2);
  padding: 20px;
  border-radius: 6px;
  min-height: 120px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-sizing: border-box;
}

.bento-card h3 {
  font-family: var(--mono), monospace;
  font-size: 14px;
  color: #2ecc71;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bento-card p {
  font-size: 11px;
  color: #aaa;
  margin: 0;
  line-height: 1.6;
}

.code-wrap {
  position: relative;
  margin-top: 12px;
}

.copy-token {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #111;
  color: #39FF14;
  border: 1px solid #333;
  padding: 6px 12px;
  font-family: var(--mono), monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
  z-index: 1;
  transition: background 0.15s, color 0.15s;
}

.copy-token:hover {
  background: #1a1a1a;
}

.copy-token.copied {
  color: #39FF14;
  border-color: #39FF14;
}

.spec-page .spec-pre {
  background: var(--spec-code-bg, #161b22);
  border: 1px solid var(--spec-border);
  border-left: 3px solid var(--spec-accent, #2ecc71);
  padding: 16px 20px;
  overflow-x: auto;
  font-family: var(--mono), monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  margin: 12px 0 20px;
  color: #e0e0e0;
  border-radius: 0 4px 4px 0;
}

.sequence-diagram-wrap {
  margin-top: 24px;
  overflow-x: auto;
  border: 1px solid #222;
  border-radius: 6px;
}

.sequence-svg {
  display: block;
  width: 100%;
  max-width: 800px;
  height: auto;
  margin: 0 auto;
}

/* Mobile: progress bar (sticky)  -  below header so it doesn't cover nav */
.spec-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #111;
  z-index: 999;
}

.spec-progress-bar {
  height: 100%;
  background: #39FF14;
  width: 0%;
  transition: width 0.1s ease-out;
}

@media (min-width: 769px) {
  .spec-progress {
    display: none;
  }
}

@media (max-width: 768px) {
  .spec-page .spec-container {
    font-size: 14px;
  }

  .spec-page .spec-section pre,
  .spec-pre,
  .code-example pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #111;
    padding: 15px;
    border-left: 2px solid #39FF14;
    font-size: 12px;
  }

  .spec-bento .bento-grid {
    grid-template-columns: 1fr;
  }
}

/* Appendix A  -  inherits .spec-section rhythm; no extra “card” stack */
.spec-page .spec-appendix > p:first-of-type {
  margin-bottom: 12px;
  font-size: 0.8125rem;
  color: var(--spec-text);
  opacity: 0.9;
}
.appendix-actions {
  margin-bottom: 12px;
}
.copy-mapping-btn {
  font-family: var(--mono), monospace;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--spec-border);
  color: var(--spec-accent);
  cursor: pointer;
  border-radius: 2px;
}
.copy-mapping-btn:hover {
  border-color: var(--spec-accent);
  background: rgba(46, 204, 113, 0.08);
}
.spec-page .audit-table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
  border: 1px solid var(--spec-border);
  border-radius: 4px;
  background: transparent;
}
.spec-page .audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-family: var(--mono), monospace;
}
.spec-page .audit-table th,
.spec-page .audit-table td {
  text-align: left;
  padding: 14px 18px;
  border-bottom: 1px solid var(--spec-border);
  vertical-align: top;
}
.spec-page .audit-table thead th {
  background: rgba(22, 27, 34, 0.6);
  color: var(--spec-accent);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.7rem;
}
.spec-page .audit-table tbody tr:last-child td {
  border-bottom: none;
}
.spec-page .audit-table .soc2-control {
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}
.spec-page .audit-table td {
  color: var(--spec-text);
  line-height: 1.5;
}
.spec-page .auditor-note {
  font-size: 0.8125rem;
  line-height: 1.55;
  margin: 16px 0 8px 0;
  padding: 12px 0 12px 16px;
  background: transparent;
  border-left: 2px solid var(--spec-accent);
  color: var(--spec-text);
  max-width: min(72ch, 100%);
}
.appendix-signature {
  font-size: 0.7rem;
  font-family: var(--mono), monospace;
  color: rgba(255, 255, 255, 0.4);
  margin: 0;
  letter-spacing: 0.02em;
}
