/* Interactive teaching tools for frequency, amplitude, and the adult PDR. */

.waveform-course-intro {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(340px, 1.28fr);
  gap: 1.25rem 2rem;
  align-items: center;
  margin: 0 0 1.4rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid #c8d9e8;
  border-radius: 16px;
  background: linear-gradient(135deg, #f4f9fe 0%, #fff 70%);
}

.waveform-course-intro h3,
.wave-lab h3,
.wave-lab h4 {
  margin: 0;
  color: #17344f;
  line-height: 1.22;
}

.waveform-course-intro > p {
  margin: 0 !important;
  max-width: none !important;
  color: #3e5366;
  line-height: 1.7;
}

.waveform-intro-kicker,
.wave-lab-eyebrow {
  margin: 0 0 0.32rem !important;
  color: #0b6ab8 !important;
  font-size: 0.74rem !important;
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1.25 !important;
  text-transform: uppercase;
}

.wave-lab {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  margin: 1.35rem 0;
  overflow: hidden;
  border: 1px solid #bfd2e2;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(29, 67, 100, 0.08);
}

.wave-lab-heading {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.15fr);
  gap: 1.25rem;
  align-items: end;
  padding: 1.25rem 1.4rem;
  border-bottom: 1px solid #d9e5ef;
  background: linear-gradient(135deg, #eef6fd, #f9fcff);
}

.wave-lab-heading > p {
  max-width: none !important;
  margin: 0 !important;
  color: #4f6476;
  font-size: 0.9rem !important;
  line-height: 1.55 !important;
}

/* Amplitude and sensitivity */

.amplitude-controls {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1fr);
  gap: 1rem 1.4rem;
  align-items: end;
  padding: 1.15rem 1.4rem 0.7rem;
}

.amplitude-range {
  display: grid;
  min-width: 0;
  grid-template-columns: 1fr auto;
  gap: 0.55rem 1rem;
  color: #344b5f;
  font-size: 0.86rem;
  font-weight: 700;
}

.amplitude-range strong { color: #075d9f; }
.amplitude-range input { grid-column: 1 / -1; width: 100%; accent-color: #0b6ab8; }

.sensitivity-control {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.sensitivity-control legend {
  margin-bottom: 0.5rem;
  color: #344b5f;
  font-size: 0.86rem;
  font-weight: 700;
}

.sensitivity-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(46px, 1fr));
  gap: 0.38rem;
}

.sensitivity-buttons button,
.pdr-stage-buttons button,
.pdr-count-choices button {
  min-height: 42px;
  border: 1px solid #b8cad9;
  border-radius: 10px;
  background: #fff;
  color: #29465f;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

.sensitivity-buttons button:hover,
.pdr-stage-buttons button:hover,
.pdr-count-choices button:hover { border-color: #0b6ab8; background: #f1f7fd; }

.sensitivity-buttons button:focus-visible,
.pdr-stage-buttons button:focus-visible,
.pdr-count-choices button:focus-visible,
.pdr-canvas-wrap:focus-visible {
  outline: 3px solid rgba(11, 106, 184, 0.28);
  outline-offset: 2px;
}

.sensitivity-buttons button.is-active,
.pdr-stage-buttons button.is-active {
  border-color: #0b6ab8;
  background: #0b6ab8;
  color: #fff;
}

.amplitude-canvas-wrap {
  min-width: 0;
  max-width: 100%;
  margin: 0.4rem 1.4rem 0;
  overflow: hidden;
  border: 1px solid #cfdae4;
  border-radius: 12px;
  background: #fdfefe;
}

#amplitude-canvas { display: block; width: 100%; height: 280px; }

.amplitude-equation {
  margin: 0.8rem 1.4rem 0;
  padding: 0.72rem 0.9rem;
  border-left: 4px solid #0b6ab8;
  border-radius: 4px 10px 10px 4px;
  background: #eef6fd;
  color: #28465f;
  font-size: 0.9rem;
  font-weight: 650;
}

.amplitude-takeaways {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0.85rem 1.4rem 0;
}

.amplitude-takeaways p {
  max-width: none !important;
  margin: 0 !important;
  padding: 0.8rem 0.9rem;
  border: 1px solid #d9e5ef;
  border-radius: 10px;
  color: #43586a;
  font-size: 0.84rem !important;
  line-height: 1.5 !important;
}

.board-review-link {
  max-width: none !important;
  margin: 1rem 1.4rem 1.25rem !important;
  padding-top: 0.85rem;
  border-top: 1px solid #e1e9ef;
  color: #52687a !important;
  font-size: 0.84rem !important;
  line-height: 1.5 !important;
}

.board-review-link i { margin-right: 0.35rem; color: #0b6ab8; }
.board-review-link a { color: #075d9f; font-weight: 750; }

/* Full-page PDR lesson */

.pdr-lab { margin-top: 1.15rem; }

.pdr-stage-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.5rem;
  padding: 1rem 1.4rem;
}

.pdr-stage-buttons button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.84rem;
}

.pdr-stage-buttons button span {
  display: inline-grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border-radius: 50%;
  background: #dfeaf3;
  color: #2a4c67;
  font-size: 0.72rem;
}

.pdr-stage-buttons button.is-active span { background: rgba(255, 255, 255, 0.22); color: #fff; }

.pdr-canvas-wrap {
  margin: 0 1.4rem;
  overflow-x: auto;
  border: 1px solid #c6d2dc;
  border-radius: 10px;
  background: #fbfcfe;
  box-shadow: inset 0 0 0 1px #fff;
}

#pdr-canvas { display: block; width: 980px; height: 560px; }

.pdr-stage-readout {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(300px, 1.35fr);
  gap: 0.8rem 1.2rem;
  margin: 0.8rem 1.4rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid #d7e4ed;
  border-radius: 10px;
  background: #f5f9fc;
  color: #42586b;
  font-size: 0.86rem;
  line-height: 1.5;
}

.pdr-stage-readout strong { color: #173d5d; }

.pdr-count-challenge {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(210px, 0.85fr);
  gap: 0.7rem 1.25rem;
  align-items: center;
  margin: 1rem 1.4rem 0;
  padding: 1rem;
  border: 1px solid #c7d9e6;
  border-radius: 12px;
  background: #f8fbfe;
}

.pdr-count-challenge p,
.pdr-count-challenge h4 { max-width: none !important; }
.pdr-count-challenge h4 { margin-bottom: 0.35rem; }
.pdr-count-challenge > div:first-child > p:last-child { margin: 0 !important; color: #5a6c7b; font-size: 0.84rem !important; }

.pdr-count-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.pdr-count-choices button { padding: 0.55rem 0.4rem; font-size: 0.82rem; }
.pdr-count-choices button.is-correct { border-color: #238552; background: #e9f7ef; color: #17613b; }
.pdr-count-choices button.is-wrong { border-color: #c84848; background: #fff1f1; color: #9c2e2e; }

.pdr-count-feedback {
  grid-column: 1 / -1;
  min-height: 1.35rem;
  margin: 0 !important;
  color: #52687a !important;
  font-size: 0.84rem !important;
  font-weight: 650;
}

.pdr-count-feedback.is-correct { color: #17613b !important; }
.pdr-count-feedback.is-wrong { color: #9c2e2e !important; }

.pdr-reference {
  margin: 1rem 0 0;
  border: 1px solid #d4e0e9;
  border-radius: 12px;
  background: #fff;
}

.pdr-reference summary {
  padding: 0.9rem 1rem;
  color: #29465f;
  font-weight: 750;
  cursor: pointer;
}

.pdr-reference[open] summary { border-bottom: 1px solid #e0e8ee; }

.pdr-reference-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 1rem;
}

.pdr-reference-grid p {
  max-width: none !important;
  margin: 0 !important;
  padding: 0.75rem;
  border-radius: 9px;
  background: #f5f8fb;
  color: #4b6071;
  font-size: 0.82rem !important;
  line-height: 1.55 !important;
}

.pdr-reference .code-table-wrap { margin: 0 1rem 1rem; }

body.dark .waveform-course-intro,
body.dark .wave-lab,
body.dark .pdr-reference { border-color: #3e5262; background: #232c36; }

body.dark .waveform-course-intro { background: linear-gradient(135deg, #1d3142, #232c36); }
body.dark .waveform-course-intro h3,
body.dark .wave-lab h3,
body.dark .wave-lab h4 { color: #e9f4fc; }
body.dark .waveform-course-intro > p,
body.dark .wave-lab-heading > p { color: #c0ced9; }
body.dark .wave-lab-heading { border-bottom-color: #3a4a57; background: linear-gradient(135deg, #1c3448, #28343e); }
body.dark .amplitude-range,
body.dark .sensitivity-control legend { color: #d6e1e9; }
body.dark .amplitude-range strong,
body.dark .waveform-intro-kicker,
body.dark .wave-lab-eyebrow { color: #76c0f5 !important; }
body.dark .sensitivity-buttons button,
body.dark .pdr-stage-buttons button,
body.dark .pdr-count-choices button { border-color: #526574; background: #2c3944; color: #e1ecf4; }
body.dark .sensitivity-buttons button:hover,
body.dark .pdr-stage-buttons button:hover,
body.dark .pdr-count-choices button:hover { border-color: #72b7eb; background: #344957; }
body.dark .sensitivity-buttons button.is-active,
body.dark .pdr-stage-buttons button.is-active { border-color: #66b5f2; background: #176ea9; color: #fff; }
body.dark .amplitude-canvas-wrap,
body.dark .pdr-canvas-wrap { border-color: #445766; background: #18232c; box-shadow: none; }
body.dark .amplitude-equation { border-left-color: #66b5f2; background: #1d3b50; color: #d7e9f5; }
body.dark .amplitude-takeaways p,
body.dark .pdr-stage-readout,
body.dark .pdr-count-challenge,
body.dark .pdr-reference-grid p { border-color: #41525f; background: #293641; color: #cbd7df; }
body.dark .pdr-stage-readout strong { color: #dceefb; }
body.dark .board-review-link { border-top-color: #3c4b56; color: #b8c7d2 !important; }
body.dark .board-review-link a { color: #72bdf3; }
body.dark .pdr-reference summary { color: #deebf4; }
body.dark .pdr-reference[open] summary { border-bottom-color: #3d4c57; }

@media (max-width: 820px) {
  .waveform-course-intro,
  .wave-lab-heading,
  .amplitude-controls,
  .pdr-stage-readout,
  .pdr-count-challenge { grid-template-columns: 1fr; }

  .pdr-stage-buttons { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .pdr-reference-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .wave-lab { border-radius: 13px; }
  .wave-lab-heading,
  .amplitude-controls,
  .pdr-stage-buttons { padding-right: 0.85rem; padding-left: 0.85rem; }
  .amplitude-canvas-wrap,
  .pdr-canvas-wrap,
  .pdr-stage-readout,
  .pdr-count-challenge,
  .board-review-link { margin-right: 0.85rem !important; margin-left: 0.85rem !important; }
  .amplitude-takeaways { grid-template-columns: 1fr; padding-right: 0.85rem; padding-left: 0.85rem; }
  .sensitivity-buttons { grid-template-columns: repeat(5, minmax(38px, 1fr)); }
  .pdr-count-choices { grid-template-columns: 1fr; }
  #amplitude-canvas { height: 250px; }
}

@media (prefers-reduced-motion: reduce) {
  .sensitivity-buttons button,
  .pdr-stage-buttons button,
  .pdr-count-choices button { transition: none; }
}

/* One pair from the stacked organization SVG (viewBox 940x790). Click opens the full figure. */
.org-crop {
  overflow: hidden;
  width: min(100%, 58rem);
  aspect-ratio: 940 / 230;
  margin: 0 auto 0.85rem;
  border: 1px solid #e3e9f0;
  border-radius: 12px;
  background: #fbfcfe;
  cursor: zoom-in;
}
.org-crop img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
}
.org-crop-continuity img { margin-top: calc(-70 / 940 * 100%); }
.org-crop-symmetry img { margin-top: calc(-310 / 940 * 100%); }
.org-crop-ap img { margin-top: calc(-540 / 940 * 100%); }
