/* Minimal shell + demo-content styles. The shell follows prefers-color-scheme
 * through the variables below. The simulated GitHub page (.gh-page) scopes the
 * Primer variables the PrefabLens renderer and toggle read on github.com
 * (exact fallback palette from extension/src/renderer/styles.ts), switched by
 * the same media query. The terminal stays dark in both schemes. */

:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #667085;
  --border: #e4e7ec;
  --code-bg: #f6f7f9;
  --link: #0b6bcb;
  --cmd: #1a7f37;
  --sans: "Nunito", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101114;
    --fg: #e8eaed;
    --muted: #8b919c;
    --border: #2a2d33;
    --code-bg: #1a1c20;
    --link: #58a6ff;
    --cmd: #3fb950;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  max-width: 880px;
  padding: 0 20px 64px;
  font: 16px/1.6 var(--sans);
  color: var(--fg);
  background: var(--bg);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
}

pre {
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--code-bg);
  overflow-x: auto;
  font: 13px/1.6 var(--mono);
}

pre code {
  background: none;
  padding: 0;
}

pre .cmd {
  color: var(--cmd);
  font-weight: 600;
}

h1 {
  font-size: 28px;
  line-height: 1.25;
  margin: 32px 0 8px;
}

h2 {
  font-size: 20px;
  margin: 40px 0 8px;
}

h3 {
  font-size: 15px;
  margin: 24px 0 4px;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.site-header .wordmark {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--fg);
}

.site-header nav {
  display: flex;
  gap: 16px;
  margin-left: auto;
}

.site-header nav a {
  font-size: 14px;
  color: var(--muted);
}

.site-header nav a:hover {
  color: var(--fg);
  text-decoration: none;
}

.site-footer {
  margin-top: 64px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.hint {
  color: var(--muted);
}

/* --- Landing compare ----------------------------------------------------- */

.compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
  gap: 16px;
  margin: 24px 0;
}

.compare .window {
  margin: 0;
}

.label {
  margin: 0 0 6px;
  font: 600 12px/1.6 var(--mono);
  color: var(--muted);
}

/* .gh-page's 24px padding must lose to this pane's edge-to-edge layout. */
.gh-page.raw-pane {
  height: 420px;
  overflow: auto;
  padding: 0;
}

.hero-frame {
  display: block;
  width: 100%;
  height: 420px;
  border: none;
  background: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .hero-frame {
    background: #0d1117;
  }
}

/* --- Framed windows ------------------------------------------------------ */

.window {
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.window-title {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--code-bg);
  font: 12px/1.6 var(--mono);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-shot {
  display: block;
  width: 100%;
  height: auto;
}

/* --- Simulated GitHub page (inside a .window) ---------------------------- */

.gh-page {
  color-scheme: light;
  --fgColor-default: #1f2328;
  --fgColor-muted: #59636e;
  --fgColor-accent: #0969da;
  --fgColor-success: #1a7f37;
  --fgColor-danger: #cf222e;
  --fgColor-attention: #9a6700;
  --borderColor-default: #d1d9e0;
  --borderColor-muted: #d8dee4;
  --bgColor-default: #ffffff;
  --bgColor-muted: #f6f8fa;
  --bgColor-neutral-muted: rgba(129, 139, 152, 0.18);
  --bgColor-success-muted: #dafbe1;
  --bgColor-danger-muted: #ffebe9;
  --bgColor-attention-muted: #fff8c5;
  --bgColor-accent-muted: #ddf4ff;
  padding: 24px;
  background: var(--bgColor-default);
  color: var(--fgColor-default);
  font-size: 14px;
}

@media (prefers-color-scheme: dark) {
  .gh-page {
    color-scheme: dark;
    --fgColor-default: #f0f6fc;
    --fgColor-muted: #9198a1;
    --fgColor-accent: #4493f8;
    --fgColor-success: #3fb950;
    --fgColor-danger: #f85149;
    --fgColor-attention: #d29922;
    --borderColor-default: #3d444d;
    --borderColor-muted: #3d444d;
    --bgColor-default: #0d1117;
    --bgColor-muted: #151b23;
    --bgColor-neutral-muted: rgba(101, 108, 118, 0.25);
    --bgColor-success-muted: rgba(46, 160, 67, 0.15);
    --bgColor-danger-muted: rgba(248, 81, 73, 0.15);
    --bgColor-attention-muted: rgba(187, 128, 9, 0.15);
    --bgColor-accent-muted: rgba(56, 139, 253, 0.15);
  }
}

.pr-header {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.3;
}

.pr-header .pr-number {
  color: var(--fgColor-muted);
}

.pr-meta {
  margin: 0 0 16px;
  color: var(--fgColor-muted);
}

.pr-meta .branch {
  font: 12px/1.8 var(--mono);
  padding: 1px 6px;
  border-radius: 6px;
  color: var(--fgColor-accent);
  background: var(--bgColor-accent-muted);
}

.file {
  margin: 0 0 16px;
  border: 1px solid var(--borderColor-default);
  border-radius: 6px;
  background: var(--bgColor-default);
}

.file-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--borderColor-default);
  border-radius: 6px 6px 0 0;
  background: var(--bgColor-muted);
}

.file:not(.Details--on) .file-header {
  border-bottom: none;
  border-radius: 6px;
}

.file-collapse {
  display: inline-flex;
  padding: 0;
  border: none;
  background: none;
  color: var(--fgColor-muted);
  cursor: pointer;
}

.file-collapse svg {
  transition: transform 120ms ease;
}

.file.Details--on .file-collapse svg {
  transform: rotate(90deg);
}

.file-info {
  font: 600 12px/1.8 var(--mono);
  overflow-wrap: anywhere;
}

.file-stat {
  font: 12px/1.8 var(--mono);
  white-space: nowrap;
}

.file-stat .added {
  color: var(--fgColor-success);
}

.file-stat .removed {
  color: var(--fgColor-danger);
}

.file-empty {
  padding: 8px 10px;
  margin: 0;
  color: var(--fgColor-muted);
}

/* Primer's collapse rule from github.com: the chevron toggles Details--on on
 * .file, and this hides anything carrying the class (including the shadow host
 * the demo script inserts, exactly like the extension on github.com). */
.Details:not(.Details--on) .Details-content--hidden {
  display: none !important;
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  font: 12px/1.7 var(--mono);
}

.diff-table td {
  padding: 0;
}

.diff-table td.num {
  width: 1%;
  min-width: 44px;
  padding: 0 10px;
  text-align: right;
  color: var(--fgColor-muted);
  user-select: none;
}

.diff-table td.code {
  white-space: pre-wrap;
  word-break: break-all;
  padding-right: 10px;
}

.diff-table tr.add {
  background: var(--bgColor-success-muted);
}

.diff-table tr.del {
  background: var(--bgColor-danger-muted);
}

.diff-table tr.hunk td {
  background: var(--bgColor-accent-muted);
  color: var(--fgColor-muted);
  padding: 2px 10px;
}

/* --- Terminal and report ------------------------------------------------- */

.terminal pre {
  margin: 0;
  padding: 16px;
  border-radius: 0;
  overflow: auto;
  max-height: 560px;
  font-size: 12px;
  color: #ffffff;
  background: #000000;
}

.terminal .prompt {
  color: #656a76;
}

.terminal .b {
  font-weight: 600;
}

.terminal .dim {
  color: #656a76;
}

.terminal .red {
  color: #f85149;
}

.terminal .green {
  color: #00ca8e;
}

.terminal .yellow {
  color: #ffcf25;
}

.report-frame {
  display: block;
  width: 100%;
  height: 720px;
  border: none;
  background: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .report-frame {
    background: #0d1117;
  }
}