/* The skill tree's Journeys panel: the list, its rows, the “+” dropdown,
   the highlight share and the specular sweep. Split out of
   css/skilltree.css along its own section banners. */
/* ============ Journeys ============ */
/* The panel is a child of the viewport, not of the board, so the board's
   pan/zoom transform never touches it. It floats over the canvas as a pane of
   dark glass: the tree stays readable underneath, while the blur and the tint
   keep the headings and rows legible over whatever the board draws behind
   them. The pane has no edge of its own — no outline, no shadow, square
   corners — and its tint is the canvas colour itself, so over an empty stretch
   of board there is nothing to see. The offsets and the padding are chosen so
   the copy still starts 16px in from the frame, as it did when the panel had no
   chrome. */
.st-journeys {
  /* Claimed lessons and the padlocks still to come. The green is its own
     value rather than --success: the list wants a bright, legible lime on
     near-black, not the softer tone the chrome uses. */
  --st-done: #abff0f;
  --st-done-ink: #101010;
  --st-locked: #555555;
  --st-lock-ink: #5a5a5a;
  --st-step-ring: #515151;
  position: absolute;
  top: 6px;
  left: 6px;
  /* 244px of content, plus the 10px of padding on each side. */
  width: 264px;
  max-height: calc(100% - 12px);
  padding: 10px;
  display: flex;
  flex-direction: column;
  cursor: default;
  z-index: 7;
  overflow: hidden;
  /* --sh-bg at less than full strength: over bare board it resolves to the
     board's own colour, so the pane only announces itself where something is
     actually passing behind it. */
  background: rgba(20, 20, 20, 0.68);
  /* Bright edges and the dots behind the pane melt into the tint instead of
     crawling under the type. */
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

/* Edit mode's one panel control. The panel has no chrome of its own and no
   fold: the journeys are always on show. */
.st-journeys-head {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 0;
}

.st-viewport.st-editing .st-journeys-head { display: flex; }

.st-journeys-new {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-secondary);
  font-family: inherit;
  cursor: pointer;
}

.st-journeys-new:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.st-journeys-new .material-symbols-outlined {
  font-size: 16px;
}

.st-journeys-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* The page's scrollbar track would paint a solid strip inside the glass. */
.st-journeys-list::-webkit-scrollbar-track { background: transparent; }

/* In edit mode the control sits above the first heading instead of over it. */
.st-viewport.st-editing .st-journeys-list { padding-top: 26px; }

.st-journey {
  flex-shrink: 0;
}

.st-journey + .st-journey { margin-top: 12px; }

/* A heading is type, not a button: a chevron, the title, and air. */
.st-journey-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 0;
  background: none;
  border-radius: 3px;
  color: var(--text-primary);
  cursor: pointer;
}

/* The big circle beside the heading is the commitment control: checking it is
   what puts the journey in the Lessons rail. It is deliberately larger than
   the 16px rings on the journey's steps, so choosing a whole journey reads as
   a bigger act than ticking off one lesson. The chevron only unfolds the list
   in this panel. */
.st-journey-check {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  background: none;
  border: 2px solid var(--st-step-ring);
  border-radius: 50%;
  color: transparent;
  font-family: inherit;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.st-journey-check .material-symbols-outlined {
  font-size: 14px;
  line-height: 1;
}

.st-journey-check:hover {
  border-color: #ffffff;
}

.st-journey-check:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.st-journey.selected .st-journey-check {
  background: var(--journey);
  border-color: var(--journey);
  color: #1a1a1a;
}

.st-journey-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 21px;
  font-size: 20px;
  color: #f5f5f5;
  /* The glyph's advance is a hair wider than the box; without this the head
     is 2px wider than the panel and the list grows a horizontal scrollbar
     under the last journey. */
  overflow: hidden;
  transition: transform 150ms ease;
}

/* The chevron's own disclosure mark: it turns to point down while the journey
   is unfolded here. It no longer follows the checked state. */
.st-journey.expanded .st-journey-arrow { transform: rotate(90deg); }

.st-journey-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #f5f5f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-journey-pencil {
  display: none;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.st-journey-pencil:hover { color: var(--text-primary); }
.st-viewport.st-editing .st-journey-pencil { display: inline-block; }

.st-journey-title-input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 3px;
  color: #ffffff;
  font-family: var(--font-ui);
  font-size: 20px;
  padding: 1px 6px;
  outline: none;
  text-transform: none;
}

.st-journey-steps {
  margin: 0;
  padding: 0 0 4px;
  background: none;
  border: 0;
  border-radius: 0;
}

/* A journey is only a headline until its chevron is clicked: the one that is
   unfolded shows its lessons and the rest stay shut. Unfolding is separate
   from checking, so the checked row can stay folded and the rail still holds
   its lessons. */
.st-journey:not(.expanded) .st-journey-steps {
  display: none;
}

.st-journey-step {
  display: flex;
  align-items: center;
  gap: 15px;
  height: 30px;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1;
  color: #ffffff;
}

.st-journey-step.done { color: var(--st-done); }
.st-journey-step.locked { color: var(--st-locked); }

.st-journey-step-empty {
  height: auto;
  padding: 6px 0;
  font-style: italic;
  color: var(--text-muted);
}

/* The one mark a row carries: a green check once claimed, an empty ring while
   it is available, and a dim padlock while its prerequisites are missing. */
.st-journey-step-mark {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--st-step-ring);
  border-radius: 50%;
  font-size: 11px;
  color: transparent;
}

.st-journey-step.done .st-journey-step-mark {
  background: var(--st-done);
  border-color: var(--st-done);
  color: var(--st-done-ink);
}

.st-journey-step.locked .st-journey-step-mark {
  background: none;
  border-color: var(--st-step-ring);
  color: var(--st-lock-ink);
  font-size: 10px;
}

.st-journey-step-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Removing a lesson straight from the list: offered in edit mode only, and
   only while the row is under the pointer, so the panel stays quiet. */
.st-journey-step-remove {
  display: none;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.st-viewport.st-editing .st-journey-step:hover .st-journey-step-remove { display: flex; }

/* ---- Reordering ---- */
.st-viewport.st-editing .st-journey-step { cursor: grab; }

.st-journey-step.st-journey-step-dragging {
  background: var(--bg-hover);
  border-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  opacity: 0.9;
}

body.st-journey-dragging,
body.st-journey-dragging .st-journey-step { cursor: grabbing; }
body.st-journey-dragging { user-select: none; }

.st-journey-step-remove:hover {
  background: var(--danger);
  color: #fff;
}

.st-journey-foot {
  display: flex;
  margin-top: 2px;
  background: none;
  border: 0;
  border-radius: 0;
}

.st-journey-add {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 4px 0 4px 2px;
  background: none;
  border: 0;
  border-radius: 3px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.st-journey-add:hover {
  background: none;
  color: var(--text-primary);
}

.st-journey-add .material-symbols-outlined { font-size: 14px; }

.st-journey-empty {
  padding: 10px 8px;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  color: var(--text-muted);
}

/* ---- The "+" dropdown ---- */
.st-journey-menu {
  position: absolute;
  width: 216px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  background: var(--bg-light);
  border: 1px solid var(--cardBorders);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  cursor: default;
  z-index: 11;
  overflow: hidden;
}

.st-journey-menu-head {
  padding: 7px 9px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.st-journey-menu-list {
  overflow-y: auto;
  max-height: 150px;
  padding: 0 4px 2px;
  flex-shrink: 1;
}

.st-journey-menu-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 6px;
  background: none;
  border: 0;
  border-radius: 3px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.st-journey-menu-item:hover { background: var(--bg-hover); }

.st-journey-menu-item .st-journey-step-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.st-journey-menu-item .st-journey-step-num {
  flex-shrink: 0;
  width: 14px;
  text-align: center;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.st-journey-menu-item .material-symbols-outlined { font-size: 14px; }

.st-journey-menu-item.danger { color: var(--danger); }

.st-journey-menu-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-journey-menu-cat {
  flex-shrink: 0;
  font-size: 9px;
  color: var(--text-muted);
}

.st-journey-menu-x { color: var(--text-muted); }

.st-journey-menu-empty {
  padding: 2px 6px 6px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--text-muted);
}

.st-journey-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
  flex-shrink: 0;
}

/* ---- Highlight ---- */
.st-card.journey {
  border-color: var(--journey);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--journey) 30%, transparent), 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* The next lesson of the selected journey: gold hugging the card, then a gap
   of bare board, then a slim white ring. The ring is an outline rather than
   another shadow because a shadow spread paints everything up to its edge —
   that is what made the mark a thick white band. outline-offset is the gap. */
.st-card.journey.next-step {
  outline: 2px solid #ffffff;
  outline-offset: 9px;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--journey) 30%, transparent),
    0 4px 14px rgba(0, 0, 0, 0.45);
}

.st-card.journey-dim { opacity: 0.15; }
.st-card.journey-dim:hover { opacity: 0.4; }

.st-journey-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--journey);
  color: #1a1a1a;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  z-index: 3;
}

/* ---- Specular sweep ---- */
/* The shine is the artist's own 30-frame loop, not a drawn one. The frames are
   luminance only, so they are baked into one strip of white with their
   brightness moved into the alpha channel (assets/anim/shine/shine-strip.png),
   and that strip is painted over the card: where a frame is bright the card
   gets white light laid on it, and the card's own colour still shows through
   underneath. Sliding the strip across with steps(30) is a frame-perfect
   flipbook the compositor runs on its own — nothing in the page ticks per
   frame. */
.st-sheen {
  /* The card's disc: .st-card is 52px across, border included. The clipping
     layer is drawn over the whole disc rather than inside its border, so the
     gloss crosses the rim the way a highlight would. */
  --st-sheen-frame: 52px;
  /* How many frames the strip holds. This is the only number a re-rendered
     shine has to agree with, so it lives in one place; the travelling reel and
     the step count both read it. tools/build-shine-strip.py prints the count it
     baked. */
  --st-sheen-frames: 30;
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

/* The reel: the whole thirty-frame strip on one element that is thirty frames
   wide, slid across the disc a frame at a time so whatever frame is under the
   window is the frame you see. Two choices in here matter. It is slid with
   transform rather than by moving the image, because a transform can be handed
   to the compositor while a moving background or mask is repainted by the main
   thread on every frame. And the strip is a background image rather than a
   mask, because masks are fetched in CORS mode: opened off the filesystem, the
   page's origin is null and the mask request is refused, which made the whole
   sweep silently disappear. A background image is an ordinary subresource and
   loads either way. */
.st-sheen-reel {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--st-sheen-frame) * var(--st-sheen-frames));
  height: var(--st-sheen-frame);
  background-image: url(../assets/anim/shine/shine-strip.png?v=13b438a2);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  will-change: transform;
  animation: st-sheen-frames 1000ms steps(var(--st-sheen-frames)) var(--sd, 0ms) forwards;
}

/* Thirty steps of one frame each. The travel is thirty frames wide, so every
   step lands on a frame boundary and the last one puts frame thirty under the
   window; the layer is taken out as the animation ends. */
@keyframes st-sheen-frames {
  from { transform: translateX(0); }
  to { transform: translateX(calc(var(--st-sheen-frame) * var(--st-sheen-frames) * -1)); }
}

/* Light sweeping the board is decoration, not information: nobody who has
   asked their machine to hold still wants it. */
@media (prefers-reduced-motion: reduce) {
  .st-sheen { display: none; }
}

@keyframes st-journey-dash {
  to { stroke-dashoffset: -36; }
}

/* ============ Reset ============ */
.st-reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 24px;
  padding: 0;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 3px;
  cursor: pointer;
}

.st-reset-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.st-reset-btn .material-symbols-outlined {
  font-size: 15px;
}
