/* Route guide (guide.js). Uses the site tokens defined on :root in styles.css. */

.guide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 520px);
  column-gap: clamp(32px, 4vw, 64px);
  align-items: start;
  color: var(--text);
  font-size: 17px;
  line-height: 1.6;
}

/* ---------- stage ---------- */
.guide__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  padding: 88px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.guide__readout {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 48px;
  align-items: flex-end;
}
.gread { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.gread__k { font-size: 14px; line-height: 1.3; color: var(--dim); }
.gread__v {
  font-family: var(--head);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.g-ft { font-size: 17px; color: var(--mut); margin-left: 8px; }

.guide__map {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--soft);
}
.guide__map .guide__canvas { position: absolute; inset: 0; }
.guide__canvas .maplibregl-canvas { outline: none; }

.gmap-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border-radius: var(--r);
}
.gmap-toggle button {
  font: 500 14px/1 var(--head);
  color: var(--mut);
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 0 12px;
  min-height: 32px;
  cursor: pointer;
}
.gmap-toggle button:hover { color: var(--ink); }
.gmap-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--on); }
.gmap-toggle button:focus-visible,
.gmap-attr__btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.gmap-attr {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
  max-width: 100%;
}
.gmap-attr__txt {
  display: block;
  background: rgba(12, 15, 18, .82);
  color: var(--mut);
  font-size: 14px;
  line-height: 1.35;
  padding: 4px 10px;
  border-top-right-radius: var(--r);
}
.gmap-attr__btn { display: none; }

.gmap-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.gmap-label__t {
  background: var(--bg);
  color: var(--ink);
  font: 500 14px/1.2 var(--head);
  padding: 3px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
.gmap-label__d { width: 2px; height: 10px; background: var(--ink); }
.gmap-label.is-hidden { visibility: hidden; }

.guide__chart { flex: 0 0 210px; min-height: 0; position: relative; }
.guide--nomap .guide__map { display: none; }
.guide--nomap .guide__chart { flex: 1 1 auto; max-height: 420px; }

.gchart { display: block; overflow: visible; }
.gchart text { font-family: var(--head); font-size: 13px; }
.gchart__grid line { stroke: var(--line); stroke-width: 1; }
.gchart__grid .gchart__v { stroke: var(--line); opacity: .6; }
.gchart__ax { fill: var(--dim); }
.gchart__t { fill: var(--mut); font-variant-numeric: tabular-nums; }
.gchart__name { fill: var(--ink); font-weight: 500; }
.gchart__line { fill: none; stroke: var(--dim); stroke-width: 1.5; stroke-linejoin: round; }
.gchart__done { fill: none; stroke: var(--red); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.gchart__dot { fill: var(--dim); }
.gchart__dot.is-done { fill: var(--red); }
.gchart__mark { fill: var(--red); stroke: var(--bg); stroke-width: 3; }

/* ---------- steps ---------- */
.guide__steps { padding: 88px 0 45vh; min-width: 0; }

.gstep {
  margin: 0 0 22vh;
  opacity: .45;
  transition: opacity .3s ease;
}
.gstep.is-on { opacity: 1; }
.gstep h3,
.gphase {
  font-family: var(--head);
  font-weight: 500;
  font-size: 26px;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 8px;
}
.gstep__meta { font-size: 15px; line-height: 1.5; color: var(--mut); margin: 0 0 20px; }
.gstep p { margin: 0 0 16px; }
.gstep__lead { color: var(--ink); }
.gstep__lead strong { font-weight: 600; }
.gstep h4 {
  font-family: var(--head);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  margin: 24px 0 6px;
}
.gstep ul { margin: 0 0 16px; padding-left: 20px; }
.gstep li { margin: 0 0 6px; }
.gstep li::marker { color: var(--dim); }
.gstep__fig { margin: 0 0 20px; }
.gstep__fig img { display: block; width: 100%; height: auto; border-radius: var(--r); background: var(--soft); }
.gstep__fig figcaption { font-size: 14px; line-height: 1.45; color: var(--dim); margin-top: 8px; }
.gstep--end { margin-bottom: 0; }

.gphase {
  margin: 0 0 22vh;
  padding-top: 20px;
  border-top: 1px solid var(--line2);
}

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .guide { grid-template-columns: minmax(0, 1fr); }
  .guide__stage {
    top: 64px;
    z-index: 3;
    height: 46vh;
    height: 46svh;
    padding: 8px 0 6px;
    gap: 6px;
    background: var(--bg);
  }
  .guide__readout { gap: 4px 20px; align-items: baseline; }
  .gread { flex-direction: row; align-items: baseline; gap: 6px; }
  .gread:first-child .gread__k {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .gread__v { font-size: 17px; }
  .g-ft { font-size: 15px; margin-left: 6px; }
  .gmap-toggle { top: 6px; right: 6px; }
  .gmap-toggle button { min-height: 30px; padding: 0 10px; }
  .gmap-attr { left: auto; right: 6px; bottom: 6px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
  .gmap-attr__btn {
    display: block;
    order: 2;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 4px;
    background: var(--bg);
    color: var(--mut);
    font: 500 15px/30px var(--head);
    padding: 0;
    cursor: pointer;
  }
  .gmap-attr__txt { display: none; border-radius: 4px; max-width: calc(100vw - 60px); }
  .gmap-attr.is-open .gmap-attr__txt { display: block; }
  .guide__chart { flex: 0 0 96px; }
  .guide__steps { padding: 28px 0 40vh; }
  .gstep { margin-bottom: 14vh; }
  .gstep h3, .gphase { font-size: 22px; }
  .gphase { margin-bottom: 14vh; }
}

@media (prefers-reduced-motion: reduce) {
  .gstep { transition: none; }
}
