/* Shipping map: the "Ships worldwide" section of Halvard, a made-up ceramics shop, on a warm white page. One panel:
   the title and two counters on top, a dotted world map below (an SVG whose viewBox is the dot grid, so it scales
   as one piece), and an HTML layer over the map for the city buttons and their cards. */
:root {
  --page: #f4f1ea;          /* the page */
  --panel: #fbfaf6;         /* the panel */
  --edge: rgba(40, 32, 20, 0.08); /* the panel's 1px edge */
  --ink: #1c1a17;           /* the words */
  --muted: #8b857a;         /* the small words */
  --dots: #cdc6b8;          /* the dots of the land */
  --accent: #e8551e;        /* the one accent: arcs, parcels, cities */
  --card: #ffffff;          /* the city cards */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vmin, 32px);
}

/* the panel: a soft paper card with a 1px edge that catches the light on top and three layers of shadow */
.ship {
  position: relative;
  width: min(1000px, calc(100vw - 2 * clamp(10px, 3vmin, 32px)), calc((100vh - 70px) * 1.95));
  padding: clamp(14px, 2.6vmin, 34px) clamp(14px, 3vmin, 38px) clamp(12px, 2.2vmin, 26px);
  border-radius: clamp(14px, 2vmin, 22px);
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 60%),
    var(--panel);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 2px rgba(60, 45, 20, 0.05),
    0 8px 20px -8px rgba(60, 45, 20, 0.1),
    0 30px 60px -24px rgba(60, 45, 20, 0.16);
}

.ship__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.ship__brand {
  margin: 0 0 clamp(4px, 0.8vmin, 10px);
  font-size: clamp(10px, 1.3vmin, 12px);
  font-weight: 560;
  font-stretch: 112%;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.ship__title {
  margin: 0;
  font-size: clamp(20px, 4.4vmin, 44px);
  line-height: 1;
  font-weight: 640;
  font-stretch: 92%;
  letter-spacing: -0.025em;
}

.ship__sub {
  margin: clamp(4px, 0.9vmin, 10px) 0 0;
  font-size: clamp(11px, 1.6vmin, 15px);
  color: var(--muted);
}

.ship__stats {
  display: flex;
  gap: clamp(14px, 3vmin, 36px);
  margin: 0;
  flex: none;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.stat dt {
  font-size: clamp(9.5px, 1.25vmin, 12px);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.stat dd {
  margin: 0;
  font-size: clamp(17px, 3.4vmin, 32px);
  font-weight: 620;
  font-stretch: 88%;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* the rolling digits: each digit is a window one line tall with the column 0 to 9 inside it */
.odo__win {
  display: inline-block;
  height: 1em;
  overflow: hidden;
  vertical-align: top;
}
.odo__col {
  display: flex;
  flex-direction: column;
}
.odo__col > span {
  height: 1em;
  line-height: 1;
}
.odo__ch {
  display: inline-block;
  vertical-align: top;
}
.stat__num.is-bump .odo__win:last-child {
  color: var(--accent);
  transition: color 0.2s ease;
}
.odo__win {
  transition: color 0.8s ease;
}

/* the map: the dot grid is 110 by 42, so the box keeps that shape */
.map {
  position: relative;
  margin-top: clamp(10px, 2.6vmin, 30px);
  aspect-ratio: 110 / 42;
}

.map__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* the land: one path of zero length segments with round caps, one dot per grid cell */
.map__land {
  fill: none;
  stroke: var(--dots);
  stroke-linecap: round;
  stroke-width: var(--dot, 0.46);
  transition: opacity 0.4s ease;
}

.map__halo {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-width: var(--dot, 0.46);
  opacity: 0;
}

.arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: var(--line, 0.18);
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  transition: stroke-width 0.35s ease;
}
.arc--glow {
  stroke-width: calc(var(--line, 0.18) * 5);
  opacity: 0;
}

.ring {
  fill: none;
  stroke: var(--accent);
  opacity: 0;
}

.city {
  fill: var(--accent);
  stroke: var(--panel);
  stroke-width: var(--rim, 0.14);
}

.parcel {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: var(--rim, 0.14);
}

.map__home-box {
  fill: var(--ink);
}
.map__home-shadow {
  fill: var(--ink);
  opacity: 0.12;
}

/* the warehouse label beside its square */
.map__from {
  position: absolute;
  margin: 0;
  transform: translate(6px, 5px);
  font-size: clamp(9px, 1.25vmin, 12px);
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}
.map__from span {
  color: var(--ink);
  font-weight: 620;
}

/* focus: the chosen arc is drawn full and thicker, everything else steps back */
.map.is-focus .arc:not(.is-on),
.map.is-focus .city:not(.is-on) {
  opacity: 0.18 !important;
}
.map.is-focus .map__land {
  opacity: 0.7;
}
.arc,
.city {
  transition: opacity 0.35s ease, stroke-width 0.35s ease;
}
.arc.is-on {
  stroke-width: calc(var(--line, 0.18) * 1.6);
  opacity: 1 !important;
}

.map__pins {
  position: absolute;
  inset: 0;
}

/* each city: an invisible button over its dot, and the card above, beside or below it */
.pin {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pin:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}
.pin[disabled] {
  pointer-events: none;
}

/* the card's position lives on .card (CSS), the motion on .card__in (GSAP) */
.card {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  transform: translate(-50%, calc(-100% - 12px));
}
.card--l {
  transform: translate(calc(-100% - 12px), -50%);
}
.card--r {
  transform: translate(12px, -50%);
}
.card--b {
  transform: translate(-50%, 12px);
}

.card__in {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: clamp(6px, 1vmin, 10px);
  padding: clamp(6px, 1vmin, 10px) clamp(9px, 1.4vmin, 14px) clamp(7px, 1.1vmin, 11px) clamp(7px, 1vmin, 10px);
  border-radius: clamp(8px, 1.1vmin, 12px);
  background: var(--card);
  box-shadow:
    inset 0 0 0 1px rgba(40, 32, 20, 0.07),
    0 1px 1px rgba(60, 45, 20, 0.06),
    0 6px 16px -6px rgba(60, 45, 20, 0.18),
    0 18px 30px -18px rgba(60, 45, 20, 0.22);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
}

.card__ic {
  grid-row: span 2;
  width: clamp(22px, 3vmin, 30px);
  height: clamp(22px, 3vmin, 30px);
  border-radius: clamp(6px, 0.8vmin, 8px);
  background: color-mix(in srgb, var(--accent) 10%, #fff);
  display: grid;
  place-items: center;
}
.card__ic svg {
  width: 62%;
  height: 62%;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.card__tick {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.card__name {
  font-size: clamp(11px, 1.6vmin, 15px);
  font-weight: 640;
  font-stretch: 96%;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.card__line {
  font-size: clamp(9.5px, 1.3vmin, 12.5px);
  color: var(--muted);
  line-height: 1.25;
}
.card__line b {
  font-weight: 600;
  color: var(--ink);
}
.card__name,
.card__line {
  display: block;
}

.ship__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px clamp(8px, 1.4vmin, 14px);
  margin-top: clamp(8px, 2vmin, 22px);
  padding-top: clamp(8px, 1.6vmin, 16px);
  border-top: 1px solid var(--edge);
  font-size: clamp(9.5px, 1.3vmin, 12.5px);
  color: var(--muted);
}
.ship__sep {
  width: 1px;
  height: 0.9em;
  background: rgba(40, 32, 20, 0.14);
}

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  pointer-events: none;
  fill: var(--ink);
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(40, 30, 10, 0.3));
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}

@media (max-width: 560px) {
  .ship__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .ship__stats {
    width: 100%;
  }
  .stat {
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .ship__foot span:nth-child(n + 4) {
    display: none;
  }
}
