/*
  Edit colors in :root.
  Edit hero visual styling in the .hero-visual* and SVG-related selectors.
*/

:root {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --bg-panel: #0a0a0a;
  --bg-panel-strong: #0a0a0a;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.28);
  --text: #f5f5f5;
  --text-muted: #b0b0b0;
  --text-soft: #8a8a8a;
  --accent: #f5f5f5;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --shadow: none;
  --radius: 0;
  --radius-sm: 0;
  --width: 1120px;
  --mono: "SFMono-Regular", "Roboto Mono", "Menlo", "Consolas", monospace;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --serif: "Chivo", "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  line-height: 1.6;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

code,
pre,
kbd {
  font-family: var(--mono);
}

.shell {
  width: min(calc(100% - 2rem), var(--width));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.7rem 1rem;
  background: #f5f5f5;
  color: #0a0a0a;
  border-radius: 0;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus-visible {
  top: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(10, 10, 10, 0.94);
  border-bottom: 1px solid var(--line);
}

.header-bar,
.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 4.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 0;
  padding: 16px 0 24px;
  width: 90px;
}

.brand-mark {
  width: clamp(8.5rem, 16vw, 10.75rem);
  height: auto;
  flex: 0 0 auto;
  display: block;
  overflow: visible;
}

.brand-text {
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.site-nav a,
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav a:hover,
.footer-links a:hover {
  color: var(--text);
}

.hero {
  padding: 4rem 0 1.5rem;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  align-items: center;
  gap: 2rem;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--text);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
  font-weight: 400;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 5.8rem);
  line-height: 0.88;
  max-width: 10ch;
}

h2 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.05rem;
  line-height: 1.25;
}

.hero-subtitle,
.section-head p,
.feature-card p,
.value-card p,
.userscript-card,
.source-card p,
.api-card p {
  color: var(--text-muted);
}

.hero-subtitle {
  max-width: 60ch;
  font-size: 1.1rem;
  margin: 1.5rem 0 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 2rem 0 1.4rem;
}

.button,
.copy-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  border-radius: 0;
  border: 1px solid var(--line-strong);
  padding: 0 1.15rem;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.button-icon {
  width: 1.3rem;
  height: 1.3rem;
  flex: 0 0 auto;
  margin-right: 0.55rem;
  transform: translateY(-2px);
}

.button-primary {
  background: #f5f5f5;
  color: #0a0a0a;
}

.button-primary:hover {
  background: #d9d9d9;
  border-color: #d9d9d9;
}

.button-secondary,
.copy-chip {
  background: #0a0a0a;
  border-color: var(--line-strong);
  color: var(--text);
}

.button-secondary:hover,
.copy-chip:hover {
  border-color: #f5f5f5;
  background: #151515;
}

.copy-chip {
  min-height: 2.2rem;
  padding: 0 0.85rem;
  font-size: 0.9rem;
}

.copy-chip.is-copied,
.button-secondary.is-copied {
  border-color: #f5f5f5;
  background: var(--accent-soft);
  color: var(--text);
}

.supporting-line {
  color: var(--text-soft);
  margin: 1rem 0 0;
}

.hero-visual-panel {
  position: relative;
}

.hero-visual-frame {
  position: relative;
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  background: #0a0a0a;
  box-shadow: var(--shadow);
}

.hero-visual-frame::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.hero-visual {
  width: 100%;
  height: 100%;
  min-height: 460px;
}

.grid-fill {
  fill: url(#grid);
}

.grid-stroke {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
}

#grid path {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.signal {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.signal-main {
  stroke: #f5f5f5;
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: round;
}

.signal-axis {
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
}

.beat-columns rect {
  fill: rgba(255, 255, 255, 0.24);
  stroke: none;
}

.axis-text text {
  fill: rgba(255, 255, 255, 0.54);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section {
  padding: 1.25rem 0 3.5rem;
}

.section-head {
  max-width: 55rem;
  margin-bottom: 1.8rem;
}

.section-head.compact {
  margin-bottom: 0;
}

.feature-grid,
.value-grid,
.source-card-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.feature-card,
.value-card,
.userscript-card,
.api-card,
.code-card {
  padding: 1.25rem;
  border-radius: 0;
  border: 1px solid var(--line);
  background: #0a0a0a;
}

.feature-card {
  display: grid;
  grid-template-columns: 3.9rem minmax(0, 1fr);
  align-items: start;
  column-gap: 1.15rem;
  row-gap: 0;
}

.feature-icon {
  width: 3.9rem;
  height: 3.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.feature-icon svg {
  width: 2.6rem;
  height: 2.6rem;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.feature-icon-userscript svg {
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature-body h3 {
  margin-bottom: 0.35rem;
}

.feature-body p {
  margin: 0;
}

.feature-card code {
  color: var(--text);
  font-size: 0.92em;
}

.code-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.code-card-wide,
.api-card {
  grid-column: span 2;
}

.code-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.code-card-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
  color: var(--text-muted);
}

.code-card-summary::-webkit-details-marker {
  display: none;
}

.code-card-summary::after {
  content: "+";
  margin-left: auto;
  color: var(--text);
}

.code-card-secondary[open] .code-card-summary::after {
  content: "-";
}

.summary-meta {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.code-card-secondary-body {
  margin-top: 1rem;
}

.envelope-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #0a0a0a;
}

.envelope-table {
  width: 100%;
  border-collapse: collapse;
}

.envelope-table th,
.envelope-table td {
  padding: 1rem 1.1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.envelope-table th {
  color: var(--text-muted);
  font-weight: 400;
}

.envelope-table tbody tr:last-child td {
  border-bottom: 0;
}

.modifier-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.modifier-card {
  padding-top: 0.25rem;
}

.modifier-card h3 {
  margin-bottom: 0.55rem;
}

.modifier-card p {
  margin: 0 0 0.85rem;
  color: var(--text-muted);
}

.envelope-note {
  margin: 1rem 0 0;
  color: var(--text-muted);
}

pre {
  margin: 0;
  padding: 1rem 1.05rem;
  overflow-x: hidden;
  border-radius: 0;
  background: #111111;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.94rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.lead-snippet {
  max-width: 52rem;
}

.shortcut-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #0a0a0a;
}

.shortcut-table {
  width: 100%;
  border-collapse: collapse;
}

.shortcut-table th,
.shortcut-table td {
  padding: 1.05rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.shortcut-table th {
  color: var(--text-muted);
  font-weight: 600;
}

.shortcut-table tbody tr:last-child td {
  border-bottom: 0;
}

.shortcut-table td:first-child {
  width: 38%;
  white-space: nowrap;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0 0.45rem;
  margin: 0 0.12rem;
  border-radius: 0;
  border: 1px solid var(--line-strong);
  background: #0a0a0a;
}

.userscript-layout,
.source-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 1rem;
  align-items: start;
}

.source-card-group {
  gap: 0;
  border-top: 1px solid var(--line);
}

.source-card {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.steps {
  margin: 0 0 1.25rem;
  padding-left: 1.2rem;
  color: var(--text-muted);
}

.steps li + li {
  margin-top: 0.6rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #0a0a0a;
}

.footer-bar p {
  margin: 0;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid #f5f5f5;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1080px) {
  .hero-layout,
  .userscript-layout,
  .source-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 3rem;
  }

  .hero-copy {
    order: 1;
  }

  .hero-visual-panel {
    display: none;
  }

  .feature-grid,
  .value-grid,
  .source-card-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feature-card {
    grid-template-columns: 3.575rem minmax(0, 1fr);
  }

  .feature-icon {
    width: 3.575rem;
    height: 3.575rem;
  }

  .feature-icon svg {
    width: 2.34rem;
    height: 2.34rem;
  }
}

@media (max-width: 760px) {
  .header-bar,
  .footer-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.9rem 0;
  }

  .site-nav,
  .footer-links {
    gap: 0.85rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .button {
    width: 100%;
  }

  .hero-visual-frame,
  .hero-visual {
    min-height: 340px;
  }

  .feature-grid,
  .value-grid,
  .source-card-group,
  .code-layout,
  .modifier-grid {
    grid-template-columns: 1fr;
  }

  .feature-card {
    grid-template-columns: 3.25rem minmax(0, 1fr);
    column-gap: 0.95rem;
  }

  .feature-icon {
    width: 3.25rem;
    height: 3.25rem;
  }

  .feature-icon svg {
    width: 2.145rem;
    height: 2.145rem;
  }

  .code-card-wide,
  .api-card {
    grid-column: auto;
  }

  .shortcut-table th,
  .shortcut-table td {
    padding: 0.95rem 1rem;
  }

  .shortcut-table td:first-child {
    width: auto;
  }
}
