:root {
  color-scheme: light;
  --surface-base: #fafafa;
  --surface-strong: #f4f4f5;
  --surface-soft: rgba(250, 250, 250, 0.92);
  --surface-muted: rgba(250, 250, 250, 0.85);
  --surface-ghost: rgba(39, 39, 42, 0.08);
  --surface-chip: rgba(39, 39, 42, 0.12);
  --border-default: #e4e4e7;
  --border-strong: #d4d4d8;
  --text-primary: #18181b;
  --text-secondary: #3f3f46;
  --text-muted: #71717a;
  --shadow-soft: 0 20px 35px rgba(15, 15, 18, 0.08);
}

[data-theme='dark'] {
  color-scheme: dark;
  --surface-base: #09090b;
  --surface-strong: rgba(24, 24, 27, 0.95);
  --surface-soft: rgba(24, 24, 27, 0.88);
  --surface-muted: rgba(24, 24, 27, 0.78);
  --surface-ghost: rgba(250, 250, 250, 0.08);
  --surface-chip: rgba(250, 250, 250, 0.16);
  --border-default: rgba(113, 113, 122, 0.55);
  --border-strong: rgba(82, 82, 91, 0.4);
  --text-primary: #f4f4f5;
  --text-secondary: #d4d4d8;
  --text-muted: rgba(161, 161, 170, 0.85);
  --shadow-soft: 0 35px 60px rgba(2, 2, 5, 0.7);
}

body {
  background-color: var(--surface-base);
  color: var(--text-primary);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

::selection {
  background-color: #d4d4d8;
  color: #18181b;
}

[data-theme='dark'] ::selection {
  background-color: rgba(113, 113, 122, 0.35);
  color: #f4f4f5;
}

.mag-section-title {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--text-muted);
}

.glass-card {
  border-radius: 1.5rem;
  border: 1px solid var(--border-default);
  background-color: var(--surface-soft);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

[data-animate-on-scroll] {
  transform: translateY(1rem);
  opacity: 0;
  transition: transform 0.7s ease-out, opacity 0.7s ease-out;
}

.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.post-feed {
  display: grid;
  gap: 1.5rem;
}

.post-feed[data-view-mode="grid"] {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.post-feed[data-view-mode="list"] {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.post-feed[data-view-mode="list"] [data-view-card] {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
}

.post-feed[data-view-mode="list"] [data-view-card] [data-view-media] {
  flex: 0 0 280px;
  margin: 0;
  height: 220px;
}

.post-feed[data-view-mode="list"] [data-view-card] [data-view-media] img {
  height: 100%;
}

[data-page-toc] .toc-link {
  display: block;
  position: relative;
  padding-left: 1rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

[data-page-toc] .toc-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 9999px;
  background-color: var(--border-strong);
  transform: translateY(-50%);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

[data-page-toc] .toc-link[data-toc-active="true"] {
  color: var(--text-primary);
  font-weight: 600;
}

[data-page-toc] .toc-link[data-toc-active="true"]::before {
  background-color: var(--text-primary);
  transform: translateY(-50%) scale(1.3);
}

[data-theme-toggle] {
  border-color: var(--border-default);
  color: var(--text-secondary);
  background-color: transparent;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

[data-theme-toggle]:hover {
  color: var(--text-primary);
  background-color: var(--surface-ghost);
}

[data-theme-toggle] svg {
  width: 1.25rem;
  height: 1.25rem;
}

[data-theme-toggle] [data-theme-icon='moon'] {
  display: none;
}

[data-theme='dark'] [data-theme-toggle] {
  color: var(--text-primary);
  border-color: var(--border-default);
}

[data-theme='dark'] [data-theme-toggle]:hover {
  background-color: var(--surface-chip);
}

[data-theme='dark'] [data-theme-toggle] [data-theme-icon='sun'] {
  display: none;
}

[data-theme='dark'] [data-theme-toggle] [data-theme-icon='moon'] {
  display: inline-block;
}

.text-neutral-900,
.text-neutral-800 {
  color: var(--text-primary) !important;
}

.text-neutral-700,
.text-neutral-600 {
  color: var(--text-secondary) !important;
}

.text-neutral-500,
.text-neutral-400,
.text-neutral-300 {
  color: var(--text-muted) !important;
}

.border-neutral-200,
.border-neutral-100,
.border-surface-200,
.border-white {
  border-color: var(--border-default) !important;
}

.bg-white,
.bg-white\/95,
.bg-white\/90,
.bg-white\/80,
.bg-white\/70 {
  background-color: var(--surface-strong) !important;
  color: var(--text-primary);
}

.prose {
  color: var(--text-secondary);
}

.prose :where(p, li, figcaption, blockquote) {
  color: inherit;
}

.prose :where(h1, h2, h3, h4, h5, h6) {
  color: var(--text-primary);
  font-weight: 600;
}

.prose a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: rgba(113, 113, 122, 0.4);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.prose a:hover {
  color: var(--text-secondary);
  text-decoration-color: rgba(113, 113, 122, 0.7);
}

.prose code:not(pre code) {
  border-radius: 0.4rem;
  border: 1px solid var(--border-default);
  background-color: var(--surface-muted);
  padding: 0.15rem 0.35rem;
  color: var(--text-primary);
  font-weight: 600;
}

.prose pre {
  border-radius: 1rem;
  border: 1px solid var(--border-default);
  background-color: var(--surface-soft);
  color: var(--text-primary);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
}

.prose blockquote {
  border-left: 3px solid var(--border-strong);
  padding-left: 1.25rem;
  font-style: normal;
  color: var(--text-secondary);
  background-color: var(--surface-soft);
  border-radius: 0 1rem 1rem 0;
}

.prose hr {
  border-color: var(--border-default);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
}

.prose table thead th {
  border-bottom: 1px solid var(--border-default);
  color: var(--text-primary);
  font-weight: 600;
}

.prose table :where(td, th) {
  border-bottom: 1px solid var(--border-default);
  padding: 0.75rem;
}

.prose img,
.prose video {
  border-radius: 1rem;
  box-shadow: var(--shadow-soft);
}

[data-theme='dark'] .bg-white,
[data-theme='dark'] .bg-white\/95,
[data-theme='dark'] .bg-white\/90,
[data-theme='dark'] .bg-white\/80,
[data-theme='dark'] .bg-white\/70,
[data-theme='dark'] .hover\:bg-white:hover {
  background-color: var(--surface-soft) !important;
  color: var(--text-primary);
}

[data-theme='dark'] .bg-surface-50,
[data-theme='dark'] .bg-surface-100,
[data-theme='dark'] .bg-surface-200,
[data-theme='dark'] .bg-neutral-50,
[data-theme='dark'] .bg-neutral-100,
[data-theme='dark'] .bg-neutral-200,
[data-theme='dark'] .hover\:bg-neutral-50:hover,
[data-theme='dark'] .hover\:bg-neutral-100:hover {
  background-color: var(--surface-muted) !important;
  color: var(--text-primary);
}

[data-theme='dark'] .bg-white\/25,
[data-theme='dark'] .bg-white\/15,
[data-theme='dark'] .bg-white\/10 {
  background-color: var(--surface-ghost) !important;
}

[data-theme='dark'] .border-neutral-200,
[data-theme='dark'] .border-neutral-100,
[data-theme='dark'] .border-surface-200,
[data-theme='dark'] .border-white {
  border-color: var(--border-default) !important;
}

[data-theme='dark'] .text-neutral-900,
[data-theme='dark'] .text-neutral-800,
[data-theme='dark'] .text-neutral-700,
[data-theme='dark'] .text-neutral-600 {
  color: var(--text-primary) !important;
}

[data-theme='dark'] .text-neutral-500,
[data-theme='dark'] .text-neutral-400,
[data-theme='dark'] .text-neutral-300 {
  color: var(--text-secondary) !important;
}

[data-theme='dark'] .text-neutral-200,
[data-theme='dark'] .text-neutral-100 {
  color: var(--text-muted) !important;
}

