:root {
  --bg: #0f1115;
  --bg-card: #171a21;
  --text: #e6e8eb;
  --text-dim: #9aa1ac;
  --accent: #5b9dff;
  --border: #262a33;
  --max-width: 780px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fafafa;
    --bg-card: #ffffff;
    --text: #16181d;
    --text-dim: #5b6270;
    --accent: #2563eb;
    --border: #e6e8eb;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-card: #171a21;
  --text: #e6e8eb;
  --text-dim: #9aa1ac;
  --accent: #5b9dff;
  --border: #262a33;
}

:root[data-theme="light"] {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --text: #16181d;
  --text-dim: #5b6270;
  --accent: #2563eb;
  --border: #e6e8eb;
}

* { box-sizing: border-box; }

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

body.home { --max-width: 900px; }

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

header.site-header .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header.site-header a.logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}

header.site-header nav a {
  color: var(--text-dim);
  text-decoration: none;
  margin-left: 18px;
  font-size: 0.92rem;
}

header.site-header nav a:hover { color: var(--accent); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  vertical-align: middle;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.2s ease;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(-10deg); }

.theme-toggle .icon-sun, .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
:root:not([data-theme]) .theme-toggle .icon-moon { display: block; }

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 16px 64px;
}

.hero {
  position: relative;
  isolation: isolate;
  padding: 28px 24px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.25), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(236, 72, 153, 0.22), transparent 45%),
    radial-gradient(circle at 60% 90%, rgba(14, 165, 233, 0.2), transparent 45%),
    var(--bg-card);
}

.hero::before, .hero::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  filter: blur(50px);
  z-index: -1;
  pointer-events: none;
}

.hero::before {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.55), transparent 70%);
  top: -80px;
  left: -50px;
  animation: hero-float-a 15s ease-in-out infinite;
}

.hero::after {
  background: radial-gradient(circle, rgba(236, 72, 153, 0.5), transparent 70%);
  bottom: -90px;
  right: -40px;
  animation: hero-float-b 17s ease-in-out infinite;
}

@keyframes hero-float-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(34px, 22px) scale(1.15); }
}

@keyframes hero-float-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-28px, -18px) scale(1.12); }
}

.hero h1 {
  font-size: 1.9rem;
  margin-bottom: 6px;
  position: relative;
  animation: fade-up 0.6s ease both;
}

.hero p {
  color: var(--text-dim);
  margin-top: 0;
  position: relative;
  animation: fade-up 0.6s ease 0.08s both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero::before, .hero::after { animation: none; }
  .hero h1, .hero p { animation: none; }
}

.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
}

.chip {
  font: inherit;
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.post-list {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .post-list { grid-template-columns: 1fr 1fr; }
  .post-card--featured { grid-column: 1 / -1; }
  .post-card--featured .cover--card { height: 260px; }
  .post-card--featured h2 { font-size: 1.5rem; }
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px 20px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { transition: none; }
}

.cover {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
  background: var(--bg-card);
}

.cover svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cover--card { height: 130px; margin-bottom: 14px; }

.cover--hero {
  height: 220px;
  margin: 4px 0 28px;
  border-radius: 14px;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  margin-bottom: 10px;
}

.post-card h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.post-meta {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.post-excerpt {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.94rem;
}

article.post {
  font-size: 1.02rem;
}

article.post h1 {
  font-size: 1.7rem;
  margin-bottom: 4px;
}

article.post .post-meta {
  margin-bottom: 24px;
}

article.post h2 {
  font-size: 1.25rem;
  margin-top: 2em;
}

article.post h3 {
  font-size: 1.05rem;
}

article.post p, article.post li {
  color: var(--text);
}

article.post code {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

article.post pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
}

article.post pre code {
  border: none;
  padding: 0;
  background: none;
}

article.post blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.2em 0;
  padding: 0.2em 1em;
  color: var(--text-dim);
}

.ad-slot {
  margin: 32px 0;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.related-posts {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.related-posts h2 {
  font-size: 1.05rem;
  margin-bottom: 14px;
}

.related-card {
  display: block;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}

.related-card:hover { border-color: var(--accent); }

.related-card h3 {
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: var(--text);
}

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

footer.site-footer a {
  color: var(--text-dim);
  margin: 0 8px;
}

.back-link {
  display: inline-block;
  margin-top: 40px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.92rem;
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 50;
  background: transparent;
}

.reading-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #ec4899);
}

.love-note {
  position: fixed;
  right: 12px;
  bottom: 10px;
  font-size: 0.72rem;
  color: var(--text-dim);
  opacity: 0.55;
  pointer-events: none;
  z-index: 10;
}
