:root {
  --logo: image-set(url("../img/logo.webp") 1x, url("../img/logo@2x.webp") 2x);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100svh;
  padding: calc(var(--header-h) + var(--space-3)) 0 var(--space-6);
  overflow: hidden;
  text-align: center;
}

.hero__glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 50% 42% at 50% 34%, rgb(240 196 106 / 0.18), transparent 70%),
    radial-gradient(ellipse 120% 70% at 50% 115%, rgb(33 17 16 / 0.6), transparent 60%);
}

.hero__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero__eyebrow {
  margin-top: var(--space-4);
}

.hero__title {
  max-width: 15ch;
  margin-top: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 24px rgb(40 10 6 / 0.35);
}

.hero__lead {
  max-width: 46ch;
  margin-top: var(--space-3);
  font-size: clamp(1.1875rem, 1rem + 0.6vw, 1.375rem);
  line-height: 1.5;
  color: var(--on-wall-muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: var(--space-4);
}

.hero__cue {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--rule-wall);
  border-radius: 50%;
  translate: -50% 0;
  color: var(--plaster);
  transition: border-color 0.3s, background-color 0.3s;
}

.hero__cue:hover {
  border-color: var(--plaster);
  background: rgb(255 255 255 / 0.08);
}

.hero__cue .icon {
  width: 1.1rem;
  height: 1.1rem;
  animation: cue-bob 2.2s var(--ease-in-out) infinite 2.6s;
}

@keyframes cue-bob {
  50% {
    translate: 0 4px;
  }
}

@media (max-height: 760px) {
  .hero__cue {
    display: none;
  }
}

/* The logo scroll unrolls: two rollers part while the paper opens between them. */
.scroll {
  position: relative;
  width: min(560px, 86vw);
  aspect-ratio: 431 / 158;
  filter: drop-shadow(0 26px 30px rgb(30 8 5 / 0.45));
}

.scroll > span {
  position: absolute;
  inset: 0;
  background: var(--logo) center / 100% 100% no-repeat;
  animation-duration: 1.3s;
  animation-timing-function: var(--ease-in-out);
  animation-delay: 0.2s;
  animation-fill-mode: both;
}

.scroll__paper {
  clip-path: inset(0 5.8% 0 5.4%);
  animation-name: scroll-open;
}

.scroll__roller--left {
  clip-path: inset(0 94.6% 0 0);
  animation-name: roll-left;
}

.scroll__roller--right {
  clip-path: inset(0 0 0 94.2%);
  animation-name: roll-right;
}

@keyframes scroll-open {
  from {
    clip-path: inset(0 50% 0 50%);
  }
}

@keyframes roll-left {
  from {
    translate: 44.6% 0;
  }
}

@keyframes roll-right {
  from {
    translate: -44.2% 0;
  }
}

/* ---------- Word explorer ---------- */

.explore__layout {
  display: grid;
  gap: var(--space-3);
}

.explore__list {
  display: flex;
  gap: 0.5rem;
  margin-inline: calc(var(--gutter) * -1);
  padding: 0.25rem var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}

.explore__word {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 44px;
  padding: 0.5rem 1.1rem;
  background: rgb(255 255 255 / 0.04);
  border: 1px solid rgb(246 236 220 / 0.16);
  border-radius: var(--r-pill);
  font-size: var(--text-base);
  line-height: 1.2;
  color: var(--on-night-muted);
  white-space: nowrap;
  transition:
    background-color 0.25s,
    border-color 0.25s,
    color 0.25s;
}

.explore__word:hover {
  background: rgb(255 255 255 / 0.07);
  color: var(--plaster);
}

.explore__word[aria-selected="true"] {
  background: rgb(227 176 75 / 0.14);
  border-color: rgb(227 176 75 / 0.5);
  color: var(--plaster);
}

.explore__hint {
  display: none;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--on-night-muted);
}

@media (min-width: 60rem) {
  .explore__layout {
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: var(--space-4);
  }

  .explore__list {
    flex-direction: column;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .explore__card {
    min-height: 25rem;
  }

  .explore__stage {
    min-height: 15rem;
  }

  .explore__word {
    font-size: var(--text-md);
    border-radius: var(--r-sm);
    border-color: transparent;
    background: transparent;
  }

  .explore__hint {
    display: inline;
  }
}

.explore__card {
  display: flex;
  flex-direction: column;
  padding: clamp(1.5rem, 1rem + 2.5vw, 3rem);
  overflow: hidden;
}

.explore__card:focus-visible {
  outline-offset: 4px;
}

.explore__stage {
  display: flex;
  flex: 1;
  align-items: center;
  min-height: 9rem;
  padding-bottom: var(--space-3);
}

.explore__grid {
  display: grid;
  grid-template-columns: auto auto auto auto;
  grid-template-rows: auto auto;
  justify-content: start;
  align-items: center;
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 9vw, 7.5rem);
  line-height: 1;
}

.explore__label {
  grid-column: 1;
  padding-right: clamp(0.75rem, 2vw, 1.75rem);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-night-muted);
}

.explore__cell {
  display: block;
  overflow: hidden;
  padding-block: 0.06em 0.12em;
  white-space: pre;
  transition: opacity 0.7s var(--ease-out);
}

.explore__pre {
  grid-column: 2;
  text-align: right;
}

.explore__stem {
  grid-column: 3;
}

.explore__suf {
  grid-column: 4;
}

.explore__ch {
  display: inline-block;
}

.explore__cell[data-row="en"] {
  grid-row: 1;
}

.explore__cell[data-row="la"] {
  grid-row: 2;
  color: var(--gold);
}

.js .explore__grid:not(.is-live) > .explore__cell {
  visibility: hidden;
}

.is-framed .explore__pre,
.is-framed .explore__suf {
  opacity: 0.35;
}

/* The shared stem gets a highlight band across both rows. */
.explore__frame {
  position: relative;
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: stretch;
  margin-inline: -0.08em;
  border-radius: 0.12em;
  background: rgb(227 176 75 / 0.1);
  box-shadow: inset 0 0 0 1px rgb(227 176 75 / 0.65);
  pointer-events: none;
  opacity: 0;
  scale: 1 0.6;
  transition:
    opacity 0.6s var(--ease-out),
    scale 0.7s var(--ease-spring);
}

.is-framed .explore__frame {
  opacity: 1;
  scale: 1 1;
}

.explore__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule-night);
  transition:
    opacity 0.5s var(--ease-out),
    translate 0.6s var(--ease-out);
}

.js .explore__meta:not(.is-in) {
  opacity: 0;
  translate: 0 0.5rem;
}

.explore__meaning {
  font-size: var(--text-md);
  color: var(--on-night-muted);
}

.explore__meaning i {
  color: var(--plaster);
}

.explore__meaning b {
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.4rem);
  font-style: italic;
  font-weight: 400;
  color: var(--plaster);
}

.explore__foot {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: var(--space-3);
}

.explore__timer {
  flex: 1;
  height: 3px;
}

.explore__timer > span {
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  transition: none;
}

.no-js .explore__foot {
  display: none;
}

/* ---------- About (parchment) ---------- */

.about__grid {
  display: grid;
  gap: var(--space-5);
  align-items: center;
}

.about__body {
  max-width: 38rem;
  margin-top: var(--space-3);
  font-size: var(--text-md);
  line-height: 1.55;
  color: var(--ink-muted);
}

.lexeme {
  padding: clamp(2rem, 4vw, 3rem);
  color: var(--plaster);
  rotate: 1.5deg;
  transition: rotate 0.6s var(--ease-out);
}

.lexeme:hover {
  rotate: 0deg;
}

.lexeme__head {
  margin-top: var(--space-2);
  font-size: var(--text-xl);
  font-style: italic;
  line-height: 1.1;
}

.lexeme__pos {
  margin-top: 0.5rem;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--on-night-muted);
}

.lexeme__pos i {
  font-family: var(--font-text);
  font-size: 1.15em;
}

.lexeme__def {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule-night);
  font-size: var(--text-md);
  line-height: 1.45;
}

@media (min-width: 56rem) {
  .about__grid {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    gap: var(--space-6);
  }
}

.steps-wrap {
  margin-top: var(--space-7);
}

.steps__heading {
  margin-bottom: var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

.steps {
  position: relative;
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-4);
}

/* Dashed thread joining the steps; it draws once the first step is revealed. */
.steps::before {
  content: "";
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 27px;
  width: 1px;
  background: repeating-linear-gradient(180deg, rgb(35 21 15 / 0.35) 0 6px, transparent 6px 12px);
  scale: 1 0;
  transform-origin: top;
  transition: scale 1.6s var(--ease-in-out) 0.3s;
}

.steps:has(.is-in)::before,
.no-js .steps::before {
  scale: 1 1;
}

.step {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--space-3);
  align-items: start;
  align-content: start;
}

.step__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--night-2), var(--night));
  color: var(--gold);
  box-shadow: 0 0 0 6px var(--parchment), var(--shadow-sm);
}

.step__icon .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.step__num {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wall);
}

.step__title {
  margin-top: 0.3rem;
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

.step__text {
  margin-top: 0.4rem;
  color: var(--ink-muted);
}

@media (min-width: 56rem) {
  .steps {
    grid-template-columns: repeat(4, 1fr);
  }

  .steps::before {
    top: 28px;
    bottom: auto;
    left: 28px;
    right: 12%;
    width: auto;
    height: 1px;
    background: repeating-linear-gradient(90deg, rgb(35 21 15 / 0.35) 0 6px, transparent 6px 12px);
    scale: 0 1;
    transform-origin: left;
  }

  .step {
    grid-template-columns: 1fr;
  }

  .step > div {
    padding-right: var(--space-2);
  }
}

/* ---------- Course ---------- */

.course {
  padding-top: calc(var(--space-7) + 1rem);
}

.chapters {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15.5rem), 1fr));
  gap: var(--space-3);
}

.chapter {
  display: flex;
  flex-direction: column;
  min-height: 25rem;
  padding: 1.75rem 1.75rem 1.6rem;
}

.chapter__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.chapter__num {
  font-family: var(--font-display);
  font-size: 4rem;
  line-height: 0.9;
  color: var(--gold);
  transition: translate 0.5s var(--ease-out);
}

.chapter__kicker {
  display: block;
  margin-bottom: 0.4rem;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-night-muted);
}

.chapter__title {
  margin-top: var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

.chapter__link {
  text-decoration: none;
}

.chapter__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.chapter__link:focus-visible {
  outline: none;
}

.chapter:has(.chapter__link:focus-visible) {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.chapter__parts {
  list-style: none;
  padding: 0;
  margin-top: var(--space-2);
}

.chapter__parts li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-block: 0.3rem;
  color: var(--on-night-muted);
  transition: color 0.4s;
}

.chapter__parts .icon {
  width: 1.05rem;
  height: 1.05rem;
  color: rgb(246 236 220 / 0.25);
  transition: color 0.4s, scale 0.4s var(--ease-spring);
}

.chapter__parts .is-done {
  color: var(--plaster);
}

.chapter__parts .is-done .icon {
  color: var(--gold);
  scale: 1.1;
}

.chapter__progress {
  margin-top: auto;
  padding-top: var(--space-3);
}

.chapter__progress-label {
  margin-top: 0.6rem;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--on-night-muted);
}

.chapter__go {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gold);
}

.chapter__go .btn__arrow {
  display: inline-block;
}

.chapter--open:hover .chapter__num {
  translate: 0 -0.2rem;
}

.chapter--open:hover .btn__arrow {
  translate: 4px 0;
}

/* Chapters still being written: an unpainted outline on the wall. */
.chapter--soon {
  border: 1px dashed rgb(246 236 220 / 0.32);
  border-radius: var(--r-lg);
  background: rgb(33 17 16 / 0.18);
}

.chapter--soon .chapter__num {
  color: rgb(246 236 220 / 0.5);
}

.chapter--soon .chapter__kicker {
  font-style: normal;
  color: var(--on-wall-muted);
}

.chapter--soon .chapter__title {
  margin-top: auto;
  font-family: var(--font-text);
  font-size: var(--text-md);
  font-style: italic;
  color: var(--on-wall-muted);
}

.chapter__lock {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--on-wall-muted);
}

/* ---------- Consultation ---------- */

.cta {
  padding-top: 0;
}

.cta__card {
  display: grid;
  gap: var(--space-3);
  justify-items: start;
  padding: clamp(2rem, 1rem + 4vw, 4rem);
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgb(227 176 75 / 0.2), transparent 45%),
    linear-gradient(180deg, var(--night-2), var(--night));
}

.cta__title {
  margin-top: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-xl);
}

.cta__text {
  max-width: 40ch;
  margin-top: var(--space-2);
  font-size: var(--text-md);
  color: var(--on-night-muted);
}

@media (min-width: 56rem) {
  .cta__card {
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: var(--space-6);
  }
}
