/* ==========================================================================
   Journey: a living tree that grows as you scroll up from the roots.
   The page starts at the bottom. Milestones sit on branches, the crown is now.
   ========================================================================== */

.jr-tree,
.jr-fall {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.jr-tree {
  z-index: 0;
}

/* Falling leaves drift in front of the content, under the nav */
.jr-fall {
  z-index: 70;
}

.jr {
  position: relative;
  z-index: 1;
}

/* --- Crown (top of page) ------------------------------------------------ */

.jr-crown {
  position: relative;
  min-height: 135vh;
  padding: clamp(8rem, 20vh, 11rem) var(--gutter) 0;
  text-align: center;
}

.jr-crown .dc-label {
  display: inline-block;
}

.jr-crown .dc-h1 {
  margin: 0 auto;
}

.jr-crown-copy {
  max-width: 34rem;
  margin: 2rem auto 0;
  color: var(--paper-soft);
}

.jr-crown-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 2rem;
}

/* --- Milestones ------------------------------------------------------- */

.jr-stages {
  margin: 0;
  padding: 0;
  list-style: none;
}

.jr-stage {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 92vh;
  padding: 4vh var(--gutter);
}

.jr-card {
  position: relative;
  width: min(30rem, 34vw);
  padding: 1.8rem 1.9rem 1.6rem;
  border: 1px solid var(--paper-faint);
  background: rgba(11, 11, 10, 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.jr-stage[data-side="left"] .jr-card {
  margin-right: auto;
  margin-left: max(0px, calc(50% - 13vw - min(30rem, 34vw)));
}

.jr-stage[data-side="right"] .jr-card {
  margin-left: calc(50% + 13vw);
}

/* Where the branch meets the card */
.jr-card::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(214, 161, 92, 0.18);
}

.jr-stage[data-side="left"] .jr-card::before {
  right: -5px;
}

.jr-stage[data-side="right"] .jr-card::before {
  left: -5px;
}

.jr-year {
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.jr-card .dc-h3 {
  margin-bottom: 1rem;
  font-size: clamp(1.7rem, 2.6vw, 2.4rem);
}

.jr-card p {
  margin: 0 0 1rem;
  color: var(--paper-soft);
}

.jr-card .jr-line {
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--paper-faint);
  font-size: 1.1rem;
  line-height: 1.35;
  color: var(--paper);
}

/* Cards wait for their branch to reach them */
.js .jr-card {
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  transition: opacity 1s var(--ease), transform 1.2s var(--ease);
}

.js .jr-stage.is-grown .jr-card,
.dc-static .jr-card {
  opacity: 1;
  transform: none;
}

/* --- Origin (bottom of page, where you start) -------------------------- */

.jr-origin {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  padding: 0 var(--gutter);
}

.jr-origin-copy {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 9vh;
  max-width: 40rem;
}

.jr-origin-copy .dc-h1 {
  font-size: clamp(2.4rem, 5vw, 5rem);
  /* keeps the headline readable where roots pass behind it */
  text-shadow: 0 2px 24px rgba(11, 11, 10, 0.95), 0 0 8px rgba(11, 11, 10, 0.8);
}

.jr-origin-copy p:last-child {
  text-shadow: 0 1px 12px rgba(11, 11, 10, 1);
}

.jr-origin-copy p:last-child {
  max-width: 30rem;
  margin: 1.5rem 0 0;
  color: var(--paper-soft);
}

/* --- Year rail --------------------------------------------------------- */

.jr-rail {
  position: fixed;
  right: var(--gutter);
  top: 50%;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: right;
  color: var(--paper-dim);
}

.jr-rail li {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  opacity: 0.35;
  transition: opacity 0.5s, color 0.5s;
}

.jr-rail li::after {
  content: "";
  width: 14px;
  height: 1px;
  background: currentColor;
  transition: width 0.5s var(--ease);
}

.jr-rail li.is-reached {
  opacity: 0.8;
}

.jr-rail li.is-current {
  opacity: 1;
  color: var(--accent);
}

.jr-rail li.is-current::after {
  width: 30px;
}

/* --- Small screens: trunk runs down the left edge ---------------------- */

@media (max-width: 760px) {
  /* The trunk runs up the middle; each card sits low in its stage so the
     tree shows in the space above it and a branch lands on its top corner */
  .jr-stage {
    min-height: 96vh;
    align-items: flex-end;
    padding: 0 var(--gutter) 5vh;
  }

  .jr-stage[data-side] .jr-card {
    width: 100%;
    margin: 0;
    padding: 1.4rem 1.3rem 1.3rem;
  }

  .jr-stage[data-side] .jr-card::before {
    top: -5px;
    margin-top: 0;
  }

  .jr-stage[data-side="left"] .jr-card::before {
    left: 28px;
    right: auto;
  }

  .jr-stage[data-side="right"] .jr-card::before {
    right: 28px;
    left: auto;
  }

  .jr-crown {
    min-height: 150vh;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
  }

  .jr-origin-copy {
    left: var(--gutter);
    bottom: 12vh;
  }

  .jr-rail {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .jr-card {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
