*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg: #fff;
  --c-surface: #f5f7fa;
  --c-border: #dde1e6;
  --c-text: #1a1a2e;
  --c-muted: #5a6270;
  --c-accent: #2563eb;
  --c-accent-hover: #1d4ed8;
  --radius: 6px;
  --max-w: 960px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── header / nav ───────────────────────────── */
header {
  background: var(--c-text);
  color: #fff;
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
header .wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
header .logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  white-space: nowrap;
}
header .logo:hover { text-decoration: none; }
nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
nav a {
  color: rgba(255,255,255,.75);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
nav a:hover { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }
nav a.active { color: #fff; background: rgba(255,255,255,.15); }

/* ── main ───────────────────────────────────── */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
  flex: 1;
}
h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.subtitle { color: var(--c-muted); margin-bottom: 2rem; }

section { margin-bottom: 2.5rem; }
section h2 { font-size: 1.2rem; margin-bottom: 0.75rem; border-bottom: 1px solid var(--c-border); padding-bottom: 0.35rem; }

/* ── cards grid (index) ─────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: box-shadow .15s;
}
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.card h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.card p { color: var(--c-muted); font-size: 0.85rem; }

/* ── tables ──────────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
th, td { padding: 0.5rem 0.75rem; border: 1px solid var(--c-border); text-align: left; font-size: 0.9rem; }
th { background: var(--c-surface); font-weight: 600; }
tr:hover { background: #f9fafb; }

/* ── forms ───────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.25rem; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-inline { display: flex; align-items: center; gap: 0.5rem; }
button, .btn {
  padding: 0.5rem 1.25rem;
  background: var(--c-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
}
button:hover, .btn:hover { background: var(--c-accent-hover); }
button.secondary { background: var(--c-surface); color: var(--c-text); border: 1px solid var(--c-border); }

/* ── images ──────────────────────────────────── */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.image-card { border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; }
.image-card img { width: 100%; height: auto; display: block; }
.image-card .caption { padding: 0.5rem 0.75rem; font-size: 0.8rem; color: var(--c-muted); }

figure { margin-bottom: 1rem; }
figure img { max-width: 100%; border-radius: var(--radius); }
figcaption { font-size: 0.85rem; color: var(--c-muted); margin-top: 0.25rem; }

/* ── code ────────────────────────────────────── */
code { background: var(--c-surface); padding: 0.15rem 0.4rem; border-radius: 3px; font-size: 0.85em; }
pre { background: var(--c-surface); padding: 1rem; border-radius: var(--radius); overflow-x: auto; margin-bottom: 1rem; }
pre code { background: none; padding: 0; }

/* ── utils ───────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 99px;
  font-size: 0.75rem;
  color: var(--c-muted);
}
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.muted { color: var(--c-muted); }
.small { font-size: 0.85rem; }
dl { margin-bottom: 1rem; }
dt { font-weight: 600; margin-top: 0.5rem; }
dd { color: var(--c-muted); margin-left: 1rem; font-size: 0.9rem; }
blockquote { border-left: 3px solid var(--c-accent); padding: 0.5rem 1rem; margin: 1rem 0; background: var(--c-surface); border-radius: 0 var(--radius) var(--radius) 0; }

/* ── footer ──────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--c-muted);
  border-top: 1px solid var(--c-border);
}
footer .credit {
  margin-top: 0.5rem;
  font-family: monospace;
  font-size: 11px;
  color: #ccc;
}
footer .credit a {
  color: inherit;
  text-decoration: none;
}
footer .credit a:hover {
  color: #aaa;
  text-decoration: none;
}

/* ── responsive ──────────────────────────────── */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  header .wrap { gap: 0.75rem; }
}
