.blog-hero {
  overflow-x: clip;
  padding: calc(var(--section-space) * 0.9) var(--gutter) calc(var(--section-space) * 0.7);
  background:
    radial-gradient(circle at 82% 24%, var(--color-accent-soft), transparent 34%),
    linear-gradient(145deg, var(--color-bg-soft), var(--color-bg));
}

.blog-hero .wrap {
  position: relative;
}

.blog-hero .wrap::after {
  position: absolute;
  right: 2%;
  bottom: -1.5rem;
  width: min(24vw, 16rem);
  height: min(24vw, 16rem);
  border-radius: var(--radius-xxl);
  background:
    linear-gradient(135deg, var(--color-desk-light), var(--color-desk-dark));
  box-shadow: var(--shadow-desk);
  content: "";
  opacity: 0.48;
  transform: rotate(-7deg);
  pointer-events: none;
}

.blog-hero h1 {
  position: relative;
  z-index: 1;
  max-width: 15ch;
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: clamp(2.45rem, 7vw, 5.4rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.blog-hero-summary {
  position: relative;
  z-index: 1;
  max-width: 42rem;
  margin: 1.4rem 0 0;
  color: var(--color-text-muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.8;
}

.blog-filter-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.blog-filter-head h2 {
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.45rem);
}

.blog-result-count {
  flex: 0 0 auto;
  margin: 0;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 2rem;
}

.blog-filter {
  max-width: 100%;
  padding: 0.7rem 1.05rem;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-panel);
  color: var(--color-text-muted);
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.blog-filter:hover {
  background: var(--color-panel-raised);
  color: var(--color-text);
  transform: translateY(-1px);
}

.blog-filter:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.blog-filter.is-active {
  background: var(--color-accent);
  color: var(--color-bg);
  font-weight: 700;
  box-shadow: var(--shadow-button);
}

.article-list {
  display: grid;
  gap: 1rem;
}

.article-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem 2rem;
  padding: clamp(1.35rem, 4vw, 2.2rem);
  border-radius: var(--radius-xl);
  background: var(--color-panel);
  box-shadow: var(--shadow-card);
  transition:
    background-color 180ms ease,
    transform 180ms ease;
}

.article-card:hover {
  background: var(--color-panel-raised);
  transform: translateY(-2px);
}

.article-card .article-meta,
.article-card h3,
.article-card p {
  grid-column: 1;
}

.article-card h3 {
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.7vw, 1.65rem);
  line-height: 1.4;
}

.article-card h3 a {
  color: inherit;
  text-decoration: none;
}

.article-card h3 a:hover {
  color: var(--color-accent-pale);
}

.article-card p {
  max-width: 54rem;
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.75;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.article-meta time {
  white-space: nowrap;
}

.article-meta .tag,
.tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 1.7rem;
  padding: 0.24rem 0.65rem;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent-pale);
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-more {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  color: var(--color-accent);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.article-more::after {
  margin-left: 0.35rem;
  content: "→";
}

.article-more:hover {
  color: var(--color-accent-pale);
}

.blog-empty {
  margin: 1.5rem 0 0;
  padding: 2rem;
  border-radius: var(--radius-xl);
  background: var(--color-panel);
  color: var(--color-text-muted);
  text-align: center;
}

.breadcrumbs {
  margin-top: 1.5rem;
  padding-top: 0.25rem;
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

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

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

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

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

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

.breadcrumbs [aria-current="page"] {
  max-width: min(54rem, 68vw);
  overflow: hidden;
  color: var(--color-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-hero {
  padding: 2.25rem 0 3rem;
}

.post-hero .article-meta {
  margin-bottom: 1rem;
}

.post-hero h1 {
  max-width: 20ch;
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.14;
  letter-spacing: -0.035em;
}

.post-summary {
  max-width: 48rem;
  margin: 1.4rem 0 0;
  color: var(--color-text-muted);
  font-size: clamp(1.03rem, 2vw, 1.2rem);
  line-height: 1.8;
}

.post-layout {
  padding-bottom: var(--section-space);
}

.prose {
  width: 100%;
  min-width: 0;
  max-width: 50rem;
  color: var(--color-text);
  font-size: 1.02rem;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.prose h2 {
  margin: 3.5rem 0 1.1rem;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.3;
}

.prose h3 {
  margin: 2.25rem 0 0.85rem;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  line-height: 1.4;
}

.prose p {
  margin: 0 0 1.25rem;
  color: var(--color-text-muted);
}

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

.prose a {
  color: var(--color-accent);
  text-underline-offset: 0.22em;
}

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

.prose ul,
.prose ol {
  margin: 0 0 1.5rem;
  padding-left: 1.45rem;
  color: var(--color-text-muted);
}

.prose li {
  margin: 0.55rem 0;
  padding-left: 0.25rem;
}

.prose code {
  padding: 0.15em 0.38em;
  border-radius: var(--radius-xs);
  background: var(--color-panel-raised);
  color: var(--color-screen);
  font-family: var(--font-mono);
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.prose pre {
  max-width: 100%;
  margin: 1.5rem 0;
  padding: 1.25rem;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: var(--color-screen-deep);
  color: var(--color-screen);
  box-shadow: var(--shadow-device);
}

.prose pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.88rem;
  line-height: 1.75;
  overflow-wrap: normal;
}

.prose blockquote {
  margin: 1.75rem 0;
  padding: 1.1rem 1.35rem;
  border-left: 0.3rem solid var(--color-accent);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  background: var(--color-panel);
  color: var(--color-text-muted);
}

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

.prose .data-table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1.5rem 0;
  overflow-x: auto;
  border-collapse: collapse;
}

.prose .data-table th,
.prose .data-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--color-border-soft);
  text-align: left;
  white-space: nowrap;
}

.prose .data-table th {
  color: var(--color-text);
  background: var(--color-panel-raised);
}

.prose .data-table td {
  color: var(--color-text-muted);
  background: var(--color-panel);
}

.post-download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  max-width: var(--content-max);
  margin: clamp(3rem, 7vw, 5rem) auto 0;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: var(--radius-xxl);
  background:
    linear-gradient(135deg, var(--color-panel-raised), var(--color-panel));
  box-shadow: var(--shadow-card);
}

.post-download-card h2 {
  margin: 0 0 0.55rem;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.post-download-card p {
  max-width: 40rem;
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.post-download-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 0.7rem;
}

#related-posts {
  max-width: var(--content-max);
  margin: clamp(3rem, 7vw, 5rem) auto 0;
}

#related-posts > h2 {
  margin: 0 0 1.25rem;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

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

.related-card {
  min-width: 0;
  padding: 1.35rem;
  border-radius: var(--radius-xl);
  background: var(--color-panel);
}

.related-card h3 {
  margin: 0.85rem 0 0.7rem;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.5;
}

.related-card h3 a {
  color: inherit;
  text-decoration: none;
}

.related-card h3 a:hover {
  color: var(--color-accent);
}

.related-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

#post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  max-width: var(--content-max);
  margin: 1rem auto 0;
}

.post-nav-slot {
  min-width: 0;
}

.post-nav-next {
  grid-column: 2;
}

.post-nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  height: 100%;
  padding: 1.25rem;
  border-radius: var(--radius-xl);
  background: var(--color-bg-soft);
  color: var(--color-text);
  text-decoration: none;
  transition:
    background-color 180ms ease,
    transform 180ms ease;
}

.post-nav-card:hover {
  background: var(--color-panel-raised);
  transform: translateY(-2px);
}

.post-nav-label {
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.post-nav-card strong {
  line-height: 1.55;
}

.dl-fab {
  position: fixed;
  right: var(--gutter);
  bottom: var(--gutter);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  max-width: calc(100vw - var(--gutter) * 2);
  min-height: 3rem;
  padding: 0.7rem 1rem;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-bg);
  font-weight: 800;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: var(--shadow-button);
}

.dl-fab:hover {
  background: var(--color-accent-pale);
}

.dl-fab-icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
}

.dl-fab-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

@media (max-width: 800px) {
  .blog-hero .wrap::after {
    right: -4rem;
    bottom: -3rem;
    width: 11rem;
    height: 11rem;
    opacity: 0.3;
    transform: none;
  }

  .article-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-card .article-meta,
  .article-card h3,
  .article-card p,
  .article-more {
    grid-column: 1;
    grid-row: auto;
  }

  .article-more {
    justify-self: start;
    margin-top: 0.25rem;
  }

  .post-download-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .post-download-actions {
    width: 100%;
  }

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

@media (max-width: 560px) {
  .blog-filter-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.55rem;
  }

  .blog-filters {
    flex-wrap: nowrap;
    margin-right: calc(var(--gutter) * -1);
    padding-right: var(--gutter);
    overflow-x: auto;
  }

  .blog-filter {
    flex: 0 0 auto;
  }

  .breadcrumbs [aria-current="page"] {
    max-width: 68vw;
  }

  .post-download-actions {
    flex-direction: column;
  }

  .post-download-actions .button {
    width: 100%;
  }

  #post-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-nav-next {
    grid-column: 1;
  }

  .dl-fab {
    right: var(--gutter);
    bottom: var(--gutter);
  }
}

@media (prefers-reduced-motion: reduce) {
  .blog-filter,
  .article-card,
  .post-nav-card {
    transition: none;
  }

  .blog-filter:hover,
  .article-card:hover,
  .post-nav-card:hover {
    transform: none;
  }
}