:root {
  --head-gap: max(8em, 16vw);
}

/* Guided scroll setup */
html {
  overflow-x: hidden;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  height: 100vh;
  width: 100vw;
}

section {
  position: relative;
  height: fit-content;
  max-height: calc((var(--vh, 1vh) * 100) - var(--header-height) - 1.6rem);
  padding: 15vw 0;
  display: flex;
  justify-content: center;
  flex-flow: column;
  align-content: start;
  scroll-margin-top: var(--header-height);
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

section#hero {
  height: 100%;
  max-height: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
  padding-top: 0;
  padding-bottom: 0;
}

section:last-of-type {
  scroll-snap-align: end;
}

footer {
  scroll-snap-align: end;
}

/* Hero */
#hero {
  flex-flow: column;
  text-align: center;
  width: var(--head-gap);
  padding-left: 0.2rem;
  padding-right: 0.2rem;
  margin: 0 auto;
  gap: calc((var(--vh, 1vh) * 5));
}

#hero h1 {
  font-size: 1.5625em;
  line-height: 1.4;
  font-weight: 300;
  font-style: italic;
  margin: 0;
  color: unset;
}

.emph {
  font-weight: 700;
  text-transform: uppercase;
}

.md-container {
  position: relative;
}

#hero-container {
  contain: paint;
  width: 100%;
  height: calc((var(--vh, 1vh) * 100) - var(--header-height));
  position: relative;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#hero-container.ready {
  opacity: 1;
}

#hero-bg {
  display: flex;
  justify-content: center;
  gap: var(--head-gap);
  position: absolute;
  top: 0;
  left: 50%;
  width: max(calc((var(--vh, 1vh) * 100)), 100vw);
  height: 100%;
  padding: 1em 0;
  transform: translateX(-50%);
  z-index: -1;
}

#hero-bg img {
  height: 100%;
  max-height: max(calc(var(--vh, 1vh) * 73), 47.7vw);
  margin: auto 0;
}

/* Grid animation */
.md-typeset .grid.cards {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}

.md-typeset .grid.cards > ul > li {
  transition: border .25s, box-shadow .25s, transform .75s cubic-bezier(.075,.85,.175,1), opacity .75s;
}

.md-typeset .grid.cards.no-border li, #questions > p:first-child {
  transition: transform .75s cubic-bezier(.075,.85,.175,1), opacity .75s;
}

.md-typeset .grid.cards.no-border li {
  border: none;
}

.md-typeset .grid.cards.no-border li:hover, .md-typeset .grid.cards.no-border li:focus-within {
  box-shadow: none;
}

[hidden] li {
  opacity: 0;
}

[hidden] li {
  transform: translate(-.8rem,.4rem);
}

[hidden] li:nth-child(2n) {
  transform: translate(.8rem,.4rem);
}

.md-typeset .grid.cards li:first-child {
  transition-delay: 200ms;
}

.md-typeset .grid.cards li:nth-child(2) {
  transition-delay: 275ms;
}

.md-typeset .grid.cards li:nth-child(3) {
  transition-delay: 350ms;
}

.md-typeset .grid.cards li:nth-child(4) {
  transition-delay: 425ms;
}

.md-typeset .grid.cards li:nth-child(5) {
  transition-delay: 500ms;
}

.md-typeset .grid.cards li:nth-child(6) {
  transition-delay: 575ms;
}

/* Text */
section > p {
  font-family: var(--md-serif-font-family);
  font-size: 1.5625em;
  line-height: 1.4;
  letter-spacing: -.01em;
}

.md-typeset .grid.cards h1 {
  margin-bottom: 0.64em;
}

/* Quotes section */
h1#quotations {
  visibility: hidden;
  position: absolute;
}

[dir="ltr"] .md-typeset blockquote {
  position: relative;
  font-size: x-large;
  border-left: none;
  font-style: italic;
  padding: 0;
  max-width: 30em;
}

blockquote:before {
  display: block;
  position: absolute;
  height: 2em;
  width: 2em;
  top: -2.5em;
  content: '';
}

#quotes li:first-child blockquote:before {
  right: 0.2rem;
  -webkit-mask: var(--md-quote-left-icon) no-repeat 50% 50%;
  mask: var(--md-quote-left-icon) no-repeat 50% 50%;
  -webkit-mask-size: cover;
  mask-size: cover;
  background-color: var(--md-accent-fg-color);
}

#quotes li:last-child blockquote:before {
  left: -0.2rem;
  -webkit-mask: var(--md-quote-right-icon) no-repeat 50% 50%;
  mask: var(--md-quote-right-icon) no-repeat 50% 50%;
  -webkit-mask-size: cover;
  mask-size: cover;
  background-color: var(--md-secondary-fg-color);
}

#quotes li:last-child {
  text-align: right;
}

#quotes li:last-child blockquote {
  margin-left: auto;
}

#quotes p {
  margin-top: 0;
}

#quotes li > p {
 all: unset;
}

#quotes .grid.cards {
  row-gap: 4.5em;
}

/* Distill section */
#distill {
  position: relative;
  background-color: var(--md-secondary-fg-color--transparent);
  padding: 2em;
  border-radius: 32px;
}

#distill p {
  max-width: 40em;
  font-size: 1.2em;
}

#distill img {
  max-width: 6.3em;
  margin: 0 auto;
}

#distill .grid.cards {
  grid-template-columns: 50em auto;
  column-gap: 0;
}

#distill li:first-child {
  padding-right: 0;
}

#distill li:last-child p {
  display: flex;
  width: 100%;
}

#distill [hidden] li:first-child {
  transform: translateY(1.6rem);
}

#distill [hidden] li:last-child {
  transform: translateY(-1.6rem);
}

/* Questions section */
#questions {
  text-align: center;
}

#questions > p:has(+ [hidden]) {
  opacity: 0;
}

#questions .grid.cards {
  display: flex;
  flex-flow: column;
}

#questions li {
  width: fit-content;
  margin: auto;
  padding: 0.5rem 1rem;
  border-radius: 32px;
  flex-flow: row;
}

#questions [hidden] li {
  transform: translateY(1.6rem);
}

/* Overview section */
#overview h1:has(+ [hidden]) {
  opacity: 0;
  transform: translate(-.8rem,.4rem);
}

#overview h1 {
  transition: transform .75s cubic-bezier(.075,.85,.175,1), opacity .75s;
  transition-delay: 125ms;
}

#overview .grid.cards {
  gap: 1.6rem;
}

#overview li {
  gap: .6rem;
  padding: 0;
  flex-flow: row;
}

#overview strong {
  display: block;
  font-size: 1.5625em;
  font-weight: 700;
  line-height: 1.4;
  margin: .175em 0 .4em;
  font-family: var(--md-text-font-family);
}

#overview .twemoji {
  background-color: var(--md-default-fg-color--lightest);
  border-radius: 100%;
  flex-shrink: 0;
  height: 2.2rem;
  padding: .4rem;
  width: 2.2rem;
  align-content: center;
  justify-content: center;
}

#overview p {
  margin: 0;
}

#overview p:first-child {
  display: contents;
}

/* Bottom image */
article.md-content__inner > p:last-child {
  contain: paint;
}

article.md-content__inner > p:last-child img {
  left: -25px;
  position: relative;
  bottom: 0;
}


@media (max-width: 1220px) {
  #hero {
    font-size: 80%;
  }

  #hero-bg {
    padding: 4.75em 0 1em;
  }

  [dir="ltr"] .md-typeset blockquote {
    font-size: large;
  }

  .md-typeset .grid.cards > ul > li {
    margin: auto 0;
    padding: 0;
  }

  .md-typeset .grid.cards p {
    max-width: none;
  }

  .md-typeset .grid.cards.no-border {
    row-gap: 1em;
    grid-template-columns: 1fr !important;
    margin-bottom: 0;
  }
}

@media (max-width: 720px) {
  #distill p {
    font-size: unset;
  }

  #questions li {
    width: 100%;
  }

  section:last-of-type {
    scroll-snap-type: none;
    scroll-snap-align: start;
    max-height: unset;
  }

  article.md-content__inner > p:last-child img {
    position: relative;
    left: -70%;
    width: 170%;
    max-width: unset;
  }
}

@media (min-width: 720px) {
  article.md-content__inner {
    margin-bottom: 0;
  }

#distill .grid.cards {
  row-gap: 2em;
}

}
