/* weisser.dev – main.css – 2026-03-23 */
/* ===== CSS Custom Properties ===== */
:root {
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;
  --content-width: 740px;
  --wide-width: 1000px;
  --nav-height: 60px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
}

:root, [data-theme="dark"] {
  --bg: hsl(0deg 0% 7%);
  --bg-surface: hsl(0deg 0% 11%);
  --bg-surface-hover: hsl(0deg 0% 15%);
  --bg-code: hsl(0deg 0% 12%);
  --border: hsl(0deg 0% 20%);
  --border-light: hsl(0deg 0% 15%);
  --text: hsl(0deg 0% 88%);
  --text-secondary: hsl(0deg 0% 60%);
  --text-tertiary: hsl(0deg 0% 42%);
  --accent: #22c55e;
  --accent-hover: #4ade80;
  --accent-subtle: rgb(34 197 94 / 0.1);
  --hero-glow: rgb(34 197 94 / 0.06);
  --shadow-sm: 0 1px 3px hsl(0deg 0% 0% / 0.3);
  --shadow-md: 0 4px 14px hsl(0deg 0% 0% / 0.35);
  --tag-bg: rgb(34 197 94 / 0.1);
  --tag-color: #4ade80;
}

[data-theme="light"] {
  --bg: hsl(0deg 0% 98%);
  --bg-surface: hsl(0deg 0% 100%);
  --bg-surface-hover: hsl(0deg 0% 95%);
  --bg-code: hsl(0deg 0% 94%);
  --border: hsl(0deg 0% 86%);
  --border-light: hsl(0deg 0% 91%);
  --text: hsl(0deg 0% 10%);
  --text-secondary: hsl(0deg 0% 38%);
  --text-tertiary: hsl(0deg 0% 55%);
  --accent: #16a34a;
  --accent-hover: #15803d;
  --accent-subtle: rgb(22 163 74 / 0.08);
  --hero-glow: rgb(22 163 74 / 0.05);
  --shadow-sm: 0 1px 3px hsl(0deg 0% 0% / 0.08);
  --shadow-md: 0 4px 14px hsl(0deg 0% 0% / 0.1);
  --tag-bg: rgb(22 163 74 / 0.08);
  --tag-color: #16a34a;
}

/* ===== Font Faces ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --text-xs: 0.72rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.6rem;
  --leading-tight: 1.25;
  --leading-normal: 1.75;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: var(--leading-tight);
  font-weight: 700;
  color: var(--text);
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); }

code, pre { font-family: var(--font-mono); }

:not(pre) > code {
  background: var(--bg-code);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
  border: 1px solid var(--border-light);
  color: var(--text);
}

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--sp-5);
}
.container--wide { max-width: var(--wide-width); }
main { flex: 1; padding-top: var(--sp-7); padding-bottom: var(--sp-9); }

/* ===== Nav ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--bg);
  backdrop-filter: blur(12px);
  font-family: var(--font-heading);
  transition: background-color 0.3s ease;
}
.nav::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: var(--accent);
  opacity: 0.3;
}
.nav__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 var(--sp-5);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
}
.nav__brand {
  font-weight: 800;
  font-size: var(--text-lg);
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.03em;
  transition: opacity 0.15s ease;
}
.nav__brand:hover { opacity: 0.85; }
.nav__links {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  list-style: none;
}
.nav__links a {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}
.nav__links a:hover { color: var(--text); }

/* ===== Theme Toggle ===== */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-2);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border-light);
  padding: var(--sp-7) 0;
  font-family: var(--font-heading);
  transition: border-color 0.3s ease;
}
.footer__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 var(--sp-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-4);
}
.footer__text { color: var(--text-tertiary); font-size: var(--text-sm); }
.footer__links { display: flex; gap: var(--sp-4); list-style: none; }
.footer__links a { color: var(--text-tertiary); font-size: var(--text-sm); }
.footer__links a:hover { color: var(--accent); }

/* ===== Hero ===== */
.hero {
  padding: var(--sp-8) 0 var(--sp-7);
  font-family: var(--font-heading);
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  top: -20%; left: -10%;
  width: 60%; height: 140%;
  background: radial-gradient(ellipse, var(--hero-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.hero__greeting {
  font-size: var(--text-base);
  color: var(--accent);
  font-weight: 600;
  margin-bottom: var(--sp-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: var(--text-sm);
}
.hero__title {
  font-size: var(--text-4xl);
  font-weight: 800;
  margin-bottom: var(--sp-4);
  letter-spacing: -0.04em;
  color: var(--accent);
}
.hero__description {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 560px;
  line-height: var(--leading-normal);
}

/* ===== Section Title ===== */
.section-title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text);
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--accent);
  opacity: 0.3;
}

/* ===== Post Card ===== */
.post-card {
  display: block;
  padding: var(--sp-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  text-decoration: none;
  font-family: var(--font-heading);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.post-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}
.post-card + .post-card { margin-top: var(--sp-4); }
.post-card__date {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--sp-2);
  display: block;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.post-card__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--sp-2);
  line-height: var(--leading-tight);
}
.post-card__excerpt {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  margin-bottom: var(--sp-4);
}
.post-card__repo {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  margin-bottom: var(--sp-3);
}

/* ===== Tags ===== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.tag {
  display: inline-block;
  padding: 0.18em 0.65em;
  background: var(--tag-bg);
  color: var(--tag-color);
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: 9999px;
  text-decoration: none;
  text-transform: lowercase;
  transition: background 0.15s ease;
  letter-spacing: 0.01em;
}
.tag:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ===== Page Header ===== */
.page-header { margin-bottom: var(--sp-7); }
.page-header__title { margin-bottom: var(--sp-2); }
.page-header__description { color: var(--text-secondary); font-size: var(--text-lg); }

/* ===== Post Header ===== */
.post-header { margin-bottom: var(--sp-7); }
.post-header__title { margin-bottom: var(--sp-4); }
.post-header__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  color: var(--text-tertiary);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
}
.post-header__meta .sep { opacity: 0.4; }
.post-header .tags { margin-top: var(--sp-4); }
.post-header__repo-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  font-size: var(--text-sm);
  color: var(--accent);
  font-family: var(--font-mono);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--accent-subtle);
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  transition: background 0.15s ease;
}
.post-header__repo-link:hover { background: var(--accent); color: var(--bg); }
.post-header__repo-link svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ===== Prose (Post Body) ===== */
.prose { font-size: var(--text-base); line-height: var(--leading-normal); }
.prose h2 {
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border-light);
  font-size: var(--text-2xl);
}
.prose h3 { margin-top: var(--sp-6); margin-bottom: var(--sp-3); font-size: var(--text-xl); }
.prose h4 { margin-top: var(--sp-5); margin-bottom: var(--sp-2); }
.prose p { margin-bottom: var(--sp-4); }
.prose ul, .prose ol { margin-bottom: var(--sp-4); padding-left: var(--sp-5); }
.prose ul li, .prose ol li { margin-bottom: var(--sp-2); }
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--sp-4);
  margin: var(--sp-5) 0;
  color: var(--text-secondary);
  font-style: italic;
}
.prose img { max-width: 100%; border-radius: var(--radius-md); margin: var(--sp-5) 0; }
.prose hr { border: none; border-top: 1px solid var(--border-light); margin: var(--sp-7) 0; }
.prose table { width: 100%; border-collapse: collapse; margin: var(--sp-5) 0; font-size: var(--text-sm); }
.prose table th, .prose table td { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); text-align: left; }
.prose table th { background: var(--bg-surface); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent-hover); }

/* ===== Code Blocks ===== */
pre {
  background: var(--bg-code);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  overflow-x: auto;
  margin: var(--sp-5) 0;
  font-size: var(--text-sm);
  line-height: 1.65;
  position: relative;
}
pre code { background: none; padding: 0; border: none; font-size: inherit; color: var(--text); }

/* Rouge syntax highlight */
.highlight .c, .highlight .c1, .highlight .cm { color: #676f7e; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr { color: #c886ea; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .se { color: #97d279; }
.highlight .mi, .highlight .mf, .highlight .mh { color: #f2b25a; }
.highlight .nf, .highlight .na { color: #7dc4e8; }
.highlight .nc, .highlight .nt { color: #f0d175; }
.highlight .nb { color: #e48191; }
.highlight .o, .highlight .p { color: #8f96a3; }
.highlight .err { background: none; color: var(--text); }

/* ===== Author Bio ===== */
.author-bio {
  display: flex;
  gap: var(--sp-5);
  align-items: flex-start;
  padding: var(--sp-6);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-top: var(--sp-8);
}
.author-bio__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.author-bio__name {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--sp-1);
}
.author-bio__text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  margin-bottom: var(--sp-3);
}
.author-bio__links {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.author-bio__links a {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: 500;
  font-family: var(--font-heading);
}
.author-bio__links a:hover { color: var(--accent); }

/* ===== Back Link ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 500;
  margin-bottom: var(--sp-6);
}
.back-link:hover { color: var(--accent); }
.back-link svg { width: 14px; height: 14px; }

/* ===== Post Navigation ===== */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin-top: var(--sp-8);
}
.post-nav__item {
  padding: var(--sp-4);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.post-nav__item:hover { border-color: var(--border); box-shadow: var(--shadow-sm); }
.post-nav__label { font-size: var(--text-xs); color: var(--text-tertiary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: var(--sp-1); }
.post-nav__title { font-size: var(--text-sm); font-weight: 600; color: var(--text); line-height: 1.4; }
.post-nav__item--next { text-align: right; }

/* ===== Callout ===== */
.callout {
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent);
  margin: var(--sp-5) 0;
  font-size: var(--text-sm);
  background: var(--accent-subtle);
  color: var(--text-secondary);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
  main { padding-top: var(--sp-6); padding-bottom: var(--sp-7); }
  .hero { padding: var(--sp-6) 0 var(--sp-5); }
  .hero__title { font-size: var(--text-3xl); }
  .nav { height: auto; padding: var(--sp-3) 0; }
  .nav__inner { flex-wrap: wrap; gap: var(--sp-2); }
  .nav__brand { order: 1; }
  .nav .theme-toggle { order: 2; margin-left: auto; }
  .nav__links { order: 3; width: 100%; margin-left: 0; gap: var(--sp-3); }
  .author-bio { flex-direction: column; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav__item--next { text-align: left; }
}
