/* Trade Node holding page.
   The page is a chart of the Strait: the Selat mark sits at the exact centre of the screen, its node
   is the fixed point, and the content sits in the two open seas with the mark's 180° symmetry:
   the name upper left (right-aligned to the mark), the particulars lower right (left-aligned). */

@font-face {
  font-family: "Public Sans"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/public-sans-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Public Sans"; font-style: italic; font-weight: 400 700; font-display: swap;
  src: url("/fonts/public-sans-italic.woff2") format("woff2");
}

:root {
  --ground: #f2f5f2; --block: #14352f; --node: #b3852c;
  --heading: #14352f; --ink: #1e2826; --muted: #50625e; --label: #5f716c; --rule: #d6dfda;
  --m: clamp(300px, min(60svh, 44vw), 620px);
  --gap: clamp(28px, 3.4vw, 56px);
  --pad: max(20px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0f201c; --block: #1d3f37; --node: #b3852c;
    --heading: #eef3ef; --ink: #e3ebe8; --muted: #a3b6b0; --label: #8aa19a; --rule: #24403a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh; background: var(--ground); color: var(--ink);
  font: 400 16px/26px "Public Sans", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--heading); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--heading); outline-offset: 4px; border-radius: 1px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ the chart */

.stage {
  position: relative; min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) calc(var(--m) / 2) calc(var(--m) / 2) minmax(0, 1fr);
  grid-template-rows: minmax(var(--gap), 1fr) calc(var(--m) / 2) calc(var(--m) / 2) minmax(calc(var(--gap) + 64px), 1fr);
  padding-inline: var(--pad);
}

.mark { grid-column: 2 / 4; grid-row: 2 / 4; position: relative; margin: 0; }
.mark svg { display: block; width: 100%; height: auto; overflow: visible; }
.mark .land { fill: var(--block); }
.mark .node { fill: var(--node); }
.mark .ring { fill: none; stroke: var(--label); stroke-width: 1.2; stroke-dasharray: 3 4; }

/* water labels, set along the passage the way charts name a strait */
.sea {
  position: absolute; margin: 0; white-space: nowrap; pointer-events: none;
  font-style: italic; font-size: clamp(11px, calc(var(--m) * .024), 14px); line-height: 1;
  letter-spacing: .06em; color: var(--label); font-variant-numeric: tabular-nums;
  transform: translate(-50%, -50%) rotate(45deg);
}
.sea.nw { left: 25%; top: 25%; }
.sea.se { left: 75%; top: 75%; }

/* the name: upper sea, right-aligned to the mark, baseline on the lower shore */
.name {
  grid-column: 1; grid-row: 1 / 3; align-self: end; justify-self: end;
  padding-right: var(--gap); text-align: right; max-width: 30rem;
}
h1 { margin: 0; }
.wordmark { display: block; width: min(100%, 22rem); height: auto; margin-left: auto; fill: var(--heading); }
.lead { margin: 18px 0 0; color: var(--muted); font-size: 18px; line-height: 28px; }

/* the particulars: lower sea, left-aligned to the mark, top on the upper shore */
.register {
  grid-column: 4; grid-row: 3 / 5; align-self: start; justify-self: start;
  padding-left: var(--gap); max-width: 30rem;
}
dl { margin: 0; display: grid; gap: 14px; }
dt { font-size: 14px; line-height: 22px; color: var(--muted); }
dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.notice { margin: 26px 0 0; padding-top: 18px; border-top: 1px solid var(--rule);
  font-size: 14px; line-height: 22px; color: var(--muted); max-width: 34ch; }

/* pinned to the bottom so the node stays at the true centre of the screen */
footer {
  position: absolute; left: var(--pad); bottom: max(24px, env(safe-area-inset-bottom, 0px));
  font-size: 13px; line-height: 20px; color: var(--muted);
}

/* ------------------------------------------------------------------ narrow and portrait screens */

@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  :root { --m: min(80vw, 440px); }
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    row-gap: 44px; padding-top: 40px;
  }
  .name { grid-column: 1; grid-row: 1; justify-self: start; text-align: left; padding: 0; }
  .wordmark { width: min(100%, 17rem); margin-left: 0; }
  .mark { grid-column: 1; grid-row: 2; width: var(--m); justify-self: center; }
  .register { grid-column: 1; grid-row: 3; padding: 0; }
  footer { position: static; grid-row: 4; padding-bottom: max(24px, env(safe-area-inset-bottom, 0px)); }
}

/* ------------------------------------------------------------------ the one moment: the strait closes on its node */

@media (prefers-reduced-motion: no-preference) {
  .mark .land, .mark .node { transform-box: fill-box; transform-origin: center; }
  .mark .ne { animation: settle-ne 1100ms cubic-bezier(.2, .7, .1, 1) both; }
  .mark .sw { animation: settle-sw 1100ms cubic-bezier(.2, .7, .1, 1) both; }
  .mark .node { animation: node-in 700ms 700ms cubic-bezier(.2, .7, .1, 1) both; }
  .sea { animation: fade-in 800ms 1100ms ease-out both; }
}
@keyframes settle-ne { from { transform: translate(16px, -16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes settle-sw { from { transform: translate(-16px, 16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes node-in { from { transform: scale(.55); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@media print {
  .stage { min-height: auto; }
  .mark .land, .mark .node, .sea { animation: none; }
}
