:root {
  --bg: #fff;
  --text: #1a1a1a;
  --muted: #595959;
  --border: #d4d4d4;
  --accent: #c2185b;
}

[data-theme="dark"] {
  --bg: #1a1028;
  --text: #ede8f5;
  --muted: #a08ab8;
  --border: #3d2f52;
  --accent: #f48fb1;
}

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
}

body {
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: underline;

  &:hover,
  &:focus-visible {
    text-decoration: none;
  }
}

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 1.8rem;
}

h2 {
  font-size: 1.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

p {
  margin: 0 0 1rem;
}

ul {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.4rem;
}

hgroup > p {
  font-weight: bold;
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;

  .site-nav {
    max-width: 700px;
    margin: 0 auto;
    padding: 1rem 1rem;
    display: flex;
    align-items: baseline;
    gap: 1.5rem;

    @media (max-width: 480px) {
      flex-wrap: wrap;
    }
  }

  .nav-brand {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
    margin-right: auto;

    &:hover {
      color: var(--accent);
    }

    @media (max-width: 480px) {
      width: 100%;
      margin-bottom: 0;
    }
  }

  .nav-links {
    display: flex;
    gap: 1rem;

    a {
      color: var(--muted);
      text-decoration: none;

      &:hover,
      &:focus-visible {
        color: var(--accent);
      }

      &.active {
        color: var(--text);
        font-weight: 600;
      }
    }
  }

  .theme-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--muted);
    font-family: inherit;
    font-size: inherit;

    &:hover,
    &:focus-visible {
      color: var(--accent);
      outline: none;
    }
  }
}

/* Main content */
.page-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2rem;

  p {
    max-width: 700px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
  }

  a {
    color: var(--muted);

    &:hover {
      color: var(--accent);
    }
  }
}

/* Fragment highlight */
:target {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 0.5rem;
  transition: background 0.3s ease, outline 0.3s ease;
}

/* Responsive */
@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.2rem;
  }
}

.footnotes {
  font-size: 0.9em;

  li {
    margin-bottom: 0.5em;
  }
}
