:root {
  --bg: #fafafa;
  --bg-alt: #f0f0f0;
  --fg: #1a1a1a;
  --fg-muted: #666;
  --border: #ddd;
  --link: #0066cc;
  --link-hover: #004499;
  --code-bg: #f5f5f5;
  --accent: #333;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a1a;
    --bg-alt: #252525;
    --fg: #e0e0e0;
    --fg-muted: #999;
    --border: #333;
    --link: #6db3f2;
    --link-hover: #9acbf7;
    --code-bg: #252525;
    --accent: #ccc;
  }
}

:root[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-alt: #252525;
  --fg: #e0e0e0;
  --fg-muted: #999;
  --border: #333;
  --link: #6db3f2;
  --link-hover: #9acbf7;
  --code-bg: #252525;
  --accent: #ccc;
}

:root[data-theme="light"] {
  --bg: #fafafa;
  --bg-alt: #f0f0f0;
  --fg: #1a1a1a;
  --fg-muted: #666;
  --border: #ddd;
  --link: #0066cc;
  --link-hover: #004499;
  --code-bg: #f5f5f5;
  --accent: #333;
}

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

html {
  font-size: 16px;
}

body {
  font-family: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--fg);
}

.header-brand:hover {
  color: var(--link);
  text-decoration: none;
}

.header-logo {
  height: 32px;
  width: 32px;
  flex-shrink: 0;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

header h1 a {
  color: var(--fg);
  text-decoration: none;
}

header h1 a:hover {
  color: var(--link);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.github-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--fg-muted);
  transition: color 0.15s ease, box-shadow 0.15s ease;
}

.github-link:hover {
  color: var(--fg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  text-decoration: none;
}

:root[data-theme="dark"] .github-link:hover {
  box-shadow: 0 2px 12px rgba(255, 255, 255, 0.1);
}

.github-link svg {
  display: block;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--fg);
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.theme-toggle:hover {
  background: var(--border);
}

.theme-toggle svg {
  display: block;
}

main {
  min-height: calc(100vh - 200px);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

h1 { font-size: 1.75rem; margin-top: 0; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4, h5, h6 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
}

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

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

ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

code {
  font-family: "IBM Plex Mono", "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  background: var(--code-bg);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.875em;
}

pre {
  font-family: "IBM Plex Mono", "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  line-height: 1;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--fg-muted);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

th, td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

th {
  background: var(--bg-alt);
  font-weight: 600;
}

/* Index page specific */
.rfc-list {
  list-style: none;
  padding: 0;
}

.rfc-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  margin: 0 -1rem;
  border-radius: 4px;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.rfc-list li:hover {
  background: var(--bg-alt);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

:root[data-theme="dark"] .rfc-list li:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.rfc-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  text-decoration: none;
  color: var(--fg);
  min-width: 0;
}

.rfc-item:hover {
  color: var(--link);
  text-decoration: none;
}

.rfc-item .rfc-number {
  font-family: "IBM Plex Mono", "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  color: var(--fg-muted);
  font-size: 0.875rem;
  flex-shrink: 0;
  width: 5rem;
}

.rfc-item .rfc-title {
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rfc-item .rfc-date {
  color: var(--fg-muted);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.rfc-author-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg-muted);
  text-decoration: none;
  flex-shrink: 0;
}

.rfc-author-link:hover {
  color: var(--link);
}

.rfc-author-link:hover .rfc-author-name {
  text-decoration: underline;
}

.rfc-author-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.rfc-author-name {
  font-size: 0.875rem;
}

/* RFC page specific */
.rfc-meta-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.rfc-meta-item {
  display: flex;
  gap: 0.5rem;
}

.rfc-meta-label {
  color: var(--fg-muted);
}

.rfc-meta-value {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.commit-link {
  display: inline-flex;
  align-items: center;
  color: var(--link);
}

.commit-link:hover {
  color: var(--link-hover);
}

.commit-link svg {
  display: block;
  transition: stroke-width 0.1s ease;
}

.commit-link:hover svg {
  stroke-width: 2.5;
}

.rfc-author {
  display: flex;
  align-items: center;
}

.author-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg);
  text-decoration: none;
}

.author-link:hover {
  color: var(--link);
}

.author-link:hover .author-name {
  text-decoration: underline;
}

.author-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.author-name {
  font-weight: 500;
}

.rfc-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.rfc-meta {
  color: var(--fg-muted);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.875rem;
}
