/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg: #fdfdfd;
  --color-text: #1a1a1a;
  --color-muted: #555;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-border: #e2e2e2;
  --color-surface: #f5f5f5;
  --color-header-bg: #fff;
  --max-width: 52rem;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

html { font-size: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Header / Nav ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-border);
}
.site-header nav { position: relative; }

.site-header nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.site-header-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  position: relative;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.github-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  padding: 0.35rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.github-link:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.site-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.25rem 0;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.15rem;
  align-items: center;
  justify-content: center;
}

.nav-links a {
  display: block;
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
  color: var(--color-muted);
  text-decoration: none;
  border-radius: 5px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover { background: var(--color-surface); color: var(--color-text); }
.nav-links a[aria-current="page"] { background: var(--color-accent); color: #fff; }

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

@media (max-width: 820px) {
  .nav-toggle {
    display: flex;
  }
  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    padding-top: 0.25rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.5rem 0.7rem; font-size: 0.95rem; }
}

/* ── Main Content ── */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ── Typography ── */
h1, h2, h3, h4 { line-height: 1.3; margin-top: 2.25rem; margin-bottom: 0.75rem; font-weight: 600; }
h1 { font-size: 1.75rem; margin-top: 0; }
h2 { font-size: 1.35rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--color-border); }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; color: var(--color-muted); }

p, ul, ol, blockquote, table, pre { margin-bottom: 1.15rem; }

a { color: var(--color-accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--color-accent-hover); }

strong { font-weight: 600; }
em { font-style: italic; }
hr { border: none; border-top: 1px solid var(--color-border); margin: 2.5rem 0; }

ul, ol { padding-left: 1.5rem; }
li { margin-bottom: 0.35rem; }
li > ul, li > ol { margin-top: 0.35rem; margin-bottom: 0; }

/* ── Blockquote ── */
blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border-radius: 0 6px 6px 0;
  color: var(--color-muted);
}
blockquote p:last-child { margin-bottom: 0; }

/* ── Code ── */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-surface);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.55;
}
pre code { background: none; padding: 0; color: inherit; }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  overflow-x: auto;
  display: block;
}
thead { border-bottom: 2px solid var(--color-border); }
th { text-align: left; font-weight: 600; padding: 0.6rem 0.75rem; }
td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--color-border); vertical-align: top; }
tr:last-child td { border-bottom: none; }

/* ── Checkboxes (task lists) ── */
input[type="checkbox"] { margin-right: 0.4rem; }

/* ── Footer ── */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-muted);
  text-align: center;
}

/* ── Collaborator Logos ── */
.collaborator-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0;
}

.collaborator-logos a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition: box-shadow 0.2s, transform 0.15s;
  text-decoration: none;
}

.collaborator-logos a:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.collaborator-logos img {
  max-height: 64px;
  max-width: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ── Print ── */
@media print {
  .site-header, .nav-toggle, footer { display: none; }
  main { padding: 0; max-width: 100%; }
}
