/* NDED homepage — Matrix clay visual system
   One material for the whole page, taken from the Matrix learning tools:
   pale blue clay slabs, white clay cards, Matrix blue for action.
   Colour carries meaning only:
     lavender = Tutor, grass green = Practice / Game, red = one tiny brand dot.
   Real tool previews keep their own internal colours. */
:root {
  /* Surfaces */
  --home-clay-bg: #E0E9FF;                       /* Matrix --clay-bg */
  --home-clay-section: linear-gradient(160deg, #E8EEFF 0%, #DDE6FF 100%);
  --home-clay-well: rgba(255,255,255,.4);        /* recessed area inside a slab */
  --home-clay-card: linear-gradient(160deg, #FFFFFF 0%, #F6F9FF 100%);
  --home-clay-chip: rgba(255,255,255,.8);
  --home-clay-edge: rgba(255,255,255,.82);

  /* Ink — every text colour below is at least 4.5:1 on the section blue */
  --home-clay-ink: #0A1931;
  --home-clay-heading: #233C61;
  --home-clay-text: #40516B;
  --home-clay-muted: #55678A;
  --home-clay-link: #3D5FA6;

  /* Action */
  --home-clay-primary: #6B94FF;                  /* Matrix --clay-primary */
  --home-clay-primary-deep: #4A6FD6;
  --home-clay-primary-soft: #E4ECFF;

  /* Semantic accents (small labels, pills, badges only) */
  --home-clay-tutor: #6347BE;
  --home-clay-tutor-soft: #ECE6FF;
  --home-clay-practice: #2B7350;
  --home-clay-practice-soft: #E1F3E8;
  --home-clay-red: #C94F5B;

  /* Lively washes: pale enough to keep the Matrix clay system intact. */
  --home-clay-sky-wash: #EEF4FF;
  --home-clay-lavender-wash: #F2EEFF;
  --home-clay-rose-wash: #FCEFF2;
  --home-clay-grass-wash: #EDF7E8;
  --home-clay-sun-wash: #FFF5DE;
  --home-clay-warm-wash: #F7EEE6;

  --home-clay-radius-lg: 30px;
  --home-clay-radius-md: 22px;
  --home-clay-radius-sm: 14px;

  /* Matrix --clay-shadow, tinted toward the blue page instead of pure black */
  --home-clay-shadow:
    8px 8px 16px rgba(40,63,100,.11),
    -4px -4px 12px rgba(255,255,255,.92),
    inset 4px 4px 8px rgba(255,255,255,.48),
    inset -4px -4px 8px rgba(72,91,123,.055);
  --home-clay-shadow-soft:
    5px 7px 14px rgba(43,65,101,.09),
    -3px -3px 9px rgba(255,255,255,.9),
    inset 3px 3px 6px rgba(255,255,255,.44),
    inset -3px -3px 6px rgba(72,91,123,.045);
  --home-clay-shadow-hover:
    9px 11px 20px rgba(40,63,100,.13),
    -4px -4px 12px rgba(255,255,255,.94),
    inset 3px 3px 7px rgba(255,255,255,.48),
    inset -3px -3px 7px rgba(72,91,123,.05);
  --home-clay-inset:
    inset 4px 4px 9px rgba(89,109,143,.11),
    inset -4px -4px 9px rgba(255,255,255,.95);
}

body {
  background: #f5f7fb !important;
}

.main-row-container {
  background: #f5f7fb !important;
}

.home-v2,
.home-v2 *,
.left-sidebar,
.right-sidebar,
.question-box {
  font-family: 'Quicksand', 'Segoe UI', sans-serif;
}

.home-v2 {
  display: grid;
  gap: 24px;
  min-width: 0;
  /* The main column's width depends on whether the side columns are shown,
     not just on the viewport, so the homepage responds to its own width. */
  container: home / inline-size;
}

/* Hero: a single large clay slab, calm rather than decorative. */
.home-v2-hero {
  position: relative;
  overflow: hidden;
  min-height: 245px;
  padding: 38px 40px 34px;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: var(--home-clay-radius-lg);
  background: var(--home-clay-section);
  box-shadow: var(--home-clay-shadow);
}

.home-v2-hero::before {
  content: "";
  position: absolute;
  width: 390px;
  height: 180px;
  right: -70px;
  bottom: -72px;
  border-radius: 50%;
  background: rgba(107,148,255,.12);
  box-shadow:
    -125px -20px 0 rgba(107,148,255,.07),
    -245px 14px 0 rgba(255,255,255,.28);
}

.home-v2-kicker {
  position: relative;
  z-index: 2;
  display: inline-flex;
  margin-bottom: 15px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--home-clay-chip);
  color: var(--home-clay-muted);
  box-shadow: var(--home-clay-shadow-soft);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .11em;
}

.home-v2-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--home-clay-red);   /* the one red brand dot */
  box-shadow: 0 2px 5px rgba(168,59,71,.18);
}

.home-v2-hero h1 {
  position: relative;
  z-index: 2;
  max-width: none;
  margin: 0 0 14px;
  white-space: nowrap;
  color: var(--home-clay-ink);
  font: 800 clamp(2.35rem,4.2vw,3.8rem)/1.04 'Quicksand', sans-serif;
  /* Shrinks with the main column so the one-line headline never touches the slab edge. */
  font-size: max(2.35rem, min(clamp(2.35rem,4.2vw,3.8rem), calc((100cqi - 100px) / 11.6)));
  letter-spacing: -.045em;
  text-shadow: 1px 2px 0 rgba(255,255,255,.74);
}

.home-v2-hero-subline {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.home-v2-hero p {
  max-width: none;
  margin: 0;
  color: var(--home-clay-text);
  font-size: .96rem;
  font-weight: 600;
  line-height: 1.55;
}

.home-v2-routebar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
}

.home-v2-routebar a {
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 12px;
  background: var(--home-clay-chip);
  color: var(--home-clay-link);
  box-shadow: var(--home-clay-shadow-soft);
  font-size: .76rem;
  font-weight: 800;
  transition: transform .16s ease, box-shadow .16s ease;
}

.home-v2-routebar a:hover {
  transform: translateY(-1px);
  box-shadow: var(--home-clay-shadow-hover);
}

.left-sidebar .nav-title::after {
  content: "";
  display: block;
  width: 34px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: var(--home-clay-red);
}

/* Semantic route pills: Tutor = lavender, Practice = grass green. */
.home-v2-routebar a:nth-child(4) {
  background: var(--home-clay-tutor-soft);
  color: var(--home-clay-tutor);
}

.home-v2-routebar a:nth-child(5) {
  background: var(--home-clay-practice-soft);
  color: var(--home-clay-practice);
}

/* Main clay sections */
.home-v2-section {
  container: section / inline-size;
  padding: 28px;
  border: 2px solid rgba(255,255,255,.75);
  border-radius: var(--home-clay-radius-lg);
  background: var(--home-clay-section);
  box-shadow: var(--home-clay-shadow);
}

.home-v2-section-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 20px;
}

.home-v2-section-head > div {
  max-width: 720px;
}

.home-v2-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--home-clay-muted);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.home-v2-section h2 {
  margin: 0;
  color: var(--home-clay-ink);
  font: 800 clamp(1.55rem,3vw,2.05rem)/1.18 'Quicksand', sans-serif;
}

.home-v2-section-head p {
  margin: 6px 0 0;
  color: var(--home-clay-text);
  font-size: .88rem;
  font-weight: 600;
}

/* Every section shares the same pale blue clay slab (set on .home-v2-section).
   Rhythm comes from spacing and headings, not from changing hue. */

/* Choose a Math Path keeps its earlier playful palette. */
#math-games-section {
  position: relative;
  background:
    linear-gradient(145deg, #e4eaf5 0%, #dce5f2 100%);
}

#math-games-section::before {
  content: "";
  position: absolute;
  top: 24px;
  right: 27px;
  width: 14px;
  height: 14px;
  border-radius: 5px;
  background: var(--home-clay-red);
  box-shadow:
    16px 9px 0 #d9b34d,
    4px 20px 0 #78b98d;
  transform: rotate(9deg);
}

/* Side columns join the clay system instead of staying as old white template cards. */
.left-sidebar {
  background:
    linear-gradient(180deg, rgba(224,235,252,.97), rgba(238,244,253,.96)) !important;
  border: 2px solid rgba(255,255,255,.78) !important;
  border-radius: 24px !important;
  box-shadow: var(--home-clay-shadow) !important;
  padding: 1.35rem !important;
}

.right-sidebar {
  background:
    linear-gradient(180deg, rgba(224,235,252,.97), rgba(238,244,253,.96)) !important;
  border: 2px solid rgba(255,255,255,.78) !important;
  border-radius: 24px !important;
  box-shadow: var(--home-clay-shadow) !important;
  padding: 1.35rem !important;
}

.left-sidebar .nav-title {
  margin: 0 0 1rem;
  padding: .72rem .7rem;
  border: 1px solid rgba(255,255,255,.85) !important;
  border-radius: 14px;
  background: rgba(255,255,255,.62);
  color: #263f61 !important;
  box-shadow: var(--home-clay-inset);
  font-weight: 800;
}

.left-sidebar .nav-buttons {
  gap: .72rem !important;
}

.left-sidebar .nav-button {
  position: relative;
  padding: .72rem .8rem !important;
  border: 2px solid rgba(255,255,255,.84) !important;
  border-radius: 14px !important;
  background: rgba(255,255,255,.76) !important;
  color: #365981 !important;
  box-shadow: var(--home-clay-shadow-soft) !important;
  font-weight: 700 !important;
}

.left-sidebar .nav-button:nth-child(1) {
  background: #dbe8ff !important;
}

.left-sidebar .nav-button:nth-child(2) {
  background: #edf2ff !important;
}

.left-sidebar .nav-button:nth-child(3) {
  background: #e3f2ec !important;
}

.left-sidebar .nav-button.external {
  background: #ece4ff !important;
  color: #654d99 !important;
}

.left-sidebar .nav-button:hover {
  color: #263f61 !important;
  transform: translateY(-2px);
  filter: brightness(1.02);
  box-shadow:
    8px 10px 18px rgba(40,63,100,.13),
    -4px -4px 10px rgba(255,255,255,.94),
    inset 3px 3px 6px rgba(255,255,255,.5),
    inset -3px -3px 6px rgba(72,91,123,.05) !important;
}

.right-sidebar .question-box {
  padding: 1.3rem !important;
  border: 2px solid rgba(255,255,255,.82) !important;
  border-radius: 22px !important;
  background: rgba(255,255,255,.7) !important;
  box-shadow: var(--home-clay-inset) !important;
}

.right-sidebar .question-box h2 {
  margin-bottom: 1rem !important;
  color: #2d4566 !important;
  font-size: .95rem !important;
  font-weight: 800 !important;
}

.right-sidebar .question-box .btn {
  margin-bottom: .8rem !important;
  padding: .72rem .65rem !important;
  border: 2px solid rgba(255,255,255,.8) !important;
  border-radius: 14px !important;
  box-shadow: var(--home-clay-shadow-soft) !important;
  font-weight: 700 !important;
}

.right-sidebar .question-box .yes {
  background: #8e7cf0 !important;
  color: #fff !important;
}

.right-sidebar .question-box .no {
  background: #f7dadd !important;
  color: #a83b47 !important;
}

.right-sidebar .question-box a[href*="saashub"] {
  display: block;
  margin-top: 1rem;
  padding: .72rem .45rem;
  border: 2px solid rgba(255,255,255,.82);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--home-clay-shadow-soft);
}

.right-sidebar .question-box a[href*="saashub"] img {
  display: block;
  max-width: 135px !important;
  margin: 0 auto;
}

/* Learning tool families */
.home-v2-learning-tools {
  position: relative;
}

.home-v2-tool-families {
  display: grid;
  grid-template-columns: minmax(0,1.55fr) minmax(300px,.95fr);
  gap: 18px;
  align-items: stretch;
}

.home-v2-tool-family {
  container: family / inline-size;
  position: relative;
  min-width: 0;
  padding: 24px 22px 22px;
  border: 2px solid rgba(255,255,255,.8);
  border-radius: 26px;
  background: var(--home-clay-well);
  box-shadow: var(--home-clay-inset);
}

.home-v2-tool-family.number-operations {
  background: linear-gradient(160deg, rgba(255,255,255,.48), rgba(238,244,255,.62));
}

.home-v2-tool-family.fraction-tools {
  background: linear-gradient(160deg, rgba(255,255,255,.48), rgba(248,239,244,.58));
}

.home-v2-family-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 17px;
  align-items: center;
  min-height: 78px;
  margin-bottom: 18px;
}

.home-v2-family-symbols {
  display: grid;
  grid-template-columns: repeat(4,42px);
  gap: 8px;
}

.home-v2-family-symbols span,
.home-v2-fraction-symbols span {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--home-clay-edge);
  background: var(--home-clay-card);
  color: var(--home-clay-primary-deep);
  box-shadow: var(--home-clay-shadow-soft);
  font-weight: 800;
}

.home-v2-family-symbols span {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 1.25rem;
}


.home-v2-fraction-symbols {
  display: flex;
  gap: 7px;
}

.home-v2-fraction-symbols span {
  min-width: 48px;
  height: 42px;
  padding: 0 9px;
  border-radius: 13px;
  font-size: .78rem;
}

.home-v2-family-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--home-clay-muted);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.home-v2-family-head h3 {
  margin: 0;
  color: var(--home-clay-ink);
  font-size: 1.28rem;
  font-weight: 800;
}

.home-v2-family-grid {
  display: grid;
  gap: 13px;
}

.operations-grid {
  grid-template-columns: repeat(2,minmax(0,1fr));
}

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

/* Problem Solving & Practice: a full-width third family under the first two. */
.home-v2-tool-family.practice-tools {
  grid-column: 1 / -1;
  background: linear-gradient(160deg, rgba(255,255,255,.48), rgba(234,246,238,.6));
}

.home-v2-family-symbols.practice-symbols {
  grid-template-columns: repeat(3,42px);
}

.practice-grid {
  grid-template-columns: repeat(2,minmax(0,1fr));
}

.tool-word-problems .home-v2-tool-type,
.tool-number-search .home-v2-tool-type { color: var(--home-clay-practice); }

/* Mini bar model: "?" over a bar of equal parts. */
.home-v2-tool-preview.preview-tape {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 150px;
  padding-top: 6px;
  padding-bottom: 9px;
}

.tape-mini-total {
  color: #c2410c;
  font-size: .82rem;
  line-height: 1;
}

.tape-mini-brace {
  width: 100%;
  height: 6px;
  border: 1.8px solid #6b7c93;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
}

.tape-mini-bar {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  width: 100%;
  overflow: hidden;
  border: 1.6px solid #3f73c9;
  border-radius: 4px;
  background: #e8f0fd;
}

.tape-mini-bar i {
  padding: 4px 0;
  border-right: 1.6px solid #3f73c9;
  color: #22324a;
  font-size: .72rem;
  font-style: normal;
  line-height: 1;
  text-align: center;
}

.tape-mini-bar i:last-child { border-right: 0; }

/* Mini number grid with one fact ringed: 4 × 8 = 32. */
.home-v2-tool-preview.preview-search {
  display: grid;
  grid-template-columns: repeat(3,30px);
  gap: 3px 0;
  justify-content: center;
  min-width: 116px;
  padding: 7px 10px;
}

.preview-search span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  color: #4d6d96;
  font-size: .7rem;
  line-height: 1;
}

.preview-search span.hit {
  background: rgba(244,132,95,.2);
  color: #9a3b1c;
  box-shadow: inset 0 1.6px 0 #F4845F, inset 0 -1.6px 0 #F4845F;
}

.preview-search span.hit:nth-child(4) {
  border-radius: 9px 0 0 9px;
  box-shadow: inset 0 1.6px 0 #F4845F, inset 0 -1.6px 0 #F4845F, inset 1.6px 0 0 #F4845F;
}

.preview-search span.hit:nth-child(6) {
  border-radius: 0 9px 9px 0;
  box-shadow: inset 0 1.6px 0 #F4845F, inset 0 -1.6px 0 #F4845F, inset -1.6px 0 0 #F4845F;
}

.home-v2-tool-card {
  position: relative;
  /* Title and preview share a row while there is room; the preview wraps
     below the title when the card gets narrow, so they never overlap. */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: space-between;
  gap: 10px 14px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  min-height: 132px;
  padding: 16px 18px 14px;
  overflow: hidden;
  border: 2px solid var(--home-clay-edge);
  border-radius: 18px;
  background: var(--home-clay-card);
  box-shadow: var(--home-clay-shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease;
}

.home-v2-tool-card::before {
  display: none;
}

.home-v2-tool-card::after {
  display: none;
}

.home-v2-tool-type {
  display: block;
  flex: 0 0 100%;
  color: var(--home-clay-muted);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

/* Semantic labels: Game = grass green, Tutor = lavender. */
.tool-fraction-match .home-v2-tool-type { color: var(--home-clay-practice); }
.tool-compare-fractions .home-v2-tool-type,
.tool-fraction-addsub .home-v2-tool-type { color: var(--home-clay-tutor); }

.home-v2-tool-card h4 {
  position: relative;
  z-index: 2;
  flex: 1 1 6.5em;   /* the preview wraps below once title + preview no longer fit */
  margin: 0;
  color: var(--home-clay-heading);
  font-size: .98rem;
  font-weight: 800;
  line-height: 1.35;
}

.home-v2-tool-preview {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 92px;
  min-height: 62px;
  padding: 10px 12px;
  border: 2px solid rgba(255,255,255,.84);
  border-radius: 15px;
  background: rgba(255,255,255,.72);
  box-shadow: var(--home-clay-shadow-soft);
  color: #29496f;
  font-size: .78rem;
  font-weight: 800;
}

.preview-addsub,
.preview-multiply {
  display: grid;
  justify-items: end;
  line-height: 1.15;
}

.preview-addsub b,
.preview-multiply b {
  width: 100%;
  margin-top: 3px;
  padding-top: 3px;
  border-top: 2px solid #55739c;
  text-align: right;
}

.preview-area {
  min-width: 138px;
  padding: 9px 10px 8px;
}

.area-mini-top {
  display: grid;
  grid-template-columns: 2.1fr .9fr;
  gap: 2px;
  margin-left: 24px;
  margin-bottom: 2px;
  color: #7a641d;
  font-size: .61rem;
  text-align: center;
}

.area-mini-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: stretch;
}

.area-mini-row > b {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7a641d;
  font-size: .64rem;
}

.area-mini-box {
  display: grid;
  grid-template-columns: 2.1fr .9fr;
  overflow: hidden;
  border: 2px solid #c89b32;
  border-radius: 4px;
  background: #fff7d5;
}

.area-mini-box span {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  color: #45617f;
  font-size: .64rem;
}

.area-mini-box span + span {
  border-left: 2px solid #c89b32;
  background: #fff0b7;
}

.area-mini-eq {
  margin-top: 4px;
  color: #6f7f95;
  font-size: .55rem;
  text-align: center;
}

.preview-longdiv {
  min-width: 112px;
  padding: 8px 12px 10px;
  font-family: 'Courier New', monospace;
}

.longdiv-mini-quotient {
  margin-left: 29px;
  padding-right: 7px;
  color: #2c4e79;
  font-size: .86rem;
  line-height: 1;
  text-align: right;
}

.longdiv-mini-work {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: start;
  margin-top: 2px;
  color: #2c4e79;
}

.longdiv-mini-work span {
  padding: 5px 5px 0 0;
  border-right: 2px solid #4d6d96;
  font-size: .78rem;
  line-height: 1;
  text-align: right;
}

.longdiv-mini-work b {
  padding: 4px 7px 0 8px;
  border-top: 2px solid #4d6d96;
  font-size: .8rem;
  line-height: 1;
}

.preview-fraction-match,
.preview-fraction-add {
  display: flex;
  min-width: 138px;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mini-frac {
  display: grid;
  grid-template-rows: 1fr 1fr;
  min-width: 30px;
  color: #35567f;
  font-size: .68rem;
  line-height: 1;
  text-align: center;
}

.mini-frac > span:first-child {
  padding: 0 4px 3px;
  border-bottom: 1.8px solid #55739c;
}

.mini-frac > span:last-child {
  padding: 3px 4px 0;
}

.mini-frac.result {
  color: #8b3845;
}

.preview-compare {
  display: flex;
  min-width: 158px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-left: 9px;
  padding-right: 9px;
}

.compare-mini-item {
  display: grid;
  gap: 5px;
  justify-items: center;
}

.mini-frac-bar {
  display: grid;
  width: 48px;
  height: 13px;
  overflow: hidden;
  border: 1px solid #b8c4d4;
  border-radius: 5px;
  background: #fff;
}

.mini-frac-bar.thirds {
  grid-template-columns: repeat(3,1fr);
}

.mini-frac-bar.fourths {
  grid-template-columns: repeat(4,1fr);
}

.mini-frac-bar i {
  border-right: 1px solid rgba(92,108,130,.18);
  background: #f6f8fb;
}

.mini-frac-bar i:last-child {
  border-right: 0;
}

.mini-frac-bar i.on {
  background: #e89aa8;
}

.preview-compare > b,
.preview-fraction-match > b,
.preview-fraction-add > b {
  color: #627694;
  font-size: .78rem;
}

.home-v2-tool-open {
  flex: 0 0 100%;
  color: var(--home-clay-link);
  font-size: .7rem;
  font-weight: 800;
}

.home-v2-tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--home-clay-shadow-hover);
}

/* Topic path cards */
.home-v2-topic-grid {
  display: grid;
  grid-template-columns: 1.18fr .82fr;
  grid-template-areas:
    "multiply divide"
    "multiply fractions"
    "area exploration";
  grid-template-rows: minmax(205px, auto) minmax(205px, auto) minmax(178px, auto);
  gap: 15px;
}

.home-v2-topic {
  position: relative;
  display: block;
  min-height: 176px;
  overflow: hidden;
  padding: 22px;
  border: 2px solid rgba(255,255,255,.8);
  border-radius: 22px;
  color: inherit;
  text-decoration: none;
  background: rgba(255,255,255,.72);
  box-shadow: var(--home-clay-shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease;
}

.home-v2-topic:hover {
  transform: translateY(-3px);
  box-shadow: var(--home-clay-shadow-hover);
}

/* All five path cards share the white clay card; topic identity comes from
   the glyph beside each title and from the real tool preview. */
.home-v2-topic.multiply {
  grid-area: multiply;
  min-height: 425px;
  background: #cbdcf4;
}

.home-v2-topic.divide {
  grid-area: divide;
  min-height: 205px;
  background: #d9dcf1;
}
.home-v2-topic.fractions {
  grid-area: fractions;
  min-height: 205px;
  background: #efcbd0;
}

/* Optical sizes keep the same visual weight without letting wide glyphs dominate. */
.home-v2-topic.multiply .home-v2-topic-tag { color: #285b9f; font-size: 2.3rem; }
.home-v2-topic.divide .home-v2-topic-tag { color: #584196; font-size: 2.3rem; }
.home-v2-topic.fractions .home-v2-topic-tag { color: #9b2c40; font-size: 1.8rem; }
.home-v2-topic.area .home-v2-topic-tag { color: #296a45; font-size: 1.45rem; }
.home-v2-topic.exploration .home-v2-topic-tag { color: #355f9b; font-size: 2.1rem; }
.home-v2-topic.area {
  grid-area: area;
  min-height: 178px;
  background: #d8e9e1;
}

.home-v2-topic.exploration {
  grid-area: exploration;
  min-height: 178px;
  background: #d8e3ef;
}

/* Symbol belongs to its heading, rather than floating across the card.
   Content-width flex row means it cannot overlap the miniature tool preview. */
.home-v2-topic-heading {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 15px;
  width: fit-content;
  max-width: 100%;
  height: 32px;
}

.home-v2-topic-tag {
  position: static;
  flex: 0 0 auto;
  display: inline-flex;
  width: auto;
  height: 40px;
  align-items: center;
  justify-content: center;
  margin: -2px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-family: 'Quicksand', 'Segoe UI', sans-serif;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.03em;
  white-space: nowrap;
  pointer-events: none;
  -webkit-text-stroke: .3px currentColor;
  text-shadow:
    -1px -1px 0 rgba(255,255,255,.77),
    1px 1px 0 rgba(255,255,255,.42),
    0 2px 3px rgba(35,51,80,.15);
}

.home-v2-topic h3 {
  position: relative;
  z-index: 2;
  min-width: 0;
  max-width: none;
  margin: 2px 0 0;
  color: var(--home-clay-heading);
  font-size: 1.22rem;
  font-weight: 800;
}

.home-v2-topic.fractions h3 {
  color: #7f3340;
}

.home-v2-topic-line {
  display: block;
  width: 40px;
  height: 4px;
  margin-top: 9px;
  border-radius: 99px;
  background: rgba(67,100,149,.28);
  box-shadow: var(--home-clay-inset);
}

.home-v2-topic-copy {
  position: relative;
  z-index: 2;
  /* --preview-space = preview width + its inset + a 16px gutter */
  max-width: min(45%, calc(100% - var(--preview-space, 0px)));
  margin: 11px 0 0;
  padding-bottom: 36px;
  color: var(--home-clay-text);
  font-size: .73rem;
  font-weight: 650;
  line-height: 1.45;
}

.home-v2-topic.multiply .home-v2-topic-copy {
  max-width: min(35%, calc(100% - min(382px, 58%) - 30px));
  padding-bottom: 0;
  font-size: .8rem;
  line-height: 1.55;
}

.home-v2-topic.fractions .home-v2-topic-copy {
  color: #89515b;
}

.home-v2-topic.area .home-v2-topic-copy {
  color: #58785e;
}

.home-v2-topic.divide .home-v2-topic-copy,
.home-v2-topic.fractions .home-v2-topic-copy {
  max-width: min(43%, calc(100% - var(--preview-space)));
}

.home-v2-topic.area .home-v2-topic-copy {
  max-width: min(56%, calc(100% - var(--preview-space)));
}

.home-v2-topic.exploration .home-v2-topic-copy {
  max-width: min(48%, calc(100% - var(--preview-space)));
}

.home-v2-topic.divide { --preview-space: 192px; }
.home-v2-topic.fractions { --preview-space: 212px; }
.home-v2-topic.area { --preview-space: 187px; }
.home-v2-topic.exploration { --preview-space: var(--matrix-preview-space, 214px); }

.home-v2-topic-arrow {
  position: absolute;
  left: 22px;
  bottom: 17px;
  z-index: 2;
  color: #466895;
  font-size: .78rem;
  font-weight: 800;
}

.home-v2-topic.multiply h3 a,
.home-v2-topic.exploration h3 a {
  color: inherit;
  text-decoration: none;
}

.matrix-size-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  /* Stay in the copy column so the links never run under the matrix preview. */
  max-width: calc(100% - 22px - var(--preview-space, 0px));
}

.matrix-size-links a {
  color: inherit;
  text-decoration: none;
}

.matrix-size-links a:hover,
.matrix-size-links a:focus-visible {
  text-decoration: underline;
}

.home-v2-topic.multiply .home-v2-topic-arrow {
  display: inline-block;
  text-decoration: none;
}

.mini-times-table {
  position: absolute;
  right: 28px;
  bottom: 27px;
  width: min(382px, 58%);
  padding: 13px 14px 15px;
  border: 2px solid rgba(255,255,255,.86);
  border-radius: 22px;
  background: #eef3f9;
  box-shadow:
    8px 10px 18px rgba(56,77,108,.11),
    -4px -4px 12px rgba(255,255,255,.95),
    inset 3px 3px 7px rgba(255,255,255,.52),
    inset -3px -3px 7px rgba(84,101,128,.05);
}

.mini-times-heading {
  display: grid;
  place-items: center;
  min-height: 72px;
  margin-bottom: 12px;
  padding: 11px 10px;
  border: 1px solid rgba(255,255,255,.88);
  border-radius: 14px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--home-clay-inset);
  text-align: center;
}

.mini-times-heading strong {
  color: #263e61;
  font-size: 1rem;
  font-weight: 800;
}

.mini-times-heading small {
  color: #7f8ea5;
  font-size: .58rem;
  font-style: italic;
  font-weight: 600;
}

.mini-times-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 8px;
}

.mini-table-btn {
  display: grid;
  min-width: 0;
  min-height: 46px;
  place-items: center;
  padding: 6px 4px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 13px;
  background: #edf2f8;
  color: #5879d9;
  text-decoration: none;
  box-shadow:
    5px 7px 12px rgba(55,75,105,.09),
    -3px -3px 8px rgba(255,255,255,.94),
    inset 2px 2px 5px rgba(255,255,255,.45),
    inset -2px -2px 5px rgba(75,91,119,.04);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.mini-table-btn span {
  color: #95a5bd;
  font-size: .5rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.mini-table-btn b {
  color: #5d7dff;
  font-size: .88rem;
  line-height: 1.1;
}

.mini-table-btn:hover {
  transform: translateY(-2px);
  background: #f7f9fc;
}

.mini-table-btn.mixed b {
  font-size: .82rem;
}

/* Real long-division miniature, enlarged and aligned to the standard algorithm. */
.mini-division-real {
  position: absolute;
  right: 28px;
  bottom: 18px;
  width: 170px;
  height: 148px;
  padding: 13px 14px;
  border: 2px solid rgba(255,255,255,.84);
  border-radius: 18px;
  background: rgba(255,255,255,.74);
  box-shadow: var(--home-clay-shadow-soft);
  color: #67539d;
  font: 800 .78rem/1 'Courier New', monospace;
}

.mini-div-quotient,
.mini-div-divisor,
.mini-div-dividend,
.mini-div-product,
.mini-div-bring,
.mini-div-final,
.mini-div-rem {
  position: absolute;
}

.mini-div-quotient {
  top: 15px;
  left: 76px;
  width: 72px;
  padding-bottom: 5px;
  border-bottom: 2px solid #7d68b1;
  text-align: center;
}

.mini-div-divisor {
  top: 43px;
  left: 22px;
  width: 30px;
  padding-right: 8px;
  text-align: right;
}

.mini-div-dividend {
  top: 38px;
  left: 61px;
  width: 78px;
  padding: 5px 0 4px 10px;
  border-left: 2px solid #7d68b1;
  text-align: center;
}

.mini-div-product {
  top: 67px;
  left: 76px;
  width: 49px;
  padding-bottom: 4px;
  border-bottom: 1px solid #b7acd6;
  text-align: center;
}

.mini-div-bring {
  top: 91px;
  left: 88px;
  width: 50px;
  text-align: center;
}

.mini-div-final {
  top: 108px;
  left: 88px;
  width: 50px;
  padding-bottom: 4px;
  border-bottom: 1px solid #b7acd6;
  text-align: center;
}

.mini-div-rem {
  top: 128px;
  left: 119px;
  width: 20px;
  color: #379267;
  text-align: center;
}

/* Fraction Match miniature, enlarged. */
.mini-fraction-tool {
  position: absolute;
  right: 26px;
  bottom: 24px;
  display: grid;
  gap: 12px;
  width: 190px;
  padding: 14px 16px;
  border: 2px solid rgba(255,255,255,.84);
  border-radius: 18px;
  background: rgba(255,255,255,.75);
  box-shadow: var(--home-clay-shadow-soft);
}

.mini-fraction-values {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #7c3542;
  font-size: .74rem;
  font-style: normal;
}

.mini-fraction-values i {
  color: #88727a;
  font-style: normal;
}

.mini-fraction-strip {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  height: 27px;
  overflow: hidden;
  border: 1px solid #c7aeb3;
  border-radius: 8px;
  background: #fff;
}

.mini-fraction-strip i {
  border-right: 1px solid rgba(120,86,92,.16);
}

.mini-fraction-strip i:last-child { border-right: 0; }
.mini-fraction-strip i.on { background: #df7b88; }

/* Zoo Fence miniature, enlarged. */
.mini-zoo-grid {
  position: absolute;
  right: 28px;
  bottom: 18px;
  width: 165px;
  height: 116px;
  overflow: hidden;
  border: 2px solid #93b783;
  border-radius: 15px;
  background-color: #e8f4df;
  background-image:
    linear-gradient(rgba(91,135,76,.17) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91,135,76,.17) 1px, transparent 1px);
  background-size: 22px 22px;
  box-shadow: var(--home-clay-shadow-soft);
}

.mini-zoo-fence {
  position: absolute;
  left: 34px;
  top: 22px;
  width: 94px;
  height: 60px;
  border: 3px solid #5f9b60;
  border-radius: 4px;
  background: rgba(185,225,166,.4);
}

.mini-zoo-animal {
  position: absolute;
  left: 69px;
  top: 37px;
  font-size: 1.55rem;
}

.mini-zoo-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5px;
  color: #52764d;
  font-size: .58rem;
  font-weight: 800;
  text-align: center;
}

/* Matrix miniature, enlarged. */
.mini-matrix-real {
  position: absolute;
  right: 27px;
  bottom: 19px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 14px;
  border: 2px solid rgba(255,255,255,.84);
  border-radius: 17px;
  background: rgba(255,255,255,.74);
  box-shadow: var(--home-clay-shadow-soft);
  color: #6b5a92;
}

.mini-matrix-box {
  display: grid;
  grid-template-columns: repeat(2,31px);
  gap: 6px;
}

.mini-matrix-box i {
  display: flex;
  width: 31px;
  height: 31px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: #65a9e1;
  color: white;
  font-size: .68rem;
  font-style: normal;
  font-weight: 800;
  box-shadow: inset 1px 1px 2px rgba(255,255,255,.45);
}

.mini-matrix-box.gold i {
  background: #f0c453;
  color: #5b4c25;
}

/* Grade rail */
.home-v2-grade {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: center;
}

.home-v2-grade-copy h2 { margin-bottom: 6px; }

.grade-rail {
  display: grid;
  grid-template-columns: repeat(6,1fr);
  gap: 11px;
}

.grade-pill {
  display: flex;
  text-decoration: none;
  min-height: 72px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--home-clay-edge);
  border-radius: 18px;
  background: var(--home-clay-card);
  color: var(--home-clay-muted);
  box-shadow: var(--home-clay-shadow-soft);
  font-size: 1.08rem;
  font-weight: 800;
}

.grade-pill.is-coming {
  opacity: .62;
  cursor: default;
}

.grade-pill.active {
  background: var(--home-clay-primary);
  color: #fff;
  box-shadow:
    8px 8px 16px rgba(55,88,145,.18),
    -4px -4px 12px rgba(255,255,255,.9),
    inset 4px 4px 8px rgba(255,255,255,.38),
    inset -4px -4px 8px rgba(29,65,126,.14);
}

/* Learning modes */
.home-v2-mode-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 14px;
}

.home-v2-mode {
  --home-mode-wash: var(--home-clay-sky-wash);
  position: relative;
  display: block;
  min-height: 180px;
  color: inherit;
  text-decoration: none;
  padding: 21px;
  border: 2px solid var(--home-clay-edge);
  border-radius: 20px;
  background:
    linear-gradient(160deg, #FFFFFF 0%, #FAFCFF 70%, var(--home-mode-wash) 100%);
  box-shadow: var(--home-clay-shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease;
}

.home-v2-mode:nth-child(2) { --home-mode-wash: var(--home-clay-lavender-wash); }
.home-v2-mode:nth-child(3) { --home-mode-wash: var(--home-clay-grass-wash); }

.home-v2-mode-index {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  border: 1px solid var(--home-clay-edge);
  border-radius: 12px;
  background: var(--home-clay-primary-soft);
  box-shadow: var(--home-clay-shadow-soft);
  color: var(--home-clay-link);
  font-size: .72rem;
  font-weight: 800;
}

/* Mode badges carry the semantic accents: Learn = Matrix blue,
   Tutors = lavender, Games & Practice = grass green. */
.home-v2-mode:nth-child(2) .home-v2-mode-index {
  background: var(--home-clay-tutor-soft);
  color: var(--home-clay-tutor);
}

.home-v2-mode:nth-child(3) .home-v2-mode-index {
  background: var(--home-clay-practice-soft);
  color: var(--home-clay-practice);
}

.home-v2-mode h3 {
  margin: 0;
  color: var(--home-clay-heading);
  font-size: 1.02rem;
  font-weight: 800;
}

.home-v2-mode p {
  margin: 7px 0 24px;
  color: var(--home-clay-text);
  font-size: .83rem;
  font-weight: 600;
  line-height: 1.5;
}

.home-v2-mode-link {
  position: absolute;
  left: 21px;
  bottom: 18px;
  color: var(--home-clay-link);
  font-size: .72rem;
  font-weight: 800;
}

.home-v2-mode:hover,
.home-v2-bottom-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--home-clay-shadow-hover);
}

/* Bottom featured resources */
.home-v2-bottom-strip {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 14px;
}

.home-v2-bottom-card {
  position: relative;
  display: block;
  min-height: 142px;
  color: inherit;
  text-decoration: none;
  padding: 22px;
  border: 2px solid rgba(255,255,255,.8);
  border-radius: 22px;
  background: var(--home-clay-section);
  box-shadow: var(--home-clay-shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}

.home-v2-bottom-card:first-child {
  background: linear-gradient(160deg, #F8FBFF 0%, #E7F0FF 100%);
}

.home-v2-bottom-card:last-child {
  background: linear-gradient(160deg, #FFFDFC 0%, var(--home-clay-warm-wash) 100%);
}

.home-v2-bottom-card h3 {
  margin: 0 0 5px;
  color: var(--home-clay-heading);
  font-size: 1rem;
  font-weight: 800;
}

.home-v2-bottom-card p {
  max-width: 88%;
  margin: 0 0 24px;
  color: var(--home-clay-text);
  font-size: .82rem;
  font-weight: 600;
}

.home-v2-learning-modes,
.home-v2-bottom-card {
  position: relative;
}

.home-v2-bottom-link {
  position: absolute;
  left: 22px;
  bottom: 17px;
  color: var(--home-clay-link);
  font-size: .72rem;
  font-weight: 800;
}

/* Teacher card: not one big link, but a card holding two real links. */
.home-v2-bottom-card--links:hover {
  transform: none;
  box-shadow: var(--home-clay-shadow);
}

.home-v2-bottom-card--links p {
  margin-bottom: 12px;
}

.home-v2-bottom-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-v2-bottom-links a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 13px;
  border: 1.5px solid var(--home-clay-edge);
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  color: var(--home-clay-link);
  font-size: .74rem;
  font-weight: 800;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.home-v2-bottom-links a:hover {
  background: #fff;
  border-color: var(--home-clay-link);
  transform: translateY(-1px);
}

.home-v2-bottom-links a:focus-visible {
  outline: 3px solid rgba(61,95,166,.45);
  outline-offset: 2px;
}

/* Responsive
   Container queries follow the real width of the main column, which is
   narrower at 1280px (both side columns shown) than on a 768px tablet. */

/* Hero headline stays on one line only while it fits. */
@container home (max-width: 540px) {
  .home-v2-hero h1 {
    white-space: normal;
    text-wrap: balance;
  }

  .home-v2-hero-subline {
    align-items: flex-start;
  }
}

/* Tool families: side by side on wide columns, stacked otherwise. */
@container section (max-width: 860px) {
  .home-v2-tool-families { grid-template-columns: 1fr; }
}

@container family (max-width: 459px) {
  .operations-grid { grid-template-columns: 1fr; }
}

/* When cards are too narrow for title and preview side by side, every card in
   the family switches together: label, title, preview, link in one column. */
@container family (max-width: 700px) {
  .operations-grid .home-v2-tool-card h4 { flex-basis: 100%; }
  .operations-grid .home-v2-tool-preview { margin-left: 0; }
}

/* Fraction titles are short words, so they can sit beside a preview in a
   narrower card than the number-operation titles. */
.fraction-grid .home-v2-tool-card h4 { flex-basis: 5em; }

@container family (max-width: 280px) {
  .fraction-grid .home-v2-tool-card h4 { flex-basis: 100%; }
  .fraction-grid .home-v2-tool-preview { margin-left: 0; }
}

@container family (min-width: 640px) {
  .fraction-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

/* Practice cards: one per row in a narrow family, title above the preview. */
@container family (max-width: 520px) {
  .practice-grid { grid-template-columns: 1fr; }
}

@container family (max-width: 360px) {
  .practice-grid .home-v2-tool-card h4 { flex-basis: 100%; }
  .practice-grid .home-v2-tool-preview { margin-left: 0; }
}

/* Topic paths: the two-column mosaic needs room for copy beside each preview. */
@container section (max-width: 860px) {
  .home-v2-topic-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "multiply"
      "divide"
      "fractions"
      "area"
      "exploration";
    grid-template-rows: auto;
  }

  .home-v2-topic.multiply { min-height: 385px; }
}

@container home (max-width: 600px) {
  /* .home-v2-grade is itself a section container, so it follows the column. */
  .home-v2-grade { grid-template-columns: 1fr; }
}

@container section (max-width: 700px) {
  .home-v2-mode-grid { grid-template-columns: 1fr; }

  .home-v2-mode { min-height: 0; }
}

/* Narrow column (phones, or a squeezed main column): previews sit below the
   copy instead of beside it. */
@container section (max-width: 520px) {
  .home-v2-topic,
  .home-v2-topic.multiply,
  .home-v2-topic.divide,
  .home-v2-topic.fractions,
  .home-v2-topic.area,
  .home-v2-topic.exploration {
    min-height: 0;
    padding-bottom: 50px;
  }

  .home-v2-topic-copy,
  .home-v2-topic.multiply .home-v2-topic-copy,
  .home-v2-topic.divide .home-v2-topic-copy,
  .home-v2-topic.fractions .home-v2-topic-copy,
  .home-v2-topic.area .home-v2-topic-copy,
  .home-v2-topic.exploration .home-v2-topic-copy {
    max-width: none;
    padding-bottom: 0;
  }

  .mini-times-table,
  .mini-division-real,
  .mini-fraction-tool,
  .mini-zoo-grid,
  .mini-matrix-real {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    margin: 16px 0 0 auto;
    transform: none;
  }

  .mini-division-real,
  .mini-zoo-grid { display: block; }

  .mini-matrix-real { width: fit-content; }

  .matrix-size-links { max-width: none; }

  .mini-times-table {
    width: 100%;
    margin-left: 0;
  }

  .grade-rail {
    grid-template-columns: repeat(3,1fr);
  }
}

@container home (max-width: 640px) {
  .home-v2 { gap: 16px; }

  .home-v2-hero,
  .home-v2-section {
    padding: 20px 15px;
    border-radius: 22px;
  }

  .home-v2-hero {
    min-height: 228px;
  }

  .home-v2-section-head {
    display: block;
  }

  .home-v2-bottom-strip {
    grid-template-columns: 1fr;
  }

  .home-v2-topic-heading {
    gap: 10px;
  }

  .home-v2-topic.multiply .home-v2-topic-tag,
  .home-v2-topic.divide .home-v2-topic-tag { font-size: 2rem; }
  .home-v2-topic.fractions .home-v2-topic-tag { font-size: 1.6rem; }
  .home-v2-topic.area .home-v2-topic-tag { font-size: 1.3rem; }
  .home-v2-topic.exploration .home-v2-topic-tag { font-size: 1.85rem; }
}

@container section (max-width: 560px) {
  .home-v2-tool-family {
    padding: 17px;
    border-radius: 20px;
  }

  .home-v2-family-symbols {
    grid-template-columns: repeat(4,36px);
  }

  .home-v2-family-symbols span {
    width: 36px;
    height: 36px;
  }
}
