/* Dental Mobile App Screen 2.1 — UI stabilization
   Build 043: fixed hero and action shell; only the topic list scrolls. */

.screen[data-screen="category"] > .topic-book-screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0 14px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255,255,255,.96) 0%, #f7fbfa 100%);
}

.topic-book-hero {
  flex: 0 0 auto;
  /* Pull the category hero upward into the unused space below the practice header. */
  margin: -14px -14px 0;
  padding: 9px 18px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,.06) 0%, rgba(255,255,255,.92) 100%);
}

.topic-book-image-tile {
  position: relative;
  z-index: 1;
  width: var(--interior-hero-image-size);
  height: var(--interior-hero-image-size);
  flex: 0 0 var(--interior-hero-image-size);
  margin: 0 0 2px;
  padding: 4px;
  border: 1px solid rgba(15,143,136,.12);
  border-radius: var(--interior-hero-radius);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(255,255,255,.98);
  box-shadow: 0 7px 18px rgba(6,50,55,.075);
}

.topic-book-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 8px rgba(6,50,55,.10));
}

.topic-book-hero h1 {
  margin: 0;
  font-size: var(--interior-hero-title-size);
  line-height: 1.08;
  letter-spacing: -.025em;
  color: var(--text);
}

.topic-book-hero p {
  width: min(100%, 340px);
  margin: 4px auto 0;
  font-size: var(--interior-body-size);
  line-height: var(--interior-body-line-height);
  font-weight: 400;
  color: var(--interior-body-color);
  text-align: center;
}

.topic-book-bridge {
  flex: 0 0 auto;
  width: 100%;
  margin: 2px 0 5px;
  display: grid;
  grid-template-columns: minmax(24px,1fr) auto minmax(24px,1fr);
  align-items: center;
  gap: 10px;
  color: var(--teal-dark);
  font-size: var(--type-bridge-label);
  line-height: 1;
  font-weight: 800;
  text-align: center;
}

.topic-book-bridge::before,
.topic-book-bridge::after {
  content: "";
  height: 2px;
  border-radius: 999px;
  background: var(--teal);
  opacity: .9;
}

.topic-book-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: visible;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: auto;
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 8px;
  scrollbar-width: thin;
}

.topic-book-list {
  display: grid;
  gap: 6px;
}

.topic-book-card,
.did-you-know-card {
  width: 100%;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 7px 12px;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 18px;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: #fff;
  color: var(--text);
  box-shadow: 0 5px 14px rgba(6,50,55,.045);
}

.topic-book-icon,
.did-you-know-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff4ed;
  font-size: 20px;
  line-height: 1;
}

.topic-book-copy,
.did-you-know-copy { min-width: 0; }

.topic-book-copy strong {
  display: block;
  margin: 0 0 3px;
  color: var(--text);
  font-size: var(--type-topic-title);
  line-height: var(--type-topic-title-line);
  font-weight: var(--type-topic-title-weight);
}

.topic-book-copy small {
  display: block;
  color: var(--muted);
  font-size: var(--topic-description-size);
  line-height: var(--topic-description-line-height);
  font-weight: 400;
  white-space: normal;
}

.screen2-fixed-actions {
  flex: 0 0 auto;
  background: rgba(255,255,255,.98);
  border-top: 1px solid rgba(215,231,226,.9);
}

.screen2-fixed-actions .did-you-know-card {
  min-height: 62px;
  margin: 0 14px;
  border-radius: 16px 16px 10px 10px;
  grid-template-columns: 42px minmax(0,1fr);
  border-color: rgba(15,143,136,.28);
  background: linear-gradient(135deg,#fbfffe 0%,#e8f7f5 100%);
}

.screen2-fixed-actions .input-wrap {
  border-top: 0;
}

.did-you-know-icon { background: #dff3ef; }

.did-you-know-copy strong {
  display: block;
  margin: 0 0 3px;
  color: var(--teal-dark);
  font-size: var(--type-did-you-know-label);
  line-height: var(--type-did-you-know-label-line);
  letter-spacing: .10em;
  font-weight: 900;
}

.did-you-know-copy small {
  display: block;
  color: #27434d;
  font-size: var(--type-did-you-know-body);
  line-height: var(--type-did-you-know-body-line);
  font-weight: 400;
  white-space: normal;
}

.topic-book-screen .knowledge-answer[hidden] { display: none; }

@media (max-height: 700px) {
  .screen[data-screen="category"] > .topic-book-screen {
    padding-left: 12px;
    padding-right: 12px;
  }

  .topic-book-hero {
    margin-left: -12px;
    margin-right: -12px;
  }

  .topic-book-list { gap: 5px; }

  .topic-book-card,
  .screen2-fixed-actions .did-you-know-card {
    min-height: 58px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .screen2-fixed-actions .did-you-know-card {
    margin-left: 12px;
    margin-right: 12px;
  }
}

@media (min-width: 700px) {
  .screen[data-screen="category"] > .topic-book-screen,
  .screen2-fixed-actions {
    max-width: 430px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
}
