:root {
  color-scheme: light;

  --color-bg: #ffffff;
  --color-surface: rgba(255, 255, 255, 0.82);
  --color-surface-soft: rgba(255, 255, 255, 0.76);
  --color-text: #18202c;
  --color-muted: #5d6877;
  --color-rule: #d8dee7;
  --color-code: #253144;

  --accent-branch: #2155a3;
  --accent-merge: #0f766e;
  --accent-tag: #b88700;
  --accent-release: #be123c;

  --deck-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono-font: "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --radius-sm: 8px;
  --slide-pad-x: 0.7rem;
  --slide-pad-y: 0.35rem;
}

body {
  background: var(--color-bg);
}

/* Reveal base */
.reveal {
  color: var(--color-text);
  font-family: var(--deck-font);
}

.reveal .slides {
  text-align: left;
}

.reveal section {
  box-sizing: border-box;
  padding: var(--slide-pad-y) var(--slide-pad-x);
  position: relative;
}

.reveal h1,
.reveal h2 {
  margin: 0 0 0.42em;
  color: var(--color-text);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1;
}

.reveal h1 {
  max-width: 10.5em;
  font-size: 2.65em;
}

.reveal h2 {
  max-width: 12em;
  font-size: 2.05em;
}

.reveal p {
  margin: 0.25em 0 0.55em;
  color: var(--color-muted);
  font-size: 0.64em;
  line-height: 1.38;
}

.reveal .subtitle {
  display: inline-flex;
  max-width: 100%;
  margin: 0 0 0.7rem;
  padding: 0.34rem 0.55rem;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
  color: var(--color-code);
  font-family: var(--mono-font);
  font-size: 0.39em;
  line-height: 1.35;
  white-space: normal;
}

.reveal .page-number {
  position: absolute;
  right: var(--slide-pad-x);
  bottom: var(--slide-pad-y);
  color: var(--color-muted);
  font-family: var(--mono-font);
  font-size: 0.3em;
  line-height: 1;
}

/* Overview slide */
.reveal .topic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  width: min(100%, 1120px);
  margin: 1.2rem auto 0;
}

.reveal .topic {
  min-height: 7.4rem;
  padding: 0.75rem;
  border: 1px solid var(--color-rule);
  border-top: 0.32rem solid var(--accent-branch);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.reveal .topic:nth-child(2) {
  border-top-color: var(--accent-merge);
}

.reveal .topic:nth-child(3) {
  border-top-color: var(--accent-tag);
}

.reveal .topic:nth-child(4) {
  border-top-color: var(--accent-release);
}

.reveal .topic strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--color-text);
  font-size: 0.48em;
}

.reveal .topic span {
  display: block;
  color: var(--color-muted);
  font-size: 0.34em;
  line-height: 1.35;
}

/* Two-column workflow slides */
.reveal .workflow-slide {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  column-gap: 2rem;
  align-items: center;
  height: 100%;
  min-height: 0;
  background: var(--color-bg);
}

.reveal .workflow-slide h2,
.reveal .branch-types-slide h2,
.reveal .branch-rules-slide h2,
.reveal .release-version-slide h2,
.reveal .version-merge-slide h2 {
  grid-column: 1 / -1;
  grid-row: 1;
  max-width: none;
  margin-bottom: 0.28em;
  font-size: 44px;
  line-height: 1.05;
}

.reveal .workflow-slide .subtitle {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-bottom: 0;
}

.reveal .workflow-slide .diagram-pane {
  display: grid;
  grid-column: 1;
  grid-row: 3;
  place-items: center start;
  min-height: 0;
}

.reveal .workflow-slide ul {
  grid-column: 2;
  grid-row: 3;
  margin: 0;
  padding-left: 1.1em;
  color: var(--color-text);
  font-size: 28px;
  line-height: 1.42;
}

.reveal .workflow-slide li {
  margin: 0.36em 0;
  padding-left: 0.1em;
}

.reveal .git-diagram-image {
  display: block;
  width: min(96%, 600px);
  height: auto;
  margin: 0;
}

.reveal .squash-merge-slide .git-diagram-image {
  width: auto;
  max-width: min(96%, 600px);
  max-height: 430px;
}

/* Full-height grid slides */
.reveal .branch-types-slide,
.reveal .branch-rules-slide {
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-items: start;
  height: 100%;
  background: var(--color-bg);
}

/* Branch type slide */
.reveal .branch-type-columns {
  align-self: center;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 1180px);
  margin: 1.4rem auto 0;
}

.reveal .branch-type-column {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 19rem;
  padding: 0.1rem 1rem 0;
}

.reveal .branch-type-column + .branch-type-column {
  border-left: 2px solid #000000;
}

.reveal .branch-type-column strong {
  display: block;
  margin-bottom: 0.85rem;
  color: var(--color-text);
  font-family: var(--mono-font);
  font-size: 0.52em;
  line-height: 1.25;
  text-align: center;
  word-break: break-word;
}

.reveal .branch-type-column ul {
  margin: 0;
  padding-left: 1.05em;
  color: var(--color-text);
  font-size: 0.43em;
  line-height: 1.5;
  text-align: left;
}

.reveal .branch-type-column li {
  margin: 0.48em 0;
  padding-left: 0.12em;
}

/* Branch rules screenshots */
.reveal .screenshot-columns {
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: min(100%, 1180px);
  min-height: 0;
  margin: 0.8rem auto 0;
}

.reveal .screenshot-frame {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0.55rem;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.reveal .screenshot-frame img {
  display: block;
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
}

/* Code panels */
.reveal .code-panel pre {
  width: 100%;
  margin: 0;
  box-shadow: none;
}

.reveal .code-panel code {
  max-height: none;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  background: #f7f9fc;
  color: var(--color-code);
  font-family: var(--mono-font);
  white-space: pre-wrap;
}

.reveal .code-panel .hljs-comment {
  color: #68768a;
  font-style: italic;
}

/* Release version slide */
.reveal .release-version-slide {
  display: grid !important;
  grid-template-rows: auto auto auto 1fr;
  align-items: start;
  height: 100%;
  background: var(--color-bg);
}

.reveal .release-version-slide .subtitle {
  grid-column: 1 / -1;
  grid-row: 2;
}

.reveal .release-version-panel {
  grid-column: 1 / -1;
  grid-row: 3;
  width: min(100%, 1080px);
  min-width: 0;
  margin: 0.75rem auto 0;
  padding: 0.8rem;
  border: 1px solid var(--color-rule);
  border-top: 0.32rem solid var(--accent-release);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.reveal .release-version-panel code {
  padding: 0.7rem;
  font-size: 22px;
  line-height: 1.42;
}

/* Version merge slide */
.reveal .version-merge-slide {
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-items: start;
  height: 100%;
  background: var(--color-bg);
}

.reveal .version-merge-slide .subtitle {
  grid-column: 1 / -1;
  grid-row: 2;
}

.reveal .version-merge-layout {
  display: grid;
  grid-column: 1 / -1;
  grid-row: 3;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 1.25rem;
  align-items: center;
  min-height: 0;
  margin-top: 0.55rem;
}

.reveal .version-merge-slide .diagram-pane {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}

.reveal .version-merge-slide .git-diagram-image {
  width: min(100%, 690px);
  height: auto;
}

.reveal .version-merge-copy {
  min-width: 0;
}

.reveal .version-merge-copy strong {
  display: block;
  margin: 0.4rem 0 0.35rem;
  color: var(--color-text);
  font-family: var(--mono-font);
  font-size: 0.4em;
  line-height: 1.25;
}

.reveal .version-merge-copy code {
  padding: 0.62rem;
  font-size: 17px;
  line-height: 1.4;
}

/* Small-screen fallback */
@media (max-width: 720px) {
  .reveal h1 {
    font-size: 2.15em;
  }

  .reveal h2 {
    font-size: 1.75em;
  }

  .reveal .subtitle {
    font-size: 0.34em;
  }

  .reveal .topic-grid {
    grid-template-columns: 1fr 1fr;
  }

  .reveal .workflow-slide {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    height: auto;
  }

  .reveal .workflow-slide .diagram-pane {
    grid-column: 1;
    grid-row: 3;
    min-height: 0;
  }

  .reveal .workflow-slide ul {
    grid-column: 1;
    grid-row: 4;
  }

  .reveal .workflow-slide h2,
  .reveal .branch-types-slide h2,
  .reveal .branch-rules-slide h2,
  .reveal .release-version-slide h2,
  .reveal .version-merge-slide h2 {
    font-size: 1.35em;
  }

  .reveal .branch-type-columns {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .reveal .branch-type-column {
    min-height: 0;
    padding: 0 0 0.8rem;
  }

  .reveal .branch-type-column + .branch-type-column {
    padding-top: 0.85rem;
    border-top: 2px solid #000000;
    border-left: 0;
  }

  .reveal .branch-types-slide,
  .reveal .branch-rules-slide,
  .reveal .release-version-slide,
  .reveal .version-merge-slide {
    height: auto;
  }

  .reveal .screenshot-columns {
    grid-template-columns: 1fr;
  }

  .reveal .version-merge-layout {
    grid-template-columns: 1fr;
  }

  .reveal .screenshot-frame img {
    max-height: 360px;
  }
}
