:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-secondary: #f7f7f8;
  --surface: #fcfcfc;
  --surface-hover: #f0f0f2;
  --surface-active: #e5e5e7;
  --border: #e8e8ea;
  --border-strong: #d1d1d4;
  --text: #0e1012;
  --text-secondary: #52525b;
  --text-tertiary: #909296;
  --accent: #ea580c;
  --accent-hover: #c2410c;
  --accent-soft: rgba(234, 88, 12, 0.08);
  --code-bg: #f4f4f6;
  --code-text: #0e1012;
  --page-glow-primary: rgba(251, 146, 60, 0.08);
  --page-glow-secondary: rgba(234, 88, 12, 0.05);
  --lift-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] {
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318;
  --bg-secondary: #171b21;
  --surface: #1b2027;
  --surface-hover: #242a33;
  --surface-active: #2c333d;
  --border: #2b313a;
  --border-strong: #3a424d;
  --text: #e6e9ee;
  --text-secondary: #b7bec8;
  --text-tertiary: #8b939f;
  --accent: #f3a15a;
  --accent-hover: #f7be88;
  --accent-soft: rgba(243, 161, 90, 0.14);
  --code-bg: #161b21;
  --code-text: #dce2ea;
  --page-glow-primary: rgba(243, 161, 90, 0.05);
  --page-glow-secondary: rgba(234, 88, 12, 0.03);
  --lift-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #111318;
    --bg-secondary: #171b21;
    --surface: #1b2027;
    --surface-hover: #242a33;
    --surface-active: #2c333d;
    --border: #2b313a;
    --border-strong: #3a424d;
    --text: #e6e9ee;
    --text-secondary: #b7bec8;
    --text-tertiary: #8b939f;
    --accent: #f3a15a;
    --accent-hover: #f7be88;
    --accent-soft: rgba(243, 161, 90, 0.14);
    --code-bg: #161b21;
    --code-text: #dce2ea;
    --page-glow-primary: rgba(243, 161, 90, 0.05);
    --page-glow-secondary: rgba(234, 88, 12, 0.03);
    --lift-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--page-glow-primary), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, var(--page-glow-secondary), transparent);
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

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

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header,
.site-footer {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  flex-shrink: 0;
}

.brand a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  padding: 0.25rem 0;
}

.brand a::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.brand p {
  margin: 0.4rem 0 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  max-width: 38rem;
  line-height: 1.5;
}

.site-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.site-actions nav {
  display: flex;
  gap: 0.25rem;
}

.site-actions nav a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.site-actions nav a:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.site-actions nav a.active {
  color: var(--text);
  background: var(--surface-hover);
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.social-link:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

.social-link svg {
  width: 16px;
  height: 16px;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  padding: 0.4rem;
  cursor: pointer;
  font-size: 0;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
  transform: rotate(15deg);
}

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

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.page-content {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.hero-section {
  margin-bottom: 3.5rem;
  padding-top: 1rem;
}

.hero-content {
  max-width: 600px;
}

.hero-section h1 {
  margin: 0 0 0.6rem;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero-section p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 48rem;
  line-height: 1.6;
}

.featured-section {
  margin-bottom: 2.5rem;
}

.featured-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  transition: all 0.2s ease;
}

.featured-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--lift-shadow);
}

.featured-label {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.featured-content h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}

.featured-card:hover h2 {
  color: var(--accent);
}

.featured-excerpt {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.55;
}

.featured-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

.featured-meta .separator {
  opacity: 0.5;
}

.posts-section {
  margin-bottom: 2rem;
}

.posts-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.posts-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.post-count {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.posts-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
}

.post-card:last-child {
  border-bottom: none;
}

.post-card:hover {
  background: var(--surface-hover);
}

.post-card-link {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 2rem;
  padding: 1.25rem 0.5rem;
  color: inherit;
  align-items: start;
}

.post-card-main {
  min-width: 0;
}

.post-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.4;
  color: var(--text);
  transition: color 0.15s ease;
}

.post-card:hover h2 {
  color: var(--accent);
}

.post-card .excerpt {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card .meta {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.75rem;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  min-width: 220px;
}

.post-card .meta-details {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.post-card .meta .date {
  min-width: 90px;
  text-align: right;
}

.post-card .reading-time {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.post-card .reading-time svg {
  width: 12px;
  height: 12px;
  opacity: 0.7;
}

.tag,
.tag-list span {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.post-article {
  padding: 0 0.5rem;
}

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.post-header .post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

.post-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.post-header .post-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.post-header .tag-list {
  margin-top: 1rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.post-card .meta .tag-list {
  justify-content: flex-end;
  flex: 0 1 220px;
}

.post-body {
  font-size: 1rem;
  line-height: 1.7;
}

.post-body :is(h2, h3, h4) {
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.post-body h2 {
  font-size: 1.3rem;
}

.post-body h3 {
  font-size: 1.1rem;
}

.post-body p {
  margin: 0.95rem 0;
}

.post-body :is(ul, ol) {
  margin: 0.95rem 0;
  padding-left: 1.25rem;
}

.post-body li {
  margin: 0.45rem 0;
}

.post-body pre,
.post-body code {
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", "Source Code Pro", monospace;
  font-size: 0.8625em;
}

.post-body pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border-radius: 8px;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  line-height: 1.6;
}

.post-body code {
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

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

.post-body blockquote {
  margin: 1.25rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
  font-style: italic;
}

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

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

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

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

.post-body th {
  background: var(--surface-hover);
  font-weight: 600;
  font-size: 0.875rem;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-section {
  animation: fadeInUp 0.4s ease-out;
}

.post-card {
  animation: fadeInUp 0.4s ease-out;
  animation-fill-mode: both;
}

.post-card:nth-child(1) { animation-delay: 0.05s; }
.post-card:nth-child(2) { animation-delay: 0.1s; }
.post-card:nth-child(3) { animation-delay: 0.15s; }
.post-card:nth-child(4) { animation-delay: 0.2s; }

@media (max-width: 700px) {
  .site-header {
    flex-direction: column;
    gap: 1rem;
  }

  .site-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .post-card-link {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .post-card h2 {
    width: 100%;
  }

  .post-card .meta {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    gap: 0.5rem 0.75rem;
  }

  .post-card .meta-details {
    gap: 0.5rem;
  }

  .post-card .meta .date {
    min-width: auto;
    text-align: left;
  }

  .post-card .meta .tag-list {
    justify-content: flex-start;
    flex-basis: 100%;
  }

  .hero-section h1 {
    font-size: 1.6rem;
  }

  .post-header h1 {
    font-size: 1.4rem;
  }
}
