:root {
  color-scheme: light;
  --page-bg: #f5f5f7;
  --page-bg-strong: #ffffff;
  --page-bg-muted: #fbfbfd;
  --surface-border: rgba(29, 29, 31, 0.08);
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --accent: #0071e3;
  --accent-strong: #0077ed;
  --shadow: 0 24px 72px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 18px 44px rgba(15, 23, 42, 0.08);
  --radius-xl: 28px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --max-width: 1240px;
  --copy-width: 62ch;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #0b0d11;
  --page-bg-strong: #101318;
  --page-bg-muted: #161a20;
  --surface-border: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --text-muted: #b4b7bf;
  --accent: #2997ff;
  --accent-strong: #59adff;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 20px 52px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-stack);
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(0, 113, 227, 0.08), transparent 34%),
    linear-gradient(180deg, var(--page-bg-strong), var(--page-bg));
}

body.blog-index {
  background:
    radial-gradient(circle at top left, rgba(0, 113, 227, 0.1), transparent 28%),
    radial-gradient(circle at top right, rgba(27, 157, 120, 0.08), transparent 24%),
    linear-gradient(180deg, var(--page-bg-strong), var(--page-bg));
}

a {
  color: inherit;
}

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

.page-shell {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding-bottom: 3rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(0.55rem, 1.4vw, 1rem);
  backdrop-filter: saturate(180%) blur(20px);
  background: color-mix(in srgb, var(--page-bg) 76%, transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
  text-decoration: none;
}

.brand-icon {
  flex: none;
  width: 62px;
  height: 62px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}

.brand-icon img {
  transform: translateY(-3px);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand-name {
  font-size: 1.34rem;
  font-weight: 720;
  letter-spacing: -0.03em;
}

.brand-platform {
  color: var(--text-muted);
  font-size: 0.96rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.nav-links a,
.button,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.72rem 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: color-mix(in srgb, var(--page-bg-strong) 90%, transparent);
  color: var(--text);
  font-weight: 640;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    background-color 160ms ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.button:hover,
.button:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible,
.text-link:hover,
.text-link:focus-visible {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-1px);
}

.nav-links a.is-active {
  background: var(--text);
  border-color: var(--text);
  color: var(--page-bg-strong);
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

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

.theme-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  cursor: pointer;
}

.theme-icon {
  position: absolute;
  width: 18px;
  height: 18px;
  display: block;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.85);
  filter: brightness(0) saturate(100%);
  transition: opacity 180ms ease, transform 180ms ease, filter 180ms ease;
}

:root[data-theme="dark"] .theme-icon {
  filter: none;
}

.theme-toggle[data-theme="light"] .theme-icon-sun,
.theme-toggle[data-theme="dark"] .theme-icon-moon {
  opacity: 1;
  transform: scale(1);
}

.eyebrow,
.post-meta {
  margin: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.blog-main,
.article-main {
  display: grid;
  gap: 1.5rem;
}

.blog-hero,
.featured-post,
.post-card,
.blog-aside,
.article-hero,
.article-body,
.article-cta,
.site-footer {
  border: 1px solid var(--surface-border);
  background: color-mix(in srgb, var(--page-bg-strong) 96%, transparent);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}

.blog-hero,
.article-hero,
.article-body,
.article-cta {
  padding: clamp(1.35rem, 3vw, 2.2rem);
}

.blog-hero {
  display: grid;
  gap: 1rem;
  margin-top: 0.6rem;
}

.blog-hero h1,
.article-hero h1 {
  margin: 0;
  letter-spacing: -0.04em;
  line-height: 1.02;
  text-wrap: balance;
}

.blog-hero h1 {
  font-size: clamp(2.7rem, 6vw, 5rem);
  max-width: 11ch;
}

.article-hero h1 {
  font-size: clamp(2.3rem, 5vw, 4.25rem);
  max-width: 12ch;
}

.blog-hero p,
.article-summary,
.article-intro,
.article-body p,
.article-body li,
.blog-aside p,
.post-copy p,
.article-cta p,
.site-footer p {
  color: var(--text-muted);
  line-height: 1.68;
}

.blog-hero p,
.article-summary,
.article-intro {
  font-size: 1.04rem;
  max-width: 62ch;
  margin: 0;
}

.blog-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.article-note {
  margin: 0;
  max-width: var(--copy-width);
  color: color-mix(in srgb, var(--text) 78%, var(--text-muted));
  font-size: 1rem;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.hero-actions,
.article-actions,
.article-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.featured-post {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  overflow: hidden;
}

.post-media {
  display: block;
  background: var(--page-bg-muted);
}

.post-media img,
.article-hero-image img,
.post-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-copy {
  display: grid;
  align-content: start;
  gap: 0.9rem;
  padding: clamp(1.35rem, 2vw, 1.8rem);
}

.post-copy h2,
.post-copy h3,
.article-body h2,
.article-body h3,
.blog-aside h2,
.article-cta h2 {
  margin: 0;
  letter-spacing: -0.03em;
}

.post-copy h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.04;
}

.post-copy h3 {
  font-size: 1.42rem;
  line-height: 1.12;
}

.text-link {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

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

.post-card {
  overflow: hidden;
}

.post-card img {
  aspect-ratio: 16 / 10;
}

.blog-aside {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 1.25rem;
  padding: clamp(1.35rem, 3vw, 2rem);
}

.blog-aside h2,
.article-cta h2 {
  font-size: 1.6rem;
}

.blog-aside ul,
.article-body ul,
.article-body ol,
.article-cta ul {
  margin: 0;
  padding-left: 1.15rem;
}

.blog-aside li,
.article-body li,
.article-cta li {
  color: var(--text-muted);
  line-height: 1.65;
}

.blog-aside li + li,
.article-body li + li,
.article-cta li + li {
  margin-top: 0.45rem;
}

.article-hero {
  display: grid;
  gap: 1rem;
  margin-top: 0.6rem;
}

.article-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.article-hero-image {
  width: min(100%, calc(var(--copy-width) - 2.25rem));
  justify-self: start;
  margin-top: 0.35rem;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
}

.article-hero-image img {
  height: auto;
  object-fit: contain;
  transform: none;
}

.article-body {
  display: grid;
  gap: 1.65rem;
}

.article-body section {
  display: grid;
  gap: 0.7rem;
  max-width: var(--copy-width);
}

.article-body h2 {
  font-size: clamp(1.3rem, 2.3vw, 1.8rem);
  line-height: 1.14;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.article-body h3 {
  font-size: 1.2rem;
}

.article-body pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background: color-mix(in srgb, var(--page-bg) 85%, var(--page-bg-strong));
}

.article-body code,
.article-body pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
}

.article-callout {
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: color-mix(in srgb, var(--page-bg-muted) 80%, transparent);
}

.article-body p,
.article-body li {
  color: color-mix(in srgb, var(--text) 80%, var(--text-muted));
  font-size: 1.02rem;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body figure,
.article-body pre {
  margin: 0;
}

.article-body figure {
  display: grid;
  gap: 0.45rem;
  width: fit-content;
}

.article-body video {
  display: block;
  max-width: 100%;
  border-radius: 26px;
}

.article-body figcaption {
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.article-callout p {
  margin: 0;
}

.related-links {
  display: grid;
  gap: 0.65rem;
}

.related-links a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  margin-top: 1.5rem;
}

.site-footer-links-only {
  justify-content: flex-start;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--accent);
}

.site-footer .footer-links .button {
  color: var(--text);
}

.site-footer .footer-links .button.button-primary {
  color: #fff;
}

@media (max-width: 980px) {
  .featured-post,
  .blog-aside {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .site-header {
    position: static;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .brand {
    align-items: flex-start;
  }

  .brand-icon {
    width: 56px;
    height: 56px;
  }

  .nav-links,
  .hero-actions,
  .article-actions,
  .article-cta-actions {
    width: 100%;
  }

  .nav-links a,
  .button {
    flex: 1 1 calc(50% - 0.5rem);
  }
}
