/* Codanics book styling */
:root {
  --codanics-teal: #008b8b;
  --codanics-navy: #05043b;
  --codanics-light: #f7fbfb;
}

.title, h1, h2 {
  letter-spacing: -0.01em;
}

.hero {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.5rem;
  align-items: center;
  padding: 1.2rem;
  border: 1px solid rgba(0, 139, 139, 0.25);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(0, 139, 139, 0.08), rgba(5, 4, 59, 0.05));
  margin: 1rem 0 2rem 0;
}

.hero img {
  max-width: 150px;
  border-radius: 18px;
}

.author-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.2rem;
  align-items: center;
  border-left: 5px solid var(--codanics-teal);
  padding: 1rem;
  background: rgba(0, 139, 139, 0.06);
  border-radius: 14px;
}

.author-card img {
  width: 150px;
  border-radius: 16px;
}

.codanics-logo {
  max-width: 180px;
  margin-bottom: 1rem;
}

.callout-note, .callout-tip, .callout-warning, .callout-important {
  border-radius: 12px;
}

.download-box {
  border: 1px solid rgba(0, 139, 139, 0.4);
  padding: 1rem;
  border-radius: 14px;
  margin: 1rem 0;
  background: rgba(0, 139, 139, 0.07);
}

.download-box a {
  font-weight: 700;
}

.time-storage {
  border-left: 5px solid var(--codanics-navy);
  padding: 0.8rem 1rem;
  background: rgba(5, 4, 59, 0.06);
  border-radius: 12px;
}

.image-prompt {
  font-family: monospace;
  font-size: 0.95rem;
  background: rgba(0,0,0,0.05);
  padding: 1rem;
  border-radius: 12px;
}

/* Download buttons for reusable scripts and data */
.dl-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem 0;
}

.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 10px;
  background: var(--codanics-teal);
  color: #ffffff !important;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none !important;
  border: 1px solid rgba(0, 139, 139, 0.5);
}

.dl-btn:hover { filter: brightness(1.08); }

.dl-btn.secondary {
  background: rgba(0, 139, 139, 0.10);
  color: var(--codanics-navy) !important;
}

[data-bs-theme="dark"] .dl-btn.secondary {
  color: #ffffff !important;
  background: rgba(0, 139, 139, 0.28);
}

/* Chapter overview / "at a glance" cards */
.chapter-goals {
  border: 1px solid rgba(0, 139, 139, 0.25);
  border-left: 5px solid var(--codanics-teal);
  border-radius: 12px;
  padding: 0.5rem 1.1rem;
  background: rgba(0, 139, 139, 0.05);
  margin: 1rem 0 1.5rem 0;
}

/* Figure placeholder credit line under generated slots */
.figure-slot-note {
  font-size: 0.85rem;
  color: #667;
  margin-top: -0.4rem;
}

/* End-of-chapter key takeaways box (bookends the opening .chapter-goals) */
.key-takeaways {
  border: 1px solid rgba(0, 139, 139, 0.28);
  border-left: 5px solid var(--codanics-navy);
  border-radius: 12px;
  padding: 0.6rem 1.2rem;
  background: linear-gradient(135deg, rgba(0, 139, 139, 0.06), rgba(5, 4, 59, 0.04));
  margin: 1.5rem 0;
}

.key-takeaways ul {
  margin-bottom: 0.3rem;
}

.key-takeaways li {
  margin: 0.3rem 0;
}

.dark-toggle-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 0.9rem;
  background: var(--codanics-teal);
  color: white;
  box-shadow: 0 8px 24px rgba(0,0,0,0.20);
  cursor: pointer;
  font-weight: 700;
}

@media (max-width: 700px) {
  .hero, .author-card {
    grid-template-columns: 1fr;
  }
}


/* Interactive quiz styling */
.interactive-quiz-note {
  margin: 0.75rem 0 1.25rem 0;
  padding: 0.8rem 1rem;
  border-left: 5px solid var(--codanics-teal);
  background: rgba(0, 139, 139, 0.07);
  border-radius: 10px;
}
.quiz-set { margin: 1rem 0 2rem 0; }
.quiz-question {
  border: 1px solid rgba(0, 139, 139, 0.25);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: rgba(0, 139, 139, 0.03);
}
.quiz-question p.quiz-prompt { font-weight: 700; margin-bottom: 0.75rem; }
.quiz-option { display: block; margin: 0.35rem 0; }
.quiz-controls { margin-top: 0.75rem; }
.quiz-check, .quiz-reset {
  border: none; border-radius: 8px; padding: 0.45rem 0.8rem; cursor: pointer; font-weight: 700;
}
.quiz-check { background: var(--codanics-teal); color: white; margin-right: 0.5rem; }
.quiz-reset { background: rgba(5, 4, 59, 0.12); color: inherit; }
.quiz-feedback { margin-top: 0.75rem; }
.quiz-msg { padding: 0.75rem 0.9rem; border-radius: 10px; }
.quiz-correct { background: rgba(25, 135, 84, 0.12); border-left: 5px solid #198754; }
.quiz-incorrect { background: rgba(220, 53, 69, 0.12); border-left: 5px solid #dc3545; }
.quiz-warn { background: rgba(255, 193, 7, 0.18); border-left: 5px solid #ffc107; }
.quiz-explanation { display: none; }
.figure-note { font-size: 0.95rem; color: #444; }


/* Codanics top bar and page footer */
.codanics-topbar {
  position: fixed;
  top: 10px;
  right: 18px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 139, 139, 0.28);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(10px);
}

[data-bs-theme="dark"] .codanics-topbar {
  background: rgba(20, 24, 28, 0.92);
  border-color: rgba(0, 139, 139, 0.55);
}

.codanics-topbar-link,
.codanics-topbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.codanics-topbar-link {
  color: var(--codanics-navy);
  background: rgba(0, 139, 139, 0.08);
}

[data-bs-theme="dark"] .codanics-topbar-link {
  color: #ffffff;
  background: rgba(0, 139, 139, 0.28);
}

.codanics-topbar-link.download {
  color: #ffffff;
  background: var(--codanics-teal);
}

.codanics-topbar-button {
  border: none;
  color: #ffffff;
  background: var(--codanics-navy);
  cursor: pointer;
}

[data-bs-theme="dark"] .codanics-topbar-button {
  background: var(--codanics-teal);
}

.codanics-topbar-link:hover,
.codanics-topbar-button:hover {
  filter: brightness(1.08);
  text-decoration: none;
}

.dark-toggle-btn {
  display: none !important;
}

.codanics-footer {
  margin-top: 3rem;
  padding: 1.2rem 0 0.4rem 0;
  border-top: 1px solid rgba(0, 139, 139, 0.28);
}

.codanics-footer-inner {
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  gap: 1rem;
  align-items: start;
  padding: 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 139, 139, 0.08), rgba(5, 4, 59, 0.04));
}

.codanics-footer-brand {
  font-size: 0.92rem;
  line-height: 1.5;
}

.codanics-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.codanics-footer-links a {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(0, 139, 139, 0.10);
  color: var(--codanics-navy);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.86rem;
}

[data-bs-theme="dark"] .codanics-footer-links a {
  color: #ffffff;
  background: rgba(0, 139, 139, 0.28);
}

@media (max-width: 900px) {
  .codanics-topbar {
    position: static;
    margin: 0.75rem;
    flex-wrap: wrap;
    border-radius: 14px;
  }

  .codanics-footer-inner {
    grid-template-columns: 1fr;
  }

  .codanics-footer-links {
    justify-content: flex-start;
  }
}

@media print {
  .codanics-topbar {
    display: none !important;
  }

  .codanics-footer {
    border-top: 1px solid #777;
  }
}
