:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-raised: #f0f0f0;
  --ink: #0a0a0a;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-disabled: #999999;
  --border: #e8e8e8;
  --border-visible: #c9c9c9;
  --accent: #d71921;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-section: 80px;
  --space-4xl: 96px;
  --body-font: "Space Grotesk", "DM Sans", system-ui, sans-serif;
  --data-font: "Space Mono", "JetBrains Mono", "SF Mono", monospace;
  --content-width: 920px;
}

html[data-theme="dark"] {
  --bg: #000000;
  --surface: #111111;
  --surface-raised: #1a1a1a;
  --ink: #ffffff;
  --text-primary: #e8e8e8;
  --text-secondary: #999999;
  --text-disabled: #666666;
  --border: #222222;
  --border-visible: #333333;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.topbar {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1280px, calc(100% - 48px));
  min-height: 72px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
}

.brand,
.topnav,
.section-label,
.section-note,
.row-index,
.site-footer {
  font-family: var(--data-font);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.brand-mark {
  position: relative;
  display: inline-block;
  flex: 0 0 18px;
  width: 18px;
  height: 15px;
}

.brand-mark i {
  position: absolute;
  top: 1px;
  width: 9px;
  height: 13px;
  border: 1px solid currentColor;
  background: transparent;
  content: "";
}

.brand-mark i:first-child {
  left: 0;
  border-radius: 2px 0 0 2px;
  transform: skewY(-5deg);
}

.brand-mark i:last-child {
  right: 0;
  border-radius: 0 2px 2px 0;
  transform: skewY(5deg);
}

.brand-mark::before {
  position: absolute;
  z-index: 1;
  top: 2px;
  left: 50%;
  width: 1px;
  height: 12px;
  background: currentColor;
  content: "";
  transform: translateX(-50%);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
}

.language-switch,
.theme-toggle,
.github-link {
  min-height: 36px;
  border: 1px solid var(--border-visible);
  border-radius: 4px;
  background: transparent;
}

.topnav a,
.topnav button {
  transition: border-color 180ms ease-out, color 180ms ease-out;
}

.topnav a:hover,
.topnav a:focus-visible,
.topnav button:hover,
.topnav button:focus-visible {
  color: var(--accent);
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--ink);
}

.language-switch {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
}

.language-option,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--data-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.language-option {
  min-width: 38px;
  min-height: 34px;
  padding: 0 9px;
}

.language-option + .language-option {
  border-left: 1px solid var(--border-visible);
}

.language-option.is-active {
  background: var(--ink);
  color: var(--bg);
}

.theme-toggle {
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--border-visible);
}

.language-switch:hover,
.language-switch:focus-within,
.theme-toggle:hover,
.theme-toggle:focus-visible,
.github-link:hover,
.github-link:focus-visible {
  border-color: var(--border-visible);
}

.theme-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  align-items: center;
  justify-content: center;
}

.theme-icon svg {
  display: block;
  width: 16px;
  height: 16px;
}

.theme-moon {
  display: none !important;
}

html[data-theme="dark"] .theme-sun {
  display: none;
}

html[data-theme="dark"] .theme-moon {
  display: block !important;
}

.theme-label {
  display: none;
}

.doc-shell {
  width: min(var(--content-width), calc(100% - 48px));
  margin: 0 auto;
  padding-top: 72px;
}

.intro {
  padding: var(--space-4xl) 0 var(--space-3xl);
}

.signal-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-weight: 500;
}

h1 {
  margin-bottom: var(--space-lg);
  font-size: clamp(52px, 8vw, 84px);
  line-height: .95;
  letter-spacing: -.055em;
}

h1 .title-secondary {
  color: var(--text-secondary);
}

.lead {
  width: 100%;
  margin: 0;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1.55;
}

.lead-highlight {
  color: var(--ink);
  font-weight: 600;
}

.doc-section {
  padding: var(--space-section) 0;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.section-label,
.section-note {
  margin: 0 0 var(--space-sm);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
}

.section-note {
  margin: 7px 0 0;
  color: var(--text-disabled);
  white-space: nowrap;
}

h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -.035em;
}

.command-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 64px;
  padding: 0 var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border-visible);
  border-radius: 8px;
}

.command-row code {
  overflow-x: auto;
  color: var(--ink);
  font-family: var(--data-font);
  font-size: 13px;
  white-space: nowrap;
}

.copy-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--border-visible);
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--data-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
  text-transform: uppercase;
  transition: border-color 180ms ease-out, color 180ms ease-out;
}

.command-row > .copy-button {
  border-color: transparent;
  box-shadow: none;
}

.copy-button:hover,
.copy-button:focus-visible {
  border-color: var(--ink);
  color: var(--accent);
}

.copy-button.is-copied,
.copy-button.is-error {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  align-items: center;
  justify-content: center;
}

.copy-icon svg {
  display: block;
  width: 16px;
  height: 16px;
}

.check-svg,
.error-svg {
  display: none !important;
}

.copy-button.is-copied .copy-svg,
.copy-button.is-error .copy-svg {
  display: none;
}

.copy-button.is-copied .check-svg,
.copy-button.is-error .error-svg {
  display: block !important;
}

.feature-list,
.declaration-list,
.usage-list {
  border-top: 1px solid var(--border);
}

.feature-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: var(--space-md);
  align-items: start;
  padding: 20px 0;
}

.feature-row.feature-expandable {
  padding: 0;
}

.feature-trigger {
  position: relative;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: var(--space-md);
  align-items: start;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.feature-trigger > .row-index {
  display: none;
}

.feature-expandable .feature-trigger {
  padding: 13px 2px;
  transition: background-color 180ms ease-in-out;
}

.feature-expandable .feature-trigger:hover,
.feature-expandable .feature-trigger:focus-visible {
  background: var(--surface-raised);
}

.feature-content {
  min-width: 0;
  grid-column: 2;
}

.feature-chevron {
  position: relative;
  display: block;
  width: 10px;
  height: 10px;
  margin-top: 3px;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  color: var(--text-secondary);
  transform: rotate(0);
  transition: transform 200ms ease-in-out, color 200ms ease-in-out;
}

.feature-chevron::before,
.feature-chevron::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 1px;
  background: currentColor;
  content: "";
  transform: translate(-50%, -50%);
}

.feature-chevron::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.feature-trigger[aria-expanded="true"] .feature-chevron {
  color: var(--ink);
  transform: rotate(45deg);
}

.declaration-panel {
  grid-column: 1 / -1;
  margin-top: 0;
  padding: 0 2px;
  border-top: 1px solid var(--border);
}

.declaration-panel .declaration-list {
  border-top: 0;
}

#declaration-details {
  border-top: 0;
}

#declaration-details .declaration-row {
  border-bottom: 0;
}

#update-mechanism-details {
  border-top: 0;
}

#update-mechanism-details .declaration-row {
  border-bottom: 0;
}

.row-index {
  color: var(--text-disabled);
  font-size: 10px;
  font-weight: 700;
}

.feature-row h3 {
  margin: 0 0 var(--space-xs);
  font-size: 18px;
  line-height: 1.2;
}

.feature-row p {
  max-width: 600px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.usage-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: var(--space-md);
  align-items: start;
  padding: 20px 0;
}

.usage-row h3 {
  margin: 0 0 var(--space-xs);
  font-size: 18px;
  line-height: 1.2;
}

.usage-row p {
  max-width: 600px;
  margin: 0 0 10px;
  color: var(--text-secondary);
  font-size: 14px;
}

.prompt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  width: 100%;
  min-height: 42px;
  padding: 4px 6px 4px 12px;
  border-left: 2px solid var(--border-visible);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 4px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.prompt-row code {
  min-width: 0;
  color: var(--text-primary);
  font-family: var(--data-font);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.prompt-copy {
  min-height: 30px;
  padding: 0 9px;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-secondary);
}

.prompt-copy:hover,
.prompt-copy:focus-visible {
  border-color: var(--border-visible);
  color: var(--accent);
}

.declaration-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: var(--space-md);
  align-items: center;
  min-height: 58px;
  padding-left: calc(48px + var(--space-md));
  border-bottom: 1px solid var(--border);
}

.declaration-row code {
  color: var(--ink);
  font-family: var(--data-font);
  font-size: 13px;
  font-weight: 700;
}

.declaration-row span {
  color: var(--text-secondary);
  font-size: 14px;
  text-align: right;
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--space-md);
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 32px;
  border-top: 1px solid var(--border);
  color: var(--text-disabled);
}

.footer-credit {
  margin: 0;
  color: var(--text-disabled);
  font-family: var(--data-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.5;
  text-align: right;
  text-transform: uppercase;
}

.footer-credit a,
.support-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-visible);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 180ms ease-out;
}

.footer-credit a:hover,
.footer-credit a:focus-visible,
.support-link:hover,
.support-link:focus-visible {
  color: var(--accent);
}

.support-link {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.footer-meta {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 12px;
  color: var(--text-disabled);
  font-family: var(--data-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: left;
}

.footer-meta a {
  color: inherit;
  text-decoration: none;
  transition: color 180ms ease-out;
}

.footer-meta a:hover,
.footer-meta a:focus-visible {
  color: var(--accent);
}

.coffee-dialog[hidden] {
  display: none;
}

.coffee-dialog {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.coffee-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .76);
}

.coffee-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 8px;
  overflow: visible;
  border: 1px solid var(--border-visible);
  background: var(--surface);
}

.coffee-panel img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 64px);
  object-fit: contain;
}

.coffee-close {
  position: absolute;
  z-index: 2;
  top: -16px;
  right: -16px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--border-visible);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--data-font);
  font-size: 20px;
  line-height: 1;
}

.coffee-close:hover,
.coffee-close:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

body.dialog-open {
  overflow: hidden;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .topbar,
  .site-footer {
    width: calc(100% - 32px);
  }

  .topnav {
    gap: 4px;
  }

  .theme-toggle {
    padding: 0 8px;
  }

  .theme-label {
    display: none;
  }

  .github-link {
    padding: 0 8px;
  }

  .doc-shell {
    width: calc(100% - 32px);
  }

  .intro {
    padding: var(--space-3xl) 0 var(--space-2xl);
  }

  h1 {
    font-size: clamp(48px, 15vw, 68px);
  }

  .lead {
    font-size: 16px;
  }

  .doc-section {
    padding: var(--space-2xl) 0;
  }

  .section-heading {
    flex-direction: column;
    gap: var(--space-md);
  }

  .section-note {
    margin-top: 0;
  }

  .command-row {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .command-row code {
    width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.6;
  }

  .feature-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .feature-trigger {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .usage-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .declaration-row {
    grid-template-columns: minmax(112px, .45fr) minmax(0, 1fr);
    gap: 12px;
    padding: 13px 0 13px calc(36px + var(--space-md));
  }

  .declaration-row span {
    font-size: 13px;
  }

  .site-footer {
    grid-template-columns: 1fr;
    align-items: start;
    gap: var(--space-sm);
  }

  .footer-credit {
    text-align: left;
  }

  .coffee-dialog {
    padding: 16px;
  }

  .coffee-close {
    top: -12px;
    right: -12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
