/* whatcountryismyip.com — "survey plate" look: cool paper, ink, one signal accent. */
:root {
  --paper: #ECEDE8;
  --ink: #121513;
  --muted: #4B514C;           /* 7.4:1 on paper */
  --hair: rgba(18, 21, 19, .2);
  --nb: #DCDFD7;
  --accent: #E5470E;          /* marks only; never small text */
  --sans: 'Archivo WC', system-ui, -apple-system, 'Segoe UI', 'Noto Sans', 'Hiragino Sans', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK JP', 'Noto Sans Arabic', 'Noto Sans Thai', 'Noto Sans Devanagari', sans-serif;
  --mono: 'Martian Mono WC', ui-monospace, 'SF Mono', Menlo, Consolas, 'Noto Sans Mono', var(--sans);
  --pad: 40px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

.mono { font-family: var(--mono); font-stretch: 87.5%; }
.muted { color: var(--muted); }
.pad { padding-left: var(--pad); padding-right: var(--pad); }
.label {
  font-family: var(--mono); font-stretch: 87.5%; font-size: 11px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0;
}
[dir=rtl] .label, [dir=rtl] .name { letter-spacing: 0; }
/* Martian Mono has no Arabic; its wide monospace space makes Arabic labels look gappy — use the sans there. */
:lang(ar) .label, :lang(ar) .maphead, :lang(ar) .meta, :lang(ar) .credits, :lang(ar) .state { font-family: var(--sans); font-stretch: 100%; }
.eyebrow { display: flex; align-items: center; gap: 10px; }
.sq, .sq-sm { display: block; background: var(--accent); flex: none; }
.sq { width: 12px; height: 12px; }
.sq-sm { width: 8px; height: 8px; }
.sq-sm.hollow { background: none; border: 1.5px solid var(--accent); }

/* ── header ─────────────────────────────────────────────── */
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--ink); }
.logo { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; font-size: 13px; font-weight: 600; }
.lang { display: flex; align-items: center; gap: 12px; }
.select-wrap { position: relative; display: flex; }
.select-wrap select {
  appearance: none; -webkit-appearance: none; height: 44px; padding: 0 40px 0 14px;
  border: 1px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink); font-size: 13px; cursor: pointer;
}
[dir=rtl] .select-wrap select { padding: 0 14px 0 40px; }
.select-wrap svg { position: absolute; inset-inline-end: 14px; top: 18px; pointer-events: none; fill: none; stroke: var(--ink); stroke-width: 1.5; }

/* ── hero ───────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.intro { display: flex; flex-direction: column; gap: 40px; padding-top: 56px; padding-bottom: 48px; min-width: 0; }
.namebox { display: flex; flex-direction: column; gap: 22px; }
.name {
  margin: 0; font-weight: 800; font-stretch: 62%; line-height: .86; letter-spacing: -.01em;
  text-transform: uppercase; text-wrap: balance; overflow-wrap: normal;
  font-size: clamp(64px, 11vw, 168px);
}
.name.len-m { font-size: clamp(52px, 8.4vw, 128px); }
.name.len-l { font-size: clamp(44px, 6.8vw, 104px); }
:lang(ja) .name, :lang(zh) .name, .name:lang(ja), .name:lang(zh) { line-height: 1.08; }
[dir=rtl] .name { line-height: 1.25; }
.locating { font-size: .4em; color: var(--muted); letter-spacing: 0; }
.name.ready { animation: rise .9s cubic-bezier(.2, .7, .1, 1) both; }

.locals { display: flex; flex-direction: column; gap: 22px; }
.locals:empty { display: none; }
.alt { display: flex; flex-direction: column; gap: 10px; padding-top: 22px; border-top: 1px solid var(--hair); }
.alt .v { margin: 0; font-size: 56px; line-height: 1.15; font-weight: 600; overflow-wrap: anywhere; }
.alt.minor .v { font-size: 32px; }
.error { margin: 0; font-size: 20px; line-height: 1.5; max-width: 32ch; }

.flagrow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px; margin-top: auto; }
.flagrow img { display: block; height: 128px; width: auto; max-width: 100%; box-shadow: 0 0 0 1px rgba(18, 21, 19, .28); background: #fff; }
.iso { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.iso-code { font-size: 20px; font-weight: 600; }

/* ── map ────────────────────────────────────────────────── */
.mappanel { display: flex; flex-direction: column; gap: 14px; padding: 28px 48px 56px 76px; border-inline-start: 1px solid var(--ink); min-width: 0; }
.maphead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; font-size: 11px; color: var(--muted); }
.mapframe { position: relative; aspect-ratio: 1000 / 860; border: 1px solid var(--ink); }
.mapframe svg#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: hidden; }
#wc-dots circle { fill: var(--ink); }
.m-grat { fill: none; stroke: var(--ink); stroke-opacity: .16; stroke-width: 1; vector-effect: non-scaling-stroke; }
.m-nb { fill: var(--nb); stroke: var(--ink); stroke-opacity: .35; stroke-width: .8; vector-effect: non-scaling-stroke; }
.m-land { fill: url(#wc-dots); opacity: 0; }
.m-coast { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.m-islets circle { fill: none; stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.m-point { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.drawn .m-coast { animation: draw 1.7s cubic-bezier(.6, 0, .2, 1) .1s forwards; }
.drawn .m-land { animation: fade .9s ease 1.2s forwards; }

.tick-b, .tick-l { position: absolute; font-family: var(--mono); font-stretch: 87.5%; font-size: 10px; color: var(--muted); white-space: nowrap; }
.tick-b { top: 100%; transform: translateX(-50%); padding-top: 12px; }
.tick-b::before { content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 7px; background: var(--ink); }
.tick-l { right: 100%; transform: translateY(-50%); padding-right: 12px; }
.tick-l::before { content: ""; position: absolute; right: 0; top: 50%; height: 1px; width: 7px; background: var(--ink); }

.pin { position: absolute; width: 0; height: 0; opacity: 0; }
.drawn .pin { animation: fade .4s ease 1.6s forwards; }
.pin .pulse { position: absolute; left: -24px; top: -24px; width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--accent); animation: pulse 2.4s ease-out infinite; }
.pin .dot { position: absolute; left: -8px; top: -8px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--paper); }
.pin .arrow { display: none; position: absolute; left: -6px; top: -30px; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid var(--accent); transform-origin: 6px 30px; }
.pin.off .arrow { display: block; }
.pin.off .pulse { display: none; }
.pin-label { position: absolute; left: 22px; top: -34px; padding: 5px 9px; background: var(--ink); color: var(--paper); font-size: 11px; white-space: nowrap; }
.pin.flip .pin-label { left: auto; right: 22px; }
.pin.low .pin-label { top: 18px; }
.north { position: absolute; right: 16px; bottom: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; }
.north svg { fill: var(--ink); }

/* ── data strip ─────────────────────────────────────────── */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--ink); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.cell { display: flex; flex-direction: column; gap: 10px; padding-top: 22px; padding-bottom: 24px; background: var(--paper); min-width: 0; }
.cell-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.cell-row.baseline { align-items: baseline; gap: 4px 12px; }
.value { font-size: 22px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.value.small-value { font-size: 15px; line-height: 1.5; }
.sub { font-size: 12px; color: var(--muted); }
.copy { min-height: 44px; padding: 0 16px; border: 1px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink); font-size: 12px; cursor: pointer; transition: background .15s, color .15s; }
.copy:hover { background: var(--ink); color: var(--paper); }

/* ── law ────────────────────────────────────────────────── */
.law { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); border-bottom: 1px solid var(--ink); }
.law-head { display: flex; flex-direction: column; gap: 18px; padding-top: 56px; padding-bottom: 56px; min-width: 0; }
.law-head h2 { margin: 0; font-size: 44px; line-height: 1.02; font-weight: 700; font-stretch: 75%; text-wrap: balance; }
.meta { margin: 0; font-size: 12px; color: var(--muted); }
.law-body { display: flex; flex-direction: column; gap: 32px; padding-top: 56px; padding-bottom: 56px; min-width: 0; }
.pending { margin: 0; font-size: 17px; line-height: 1.55; color: var(--muted); max-width: 64ch; }
.blurb { display: flex; flex-direction: column; gap: 14px; max-width: 68ch; }
.blurb:empty { display: none; }
.blurb p { margin: 0; font-size: 19px; line-height: 1.55; text-wrap: pretty; }
.topics { display: flex; flex-direction: column; border-top: 1px solid var(--hair); max-width: 76ch; }
.topics:empty { display: none; }
.topics details { border-bottom: 1px solid var(--hair); }
.topics summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; cursor: pointer; font-size: 17px; font-weight: 600; list-style: none; }
.topics summary::-webkit-details-marker { display: none; }
.topics summary::after { content: "+"; font-family: var(--mono); font-weight: 400; font-size: 18px; }
.topics details[open] summary::after { content: "–"; }
.topics .t-body { padding: 0 0 20px; display: flex; flex-direction: column; gap: 12px; }
.topics .t-body p { margin: 0; font-size: 16px; line-height: 1.6; }
.cite { font-family: var(--mono); font-stretch: 87.5%; font-size: 11px; vertical-align: super; text-decoration: none; margin-inline-start: 2px; }
.lawchips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lawchips li { font-size: 13px; padding: 6px 10px; border: 1px solid var(--hair); }
.lawchips .local { color: var(--muted); margin-inline-start: 6px; }
.recent ul, .sources ol { margin: 12px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.5; max-width: 72ch; }
.state { font-family: var(--mono); font-stretch: 87.5%; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-inline-end: 8px; }
.treaties { display: flex; flex-direction: column; gap: 14px; }
.treaty-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.treaty-list li { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--ink); }
.treaty-list .t-name { font-size: 15px; font-weight: 600; line-height: 1.3; }
.treaty-list .t-name a { text-decoration: none; }
.treaty-list .t-name a:hover { text-decoration: underline; color: var(--ink); }
.treaty-list .t-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-family: var(--mono); font-stretch: 87.5%; font-size: 11px; color: var(--muted); }
.treaty-list .role { color: var(--ink); font-weight: 600; }
.disclaimer { display: flex; gap: 16px; align-items: flex-start; padding: 20px 22px; border: 1px solid var(--ink); max-width: 76ch; }
.disclaimer svg { flex: none; margin-top: 2px; fill: none; stroke: var(--ink); stroke-width: 1.6; }
.disclaimer p { margin: 0; font-size: 15px; line-height: 1.55; text-wrap: pretty; }

/* ── footer ─────────────────────────────────────────────── */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px 40px; padding-top: 28px; padding-bottom: 44px; }
.note { margin: 0; max-width: 66ch; font-size: 14px; line-height: 1.6; color: var(--muted); text-wrap: pretty; }
.credits { margin: 0; font-size: 11px; color: var(--muted); max-width: 48ch; line-height: 1.6; }
.noscript { padding: 40px; font-size: 18px; }

/* ── states ─────────────────────────────────────────────── */
[data-state=error] .mappanel, [data-state=error] .strip > :not(#cell-ip), [data-state=error] .law { display: none; }
[data-state=error] .hero { grid-template-columns: minmax(0, 1fr); }
[data-state=error] .namebox { display: none; }
[data-state=error] .strip { grid-template-columns: minmax(0, 1fr); }
[data-state=error] .error { font-size: 28px; max-width: 36ch; }

/* ── responsive ─────────────────────────────────────────── */
@media (max-width: 980px) {
  .hero, .law { grid-template-columns: minmax(0, 1fr); }
  .mappanel { border-inline-start: 0; border-top: 1px solid var(--ink); }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .law-head { padding-bottom: 0; }
  .law-body { padding-top: 32px; }
}
@media (max-width: 600px) {
  :root { --pad: 20px; }
  .strip { grid-template-columns: minmax(0, 1fr); }
  .mappanel { padding: 24px 20px 48px 52px; }
  .intro { padding-top: 36px; gap: 32px; }
  .alt .v { font-size: 40px; }
  .alt.minor .v { font-size: 26px; }
  .flagrow img { height: 96px; }
  .law-head h2 { font-size: 34px; }
}

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(.35em); } }
@keyframes pulse { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .m-land, .pin { opacity: 1; }
  .m-coast { stroke-dashoffset: 0; }
}

/* ── footer links, privacy page ─────────────────────────── */
.foot-side { display: grid; gap: 6px; }
.credits a { color: inherit; }
.doc { max-width: calc(72ch + 2 * var(--pad)); padding-top: 36px; padding-bottom: 48px; }
.doc h1 { font-size: 40px; line-height: 1.1; margin: 0 0 10px; }
.doc h2 { font-size: 20px; margin: 36px 0 10px; }
.doc p { font-size: 16px; line-height: 1.65; margin: 0 0 14px; text-wrap: pretty; }
.doc .meta { font-size: 12px; color: var(--muted); }
.doc-links { margin: 0 0 14px; padding-inline-start: 20px; font-size: 12px; line-height: 1.9; }

/* Strip cells share the row whatever number are shown. Location and network are hidden when there is no
   data (e.g. ?override=CC); a fixed 4-column grid left those slots as solid ink. */
.strip { display: flex; flex-wrap: wrap; }
.strip > .cell { flex: 1 1 0; }
@media (max-width: 980px) { .strip > .cell { flex-basis: calc(50% - 1px); } }
@media (max-width: 600px) { .strip > .cell { flex-basis: 100%; } }

/* Very wide screens. The page stops at 1600px and centres, with side rules so the plate keeps its edges;
   the map (and its header) is also capped by viewport height, so on short wide screens (2560×1080 etc.)
   the strip and law summary stay near the fold instead of a few scrolls down. */
.wc { max-width: 1600px; margin-inline: auto; }
@media (min-width: 1602px) { .wc { border-inline: 1px solid var(--ink); } }
.mappanel > .maphead, .mappanel > .mapframe { width: min(100%, calc(68svh * 1000 / 860)); align-self: center; }
