/* Akar theme: per-page gradients, readable panels and the home thumbnail grid.
   --g1 (image background) and --g2 (image accent) are set per page in
   overrides/main.html from the page's `gradient` front matter. */

:root {
  --g1: #0e1925;
  --g2: #2a8a94;
}

/* Light mode: pale tints of the image colours, so dark text stays readable. */
[data-md-color-scheme="default"] {
  --md-primary-fg-color: #0b4f5c;
  --md-primary-bg-color: #fff;
  --md-accent-fg-color: #00695c;
  --md-typeset-a-color: #00695c;
  --page-a: color-mix(in srgb, var(--g1) 16%, #fff);
  --page-b: color-mix(in srgb, var(--g2) 38%, #fff);
  --panel: color-mix(in srgb, #fff 88%, transparent);
}

/* Dark mode: deep shades of the same colours, so light text stays readable. */
[data-md-color-scheme="slate"],
[data-md-color-scheme="slate"][data-md-color-primary] {
  --md-primary-fg-color: #0d2230;
  --md-accent-fg-color: #5eead4;
  --md-typeset-a-color: #5eead4;
  --page-a: color-mix(in srgb, var(--g1) 70%, #000);
  --page-b: color-mix(in srgb, var(--g2) 42%, #000);
  --panel: color-mix(in srgb, #10161d 84%, transparent);
}

.md-main {
  background: linear-gradient(160deg, var(--page-a) 0%, var(--page-b) 100%);
}

/* The content sits on a translucent panel so text contrast never depends on the gradient. */
.md-content__inner {
  background: var(--panel);
  border-radius: 0.75rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.5rem 1.25rem 1.25rem;
}

.md-footer {
  background: color-mix(in srgb, var(--g2) 40%, #000);
}

.md-footer-meta {
  background: color-mix(in srgb, var(--g2) 28%, #000);
}

/* Material's footer text is only 30% white by default, which fails contrast. */
.md-footer,
.md-footer-meta {
  --md-footer-fg-color--light: rgb(255 255 255 / 85%);
  --md-footer-fg-color--lighter: rgb(255 255 255 / 85%);
}

/* Material paints a solid white/dark block behind sidebar titles; let the gradient show through. */
.md-sidebar .md-nav__title {
  background: transparent;
  box-shadow: none;
}

/* Material's default h1 is a pale grey, which is too low contrast on the panel. */
.md-typeset h1 {
  color: var(--md-default-fg-color);
  font-weight: 700;
}

/* Slide pages */
.slide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.8rem;
}

.slide-meta span {
  padding: 0.15rem 0.7rem;
  border-radius: 1rem;
  border: 1px solid currentcolor;
  color: var(--md-typeset-a-color);
}

.md-typeset .hero {
  width: 100%;
  margin: 0 0 1.5rem;
}

.hero img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 4px 18px rgb(0 0 0 / 35%);
}

.md-typeset .hero figcaption {
  max-width: none;
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  text-align: right;
}

/* Speaker track reads like a script, so give it a comfortable size and line length. */
.md-typeset {
  font-size: 0.8rem;
}

.md-content__inner > p,
.md-content__inner > ul {
  max-width: 44rem;
  font-size: 0.88rem;
  line-height: 1.75;
}

/* Home page */
.lead {
  font-size: 1.05rem;
  max-width: 44rem;
}

.md-typeset ul.slide-grid:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 0 !important;
  padding: 0;
  list-style: none;
}

.md-typeset .slide-grid li {
  margin: 0 !important;
  overflow: hidden;
  border-radius: 0.6rem;
  background: linear-gradient(160deg, color-mix(in srgb, var(--g1) 70%, #000), color-mix(in srgb, var(--g2) 45%, #000));
  box-shadow: 0 2px 10px rgb(0 0 0 / 25%);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.md-typeset .slide-grid li:hover,
.md-typeset .slide-grid li:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgb(0 0 0 / 40%);
}

.md-typeset .slide-grid a,
.md-typeset .slide-grid a:hover {
  display: block;
  color: #fff;
}

.md-typeset .slide-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.slide-card__title {
  display: block;
  padding: 0.6rem 0.8rem 0.75rem;
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.3;
}

.slide-card__num {
  display: inline-block;
  min-width: 1.4rem;
  margin-right: 0.3rem;
  text-align: center;
  border-radius: 0.8rem;
  background: #fff;
  color: #0d2230;
}

/* Clear keyboard focus on cards. */
.md-typeset .slide-grid a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -3px;
}

@media (max-width: 44.9375em) {
  .md-content__inner {
    padding-inline: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .md-typeset .slide-grid li {
    transition: none;
  }

  .md-typeset .slide-grid li:hover,
  .md-typeset .slide-grid li:focus-within {
    transform: none;
  }
}
