:root {
  --color-bg: #faf6ef;
  --color-text: #2b2620;
  --color-muted: #7d7367;
  --color-rule: #e2d9c9;
  --color-accent: #c74a32;
  --color-squiggle: #7ac0e7;
  --color-fill: #e9f4fa;

  --space: 1.5rem;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;

  accent-color: var(--color-text);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0 auto;
  padding: calc(var(--space) * 2.5) var(--space) calc(var(--space) * 2);
  max-width: 42rem;
  font-family: system-ui, sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

h1,
h2,
h3 {
  line-height: 1.15;
}

a {
  color: var(--color-accent);
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

button {
  font: inherit;
  cursor: pointer;
}

.hero h1 {
  margin: 0;
  font-size: 2.75rem;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 26rem;
  margin-block: 1.1rem;
  color: var(--color-muted);
}

.quickstart {
  margin: 0;
  overflow-x: auto;
}

.rule {
  margin-block: calc(var(--space) * 2);
  color: var(--color-rule);
}

.section {
  margin-block: calc(var(--space) * 2);
}

.section > h2 {
  margin-block: 0 var(--space);
  font-size: 1.15rem;
}

.playground {
  display: grid;
  grid-template-columns: minmax(0, 12.5rem) minmax(0, 1fr);
  gap: calc(var(--space) * 1.5);
  align-items: start;
}

@media (width < 38rem) {
  .playground {
    grid-template-columns: minmax(0, 1fr);
  }
}

.controls {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  font-size: 0.85rem;
}

.control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 0.5rem;
}

.control > label:first-child,
.control > output,
.segmented > legend {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.control > output {
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

/* Full ink means this one is in the snippet, which prints only non-defaults */
.control > output[data-changed] {
  color: var(--color-text);
}

.control > input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
}

.control > input[type="color"] {
  grid-column: 1 / -1;
  width: 100%;
  height: 1.5rem;
  padding: 0;
  border: 1px solid var(--color-rule);
  background: none;
}

.control:has(input:disabled) > label:first-child,
.control:has(input:disabled) > output {
  opacity: 0.4;
}

.control__toggle,
.segmented__options label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-muted);
  cursor: pointer;
}

.control__toggle {
  grid-column: 1 / -1;
}

.control__toggle input,
.segmented__options input {
  margin: 0;
}

.segmented {
  display: grid;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented > legend {
  padding: 0;
}

.segmented__options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.segmented__options input:checked + span {
  color: var(--color-text);
}

.stage {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: var(--space);
  min-height: 12rem;
}

.stage__specimen {
  display: grid;
  place-items: center;
}

.stage__specimen p {
  margin: 0;
  max-width: 21rem;
}

.stage__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  justify-content: center;
}

.presets button[aria-pressed="true"] {
  color: var(--color-text);
  text-decoration: none;
}

.stage__actions button,
.codeblock__copy {
  padding: 0;
  border: 0;
  font-size: 0.8rem;
  color: var(--color-accent);
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.codeblock {
  position: relative;
  margin: var(--space) 0 0;
}

.codeblock pre,
.card__code {
  margin: 0;
  padding: 0;
  overflow-x: auto;
}

.quickstart code,
.codeblock code,
.card__code code {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.75;
  white-space: pre;
  color: var(--color-muted);
}

.codeblock__copy {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
}

.tok {
  color: var(--color-text);
}

.card {
  margin-block: calc(var(--space) * 2);
}

.card h3 {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: normal;
  color: var(--color-muted);
}

.card--flush {
  margin-block-start: 0;
}

.note {
  margin: 0.2rem 0 0;
  max-width: 30rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.section > .note {
  margin-block-end: var(--space);
}

.card__demo {
  display: grid;
  place-items: center;
  gap: var(--space);
  margin-block: calc(var(--space) * 1.1);
}

.card__demo--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space);
}

.card__demo--narrow > p {
  max-width: 21rem;
}

.card__demo p {
  margin: 0;
}

.card__demo svg {
  color: var(--color-squiggle);
}

/* The stroke has to follow the host's animated color, not a fixed tint */
.card__demo .shift svg {
  color: inherit;
}

.rows {
  place-items: stretch;
  gap: 1.2rem;
}

.row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 0.9rem;
  align-items: baseline;
}

/* Grid items are blockified, so the squiggle target has to be an inline child
   of the cell or it stops fragmenting per line when the text wraps */
.row__text {
  min-width: 0;
}

.row__value {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--color-muted);
  text-align: right;
}

.display {
  font-size: 1.75rem;
}

.pill,
.plain {
  padding: 0.6em 1.2em;
  border: none;
  border-radius: 999px;
  color: var(--color-text);
  background: none;
}

[data-example="pill"] .pill {
  min-width: 6.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--color-muted);
}

.plain {
  padding-inline: 0;
}

.pill:focus-visible,
.plain:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 6px;
}

.shift {
  transition: color 300ms;
}

.shift:hover {
  color: var(--color-accent);
}

.filled svg path {
  transition: fill 250ms;
}

.filled:hover svg path {
  fill: var(--color-fill);
}

.resizable {
  padding: 8px;
  width: 17rem;
  height: 6rem;
  max-width: 100%;
  min-width: 8rem;
  min-height: 4rem;
  resize: both;
  overflow: hidden;
}

.resizable > div {
  display: grid;
  place-items: center;
  height: 100%;
}

#specimen-box {
  border-radius: 34px 10px 34px 10px;
}

.footer {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.footer p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .shift,
  .filled svg path {
    transition-duration: 1ms;
  }
}
