/* ============================================
   HUB LAYOUT
   ============================================ */

.hub-inner {
  --hub-gutter: clamp(0.6rem, 11vw, 10rem);

  max-width: none;
  margin: 0 auto;
  padding: 2.5rem var(--hub-gutter) 0;
}

.hub-body {
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  text-align: center;
}

.hub-body p {
  margin-bottom: 0.4rem;
}

.hub-body a {
  color: var(--text-light);
}

.hub-body a:hover {
  color: var(--text);
}

/* ============================================
   HUB SECTIONS
   ============================================ */

.hub-section {
  margin-top: 2.5rem;
}

.hub-section:first-child {
  margin-top: 0;
}

body.hub-page .hub-inner > .hub-section {
  margin: 0 calc(-1 * var(--hub-gutter));
  padding: clamp(2.5rem, 4vw, 4rem) var(--hub-gutter);
  border-top: 1px solid var(--border);
  background-color: var(--bg);
}

body.hub-page .hub-inner > .hub-section:nth-of-type(even) {
  background-color: var(--bg-raised);
}

/* Let the first chapter begin directly beneath a hero. */
body.hub-page .cover-hero-snap + .hub-inner > .hub-section:first-child {
  margin-top: -2.5rem;
  padding-top: 2rem;
}

body.hub-page .hub-section__header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  padding: 0 0 1rem;
  border: 0;
  text-align: center;
}

body.hub-page .hub-section__header h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  font-weight: 400;
  font-variant: small-caps;
  letter-spacing: 0.13em;
}

/* Ochre hairline. */
body.hub-page .hub-section__header::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 5rem;
  height: 1px;
  background: var(--accent);
  transform: translateX(-50%);
}

.hub-section__header a {
  font-size: 0.85rem;
  color: var(--text-light);
}

.hub-section__header a:hover {
  color: var(--text);
}

.hub-section__more {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-align: right;
}

.hub-section__more a {
  color: var(--link);
  transition: color 0.15s ease;
}

.hub-section__more a:hover {
  color: var(--link-hover);
}

/* Cards sit directly on the section background. */
body.hub-page .hub-section .content-card-wall,
body.hub-page .hub-section .content-cards,
body.hub-page .hub-section .content-cards__track {
  background: transparent;
}

body.hub-page .hub-inner a:focus-visible {
  outline-color: var(--text);
  outline-offset: 3px;
}

/* ============================================
   CARD ENTRANCE
   Driven by js/section-reveal.js: cards below the fold (or clipped
   off the side of a rail) are parked `is-reveal-pending`, and swapped
   to `is-arriving` (with a per-batch `--arrival-delay`) once half of
   the card is on screen. All of it lives inside the no-preference
   media query, so without the script — or with reduced motion — no
   card is ever hidden.
   ============================================ */

@keyframes hub-card-arrive {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .content-card-mount.is-reveal-pending {
    opacity: 0;
    transform: translateY(2rem);
  }

  .content-card-mount.is-arriving {
    animation: hub-card-arrive 900ms cubic-bezier(0.22, 0.61, 0.36, 1) var(--arrival-delay, 0ms)
      both;
  }

  .content-card-mount:is(.is-reveal-pending, .is-arriving):focus-within {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
