:root {
  --background: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --foreground: #0f172a;
  --muted: #475569;
  --muted-strong: #334155;
  --border: #cbd5e1;
  --primary: #0f172a;
  --primary-strong: #1e293b;
  --accent: #0f172a;
  --success: #23845f;
  --warning: #b67615;
  --ink: #0f172a;
  --radius: 8px;
  --shadow: 0 18px 42px -32px rgba(15, 23, 42, 0.32);
  --font-sans: Montserrat, var(--gh-font-body, Arial), sans-serif;
  --font-heading: Montserrat, var(--gh-font-heading, Arial), sans-serif;
  --font-mono: "Fira Code", ui-monospace, monospace;
  --ghost-accent-color: #0f172a !important;
}

html[data-theme="dark"] {
  color-scheme: dark;
  /* Exact public-platform dark tokens from src/index.css. */
  --background: oklch(0.17 0.025 250);
  --surface: oklch(0.22 0.027 265 / 0.98);
  --surface-soft: oklch(0.28 0.03 250);
  --card: oklch(0.22 0.027 265 / 0.98);
  --foreground: oklch(0.94 0.008 250);
  /* Ghost uses these as text colors; map them to the platform's muted foregrounds. */
  --muted: oklch(0.73 0.018 250);
  --muted-strong: oklch(0.91 0.01 250);
  --border: oklch(0.37 0.025 250);
  --primary: oklch(0.78 0.1 240);
  --primary-strong: oklch(0.84 0.08 240);
  --accent: oklch(0.78 0.1 240);
  --success: oklch(0.76 0.14 153.52);
  --warning: oklch(0.8 0.15 74.65);
  --ink: oklch(0.18 0.03 250);
  --shadow: 0 20px 46px -32px rgba(0, 0, 0, 0.72);
  --ghost-accent-color: oklch(0.78 0.1 240) !important;
}

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

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--background) 0%, var(--surface-soft) 48%, #e2e8f0 100%);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

img {
  height: auto;
}

::selection {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 36%, transparent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 100;
  transform: translateY(-140%);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  font-weight: 800;
  transition: transform 0.2s ease;
}

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

.shell,
.shell-wide,
.shell-narrow {
  width: min(100% - 32px, 1180px);
  margin-inline: auto;
}

.shell-wide {
  width: min(100% - 32px, 1120px);
}

.shell-narrow {
  width: min(100% - 32px, 760px);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 14px 34px -30px rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(24px);
}

.header-inner {
  display: grid;
  min-height: 64px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding-block: 8px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: var(--foreground);
}

.brand-link img {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.12));
}

.brand-link span {
  display: grid;
  gap: 2px;
}

.brand-link strong {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
}

.brand-link em {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  padding: 2px 8px;
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.brand-link small {
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
}

.desktop-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.desktop-nav a,
.mobile-nav a {
  color: #475569;
  font-size: 0.88rem;
  font-weight: 700;
}

.desktop-nav a:hover,
.mobile-nav a:hover {
  color: var(--foreground);
}

.desktop-nav .nav-current,
.mobile-nav .nav-current {
  color: var(--foreground);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.button,
.text-button,
.icon-button,
.footer-group button {
  border: 0;
  background: transparent;
  color: inherit;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 0 16px;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

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

.button-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 14px 28px -18px color-mix(in srgb, var(--primary) 72%, transparent);
}

.button-primary:hover {
  background: var(--primary-strong);
  color: #fff;
}

.button-secondary {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--foreground);
}

.button-secondary:hover {
  border-color: color-mix(in srgb, var(--primary) 32%, transparent);
  color: var(--primary);
}

.text-button {
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 800;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(226, 232, 240, 1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: #334155;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.menu-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.menu-button {
  display: none;
}

.menu-close,
.menu-button.is-open .menu-open {
  display: none;
}

.menu-button.is-open .menu-close {
  display: block;
}

.mobile-nav {
  display: none;
  width: 100%;
  margin: 0;
  border-top: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: none;
}

.mobile-nav a {
  display: block;
  width: min(100% - 32px, 1180px);
  margin-inline: auto;
  border-radius: 10px;
  padding: 12px 12px;
}

.mobile-nav a + a {
  border-top: 0;
}

.hero-section,
.archive-header {
  padding: 34px 0 18px;
}

.hero-section {
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 34%),
    radial-gradient(circle at 92% 14%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 30%);
}

.blog-home,
.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: stretch;
}

.blog-home-copy,
.blog-search-panel,
.hero-copy,
.hero-panel,
.archive-header-inner,
.sidebar-panel,
.cta-panel,
.featured-post,
.post-card {
  border: 1px solid rgba(203, 213, 225, 0.88);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.blog-home-copy,
.hero-copy {
  padding: 34px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
}

.blog-home-copy h1,
.hero-copy h1,
.archive-header h1,
.article-header h1,
.error-screen h1 {
  margin: 0;
  color: var(--foreground);
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.blog-home-copy p,
.hero-copy p,
.archive-header p,
.article-excerpt,
.error-screen p {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.78;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.eyebrow,
.panel-label {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-panel,
.blog-search-panel,
.sidebar-panel {
  padding: 22px;
}

.blog-search-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.blog-search-trigger {
  display: grid;
  width: 100%;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 10%, transparent), color-mix(in srgb, var(--accent) 8%, transparent));
  color: var(--foreground);
  padding: 16px;
  text-align: left;
}

.blog-search-trigger span {
  font-weight: 900;
}

.blog-search-trigger small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5;
}

.topic-list {
  display: grid;
  gap: 10px;
}

.topic-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(203, 213, 225, 0.86);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  padding: 12px;
}

.topic-list span {
  min-width: 0;
  color: var(--foreground);
  font-size: 0.88rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.topic-list small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.section-band {
  padding: 34px 0;
}

.section-band-tight {
  padding-top: 18px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.content-sidebar {
  position: sticky;
  top: 94px;
  display: grid;
  gap: 16px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.post-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.post-card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border-radius: 16px;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
  box-shadow: 0 22px 46px -34px rgba(15, 23, 42, 0.4);
  transform: translateY(-1px);
}

.post-card-image-link,
.featured-image-link {
  display: block;
  overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 10%, transparent), color-mix(in srgb, var(--accent) 8%, transparent));
}

.post-card-image-link {
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid rgba(203, 213, 225, 0.88);
}

.post-card-image,
.featured-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-image {
  transition: transform 0.25s ease;
}

.post-card:hover .post-card-image {
  transform: scale(1.02);
}

.post-card-body {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.post-card-body .post-meta {
  min-height: 20px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.post-meta a {
  color: var(--accent);
}

.post-card h3,
.featured-post h3 {
  margin: 0;
  color: var(--foreground);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.4;
}

.post-card p,
.featured-post p,
.cta-panel p,
.footer-brand p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.site-footer .footer-brand .brand-link small {
  display: none;
}

.footer-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.footer-pills a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #475569;
  padding: 0 12px;
  font-size: 0.74rem;
  font-weight: 800;
}

.footer-pills a:hover {
  border-color: color-mix(in srgb, var(--primary) 28%, transparent);
  color: var(--primary);
}

.post-card-link {
  align-self: end;
  color: var(--primary);
  font-size: 0.86rem;
  font-weight: 900;
}

.post-card-link:hover {
  color: var(--primary-strong);
}

.featured-post {
  display: grid;
  overflow: hidden;
}

.featured-post.has-image {
  grid-template-columns: minmax(260px, 0.55fr) minmax(0, 1fr);
}

.featured-image-link {
  min-height: 100%;
  border-right: 1px solid rgba(203, 213, 225, 0.88);
}

.featured-image {
  min-height: 260px;
}

.featured-body {
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: center;
  gap: 16px;
  padding: 26px;
}

.featured-body h3 {
  font-size: 1.25rem;
  line-height: 1.3;
}

.archive-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 34px;
}

.archive-image,
.author-avatar {
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
  border-radius: var(--radius);
}

.author-avatar {
  object-fit: cover;
}

.article {
  padding: 34px 0 0;
}

.article-header {
  text-align: left;
}

.article-header .post-meta {
  justify-content: flex-start;
  margin-bottom: 16px;
}

.article-author {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 22px;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 800;
}

.article-feature-image {
  margin-top: 30px;
}

.article-feature-image img {
  width: 100%;
  max-height: 620px;
  border: 1px solid rgba(203, 213, 225, 0.88);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  object-fit: cover;
}

.article-feature-image figcaption {
  width: min(100%, 760px);
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
  text-align: center;
}

.article-layout {
  width: min(100% - 32px, 1260px);
  max-width: 760px;
  padding-top: 30px;
}

.article-content {
  min-width: 0;
}

.gh-content {
  color: #334155;
  font-size: 1.06rem;
  line-height: 1.86;
}

.gh-content > *:first-child {
  margin-top: 0;
}

.gh-content > *:last-child {
  margin-bottom: 0;
}

.gh-content p,
.gh-content ul,
.gh-content ol,
.gh-content blockquote,
.gh-content table,
.gh-content pre,
.gh-content figure {
  margin: 0 0 1.45em;
}

.gh-content h2,
.gh-content h3,
.gh-content h4 {
  color: var(--foreground);
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.18;
}

.gh-content h2 {
  margin: 2.2em 0 0.7em;
  font-size: 2.25rem;
}

.gh-content h3 {
  margin: 1.8em 0 0.65em;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.4;
}

.gh-content h4 {
  margin: 1.5em 0 0.6em;
  font-size: 1.1rem;
}

.gh-content a {
  color: var(--primary);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--primary) 26%, transparent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.gh-content strong {
  color: var(--foreground);
  font-weight: 900;
}

.gh-content ul,
.gh-content ol {
  padding-left: 1.3em;
}

.gh-content li + li {
  margin-top: 0.45em;
}

.gh-content blockquote {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.gh-content blockquote > *:last-child {
  margin-bottom: 0;
}

.gh-content pre {
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--ink);
  color: #f8fafc;
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.7;
}

.gh-content code {
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--ink);
  padding: 0.15em 0.34em;
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.gh-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.gh-content > table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.gh-content .table-scroll {
  width: 100%;
  max-width: 100%;
  margin: 0 0 1.45em;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
  scrollbar-color: var(--primary) var(--surface-soft);
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.gh-content .table-scroll.is-wide-table {
  width: min(calc(100vw - 32px), 1180px);
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}

.gh-content .table-scroll:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 28%, transparent);
  outline-offset: 3px;
}

.gh-content .table-scroll::-webkit-scrollbar {
  height: 10px;
}

.gh-content .table-scroll::-webkit-scrollbar-track {
  background: var(--surface-soft);
}

.gh-content .table-scroll::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface-soft);
  border-radius: 999px;
  background: var(--primary);
}

.gh-content .table-scroll table {
  display: table;
  width: 100%;
  min-width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
}

.gh-content .table-scroll.is-wide-table table {
  min-width: 960px;
}

.gh-content th,
.gh-content td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.gh-content th {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--foreground);
}

.gh-content .table-scroll.is-wide-table th:not(:first-child),
.gh-content .table-scroll.is-wide-table td:not(:first-child) {
  min-width: 104px;
  white-space: nowrap;
}

.gh-content .table-scroll.is-wide-table th:first-child,
.gh-content .table-scroll.is-wide-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 168px;
  max-width: 220px;
  background: #f8fafc;
  overflow-wrap: anywhere;
}

.gh-content .table-scroll.is-wide-table th:first-child {
  z-index: 2;
  background: #e2e8f0;
}

.kg-card,
.kg-image-card,
.kg-gallery-card,
.kg-embed-card,
.kg-bookmark-card {
  margin: 2rem 0;
}

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

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

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

.kg-image,
.kg-gallery-image img,
.kg-card img {
  border-radius: var(--radius);
}

.kg-card figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.kg-bookmark-card a.kg-bookmark-container {
  border-color: var(--border);
  border-radius: var(--radius);
}

.article-footer {
  padding: 28px 0 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.tag-row a {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted-strong);
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 800;
}

.cta-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 24px;
}

.cta-panel > div {
  min-width: 0;
}

.cta-panel h2 {
  max-width: 680px;
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.18;
}

.cta-panel > .button {
  flex: 0 0 auto;
  min-width: 112px;
  white-space: nowrap;
}

.content-sidebar .cta-panel {
  display: grid;
  gap: 16px;
  align-items: start;
  justify-content: stretch;
  padding: 20px;
}

.content-sidebar .cta-panel h2 {
  max-width: none;
  font-size: 1rem;
  line-height: 1.28;
}

.content-sidebar .cta-panel p:not(.panel-label) {
  font-size: 0.9rem;
  line-height: 1.65;
}

.content-sidebar .cta-panel .button {
  width: 100%;
  min-height: 40px;
  padding-inline: 14px;
  white-space: nowrap;
}

.pagination {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  border: 1px solid rgba(203, 213, 225, 0.88);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  padding: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.pagination p {
  margin: 0;
}

.pagination-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.pagination-done {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border: 1px solid rgba(35, 132, 95, 0.24);
  border-radius: var(--radius);
  background: rgba(35, 132, 95, 0.08);
  color: var(--success);
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 900;
}

.site-footer {
  margin-top: 42px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 -14px 34px -34px rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(18px);
}

.footer-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) repeat(4, minmax(118px, 0.55fr));
  gap: 30px;
  padding: 40px 0 28px;
}

.footer-brand p {
  max-width: 340px;
  margin-top: 16px;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.75;
}

.footer-group {
  display: grid;
  align-content: start;
  gap: 12px;
}

.footer-group h2 {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.footer-group a,
.footer-group button {
  padding: 0;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 700;
  text-align: left;
}

.footer-group a:hover,
.footer-group button:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  padding: 18px 0 26px;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 18px 34px -20px color-mix(in srgb, var(--primary) 70%, transparent);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary-strong);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.whatsapp-contact {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 60;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(52, 211, 153, 0.72);
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  box-shadow: 0 18px 34px -20px rgba(16, 185, 129, 0.72);
  transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.whatsapp-contact:hover {
  background: #1ebe5d;
  transform: translateY(-2px);
}

.whatsapp-contact:focus-visible {
  outline: 3px solid rgba(37, 211, 102, 0.28);
  outline-offset: 3px;
}

.whatsapp-contact svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.error-screen {
  display: grid;
  min-height: 54vh;
  align-content: center;
  padding: 76px 0;
}

@media (max-width: 1080px) {
  .desktop-nav {
    gap: 16px;
  }

  .article-layout {
    width: min(100% - 32px, 760px);
  }
}

@media (max-width: 920px) {
  .desktop-nav,
  .header-cta {
    display: none;
  }

  .header-inner {
    grid-template-columns: auto auto;
  }

  .menu-button {
    display: inline-grid;
  }

  .mobile-nav.is-open {
    display: block;
  }

  .blog-home,
  .hero-layout,
  .content-layout,
  .featured-post.has-image,
  .footer-layout {
    grid-template-columns: 1fr;
  }

  .featured-image-link {
    border-right: 0;
    border-bottom: 1px solid rgba(203, 213, 225, 0.88);
  }

  .content-sidebar {
    position: static;
  }

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

  .blog-home-copy h1,
  .hero-copy h1,
  .archive-header h1,
  .article-header h1,
  .error-screen h1 {
    font-size: 2.25rem;
  }

  .featured-body h3 {
    font-size: 1.125rem;
  }

  .archive-header-inner,
  .cta-panel {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .shell,
  .shell-wide,
  .shell-narrow {
    width: min(100% - 22px, 1180px);
  }

  .site-header {
    position: sticky;
  }

  .header-inner {
    min-height: 64px;
  }

  .brand-link {
    gap: 10px;
  }

  .brand-link img {
    width: 36px;
    height: 36px;
  }

  .brand-link small {
    display: none;
  }

  .brand-link em {
    min-height: 18px;
    padding-inline: 7px;
    font-size: 0.62rem;
  }

  .hero-section,
  .archive-header {
    padding-top: 24px;
  }

  .blog-home-copy,
  .blog-search-panel,
  .hero-copy,
  .archive-header-inner,
  .sidebar-panel,
  .cta-panel {
    padding: 18px;
  }

  .blog-home-copy h1,
  .hero-copy h1,
  .archive-header h1,
  .article-header h1,
  .error-screen h1 {
    font-size: 1.875rem;
    line-height: 1.12;
  }

  .blog-home-copy p,
  .hero-copy p,
  .archive-header p,
  .article-excerpt,
  .error-screen p {
    font-size: 0.96rem;
    line-height: 1.75;
  }

  .hero-actions,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .section-band {
    padding: 24px 0;
  }

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

  .post-card-body {
    padding: 16px;
  }

  .featured-image {
    min-height: 0;
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-actions {
    display: grid;
    justify-content: stretch;
  }

  .pagination-done {
    justify-content: center;
  }

  .article {
    padding-top: 28px;
  }

  .article-layout {
    padding-top: 26px;
  }

  .back-to-top {
    right: 16px;
    bottom: 16px;
    width: 42px;
    height: 42px;
  }

  .whatsapp-contact {
    left: 16px;
    bottom: 16px;
    width: 42px;
    height: 42px;
  }

  .article-header {
    text-align: left;
  }

  .article-header .post-meta,
  .article-author {
    justify-content: flex-start;
  }

  .gh-content {
    font-size: 1rem;
    line-height: 1.78;
  }

  .gh-content h2 {
    font-size: 1.5rem;
  }

  .gh-content h3 {
    font-size: 1rem;
  }

  .gh-content .table-scroll.is-wide-table {
    width: calc(100vw - 22px);
  }

  .gh-content .table-scroll.is-wide-table table {
    min-width: 880px;
    font-size: 0.88rem;
  }

  .gh-content .table-scroll.is-wide-table th,
  .gh-content .table-scroll.is-wide-table td {
    padding: 9px 10px;
  }

  .gh-content .table-scroll.is-wide-table th:first-child,
  .gh-content .table-scroll.is-wide-table td:first-child {
    min-width: 140px;
    max-width: 168px;
  }

  .footer-layout {
    gap: 22px;
  }
}

.cookie-banner[hidden],
.cookie-settings-overlay[hidden] {
  display: none !important;
}

.cookie-banner {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  z-index: 100;
  display: flex;
  width: min(calc(100% - 40px), 920px);
  margin-inline: auto;
  align-items: center;
  gap: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px -28px rgba(15, 23, 42, 0.46);
  padding: 20px;
}

.cookie-banner-copy {
  min-width: 0;
  flex: 1;
}

.cookie-kicker {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.cookie-banner h2,
.cookie-settings h2,
.cookie-preference h3 {
  margin: 0;
  color: var(--foreground);
  font-family: var(--font-heading);
  letter-spacing: 0;
}

.cookie-banner h2 {
  margin-top: 3px;
  font-size: 1rem;
  font-weight: 800;
}

.cookie-banner p,
.cookie-settings-header p,
.cookie-preference p {
  color: var(--muted);
  font-weight: 600;
}

.cookie-banner p {
  margin: 5px 0 0;
  font-size: 0.78rem;
  line-height: 1.65;
}

.cookie-banner p a {
  color: var(--primary);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-banner-actions,
.cookie-settings-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.cookie-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

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

.cookie-button-primary:hover {
  background: var(--primary-strong);
}

.cookie-button-secondary {
  border-color: var(--border);
  background: #fff;
  color: var(--muted-strong);
}

.cookie-button-secondary:hover {
  background: var(--surface-soft);
}

.cookie-button-soft {
  border-color: color-mix(in srgb, var(--primary) 26%, transparent);
  background: #f1f5f9;
  color: var(--primary);
}

.cookie-button-soft:hover {
  background: #e2e8f0;
}

.cookie-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.48);
  padding: 16px;
  backdrop-filter: blur(2px);
}

.cookie-settings {
  width: min(100%, 580px);
  max-height: calc(100svh - 32px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 28px 70px -30px rgba(15, 23, 42, 0.55);
}

.cookie-settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  padding: 20px;
}

.cookie-settings h2 {
  margin-top: 4px;
  font-size: 1.3rem;
  font-weight: 900;
}

.cookie-settings-header p {
  margin: 5px 0 0;
  font-size: 0.76rem;
  line-height: 1.65;
}

.cookie-settings-close {
  min-width: 58px;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted-strong);
  font-size: 0.7rem;
  font-weight: 800;
}

.cookie-settings-close:hover {
  background: var(--surface-soft);
}

.cookie-preferences {
  padding: 4px 20px;
}

.cookie-preference {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--border);
  padding: 16px 0;
}

.cookie-preference:first-child {
  border-top: 0;
}

.cookie-preference h3 {
  font-size: 0.86rem;
  font-weight: 800;
}

.cookie-preference p {
  margin: 4px 0 0;
  font-size: 0.72rem;
  line-height: 1.6;
}

.cookie-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 44px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #e2e8f0;
  padding: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.cookie-switch span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
  transition: transform 0.2s ease;
}

.cookie-switch.is-on {
  border-color: var(--primary);
  background: var(--primary);
}

.cookie-switch.is-on span {
  transform: translateX(20px);
}

.cookie-switch:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.cookie-settings-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
  padding: 16px 20px;
}

.cookie-settings-open {
  overflow: hidden;
}

.cookie-consent-visible .back-to-top {
  opacity: 0;
  pointer-events: none;
}

.cookie-consent-visible .whatsapp-contact {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 780px) {
  .cookie-banner {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: calc(100% - 24px);
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }

  .cookie-banner-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cookie-button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .cookie-settings-overlay {
    padding: 10px;
  }

  .cookie-settings {
    max-height: calc(100svh - 20px);
  }

  .cookie-settings-header,
  .cookie-preferences {
    padding-right: 16px;
    padding-left: 16px;
  }

  .cookie-settings-actions {
    flex-direction: column-reverse;
    padding: 14px 16px;
  }
}

/* Dark theme: keep every surface, pop-up, card, table, and navigation control legible. */
html[data-theme="dark"] body {
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.1), transparent 32%),
    linear-gradient(180deg, #0f172a 0%, #111827 48%, #0b1120 100%);
}

html[data-theme="dark"] .site-header,
html[data-theme="dark"] .mobile-nav,
html[data-theme="dark"] .site-footer {
  border-color: var(--border);
  background: rgba(15, 23, 42, 0.9);
}

html[data-theme="dark"] .brand-link small,
html[data-theme="dark"] .desktop-nav a,
html[data-theme="dark"] .mobile-nav a,
html[data-theme="dark"] .footer-brand p,
html[data-theme="dark"] .footer-group a,
html[data-theme="dark"] .footer-group button,
html[data-theme="dark"] .footer-bottom {
  color: var(--muted);
}

html[data-theme="dark"] .footer-group h2,
html[data-theme="dark"] .gh-content {
  color: var(--foreground);
}

html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .footer-pills a,
html[data-theme="dark"] .tag-row a,
html[data-theme="dark"] .cookie-button-secondary,
html[data-theme="dark"] .cookie-settings,
html[data-theme="dark"] .cookie-settings-close {
  border-color: var(--border);
  background: var(--card, var(--surface));
  color: var(--foreground);
}

html[data-theme="dark"] .button-primary,
html[data-theme="dark"] .back-to-top,
html[data-theme="dark"] .cookie-button-primary {
  background: var(--primary);
  color: var(--ink);
}

html[data-theme="dark"] .button-primary:hover,
html[data-theme="dark"] .back-to-top:hover,
html[data-theme="dark"] .cookie-button-primary:hover {
  background: var(--primary-strong);
  color: var(--ink);
}

html[data-theme="dark"] .icon-button:hover,
html[data-theme="dark"] .button-secondary:hover,
html[data-theme="dark"] .cookie-button-secondary:hover,
html[data-theme="dark"] .cookie-settings-close:hover {
  background: var(--surface-soft);
}

html[data-theme="dark"] .blog-home-copy,
html[data-theme="dark"] .blog-search-panel,
html[data-theme="dark"] .hero-copy,
html[data-theme="dark"] .hero-panel,
html[data-theme="dark"] .archive-header-inner,
html[data-theme="dark"] .sidebar-panel,
html[data-theme="dark"] .cta-panel,
html[data-theme="dark"] .featured-post,
html[data-theme="dark"] .post-card,
html[data-theme="dark"] .pagination,
html[data-theme="dark"] .cookie-banner {
  border-color: var(--border);
  background: var(--card);
}

html[data-theme="dark"] .blog-home-copy,
html[data-theme="dark"] .hero-copy,
html[data-theme="dark"] .topic-list a {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.99), rgba(15, 23, 42, 0.96));
}

html[data-theme="dark"] .featured-image-link,
html[data-theme="dark"] .post-card-image-link {
  border-color: var(--border);
}

html[data-theme="dark"] .gh-content code {
  background: rgba(255, 255, 255, 0.1);
  color: var(--foreground);
}

html[data-theme="dark"] .gh-content .table-scroll {
  background: rgba(15, 23, 42, 0.78);
}

html[data-theme="dark"] .gh-content .table-scroll.is-wide-table th:first-child,
html[data-theme="dark"] .gh-content .table-scroll.is-wide-table td:first-child {
  background: var(--surface);
}

html[data-theme="dark"] .gh-content .table-scroll.is-wide-table th:first-child {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
}

html[data-theme="dark"] .cookie-button-soft {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
}

html[data-theme="dark"] .cookie-button-soft:hover {
  background: color-mix(in srgb, var(--primary) 28%, var(--surface));
}

html[data-theme="dark"] .cookie-settings-actions {
  background: var(--surface-soft);
}

html[data-theme="dark"] .cookie-switch {
  border-color: var(--border);
  background: var(--muted);
}

html[data-theme="dark"] .cookie-switch span {
  background: var(--surface);
}
