/**
 * Appily Fifty — Route Beacon (track & support)
 * New layout: asymmetric hero + horizontal lookup command
 * + horizontal route map + result board + link strip
 */

.page-track-route {
  --route-ink: #111a17;
  --route-mid: #1b2a24;
  --route-paper: #FFFEF9;
  --route-mist: #EEF2EC;
  --route-chart: #C5D93D;
  --route-clay: #A65D3F;
  --route-line: rgba(17, 26, 23, 0.12);
  --route-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --route-snap: cubic-bezier(0.34, 1.4, 0.64, 1);
  background:
    radial-gradient(900px 360px at 100% 0%, rgba(197, 217, 61, 0.1), transparent 55%),
    radial-gradient(700px 300px at 0% 40%, rgba(166, 93, 63, 0.07), transparent 50%),
    var(--route-paper);
}
.page-track-route .page-main {
  padding-top: 0;
  overflow-x: clip;
}
.a50-route { padding-bottom: 0; }

/* Hero */
.a50-route-hero {
  position: relative;
  color: #f5f8f4;
  padding: clamp(2.4rem, 5vw, 3.6rem) 0 clamp(2.6rem, 4.5vw, 3.4rem);
  overflow: hidden;
  isolation: isolate;
}
.a50-route-hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(125deg, #0e1614 0%, #1b2a24 52%, #243038 100%);
}
.a50-route-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(197, 217, 61, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(197, 217, 61, 0.07) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(90deg, #000 25%, transparent 90%);
  animation: a50RouteGrid 16s linear infinite;
}
@keyframes a50RouteGrid {
  to { transform: translateX(-38px); }
}
.a50-route-beam {
  position: absolute;
  top: -25%;
  right: -8%;
  width: 46%;
  height: 150%;
  background: linear-gradient(160deg, rgba(197, 217, 61, 0.22), transparent 58%);
  clip-path: polygon(32% 0, 100% 0, 100% 100%, 0 100%);
  animation: a50RouteBeam 8s var(--route-ease) infinite alternate;
}
@keyframes a50RouteBeam {
  from { opacity: .5; transform: translateX(0); }
  to { opacity: 1; transform: translateX(-3%); }
}

.a50-route-hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 1.5rem;
  align-items: end;
}
.a50-route-kicker {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}
.a50-route-hero-copy h1 {
  margin: 0 0 0.9rem;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #fff;
  max-width: 14ch;
}
.a50-route-hero-copy h1 em {
  font-style: italic;
  color: var(--route-chart);
}
.a50-route-lede {
  margin: 0;
  max-width: 40ch;
  color: rgba(255, 255, 255, 0.76);
  font-size: 1.02rem;
}

.a50-route-hero-meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}
.a50-route-meter {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.9rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  clip-path: polygon(0 0, 100% 0, 100% 82%, 88% 100%, 0 100%);
  backdrop-filter: blur(8px);
  animation: a50RouteRise 0.7s var(--route-ease) both;
}
.a50-route-meter:nth-child(2) { animation-delay: 0.08s; }
.a50-route-meter:nth-child(3) { animation-delay: 0.16s; }
@keyframes a50RouteRise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.a50-route-meter span {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.a50-route-meter strong {
  font-family: var(--a50-font-serif);
  font-size: 1.35rem;
  color: #fff;
}
.a50-route-meter--state.is-found {
  background: rgba(197, 217, 61, 0.14);
  border-color: rgba(197, 217, 61, 0.4);
}
.a50-route-meter--state.is-found strong { color: var(--route-chart); }
.a50-route-meter--state.is-miss {
  background: rgba(166, 93, 63, 0.18);
  border-color: rgba(166, 93, 63, 0.45);
}
.a50-route-meter--state.is-miss strong { color: #f0b29a; }

/* Command form */
.a50-route-command {
  margin-top: -1.25rem;
  position: relative;
  z-index: 4;
  padding-bottom: 0.5rem;
}
.a50-route-form {
  display: grid;
  grid-template-columns: auto 1.1fr 1.1fr auto;
  gap: 0.85rem;
  align-items: end;
  background: #fff;
  border: 1px solid var(--route-line);
  box-shadow: 0 18px 48px rgba(17, 26, 23, 0.1);
  padding: 1.1rem 1.15rem;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 1.5% 100%);
}
.a50-route-form-copy h2 {
  margin: 0.2rem 0 0;
  font-size: 1.15rem;
}
.a50-route-form-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--route-clay);
}
.a50-route-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.a50-route-field span {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a50-muted);
}
.a50-route-field input {
  border: 1px solid var(--route-line);
  background: var(--route-paper);
  padding: 0.75rem 0.85rem;
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.a50-route-field input:focus {
  border-color: var(--route-ink);
  box-shadow: 0 0 0 3px rgba(197, 217, 61, 0.3);
}
.a50-route-form-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.a50-route-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.8rem 1.15rem;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  clip-path: polygon(6% 0, 100% 0, 94% 100%, 0 100%);
  transition: transform 0.25s var(--route-snap), background 0.2s ease, color 0.2s ease;
}
.a50-route-btn--primary {
  background: var(--route-ink);
  color: #fff;
}
.a50-route-btn--primary:hover {
  background: var(--route-chart);
  color: var(--route-ink);
  transform: translateY(-2px);
}
.a50-route-btn--ghost {
  background: var(--route-mist);
  color: var(--route-ink);
}
.a50-route-btn--ghost:hover {
  background: #e2e8e1;
  transform: translateY(-2px);
}

/* Route map */
.a50-route-map {
  padding: 2rem 0 1.25rem;
}
.a50-route-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.a50-route-map-head h2 {
  margin: 0;
  font-size: 1.4rem;
}
.a50-route-pill {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  background: var(--route-mist);
  color: var(--route-ink);
}
.a50-route-pill.is-found {
  background: rgba(197, 217, 61, 0.25);
  color: #4d5f12;
}
.a50-route-pill.is-miss {
  background: rgba(166, 93, 63, 0.18);
  color: var(--route-clay);
}

.a50-route-stops {
  list-style: none;
  margin: 0;
  padding: 1.35rem 0.5rem 0.5rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  position: relative;
  background: #fff;
  border: 1px solid var(--route-line);
  box-shadow: 0 16px 40px rgba(17, 26, 23, 0.06);
}
.a50-route-rail {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 2.35rem;
  height: 3px;
  background: rgba(17, 26, 23, 0.08);
  z-index: 0;
  overflow: hidden;
}
.a50-route-rail-fill {
  display: block;
  height: 100%;
  width: calc(var(--route-pct, 0) * 1%);
  background: linear-gradient(90deg, var(--route-chart), var(--route-clay));
  transition: width 1.1s var(--route-ease);
}
.a50-route-stop {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 1.6rem 0.85rem 0.9rem;
  min-height: 150px;
  transition: transform 0.35s var(--route-ease), background 0.3s ease;
}
.a50-route-stop-num {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 0.45rem;
  font-family: var(--a50-font-serif);
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--route-mist);
  color: var(--route-ink);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(17, 26, 23, 0.12);
  transition: background 0.3s ease, color 0.3s ease, transform 0.35s var(--route-snap), box-shadow 0.3s ease;
}
.a50-route-stop strong {
  font-size: 0.95rem;
  line-height: 1.25;
}
.a50-route-stop-place {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--route-clay);
}
.a50-route-stop small {
  color: var(--a50-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}
.a50-route-stop.is-done .a50-route-stop-num,
.a50-route-stop.is-current .a50-route-stop-num {
  background: var(--route-ink);
  color: var(--route-chart);
  box-shadow: 0 0 0 2px rgba(197, 217, 61, 0.45);
}
.a50-route-stop.is-current {
  background: linear-gradient(180deg, rgba(197, 217, 61, 0.12), transparent);
}
.a50-route-stop.is-current .a50-route-stop-num {
  transform: scale(1.12);
  animation: a50RoutePulse 1.8s ease infinite;
}
@keyframes a50RoutePulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(197, 217, 61, 0.45); }
  50% { box-shadow: 0 0 0 7px rgba(197, 217, 61, 0.12); }
}
.a50-route-stop.is-muted {
  opacity: 0.55;
}
.a50-route-stops.is-found .a50-route-stop.is-done,
.a50-route-stops.is-found .a50-route-stop.is-current {
  animation: a50RouteRise 0.55s var(--route-ease) both;
  animation-delay: calc(var(--stop-i, 0) * 0.08s);
}

/* Result board */
.a50-route-board {
  padding: 0.5rem 0 2.5rem;
}
.a50-route-result,
.a50-route-empty {
  background: #fff;
  border: 1px solid var(--route-line);
  box-shadow: 0 18px 48px rgba(17, 26, 23, 0.07);
  padding: clamp(1.25rem, 3vw, 1.85rem);
  animation: a50RouteRise 0.55s var(--route-ease);
}
.a50-route-result-head {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1.35rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--route-line);
}
.a50-route-result-badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--route-clay);
  margin-bottom: 0.35rem;
}
.a50-route-result-head h2 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}
.a50-route-result-head p {
  margin: 0;
  color: var(--a50-muted);
  font-weight: 700;
}

.a50-route-progress-ring {
  --pct: 0;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(closest-side, #fff 76%, transparent 77% 100%),
    conic-gradient(var(--route-chart) calc(var(--pct) * 1%), rgba(17, 26, 23, 0.08) 0);
  animation: a50RouteSpinIn 1s var(--route-ease);
}
@keyframes a50RouteSpinIn {
  from { filter: saturate(0.4); transform: scale(0.9); }
  to { filter: none; transform: scale(1); }
}
.a50-route-progress-ring strong {
  display: block;
  font-family: var(--a50-font-serif);
  font-size: 1.25rem;
  line-height: 1;
}
.a50-route-progress-ring span {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a50-muted);
}

.a50-route-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}
.a50-route-stat {
  background: var(--route-mist);
  padding: 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-left: 3px solid var(--route-chart);
}
.a50-route-stat--wide { grid-column: 1 / -1; }
.a50-route-stat span {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a50-muted);
}
.a50-route-stat strong {
  font-size: 1.02rem;
  color: var(--route-ink);
  word-break: break-word;
}
.a50-route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.a50-route-empty {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.15rem;
  align-items: start;
}
.a50-route-empty h2 {
  margin: 0 0 0.45rem;
  font-size: 1.45rem;
}
.a50-route-empty p {
  margin: 0 0 1rem;
  color: var(--a50-muted);
  max-width: 50ch;
}
.a50-route-empty-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  background: var(--route-ink);
  color: var(--route-chart);
  font-size: 1.4rem;
  font-weight: 800;
  clip-path: polygon(12% 0, 100% 0, 88% 100%, 0 100%);
}
.a50-route-empty--miss .a50-route-empty-mark {
  background: var(--route-clay);
  color: #fff;
}
.a50-route-empty-mark--pulse {
  animation: a50RoutePulse 1.8s ease infinite;
}
.a50-route-tips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.a50-route-tips li {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  font-size: 0.9rem;
  color: var(--route-ink);
}
.a50-route-tips span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--route-mist);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--route-clay);
}

/* Links */
.a50-route-links {
  background: var(--route-ink);
  color: #f4f7f2;
  padding: 2.25rem 0;
  position: relative;
  overflow: hidden;
}
.a50-route-links::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(110deg, transparent 40%, rgba(197, 217, 61, 0.1)),
    repeating-linear-gradient(-18deg, transparent 0 16px, rgba(255,255,255,0.02) 16px 17px);
  pointer-events: none;
}
.a50-route-links-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}
.a50-route-link {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 110px;
  transition: transform 0.3s var(--route-snap), background 0.25s ease, border-color 0.25s ease;
}
.a50-route-link:hover {
  transform: translateY(-4px);
  background: rgba(197, 217, 61, 0.14);
  border-color: rgba(197, 217, 61, 0.4);
}
.a50-route-link span {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--route-chart);
}
.a50-route-link strong {
  font-size: 1rem;
  color: #fff;
}
.a50-route-link small {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.8rem;
  line-height: 1.4;
}
.a50-route-link--wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  min-height: auto;
}

@media (prefers-reduced-motion: reduce) {
  .a50-route-grid,
  .a50-route-beam,
  .a50-route-meter,
  .a50-route-stop.is-current .a50-route-stop-num,
  .a50-route-empty-mark--pulse,
  .a50-route-progress-ring,
  .a50-route-stops.is-found .a50-route-stop.is-done,
  .a50-route-stops.is-found .a50-route-stop.is-current,
  .a50-route-result,
  .a50-route-empty {
    animation: none !important;
  }
}

@media (max-width: 980px) {
  .a50-route-hero-grid,
  .a50-route-form {
    grid-template-columns: 1fr;
  }
  .a50-route-hero-meters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .a50-route-stops {
    grid-template-columns: 1fr 1fr;
    padding-top: 1rem;
  }
  .a50-route-rail { display: none; }
  .a50-route-links-grid {
    grid-template-columns: 1fr 1fr;
  }
  .a50-route-form-actions { justify-content: stretch; }
  .a50-route-form-actions .a50-route-btn { flex: 1; }
}

@media (max-width: 640px) {
  .a50-route-hero-meters,
  .a50-route-stops,
  .a50-route-stats,
  .a50-route-links-grid {
    grid-template-columns: 1fr;
  }
  .a50-route-empty {
    grid-template-columns: 1fr;
  }
  .a50-route-result-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .a50-route-link--wide {
    flex-direction: column;
    align-items: flex-start;
  }
}
