/* ------------------------------------------------------------------
   Kedge Line — chart surface
   Canvas layers, world labels, dock markers, instruments.
   ------------------------------------------------------------------ */

.chart {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 100% at 50% 40%, #cdb68f 0%, #b89e74 70%, #a88d63 100%);
  touch-action: none;
  cursor: none;
}

.chart[data-mode="docked"] {
  cursor: default;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Static art lives in world space and is moved with CSS, so panning is free. */
.layer-static,
.layer-landmarks {
  inset: auto;
  left: 0;
  top: 0;
  height: 1000px;
  transform-origin: 0 0;
}

.layer-static {
  width: 2030px;
}

.layer-landmarks {
  width: 1600px;
}

.layer-static {
  background: #e7d8b8;
  /* The sheet edge and its shadow are painted into the canvas itself, so the
     layer only ever has to be composited, never re-rastered. */
}

.layer-landmarks {
  opacity: 0.94;
}

/* the chart border, drawn in screen space so it never clips */
.chart::after {
  content: "";
  position: absolute;
  inset: clamp(8px, 1.2vw, 18px);
  z-index: 20;
  pointer-events: none;
  border: 1px solid rgba(43, 35, 24, 0.42);
  box-shadow:
    inset 0 0 0 5px transparent,
    inset 0 0 0 6px rgba(43, 35, 24, 0.16),
    inset 0 0 160px rgba(86, 64, 36, 0.28);
}

/* --- world labels ------------------------------------------------ */

.layer-labels {
  z-index: 11;
}

.label {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  color: var(--ink-soft);
  font-family: var(--display-sc);
  font-size: 17px;
  letter-spacing: 0.2em;
  line-height: 1;
  opacity: 0.92;
  /* a paper halo, so type sits on the sheet and does not float above it */
  text-shadow:
    0 0 1px rgba(235, 220, 186, 0.95),
    0 0 3px rgba(235, 220, 186, 0.85),
    0 0 6px rgba(235, 220, 186, 0.55),
    0 0.6px 0 rgba(43, 35, 24, 0.13);
  will-change: transform;
}

.label--sea {
  font-family: var(--display);
  font-style: italic;
  font-size: 21px;
  letter-spacing: 0.06em;
  color: rgba(61, 51, 36, 0.72);
}

.label--place {
  color: var(--ink);
}

.label--warning {
  font-size: 13px;
  letter-spacing: 0.16em;
  color: rgba(74, 61, 44, 0.62);
}

.label--home {
  color: var(--oxblood);
}

.label small {
  display: block;
  margin-top: 5px;
  font-family: var(--display);
  font-style: italic;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  text-transform: none;
  color: var(--ink-faint);
}

/* --- dock markers ------------------------------------------------ */

.layer-markers {
  z-index: 12;
  pointer-events: none;
}

.label--landmark {
  font-family: var(--display-sc);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(64, 50, 32, 0.72);
  white-space: nowrap;
}

.marker {
  position: absolute;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.marker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--oxblood);
  box-shadow: 0 0 0 3px rgba(226, 208, 171, 0.75);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease);
}

.marker::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid transparent;
  border-radius: 50%;
  transition: border-color 180ms var(--ease);
}

.marker:hover::before,
.marker:focus-visible::before {
  transform: scale(1.45);
  box-shadow: 0 0 0 4px rgba(226, 208, 171, 0.9);
}

.marker:hover::after,
.marker:focus-visible::after {
  border-color: rgba(121, 48, 42, 0.4);
}

/* The boat sits on the berth it belongs to, so the marker would read as a
   ring on the deck. Hide it while docked; the open cartouche names the place. */
.marker[data-current="true"] {
  visibility: hidden;
  transition: visibility 0s linear 180ms;
}

/* --- instruction ------------------------------------------------- */

.instruction {
  position: absolute;
  left: 50%;
  bottom: 5.5%;
  z-index: 15;
  margin: 0;
  transform: translateX(-50%);
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  pointer-events: none;
  opacity: 0;
  transition: opacity 500ms var(--ease);
}

.instruction[data-visible="true"] {
  opacity: 0.85;
}

/* --- instruments ------------------------------------------------- */

.instruments {
  position: fixed;
  top: clamp(10px, 1.8vh, 22px);
  right: clamp(10px, 1.8vw, 26px);
  z-index: 25;
  display: grid;
  justify-items: center;
  gap: 2px;
  pointer-events: none;
}

.compass {
  width: clamp(72px, 8vw, 104px);
  height: auto;
  overflow: visible;
  opacity: 0.9;
}

.compass-needle {
  transform-box: view-box;
  transform-origin: 60px 60px;
}

.wind {
  margin: 0;
  font-family: var(--display-sc);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}

.wind-label {
  opacity: 0.6;
  margin-right: 4px;
}

/* --- responsive -------------------------------------------------- */

@media (max-width: 720px) {
  .tagline {
    display: none;
  }

  .label {
    font-size: 15px;
  }

  .label--sea {
    font-size: 18px;
  }

  .label small {
    font-size: 11.5px;
  }

  .instruction {
    bottom: 12%;
    font-size: 13px;
  }

  .instruments {
    top: clamp(8px, 1.4vh, 16px);
    right: clamp(10px, 3vw, 18px);
  }

  .compass {
    width: 58px;
  }

  .wind {
    font-size: 10px;
  }
}

/* landscape phones: the cartouche sits beside the chart, so drop the instruments */
@media (max-height: 520px) {
  .instruments {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .compass-needle,
  .marker::before,
  .instruction {
    transition: none;
  }
}
