/* Route banner: a miniature map of all 106 N5 kanji under the header, walked by a small 3D Mikasa.
   Look borrowed from Kotoba Path (tactile stops, dotted track, handwritten labels) in the Nara palette. */
@font-face {
  font-family: "Nara Hand";
  src: url("../assets/fonts/caveat.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

.route-banner {
  --rb-h: 140px;
  --rb-stop: 42px;
  position: relative;
  height: var(--rb-h);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(rgba(52, 82, 91, .14) .5px, transparent .6px) 0 0 / 6px 6px,
    linear-gradient(180deg, #fbfcfa, #f3f7f4);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.route-scroll {
  position: absolute;
  inset: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  cursor: grab;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent);
}
.route-scroll::-webkit-scrollbar { display: none; }
.route-scroll.is-dragging { cursor: grabbing; }

.route-map { position: relative; height: 100%; }

/* map regions, one per category */
.route-zone {
  position: absolute;
  top: 10px;
  bottom: 10px;
  border-radius: 22px;
  background: var(--zone, #e8eff2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7);
}
.route-zone::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(rgba(255, 255, 255, .55) .7px, transparent .8px) 0 0 / 7px 7px;
  pointer-events: none;
}
.route-zone-label {
  position: absolute;
  z-index: 1;
  left: 16px;
  top: 4px;
  font: 600 19px/1 "Nara Hand", "Segoe Print", cursive;
  color: var(--zone-ink, var(--ink-soft));
  white-space: nowrap;
}
.route-zone-label small {
  margin-left: 6px;
  font: 700 9px var(--utility);
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .7;
}

.route-track { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.route-line { fill: none; stroke: rgba(25, 125, 121, .3); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 0 10; }
.route-line.is-walked { stroke: rgba(199, 151, 71, .75); }

/* a milestone where each category begins */
.route-milestone {
  position: absolute;
  width: 15px;
  height: 15px;
  margin: -7.5px 0 0 -7.5px;
  border: 3px solid var(--gold);
  border-radius: 4px;
  background: #fffaf0;
  transform: rotate(45deg);
  pointer-events: none;
}

/* a stop: a chunky, pressable button like Kotoba Path's nodes */
.route-stop {
  position: absolute;
  width: var(--rb-stop);
  height: calc(var(--rb-stop) * .92);
  margin: calc(var(--rb-stop) * -.46) 0 0 calc(var(--rb-stop) * -.5);
  padding: 0;
  display: grid;
  place-items: center;
  border: 2px solid #d3e3e4;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 5px 0 #c8dadb;
  color: var(--ink-soft);
  font: 600 calc(var(--rb-stop) * .5)/1 var(--serif);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .2s, border-color .2s, color .2s;
}
.route-stop:hover { transform: translateY(-2px); box-shadow: 0 7px 0 #c8dadb; }
.route-stop:active { transform: translateY(4px); box-shadow: 0 1px 0 #c8dadb; }
.route-stop:focus-visible { outline: 3px solid rgba(25, 125, 121, .4); outline-offset: 4px; }
.route-stop.is-seen { border-color: #a9d0ca; background: #e4f2ef; color: var(--teal-dark); box-shadow: 0 5px 0 #a9cdc6; }
.route-stop.is-current {
  z-index: 2;
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  box-shadow: 0 5px 0 var(--teal-dark);
}
.route-stop.is-current::before {
  content: "";
  position: absolute;
  inset: -9px;
  border: 4px solid rgba(25, 125, 121, .26);
  border-radius: 50%;
  animation: route-ring 1.8s ease-out infinite;
}
@keyframes route-ring { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.28); opacity: 0; } }
.route-stop.is-practice::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--coral);
}

/* handwritten meaning under the current stop */
.route-caption {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, 0);
  padding: 1px 9px 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .86);
  font: 600 17px/1.1 "Nara Hand", "Segoe Print", cursive;
  color: var(--teal-dark);
  white-space: nowrap;
  pointer-events: none;
  transition: left .25s ease, top .25s ease;
}

/* Mikasa: a small 3D canvas over the map; the 2D pin is the fallback without WebGL */
.route-mikasa { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.route-pin {
  position: absolute;
  z-index: 3;
  width: 22px;
  height: 22px;
  margin: -30px 0 0 -11px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: var(--coral);
  transform: rotate(-45deg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
  pointer-events: none;
}

@media (max-width: 720px) {
  .route-banner { --rb-h: 116px; --rb-stop: 36px; }
  .route-zone-label { font-size: 17px; left: 12px; }
  .route-caption { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .route-stop.is-current::before { animation: none; opacity: .6; }
  .route-caption { transition: none; }
}
