/* Catalogue page – extends styles.css */
.nav-links a.is-active {
  color: #fff;
}

.cat-hero {
  padding: calc(var(--header-h) + 2.4rem) 0 2.2rem;
}

.cat-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 240px);
  gap: 2.5rem;
  align-items: start;
}

.cat-hero h1 {
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 0 1rem;
}

.cat-hero-lead {
  color: var(--text-muted);
  font-size: 1.08rem;
  max-width: 40rem;
  margin-bottom: 0.85rem;
}

.cat-hero-note {
  color: var(--text-dim);
  font-size: 0.92rem;
  max-width: 40rem;
  margin-bottom: 1.5rem;
}

.cat-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.cat-hero-cover {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  background: #001234;
  max-width: 240px;
  justify-self: end;
}

.cat-hero-cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 1698;
}

.cat-toc {
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  background: rgba(0, 18, 52, 0.94);
  backdrop-filter: blur(14px) saturate(1.3);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cat-toc-inner {
  display: flex;
  align-items: center;
  gap: 0.35rem 1rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 0.7rem 0;
  scrollbar-width: thin;
}

.cat-toc a {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.cat-toc a:hover,
.cat-toc a:focus-visible {
  color: #fff;
  border-bottom-color: var(--accent);
}

.cat-toc a.cat-toc-dl {
  color: var(--brand-bright);
  margin-left: auto;
}

.cat-pages {
  padding: 2.2rem 0 3rem;
}

.cat-spread {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin: 0 0 1.6rem;
}

.cat-spread.is-pair {
  /* single column on small screens so each A4 page stays readable */
}

.cat-spread.is-solo {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.cat-block-title {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-bright);
  margin: 2.2rem 0 0.9rem;
}

.cat-page {
  margin: 0;
}

.cat-page-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 16px 40px rgba(0, 8, 24, 0.35);
  cursor: zoom-in;
  transition: border-color 0.2s, transform 0.2s;
}

.cat-page-btn:hover,
.cat-page-btn:focus-visible {
  border-color: rgba(0, 159, 227, 0.7);
  transform: translateY(-2px);
}

.cat-page-btn img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.cat-page figcaption {
  margin-top: 0.55rem;
  color: var(--text-dim);
  font-size: 0.86rem;
  font-weight: 500;
}

.cat-close {
  padding: 0 0 4.5rem;
}

.cat-close-box {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2rem 1.6rem;
  max-width: 720px;
}

.cat-close-box h2 {
  font-family: var(--display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin: 0.3rem 0 0.7rem;
}

.cat-close-box p {
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 8, 24, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: min(900px, 100%);
  max-height: 86vh;
  border-radius: 12px;
  box-shadow: var(--shadow);
  background: #fff;
}

.lightbox-close {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
}

@media (min-width: 900px) {
  .cat-spread.is-pair {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: none;
  }
}

@media (max-width: 860px) {
  .cat-hero-grid {
    grid-template-columns: 1fr;
  }

  .cat-hero-cover {
    max-width: 240px;
  }
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 1.1rem;
}

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

.cat-page,
.cat-page-anchor,
.cat-block-title {
  scroll-margin-top: calc(3.6rem + 8px);
}

/* Reserve space for lazy-loaded pages so section jumps don't land short */
.cat-page-btn img {
  aspect-ratio: 1200 / 1698;
}

.cat-page {
  position: relative;
}

.cat-page-anchor {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Scroll cue under the hero */
.cat-scroll-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  margin: 1.6rem auto 0;
  color: var(--brand-bright);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.cat-scroll-cue:hover,
.cat-scroll-cue:focus-visible {
  color: #fff;
}

.cat-scroll-cue-icon {
  display: block;
  animation: cat-cue-bounce 1.6s var(--ease) infinite;
}

@keyframes cat-cue-bounce {
  0%,
  100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(7px); opacity: 1; }
}

/* Active section in the sticky contents bar */
.cat-toc a.is-current {
  color: #fff;
  border-bottom-color: var(--accent);
}

/* Hint that the contents bar scrolls sideways on a phone */
.cat-toc-inner {
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 2.2rem), transparent 100%);
}

.cat-toc-inner:last-child,
.cat-toc a.cat-toc-dl {
  /* the fade is on the track; download stays in the scroll row */
}

@media (min-width: 1100px) {
  .cat-toc-inner {
    mask-image: none;
  }
}

@media (max-width: 860px) {
  .cat-hero {
    padding: calc(var(--header-h) + 1rem) 0 0.75rem;
  }

  .cat-hero-cover {
    display: none;
  }

  .cat-hero h1 {
    font-size: 2rem;
  }

  .cat-hero-lead {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  .cat-hero-note {
    margin-bottom: 0.7rem;
  }

  .cat-scroll-cue {
    margin-top: 0.85rem;
  }

  .cat-pages {
    padding-top: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cat-scroll-cue-icon {
    animation: none;
  }
}
