/* Island locator: Anna Maria Island with numbered places.
   Markup: src/_includes/partials/island-locator.njk. Catalog entry and limits:
   docs/design/component-patterns.md -> Island locator. Linked by the planning-guide layout for a place-look guide.
   Values are Waterline scale literals (scripts/enforcement/waterline-tokens.test.js).
   Link colour, hover colour and the focus ring come from the page. */

/* ---- Key map: the island, a marker per place, a key of names ---- */
.isl-map { --isl-w: min(190px, 46vw); min-width: 0; padding-top: 24px; border-top: 1px solid #1b1b1b; }
.isl-plot { position: relative; box-sizing: border-box; display: grid; grid-template-columns: var(--isl-w) minmax(0, 1fr); column-gap: 16px; margin: 0 0 32px 16px; }
.isl-stage { position: relative; align-self: start; width: 100%; aspect-ratio: 560 / 1000; }
.isl-island { display: block; width: 100%; height: 100%; }
.isl-island path { fill: #CAD4CF; stroke: #1b1b1b; stroke-width: 6; stroke-linejoin: round; }

.isl-water { position: absolute; color: #52676A; font: italic 400 16px/1.3 "Instrument Serif", Georgia, serif; white-space: nowrap; }
.isl-gulf { left: 0; top: 58%; }
.isl-bay { right: 0; top: 13%; }
.isl-pass { right: 0; top: 100%; margin-top: 8px; }

.isl-scale { position: absolute; left: 0; top: 84%; display: flex; align-items: center; gap: 8px; width: 100%; color: #52676A; font: 400 12px/1.4 Inter, system-ui, sans-serif; }
.isl-scale i { position: relative; flex: none; width: calc(var(--m) * 100%); height: 8px; border: solid #1b1b1b; border-width: 0 1px; }
.isl-scale i::before { content: ""; position: absolute; left: 0; right: 0; top: 3px; border-top: 1px solid #1b1b1b; }
.isl-north { position: absolute; top: 0; right: 0; display: grid; justify-items: center; gap: 4px; color: #52676A; font: 500 12px/1 Inter, system-ui, sans-serif; }
.isl-north svg { display: block; fill: #1b1b1b; }

/* Phones: the key is a column of rows beside the island. Each marker belongs to its
   link and is placed over the island from the link's --fx and --fy. */
.isl-key { display: flex; flex-direction: column; min-width: 0; }
.isl-link { display: flex; flex: 1 0 auto; align-items: center; box-sizing: border-box; min-height: 48px; padding: 8px 0; border-top: 1px solid #CAD4CF; text-decoration: none; }
.isl-link:first-child { border-top: 0; }
.isl-txt { display: flex; flex-direction: column; gap: 2px; transform-origin: left center; transition: transform 120ms cubic-bezier(.23,1,.32,1); }
.isl-n { color: #A4533E; font: 500 12px/1.4 Inter, system-ui, sans-serif; letter-spacing: .13em; }
.isl-name { font: 400 20px/1.15 "Instrument Serif", Georgia, serif; }
.isl-link:active .isl-txt { transform: scale(.97); }

.isl-dot {
  position: absolute;
  left: calc(var(--fx) * var(--isl-w));
  top: calc(var(--fy) * var(--isl-w) * 1000 / 560);
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 2px solid #1b1b1b;
  border-radius: 50%;
  background: #1B1B1B;
}
.isl-dot::before { content: attr(data-n); display: grid; place-items: center; height: 100%; color: #ffffff; font: 600 12px/1 Inter, system-ui, sans-serif; }
/* The ring is ink, so the marker reads over the pale island and over the paper (8:1 and 10:1);
   the lit marker adds a second ink ring outside it. */
.isl-link:focus-visible .isl-dot { outline: 2px solid #1b1b1b; outline-offset: 2px; }

.isl-credit { display: flex; flex-wrap: wrap; align-items: center; color: #52676A; font: 400 12px/1.4 Inter, system-ui, sans-serif; white-space: pre; }
.isl-credit a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* Wide screens: each name sits at its place's latitude, joined to its marker by a rule.
   The switch follows the viewport, as the guide layout's does, and the map is then
   504px wide: it needs a column at least that wide. The px values assume the 560 by
   1000 outline (island-locator.test.js holds the data to it). */
@media (min-width: 1050px) {
  .isl-map { width: 504px; }
  .isl-plot { display: block; width: 503.6px; margin: 0 0 32px; padding-left: 190px; }
  .isl-stage { width: 313.6px; height: 560px; }
  .isl-water { font-size: 17px; }
  .isl-key { position: absolute; inset: 0; display: block; }
  .isl-link { position: absolute; left: 0; top: calc(var(--fy) * 100% - 22px); width: 170px; height: 44px; min-height: 44px; padding: 0; justify-content: flex-end; border-top: 0; }
  .isl-link::after { content: ""; position: absolute; left: 100%; top: 50%; width: calc(var(--fx) * 313.6px + 6px); height: 1px; background: #CAD4CF; transition: background-color 200ms cubic-bezier(.23,1,.32,1); }
  .isl-txt { flex-direction: row; align-items: baseline; gap: 12px; transform-origin: right center; }
  .isl-name { font-size: 22px; white-space: nowrap; }
  .isl-dot { left: calc(190px + var(--fx) * 313.6px); top: 50%; }
  .isl-dot::before { content: none; }
  .isl-credit { justify-content: flex-end; }
}

/* A name and its marker answer each other. */
@media (hover: hover) and (pointer: fine) {
  .isl-link:hover .isl-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
  .isl-link:hover .isl-dot { outline: 2px solid #1b1b1b; outline-offset: 2px; }
  .isl-link:hover::after { background: #1b1b1b; }
}
@media (prefers-reduced-motion: reduce) {
  .isl-txt, .isl-link::after { transition: none; }
  .isl-link:active .isl-txt { transform: none; }
}

/* ---- Inset: the island with one place lit ---- */
.isl-inset { display: block; width: 120px; height: auto; }
.isl-inset path { fill: #F5F5F5; stroke: #1b1b1b; stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.isl-other { fill: #52676A; }
.isl-own { fill: #1B1B1B; stroke: #1b1b1b; stroke-width: 2; vector-effect: non-scaling-stroke; }
@media (min-width: 900px) {
  .isl-inset { width: 160px; }
}
