/* Source file actions and code canvas */
.source-file-meta {
  align-items: center;
  background: var(--surface);
}
.source-file-details {
  min-width: 0;
  overflow-wrap: anywhere;
}
.source-file-meta .btn,
.source-view-switch a {
  min-height: 36px;
  white-space: nowrap;
}
.source-view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}
.source-view-switch a {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.source-view-switch a:hover { color: var(--accent) }
.source-view-switch a[aria-current="page"] {
  color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.source-file-actions [aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}
.source-file-actions [hidden] { display: none }
.source-copy-status {
  margin: 0;
  padding: 8px 19px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 13px;
}
.source-copy-status:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  margin: -1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
}
.source-copy-status[data-result="success"] { color: var(--green) }
.source-copy-status[data-result="error"] { color: var(--red) }
.source-empty-file { margin: 0; padding: 28px 19px; color: var(--text-2) }

.source-code {
  display: block;
  position: relative;
  overflow: auto;
  max-height: 70vh;
  background: var(--surface);
  color: var(--text);
  scrollbar-color: var(--line-strong) var(--bg-soft);
}
.source-code:focus-visible { outline-offset: -3px }
.source-code > .source-code-body {
  width: max-content;
  min-width: 100%;
  margin: 0;
  padding: 10px 0;
  tab-size: 4;
  font: 13px / 1.65 var(--font-mono);
}
.source-code-body > code { display: block; font: inherit }
.source-code-line {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  min-height: 1.65em;
}
.source-code-line:hover { background: var(--bg-hover) }
.source-line-number {
  position: sticky;
  inset-inline-start: 0;
  padding-inline-end: 11px;
  border-inline-end: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-3);
  text-align: end;
  user-select: none;
}
.source-line-number::before { content: attr(data-line) }
.source-code-text { display: block; padding-inline: 14px; white-space: pre }
.source-code[data-wrap="true"] > .source-code-body { width: 100% }
.source-code[data-wrap="true"] .source-code-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .source-code-line { grid-template-columns: 42px minmax(0, 1fr) }
  .source-line-number { padding-inline-end: 8px }
  .source-code-text { padding-inline: 10px }
  .source-file-meta .btn,
  .source-view-switch a { min-height: 40px }
}

@media (max-width: 380px) {
  .source-file-actions { gap: 5px }
  .source-file-actions .btn { gap: 4px; padding-inline: 8px; font-size: 12px }
  .source-file-actions .btn svg { width: 15px; height: 15px }
}
