/* CORS page styles */

/* Table of contents jump links */
.cors-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 32px;
}

.cors-toc a {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.07);
  color: #a78bfa;
  text-decoration: none;
  font-size: 0.82rem;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.cors-toc a:hover {
  background: rgba(124, 58, 237, 0.18);
  border-color: rgba(124, 58, 237, 0.55);
  color: #c4b5fd;
}

/* ── details / summary accordion ── */
.cors-section {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.015);
  overflow: hidden; /* keep border-radius on open state */
}

.cors-summary {
  list-style: none; /* Firefox */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-size: 0.98rem;
  font-weight: 600;
  color: #e6eef8;
  cursor: pointer;
  user-select: none;
  gap: 12px;
}

/* Remove default webkit triangle */
.cors-summary::-webkit-details-marker {
  display: none;
}

/* Custom chevron */
.cors-summary::after {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  flex-shrink: 0;
  transition:
    transform 0.2s,
    border-color 0.15s;
  margin-top: -3px; /* optical center */
}

.cors-section[open] > .cors-summary::after {
  transform: rotate(225deg);
  margin-top: 3px;
}

.cors-summary:hover {
  background: rgba(255, 255, 255, 0.03);
}

.cors-summary:hover::after {
  border-color: #e6eef8;
}

/* Content area */
.cors-body {
  padding: 0 20px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.cors-body > p:first-child {
  margin-top: 16px;
}

/* Snippet label (sits above a code block) */
.snippet-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 16px 0 4px;
}

/* Code blocks */
.snippet {
  background: #060e1c;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 4px;
  font-size: 0.84rem;
  line-height: 1.6;
}

.snippet code {
  background: none;
  border-radius: 0;
  padding: 0;
  font-size: inherit;
  color: #b8c8dc;
}

/* Shell snippets */
.snippet.shell code {
  color: #7dd3fc;
}

/* Diff snippets */
.snippet.diff code {
  color: #b8c8dc;
}

/* Added line (+) */
.snippet.diff .da {
  color: #86efac;
  display: block;
}

.snippet.diff .da::before {
  content: '+';
  margin-right: 0.5ch;
  opacity: 0.7;
}

/* Removed line (-) */
.snippet.diff .dr {
  color: #fca5a5;
  display: block;
}

.snippet.diff .dr::before {
  content: '-';
  margin-right: 0.5ch;
  opacity: 0.7;
}

/* Unchanged lines in diff */
.snippet.diff .di {
  color: #b8c8dc;
  display: block;
}

.snippet.diff .di::before {
  content: '\00a0';
  margin-right: 0.5ch;
}

/* Informational note below a snippet */
.cors-note {
  font-size: 0.85rem !important;
  color: var(--muted) !important;
  margin-top: 8px !important;
  margin-bottom: 0 !important;
}

.cors-note code {
  font-size: 0.88em;
}

.cors-toc a {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.07);
  color: #a78bfa;
  text-decoration: none;
  font-size: 0.82rem;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.cors-toc a:hover {
  background: rgba(124, 58, 237, 0.18);
  border-color: rgba(124, 58, 237, 0.55);
  color: #c4b5fd;
}

/* Per-framework sections */
.cors-section {
  margin-bottom: 56px;
}

.cors-section h2 {
  margin-top: 0;
  margin-bottom: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Snippet label (sits above a code block) */
.snippet-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 16px 0 4px;
}

/* Code blocks */
.snippet {
  background: #060e1c;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 4px;
  font-size: 0.84rem;
  line-height: 1.6;
}

.snippet code {
  background: none;
  border-radius: 0;
  padding: 0;
  font-size: inherit;
  color: #b8c8dc;
}

/* Shell snippets */
.snippet.shell code {
  color: #7dd3fc;
}

/* Diff snippets */
.snippet.diff code {
  color: #b8c8dc;
}

/* Unchanged diff line */
.snippet.diff .di {
  color: #b8c8dc;
}

/* Added line (+) */
.snippet.diff .da {
  color: #86efac; /* green */
  display: block;
}

.snippet.diff .da::before {
  content: '+';
  margin-right: 0.5ch;
  opacity: 0.7;
}

/* Removed line (-) */
.snippet.diff .dr {
  color: #fca5a5; /* red */
  display: block;
}

.snippet.diff .dr::before {
  content: '-';
  margin-right: 0.5ch;
  opacity: 0.7;
}

/* Unchanged lines in diff — show space indent */
.snippet.diff .di {
  display: block;
}

.snippet.diff .di::before {
  content: '\00a0'; /* non-breaking space to align with +/- */
  margin-right: 0.5ch;
}

/* Informational note below a snippet */
.cors-note {
  font-size: 0.85rem !important;
  color: var(--muted) !important;
  margin-top: 8px !important;
  margin-bottom: 0 !important;
}

.cors-note code {
  font-size: 0.88em;
}
