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

:root {
  --text: #111111;
  --secondary: #666666;
  --bg: #ffffff;
  --border: #e0e0e0;
  --surface: #f5f5f5;
  --max-width: 660px;
}

body {
  margin: 0;
  padding: 0 1.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

main {
  min-height: 60vh;
}

/* ─── Accessibility utilities ───────────────────── */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Skip link ──────────────────────────────────── */

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--text);
  color: var(--bg);
  font-size: 0.875rem;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* ─── Navigation ─────────────────────────────────── */

header {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3.5rem;
}

header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Index page nav has no left-side home link — push links right */
header nav .nav-links:only-child {
  margin-left: auto;
}

.nav-home {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--secondary);
  text-decoration: none;
  font-size: 0.9375rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a.active {
  font-weight: 500;
}

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

h1 {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 0.375rem;
}

h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--secondary);
  margin: 3rem 0 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 1.5rem;
}

h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.75rem 0 0.5rem;
}

p {
  margin: 0 0 1rem;
}

/* Links are same color as text; underline identifies them */
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #c0c0c0;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

ul {
  padding-left: 1.25rem;
  margin: 0 0 0.75rem;
}

li {
  margin-bottom: 0.625rem;
  line-height: 1.6;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Mono", monospace;
  font-size: 0.875em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

/* ─── Profile ────────────────────────────────────── */

.profile {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.profile-photo {
  flex-shrink: 0;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-name {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem;
}

.profile-role {
  color: var(--secondary);
  margin: 0 0 1rem;
  font-size: 0.9375rem;
}

.social-links {
  display: flex;
  gap: 1.25rem;
  padding: 0;
  list-style: none;
  margin: 0;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  color: var(--secondary);
  text-decoration: none;
}

.social-links svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.social-links a:hover {
  color: var(--text);
}

.bio {
  font-size: 1rem;
}

/* ─── Table of Contents ──────────────────────────── */

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.toc-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--secondary);
  margin: 0 0 0.75rem;
}

.toc-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem 2rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: 0;
  line-height: 1.5;
}

.toc-list a {
  font-size: 0.9rem;
  color: var(--secondary);
  text-decoration: none;
}

.toc-list a:hover {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--text);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ─── Resources page ─────────────────────────────── */

.resources-intro {
  font-size: 0.9375rem;
  color: var(--secondary);
  margin-bottom: 0;
}

.tag {
  color: var(--secondary);
  font-size: 0.8125rem;
  font-weight: 500;
}

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

footer {
  margin-top: 5rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: #aaaaaa;
  font-size: 0.8125rem;
}

/* ─── Responsive ─────────────────────────────────── */

@media (max-width: 560px) {
  header {
    margin-bottom: 2.5rem;
  }

  .nav-links {
    gap: 1.25rem;
  }

  .nav-links a {
    font-size: 0.875rem;
  }

  .profile {
    flex-direction: column;
    gap: 1.25rem;
  }

  .profile-photo {
    width: 80px;
    height: 80px;
  }

  .toc-list {
    grid-template-columns: 1fr;
  }
}
