/*
 * content-widgets.css — table variants, kbd, details/summary, badges.
 *
 * Table styles are activated by the content-widgets.js plugin via
 * HTML comment markers in markdown. All styles use existing --t-*
 * CSS variables for theme compatibility.
 */

/* ================================================================== */
/* Table variants                                                      */
/* ================================================================== */

/* ------------------------------------------------------------------ */
/* Striped — alternating row colors                                    */
/* ------------------------------------------------------------------ */

.markdown-section table.table-striped tr:nth-child(even) {
  background: var(--t-bg-alt) !important;
}

/* ------------------------------------------------------------------ */
/* Bordered — full grid borders on all cells                           */
/* ------------------------------------------------------------------ */

.markdown-section table.table-bordered {
  border: 1px solid var(--t-border) !important;
}

.markdown-section table.table-bordered th,
.markdown-section table.table-bordered td {
  border: 1px solid var(--t-border) !important;
}

.markdown-section table.table-bordered th {
  background: var(--t-table-header-bg);
}

/* ------------------------------------------------------------------ */
/* Compact — tighter padding for dense data                            */
/* ------------------------------------------------------------------ */

.markdown-section table.table-compact {
  width: auto !important;
}

.markdown-section table.table-compact th,
.markdown-section table.table-compact td {
  padding: 0.35em 0.6em;
  font-size: 0.85em;
}

/* ------------------------------------------------------------------ */
/* Borderless — no borders at all                                      */
/* ------------------------------------------------------------------ */

.markdown-section table.table-borderless th,
.markdown-section table.table-borderless td {
  border: none !important;
}

.markdown-section table.table-borderless th {
  border-bottom: none !important;
}

/* ================================================================== */
/* Keyboard keys — <kbd> elements                                      */
/* ================================================================== */

.markdown-section kbd {
  display: inline-block;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.78em;
  font-weight: 500;
  line-height: 1;
  color: var(--t-text);
  background: var(--t-bg-alt);
  border: 1px solid var(--t-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.2em 0.5em;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
  vertical-align: baseline;
}

/* ================================================================== */
/* Collapsible details/summary                                         */
/* ================================================================== */

.markdown-section details {
  border: 1px solid var(--t-border);
  border-left: 4px solid var(--t-accent);
  border-radius: 6px;
  padding: 0.8em 1.2em;
  margin: 1.2em 0;
  background: var(--t-bg);
}

.markdown-section details[open] {
  padding-bottom: 1em;
}

.markdown-section details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95em;
  color: var(--t-heading);
  padding: 0.3em 0;
  list-style: none;
  user-select: none;
}

.markdown-section details summary::-webkit-details-marker {
  display: none;
}

.markdown-section details summary::before {
  content: '\25B6';
  display: inline-block;
  font-size: 0.65em;
  margin-right: 0.6em;
  transition: transform 0.15s ease;
  vertical-align: middle;
}

.markdown-section details[open] summary::before {
  transform: rotate(90deg);
}

.markdown-section details > *:not(summary) {
  margin-top: 0.6em;
}

/* ================================================================== */
/* Badges — inline colored labels                                      */
/* ================================================================== */

.markdown-section .badge {
  display: inline-block;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.72em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  vertical-align: middle;
  line-height: 1.4;
}

.badge-green {
  background: #d4edda;
  color: #1e7e34;
}

.badge-blue {
  background: #dae8f5;
  color: #2a5a8a;
}

.badge-amber {
  background: #fef3cd;
  color: #8a6a10;
}

.badge-red {
  background: #f8d7da;
  color: #8a2020;
}

.badge-purple {
  background: #e8def8;
  color: #5e3d82;
}

.badge-gray {
  background: #e8e8e8;
  color: #555555;
}

html.dark-mode .badge-green {
  background: #162b19;
  color: #48c864;
}

html.dark-mode .badge-blue {
  background: #1a2430;
  color: #6aa0d0;
}

html.dark-mode .badge-amber {
  background: #2a2410;
  color: #d4b040;
}

html.dark-mode .badge-red {
  background: #2a1a1a;
  color: #d06060;
}

html.dark-mode .badge-purple {
  background: #1e1830;
  color: #a07ee0;
}

html.dark-mode .badge-gray {
  background: #2a2a2a;
  color: #999999;
}

/* ================================================================== */
/* Horizontal definition list — <dl> with dt/dd pairs                  */
/* ================================================================== */

.markdown-section dl {
  margin: 1.2em 0;
}

.markdown-section dt {
  font-weight: 600;
  color: var(--t-heading);
  margin-top: 0.8em;
}

.markdown-section dt:first-child {
  margin-top: 0;
}

.markdown-section dd {
  margin-left: 1.5em;
  margin-bottom: 0.4em;
  color: var(--t-text);
}
