/* ── 12 Trilhas (the Pentateuch trail, scrolled inside the phone) ───────── */
/* The app's real trail map (tools/trails/scenery export, baked into six tiles by
   web/scripts/bake-home-characters.py) inside a phone frame, opening at the bottom
   where the trail starts: the scroller runs column-reverse, so it opens at "A
   criação" with or without scripts. Beside it, the first lesson's card with
   Spurgeonzinho's lesson-opening loop (lottie-web, trilhas.js) and his real entry line
   (resources/data/trails/pentateuco.json). .on comes from trilhas.js when the
   scene is in view; without scripts everything is shown at rest. */
.l-trail {
  position: relative;
  background: var(--bg);
  padding: clamp(96px, 14vh, 150px) clamp(20px, 5vw, 64px);
}
.l-trail-in {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(280px, 380px);
  gap: clamp(28px, 4.5vw, 64px);
  align-items: center;
}
.l-trail-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 0;
  font-size: 17px;
  color: var(--ink-3);
}
.l-trail-arrow {
  display: inline-block;
  font-size: 20px;
  color: var(--accent);
}
:root[data-theme-choice] .l-trail.live .l-trail-arrow {
  animation: l-trail-nudge 1.8s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
@keyframes l-trail-nudge {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* The phone: the same bezel as the Chat demo's (.l-cf). */
.l-trail-phone {
  width: clamp(280px, 24vw, 340px);
  aspect-ratio: 640 / 1392;
  padding: 8px;
  border-radius: 38px;
  background: var(--bezel);
  box-shadow:
    0 0 0 1px var(--bezel-rim),
    0 2px 4px var(--bezel-drop-2),
    0 30px 60px -22px var(--bezel-drop);
}
.l-trail-screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 31px;
  background: #f5efe3;
}
/* The status-bar wash: the map slides under it, as in the app. */
.l-trail-screen::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 54px;
  background: linear-gradient(#f5efe3 35%, rgb(245 239 227 / 0));
  pointer-events: none;
}
.l-trail-map {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column-reverse;
  overflow-y: auto;
  overscroll-behavior-x: none;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.l-trail-map::-webkit-scrollbar {
  display: none;
}
.l-trail-map:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
  border-radius: 31px;
}
.l-trail-art {
  position: relative;
  flex: none;
}
.l-trail-art img {
  display: block;
  width: 100%;
  height: auto;
  /* Each tile overlaps the next by a hair so no seam line shows between them. */
  margin-bottom: -1px;
}
/* "Começar a aula" lands here: the first stone, marked once by a widening ring. */
.l-trail-ring {
  position: absolute;
  left: 50%;
  top: 97.5%;
  width: 34%;
  aspect-ratio: 1.55;
  border: 3px solid var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  opacity: 0;
  pointer-events: none;
}
.l-trail-ring.pulse {
  animation: l-trail-ring 1.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes l-trail-ring {
  0% {
    transform: translate(-50%, -50%) scale(0.7);
    opacity: 0;
  }
  25% {
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.25);
    opacity: 0;
  }
}

/* The lesson card: paper on the page, lifted like the app's floating cards. */
.l-trail-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.l-trail-kick {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.l-trail-title {
  margin: 0;
  font-family: var(--font-roman);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.1;
}
.l-trail-teach {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.l-trail-guide {
  position: relative;
  flex: 0 0 120px;
  height: 120px;
}
.l-trail-still,
.l-trail-guide svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.l-trail-still {
  object-fit: contain;
  transition: opacity 0.4s ease;
}
.l-trail-still.gone {
  opacity: 0;
}
/* His line, in a speech card that leans toward him. */
.l-trail-say {
  position: relative;
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: var(--radius-card);
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--rule-soft);
  font-size: 17px;
  line-height: 1.45;
}
.l-trail-say::before {
  content: "";
  position: absolute;
  left: -7px;
  bottom: 18px;
  width: 12px;
  height: 12px;
  background: var(--bg-2);
  box-shadow: inset 1px -1px 0 var(--rule-soft);
  transform: rotate(45deg);
}
.l-trail-with {
  margin: 0;
  font-size: 16px;
  color: var(--ink-3);
}
.l-trail-go {
  align-self: stretch;
}
.l-trail-go:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
/* Without scripts the map already rests at the start, so the button has no work. */
:root:not([data-theme-choice]) .l-trail-go {
  display: none;
}

/* The card rises and his line follows when the scene comes into view. */
:root[data-theme-choice] .l-trail-card,
:root[data-theme-choice] .l-trail-say {
  transition:
    transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
:root[data-theme-choice] .l-trail:not(.on) .l-trail-card {
  transform: translateY(20px) scale(0.97);
  opacity: 0;
}
:root[data-theme-choice] .l-trail:not(.on) .l-trail-say {
  transform: translateX(-10px);
  opacity: 0;
}
:root[data-theme-choice] .l-trail.on .l-trail-say {
  transition-delay: 0.45s;
}

@media (max-width: 1100px) {
  .l-trail-in {
    grid-template-columns: auto minmax(260px, 360px);
    justify-content: center;
  }
  .l-trail-copy {
    grid-column: 1 / -1;
    text-align: center;
  }
  .l-trail-copy .l-lede {
    margin-inline: auto;
  }
  .l-trail-hint {
    justify-content: center;
  }
}
/* Phones: copy, then the phone, then the lesson card under it. */
@media (max-width: 700px) {
  .l-trail-in {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 36px;
  }
  .l-trail-phone {
    width: min(78vw, 300px);
  }
  .l-trail-card {
    width: 100%;
    max-width: 380px;
    padding: 22px;
    box-sizing: border-box;
  }
  .l-trail-title {
    font-size: 27px;
  }
  .l-trail-guide {
    flex-basis: 108px;
    height: 108px;
  }
  .l-trail-say {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .l-trail-map {
    scroll-behavior: auto;
  }
  :root[data-theme-choice] .l-trail.live .l-trail-arrow,
  .l-trail-ring.pulse {
    animation: none;
  }
  :root[data-theme-choice] .l-trail-card,
  :root[data-theme-choice] .l-trail-say {
    transition: none;
  }
  :root[data-theme-choice] .l-trail:not(.on) .l-trail-card,
  :root[data-theme-choice] .l-trail:not(.on) .l-trail-say {
    transform: none;
    opacity: 1;
  }
}
