:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #6b6b6b;
  --border: #eeeeee;
  --accent: #ff6b35;
  --accent-bg: #fff1e8;
  --accent-contrast: #fff;
  --link: #b8451a;
  --card-bg: #ffffff;
  --max-width: 680px;
}

[data-theme="dark"] {
  --bg: #121212;
  --text: #eeeeee;
  --muted: #888888;
  --border: #262626;
  --accent: #ff8a5c;
  --accent-bg: #3a2418;
  --accent-contrast: #fff;
  --link: #ff8a5c;
  --card-bg: #161616;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  line-height: 1.6;
  transition: background 0.2s ease, color 0.2s ease;
}

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

.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.site-header { border-bottom: 1px solid var(--border); }

.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-name {
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
}

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

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
}

.theme-toggle:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: inline; }

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.profile-header { text-align: center; padding: 2rem 0 3rem; }

.profile-header .avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  margin-bottom: 1rem;
}

.profile-name { font-size: 1.5rem; font-weight: 800; margin: 0 0 0.5rem; }

.profile-tagline { color: var(--muted); max-width: 560px; margin: 0 auto 1rem; }

.profile-links { display: flex; gap: 1rem; justify-content: center; font-weight: 600; }

.section-label,
.filter-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.section-label {
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

.post-list { border-top: 1px solid var(--border); }

.post-card {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.post-card-title { color: var(--text); font-weight: 700; }

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.post-card-tag {
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 10px;
  padding: 0.15rem 0.5rem;
  font-weight: 600;
  font-size: 0.7rem;
}

.filter-label {
  font-size: 0.7rem;
  margin-bottom: 0.5rem;
}

.filter-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }

.chip {
  background: var(--border);
  border: none;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text);
}

.chip.is-active { background: var(--accent); color: var(--accent-contrast); font-weight: 600; }

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

.post-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.5rem; }

.post-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.post-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 1rem 0; }

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

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

.post-body th {
  background: var(--card-bg);
  font-weight: 700;
}

.post-body pre {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  max-width: 100%;
}

.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  white-space: pre;
}

.post-body code {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.youtube-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; margin-bottom: 1.5rem; }

.youtube-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
}

@media (max-width: 640px) {
  .nav-links { gap: 0.75rem; }
  .post-card { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
}
