/* ── HOME ── */
.page-home {
  padding-top: calc(var(--header-h) + var(--proto-banner-h));
}

.hero {
  position: relative;
  min-height: clamp(420px, 72vh, 640px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
}

.hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: hero-zoom 20s ease-out forwards;
}

@keyframes hero-zoom {
  from {
    transform: scale(1.08);
  }
  to {
    transform: scale(1);
  }
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    var(--bg-base) 0%,
    rgba(18, 18, 18, 0.75) 40%,
    rgba(18, 18, 18, 0.35) 100%
  );
}

.hero__overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(222, 0, 43, 0.15) 0%, transparent 50%);
}

.hero__content {
  position: relative;
  z-index: 1;
  padding: 3rem 0 4rem;
  max-width: 720px;
}

.hero__label {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
}

.hero__title {
  margin: 0 0 1rem;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--text);
}

.hero__title span {
  color: var(--brand);
}

.hero__lead {
  margin: 0 0 1.75rem;
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 540px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 600px) {
  .hero__title {
    line-height: 1.1;
  }
}

.section {
  padding: 3.5rem 0;
}

.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.section__title {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  text-transform: uppercase;
  color: var(--text);
}

.section__title::before {
  content: "// ";
  color: var(--brand);
}

/* Bento grid */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
}

.bento .card--featured {
  grid-column: span 7;
  grid-row: span 2;
}

.bento .card:nth-child(2) {
  grid-column: span 5;
}

.bento .card:nth-child(3) {
  grid-column: span 5;
}

.bento .card:nth-child(4) {
  grid-column: span 12;
  flex-direction: row;
}

.bento .card:nth-child(4) .card__media {
  width: 40%;
  aspect-ratio: auto;
  min-height: 200px;
}

.bento .card:nth-child(4) .card__body {
  width: 60%;
  justify-content: center;
}

/* Fallback: bento child without explicit placement (e.g. single card on home) */
.bento .card:not(.card--featured):first-child:last-child {
  grid-column: span 12;
}

@media (max-width: 900px) and (min-width: 601px) {
  .bento {
    grid-template-columns: repeat(2, 1fr);
  }

  .bento .card--featured {
    grid-column: span 2;
    grid-row: span 1;
  }

  .bento .card:nth-child(2),
  .bento .card:nth-child(3) {
    grid-column: span 1;
  }

  .bento .card:nth-child(4) {
    grid-column: span 2;
    flex-direction: row;
  }

  .bento .card:nth-child(4) .card__media {
    width: 40%;
  }

  .bento .card:nth-child(4) .card__body {
    width: 60%;
  }
}

@media (max-width: 600px) {
  .bento {
    grid-template-columns: 1fr;
  }

  .bento .card--featured,
  .bento .card:nth-child(2),
  .bento .card:nth-child(3),
  .bento .card:nth-child(4) {
    grid-column: span 1;
  }

  .bento .card:nth-child(4) {
    flex-direction: column;
  }

  .bento .card:nth-child(4) .card__media,
  .bento .card:nth-child(4) .card__body {
    width: 100%;
  }
}

/* Stagger reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 {
  transition-delay: 0.1s;
}
.reveal-delay-2 {
  transition-delay: 0.2s;
}
.reveal-delay-3 {
  transition-delay: 0.3s;
}

/* ── CATEGORY ── */
.page-category .category-hero {
  padding: calc(var(--header-h) + var(--proto-banner-h) + 3rem) 0 2rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-raised) 0%, var(--bg-base) 100%);
}

.category-hero__title {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 4vw, 3rem);
  text-transform: uppercase;
}

.category-hero__title span {
  color: var(--brand);
}

.category-hero__count {
  margin: 0;
  color: var(--text-muted);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  padding: 2.5rem 0 4rem;
}

/* Category/archive: always concept category.html grid (not home bento) */
body.page-category .posts-grid,
body.page-category .bento {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  padding: 2.5rem 0 4rem;
}

body.page-category .bento .card,
body.page-category .posts-grid .card {
  grid-column: auto !important;
  grid-row: auto !important;
}

body.page-category .bento .card:nth-child(4) {
  flex-direction: column;
}

body.page-category .bento .card:nth-child(4) .card__media,
body.page-category .bento .card:nth-child(4) .card__body {
  width: 100%;
}

/* ── ARTICLE layout shell ── */
.page-article {
  padding-top: calc(var(--header-h) + var(--proto-banner-h));
}

.article-hero {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: flex-end;
}

.article-hero__bg {
  position: absolute;
  inset: 0;
}

.article-hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-base) 0%, transparent 70%);
}

.article-hero__inner {
  position: relative;
  z-index: 1;
  padding: 2.5rem 0 2rem;
  max-width: var(--max);
  margin: 0 auto;
  width: min(100% - 2rem, var(--max));
}

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

.article-hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  max-width: 900px;
}

.article-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.article-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5rem;
  padding: 2rem 0 4rem;
  align-items: start;
}

@media (max-width: 960px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
  .article-sidebar {
    position: static !important;
  }
}

/* Ultra-wide article framing (≥1400px) */
@media (min-width: 1400px) {
  .sto-single-article .container.article-layout,
  .sto-single-wrap .related .container {
    width: min(100% - 3rem, var(--max-ultra));
    max-width: var(--max-ultra);
  }

  .sto-single-article .article-hero__inner {
    width: min(100% - 3rem, var(--max-ultra));
    max-width: var(--max-ultra);
  }

  .sto-single-article .container.article-layout {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 3rem;
    padding: 2.5rem 0 4.5rem;
  }

  .sto-single-article .article-hero h1 {
    max-width: 1040px;
  }

  .sto-single-article .article-content-panel {
    padding: 2.25rem 2.75rem;
  }
}

/* Sidebar TOC */
.article-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--proto-banner-h) + 1.5rem);
}

.toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.toc__title {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.toc ol {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

.toc li {
  margin-bottom: 0.5rem;
}

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

.toc a:hover {
  color: var(--brand);
}

.sidebar-cta {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: var(--radius-lg);
  color: #fff;
}

.sidebar-cta h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.sidebar-cta p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  opacity: 0.9;
}

.sidebar-cta .btn {
  width: 100%;
  background: #fff;
  color: var(--brand);
  clip-path: none;
}

.sidebar-cta .btn:hover {
  background: #f0f0f0;
  color: var(--brand-dark);
}

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

/* Long posts: do not hide main column behind .reveal (IO threshold never fires). */
body.sto-blog-v2 .article-main.reveal {
  opacity: 1;
  transform: none;
}

.article-content-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
}

.related {
  padding: 0 0 4rem;
}

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

@media (max-width: 768px) {
  .related__grid {
    grid-template-columns: 1fr;
  }
}
