/* Stable layouts for the CIRCT lowering and datapath diagrams. */

.reveal .session-time {
  margin-top: 0.9em;
  color: #425466;
  font-size: 0.52em;
  font-weight: 650;
}

/* Register variants share fixed stacks so only their behavior changes. */
.reveal #dd-registers .dd-ff-heading-stack {
  display: grid !important;
  grid-template: 1fr / 1fr;
  align-items: center;
  min-height: 3.4em;
  margin: 0 0 0.3em;
}

.reveal #dd-registers .dd-ff-heading-stack > * {
  grid-area: 1 / 1;
  width: 100%;
  margin: 0;
}

.reveal #dd-registers .dd-ff-stage-heading {
  color: #263746;
  font-size: 0.82em;
  text-align: center;
}

.reveal #dd-registers .dd-ff-layout {
  display: flex !important;
  align-items: center;
  min-height: 6.2em;
}

.reveal #dd-registers .dd-ff-code-stack,
.reveal #dd-registers .dd-ff-waveform-stack,
.reveal #dd-registers .dd-ff-copy-stack {
  display: grid !important;
  grid-template: 1fr / 1fr;
  place-items: center;
  width: 100%;
  margin-right: 0;
  margin-left: 0;
}

.reveal #dd-registers .dd-ff-code-stack {
  height: 6.2em;
}

.reveal #dd-registers .dd-ff-waveform-stack {
  height: 6.2em;
}

.reveal #dd-registers .dd-ff-code-stack > div,
.reveal #dd-registers .dd-ff-waveform-stack > div,
.reveal #dd-registers .dd-ff-copy-stack > div {
  grid-area: 1 / 1;
  width: 100%;
}

.reveal #dd-registers .dd-ff-code-stack div.sourceCode {
  margin: 0;
}

.reveal #dd-registers .dd-ff-code-stack pre code {
  font-size: 0.88em;
  line-height: 1.28;
}

.reveal #dd-registers .dd-ff-waveform-stack p {
  margin: 0;
}

.reveal #dd-registers .dd-ff-waveform-stack img {
  display: block;
  width: 100%;
  height: 6.2em;
  margin: 0;
  object-fit: contain;
}

.reveal #dd-registers .dd-ff-copy-stack {
  min-height: 2.3em;
  margin-top: 0.25em;
}

.reveal #dd-registers .dd-ff-stage-copy {
  color: #354653;
  font-size: 0.66em;
  text-align: center;
}

.reveal #dd-registers .dd-ff-stage-copy p {
  margin: 0;
}

.reveal .dd-compiler-takeaway {
  font-size: 1em;
  text-align: left;
}

.reveal .dd-compiler-takeaway > .callout {
  font-size: 1em;
}

.reveal #dd-fpga-fabric figure {
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

.reveal #dd-fpga-fabric img {
  box-sizing: border-box;
  display: block;
  margin-right: auto;
  margin-left: auto;
  padding: 0.16em;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 0.18em 0.36em rgb(15 23 42 / 22%);
  filter: none;
}

/* ASIC inverter reveal. */
.reveal .asic-reveal-stage {
  box-sizing: border-box;
  width: 100%;
}

.reveal .asic-render-frame,
.reveal .asic-answer-media {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
}

.reveal .asic-render-frame img {
  display: block;
  width: 100%;
  max-height: 100%;
  margin: 0;
  border-radius: 6px;
  object-fit: contain;
}

.reveal .asic-mystery-stage {
  display: flex;
  height: 12.4em;
  align-items: center;
  justify-content: center;
}

.reveal .asic-mystery-stage .asic-render-frame {
  width: 66%;
  height: 12.2em;
}

.reveal .asic-pair-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 1.25em;
  height: 13.1em;
  align-items: center;
}

.reveal .asic-pair-stage .asic-render-frame {
  width: 100%;
  height: 11.7em;
}

.reveal .asic-cmos-column {
  display: grid;
  grid-template-rows: max-content minmax(0, 1fr);
  height: 13.1em;
  align-items: center;
}

.reveal .asic-kind-of {
  color: #354653;
  font-size: 0.72em;
  font-weight: 650;
  text-align: center;
}

.reveal .asic-cmos-stack {
  display: grid !important;
  grid-template: 1fr / 1fr;
  place-items: center;
  width: 100%;
  height: 11.2em;
  margin: 0;
}

.reveal .asic-cmos-stack > p {
  grid-area: 1 / 1;
  display: grid;
  grid-template: 1fr / 1fr;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

.reveal .asic-cmos-stack img {
  grid-area: 1 / 1;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0;
  min-height: 0;
  margin: 0;
  object-fit: contain;
  object-position: center;
}

.reveal .asic-answer-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 0.78fr);
  gap: 0.8em;
  align-items: start;
}

.reveal .asic-answer-item {
  display: grid;
  grid-template-rows: 9.7em 2.05em;
  min-width: 0;
  align-items: center;
}

.reveal .asic-answer-media {
  width: 100%;
  height: 9.7em;
}

.reveal .asic-answer-media > p {
  display: flex;
  width: 100%;
  height: 100%;
  margin: 0;
  align-items: center;
  justify-content: center;
}

.reveal .asic-answer-media img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0;
  object-fit: contain;
}

.reveal .asic-answer-caption {
  align-self: start;
  min-width: 0;
  margin-top: 0.28em;
  color: #111111;
  font-size: 0.68em;
  font-weight: 650;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.reveal .asic-answer-caption code,
.reveal .asic-answer-caption strong {
  color: inherit;
}

.reveal .asic-answer-caption a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.12em;
}

.reveal #circt-route .circt-dialects-figure {
  width: min(100%, 13.1em);
  margin: 0 0 0 auto;
}

.reveal .circt-dialects-figure figure,
.reveal .circt-dialects-figure figure > p {
  margin: 0;
}

.reveal #circt-route .circt-dialects-figure img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}

.reveal .circt-dialects-figure figcaption {
  margin-top: 0.35em;
  color: #52616e;
  font-size: 0.42em;
  line-height: 1.2;
  text-align: center;
}

.reveal .narrative-question {
  margin: 0.7em auto 0;
  max-width: 25ch;
  color: #16212b;
  font-size: 1.12em;
  font-weight: 650;
  text-align: center;
}

.reveal .lowering-flow,
.reveal .hls-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25em;
  align-items: stretch;
  width: 100%;
}

.reveal .flow-level {
  position: relative;
  display: flex;
  min-height: 5.2em;
  padding: 0.65em;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  border: 2px solid #b8c3cc;
  background: #ffffff;
  color: #17212b;
  text-align: center;
}

.reveal .flow-level:not(:last-child)::after {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: -0.95em;
  width: 0.65em;
  height: 0.65em;
  border-top: 0.13em solid #52616e;
  border-right: 0.13em solid #52616e;
  content: "";
  transform: translateY(-50%) rotate(45deg);
}

.reveal .flow-level strong {
  display: block;
  margin-bottom: 0.24em;
}

.reveal .flow-level p {
  margin: 0.12em 0;
}

.reveal .flow-level.source {
  border-color: #3385a6;
  background: #e8f6fa;
}

.reveal .flow-level.transform {
  border-color: #b36b32;
  background: #fff2e5;
}

.reveal .flow-level.hardware {
  border-color: #3f8a61;
  background: #e9f7ef;
}

.reveal .flow-level.output {
  border-color: #8262a8;
  background: #f3edfa;
}

.reveal .bit-layout {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr 4fr 3fr;
  width: min(100%, 26em);
  margin: 0.8em auto;
  border: 2px solid #33424f;
  background: #ffffff;
}

.reveal .bit-field {
  min-width: 0;
  padding: 0.58em 0.35em;
  border-right: 2px solid #33424f;
  text-align: center;
}

.reveal .bit-field:last-child {
  border-right: 0;
}

.reveal .bit-field.sign {
  background: #fce8e6;
}

.reveal .bit-field.exponent {
  background: #e8f2fb;
}

.reveal .bit-field.fraction {
  background: #edf7e9;
}

.reveal .bit-field small {
  display: block;
  margin-top: 0.2em;
  color: #52616e;
  font-size: 0.58em;
}

.reveal .circuit-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.78em;
  width: 100%;
  margin: 0 auto 0.65em;
}

.reveal .circuit-stage {
  position: relative;
  display: flex;
  min-height: 4.35em;
  padding: 0.48em 0.34em;
  align-items: center;
  justify-content: center;
  border: 2px solid #b8c3cc;
  background: rgb(255 255 255 / 92%);
  color: #425466;
  font-size: 0.75em;
  font-weight: 650;
  text-align: center;
  transition: background-color 0.35s ease, border-color 0.35s ease,
    color 0.35s ease, transform 0.35s ease;
}

.reveal .circuit-stage:not(:last-child)::after {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: -0.66em;
  width: 0.48em;
  height: 0.48em;
  border-top: 0.11em solid #52616e;
  border-right: 0.11em solid #52616e;
  content: "";
  transform: translateY(-50%) rotate(45deg);
}

.reveal .circuit-stage.is-done {
  border-color: #5f7d69;
  background: #edf7e9;
  color: #244c32;
}

.reveal .circuit-stage.is-active {
  border-color: #b05c2e;
  background: #fff0df;
  color: #713616;
  transform: translateY(-0.12em);
}

.reveal .circuit-stage:nth-child(1).is-active {
  border-color: #3385a6;
  background: #e8f6fa;
  color: #17536b;
}

.reveal .circuit-stage:nth-child(3).is-active {
  border-color: #3f8a61;
  background: #e9f7ef;
  color: #245b3b;
}

.reveal .circuit-stage:nth-child(4).is-active {
  border-color: #a67816;
  background: #fff6d8;
  color: #674905;
}

.reveal .circuit-stage:nth-child(5).is-active {
  border-color: #8262a8;
  background: #f3edfa;
  color: #52386f;
}

.reveal .exercise-clock {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45em;
  width: 100%;
  margin-top: 0.65em;
  font-size: 0.65em;
  text-align: center;
}

.reveal .exercise-clock > div {
  padding-top: 0.45em;
  border-top: 0.18em solid #9ca9b3;
}

.reveal .exercise-clock strong {
  display: block;
}

.reveal .scope-line {
  display: grid;
  grid-template-columns: 7em minmax(0, 1fr);
  gap: 0.7em;
  align-items: baseline;
  margin: 0.42em 0;
}

.reveal .scope-line strong {
  color: #263746;
}

.reveal .solution-code pre {
  max-height: 19em;
}

@media (max-width: 900px) {
  .reveal .lowering-flow,
  .reveal .hls-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reveal .flow-level::after {
    display: none;
  }

  .reveal .circuit-flow {
    grid-template-columns: repeat(5, minmax(7.5em, 1fr));
    overflow-x: auto;
  }
}
