* { box-sizing: border-box; }

:root {
  --text: #1f2328;
  --muted: #59636e;
  --link: #0969da;
  --rule: #d1d9e0;
  --rule-muted: #d1d9e0b3;
  --bg: #ffffff;
  --canvas-subtle: #f6f8fa;
  --code-bg: #818b981f;
  --note-border: #0969da;
  --note-bg: #ddf4ff80;
  --tip-border: #1a7f37;
  --tip-bg: #dafbe180;
}

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 32px;
}
@media (max-width: 600px) { .container { padding: 20px 16px; } }

/* ── Typography ──────────────────────────────────────────────────────────── */

code, kbd, pre, samp {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 85%;
}

p code, li code, td code {
  padding: 0.2em 0.4em;
  background: var(--code-bg);
  border-radius: 6px;
  white-space: break-spaces;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.25;
  margin-top: 24px;
  margin-bottom: 16px;
}

h1 {
  font-size: 2em;
  margin-top: 0;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--rule-muted);
}

h2 {
  font-size: 1.5em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--rule-muted);
}

h3 { font-size: 1.25em; }

p { margin: 0 0 16px; }

ul, ol { margin: 0 0 16px; padding-left: 2em; }
li { margin-bottom: 4px; }
li > p { margin: 8px 0; }

hr {
  border: 0;
  border-top: 1px solid var(--rule-muted);
  margin: 24px 0;
  height: 0;
}

.subtitle {
  color: var(--muted);
  font-size: 0.95em;
  margin-top: -12px;
  margin-bottom: 16px;
}

/* ── Alert callouts (GitHub-style) ───────────────────────────────────────── */

.alert {
  padding: 8px 16px;
  margin-bottom: 16px;
  color: inherit;
  border-left: 0.25em solid var(--note-border);
  background: transparent;
}
.alert p { margin: 8px 0; }
.alert-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--note-border);
  margin-bottom: 4px;
}
.alert-tip { border-left-color: var(--tip-border); }
.alert-tip .alert-title { color: var(--tip-border); }

/* ── Code blocks ─────────────────────────────────────────────────────────── */

pre.shell {
  background: var(--canvas-subtle);
  border-radius: 6px;
  padding: 12px 16px;
  overflow-x: auto;
  font-size: 85%;
  line-height: 1.45;
}
pre.shell code {
  padding: 0;
  background: transparent;
  border-radius: 0;
}

/* ── Section cards (index.html) ──────────────────────────────────────────── */

.sections { display: grid; gap: 12px; margin: 16px 0; }

.section-card {
  display: block;
  padding: 16px 20px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s;
}
.section-card:hover {
  background: var(--canvas-subtle);
  border-color: var(--link);
  text-decoration: none;
}
.section-card .sc-title {
  font-weight: 600;
  color: var(--link);
  font-size: 1em;
  margin-bottom: 4px;
}
.section-card:hover .sc-title { text-decoration: underline; }
.section-card .sc-desc {
  color: var(--muted);
  font-size: 0.9em;
  line-height: 1.5;
}

/* ── Example cards (p5examples.html) ─────────────────────────────────────── */

.examples {
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  margin: 16px 0 24px;
  background: #fff;
}

.card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  color: inherit;
}
.card:last-child { border-bottom: 0; }

.card-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.card-num {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: var(--muted);
}

.card-title {
  font-size: 1em;
  font-weight: 600;
  color: var(--link);
}
.card-title:hover { text-decoration: underline; }

.card-desc {
  color: var(--muted);
  font-size: 0.9em;
  line-height: 1.5;
  margin-bottom: 8px;
}

.tag {
  display: inline-block;
  padding: 0 7px;
  font-size: 12px;
  line-height: 18px;
  border: 1px solid var(--rule);
  color: var(--muted);
  border-radius: 2em;
  background: var(--canvas-subtle);
}

/* ── Collapsible technique details ───────────────────────────────────────── */

.card details { margin-top: 8px; font-size: 0.9em; }

.card details summary {
  cursor: pointer;
  color: var(--link);
  font-size: 1em;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.card details summary::-webkit-details-marker { display: none; }
.card details summary::before {
  content: '▶';
  font-size: 0.65em;
  transition: transform 0.15s;
  color: var(--muted);
}
.card details[open] summary::before { transform: rotate(90deg); }
.card details summary:hover { text-decoration: underline; }

.card details .detail-body {
  margin-top: 10px;
  padding: 12px 16px;
  background: var(--canvas-subtle);
  border-radius: 6px;
  border: 1px solid var(--rule);
}
.card details .detail-body p  { font-size: 0.95em; color: #333; }
.card details .detail-body ul { font-size: 0.95em; color: #333; margin-bottom: 10px; }
.card details .detail-body h3 { font-size: 0.95em; margin: 12px 0 6px; color: var(--text); border: 0; }
.card details .detail-body p:last-child,
.card details .detail-body ul:last-child { margin-bottom: 0; }

.card-source {
  margin-top: 8px;
  font-size: 0.9em;
}
.card-source a { color: var(--link); }

/* ── AI tips list ────────────────────────────────────────────────────────── */

.tips ol { margin-top: 8px; }
.tips li { margin-bottom: 10px; line-height: 1.6; }
.tips em { color: var(--text); font-style: italic; }

/* ── Footer ─────────────────────────────────────────────────────────────── */

footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--rule-muted);
  color: var(--muted);
  font-size: 12px;
}
