/*
  Dynamic Agility chapter pages
*/

.da-chapter-page {
  --chapter-ink: #071426;
  --chapter-muted: #52657d;
  --chapter-line: rgba(37, 99, 235, 0.14);
  --chapter-blue: #2563eb;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 0%, rgba(186, 230, 253, 0.52), transparent 30rem),
    radial-gradient(circle at 86% 8%, rgba(37, 99, 235, 0.15), transparent 34rem),
    linear-gradient(180deg, #ffffff, #f7fcff 42%, #eef8ff);
  color: var(--chapter-ink);
  padding: clamp(1rem, 3vw, 2.5rem);
  padding-right: min(25rem, 32vw);
}

.da-chapter-content {
  width: min(74rem, 100%);
  margin-inline: auto;
}

.da-chapter-hero {
  display: grid;
  gap: 1rem;
  padding: clamp(4rem, 8vw, 7rem) 0 clamp(2rem, 5vw, 4rem);
}

.da-chapter-hero h1,
.da-chapter-section h2,
.da-chapter-final-link h2 {
  margin: 0;
  color: var(--chapter-ink);
  letter-spacing: -0.07em;
  text-wrap: balance;
}

.da-chapter-hero h1 {
  max-width: 12ch;
  font-size: clamp(4rem, 8.5vw, 8.6rem);
  line-height: 0.86;
}

.da-chapter-hero > p:not(.da-overline),
.da-chapter-section p,
.da-pattern-list span {
  max-width: 54rem;
  color: var(--chapter-muted);
  font-size: clamp(1rem, 1.3vw, 1.18rem);
  line-height: 1.65;
}

.da-chapter-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.da-chapter-metadata span {
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #1d4ed8;
  padding: 0.48rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.da-chapter-section {
  margin-bottom: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid var(--chapter-line);
  border-radius: 2rem;
  background:
    radial-gradient(circle at 8% 0%, rgba(186, 230, 253, 0.32), transparent 20rem),
    rgba(255, 255, 255, 0.75);
  box-shadow: 0 14px 45px rgba(15, 23, 42, 0.08);
  padding: clamp(1.15rem, 2.6vw, 2rem);
}

.da-chapter-section h2 {
  max-width: 14ch;
  font-size: clamp(2.2rem, 4.5vw, 4.5rem);
  line-height: 0.92;
}

.da-chapter-card-grid,
.da-timeline-cards,
.da-pattern-list {
  display: grid;
  gap: 0.85rem;
  margin-top: clamp(1rem, 2vw, 1.4rem);
}

.da-chapter-card-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.da-chapter-card-grid-four,
.da-timeline-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.da-chapter-card-grid article,
.da-timeline-cards article,
.da-pattern-list article,
.da-chapter-mini-visual {
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: 1.35rem;
  background: rgba(255, 255, 255, 0.76);
  padding: 1rem;
}

.da-chapter-card-grid span,
.da-timeline-cards span,
.da-chapter-mini-visual span,
.da-pattern-list strong {
  color: var(--chapter-blue);
  font-size: 0.72rem;
  font-weight: 860;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.da-chapter-card-grid h3,
.da-timeline-cards h3 {
  margin: 0.68rem 0 0;
  color: var(--chapter-ink);
  font-size: clamp(1.04rem, 1.7vw, 1.42rem);
  line-height: 1.14;
  letter-spacing: -0.035em;
}

.da-chapter-card-grid p,
.da-timeline-cards p,
.da-pattern-list span {
  margin: 0.62rem 0 0;
  font-size: 0.9rem;
}

.da-pattern-list article {
  display: grid;
  grid-template-columns: minmax(12rem, 0.4fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.da-chapter-callout,
.da-chapter-final-link {
  background:
    radial-gradient(circle at 12% 10%, rgba(56, 189, 248, 0.24), transparent 22rem),
    linear-gradient(135deg, #071426, #0f2744);
  color: #fff;
}

.da-chapter-callout h2,
.da-chapter-callout .da-overline,
.da-chapter-final-link h2,
.da-chapter-final-link .da-overline {
  color: #fff;
}

.da-chapter-callout p,
.da-chapter-final-link p {
  color: rgba(255, 255, 255, 0.72);
}

.da-chapter-two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 0.7fr);
  gap: 1.2rem;
  align-items: center;
}

.da-chapter-mini-visual {
  display: grid;
  gap: 0.75rem;
  min-height: 12rem;
  align-content: center;
  background:
    radial-gradient(circle at 88% 0%, rgba(56, 189, 248, 0.26), transparent 18rem),
    rgba(255, 255, 255, 0.8);
}

.da-chapter-mini-visual strong {
  color: var(--chapter-ink);
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  line-height: 1.12;
}

.da-chapter-final-link a {
  display: inline-flex;
  margin-top: 1rem;
  border-radius: 999px;
  background: #fff;
  color: #1d4ed8;
  padding: 0.82rem 1rem;
  font-weight: 820;
  text-decoration: none;
}

.da-chapter-right-sidebar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 110;
  display: flex;
  width: min(21rem, 28vw);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 1.7rem;
  background:
    radial-gradient(circle at 10% 0%, rgba(186, 230, 253, 0.54), transparent 18rem),
    rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(18px);
}

.da-chapter-sidebar-brand,
.da-chapter-sidebar-footer {
  padding: 1rem;
}

.da-chapter-sidebar-brand {
  border-bottom: 1px solid rgba(37, 99, 235, 0.14);
}

.da-chapter-sidebar-brand p {
  margin: 0.35rem 0 0;
  color: var(--chapter-muted);
  font-size: 0.8rem;
}

.da-chapter-right-sidebar nav {
  display: grid;
  gap: 0.45rem;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem;
}

.da-chapter-right-sidebar nav a {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 1rem;
  color: var(--chapter-muted);
  padding: 0.62rem;
  text-decoration: none;
}

.da-chapter-right-sidebar nav a:hover,
.da-chapter-right-sidebar nav a.is-active {
  border-color: rgba(37, 99, 235, 0.18);
  background: rgba(224, 242, 254, 0.56);
  color: var(--chapter-ink);
}

.da-chapter-right-sidebar nav span {
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 860;
}

.da-chapter-right-sidebar nav strong {
  overflow: hidden;
  font-size: 0.84rem;
  line-height: 1.15;
  text-overflow: ellipsis;
}

.da-chapter-sidebar-footer {
  border-top: 1px solid rgba(37, 99, 235, 0.14);
}

.da-chapter-sidebar-footer a {
  display: block;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #0284c7);
  color: #fff;
  padding: 0.75rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 820;
  text-align: center;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .da-chapter-page {
    padding-right: clamp(1rem, 3vw, 2.5rem);
  }

  .da-chapter-right-sidebar {
    position: sticky;
    top: 0;
    right: auto;
    bottom: auto;
    width: min(74rem, 100%);
    max-height: none;
    margin: 0 auto 1rem;
  }

  .da-chapter-right-sidebar nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(12rem, 1fr);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .da-chapter-sidebar-footer {
    display: none;
  }
}

@media (max-width: 860px) {
  .da-chapter-card-grid-three,
  .da-chapter-card-grid-four,
  .da-timeline-cards,
  .da-chapter-two-column {
    grid-template-columns: 1fr;
  }

  .da-pattern-list article {
    grid-template-columns: 1fr;
  }

  .da-chapter-hero h1 {
    font-size: clamp(3.1rem, 14vw, 5.4rem);
  }
}
