:root {
  --background: #000000;
  --foreground: #f8f8f2;
  --rule: #313131;
  --body-background: #f4f1ea;
  --body-text: #111111;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--body-text);
  background: var(--body-background);
  font-family: "Courier New", Courier, monospace;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 35% 30% 35%;
  align-items: start;
  width: 100%;
  min-height: 6.5vh;
  padding: 1.2vh 2.5vw;
  color: var(--foreground);
  background: var(--background);
  border-bottom: 0.08vw solid var(--rule);
}

.site-header h1,
.header-block p {
  margin: 0;
  line-height: 112%;
}

.site-header h1 {
  align-self: center;
  padding-top: 0.15vh;
  font-size: 1.45vw;
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
}

.header-block {
  font-size: 1vw;
  font-weight: 400;
}

.header-left {
  justify-self: start;
  text-align: left;
}

.header-right {
  justify-self: end;
  text-align: right;
}

.header-right p:first-child {
  font-weight: 700;
}

.page-body {
  width: 100%;
  margin-top: 6.5vh;
}

.section-target {
  scroll-margin-top: 6.5vh;
}

.slide {
  height: 93.5vh; /* 100vh - 6.5vh */
  padding: 4vh 5vw;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  border-bottom: 0.08vw solid var(--rule);
}

.slide-title {
  margin: 0 0 1.5vh 0;
  font-size: 1.15vw;
  font-weight: 700;
  line-height: 120%;
}

.split-layout {
  display: flex;
  flex: 1;
  border: 0.08vw solid var(--rule);
  background: #ebe6dc;
  min-height: 0; /* Important for flex child to be scrollable */
}

.left-text {
  flex-direction: row;
}

.right-text {
  flex-direction: row-reverse;
}

.text-box {
  max-width: 25%;
  flex-shrink: 0;
  padding: 1.2vh 1.2vw;
  overflow: auto;
}

.left-text .text-box {
  border-right: 0.08vw solid var(--rule);
}

.right-text .text-box {
  border-left: 0.08vw solid var(--rule);
}

.slide4-question {
  margin: 2.5vh 0 1.5vh;
  font-size: clamp(0.9rem, 1vw, 1.15rem);
}

.slide4-text-box {
  display: flex;
  flex-direction: column;
}

.slide4-sketch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 1.2vh 0.6vw;
  align-items: center;
  flex: 1;
  min-height: 0;
}

.slide4-sketch-grid img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.slide4-sketch-grid img:nth-child(3),
.slide4-sketch-grid .slide4-workflow-sketch {
  grid-column: 1 / -1;
}

.viewport {
  flex-grow: 1;
  width: 100%; /* forces it to take up the remaining space */
  min-width: 0; /* allows it to shrink below its content size if necessary */
  position: relative;
}

.viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.viewport canvas:active {
  cursor: grabbing;
}

.viewport-expand-button {
  position: absolute;
  right: 1vw;
  bottom: 1vh;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  color: var(--foreground);
  background: var(--background);
  border: 0.08vw solid var(--rule);
  border-radius: 4px;
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.viewport-expand-button:hover,
.viewport-expand-button:focus-visible {
  color: var(--background);
  background: var(--foreground);
  outline: 2px solid var(--background);
  outline-offset: 2px;
}

.slide-2-layout.is-viewport-expanded .text-box {
  display: none;
}

.slide-2-layout.is-viewport-expanded .viewport {
  width: 100%;
}

.pdf-layout {
  display: grid;
  place-items: center;
  padding: 1.2vh 1.2vw;
  overflow: auto;
}

.pdf-frame {
  width: clamp(50vw, 128vh, 90vw);
  max-width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.slide p {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1vw;
  line-height: 165%;
  margin: 0;
}

.examples-table {
  width: 100%;
  margin-top: 1.5vh;
  border-collapse: collapse;
}

.examples-table th,
.examples-table td {
  padding: 0.5vh 0.5vw;
  text-align: left;
  vertical-align: top;
  border: 0.08vw solid var(--rule);
  white-space: nowrap;
  font-size: 0.85vw;
}

.examples-table th {
  font-weight: 700;
  font-family: "Courier New", Courier, monospace;
}

.section-nav {
  position: fixed;
  right: 5vw;
  top: 9vh; /* Positoned below header which is 6.5vh */
  z-index: 6;
  display: flex;
  gap: 0.5vw;
}

.left-nav {
  position: fixed;
  left: 2.5vw;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 0.5vw;
}

.left-nav button,
.section-nav button {
  display: grid;
  place-items: center;
  width: 2.25vw;
  height: 2.25vw;
  font-family: inherit;
  font-size: 1.25vw;
  font-weight: 700;
  color: var(--foreground);
  background: var(--background);
  border: 0.08vw solid var(--rule);
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.left-nav button:hover,
.section-nav button:hover {
  background: var(--rule);
}

.left-nav button.active-tool {
  background: #a62e96;
  color: white;
  border-color: #a62e96;
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  width: 100%;
  height: calc(100% - 3vh); /* Leave room for credits below */
  gap: 0.5vw; /* Reduced from 1.25vw to close gap between pairs */
  padding: 1.25vw;
  padding-bottom: 0;
}

.video-grid video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0.08vw solid var(--rule);
}

/* Slide 7 Specific Styles */
.slide7-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 1.2vw;
  flex: 1;
  min-height: 0;
  padding: 1.2vw;
  background: #ebe6dc;
  border: 0.08vw solid var(--rule);
}

.slide7-item {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.7vh;
  min-height: 0;
  margin: 0;
}

.slide7-item img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.slide7-item figcaption {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.85vw;
  line-height: 135%;
  text-align: center;
}

.slide7-item figcaption span {
  display: block;
}

.slide7-author {
  margin-top: 0.3vh;
  font-style: italic;
}

/* Slide 5 Specific Styles */
.slide5-counter-text {
  position: absolute;
  top: 1vh;
  right: 0;
  width: 4.5vw; /* Match the 4.5vw padding on the right edge */
  text-align: center;
  font-weight: 700;
  font-family: monospace;
  font-size: 0.65vw; /* Made even smaller to fit */
  z-index: 10;
  white-space: nowrap; /* Ensure text doesn't wrap */
}

.slide5-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  width: 2.5vw;
  height: 2.5vw;
  font-weight: bold;
  font-size: 1.2vw;
  background: var(--background);
  color: var(--foreground);
  border: 0.08vw solid var(--rule);
  border-radius: 0;
  z-index: 10;
  display: grid;
  place-items: center;
}

.slide5-nav-btn:hover {
  background: var(--rule);
}

.slide5-prev-btn {
  left: 1vw;
}

.slide5-next-btn {
  right: 1vw;
}

.slide5-layout {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.slide5-page {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 1.2vh 4.5vw; /* Increased side padding to make room for buttons */
  min-height: 0;
}

.slide5-page-split {
  flex-direction: row;
  padding: 0 4.5vw; /* Maintain the outer padding to keep away from arrows */
}

/* Ensure border is on the left side of text box and right side of viewport */
.slide5-page-split .text-box {
  border-left: 0.08vw solid var(--rule);
  border-right: 0.08vw solid var(--rule); /* Box it off from the right arrow padding zone */
  width: 25%; /* Fixed width in percentage */
  min-width: 0;
  max-width: none;
}

.slide5-page-split .viewport {
  border-left: 0.08vw solid var(--rule); /* Box it off from the left arrow padding zone */
}

.slide5-headings {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5vw;
  margin-bottom: 1vh;
  padding: 0 0.2vw;
}

.slide5-headings h3 {
  margin: 0;
  font-size: 1vw;
  text-decoration: underline;
}

.slide5-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5vw;
  flex: 1;
  min-height: 0;
}

.slide5-grid-left {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.5vw;
  height: 100%;
  min-height: 0;
}

.slide5-grid-right {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.5vw;
  height: 100%;
  min-height: 0;
}

.slide5-video,
.slide5-image,
.slide5-empty-cell {
  width: auto;
  max-width: 100%;
  height: 80%; /* Reduce height to allow room for caption without stretching */
  max-height: 100%;
  min-height: 0;
  box-sizing: border-box;
  margin: 0 auto;
  display: block;
}

.slide5-cell-container {
  display: flex;
  flex-direction: column;
  justify-content: center; /* Center the video and caption vertically together */
  height: 100%;
  min-height: 0;
  overflow: hidden;
  align-items: center; /* keep it centered horizontally */
}

.slide5-cell-caption {
  font-size: 0.8vw;
  text-align: center;
  padding: 0.5vh 0;
}

.slide5-cell-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  gap: 0.25vh;
}

.slide5-cell-caption {
  font-size: 0.8vw;
  text-align: center;
  color: var(--body-text);
  font-family: Georgia, "Times New Roman", serif;
  height: 2vh; /* Fixed height for the caption area */
  flex-shrink: 0;
}

.slide5-video,
.slide5-image {
  object-fit: contain;
  background: white;
  border: 0.08vw solid var(--rule);
}

.slide5-empty-cell {
  border: 0.08vw dashed var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rule);
  font-style: italic;
}
  place-items: center;
  width: 2.4vw;
  min-width: 2vw;
  aspect-ratio: 1 / 1;
  padding: 0;
  color: var(--foreground);
  background: var(--background);
  border: 0.08vw solid var(--rule);
  cursor: pointer;
  font-family: "Courier New", Courier, monospace;
  font-size: 1.3vw;
}