/* book.css — Companion Materials page.
   Reuses the design tokens of home.css (--home-* vars) but adds the
   chapter-grouped grid for notebook cards. */

.companion-hero {
  position: relative;
  padding: 6.5rem 1.5rem 3rem;
  border-bottom: 1px solid var(--home-line);
  text-align: center;
}

.companion-hero .eyebrow {
  font-family: var(--home-mono);
  font-size: .65rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--home-orange);
  margin-bottom: .8rem;
}

.companion-hero h1 {
  font-family: var(--home-serif);
  font-size: clamp(2.1rem, 4.5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.08;
  margin: 0 0 .8rem;
  color: #fff;
}

.companion-hero h1 span {
  color: var(--home-orange);
}

.companion-hero p {
  max-width: 720px;
  margin: 0 auto;
  color: var(--home-muted);
  font-size: 1rem;
  line-height: 1.55;
}

/* Sticky chapter quick-jump bar */
.chapter-rail {
  position: sticky;
  top: 68px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .9rem 1.5rem;
  background: rgba(8, 8, 8, .92);
  border-bottom: 1px solid var(--home-line);
  backdrop-filter: blur(14px);
}

.chapter-rail a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .75rem;
  border: 1px solid var(--home-line);
  border-radius: 999px;
  font-family: var(--home-mono);
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--home-muted);
  transition: color .2s, border-color .2s, background .2s;
}

.chapter-rail a:hover {
  color: #fff;
  border-color: var(--home-orange);
  background: rgba(249, 115, 22, .08);
}

.chapter-rail a strong {
  color: var(--home-orange);
  font-weight: 700;
}

/* Chapter blocks */
.chapter-block {
  padding: 1.6rem 1.5rem 1.5rem;
  border-bottom: 1px solid var(--home-line);
  /* sticky nav (68px) + chapter-rail (can wrap to 2 lines on narrower
     widths) ≈ 160–180px, plus a small breathing margin */
  scroll-margin-top: 190px;
}

.chapter-block:last-of-type {
  border-bottom: 0;
}

.chapter-head {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  max-width: 1280px;
  margin: 0 auto 1.2rem;
}

.chapter-head .kicker {
  font-family: var(--home-mono);
  font-size: .65rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--home-orange);
}

.chapter-head h2 {
  font-family: var(--home-serif);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.chapter-head small {
  color: var(--home-dim);
  font-family: var(--home-mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.notebook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
  max-width: 1280px;
  margin: 0 auto;
}

.nb-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--home-panel);
  border: 1px solid var(--home-line);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.nb-card:hover {
  border-color: rgba(249, 115, 22, .6);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}

.nb-canvas-wrap {
  position: relative;
  height: 120px;
  background: linear-gradient(180deg, #0b0b0b 0%, #050505 100%);
  overflow: hidden;
}

.nb-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.nb-body {
  padding: 1rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  flex: 1;
}

.nb-id {
  font-family: var(--home-mono);
  font-size: .58rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--home-orange);
}

.nb-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.25;
}

.nb-desc {
  font-size: .82rem;
  color: var(--home-muted);
  line-height: 1.45;
  margin: 0;
}

.nb-actions {
  display: flex;
  gap: .5rem;
  padding: .8rem 1.1rem 1.1rem;
  margin-top: auto;
  border-top: 1px solid var(--home-line);
}

.nb-actions a {
  flex: 1;
  text-align: center;
  padding: .55rem .7rem;
  border-radius: 9px;
  font-family: var(--home-mono);
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid var(--home-line);
  color: var(--home-text);
  transition: background .2s, border-color .2s, color .2s;
}

.nb-actions a.primary {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  border-color: transparent;
  color: #fff;
}

.nb-actions a.primary:hover {
  filter: brightness(1.08);
}

.nb-actions a.secondary:hover {
  color: #fff;
  border-color: rgba(249, 115, 22, .55);
  background: rgba(249, 115, 22, .07);
}

/* Empty / loading hint */
.nb-grid-empty {
  padding: 2rem;
  text-align: center;
  color: var(--home-dim);
  font-family: var(--home-mono);
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* Browse companion materials button on home page */
.browse-companion {
  margin-top: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .85rem 1.25rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #fff;
  font-family: var(--home-mono);
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  transition: filter .2s, transform .2s;
}

.browse-companion:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.browse-companion::after {
  content: "→";
  font-size: 1rem;
}

@media (max-width: 720px) {
  .chapter-rail {
    top: 60px;
    padding: .7rem 1rem;
  }
  .chapter-block {
    padding: 1.3rem 1rem 1rem;
    scroll-margin-top: 220px;       /* rail may wrap to 3 rows on phones */
  }
  .notebook-grid { grid-template-columns: 1fr; }
  .companion-hero { padding: 5rem 1rem 2.2rem; }
}
