/* The lake map: a drawn map of Flathead Lake with a pin for each project.
   Written to drop into the site as it is (it uses the site's --head, --body, and --ink).

   Two drawings, one per frame in pins.json: a 2 to 1 band for screens 700 and up, and the
   lake alone, upright, for phones. render.py draws both; build.py places the pins on each
   (--x and --y on the band, --xm and --ym on the phone drawing), so pins and art always agree. */

.lake-map {
  --lm-paper: #f2eee5;    /* the sheet the map is printed on; render.py uses the same */
  --lm-water: #2f3e4b;
  --lm-pin: #b8432b;      /* brick red */
  margin: 0;
  background: var(--lm-paper);
}
.lm-box {
  position: relative;
  max-width: 1680px;      /* past this the sheet's own colour carries on either side */
  margin: 0 auto;
  aspect-ratio: var(--lm-ratio, 2);
}
.lm-art, .lm-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Placeholder until the art arrives */
.lm-art.is-empty {
  border: 1px dashed rgba(6, 6, 6, .25);
  display: grid;
  place-items: center;
  font: 400 13px/1.4 var(--body);
  color: rgba(6, 6, 6, .45);
}

.lm-pins { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; }
.lm-pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 1;
}
.lm-pin:hover, .lm-pin:focus-within, .lm-pin.is-open { z-index: 2; }

/* The link is the 44 px tap area, centred on the spot */
.lm-pin > a {
  position: absolute;
  left: -22px;
  top: -22px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.lm-pin > a:focus-visible { outline: 2px solid #fff; outline-offset: -4px; box-shadow: 0 0 0 2px var(--ink, #060606) inset; }

/* The pin: the one warm colour on the sheet, so a home is never mistaken for a town's black dot.
   Small at rest; under the pointer it swells to about a mile and a half across on the map, so it
   marks an area and never a house (Jeremy, 3 Dec: "perfect size for hover, not for static", then "static size can go up a bit"). */
.lm-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--lm-pin);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px 1px rgba(0, 0, 0, .4);
  transition: width .2s ease, height .2s ease, border-width .2s ease;
}
.lm-pin > a:hover .lm-dot,
.lm-pin > a:focus-visible .lm-dot,
.lm-pin.is-open .lm-dot { width: 30px; height: 30px; border-width: 3px; }

/* On a project page the map shows where you are and what is left to see (lake-map.js adds the classes):
   the home you are on is an ink dot, a home you have already opened is hollow, and the rest stay solid red. */
.lm-pin.is-here .lm-dot { background: var(--ink, #060606); }
.lm-pin.is-seen .lm-dot { background: #fff; border-color: var(--lm-pin); }

/* The pin's name, always showing (Jeremy, 3 Dec: "label the dots"). build.py says which side of the
   pin it sits on and whether that spot is land or water (data-lab on the band, data-labm on the
   phone sheet): ink on land, paper white on water, each with a soft edge of the ground's own
   colour so it reads where a river or a shoreline runs under it. */
.lm-label {
  position: absolute;
  top: 50%;
  left: calc(50% + 17px);
  transform: translateY(-50%);
  white-space: nowrap;
  font: 400 11px/1 var(--head);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink, #060606);
  text-shadow: 0 0 2px var(--lm-paper), 0 0 2px var(--lm-paper), 0 0 4px var(--lm-paper), 0 0 6px var(--lm-paper);
}
@media (min-width: 700px) {
  .lm-pin[data-lab~="left"] .lm-label { left: auto; right: calc(50% + 17px); }
  .lm-pin[data-lab~="water"] .lm-label { color: #fff; text-shadow: 0 0 2px var(--lm-water), 0 0 2px var(--lm-water), 0 0 4px var(--lm-water), 0 0 6px var(--lm-water); }
}

/* The card: the home's photo over its name, a square. No town on it: the caption under the map
   says the pins show areas, and the homeowners' places stay vague. */
.lm-tip {
  position: absolute;
  left: 50%;
  bottom: calc(50% + 21px);
  --tx: -50%;
  --ty: 4px;
  transform: translate(var(--tx), var(--ty));
  display: flex;
  flex-direction: column;
  width: 180px;
  height: 180px;
  background: #fff;
  color: var(--ink, #060606);
  box-shadow: 0 3px 16px rgba(0, 0, 0, .3);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}
.lm-photo {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  object-fit: cover;
  background: #e9e6df;
}
.lm-name {
  flex: none;
  display: block;
  padding: 9px 10px 10px;
  font: 400 13px/1.3 var(--head);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.lm-name::after { content: " \2192"; font-family: var(--body); }
.lm-pin > a:hover .lm-tip,
.lm-pin > a:focus-visible .lm-tip,
.lm-pin.is-open .lm-tip { opacity: 1; --ty: 0px; pointer-events: auto; }   /* the card is part of the link, so it can be clicked too */

/* The card opens above its pin (below only by the top edge) and away from a near side. build.py sets data-tip for the band
   and data-tipm for the phone drawing. */
@media (min-width: 700px) {
  .lm-pin[data-tip~="down"] .lm-tip { bottom: auto; top: calc(50% + 21px); --ty: -4px; }
  .lm-pin[data-tip~="left"] .lm-tip { left: 4px; --tx: 0px; }
  .lm-pin[data-tip~="right"] .lm-tip { left: auto; right: 4px; --tx: 0px; }
}

.lake-map figcaption {
  padding: 0 16px 14px;
  text-align: center;
  font: 400 13px/1.5 var(--body);
  color: rgba(6, 6, 6, .7);
}

/* Phones: the upright drawing and its own pin places */
@media (max-width: 699px) {
  .lm-box { aspect-ratio: var(--lm-ratio-m, .53); }
  .lm-pin { left: var(--xm); top: var(--ym); }
  .lm-label { font-size: 9.5px; left: calc(50% + 15px); }
  .lm-pin[data-labm~="left"] .lm-label { left: auto; right: calc(50% + 15px); }
  .lm-pin[data-labm~="water"] .lm-label { color: #fff; text-shadow: 0 0 2px var(--lm-water), 0 0 2px var(--lm-water), 0 0 4px var(--lm-water), 0 0 6px var(--lm-water); }
  .lm-tip { width: 150px; height: 150px; }
  .lm-name { font-size: 12px; padding: 7px 8px 8px; }
  .lm-pin[data-tipm~="down"] .lm-tip { bottom: auto; top: calc(50% + 21px); --ty: -4px; }
  .lm-pin[data-tipm~="left"] .lm-tip { left: 4px; --tx: 0px; }
  .lm-pin[data-tipm~="right"] .lm-tip { left: auto; right: 4px; --tx: 0px; }
}

@media (prefers-reduced-motion: reduce) {
  .lm-dot, .lm-tip { transition: none; }
}

/* The satellite version (design option B): one upright poster, black sheet and all, in the
   middle of the page. Its pins sit inside the poster's map, which build.py reads from art/sat.json. */
.lake-map-sat { background: none; }
.lake-map-sat .lm-box { max-width: 860px; box-shadow: 0 10px 40px rgba(0, 0, 0, .28); }
.lake-map-sat .lm-pins { inset: auto; left: var(--sat-l); top: var(--sat-t); width: var(--sat-w); height: var(--sat-h); }
.lake-map-sat figcaption { padding-top: 14px; }
.lake-map-sat .lm-pin .lm-label { color: #fff; text-shadow: 0 0 2px #000, 0 0 3px #000, 0 1px 5px #000; }
@media (max-width: 699px) {   /* the poster is small on a phone, so its pins and names are too */
  .lake-map-sat .lm-dot { width: 13px; height: 13px; }
  .lake-map-sat .lm-pin .lm-label { font-size: 8.5px; left: calc(50% + 11px); }
  .lake-map-sat .lm-pin[data-labm~="left"] .lm-label { left: auto; right: calc(50% + 11px); }
}

/* ---------------------------------------------------------------------------------------------
   Site only (not in ../design-review/lake-map/lake-map.css): the home page's "Where we've built"
   section around the map. Everything above this line is copied unchanged from the design folder.
   The section sits in the page's flow at every width, so its height comes from what's in it.
   No space above the heading: the quote section before it ends in plenty of its own.
   --------------------------------------------------------------------------------------------- */
.home-map { background: #fff; padding-top: 0; overflow-x: hidden; overflow-x: clip; }   /* a hidden label by a pin near the edge must not widen the page */
.home-map .mid { position: static; width: auto; max-width: 780px; margin: 0 auto; padding: 0 20px; }
.home-map .lead { margin-top: 14px; margin-bottom: 46px; max-width: 560px; font: 400 16px/1.79 var(--body); }
/* While Rye chooses (Jeremy, 3 Dec: "Put the other map directly under the current map so Rye can see both"):
   the two versions one under the other, each with a small name over it. When he has picked, take the
   other figure, its .opt line, and these rules out. */
.home-map .opt { margin: 0; padding: 0 20px 14px; text-align: center; font: 400 14px/1.4 var(--head); text-transform: uppercase; letter-spacing: .12em; }
.home-map .lake-map + .opt { padding-top: 64px; }
.home-map .lake-map-sat { padding: 0 20px 80px; }

@media (max-width: 699px) {
  .home-map { padding-top: 10px; }
  .home-map h2 { font: 28px/1.25 var(--head); }   /* the phone size of "Who we are" */
  .home-map .lead { margin-top: 10px; margin-bottom: 22px; font-size: 14px; }
  .home-map .opt { font-size: 12px; padding-bottom: 10px; }
  .home-map .lake-map + .opt { padding-top: 36px; }
  .home-map .lake-map-sat { padding: 0 10px 44px; }
}

/* The same map at the foot of each project page (tools/build-pages.py puts it there), so a visitor can
   hop to a home they haven't seen. lake-map.js marks the home they are on and the ones already opened. */
.pj-map { background: #fff; overflow-x: hidden; overflow-x: clip; }
.pj-map h2 { margin: 0; padding: 0 20px 14px; }
.pj-map .lead { margin: 0 auto 46px; padding: 0 20px; max-width: 560px; text-align: center; font: 400 16px/1.79 var(--body); }

@media (max-width: 699px) {
  .pj-map h2 { font: 28px/1.25 var(--head); padding-bottom: 10px; }
  .pj-map .lead { margin-bottom: 22px; font-size: 14px; }
}
