:root {
  --bg-deep: #050508;
  --surface: rgba(16, 16, 24, 0.72);
  --text: #f1f2f6;
  --muted: #9a9aac;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #c4b5fd;
  --accent-2: #22d3ee;
  --accent-dim: rgba(196, 181, 253, 0.12);
  --focus: rgba(34, 211, 238, 0.95);
  --glow-violet: rgba(124, 92, 255, 0.45);
  --glow-cyan: rgba(34, 211, 238, 0.22);
  --maxw: 100ch;

  --radius: 14px;
  --radius-lg: 22px;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.25rem;
  --space-6: 3rem;

  --fs-body: clamp(1rem, 0.94rem + 0.2vw, 1.09rem);
  --fs-h1: clamp(2.1rem, 1.55rem + 1.5vw, 3.35rem);
  --fs-h2: clamp(1.4rem, 1.18rem + 0.65vw, 2.05rem);
  --fs-h3: clamp(1.12rem, 1.02rem + 0.4vw, 1.45rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color: var(--text);
  scroll-behavior: smooth;
  background: var(--bg-deep);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    "Apple Color Emoji",
    "Segoe UI Emoji";
  font-size: var(--fs-body);
  line-height: 1.65;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 100% 80% at 15% -30%, var(--glow-violet), transparent 55%),
    radial-gradient(ellipse 70% 50% at 95% 10%, var(--glow-cyan), transparent 50%),
    radial-gradient(ellipse 60% 45% at 50% 110%, rgba(196, 181, 253, 0.12), transparent 45%),
    var(--bg-deep);
}

.noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: rgba(196, 181, 253, 0.35);
  color: var(--text);
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-thickness: 0.1em;
  text-underline-offset: 0.2em;
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 10px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 0.65rem;
  transform: translateY(-200%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  z-index: 1000;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(10, 10, 16, 0.92) 0%,
    rgba(10, 10, 16, 0.78) 100%
  );
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

.brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  font-size: 1.05rem;
  background: linear-gradient(120deg, #eef2ff 0%, #c4b5fd 42%, #22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(196, 181, 253, 0.25);
}

@supports not (background-clip: text) {
  .brand {
    color: var(--accent);
    background: none;
  }
}

.site-nav a {
  text-decoration: none;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.nav-list-desktop a {
  display: inline-block;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
  transition: color 0.18s ease, background 0.18s ease;
}

.nav-list-desktop a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.nav-list-desktop a[aria-current="page"] {
  color: var(--text);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px rgba(196, 181, 253, 0.25);
}

.nav-list-mobile {
  display: block;
}

.nav-list-desktop {
  display: none;
}

.nav-details {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  background: rgba(255, 255, 255, 0.04);
}

.nav-summary {
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.5rem 0.35rem;
  list-style: none;
}

.nav-summary::-webkit-details-marker {
  display: none;
}

.nav-mobile-inner {
  margin-top: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: rgba(12, 12, 18, 0.96);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.nav-mobile-inner .nav-list {
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
}

.nav-mobile-inner a {
  display: block;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  font-weight: 600;
  color: var(--muted);
}

.nav-mobile-inner a:hover,
.nav-mobile-inner a[aria-current="page"] {
  color: var(--text);
  background: var(--accent-dim);
}

main.site-main {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
  padding-bottom: var(--space-5);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.25));
}

.footer-inner {
  text-align: center;
}

.muted {
  color: var(--muted);
}

article.prose-surface {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.35rem, 4.5vw, 2.5rem);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 28px 56px -28px rgba(0, 0, 0, 0.65),
    0 0 100px -50px rgba(124, 92, 255, 0.2);
}

article.prose-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(196, 181, 253, 0.35) 0%,
    transparent 40%,
    transparent 60%,
    rgba(34, 211, 238, 0.2) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.page-hero {
  margin-bottom: var(--space-5);
}

.lead {
  margin: var(--space-3) 0 0;
  width: 100%;
  font-size: clamp(1.05rem, 0.98rem + 0.25vw, 1.2rem);
  line-height: 1.55;
  color: var(--muted);
}

article.prose h1 {
  font-size: var(--fs-h1);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 var(--space-3);
  font-weight: 800;
}

article.prose .page-hero h1 {
  background: linear-gradient(105deg, #fff 0%, #e0e7ff 35%, #c4b5fd 70%, #67e8f9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@supports not (background-clip: text) {
  article.prose .page-hero h1 {
    color: var(--text);
    background: none;
  }
}

article.prose h2 {
  font-size: var(--fs-h2);
  margin: calc(var(--space-4) * 0.9) 0 var(--space-2);
  font-weight: 750;
  letter-spacing: -0.02em;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

article.prose h3 {
  font-size: var(--fs-h3);
  margin: calc(var(--space-4) * 0.75) 0 var(--space-2);
  font-weight: 700;
  color: #e8e8f0;
}

/* Heading permalinks (markdown-it-anchor) */
article.prose :is(h1, h2, h3, h4, h5, h6) {
  scroll-margin-top: 6rem;
}

article.prose :is(h1, h2, h3, h4, h5, h6) > a.header-anchor {
  color: inherit;
  color: inherit;
  text-decoration: none;
  border-bottom: none;
}

article.prose :is(h1, h2, h3, h4, h5, h6) > a.header-anchor::before {
  content: "#";
  display: inline-block;
  margin-right: 0.4em;
  padding: 0.05em 0.35em;
  border-radius: 8px;
  font-weight: 800;
  color: var(--muted);
  opacity: 0;
  transform: translateY(-0.02em);
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

article.prose :is(h1, h2, h3, h4, h5, h6):hover > a.header-anchor::before,
article.prose :is(h1, h2, h3, h4, h5, h6):focus-within > a.header-anchor::before {
  opacity: 1;
}

article.prose :is(h1, h2, h3, h4, h5, h6) > a.header-anchor:hover {
  color: var(--accent-2);
}

article.prose :is(h1, h2, h3, h4, h5, h6) > a.header-anchor:hover::before {
  color: var(--accent-2);
  background: rgba(34, 211, 238, 0.12);
}

article.prose p {
  margin: 0 0 var(--space-3);
}

article.prose img {
  display: block;
  margin: var(--space-4) auto;
}

article.prose a {
  color: var(--accent-2);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(34, 211, 238, 0.35);
  transition: border-color 0.15s ease, color 0.15s ease;
}

article.prose a:hover {
  border-bottom-color: var(--accent-2);
  color: #a5f3fc;
}

article.prose strong {
  color: #fff;
  font-weight: 700;
}

article.prose code,
article.prose pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.88em;
  color: #e5e7eb;
}

article.prose code {
  padding: 0.08em 0.3em;
  border-radius: 0.25em;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(56, 189, 248, 0.45);
}

article.prose pre {
  margin: 0 0 var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.92))
    border-box;
  border: 1px solid rgba(56, 189, 248, 0.55);
  overflow-x: auto;
}

article.prose pre code {
  padding: 0;
  border: 0;
  background: transparent;
}

article.prose ul,
article.prose ol {
  padding-left: 1.2rem;
  margin: 0 0 var(--space-3);
}

article.prose blockquote {
  position: relative;
  margin: var(--space-4) 0;
  padding: 0.95rem 1rem 0.95rem calc(var(--space-3) + 0.35rem);
  border-radius: var(--radius);
  color: #f1f2ff;
  font-style: italic;
  font-size: 1.04em;
  line-height: 1.7;
  background:
    radial-gradient(60% 120% at 0% 50%, rgba(124, 92, 255, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 22px 44px -34px rgba(0, 0, 0, 0.8),
    -18px 0 56px -44px rgba(124, 92, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

article.prose blockquote::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 4px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(196, 181, 253, 0.95), rgba(34, 211, 238, 0.75));
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.2), 0 0 24px rgba(124, 92, 255, 0.28);
}

article.prose blockquote::after {
  content: "“";
  position: absolute;
  left: 0.75rem;
  top: 0.35rem;
  font-size: 2.25rem;
  line-height: 1;
  font-weight: 900;
  color: rgba(196, 181, 253, 0.3);
  pointer-events: none;
}

article.prose blockquote > :last-child {
  margin-bottom: 0;
}

article.prose blockquote > :first-child {
  margin-top: 0;
}

article.prose blockquote :is(strong, em) {
  color: #fff;
}

article.prose blockquote :is(code, pre, kbd, samp) {
  font-style: normal;
}

article.prose blockquote cite {
  display: block;
  margin-top: 0.65rem;
  font-style: normal;
  font-weight: 650;
  font-size: 0.92em;
  color: var(--muted);
}

article.prose li {
  margin: 0.4rem 0;
}

article.prose li::marker {
  color: var(--accent);
}

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

.article-previews {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.article-preview {
  margin: 0;
}

.article-preview > article {
  margin: 0;
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.article-preview > article:hover {
  border-color: rgba(196, 181, 253, 0.35);
  box-shadow: 0 16px 40px -28px rgba(0, 0, 0, 0.5);
}

.article-preview__head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: var(--space-2);
}

.article-preview__title {
  margin: 0;
  font-size: var(--fs-h3);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.article-preview__title a {
  color: var(--text);
  text-decoration: none;
  border-bottom: none;
}

.article-preview__title a:hover {
  color: var(--accent-2);
}

.article-preview__date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.article-preview__excerpt {
  margin: 0 0 var(--space-3);
  color: var(--muted);
  line-height: 1.6;
}

.article-preview__more {
  margin: 0;
}

.article-preview__link {
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(34, 211, 238, 0.4);
}

.article-preview__link:hover {
  border-bottom-color: var(--accent-2);
  color: #a5f3fc;
}

@media (min-width: 600px) {
  .nav-summary {
    padding: 0.55rem 0.45rem;
  }
}

@media (min-width: 900px) {
  .nav-list-mobile {
    display: none;
  }

  .nav-list-desktop {
    display: flex;
  }

  main.site-main {
    padding-top: calc(var(--space-6) * 1.1);
    padding-bottom: calc(var(--space-6) * 1.1);
  }
}

@media (min-width: 1200px) {
  .container {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
