/* Route Ledger V2 — motion & UX enhancement layer.
 * Loaded on top of styles.css; index.html stays untouched for comparison.
 * Concept: "the route draws as you climb" — content reveals like ledger
 * entries being pinned, and the process line draws with scroll.
 * All effects are gated behind .js-motion (added by js/v2.js) so the page
 * degrades to the static version without JavaScript. */

/* ---- Scroll reveals ---- */
.js-motion [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--ri, 0) * 90ms);
}

.js-motion [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* Ledger entries slide in from the side they sit on, like pinned notes */
.js-motion .culture-ledger [data-reveal],
.js-motion .archive-rail [data-reveal] {
  transform: translateY(20px) rotate(0.4deg);
}

.js-motion .culture-ledger [data-reveal].is-in,
.js-motion .archive-rail [data-reveal].is-in {
  transform: none;
}

/* ---- Header: compact state + section awareness ---- */
.v2 .site-header {
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

.v2 .site-header.is-scrolled {
  background: rgba(23, 27, 24, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--rt-rule-light), 0 12px 30px rgba(0, 0, 0, 0.35);
}

.v2 .primary-nav a {
  position: relative;
}

.v2 .primary-nav a::after {
  position: absolute;
  right: 0;
  bottom: -6px;
  left: 0;
  height: 2px;
  background: var(--rt-orange);
  content: "";
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.v2 .primary-nav a:hover::after,
.v2 .primary-nav a.is-active::after {
  transform: scaleX(1);
}

/* ---- Process line: draws with scroll (the signature) ---- */
.v2 .process-line::before {
  transform: scaleX(var(--draw, 0));
  transform-origin: left;
}

@media (max-width: 900px) {
  .v2 .process-line::before {
    transform: scaleY(var(--draw, 0));
    transform-origin: top;
  }
}

.js-motion .process-line li .process-icon {
  transition: border-color 0.4s ease, color 0.4s ease;
}

.js-motion .process-line li.is-reached .process-icon {
  border-color: var(--rt-orange);
  color: var(--rt-orange);
}

/* ---- FAQ: plus rotates to close, answers ease in ---- */
.v2 .faq-plus {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.v2 details[open] .faq-plus {
  transform: rotate(45deg);
}

.v2 details[open] > p {
  animation: v2-faq-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes v2-faq-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---- Micro-interactions ---- */
.v2 .hero-route-tab span[aria-hidden],
.v2 .circuit-cta span[aria-hidden],
.v2 .whatsapp-dispatch span[aria-hidden] {
  display: inline-block;
  transition: transform 0.25s ease;
}

.v2 .hero-route-tab:hover span[aria-hidden],
.v2 .circuit-cta:hover span[aria-hidden] {
  transform: translate(3px, 3px);
}

.v2 .whatsapp-dispatch:hover span[aria-hidden] {
  transform: translate(3px, -3px);
}

.v2 .hero-route-tab:active,
.v2 .circuit-cta:active,
.v2 .whatsapp-dispatch:active,
.v2 .gym-tape-label:active,
.v2 .rock-anchor-pull:active {
  transform: translateY(1px);
}

.v2 .choice-panel {
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.v2 .choice-panel:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.v2 .archive-item img {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.v2 .archive-item:hover img {
  transform: scale(1.03);
}

/* ---- Form feedback ---- */
.v2 .path-option {
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.v2 .path-option.v2-flash {
  animation: v2-path-flash 0.9s ease;
}

@keyframes v2-path-flash {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(192, 75, 37, 0);
  }
  30% {
    box-shadow: 0 0 0 4px rgba(192, 75, 37, 0.55);
  }
}

.v2 .message-preview pre {
  transition: background-color 0.4s ease;
}

.v2 .message-preview pre.v2-updated {
  background-color: rgba(192, 75, 37, 0.14);
}

.v2 #goal-count.v2-near-limit {
  color: var(--rt-orange);
  font-weight: 700;
}

/* ---- Language switch: soft crossfade of the content ---- */
.v2 main {
  transition: opacity 0.18s ease;
}

.v2 main.v2-lang-fade {
  opacity: 0.35;
}

/* ---- Reduced motion: disable the whole layer ---- */
@media (prefers-reduced-motion: reduce) {
  .js-motion [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .v2 .process-line::before {
    transform: none !important;
  }

  .v2 details[open] > p,
  .v2 .path-option.v2-flash {
    animation: none !important;
  }

  .v2 main,
  .v2 .faq-plus,
  .v2 .choice-panel,
  .v2 .archive-item img {
    transition: none !important;
  }
}
