/* Merriweather (SIL OFL), self-hosted so the page has no external requests */
@font-face {
  font-family: "Merriweather";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/merriweather-latin-300-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Merriweather";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/merriweather-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Merriweather";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/merriweather-latin-700-normal.woff2") format("woff2");
}

:root {
  --navy: #16213a;
  --ink: #121d36;
  --slate: #4a5f7a;
  --soft: #566b86;
  --red: #c8102e;
  --page: #f1f6f8;
  --panel-a: #f5fafc;
  --panel-b: #e5eff2;
  --serif: "Merriweather", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--page);
  color: var(--navy);
  font-family: var(--serif);
  line-height: 1.4;
}

/* ---------- Card + stage ---------- */
.card {
  container-type: inline-size;
  width: 100%;
  /* keep the whole card inside the viewport height (stage aspect = 1075 / 752) */
  max-width: max(760px, min(1700px, calc((100dvh - 56px) * 1.4295 + 24px)));
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(160deg, var(--panel-a), var(--panel-b));
  box-shadow: 0 1px 2px rgba(22, 33, 58, 0.06), 0 18px 50px -12px rgba(22, 33, 58, 0.28);
}

.stage {
  position: relative;
  aspect-ratio: 1075 / 752;
  overflow: hidden;
  border-radius: 6px;
}

.map {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

.copy {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3.7cqw 4cqw 3.3cqw;
  pointer-events: none;
}

/* ---------- Copy ---------- */
.eyebrow {
  margin: 0;
  font-size: max(10px, 1cqw);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.intro {
  max-width: 19em;
  margin: 0.6cqw 0 0;
  font-size: max(11px, 1.2cqw);
  font-weight: 300;
  color: var(--slate);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  margin: 1.5cqw 0 0;
  padding: 0.5em 1em;
  border: 1px solid rgba(200, 16, 46, 0.3);
  border-radius: 999px;
  background: #fff;
  color: var(--red);
  font-size: max(9.5px, 0.88cqw);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status-dot {
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  background: var(--red);
  animation: blink 1.8s ease-in-out infinite;
}

.accent {
  display: block;
  width: 2.4cqw;
  height: 2px;
  margin-bottom: 1.6cqw;
  background: #cf3b36;
}

h1 {
  margin: 0;
  font-size: max(20px, 2.85cqw);
  font-weight: 400;
  line-height: 1.28;
  letter-spacing: -0.005em;
}

h1 .light {
  display: block;
  font-weight: 300;
  color: #566c88;
}

h1 .strong {
  display: block;
  color: var(--ink);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 1.8cqw;
  width: 52cqw;
  margin-top: 2.3cqw;
  padding-top: 1.5cqw;
  border-top: 1px solid rgba(22, 33, 58, 0.2);
}

.stat p { margin: 0; }

.label {
  font-size: max(10px, 0.98cqw);
  font-weight: 700;
  color: var(--soft);
}

.value {
  margin: 0.55cqw 0 0.2cqw !important;
  font-size: max(17px, 2.5cqw);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ap {
  margin-left: 0.15em;
  font-size: 0.52em;
  color: var(--soft);
}

.sub {
  font-size: max(10px, 1cqw);
  color: var(--soft);
}

/* ---------- Map ---------- */
.grid line { stroke: #b6c9d4; stroke-width: 1; opacity: 0.55; }

.grid-labels text { font-size: 11px; }
.grid-labels .lon { fill: #7a9dc0; }
.grid-labels .lat { fill: #a39a88; }

.land {
  fill: none;
  stroke: #96a5ba;
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.88;
}

.rings circle { fill: none; stroke: #8fa1b8; stroke-opacity: 0.26; stroke-width: 1; }
.rings .disc { fill: #fff; fill-opacity: 0.16; stroke: none; }

.sweep path { fill: url(#sweep-fill); stroke: none; }
.sweep .edge { fill: none; stroke: #6c7b91; stroke-width: 1; stroke-opacity: 0.8; }
.sweep { animation: breathe 7s ease-in-out infinite; }

.bearing circle { fill: #1f2d4a; }

.route {
  fill: none;
  stroke: #d95a55;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}
.route:nth-child(2) { animation-delay: 0.5s; }
.route:nth-child(3) { animation-delay: 0.7s; animation-duration: 2.6s; }
.route:nth-child(n + 4) { animation-delay: 1.1s; }

.port {
  fill: #f6fafc;
  stroke: #223255;
  stroke-width: 1.5;
  animation: pop 0.5s ease-out 0.4s both;
}

.home-ring { fill: #fff; fill-opacity: 0.6; stroke: #8b9db6; stroke-width: 1.5; }
.home-dot { fill: #d94841; }
.pulse {
  fill: none;
  stroke: #d94841;
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: ping 2.6s ease-out infinite;
}

.home-label {
  font-size: 12px;
  fill: #2a3b5c;
  paint-order: stroke;
  stroke: #eaf3f6;
  stroke-width: 4px;
  stroke-linejoin: round;
}
.home-label .b { font-weight: 700; }

.compass .c-ring { fill: none; stroke: #a9bccb; stroke-width: 1; }
.compass .c-ring.faint { stroke-opacity: 0.55; }
.compass .c-ticks { fill: none; stroke: #a9bccb; stroke-width: 1; }
.compass .c-ew { fill: #d3dbe5; }
.compass .c-s { fill: #c3ccd8; }
.compass .c-n { fill: #98a4b5; }
.compass .c-n-shade { fill: #6f7d92; fill-opacity: 0.55; }
.compass .c-label { font-size: 10px; font-weight: 700; fill: #7d8da3; }

.frame .outline { fill: none; stroke: #9db3c3; stroke-width: 1; stroke-opacity: 0.8; }
.frame .ticks { fill: none; stroke: #9db3c3; stroke-width: 1; }
.frame .ticks.major { stroke: #7f9ab0; }

/* ---------- Animations ---------- */
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
@keyframes ping {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.8); }
}
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.72; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.port { transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .route { stroke-dashoffset: 0; }
}

/* ---------- Tablet / phone: copy stacks above the map ---------- */
@media (max-width: 899px) {
  body { padding: 10px; place-items: start center; }

  .card { max-width: 720px; padding: 8px; }

  .stage {
    aspect-ratio: auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .copy {
    position: static;
    padding: 18px 14px 6px;
    gap: 28px;
  }

  .map {
    position: static;
    width: 100%;
    height: auto;
    aspect-ratio: 1075 / 752;
    border-radius: 6px;
  }

  .eyebrow { font-size: 0.7rem; }
  .intro { margin-top: 8px; font-size: 0.85rem; }
  .status { margin-top: 14px; font-size: 0.65rem; }
  .accent { width: 28px; margin-bottom: 14px; }
  h1 { font-size: clamp(1.45rem, 6.4vw, 2.1rem); }

  .stats {
    width: 100%;
    margin-top: 22px;
    padding-top: 16px;
    gap: 16px 14px;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  }

  .label { font-size: 0.7rem; }
  .value { margin: 6px 0 3px !important; font-size: clamp(1.15rem, 5.2vw, 1.6rem); }
  .sub { font-size: 0.7rem; }
}

@media (max-width: 639px) {
  .grid-labels, .home-label { display: none; }
}
