/* =========================================================================
   map.css — the navigation mapping

   Drawn as the board it was: a dotted field, regions with a tab on the
   corner, cards, and wires that appear only when you ask for them. The
   styling is deliberately a working-document style rather than the page's
   own — it is an artefact being shown, not a figure being designed, and it
   should look like something that was made in a room with other people.
   ========================================================================= */

.map {
  --map-field: #f1f1ef;
  --map-dot:   rgba(45, 45, 57, .19);
  --map-line:  rgba(45, 45, 57, .40);   /* a card's edge: thin, but a line  */
  --map-soft:  rgba(45, 45, 57, .16);   /* a region's edge, and the rules   */
  --map-wire:  rgba(45, 45, 57, .62);
  --map-new:   #8b66c1;                 /* the gradient's own purple        */
  --map-new-f: rgba(139, 102, 193, .10);
  --map-dim:   .22;                     /* everything the hover is not      */

  position: relative;
  background: var(--map-field);
  border-radius: var(--radius, 16px);   /* the standing rule: media rounded */
  /* A window onto the board rather than the whole thing. Cropped to roughly
     its top half: enough to read the shape of the three stages, and short
     enough that the page does not stop dead for a figure. The rest is a
     drag away. */
  height: min(472px, 62vh);
  overflow: hidden;
}

/* The pane the board is dragged inside. `pan-y` hands the vertical back to
   the browser, so a finger swiping down the page still moves the page; the
   horizontal is ours, because four columns will not fold into a phone. */
/* Nothing in here responds, so nothing in here should look as though it
   might: no grab cursor, no text selection, no pointer events reaching the
   rows. The board is a picture of a board. */
.map__view {
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Says the board continues, without putting a control on top of it. */
.map__fade {
  position: absolute; left: 0; right: 0; bottom: 0; height: 56px;
  pointer-events: none;
  background: linear-gradient(to top, var(--map-field), rgba(241, 241, 239, 0));
  opacity: 1; transition: opacity .2s ease-out;
}
.map.is-end .map__fade { opacity: 0; }

.map__board {
  position: relative;
  /* Its natural width, but never less than the window it sits in, so the
     dotted field reaches the edges instead of stopping short of them. */
  width: max-content; min-width: max(100%, 1028px);
  will-change: transform;
  display: flex; flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 20px 24px;
  /* The dots are on the board rather than the shell so they pan with it. */
  background-image: radial-gradient(circle at 1px 1px, var(--map-dot) 1px, transparent 0);
  background-size: 17px 17px;
}

/* ── the wires ───────────────────────────────────────────────────────────
   One overlay for the whole board, above the regions but under nothing that
   is clickable — it never takes a pointer, so a wire crossing a row does not
   stop you pointing at the row. */
.map__wires {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 3; pointer-events: none;
  color: var(--map-wire);
  overflow: visible;
}
.map__wires path.w {
  fill: none; stroke: currentColor; stroke-width: 1.05;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ── a region ────────────────────────────────────────────────────────────
   One of the three stages. The tab sits across the top-left corner the way
   a frame label does on a whiteboard — half on the border, not inside it. */
.map__region {
  position: relative;
  flex: none;
  padding: 21px 13px 13px;
  border: 1px solid var(--map-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, .42);
}
.map__chip {
  position: absolute; top: -11px; left: 13px;
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 3px 8px;
  border: 1px solid var(--map-line);
  border-radius: 5px;
  background: #fff;
  font-size: 12px; font-weight: 500; line-height: 1.3; color: var(--ink);
  white-space: nowrap;
}
.map__chip i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); opacity: .75;
}

/* -- the card on the board -------------------------------------------
   Its title, in the board's own hand: same white, same thin edge, same
   corner as everything else on the field. It travels with the board, so
   dragging past it is allowed - by then it has been read.

   It used to carry a key as well - a stub of wire for "became", a tinted
   square for "new in this structure", and a line saying what to do with
   the board. The board now opens with Home already traced, which shows
   all three faster than naming them did. */
.map__note {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 9px 12px;
  border: 1px solid var(--map-line); border-radius: 4px; background: #fff;
}
.map__note-t { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.map__note-t b { font-size: 12px; font-weight: 600; color: var(--ink); }
.map__note-t span { font-size: 11.5px; color: var(--muted); }

/* The four columns are sized so the whole board fits the width of the
   research boards above it (--w-mid): 4 x 212 + the paddings and gaps of the
   board, its three regions and the one split stage comes to 1028. Change any
   gap here and .map__board's min-width wants changing with it. */
.map__stages { display: flex; align-items: flex-start; gap: 24px; }
.map__cols { display: flex; align-items: flex-start; gap: 14px; }
.map__col  { display: flex; flex-direction: column; gap: 12px; width: 212px; }

/* ── a card ──────────────────────────────────────────────────────────────
   A group of destinations. White on the field, one thin edge, no shadow:
   a sticky note, not a component. */
.map__card {
  position: relative; z-index: 1;
  padding: 8px 9px 9px;
  border: 1px solid var(--map-line);
  border-radius: 4px;
  background: #fff;
}
/* The three destinations that sat at the root of the old nav with nothing
   under them. One card so they read as a set, no title because they are not
   a group — they are three loose ends. */
.map__card--head { padding: 6px 9px 7px; }

.map__name {
  font-size: 10px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase;
  line-height: 1.35; color: var(--ink);
  padding: 2px 3px; margin: -2px -3px 5px;
  border-radius: 3px;
}
/* A card whose title is the only thing in it needs no gap under the title. */
.map__name:last-child { margin-bottom: -2px; }

.map__row {
  font-size: 11.5px; line-height: 1.42; color: var(--muted);
  padding: 1px 3px; margin: 0 -3px;
  border-radius: 3px;
}
.map__row--head {
  font-size: 10px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink); line-height: 1.35; padding: 2px 3px;
}
.map__rule { height: 0; margin: 6px 0; border: 0; border-top: 1px solid var(--map-soft); }

/* Nothing upstream explains it — it arrived with the new structure rather
   than being carried into it. */
.map__row.is-new { color: var(--map-new); background: var(--map-new-f); }

/* ── pointing at something ───────────────────────────────────────────────
   The whole board steps back and the lineage stays lit, so the answer is
   the only thing with contrast on it. Rows are the readable unit, so they
   carry the dimming; the cards and regions stay put, because a board that
   rearranges itself under the pointer is no longer a board. */
/* Everything inherits the hand: the board is a thing you move, and pointing
   at a row needs no cursor of its own because it needs no click. */
.map__name, .map__row { cursor: inherit; transition: opacity .16s ease-out, background-color .16s ease-out, color .16s ease-out; }

.map.is-focus .map__name,
.map.is-focus .map__row { opacity: var(--map-dim); }
.map.is-focus .map__rule { opacity: .35; }

.map.is-focus .map__name.is-lit,
.map.is-focus .map__row.is-lit { opacity: 1; }

/* Lit, and lit-and-pointed-at. The first says "this is part of the answer";
   the second says "this is the question", and only the second is filled. */
.map__row.is-lit  { color: var(--ink); background: rgba(45, 45, 57, .055); }
.map__row.is-self,
.map__name.is-self { color: #fff; background: var(--ink); }
.map__row.is-lit.is-new { color: var(--map-new); background: var(--map-new-f); }
.map__row.is-self.is-new { color: #fff; background: var(--map-new); }

/* The card a pointed-at title belongs to, so a group reads as one thing. */
.map.is-focus .map__card:has(.is-self) { border-color: var(--ink); }


/* The key is the one thing on the board that has to be readable before you
   have panned anywhere, so it narrows as soon as the window does - well
   before the board itself changes, which only happens on a phone. */
@media (max-width: 920px) {
  /* --map-vw is the width of the window onto the board, set by map.js; the
     40px is the board's own padding on either side of the card. */
  .map__note { max-width: calc(var(--map-vw, 100%) - 40px); gap: 9px 18px; }
}

@media (max-width: 760px) {
  .map { height: min(410px, 58vh); }
  .map__board { padding: 16px 16px 18px; }
  /* On a phone the window is narrower than the card's own text wants to be,
     so it is pinned to the window rather than to its content. */
  .map__note { max-width: calc(var(--map-vw, 100%) - 32px); }
}
@media (prefers-reduced-motion: reduce) {
  .map__name, .map__row { transition: none; }
}

/* ── somebody's cursor ───────────────────────────────────────────────────
   A remote pointer of the kind a shared canvas draws for everyone in the
   room, left on the row the board is traced from. It is the one thing that
   says this is a picture of a session rather than a diagram: a person was
   here, and Home is lit because they were pointing at it.

   It lives on the board, not the shell, so it pans with the rows it points
   at. Positioned by map.js against the measured row. */
.map__cur {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  color: var(--accent, #6910e7);
  /* The tip of the arrow is the origin, the way a real cursor's is. */
  transform: translate(-1px, -1px);
  filter: drop-shadow(0 1px 2px rgba(45, 45, 57, .22));
}
.map__cur svg { display: block; }
.map__cur-n {
  position: absolute; left: 10px; top: 15px;
  padding: 2px 7px 3px;
  border-radius: 4px 4px 4px 1px;
  /* Named, not currentColor: the rule below sets this element's own colour to
     white for the text, and currentColor would resolve against that. */
  background: var(--accent, #6910e7);
  font-family: var(--font-sans);
  font-size: 11px; font-weight: 500; line-height: 1.25;
  letter-spacing: -.005em;
  color: #fff;
  white-space: nowrap;
}
