.blog-index,
.article-page {
  --blog-reading: 54rem;
  --blog-pad: clamp(1rem, 2.4vw, 1.75rem);
}

.blog-column {
  width: 100%;
  max-width: calc(var(--blog-reading) + 2 * var(--blog-pad));
  margin-inline: auto;
  padding-inline: var(--blog-pad);
}

.blog-index .mag-head {
  padding-top: clamp(2rem, 5vw, 3.5rem);
}

.mag-rule {
  height: 4px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent) 0 62%, var(--accent-lift) 62% 100%);
}

.mag-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .9rem;
  margin: 1rem 0 .85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .08em;
}

.mag-title {
  margin: 0 0 1rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

.mag-sub {
  max-width: 44rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.8;
}

.mag-divider {
  height: 1px;
  margin-top: 1.75rem;
  background: var(--border);
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1.5rem 0 1.75rem;
}

.tag-filter-btn {
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: .45rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel);
  color: var(--text-muted);
  font: inherit;
  font-size: .88rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.tag-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag-filter-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--paper);
  box-shadow: var(--shadow-soft);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  min-width: 0;
  padding: 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-panel);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-card);
}

.post-card:hover .post-title {
  color: var(--accent-dark);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
}

.post-meta .tag,
.related-meta .tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: .1rem .55rem;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-panel));
  color: var(--accent-dark);
  font-family: var(--font-body);
  font-size: .72rem;
  line-height: 1.2;
  white-space: nowrap;
}

.post-title {
  margin: 0;
  color: var(--text);
  font-size: 1.18rem;
  line-height: 1.45;
  text-wrap: pretty;
  transition: color .18s ease;
}

.post-summary {
  margin: 0;
  color: var(--text-muted);
  font-size: .95rem;
  line-height: 1.75;
}

.post-more {
  margin-top: auto;
  padding-top: .35rem;
  color: var(--accent);
  font-size: .9rem;
  font-weight: 600;
}

.post-empty {
  margin: 1.5rem 0 0;
  padding: 2rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  text-align: center;
}

.article-page .article-shell {
  width: 100%;
  max-width: calc(var(--blog-reading) + 2 * var(--blog-pad));
  margin-inline: auto;
}

.article-page .breadcrumbs,
.article-page .article-hero,
.article-page .reading-wrap {
  width: 100%;
  max-width: calc(var(--blog-reading) + 2 * var(--blog-pad));
  margin-inline: auto;
  padding-inline: var(--blog-pad);
}

.breadcrumbs {
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  font-size: .86rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  color: var(--border);
}

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

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

.breadcrumbs [aria-current="page"] {
  color: var(--text);
  overflow-wrap: anywhere;
}

.article-page .article-hero {
  padding-top: 0;
  padding-bottom: 0;
}

.article-page .article-hero .mag-rule {
  margin-bottom: 1.1rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
}

.article-meta .tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: .15rem .65rem;
  border: 1px solid var(--accent);
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: .74rem;
  line-height: 1.2;
  white-space: nowrap;
}

.article-meta .meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: .15rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel);
  color: var(--text-muted);
  line-height: 1.2;
  white-space: nowrap;
}

.article-title {
  margin: 0 0 1rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.18;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

.article-summary {
  max-width: 46rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-divider {
  height: 1px;
  margin-top: 1.6rem;
  background: var(--border);
}

.reading-wrap {
  width: 100%;
  max-width: calc(var(--blog-reading) + 2 * var(--blog-pad));
  margin-inline: auto;
  padding-inline: var(--blog-pad);
  padding-top: 1.5rem;
  padding-bottom: 0;
}

.article-body {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding-inline: 0;
  min-width: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.85;
  counter-reset: article-section;
  overflow-wrap: break-word;
}

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

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

.article-body p {
  margin: 0 0 1.15rem;
  text-wrap: pretty;
}

.article-body h2 {
  margin: 2.6rem 0 1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-wrap: pretty;
  counter-increment: article-section;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.article-body h2::before {
  content: counter(article-section, decimal-leading-zero);
  display: inline-block;
  margin-right: .6rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: .72em;
  font-weight: 600;
  vertical-align: .08em;
}

.article-body h2:first-child {
  padding-top: 0;
  border-top: 0;
}

.article-body h3 {
  margin: 1.8rem 0 .7rem;
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1.45;
  text-wrap: pretty;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.2rem;
  padding-left: 1.4rem;
}

.article-body li {
  margin: .35rem 0;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: .18em;
  overflow-wrap: anywhere;
}

.article-body a:hover {
  color: var(--accent-dark);
}

.article-body strong {
  color: var(--text);
}

.article-body blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-panel));
  color: var(--text);
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

.article-body :not(pre) > code {
  padding: .12em .35em;
  border-radius: var(--r-sm);
  background: var(--bg-panel-2);
  color: var(--accent-dark);
  font-family: var(--font-mono);
  font-size: .9em;
  overflow-wrap: anywhere;
}

.article-body pre {
  position: relative;
  max-width: 100%;
  margin: 1.5rem 0;
  padding: 2.2rem 1.1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--text);
  color: var(--paper);
  box-shadow: var(--shadow-soft);
}

.article-body pre::before {
  content: "";
  position: absolute;
  top: 1rem;
  left: 1.1rem;
  width: .5rem;
  height: .5rem;
  border-radius: var(--r-pill);
  background: var(--error);
  box-shadow: 1rem 0 0 var(--warn), 2rem 0 0 var(--success);
}

.article-body pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: var(--font-mono);
  font-size: .86rem;
  line-height: 1.7;
  white-space: pre;
}

.article-body hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.article-body img,
.article-body svg {
  max-width: 100%;
  height: auto;
}

.article-body figure {
  margin: 1.5rem 0;
}

.article-body figcaption {
  margin-top: .5rem;
  color: var(--text-muted);
  font-size: .82rem;
  line-height: 1.6;
}

.article-body .table-scroll {
  max-width: 100%;
  margin: 1.5rem 0;
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-panel);
  box-shadow: var(--shadow-soft);
}

.article-body .table-scroll table {
  min-width: 36rem;
  margin: 0;
}

.article-body > table {
  margin: 1.5rem 0;
}

.article-body table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  background: var(--bg-panel);
  font-size: .94rem;
}

.article-body thead th {
  padding: .7rem .85rem;
  background: var(--accent-dark);
  color: var(--paper);
  font-weight: 600;
  text-align: left;
}

.article-body tbody td,
.article-body tbody th {
  padding: .65rem .85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.article-body tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--bg-panel-2) 55%, transparent);
}

.article-body tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-panel));
}

.article-body tbody tr:last-child td,
.article-body tbody tr:last-child th {
  border-bottom: 0;
}

.article-body .callout {
  position: relative;
  margin: 1.5rem 0;
  padding: 1rem 1.1rem 1rem 3rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-panel));
}

.article-body .callout::before {
  content: "i";
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1;
}

.article-body .callout.is-warn {
  border-left-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, var(--bg-panel));
}

.article-body .callout.is-warn::before {
  content: "!";
  background: var(--warn);
}

.article-body .callout.is-success {
  border-left-color: var(--success);
  background: color-mix(in srgb, var(--success) 10%, var(--bg-panel));
}

.article-body .callout.is-success::before {
  content: "✓";
  background: var(--success);
}

.article-body .callout.is-info {
  border-left-color: var(--accent-lift);
  background: color-mix(in srgb, var(--accent-lift) 8%, var(--bg-panel));
}

.article-body .callout.is-info::before {
  content: "i";
  background: var(--accent-lift);
}

.article-body .callout-title {
  display: block;
  margin-bottom: .3rem;
  color: var(--accent-dark);
  font-weight: 700;
}

.article-body .callout.is-warn .callout-title {
  color: var(--warn);
}

.article-body .callout.is-success .callout-title {
  color: var(--success);
}

.article-body .callout.is-info .callout-title {
  color: var(--accent-lift);
}

.article-body .callout p:last-child {
  margin-bottom: 0;
}

.article-body .stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: .85rem;
  margin: 1.5rem 0;
}

.article-body .stat-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--bg-panel);
}

.article-body .stat-card:nth-child(3n+2) {
  border-top-color: var(--success);
  background: color-mix(in srgb, var(--success) 6%, var(--bg-panel));
}

.article-body .stat-card:nth-child(3n+3) {
  border-top-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 7%, var(--bg-panel));
}

.article-body .stat-num {
  display: block;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.5rem;
  line-height: 1.2;
}

.article-body .stat-label {
  display: block;
  margin-top: .25rem;
  color: var(--text-muted);
  font-size: .82rem;
  line-height: 1.4;
}

.article-body .check-list {
  display: grid;
  gap: .55rem;
  margin: 1.4rem 0;
  padding: 0;
  list-style: none;
}

.article-body .check-list li {
  margin: 0;
  padding: .75rem .9rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--bg-panel);
  list-style: none;
}

.article-body .check-list li p:last-child {
  margin-bottom: 0;
}

.article-body .verdict {
  margin: 1.5rem 0;
  padding: 1rem 1.2rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-panel));
}

.article-body .verdict strong:first-child {
  color: var(--accent-dark);
}

.article-body .verdict p:last-child {
  margin-bottom: 0;
}

.article-promo {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1.25rem;
  margin: 2.5rem 0 0;
  padding: clamp(1.3rem, 3vw, 2rem);
  overflow: hidden;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent-dark), var(--accent-lift));
  border: 1px solid color-mix(in srgb, var(--white) 22%, transparent);
  box-shadow: var(--shadow-window);
  color: var(--paper);
}

.article-promo::before {
  content: "";
  position: absolute;
  top: -3rem;
  right: -2rem;
  width: 12rem;
  height: 12rem;
  border: 1px solid color-mix(in srgb, var(--white) 18%, transparent);
  border-radius: var(--r-pill);
  pointer-events: none;
}

.article-promo .promo-body {
  position: relative;
  min-width: 0;
}

.article-promo .promo-brand {
  margin: 0 0 .35rem;
  color: color-mix(in srgb, var(--paper) 72%, transparent);
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .1em;
}

.article-promo .promo-title {
  margin: 0 0 .45rem;
  color: var(--white);
  font-size: 1.3rem;
  line-height: 1.35;
  text-wrap: pretty;
}

.article-promo .promo-text {
  margin: 0;
  color: color-mix(in srgb, var(--paper) 88%, transparent);
  font-size: .94rem;
  line-height: 1.7;
}

.article-promo .btn-primary {
  background: var(--white);
  border-color: var(--white);
  color: var(--accent-dark);
  box-shadow: none;
}

.article-promo .btn-primary:hover {
  background: var(--bg-panel);
  border-color: var(--bg-panel);
  color: var(--accent-dark);
}

.article-promo .btn-ghost {
  border-color: color-mix(in srgb, var(--white) 55%, transparent);
  color: var(--paper);
}

.article-promo .btn-ghost:hover {
  border-color: var(--white);
  background: color-mix(in srgb, var(--white) 14%, transparent);
  color: var(--white);
}

.article-promo .promo-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

#related-posts {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

#related-posts h2 {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1.4;
}

#related-posts h2::before {
  content: none;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: .85rem;
}

.related-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-width: 0;
  padding: 1.05rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-panel);
  color: var(--text);
  text-decoration: none;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.related-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 1.1rem;
  width: 2.25rem;
  height: 2px;
  border-radius: var(--r-pill);
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .2s ease;
}

.related-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  box-shadow: var(--shadow-card);
}

.related-card:hover::after {
  transform: scaleX(1);
}

.related-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
}

.related-title {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.related-summary {
  margin: 0;
  color: var(--text-muted);
  font-size: .86rem;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

#post-nav {
  margin-top: 1.5rem;
  padding-bottom: 1.75rem;
}

.post-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: .85rem;
}

.post-nav-card {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 0;
  padding: .95rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-panel);
  color: var(--text);
  text-decoration: none;
  transition: border-color .2s ease, transform .2s ease, background-color .2s ease;
}

.post-nav-card:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-panel));
  transform: translateY(-2px);
}

.post-nav-next {
  text-align: right;
}

.post-nav-dir {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .06em;
}

.post-nav-title {
  color: var(--text);
  font-size: .95rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.float-cta {
  position: fixed;
  right: clamp(.85rem, 2.5vw, 1.5rem);
  bottom: clamp(.85rem, 2.5vw, 1.5rem);
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.75rem;
  max-width: calc(100vw - 2rem);
  padding: .6rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--white) 24%, transparent);
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--paper);
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: var(--shadow-window);
  transition: background-color .2s ease, transform .2s ease;
}

.float-cta:hover {
  background: var(--accent-dark);
  color: var(--paper);
  transform: translateY(-2px);
}

.float-cta svg {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
}

.float-cta .float-cta-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .float-cta {
    right: .75rem;
    bottom: .75rem;
    padding: .55rem .9rem;
    font-size: .86rem;
  }

  .article-promo {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .article-promo .promo-actions {
    justify-content: stretch;
  }

  .article-promo .promo-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .post-nav-next {
    text-align: left;
  }
}

@media (max-width: 860px) {
  .article-body table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .article-body .table-scroll table {
    display: table;
    width: auto;
    min-width: 36rem;
    overflow: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  .post-card,
  .related-card,
  .post-nav-card,
  .tag-filter-btn,
  .float-cta,
  .related-card::after {
    transition: none;
  }

  .post-card:hover,
  .related-card:hover,
  .post-nav-card:hover,
  .float-cta:hover {
    transform: none;
  }
}