:root {
  --paper: #f4f0e6;
  --ink: #161b22;
  --muted: #5e675f;
  --line: rgba(22, 27, 34, 0.12);
  --card: rgba(255, 252, 247, 0.88);
  --blue: #1d4ed8;
  --blue-ink: #ffffff;
  --added: #0c6b45;
  --added-bg: #dff6ea;
  --added-mark: #b7e7cd;
  --removed: #a61d36;
  --removed-bg: #fde7eb;
  --removed-mark: #f6c2cb;
  --modified: #8a5a00;
  --modified-bg: #fff1c9;
  --empty: rgba(22, 27, 34, 0.03);
  --shadow: 0 30px 70px rgba(40, 32, 16, 0.12);
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", "Avenir Next", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --radius: 22px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #10141b;
  --ink: #f4f0e6;
  --muted: #b4bdc6;
  --line: rgba(244, 240, 230, 0.14);
  --card: rgba(22, 28, 38, 0.9);
  --blue: #7aa2ff;
  --blue-ink: #10141b;
  --added: #8ee0b5;
  --added-bg: rgba(14, 122, 78, 0.32);
  --added-mark: rgba(142, 224, 181, 0.35);
  --removed: #ffb3be;
  --removed-bg: rgba(166, 29, 54, 0.36);
  --removed-mark: rgba(255, 179, 190, 0.35);
  --modified: #ffd36a;
  --modified-bg: rgba(138, 90, 0, 0.36);
  --empty: rgba(244, 240, 230, 0.04);
  --shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(900px 420px at 8% -10%, color-mix(in srgb, var(--blue) 22%, transparent), transparent 60%),
    radial-gradient(720px 380px at 100% 0%, rgba(198, 122, 26, 0.16), transparent 55%),
    var(--paper);
}
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  opacity: 0.16;
  background-image: radial-gradient(rgba(22, 27, 34, 0.28) 0.6px, transparent 0.6px);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}
:root[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.1; }
:root[data-theme="dark"] .when-light { display: none; }
.when-dark { display: none; }
:root[data-theme="dark"] .when-dark { display: inline; }
::selection { background: var(--modified-bg); color: var(--ink); }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: 0.92em; }
section { scroll-margin-top: 84px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.03em; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 40;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 12px;
  border-radius: 999px;
  text-decoration: none;
}
.skip:focus { top: 12px; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.mast {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  border-bottom: 1px solid transparent;
}
.mast-inner, .band, .footer {
  width: min(1180px, calc(100% - 48px));
  margin-left: auto;
  margin-right: auto;
}
.mast-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.mark {
  font-family: var(--serif);
  font-size: 28px;
  letter-spacing: -0.04em;
  text-decoration: none;
  line-height: 1;
}
.mark span { font-style: italic; }
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a {
  position: relative;
  text-decoration: none;
  color: var(--muted);
}
.nav-links a:hover, .nav-links a.is-current { color: var(--ink); }
.nav-links a.is-current::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 2px;
  border-radius: 2px;
  background: var(--blue);
}
.mast-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.version { color: var(--muted); font-size: 13px; }
.btn.nav-burger { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.theme-toggle { gap: 8px; }

.band {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(340px, 1.15fr);
  gap: 48px;
  align-items: center;
  padding: 72px 0;
}
.band-stack { grid-template-columns: 1fr; align-items: start; gap: 28px; }
.band-stack .band-copy { max-width: 680px; }
.kicker {
  margin: 0 0 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}
h1 { margin: 0 0 16px; font-size: clamp(48px, 6vw, 80px); line-height: 0.94; }
h1 em { font-style: italic; }
h2 { margin: 0 0 12px; font-size: clamp(36px, 4vw, 56px); line-height: 1; }
h3 { margin: 0; font-size: 28px; }
.lede, .band-copy p { margin: 0; color: var(--muted); line-height: 1.6; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 0; }
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 0;
}
.facts div {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 10px 30px rgba(40, 32, 16, 0.05);
}
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }

.bench, .price-card, .download-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.bench { overflow: hidden; }
.bench-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.bench-head::before {
  content: "";
  width: 48px;
  height: 12px;
  flex: none;
  background:
    radial-gradient(circle at 6px 6px, #ff5f57 4px, transparent 4.5px),
    radial-gradient(circle at 22px 6px, #febc2e 4px, transparent 4.5px),
    radial-gradient(circle at 38px 6px, #28c840 4px, transparent 4.5px);
}
.samples { display: flex; gap: 6px; }
.samples button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
}
.samples button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
.bench-meta {
  margin-left: auto;
  display: flex;
  gap: 8px;
  font-size: 12px;
}
.bench-meta span {
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}
#diff-stats:not(:empty) { background: var(--added-bg); color: var(--added); }
.editors {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr);
  align-items: stretch;
}
.pane { display: flex; flex-direction: column; min-width: 0; }
.pane + .pane { border-left: 0; }
.pane > span {
  padding: 12px 14px 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
textarea {
  width: 100%;
  min-height: 148px;
  flex: 1;
  resize: none;
  border: 0;
  background: transparent;
  padding: 8px 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
}
.pane:focus-within { background: color-mix(in srgb, var(--blue) 6%, transparent); }
.gutter { position: relative; cursor: col-resize; touch-action: none; }
.gutter::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}
.gutter::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 10px;
  height: 28px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.gutter:hover::before, .gutter.is-dragging::before { background: var(--blue); }

.diff-grid { border-top: 1px solid var(--line); max-height: 320px; overflow: auto; }
.diff-row { display: grid; grid-template-columns: 1fr 1fr; }
.side {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  min-height: 28px;
  align-items: start;
}
.side + .side { border-left: 1px solid var(--line); }
.sign, .code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  padding-top: 4px;
  padding-bottom: 4px;
}
.sign { text-align: center; }
.code { white-space: pre; padding-right: 12px; }
.side.removed { background: var(--removed-bg); color: var(--removed); }
.side.added { background: var(--added-bg); color: var(--added); }
.side.changed .minus { color: var(--removed); }
.side.changed .plus { color: var(--added); }
.side.empty {
  background-color: var(--empty);
  background-image: repeating-linear-gradient(-45deg, transparent, transparent 4px, var(--line) 4px, var(--line) 5px);
}
mark { color: inherit; border-radius: 4px; padding: 0 2px; }
mark.minus { background: var(--removed-mark); }
mark.plus { background: var(--added-mark); }
.bench-help {
  margin: 0;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.folder-app { display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.folder-app aside {
  padding: 22px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 4%, var(--card));
}
.field-label {
  margin: 14px 0 4px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.field-label:first-child { margin-top: 0; }
.folder-name { margin: 0; font-family: var(--serif); font-size: 28px; }
.folder-app .btn { margin-top: 18px; }
.aside-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.file-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 0;
}
.file-toolbar h3 { font-size: 26px; }
.filters { position: relative; margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
#filter-thumb { display: none; }
.filters button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}
.filters button.is-selected {
  background: var(--blue);
  color: var(--blue-ink);
  border-color: var(--blue);
}
.search input {
  width: calc(100% - 32px);
  margin: 14px 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
}
.file-list { list-style: none; margin: 0; padding: 0 8px 8px; }
.file-open {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 10px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: 12px;
}
.dot { display: none; }
.file-open:hover, .file-open[aria-expanded="true"] { background: color-mix(in srgb, var(--blue) 8%, transparent); }
.file-id strong, .file-id small { display: block; }
.file-id strong { font-weight: 600; }
.file-id small, .file-size { color: var(--muted); font-size: 12px; }
.file-status {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 8px;
}
.file-status.modified { background: var(--modified-bg); color: var(--modified); }
.file-status.added { background: var(--added-bg); color: var(--added); }
.file-status.removed { background: var(--removed-bg); color: var(--removed); }
.file-status.same { background: var(--line); color: var(--muted); }
.file-detail { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 180ms ease; }
.file-detail.is-open { grid-template-rows: 1fr; }
.file-detail-inner { min-height: 0; overflow: hidden; }
.mini-diff { border-radius: 12px; overflow: hidden; }
.mini-diff.diff-grid { max-height: none; border-top: 0; }
.mini-diff .code { white-space: pre-wrap; }
.file-list li.is-entering { animation: rise 280ms ease both; }
.empty { color: var(--muted); padding: 22px 12px; }

.sources { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sources article + article { border-left: 1px solid var(--line); }
.sources header, .result header {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.source-body {
  margin: 0;
  padding: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
}
.src-changed { background: var(--modified-bg); color: var(--modified); border-radius: 6px; }
.result { border-top: 1px solid var(--line); }
.merge-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.merge-actions button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
}
.merge-actions button.is-selected, .merge-actions button[aria-pressed="true"] {
  background: var(--blue);
  color: var(--blue-ink);
  border-color: var(--blue);
}
.conflict { margin: 8px 0; border-radius: 12px; overflow: hidden; }
.conflict-group { padding: 6px 10px; }
.conflict-group.remote { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.conflict-group > span {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.took { animation: settle 800ms ease; border-radius: 6px; }
@keyframes settle {
  from { background: var(--added-bg); }
  to { background: transparent; }
}

.cli-card pre {
  margin: 0;
  padding: 8px 18px 20px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre;
  overflow-x: auto;
}
#copy-cli.is-copied { background: var(--added-bg); color: var(--added); border-color: transparent; }

.price-grid, .downloads {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.price-card, .download-card { padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.price {
  font-family: var(--serif);
  font-size: 42px;
  margin: 4px 0;
  line-height: 1;
}
.price-card p, .price-card li { color: var(--muted); line-height: 1.55; }
.price-card ul { margin: 0 0 8px; padding-left: 18px; }
.price-card .btn, .download-card { margin-top: auto; }
.price-card .btn { align-self: flex-start; }
.price-card-main {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.price-card-main p, .price-card-main li { color: color-mix(in srgb, var(--paper) 78%, transparent); }
.price-card-main .btn { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.download-card {
  text-decoration: none;
  min-height: 168px;
  transition: transform 160ms ease;
}
.download-card:hover { transform: translateY(-3px); }
.dl-os {
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
}
.dl-detail { font-family: var(--serif); font-size: 32px; color: var(--ink); line-height: 1.1; }
.dl-action { margin-top: auto; font-style: normal; color: var(--blue); }
.download-note { min-height: 1.4em; margin: 14px 0 0; color: var(--muted); }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px 0 56px;
}
.footer p { max-width: 520px; margin: 8px 0 0; color: var(--muted); }
.footer-links { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.footer-links a { color: var(--muted); }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .download-card, .file-list li.is-entering, .took, .file-detail { animation: none; transition: none; }
}

@media (max-width: 980px) {
  .mast-inner, .band, .footer { width: min(1180px, calc(100% - 32px)); }
  .band, .price-grid, .downloads, .folder-app, .sources { grid-template-columns: 1fr; }
  .btn.nav-burger { display: inline-flex; }
  .version { display: none; }
  .nav-links {
    display: none;
    position: absolute;
    top: 72px;
    left: 16px;
    right: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { min-height: 44px; display: flex; align-items: center; }
  .nav-links a.is-current::after { display: none; }
  h1 { font-size: 48px; }
  .editors { grid-template-columns: 1fr !important; }
  .gutter { display: none; }
  .pane + .gutter + .pane, .editors .pane:last-child { border-top: 1px solid var(--line); }
  .diff-row { grid-template-columns: 1fr; }
  .side + .side { border-left: 0; border-top: 1px solid var(--line); }
  .folder-app aside { border-right: 0; border-bottom: 1px solid var(--line); }
  .sources article + article { border-left: 0; border-top: 1px solid var(--line); }
  .file-toolbar { align-items: flex-start; flex-direction: column; }
  .filters { margin-left: 0; }
  .footer { flex-direction: column; align-items: flex-start; }
  .footer-links { align-items: flex-start; }
  .bench-head { flex-wrap: wrap; }
  .bench-meta { margin-left: 0; }
}
