:root {
  color-scheme: light dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f0e8;
  color: #20201d;
  --surface: #fffdf8;
  --border: #d8d1c0;
  --muted: #4b4b44;
  --accent: #2f7d5c;
  --code-bg: #20201d;
  --code-text: #f8f3e8;
  --button-bg: #ebe5d6;
  --button-active: #20201d;
  --button-active-text: #fffdf8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f3f0e8;
  color: #20201d;
}

.page {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: start;
  margin-bottom: 36px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #5f6f61;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(2.4rem, 8vw, 5rem);
  line-height: 0.94;
}

h2 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

h3 {
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.lede {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.theme-switch {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 4px;
}

.theme-switch button {
  min-width: 58px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 8px 10px;
}

.theme-switch button[aria-pressed="true"] {
  background: var(--button-active);
  color: var(--button-active-text);
}

.preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.docs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
}

.panel-wide {
  grid-column: 1 / -1;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.panel a {
  color: var(--accent);
  font-weight: 700;
}

iframe {
  width: 100%;
  max-width: 420px;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.format-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 220px);
  gap: 18px;
  align-items: start;
}

.format-card {
  min-width: 0;
}

.format-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.format-heading h3 {
  margin-bottom: 0;
}

.format-heading code {
  color: var(--muted);
  white-space: nowrap;
}

.format-card iframe {
  display: block;
  max-width: 100%;
}

.format-card-wide {
  grid-column: 1 / -1;
}

.format-card-wide iframe {
  max-width: 728px;
}

.format-card-vertical {
  width: min(100%, 180px);
}

.format-card-compact {
  align-self: end;
}

.format-card-compact iframe {
  max-width: 300px;
}

pre {
  overflow-x: auto;
  margin: 0 0 16px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 16px;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

.panel p,
.panel li,
.panel dd {
  color: var(--muted);
  line-height: 1.55;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.field-grid > div {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

dt {
  font-weight: 800;
}

dd {
  margin: 0;
}

ul {
  margin: 0;
  padding-left: 20px;
}

body.theme-light {
  color-scheme: light;
  background: #f3f0e8;
  color: #20201d;
  --surface: #fffdf8;
  --border: #d8d1c0;
  --muted: #4b4b44;
  --accent: #2f7d5c;
  --code-bg: #20201d;
  --code-text: #f8f3e8;
  --button-active: #20201d;
  --button-active-text: #fffdf8;
}

body.theme-dark {
  color-scheme: dark;
  background: #171916;
  color: #f2eee4;
  --surface: #22241f;
  --border: #3a3d35;
  --muted: #c6c0b3;
  --accent: #8fc9a7;
  --code-bg: #0f100e;
  --code-text: #f5efe4;
  --button-active: #f5efe4;
  --button-active-text: #171916;
}

@media (prefers-color-scheme: dark) {
  body.theme-auto {
    background: #171916;
    color: #f2eee4;
    --surface: #22241f;
    --border: #3a3d35;
    --muted: #c6c0b3;
    --accent: #8fc9a7;
    --code-bg: #0f100e;
    --code-text: #f5efe4;
    --button-active: #f5efe4;
    --button-active-text: #171916;
  }

  body.theme-auto .eyebrow {
    color: #a9c5a8;
  }

  body.theme-auto .panel {
    border-color: var(--border);
  }
}

body.theme-dark .eyebrow {
  color: #a9c5a8;
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 24px, 980px);
    padding: 32px 0;
  }

  .intro,
  .preview,
  .docs,
  .field-grid,
  .format-grid {
    grid-template-columns: 1fr;
  }

  .format-card-wide {
    grid-column: auto;
  }

  .theme-switch {
    width: 100%;
  }

  .theme-switch button {
    flex: 1;
  }
}
