:root {
  --bg: #fafaf8;
  --paper: #ffffff;
  --ink: #2c2c2c;
  --muted: #888;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #2c2c2c;
  --accent-strong: #1a1a1a;
  --tag-bg: rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

code {
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.95em;
}

.site-shell {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero {
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.eyebrow,
.section-kicker,
.tag {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  color: var(--muted);
}

.hero h1,
.section-heading h2,
.turtle-header h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.02em;
}

.hero h1 {
  margin-top: 0.45rem;
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  line-height: 0.96;
  max-width: 30ch;
}

.hero-copy {
  max-width: 58rem;
  margin: 1.1rem 0 0;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--muted);
}

.content-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.section-block {
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.section-heading {
  display: grid;
  gap: 0.2rem;
  margin-bottom: 1rem;
}

.section-heading h2 {
  font-size: clamp(1.4rem, 3vw, 2.3rem);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.example-card,
.mini-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.example-card:hover,
.mini-card:hover {
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.example-card h3,
.mini-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.example-card p,
.mini-card p,
.turtle-lede,
.field-note,
.control-label,
.control-value,
.turtle-toolbar a,
.button-row button,
.button-row a {
  color: var(--muted);
}

.tag {
  justify-self: start;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--tag-bg);
  font-size: 0.7rem;
  display: flex;
    align-items: center;
}

.turtle-page {
  min-height: 100vh;
}

.turtle-shell {
  width: min(1240px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.turtle-backlink {
  color: var(--accent-strong);
  text-decoration: none;
}

.turtle-header {
  margin-top: 1rem;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.turtle-header h1 {
  margin-top: 0.35rem;
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.turtle-lede {
  max-width: 62rem;
  line-height: 1.7;
  margin: 0.85rem 0 0;
}

.turtle-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.sidebar-panel,
.viewport-panel,
.field-panel {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.sidebar-panel {
  padding: 1.25rem;
  align-self: start;
}

.viewport-panel {
  padding: 1rem;
}

.panel-title {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.controls-list {
  display: grid;
  gap: 0.85rem;
}

.control-field {
  display: grid;
  gap: 0.35rem;
}

.control-label,
.control-value {
  font-size: 0.9rem;
}

.control-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.control-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.button-row button,
.button-row a {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  text-decoration: none;
  cursor: pointer;
  padding: 0.7rem 1rem;
  font: inherit;
  transition:
    border-color 180ms ease;
}

.button-row button:hover,
.button-row a:hover {
  border-color: rgba(0, 0, 0, 0.2);
}

.field-note {
  margin: 1rem 0 0;
  line-height: 1.6;
  font-size: 0.92rem;
}

.svg-frame {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.svg-frame svg {
  width: 100%;
  height: 100%;
  display: block;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.mini-card {
  padding: 1rem;
}

.code-panel {
  margin-top: 1rem;
  padding: 1.25rem;
}

.code-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.code-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.code-tab {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 0.55rem 0.85rem;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.code-tab.is-active {
  border-color: var(--accent-strong);
  background: rgba(0, 0, 0, 0.05);
  color: var(--accent-strong);
}

.code-block {
  margin: 0;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #18211e;
  color: #f3f0e8;
  padding: 1rem;
}

.code-block code {
  display: block;
  min-width: max-content;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.86rem;
  line-height: 1.7;
}

.token-comment {
  color: #7f9a92;
}

.token-string {
  color: #f3b77e;
}

.token-number {
  color: #f08f87;
}

.token-keyword {
  color: #94d2bd;
}

.token-builtin {
  color: #9cc7ff;
}

@media (max-width: 900px) {
  .turtle-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .site-shell,
  .turtle-shell {
    width: min(100% - 1rem, 100%);
  }

  .hero,
  .section-block,
  .sidebar-panel,
  .viewport-panel,
  .field-panel,
  .turtle-header {
    border-radius: 10px;
  }

  .hero {
    padding: 1.5rem;
  }

  .code-panel-header {
    flex-direction: column;
  }
}
