@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap');

:root {
  --axis-x: #d62828;
  --axis-y: #2a9d3f;
  --axis-z: #2f6ed3;
}

/* Global reveal surface + typography */
.reveal {
  font-family: 'Quicksand', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: #f8f9fa;
  color: #333;
}

.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
  color: #1c5b84;
  text-transform: none;
  font-family: 'Quicksand', sans-serif;
}

.reveal .axis-x {
  color: var(--axis-x);
  font-weight: 700;
}

.reveal .axis-y {
  color: var(--axis-y);
  font-weight: 700;
}

.reveal .axis-z {
  color: var(--axis-z);
  font-weight: 700;
}

.reveal a {
  color: #007bff;
  text-decoration: none;
  transition: color .15s ease;
}

.reveal a:hover {
  color: #0056b3;
  text-decoration: underline;
}

.reveal blockquote {
  border-left: 4px solid #007bff;
  background: #f1f3f5;
  padding: 15px;
  font-style: italic;
  color: #495057;
}

.reveal .progress {
  background: rgba(0, 0, 0, .2);
  color: #007bff;
  height: 4px;
}

.reveal .slides section {
  padding-top: 40px !important;
  padding-bottom: 40px !important;
}

.reveal pre code {
  max-height: unset !important;
  overflow-y: auto !important;
}

.reveal ol li {
  list-style-position: outside !important;
  margin-left: 40px !important;
  padding-left: 0 !important;
}

.reveal ul li {
  margin-left: 40px !important;
  padding-left: 0 !important;
}

/* Nice surface for embeds (if you want an outer frame) */
.embed-surface {
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(28, 91, 132, 0.12);
}

/* Consistent treatment for photographic media cards */
.reveal img.photo-card {
  border-radius: 12px;
  border: 2px solid #d9e4ee;
  box-shadow: 0 6px 18px rgba(28, 91, 132, 0.15);
  object-fit: cover;
}

/* Section-divider slides for Part transitions */
.reveal .slides section.section-divider {
  background: linear-gradient(135deg, #0f4c75 0%, #1c5b84 55%, #3282b8 100%);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  overflow: hidden !important;
  max-height: none !important;
}

.reveal .slides section:has(> h1.section-divider) {
  background: linear-gradient(135deg, #0f4c75 0%, #1c5b84 55%, #3282b8 100%);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  overflow: hidden !important;
  max-height: none !important;
}

.reveal .slides section.section-divider h1 {
  color: #ffffff;
  font-size: 2.1em;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.reveal .slides section:has(> h1.section-divider) h1.section-divider {
  color: #ffffff;
  font-size: 2.1em;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* Match earlier weeks' handling of large diagrams */
.reveal .diagram-scroll {
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.reveal .diagram-scroll img {
  max-width: none;
  height: auto;
}

.reveal .diagram-scroll img.diagram-register {
  width: 115%;
}

.reveal .diagram-scroll img.diagram-moder {
  width: 130%;
}

.reveal section iframe.r-stretch {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  display: block;
}

/* Hide any section explicitly marked as hidden */
.reveal .slides section.hidden {
  display: none !important;
}

/* Tighten space below lists on definition slides */
#what-is-a-timer ul:last-child {
  margin-bottom: 0.2rem;
}

/* Optional utility to make any single child fill the slide */
.fill-slide {
  height: 100%;
  width: 100%;
  display: grid;
}

.fill-slide>* {
  align-self: stretch;
  justify-self: stretch;
}

/* Quarto bundles a reset that sets `div.columns { display: initial; gap: initial }`,
 * which collapses the columns container to `display: inline` and produces a large
 * empty gap above the content on reveal.js slides. Force it back to flex, and
 * align children to the top so text columns don't get pushed down next to taller
 * image columns. */
.reveal .slides section .columns {
  display: flex !important;
  gap: 0.4rem !important;
  align-items: flex-start;
}

/* Half-slide animation: large but not full-screen */
/* Keep animation with consistent aspect ratio, not full-height */
iframe.half-anim {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: 60vh;
  display: block;
}

/* Taller embed variant for complex interactive visuals */
iframe.tall-anim {
  width: 100%;
  height: 88vh;
  max-height: 88vh;
  display: block;
}

/* Reduce padding and maximize vertical room on the PWM visualizer slide */
.reveal .slides section#pwm-visualizer {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

/* Rotation Matrix Explorer slide: full-width interactive without slide scroll */
.reveal .slides section#rotation-matrix-explorer-interactive {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  overflow: hidden !important;
}

.reveal .slides section#rotation-matrix-explorer-interactive iframe {
  width: 100% !important;
  height: 68vh !important;
  max-height: 68vh !important;
  display: block;
}

.reveal .slides section#rotation-matrix-explorer-interactive > p {
  margin: 0.25rem 0 0.35rem !important;
  font-size: 0.8em !important;
}

/* RC filter slide: ensure no scroll and tighter padding; slightly shorter iframe */
.reveal .slides section#pwm-rc-filter {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  overflow: hidden !important;
}

.reveal .slides section#pwm-rc-filter iframe {
  height: 88vh;
  max-height: 88vh;
}

/* Input Capture interactive slide: no scroll, larger iframe */
.reveal .slides section#input-capture-interactive {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  overflow: hidden !important;
}

.reveal .slides section#input-capture-interactive>h2 {
  display: none !important;
}

.reveal .slides section#input-capture-interactive iframe {
  height: 88vh;
  max-height: 88vh;
}

/* Aliasing animation slide: hide title and maximize iframe */
.reveal .slides section#aliasing-in-action {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  overflow: hidden !important;
}

.reveal .slides section#aliasing-in-action>h2 {
  display: none !important;
}

.reveal .slides section#aliasing-in-action iframe {
  height: 88vh !important;
  max-height: 88vh !important;
  width: 100% !important;
  display: block;
}

/* ============================================
   TABLES: Clean bordered style
   ============================================ */
.reveal table {
  border-collapse: collapse;
  width: auto;
  margin: 0.5em auto;
  font-size: 0.85em;
}

.reveal table th,
.reveal table td {
  border: 1px solid #c8d6e5;
  padding: 0.35em 0.7em;
  text-align: center;
}

.reveal table th {
  background: #1c5b84;
  color: #ffffff;
  font-weight: 600;
}

/* Inline code inside dark header cells: the default code colour is too dark on #1c5b84 */
.reveal table th code {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  padding: 0 0.2em;
  border-radius: 3px;
}

.reveal table tr:nth-child(even) {
  background: #eef3f8;
}

.reveal table tr:nth-child(odd) {
  background: #ffffff;
}

/* Compact table: shrink first two columns, let last column expand */
.reveal .compact-params table th:nth-child(1),
.reveal .compact-params table td:nth-child(1) {
  white-space: nowrap;
  width: 1%;
}

.reveal .compact-params table th:nth-child(2),
.reveal .compact-params table td:nth-child(2) {
  white-space: nowrap;
  width: 1%;
}

/* Larger code blocks — use absolute size to override .smaller scaling */
.reveal .slides section.larger-code pre code {
  font-size: 22px !important;
  line-height: 1.45 !important;
}

/* Smaller text utility */
.reveal .smaller-text {
  font-size: 0.7em !important;
}

/* Even smaller text utility */
.reveal .tiny-text {
  font-size: 0.5em !important;
}

/* Force vertical scrolling for slides with .scrollable class */
.reveal .slides section.scrollable {
  overflow-y: auto !important;
  display: block !important;
  height: 100% !important;
  max-height: 850px !important;
  /* Slightly less than 900 to avoid bottom clip */
  padding-bottom: 50px !important;
  /* Ensure last line is not right at edge */
  box-sizing: border-box !important;
}

/* ============================================
   DEFAULT: Scroll only when content overflows
   ============================================ */
.reveal .slides section {
  overflow-y: auto !important;
  max-height: 850px !important;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Hide scrollbars while preserving scroll behavior */
.reveal .slides section::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* ============================================
   MERMAID DIAGRAMS: Light background + larger text
   ============================================ */
.reveal .mermaid {
  background: #f8f9fa !important;
  border-radius: 8px;
  padding: 20px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Force light node backgrounds */
.reveal .mermaid .node rect,
.reveal .mermaid .node circle,
.reveal .mermaid .node ellipse,
.reveal .mermaid .node polygon,
.reveal .mermaid .node path {
  fill: #e9ecef !important;
  stroke: #1c5b84 !important;
  stroke-width: 2px !important;
}

/* Subgraph backgrounds */
.reveal .mermaid .cluster rect {
  fill: #ffffff !important;
  stroke: #1c5b84 !important;
}

/* Make text 50% larger */
.reveal .mermaid text {
  font-size: 18px !important;
}

.reveal .mermaid .nodeLabel,
.reveal .mermaid .label,
.reveal .mermaid .edgeLabel,
.reveal .mermaid .cluster-label {
  font-size: 18px !important;
}

.reveal .mermaid .edgeLabel {
  background-color: #f8f9fa !important;
}

/* Flowchart specific */
.reveal .mermaid .flowchart-link {
  stroke: #1c5b84 !important;
}

.reveal .mermaid marker path {
  fill: #1c5b84 !important;
}

/* ============================================
   PART TITLE SLIDES: Vertically centered
   ============================================ */
.reveal .slides section.center-vertical,
.reveal .slides section[data-vertical-center="true"] {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  height: 100% !important;
}

/* Auto-detect "Part X:" slides - these have only an h2 with "Part" in it */
.reveal .slides section > h2:only-child {
  margin-top: auto !important;
  margin-bottom: auto !important;
}

/* ============================================
   FLOW UTILITIES + OPTIONAL TRACK MARKERS
   ============================================ */
.reveal .slides section.flow-bridge {
  background: linear-gradient(135deg, #eef6ff 0%, #dbeeff 100%);
  border-left: 8px solid #1c5b84;
}

.reveal .slides section.checkpoint {
  background: linear-gradient(135deg, #f4f8fb 0%, #eaf2f9 100%);
  border: 2px dashed #5d88a8;
  border-radius: 14px;
}

.reveal .slides section.appendix-gateway {
  background: linear-gradient(135deg, #fff8e8 0%, #fff2cf 100%);
  border-left: 8px solid #b98200;
}

.reveal .slides section.backup:not(.section-divider) {
  background: linear-gradient(180deg, #fff9ef 0%, #fff3dc 100%);
  border-left: 6px solid #d39522;
}

.reveal .slides section.backup:not(.section-divider)::before {
  content: "BACKUP";
  position: absolute;
  top: 10px;
  right: 14px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #d39522;
  color: #fff;
  font-size: 0.48em;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.reveal .slides section.async:not(.section-divider) {
  background: linear-gradient(180deg, #eefaf4 0%, #e2f5ea 100%);
  border-left: 6px solid #1f8b5c;
}

.reveal .slides section.async:not(.section-divider)::before {
  content: "POST-CLASS";
  position: absolute;
  top: 10px;
  right: 14px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #1f8b5c;
  color: #fff;
  font-size: 0.48em;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* ============================================
   EE1021 WEEK 2: CONTROL-FLOW TEACHING SURFACES
   ============================================ */
.reveal pre {
  max-width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
}

.reveal pre code {
  display: block;
  white-space: pre;
  font-size: 0.92em;
}

.reveal .columns .column pre {
  margin-top: 0.25rem;
}

.reveal code {
  color: #111;
}

.sourceCode span.kw {
  color: #0000ff !important;
  font-weight: normal !important;
}

.sourceCode span.co {
  color: #007300 !important;
  font-style: normal !important;
}

.sourceCode span.st {
  color: #b200b2 !important;
}

.sourceCode span.dv {
  color: #ad0000 !important;
}

.reveal li code:not(.sourceCode):not([class*="language-"]) {
  color: #1c5b84;
  font-weight: 700;
}

.reveal .try-it {
  max-width: 1240px;
  margin: 0.65em auto 0;
  padding: 0.44em 0.68em;
  color: #294154;
  background: #fff8e8;
  border: 1px solid #e3c583;
  border-left: 5px solid #c48115;
  border-radius: 8px;
  font-size: 0.62em;
  line-height: 1.35;
  text-align: left;
}

.reveal .try-it p {
  margin: 0;
}

.reveal .choice-card {
  min-height: 8em;
  padding: 0.7em 0.85em !important;
  color: #263c4d;
  background: linear-gradient(180deg, #ffffff 0%, #f1f7fb 100%);
  border: 1px solid #bfd4e1;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(28, 91, 132, 0.09);
  font-size: 0.75em;
  text-align: left;
}

.reveal .choice-card > p:first-child {
  margin-top: 0;
  color: #164c70;
  font-size: 1.1em;
}

.reveal .choice-card li {
  margin-left: 1.15em !important;
}

@media print {
  .reveal .choice-card {
    box-shadow: none;
  }

  .reveal pre code {
    white-space: pre-wrap;
  }
}
