/* Interactive Tools hub — iframe shell (matches S3 CH05 chemistry-tools-page) */
html.bio-embed:has(body.bio-tools-hub),
html.bio-embed body.bio-tools-hub {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

html.bio-embed body.bio-tools-hub,
html.bio-embed body.bio-flashcards-hub {
  background: var(--bg-color, #fdfbf7);
  font-family: var(--bio-font-sans);
}

.bio-tools-hub-root {
  position: relative;
  overflow: visible;
  min-height: 100%;
  height: auto;
  padding-bottom: clamp(24px, 4vh, 48px);
  box-sizing: border-box;
}

.bio-tools-hub-root::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60vh;
  background: radial-gradient(ellipse at top left, rgba(56, 189, 248, 0.12), transparent 70%),
    radial-gradient(ellipse at top right, rgba(167, 139, 250, 0.12), transparent 70%);
  z-index: 0;
  pointer-events: none;
}

html.dark-theme .bio-tools-hub-root::before {
  background: radial-gradient(ellipse at top left, rgba(56, 189, 248, 0.05), transparent 70%),
    radial-gradient(ellipse at top right, rgba(167, 139, 250, 0.05), transparent 70%);
}

.bio-tools-hub-root .chem-tools-container {
  position: relative;
  z-index: 1;
}

html.bio-embed .bio-tools-hub-root.chemistry-tools-page {
  height: auto;
  min-height: 100%;
}

html.bio-embed .bio-tools-hub-root .chem-tools-container {
  flex: 0 0 auto;
  height: auto;
  justify-content: flex-start;
}

/* Bio hub: third tool card spans full column (override chemistry 50% cap) */
.chem-tools-grid--two-games > .chem-tool-card:last-child:nth-child(3) {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  justify-self: stretch;
}

/* Compact interactive tools — more cards visible at once */
.chem-tools-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(8px, 1.2vw, 12px);
  align-content: start;
}

@media (min-width: 720px) {
  .chem-tools-grid--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .chem-tools-grid--compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

html.bio-embed .chem-tools-grid--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 900px) {
  html.bio-embed .chem-tools-grid--compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.chem-tools-grid--compact > .chem-tool-card:last-child:nth-child(3) {
  grid-column: auto;
  max-width: none;
  justify-self: stretch;
}

.chem-tool-card--compact {
  min-height: 0 !important;
  padding: clamp(8px, 1vh, 10px);
  gap: 10px;
  border-radius: 12px;
  flex-direction: row;
  align-items: stretch;
}

.chem-tool-card--compact .chem-tool-thumb {
  flex: 0 0 38%;
  width: 38%;
  max-width: 168px;
  height: auto;
  min-height: 88px;
  align-self: stretch;
  border-radius: 10px;
}

.chem-tool-card--compact .transport-cover-preview,
.chem-tool-card--compact .osmosis-cover-preview,
.chem-tool-card--compact .endo-cover-preview,
.chem-tool-card--compact .condensation-cover-preview,
.chem-tool-card--compact .enzyme-cover-preview {
  min-height: 0;
  height: 100%;
  padding: 0.3rem;
}

.chem-tool-card--compact .chem-tool-info {
  gap: 4px;
  padding: 0 2px 2px;
}

.chem-tool-card--compact .chem-tool-name {
  font-size: 0.9rem;
  line-height: 1.25;
}

.chem-tool-card--compact .chem-tool-desc {
  font-size: 0.68rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chem-tool-card--compact [class$="-cover-cta"] {
  font-size: 0.68rem;
  margin-top: 2px;
}

.chem-tool-card--compact .chem-tool-badge-num {
  min-width: 1.35rem;
  height: 1.35rem;
  font-size: 0.68rem;
  left: 8px;
  top: 8px;
}

.chem-tool-card--compact .transport-cover-badge,
.chem-tool-card--compact .osmosis-cover-live-badge,
.chem-tool-card--compact .endo-cover-badge,
.chem-tool-card--compact .condensation-cover-badge,
.chem-tool-card--compact .enzyme-cover-badge {
  font-size: 0.58rem;
  padding: 0.2rem 0.55rem;
  top: 6px;
  right: 6px;
}

.chem-tool-card--compact .enzyme-cover-tags {
  display: none;
}

.bio-tools-hub .chem-tools-title {
  font-size: clamp(1.35rem, 3vh, 1.85rem);
  margin-bottom: clamp(6px, 1vh, 10px);
}

.bio-tools-hub-root .chem-tools-container {
  padding-top: clamp(8px, 1.5vh, 16px);
  padding-bottom: clamp(12px, 2vh, 20px);
}
