.editorial-search {
  display: grid;
  max-width: 46rem;
  grid-template-columns: 8rem 1fr;
  align-items: center;
  gap: var(--brand-space-4);
  margin-bottom: var(--brand-space-7);
}

.editorial-search label {
  color: var(--brand-light-blue);
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editorial-search__control {
  position: relative;
}

.editorial-search input {
  width: 100%;
  min-height: 3.4rem;
  padding: 0.8rem 3rem 0.8rem 1rem;
  border: 1px solid var(--brand-hairline);
  border-radius: var(--brand-radius-small);
  outline: none;
  background: var(--brand-surface);
  color: var(--brand-white);
  font: inherit;
}

.editorial-search input:focus {
  border-color: var(--brand-light-blue);
  box-shadow: 0 0 0 3px rgba(142, 173, 207, 0.12);
}

.editorial-search .htmx-indicator {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
}

.writing-grid--index {
  row-gap: var(--brand-space-7);
}

.search-summary,
.writing-grid--index > .writing-empty,
.writing-grid--index > .load-more-trigger {
  grid-column: 1 / -1;
}

.search-summary {
  margin: 0;
  color: var(--brand-muted);
}

.load-more-trigger {
  min-height: 3rem;
  text-align: center;
}

.htmx-indicator {
  display: none;
  color: var(--brand-muted);
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}

.article-detail__header {
  padding-block: clamp(4.5rem, 9vw, 8rem);
  border-bottom: 1px solid var(--brand-hairline);
  background: linear-gradient(125deg, rgba(142, 173, 207, 0.1), transparent 48%), var(--brand-surface);
}

.article-detail__header-grid {
  display: grid;
  grid-template-columns: 3fr 9fr;
  gap: var(--brand-space-6);
}

.article-detail__back {
  align-self: start;
  justify-self: start;
}

.article-detail__heading {
  max-width: 58rem;
}

.article-detail__heading h1 {
  font-size: clamp(2.6rem, 5.7vw, 5.8rem);
  text-wrap: balance;
}

.article-detail__dek {
  max-width: 44rem;
  margin: var(--brand-space-5) 0;
  color: var(--brand-muted);
  font-size: clamp(1.15rem, 1.65vw, 1.4rem);
  font-weight: var(--brand-weight-light);
}

.article-detail__image {
  margin-top: var(--brand-space-7);
}

.article-detail__image img {
  width: 100%;
  max-height: 42rem;
  object-fit: cover;
  border-radius: var(--brand-radius-large);
}

.article-detail__body-grid {
  display: grid;
  grid-template-columns: 3fr 9fr;
  gap: var(--brand-space-6);
  padding-block: clamp(4rem, 8vw, 7rem);
}

.article-detail__aside {
  align-self: start;
  position: sticky;
  top: 7rem;
}

.article-topics {
  margin-top: var(--brand-space-6);
}

[data-article-sections][hidden] + .article-topics {
  margin-top: 0;
}

.article-topics > span {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--brand-muted);
  font-size: 0.9rem;
}

.article-toc {
  display: grid;
  gap: 0.2rem;
  margin: var(--brand-space-3) 0 0;
  padding: 0;
  list-style: none;
}

.article-toc a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-left: 2px solid var(--brand-hairline);
  color: var(--brand-muted);
  font-size: 0.9rem;
  line-height: 1.35;
  text-decoration: none;
}

.article-toc a:hover,
.article-toc a:focus-visible {
  border-left-color: rgba(142, 173, 207, 0.65);
  color: var(--brand-white);
}

.article-toc a.is-active {
  border-left-color: var(--brand-light-blue);
  background: rgba(142, 173, 207, 0.08);
  color: var(--brand-light-blue);
}

.blog-content {
  max-width: 48rem;
  color: var(--brand-muted);
  font-size: clamp(1.05rem, 1.3vw, 1.15rem);
  font-weight: var(--brand-weight-light);
  line-height: 1.75;
}

.blog-content > h1:first-child {
  display: none;
}

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
  margin: 2.8em 0 0.8em;
  color: var(--brand-white);
  font-weight: var(--brand-weight-regular);
  line-height: 1.2;
}

.blog-content h2 { font-size: clamp(1.65rem, 2.6vw, 2.35rem); }
.blog-content h3 { font-size: clamp(1.35rem, 2vw, 1.8rem); }

.blog-content p,
.blog-content ul,
.blog-content ol,
.blog-content pre,
.blog-content blockquote,
.blog-content table {
  margin-bottom: 1.6rem;
}

.blog-content strong {
  color: var(--brand-white);
  font-weight: var(--brand-weight-regular);
}

.blog-content a {
  color: var(--brand-light-blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.blog-content li { margin-bottom: 0.55rem; }

.blog-content code {
  padding: 0.15rem 0.35rem;
  border-radius: 0.3rem;
  background: rgba(142, 173, 207, 0.12);
  color: var(--brand-light-blue);
}

.blog-content pre {
  overflow-x: auto;
  padding: var(--brand-space-4);
  border: 1px solid var(--brand-hairline);
  border-radius: var(--brand-radius-small);
  background: #0b1017;
}

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

.blog-content blockquote {
  margin-inline: 0;
  padding: var(--brand-space-4);
  border-left: 2px solid var(--brand-light-blue);
  background: var(--brand-surface);
  color: var(--brand-white);
}

.blog-content img {
  max-width: 100%;
  height: auto;
  margin-block: var(--brand-space-5);
  border-radius: var(--brand-radius-medium);
}

.blog-content table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}

.blog-content th,
.blog-content td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--brand-hairline);
  text-align: left;
}

.blog-content th { color: var(--brand-white); font-weight: var(--brand-weight-regular); }

.article-navigation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--brand-space-4);
  padding-bottom: var(--brand-space-8);
}

.article-navigation a {
  display: flex;
  min-height: 10rem;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--brand-space-5);
  border: 1px solid var(--brand-hairline);
  border-radius: var(--brand-radius-medium);
  background: var(--brand-surface);
  color: var(--brand-white);
  text-decoration: none;
}

.article-navigation a:last-child { text-align: right; }
.article-navigation span { color: var(--brand-light-blue); font-size: 0.875rem; }
.article-navigation strong { font-weight: var(--brand-weight-regular); }

.article-not-found {
  min-height: 60vh;
  padding-block: var(--brand-space-8);
}

@media (max-width: 720px) {
  .editorial-search,
  .article-detail__header-grid,
  .article-detail__body-grid,
  .article-navigation {
    grid-template-columns: 1fr;
  }

  .editorial-search { align-items: stretch; gap: var(--brand-space-2); }
  .article-detail__aside { position: static; }
  .article-navigation a:last-child { text-align: left; }
}
