/* The Map tab (village_sheet.rs, world_map.rs): the realm's chart (map.css) lies across both pages
   of the book (ui.css, "The book": `.across`), the island inked on the paper. On the verso the
   compass and what a lost fight costs, by how far from home; on the recto the zoom and Home,
   and the slip of what is picked (a territory with its way there, or a village). A place's card
   is a pop beside it while it is pointed at (village_panel.rs places it). */
.map-body {
  .map-stage { position: absolute; inset: 0; overflow: hidden; }
  /* The pages' bodies hold their parts where they lie, over the chart. */
  .page-body { position: relative; overflow: visible; }
}
/* The compass rose, at one size whatever the zoom, at the verso's head. */
.map-body .map-compass { position: absolute; left: -4px; top: 0; width: 64px; pointer-events: none; }
/* What a lost fight costs, by how far from home: each fate's seal as the chart stamps it. */
.map-body .stakes-legend {
  position: absolute; left: 0; bottom: 0; display: grid; gap: 4px;
  > h3 { font: 600 10.5px/1 var(--face); letter-spacing: 0.22em; text-transform: uppercase; color: var(--sumi-faint); }
  > .lede { margin: 0 0 6px; }
  ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
  li { display: flex; align-items: center; gap: 10px; font: 400 14.5px/1.2 var(--face); color: var(--sumi-soft); }
  .seal-pic { flex: none; width: 26px; height: 26px; overflow: visible; }
  .stakes-wound { color: var(--vermilion-ink); }
}
/* The zoom and Home: word buttons on the paper at the recto's head. */
.map-body .map-tools {
  position: absolute; top: -4px; right: 0; display: flex; align-items: center; gap: 2px;
  .btn { display: grid; place-items: center; height: 30px; min-width: 30px; padding: 0 10px; font: 700 11px/1 var(--face);
    letter-spacing: 0.2em; text-transform: uppercase; box-shadow: inset 0 0 0 1px var(--sumi-line); color: var(--sumi-soft); }
  .btn:is(:first-child, :nth-child(2)) { padding: 0; font-size: 18px; letter-spacing: 0; }
  .btn:last-child { color: var(--accent-on-paper); }
  .btn::after { display: none; }
  .btn:hover:not(:disabled) { color: var(--sumi); background: var(--sumi-wash); }
}

/* The slip of what is picked (village_sheet.rs, `map_card`): a sheet laid on the recto's foot. */
.map-body .map-card {
  position: absolute; right: -14px; bottom: 6px; width: 340px;
  animation: pop-in 0.16s ease-out;
  &[hidden] { display: none; }
  > .cta { margin-top: 16px; }
  > .problem { margin: 12px 0 0; font-size: 14px; }
}

/* A place's card, on the slip and in its pop: its picture and name, then its facts. */
.map-body :is(.map-card, .map-tip) {
  .card-head { display: flex; align-items: center; gap: 12px; padding: 0 0 10px; }
  .card-title { display: flex; flex-direction: column; gap: 4px; min-width: 0;
    small { font: 600 10.5px/1.1 var(--face); letter-spacing: 0.16em; text-transform: uppercase; }
  }
  .emblem-pic { flex: none; width: 58px; height: 58px; overflow: visible; }
  .seal-pic { flex: none; width: 44px; height: 44px; overflow: visible; }
  .biome { margin: 8px 0 0; font-size: 14px; line-height: 1.4; }
  .biome b { margin-right: 6px; font-weight: 600; }
  .danger { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; font: 600 16px/1.2 var(--face); }
  .meter-pic { flex: none; height: 15px; width: auto; overflow: visible; }
  .facts { display: grid; gap: 6px; margin: 10px 0 0; padding: 10px 0 0; list-style: none; }
  .facts li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
  .facts svg { flex: none; width: 16px; height: 16px; }
  .facts b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
  .facts .stakes { padding-left: 24px; font-weight: 600; }
}
/* On the slip: sumi on washi, the name in the serif, the stakes in their inks on paper. */
.map-body .map-card {
  .card-head { border-bottom: 1px solid var(--sumi-line); }
  .card-title b { font: 600 26px/1.1 var(--face); color: var(--sumi); overflow-wrap: anywhere; }
  .card-title small { color: var(--sumi-faint); }
  .card-title .home { color: var(--gold-ink); }
  .card-title .here { color: var(--accent-on-paper); }
  .biome { color: var(--sumi-faint); font-style: italic; }
  .biome b { font-style: normal; color: var(--azure-ink); font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; }
  .danger { color: var(--sumi); }
  .danger-jail { color: var(--gold-ink); }
  .danger-wound { color: var(--vermilion-ink); }
  .facts { border-top: 1px solid var(--sumi-line); }
  .facts li { color: var(--sumi-soft); }
  .facts svg { color: var(--sumi-faint); }
  .facts b { color: var(--sumi); }
  .facts .stakes { color: var(--sumi); }
  .facts .stakes-safe { font-weight: 400; color: var(--sumi-soft); }
  .facts .stakes-wound { color: var(--vermilion-ink); }
}
/* A place's pop beside it while it is pointed at, away from the stage's nearer edges
   (village_panel.rs places it and turns it west or up). It takes no pointer, so the map keeps
   it. The page's pops let what is under them through; over the paper that would show through
   their words, so these stand on ink. */
.map-body .book > .map-tips { position: relative; z-index: 3; grid-area: 1 / 1 / 2 / -1; pointer-events: none; }
.map-body .map-tip {
  position: absolute; z-index: 3; width: 300px; padding: 12px 14px 12px 16px; pointer-events: none; background-color: var(--ink);
  --tx: 34px; --ty: -34px; transform: translate(var(--tx), var(--ty)); animation: pop-in 0.14s ease-out;
  &.west { --tx: calc(-100% - 34px); }
  &.up { --ty: calc(-100% + 34px); }
  &[hidden] { display: none; }
  .card-head { border-bottom: 1px solid var(--line); }
  .card-title b { font: 600 19px/1.15 var(--face); color: var(--paper-bright); overflow-wrap: anywhere; }
  .card-title small { color: var(--muted); }
  .card-title .home { color: var(--accent-hi); }
  .card-title .here { color: var(--jade-hi); }
  .biome { color: var(--muted); }
  .biome b { color: var(--paper); }
  .danger { color: var(--paper-bright); }
  .danger-jail { color: var(--gold-hi); }
  .danger-wound { color: var(--vermilion-hi); }
  .meter .rung { fill: none; stroke: var(--muted); }
  .meter-jail .rung.on { fill: var(--gold); stroke: var(--gold); }
  .meter-wound .rung.on { fill: var(--vermilion); stroke: var(--vermilion); }
  .facts { border-top: 1px solid var(--line); }
  .facts svg { color: var(--muted); }
  .facts .of { color: var(--muted); }
  .facts .why { font-size: 13px; color: var(--muted); }
  .facts .stakes { color: var(--paper); }
  .facts .stakes-safe { font-weight: 400; color: var(--muted); }
  .facts .stakes-wound { color: var(--vermilion-hi); }
}
@media (max-height: 800px) {
  .map-body .map-card { width: 320px; padding: 14px 18px 16px;
    .card-head { padding-bottom: 6px; }
    .card-title b { font-size: 20px; }
    .seal-pic { width: 36px; height: 36px; }
    .emblem-pic { width: 46px; height: 46px; }
    .facts { gap: 4px; margin-top: 6px; padding-top: 6px; }
    .danger { margin-top: 6px; }
    /* The seal's words say it already. */
    .facts .stakes { display: none; }
    > .cta { margin-top: 10px; }
  }
  .map-body .stakes-legend li { font-size: 13.5px; }
  .map-body .map-compass { width: 52px; }
}
