:root {
  --paper: oklch(0.97 0.018 88);
  --ink: oklch(0.19 0.025 255);
  --vermilion: oklch(0.61 0.2 30);
  --cobalt: oklch(0.48 0.18 255);
  --mint: oklch(0.84 0.09 165);
  --rule: oklch(0.9 0.012 88 / 0.46);
  --muted: oklch(0.44 0.02 255);
  --code: oklch(0.92 0.026 170);
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 32px 32px;
  font-family: "Spline Sans", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover {
  color: var(--vermilion);
}

button,
input,
textarea {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.site-header,
footer {
  width: min(var(--max), calc(100% - 48px));
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-header {
  min-height: 76px;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  display: block;
  width: 118px;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.12rem;
}

.wordmark .hw-word {
  display: block;
  width: 100%;
  height: auto;
}

nav {
  display: flex;
  gap: 18px;
  font-size: 0.93rem;
  font-weight: 600;
}
nav a {
  text-decoration: none;
}
nav a[aria-current="page"] {
  color: var(--vermilion);
}

main {
  overflow: hidden;
}

.hero,
.section-grid,
.specimen-section,
.how-it-works,
.closing,
.install-strip {
  width: min(var(--max), calc(100% - 48px));
  margin: auto;
}

.hero {
  min-height: 680px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  align-items: center;
  gap: clamp(48px, 10vw, 144px);
}

.hero-copy {
  padding: 64px 0;
}
.eyebrow,
.stage-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: "Martian Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}
h1,
h2 {
  line-height: 1.04;
  letter-spacing: 0;
}
h1 {
  max-width: 9ch;
  margin-bottom: 28px;
  font-size: clamp(3.4rem, 7vw, 6.8rem);
}
h2 {
  max-width: 13ch;
  margin-bottom: 18px;
  font-size: clamp(2.2rem, 4.4vw, 4.1rem);
}
.handwritten-heading .hw-sentence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}
.handwritten-heading .hw-word {
  display: block;
  width: auto;
  max-width: 100%;
  height: 1em;
}
.hero-summary,
.section-intro > p:not(.eyebrow),
.docs-lead {
  max-width: 55ch;
  color: var(--muted);
  font-size: 1.12rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}
.button-primary {
  color: var(--paper);
  background: var(--ink);
}
.button-primary:hover {
  color: var(--ink);
  background: var(--mint);
}
.button-quiet {
  background: transparent;
}
.button-quiet:hover {
  background: var(--code);
  color: var(--ink);
}

.hero-canvas {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 5vw, 72px);
  background: var(--mint);
  border: 1px solid var(--ink);
  box-shadow: 12px 12px 0 var(--cobalt);
  transform: rotate(-2deg);
}
.hero-canvas #hero-writing {
  min-height: 190px;
  display: grid;
  align-content: center;
  transform: rotate(2deg);
}
.hero-canvas #hero-writing .hw-sentence,
.hero-canvas #hero-writing .hw-token {
  display: block !important;
  width: 100%;
}
.hero-canvas .hw-word {
  width: min(100%, 500px);
  height: auto;
}
.canvas-details {
  margin: 0;
  font-family: "Martian Mono", monospace;
  font-size: 0.74rem;
}
.canvas-details {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in oklch, var(--ink), transparent 65%);
}
.canvas-details p {
  margin: 0;
}

.install-strip {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.install-strip p {
  margin: 0;
  font-weight: 700;
}
.install-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
code {
  font-family: "Martian Mono", monospace;
  font-size: 0.8em;
}
.copy-command {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 10px;
  color: var(--ink);
  border: 1px solid color-mix(in oklch, var(--mint), var(--ink) 25%);
  border-radius: 3px;
  background: var(--code);
  cursor: pointer;
}
.copy-command code {
  white-space: nowrap;
}
.copy-command span,
.copy-button {
  padding: 4px 6px;
  color: var(--paper);
  border: 0;
  border-radius: 2px;
  background: var(--ink);
  font-family: "Martian Mono", monospace;
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1;
}
.copy-command:hover,
.copy-command:focus-visible {
  background: var(--mint);
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(40px, 10vw, 144px);
  padding: 160px 0;
}
.workbench {
  display: grid;
  align-content: start;
  gap: 24px;
  padding-top: 4px;
}
.control-row,
.color-picker {
  border: 0;
  margin: 0;
  padding: 0;
}
.control-row label,
.color-picker legend {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}
textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  padding: 14px;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: oklch(0.99 0.008 88);
}
.swatches {
  display: flex;
  gap: 12px;
}
.swatch {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--swatch);
  cursor: pointer;
}
.swatch.is-selected {
  outline: 3px solid var(--paper);
  box-shadow: 0 0 0 5px var(--ink);
}
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--vermilion);
}

.preview-stage {
  grid-column: 1 / -1;
  min-height: 300px;
  display: grid;
  align-content: center;
  padding: 36px;
  background: oklch(0.99 0.008 88);
  border: 1px solid var(--ink);
  box-shadow: 10px 10px 0 var(--vermilion);
}
.preview-stage #writing-preview {
  overflow-wrap: anywhere;
}
.preview-stage .hw-word {
  max-width: 100%;
  height: auto;
}

.specimen-section {
  padding: 120px 0;
  border-top: 1px solid var(--ink);
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
}
.specimen-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 48px;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}
.specimen {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 28px;
  background: var(--paper);
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.specimen:nth-child(2n) {
  background: var(--code);
}
.specimen .hw-word {
  width: min(100%, 150px);
  height: auto;
}
.variation-panel {
  display: grid;
  grid-template-columns: minmax(200px, 0.8fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: 28px;
  padding: 32px 0 0;
}
.variation-panel h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}
.variation-panel p:not(.eyebrow) {
  max-width: 34ch;
  margin: 0;
  color: var(--muted);
}
.variation-samples {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 110px;
  border: 1px solid var(--ink);
}
.variation-sample {
  display: grid;
  place-items: center;
  padding: 16px;
  background: oklch(0.99 0.008 88);
  border-right: 1px solid var(--ink);
}
.variation-sample:last-child {
  border-right: 0;
}
.variation-sample .hw-word {
  width: min(100%, 140px);
  height: auto;
}

.how-it-works {
  padding-top: 140px;
  padding-bottom: 140px;
  border-top: 1px solid var(--ink);
}
.steps {
  display: grid;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.steps li {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
  font-size: 1.1rem;
}
.steps strong {
  display: block;
  margin-bottom: 4px;
  color: var(--vermilion);
}

.closing {
  padding: 140px 0;
  text-align: center;
}
.closing h2,
.closing .hero-actions {
  margin-right: auto;
  margin-left: auto;
}
.closing .hero-actions {
  justify-content: center;
}

footer {
  min-height: 96px;
  border-top: 1px solid var(--ink);
  font-family: "Martian Mono", monospace;
  font-size: 0.72rem;
}
footer > span {
  font-weight: 600;
}
footer a {
  margin-left: 16px;
}

.docs-layout {
  width: min(var(--max), calc(100% - 48px));
  min-height: calc(100vh - 172px);
  margin: auto;
  display: grid;
  grid-template-columns: 190px minmax(0, 720px);
  gap: clamp(48px, 10vw, 160px);
  padding: 96px 0 140px;
}
.docs-nav {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 12px;
  font-size: 0.92rem;
}
.docs-nav a {
  color: var(--muted);
  text-decoration: none;
}
.docs-nav a:hover {
  color: var(--vermilion);
}
.docs-content h1 {
  max-width: 11ch;
  font-size: clamp(3.4rem, 6vw, 5.4rem);
}
.docs-content section {
  margin-top: 76px;
  scroll-margin-top: 24px;
}
.docs-content h2 {
  font-size: clamp(2rem, 4vw, 3.25rem);
}
.docs-content p {
  max-width: 68ch;
}
pre {
  position: relative;
  overflow-x: auto;
  padding: 52px 20px 20px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  line-height: 1.65;
}
pre code {
  font-size: 0.82rem;
}
.copy-button {
  position: absolute;
  top: 12px;
  right: 12px;
  cursor: pointer;
}
.copy-button:hover,
.copy-button:focus-visible {
  color: var(--ink);
  background: var(--mint);
}
.docs-demo {
  min-height: 112px;
  display: grid;
  align-content: center;
  padding: 20px;
  background: var(--mint);
  border: 1px solid var(--ink);
}
.docs-demo .hw-word {
  max-width: 100%;
  height: auto;
}
.api-list {
  display: grid;
  gap: 18px;
}
.api-list div {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.api-list dt {
  margin-bottom: 4px;
  font-weight: 700;
}
.api-list dd {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .site-header,
  footer,
  .hero,
  .section-grid,
  .specimen-section,
  .how-it-works,
  .closing,
  .install-strip,
  .docs-layout {
    width: min(100% - 32px, var(--max));
  }
  .site-header {
    min-height: 68px;
  }
  nav {
    gap: 12px;
    font-size: 0.82rem;
  }
  nav a:nth-last-child(-n + 2) {
    display: none;
  }
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 64px 0 84px;
  }
  .hero-copy {
    padding: 0;
  }
  .hero-canvas {
    min-height: 260px;
    box-shadow: 7px 7px 0 var(--cobalt);
  }
  .hero-canvas #hero-writing {
    min-height: 110px;
  }
  .canvas-details {
    display: grid;
    gap: 4px;
  }
  .install-strip {
    grid-template-columns: 1fr;
  }
  .section-grid {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 96px 0;
  }
  .preview-stage {
    min-height: 240px;
    padding: 24px;
  }
  .specimen-section {
    padding: 88px 0;
  }
  .section-heading {
    display: block;
  }
  .specimen-grid {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 32px;
  }
  .specimen {
    min-height: 130px;
  }
  .variation-panel {
    grid-template-columns: 1fr;
  }
  .variation-samples {
    min-height: 96px;
  }
  .how-it-works {
    padding: 96px 0;
  }
  .closing {
    padding: 96px 0;
    text-align: left;
  }
  .closing .hero-actions {
    justify-content: flex-start;
  }
  footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 12px;
    padding: 24px 0;
  }
  footer a {
    margin-left: 0;
  }
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 64px 0 96px;
  }
  .docs-nav {
    position: static;
    grid-auto-flow: column;
    grid-template-columns: repeat(6, max-content);
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
  }
}

@media (max-width: 480px) {
  .site-header,
  footer,
  .hero,
  .section-grid,
  .specimen-section,
  .how-it-works,
  .closing,
  .install-strip,
  .docs-layout {
    width: min(100% - 24px, var(--max));
  }
  .site-header {
    gap: 16px;
  }
  .wordmark {
    width: 98px;
  }
  nav {
    gap: 10px;
    font-size: 0.78rem;
  }
  .hero {
    padding: 48px 0 64px;
  }
  h1,
  .docs-content h1 {
    margin-bottom: 20px;
    font-size: 3rem;
  }
  h2,
  .docs-content h2 {
    font-size: 2rem;
  }
  .hero-summary,
  .section-intro > p:not(.eyebrow),
  .docs-lead {
    font-size: 1rem;
  }
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 24px;
  }
  .hero-actions .button {
    width: 100%;
  }
  .hero-canvas {
    min-height: 230px;
    padding: 24px;
    box-shadow: 5px 5px 0 var(--cobalt);
  }
  .canvas-details {
    font-size: 0.66rem;
  }
  .install-strip {
    gap: 16px;
    padding: 20px 0;
  }
  .install-list {
    display: grid;
    grid-template-columns: 1fr;
  }
  .copy-command {
    width: 100%;
    justify-content: space-between;
  }
  .copy-command code {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .section-grid,
  .how-it-works,
  .closing {
    padding: 72px 0;
  }
  .workbench {
    gap: 20px;
  }
  .swatches {
    justify-content: space-between;
  }
  .swatch {
    width: 42px;
    height: 42px;
  }
  .preview-stage {
    min-height: 200px;
    padding: 20px;
    box-shadow: 6px 6px 0 var(--vermilion);
  }
  .specimen-section {
    padding: 72px 0;
  }
  .specimen-grid {
    grid-template-columns: 1fr;
  }
  .specimen {
    min-height: 116px;
  }
  .variation-panel {
    gap: 20px;
  }
  .variation-samples {
    grid-template-columns: 1fr;
  }
  .variation-sample {
    min-height: 82px;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }
  .variation-sample:last-child {
    border-bottom: 0;
  }
  .docs-layout {
    gap: 28px;
    padding: 48px 0 72px;
  }
  .docs-nav {
    gap: 18px;
  }
  .docs-content section {
    margin-top: 56px;
  }
  pre {
    padding: 48px 16px 16px;
  }
  pre code {
    font-size: 0.74rem;
  }
  .docs-demo {
    min-height: 96px;
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .hero-canvas {
    transform: none;
  }
  .hero-canvas #hero-writing {
    transform: none;
  }
}
