:root {
  --bg: #07111f;
  --surface: rgba(10, 24, 42, 0.72);
  --surface-strong: rgba(14, 31, 54, 0.92);
  --surface-soft: rgba(20, 42, 72, 0.62);
  --text: #edf4ff;
  --muted: #8fa4c4;
  --line: rgba(128, 164, 214, 0.2);
  --brand: #31c3ff;
  --brand-blue: #2a72ff;
  --brand-dark: #8fdfff;
  --shadow: 0 28px 80px rgba(1, 8, 18, 0.45);
  --focus-ring: 0 0 0 4px rgba(49, 195, 255, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(49, 195, 255, 0.15), transparent 24%),
    radial-gradient(circle at 85% 10%, rgba(71, 104, 255, 0.18), transparent 18%),
    linear-gradient(180deg, #08111d 0%, #091527 48%, #07111f 100%);
  background-color: var(--bg);
  font-family: "Avenir Next", Avenir, Montserrat, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.site-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 4rem;
}

.site-header {
  position: sticky;
  top: 0.9rem;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.78rem 0.95rem;
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(7, 17, 31, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.site-brand {
  color: #f4f9ff;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
}

.site-nav a:not(.button) {
  color: var(--muted);
  transition: color 160ms ease;
}

.site-nav a:not(.button):hover {
  color: var(--text);
}

.menu-toggle {
  display: none;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(11, 26, 47, 0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.28rem;
  box-shadow: var(--shadow);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.site-main {
  display: grid;
  gap: 1.1rem;
  padding-top: 1rem;
}

.blog-hero,
.archive-header,
.related-posts,
.article,
.topic-strip,
.site-footer {
  border: 1px solid rgba(76, 111, 187, 0.24);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(7, 13, 25, 0.96), rgba(6, 11, 23, 0.94)),
    radial-gradient(circle at top, rgba(41, 108, 255, 0.16), transparent 42%);
  box-shadow: 0 30px 80px rgba(2, 8, 18, 0.52);
}

.blog-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 1.4rem;
  padding: 1.6rem;
}

.blog-hero-copy {
  padding: 1.25rem 0.2rem 0.35rem;
}

.kicker,
.card-label {
  display: inline-flex;
  margin: 0 0 0.7rem;
  color: #8ca3cf;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.blog-hero h1,
.archive-header h1,
.article-header h1,
.section-head h2 {
  margin: 0;
  color: #f5f8ff;
  letter-spacing: -0.05em;
}

.blog-hero h1 {
  max-width: 10ch;
  font-size: clamp(2.9rem, 5vw, 4.9rem);
  line-height: 0.95;
}

.archive-header h1,
.article-header h1 {
  max-width: 920px;
  font-size: clamp(2.35rem, 4.6vw, 4.45rem);
  line-height: 0.98;
}

.lede {
  max-width: 64ch;
  margin: 1rem 0 1.25rem;
  color: #9bb0d3;
  font-size: 1.04rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.76rem 1.05rem;
  border-radius: 999px;
  border: 1px solid rgba(84, 162, 255, 0.14);
  font-weight: 600;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary,
.button-small {
  background: linear-gradient(135deg, #32c4ff, #147fda);
  color: #04101e;
  box-shadow: 0 10px 24px rgba(20, 127, 218, 0.18);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: #dce9ff;
  border-color: rgba(155, 186, 226, 0.18);
}

.button-small {
  min-height: 40px;
  padding: 0.64rem 0.9rem;
}

.featured-post,
.post-card,
.article-footer {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(72, 100, 168, 0.24);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(13, 20, 38, 0.94), rgba(8, 14, 28, 0.94)),
    rgba(11, 20, 38, 0.92);
}

.featured-post a {
  display: grid;
  min-height: 100%;
}

.featured-post img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.featured-post div,
.post-card-body {
  padding: 1.2rem;
}

.featured-post h2,
.post-card h2 {
  margin: 0 0 0.55rem;
  color: #f4f8ff;
  font-size: 1.35rem;
  line-height: 1.14;
  letter-spacing: -0.03em;
}

.featured-post p,
.post-card p {
  margin: 0 0 1rem;
  color: #90a5cb;
  line-height: 1.55;
}

.post-meta {
  color: #7288b0;
  font-size: 0.88rem;
}

.topic-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 1.15rem 1.35rem;
}

.topic-strip span {
  color: #dce6fb;
  font-weight: 600;
}

.topic-strip ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topic-strip a,
.tag-list a {
  display: inline-flex;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(73, 107, 182, 0.22);
  border-radius: 999px;
  background: rgba(10, 18, 34, 0.94);
  color: #bbcae8;
  font-size: 0.94rem;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.post-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.post-card a {
  display: grid;
  height: 100%;
}

.post-card-image,
.post-card-fallback {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.post-card-fallback {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(49, 195, 255, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(42, 114, 255, 0.28), rgba(7, 17, 31, 0.94));
}

.post-card-fallback span {
  color: #f5f8ff;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.archive-header,
.article-header {
  padding: 2rem 1.6rem;
}

.author-header {
  text-align: center;
}

.author-avatar {
  width: 86px;
  height: 86px;
  margin: 0 auto 1rem;
  border-radius: 999px;
  border: 1px solid rgba(128, 164, 214, 0.32);
  object-fit: cover;
}

.article {
  overflow: hidden;
}

.article-header {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  color: #8fa4c4;
}

.article-image {
  margin: 0;
}

.article-image img {
  width: 100%;
  max-height: 620px;
  object-fit: cover;
}

.article-image figcaption {
  padding: 0.75rem 1.6rem 0;
  color: #7288b0;
  font-size: 0.9rem;
}

.article-content {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.6rem 2.3rem;
  color: #dce8fb;
  font-size: 1.05rem;
  line-height: 1.78;
}

.article-content > * {
  margin-top: 0;
  margin-bottom: 1.3rem;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  color: #f5f8ff;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.article-content h2 {
  margin-top: 2.1rem;
  font-size: 2rem;
}

.article-content h3 {
  margin-top: 1.7rem;
  font-size: 1.45rem;
}

.article-content a {
  color: #8fdfff;
  text-decoration: underline;
  text-decoration-color: rgba(143, 223, 255, 0.35);
  text-underline-offset: 0.18em;
}

.article-content blockquote {
  margin-left: 0;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--brand);
  border-radius: 0 16px 16px 0;
  background: rgba(10, 20, 39, 0.72);
  color: #f1f7ff;
}

.article-content pre,
.article-content code {
  font-family: "SFMono-Regular", "JetBrains Mono", "Fira Code", Consolas, monospace;
}

.article-content pre {
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid rgba(155, 186, 226, 0.18);
  border-radius: 16px;
  background: rgba(2, 8, 18, 0.82);
}

.article-content code {
  color: #9ae8ff;
}

.article-content :not(pre) > code {
  padding: 0.12rem 0.34rem;
  border-radius: 8px;
  background: rgba(49, 195, 255, 0.1);
}

.kg-image,
.kg-video-container,
.kg-card img {
  border-radius: 20px;
}

.kg-width-wide {
  width: min(1040px, calc(100vw - 3rem));
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}

.kg-width-full {
  width: min(1200px, calc(100vw - 2.5rem));
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}

.kg-width-full img,
.kg-width-wide img {
  width: 100%;
}

.article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: 780px;
  margin: 0 auto 1.6rem;
  padding: 1rem;
}

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

.related-posts {
  padding: 1.4rem;
}

.section-head {
  margin-bottom: 1rem;
  text-align: center;
}

.section-head h2 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.9rem;
  padding: 1rem;
  color: #8fa4c4;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.1rem;
  padding: 1.35rem;
}

.site-footer p {
  max-width: 56ch;
  margin: 0.55rem 0 0;
  color: #8fa4c4;
  line-height: 1.55;
}

.site-footer nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  color: #b7c9ea;
}

.error-panel {
  display: grid;
  justify-items: start;
  gap: 0.4rem;
}

@media (max-width: 900px) {
  .site-shell {
    padding: 1rem 1rem 3rem;
  }

  .site-header {
    position: relative;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    z-index: 20;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(8, 18, 33, 0.96);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    width: 100%;
  }

  .blog-hero,
  .post-grid,
  .post-grid.compact,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .site-footer {
    display: grid;
  }

  .blog-hero,
  .archive-header,
  .article-header,
  .related-posts {
    padding: 1.2rem;
  }

  .blog-hero h1,
  .archive-header h1,
  .article-header h1 {
    max-width: none;
  }

  .article-content {
    padding: 1.4rem 1.2rem 1.8rem;
    font-size: 1rem;
  }
}

@media (max-width: 560px) {
  .site-shell {
    padding-inline: 0.75rem;
  }

  .blog-hero,
  .archive-header,
  .article,
  .related-posts,
  .site-footer {
    border-radius: 24px;
  }

  .hero-actions .button,
  .article-footer .button {
    width: 100%;
  }
}
