.topic-directory {
  max-width: 1080px;
  margin: 0 auto 1.8rem;
  padding: 26px;
  background: #ffffff;
  border: 1px solid #e4eaf2;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(42, 61, 92, .07);
}

.topic-directory-header {
  max-width: 760px;
  margin: 0 auto 22px;
  text-align: center;
}

.topic-directory-kicker {
  display: inline-block;
  margin-bottom: 7px;
  color: #6880a4;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.topic-directory h2,
.topic-hub h1,
.continue-learning h2 {
  color: #2c4e79;
}

.topic-directory h2 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 3vw, 2.1rem);
}

.topic-directory-header p {
  margin: 0 auto;
  color: #5b6879;
  line-height: 1.65;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.topic-card {
  display: block;
  min-width: 0;
  padding: 19px 20px;
  border: 1px solid #dce6f1;
  border-radius: 14px;
  background: #f9fbfe;
  color: inherit;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.topic-card:hover {
  transform: translateY(-2px);
  border-color: #a8bfdc;
  box-shadow: 0 10px 24px rgba(50, 79, 116, .10);
}

.topic-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  margin-bottom: 10px;
  padding: 0 10px;
  border-radius: 12px;
  background: #eaf2ff;
  color: #3869b3;
  font-weight: 900;
}

.topic-card h3 {
  margin: 0 0 5px;
  color: #2c4565;
  font-size: 1.08rem;
}

.topic-card p {
  margin: 0;
  color: #657386;
  font-size: .9rem;
  line-height: 1.55;
  text-align: left;
}

.topic-card-arrow {
  display: inline-block;
  margin-top: 10px;
  color: #3266aa;
  font-size: .88rem;
  font-weight: 800;
}

.topic-card.exploration {
  grid-column: 1 / -1;
  background: #fbf9ff;
  border-color: #e2d9f0;
}

.topic-card.exploration .topic-card-icon {
  background: #f0eaff;
  color: #7254a4;
}

.explore-tools-heading {
  max-width: 780px;
  margin: 4px auto 16px;
  text-align: center;
}

.explore-tools-heading h2 {
  margin: 0 0 5px;
  color: #344c6a;
  font-size: 1.45rem;
}

.explore-tools-heading p {
  margin: 0 auto;
  color: #6a7787;
  font-size: .93rem;
}

.topic-hub {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  container: topic-hub / inline-size;
}

/* Hub pages: match the border-box sizing tool pages already use, so the
   sidebars stay inside the viewport. */
body:has(.topic-hub),
body:has(.topic-hub) *,
body:has(.topic-hub) *::before,
body:has(.topic-hub) *::after {
  box-sizing: border-box;
}

.topic-hub-hero {
  margin-bottom: 18px;
  padding: 28px 28px 25px;
  background: #ffffff;
  border: 1px solid #e3eaf2;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(42, 61, 92, .07);
  text-align: center;
}

.topic-hub-kicker {
  color: #6880a4;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.topic-hub h1 {
  margin: 7px 0 10px;
  font: 700 max(1.5rem, min(clamp(2rem, 4vw, 3rem), 10cqi))/1.15 'Raleway', sans-serif;
  overflow-wrap: break-word;
  hyphens: auto;
}

.topic-hub-hero p {
  max-width: 720px;
  margin: 0 auto;
  color: #536276;
  font-size: 1rem;
  line-height: 1.65;
}

.learning-path {
  display: grid;
  gap: 13px;
}

.learning-path-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 15px;
  align-items: center;
  padding: 18px 20px;
  background: #ffffff;
  border: 1px solid #e0e7f0;
  border-radius: 14px;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.learning-path-card:hover {
  transform: translateY(-2px);
  border-color: #aabfd9;
  box-shadow: 0 9px 22px rgba(47, 71, 102, .09);
}

.learning-path-step {
  display: flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #edf4ff;
  color: #3767ac;
  font-weight: 900;
}

.learning-path-copy {
  min-width: 0;
}

.learning-path-label {
  display: block;
  margin-bottom: 2px;
  color: #7a899b;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.learning-path-card h2,
.learning-path-card h3 {
  margin: 0 0 4px;
  color: #304a69;
  font-size: 1.08rem;
}

.learning-path-card p {
  margin: 0;
  color: #657386;
  font-size: .9rem;
  line-height: 1.5;
}

.learning-path-arrow {
  color: #6e8fb8;
  font-size: 1.2rem;
  font-weight: 900;
}

.topic-extra {
  margin-top: 18px;
  padding: 20px 22px;
  background: #f7faff;
  border: 1px solid #dce7f3;
  border-radius: 14px;
}

.topic-extra h2 {
  margin: 0 0 8px;
  color: #365477;
  font-size: 1.16rem;
}

.topic-extra p {
  margin: 0 0 10px;
  color: #607083;
  line-height: 1.6;
}

.topic-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-link-list a {
  display: inline-block;
  padding: 8px 11px;
  border: 1px solid #cddbeb;
  border-radius: 999px;
  background: #fff;
  color: #3b638f;
  font-size: .86rem;
  font-weight: 750;
  text-decoration: none;
}

.topic-link-list a:hover {
  border-color: #9bb5d3;
  background: #f3f8ff;
}

.continue-learning {
  max-width: 920px;
  margin: 20px auto 4px;
  padding: 20px 22px;
  background: #f8fbff;
  border: 1px solid #dce6f2;
  border-radius: 15px;
}

.continue-learning h2 {
  margin: 0 0 5px;
  font-size: 1.18rem;
  text-align: center;
}

.continue-learning > p {
  margin: 0 auto 14px;
  color: #677487;
  font-size: .88rem;
  line-height: 1.5;
  text-align: center;
}

.continue-links {
  display: grid;
  /* Columns follow the width actually available: the main column can be
     narrower at tablet widths (both sidebars shown) than on a phone. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 9px;
}

.continue-link {
  display: block;
  padding: 12px 13px;
  background: #fff;
  border: 1px solid #d8e2ee;
  border-radius: 11px;
  color: #375a83;
  text-decoration: none;
}

.continue-link:hover {
  border-color: #9fb5cf;
  background: #f4f8fd;
}

.continue-link small {
  display: block;
  margin-bottom: 2px;
  color: #8996a6;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.continue-link strong {
  display: block;
  color: #355474;
  font-size: .9rem;
  line-height: 1.35;
}

@media (max-width: 720px) {
  .topic-directory {
    padding: 20px 14px;
  }

  .topic-grid {
    grid-template-columns: 1fr;
  }

  .topic-card.exploration {
    grid-column: auto;
  }

  .learning-path-card {
    grid-template-columns: 46px minmax(0, 1fr) 20px;
    gap: 10px;
    padding: 15px 13px;
  }

  .learning-path-step {
    width: 40px;
    height: 40px;
  }

  .topic-hub-hero {
    padding: 23px 17px 21px;
  }
}

/* Hub learning path follows the hub's own width, not the viewport. */
@container topic-hub (max-width: 560px) {
  .topic-hub-hero {
    padding: 23px 17px 21px;
  }

  .learning-path-card {
    grid-template-columns: 40px minmax(0, 1fr) 16px;
    gap: 10px;
    padding: 15px 13px;
  }

  .learning-path-step {
    width: 40px;
    height: 40px;
  }

  .topic-extra {
    padding: 17px 15px;
  }
}

@container topic-hub (max-width: 340px) {
  .topic-hub-hero {
    padding: 20px 13px 18px;
  }

  .learning-path-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 14px 13px;
  }

  .learning-path-step {
    width: 34px;
    height: 34px;
    font-size: .85rem;
  }

  .learning-path-arrow {
    display: none;
  }
}
