/* APGO layout corrections — authoritative component geometry. */

.section {
  padding-block: clamp(2.25rem, 4vw, 3.5rem);
}

.section-title {
  font-size: clamp(1.65rem, 2.5vw, 2.15rem);
  line-height: 1.08;
}

.top-grid {
  display: grid;
  padding-block: clamp(1.75rem, 3vw, 2.75rem);
  grid-template-columns: minmax(0, 2fr) minmax(17rem, 0.75fr);
  gap: clamp(1.75rem, 3vw, 2.75rem);
  align-items: start;
}

.lead-story {
  display: block;
  min-height: 0;
  padding-right: clamp(1.5rem, 3vw, 2.5rem);
  border-right: 1px solid var(--rule);
}

.lead-story__image {
  display: block;
  min-height: 0;
  margin: 0 0 1.1rem;
  aspect-ratio: 16 / 9;
}

.lead-story__image img,
.lead-story__image:hover img {
  height: 100%;
  object-fit: cover;
  transform: none;
  transition: none;
}

.lead-story > .kicker,
.lead-story__headline,
.lead-story__dek,
.lead-story__meta {
  display: block;
  max-width: 46rem;
}

.lead-story__headline {
  margin-top: 0.45rem;
  font-size: clamp(2.35rem, 3.5vw, 3rem);
  letter-spacing: -0.025em;
  line-height: 1.01;
  text-wrap: balance;
}

.lead-story__dek {
  margin-top: 0.75rem;
  font-size: clamp(1.03rem, 1.35vw, 1.16rem);
  line-height: 1.5;
}

.lead-story__meta {
  margin-top: 0.75rem;
}

.top-stack {
  display: grid;
  align-content: start;
}

.top-stack .story-card {
  padding: 1rem 0;
}

.top-stack .story-card:first-child {
  padding-top: 0;
}

.top-stack .story-card + .story-card {
  padding-left: 0;
  border-top: 1px solid var(--rule);
  border-left: 0;
}

.top-stack .story-card__headline {
  font-size: clamp(1.2rem, 1.55vw, 1.45rem);
  line-height: 1.16;
}

.top-stack .story-card__dek {
  display: -webkit-box;
  max-height: 2.92em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.page-head {
  padding-block: clamp(2.5rem, 4vw, 3.75rem);
}

.page-head h1,
.projects-hero h1 {
  max-width: 46rem;
  font-size: clamp(2.5rem, 4vw, 3.25rem);
  letter-spacing: -0.025em;
  line-height: 1.02;
  text-wrap: balance;
}

.page-head--journal,
.page-head--support {
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem);
  gap: clamp(2.5rem, 5vw, 5rem);
  align-items: start;
}

.page-head--journal {
  padding-block: clamp(2rem, 3vw, 2.75rem);
}

.page-head--journal .page-head__aside > p,
.page-head--support > p {
  margin-top: 0;
  font-size: 1.08rem;
  line-height: 1.5;
}

.page-head__aside dl {
  margin-top: 0.75rem;
}

.archive-intro {
  align-items: start;
}

.page-head--journal + .section {
  padding-top: clamp(2rem, 3vw, 2.75rem);
}

.projects-hero__grid {
  min-height: 0;
  padding-block: clamp(2.75rem, 4vw, 4rem);
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem);
  gap: clamp(2.5rem, 5vw, 5rem);
  align-items: start;
}

.projects-hero {
  padding-block: 0;
}

.projects-hero__grid > div:last-child p {
  font-size: 1.08rem;
}

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

.support-strip__inner {
  min-height: 12rem;
  grid-template-columns: minmax(16rem, 0.9fr) minmax(18rem, 1.1fr) auto;
  gap: clamp(1.5rem, 4vw, 3.5rem);
}

.support-strip h2 {
  font-size: clamp(1.75rem, 2.8vw, 2.5rem);
  line-height: 1.05;
}

.footer__grid {
  grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
}

.footer__column:last-child {
  grid-column: auto;
}

.wallet code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ranking-preview > * {
  min-width: 0;
}

.ranking-table {
  max-width: 100%;
}

/* Safe article geometry if the article-specific enhancement fails to load. */
.article-head {
  width: min(100%, 64rem);
  max-width: none;
}

.article-head__headline {
  font-size: clamp(2.35rem, 4vw, 3rem);
}

.article-hero__frame {
  max-height: none;
  aspect-ratio: 16 / 9;
}

.article-layout {
  max-width: 64rem;
  grid-template-areas: "body rail";
  grid-template-columns: minmax(0, 42rem) minmax(12rem, 14rem);
}

.article-body {
  grid-area: body;
}

.article-aside {
  grid-area: rail;
}

@media (max-width: 1000px) {
  .article-layout {
    grid-template-areas:
      "body"
      "rail";
    grid-template-columns: minmax(0, 1fr);
  }

  .article-aside {
    position: static;
  }
}

@media (max-width: 1000px) {
  .ranking-preview {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .lead-story {
    padding-right: 0;
    padding-bottom: 1.75rem;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

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

  .top-stack .story-card,
  .top-stack .story-card:first-child {
    padding: 0;
  }

  .top-stack .story-card + .story-card {
    padding-left: 1.25rem;
    border-top: 0;
    border-left: 1px solid var(--rule);
  }

  .support-strip__inner {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .support-strip__inner .button {
    justify-self: start;
  }

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

  .footer__brand-wrap {
    grid-column: 1 / -1;
  }

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

  .filter-buttons {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.25rem;
  }

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

@media (max-width: 900px) {
  .top-stack {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .top-stack .story-card,
  .top-stack .story-card:first-child,
  .top-stack .story-card + .story-card {
    padding: 1rem 0;
    border-top: 1px solid var(--rule);
    border-left: 0;
  }

  .top-stack .story-card:first-child {
    border-top: 0;
  }

  .page-head--journal,
  .page-head--support,
  .projects-hero__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

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

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

  .support-box__qr {
    width: min(100%, 20rem);
  }
}

@media (max-width: 640px) {
  .lead-story__headline {
    font-size: clamp(2.15rem, 9vw, 2.5rem);
    text-wrap: wrap;
  }

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

  .footer__brand-wrap {
    grid-column: auto;
  }

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