/* =============================================================================
   404 "Off the map" (2026-11-04): a night chart of the gulf. The 0 of 404 is
   a vibe compass (a turning gradient ring, a radar that lights the 16 vibe
   dimensions as it passes, a needle that never settles); a dotted route
   wanders off into a question mark (SMIL in the SVG), places bob, and a
   ferry crosses the sea along the bottom. Markup: templates/notfound.html
   (generated). The compass is also the guide's missing page emblem.
   ========================================================================== */

:root {
  --nf-face: rgba(11, 28, 46, .88);
  --nf-tick: rgba(242, 246, 251, .22);
  --nf-grid: rgba(255, 255, 255, .05);
  --nf-current: rgba(18, 194, 208, .11);
  --nf-hull: #E8F4F8;
  --nf-cabin: #BFD9E2;
  --nf-smoke: rgba(242, 246, 251, .25);
  --nf-wave-0: rgba(18, 194, 208, .18);
  --nf-wave-1: rgba(11, 110, 138, .38);
  --nf-wave-2: rgba(7, 52, 77, .85);
  --nf-ring-glow: .55;
}
:root[data-theme="light"] {
  --nf-face: rgba(255, 255, 255, .9);
  --nf-tick: rgba(11, 27, 46, .2);
  --nf-grid: rgba(10, 30, 55, .05);
  --nf-current: rgba(4, 119, 162, .12);
  --nf-hull: #0E2A3F;
  --nf-cabin: #1F4A66;
  --nf-smoke: rgba(11, 27, 46, .18);
  --nf-wave-0: rgba(127, 211, 224, .35);
  --nf-wave-1: rgba(61, 169, 196, .4);
  --nf-wave-2: rgba(30, 127, 163, .6);
  --nf-ring-glow: .25;
}

/* ── Page ─────────────────────────────────────────────────────────────── */
.nf-body {
  min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 1fr); place-items: center;
  overflow-x: hidden;
  background:
    radial-gradient(60% 50% at 50% 32%, var(--glow-a), transparent 70%),
    radial-gradient(50% 45% at 92% 90%, var(--glow-b), transparent 70%),
    var(--bg);
}
.nf-sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.nf-sea { position: fixed; inset-inline: 0; bottom: 0; width: 100%; height: 140px; z-index: 0; pointer-events: none; }

.nf-brand {
  position: fixed; inset-block-start: 20px; inset-inline-start: 24px; z-index: 2;
  display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none;
}
.nf-brand:hover .wordmark { color: var(--accent-ink); }

.nf-main {
  position: relative; z-index: 1;
  width: min(100% - 32px, 580px);
  padding-block: 96px 170px;
  text-align: center;
}
.nf-kicker {
  margin: 30px 0 8px; color: var(--accent-ink);
  font-family: var(--font-head); font-weight: 700; font-size: .82rem;
  letter-spacing: .28em; text-transform: uppercase;
}
:lang(fa) .nf-kicker, :lang(ar) .nf-kicker { letter-spacing: 0; font-size: .95rem; }
.nf-h1 { font-size: clamp(1.8rem, 1.2rem + 2.6vw, 2.9rem); line-height: 1.12; text-wrap: balance; }
.nf-text { margin: 16px auto 0; max-width: 32em; color: var(--ink-2); text-wrap: pretty; }
.nf-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
.nf-path { margin: 26px 0 0; }
.nf-path code {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 6px 14px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem;
  direction: ltr; unicode-bidi: isolate; vertical-align: middle;
}

/* ── 4 (compass) 4 ────────────────────────────────────────────────────── */
.nf-404 {
  --nf-size: clamp(96px, 22vw, 168px);
  display: flex; align-items: center; justify-content: center; gap: calc(var(--nf-size) * .06);
}
.nf-four {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif; font-weight: 700;
  font-size: var(--nf-size); line-height: 1; letter-spacing: -.04em;
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: nf-float 5.33s ease-in-out infinite;
}
.nf-four-b { animation-delay: -2.66s; }
@keyframes nf-float { 0%, 100% { transform: translateY(-5px); } 50% { transform: translateY(5px); } }

.nf-compass { position: relative; width: calc(var(--nf-size) * .95); aspect-ratio: 1; flex: none; }
.nf-compass > * { position: absolute; inset: 0; border-radius: 50%; }
.nf-glow {
  inset: -14%;
  background: radial-gradient(closest-side, rgba(18, 194, 208, .35), transparent);
  animation: nf-breathe 4s ease-in-out infinite;
}
@keyframes nf-breathe { 0%, 100% { opacity: .7; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.04); } }
.nf-face { inset: 14%; background: var(--nf-face); box-shadow: inset 0 0 24px rgba(0, 0, 0, .25); }
.nf-sweep {
  inset: 14%;
  background: conic-gradient(from 0deg, transparent 0 74%, rgba(18, 194, 208, .5) 100%);
  animation: nf-spin 4s linear infinite;
}
.nf-ring {
  background: conic-gradient(#12C2D0, #43D6AE, #F9B04E, #F76334, #12C2D0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 13%), #000 calc(100% - 13% + 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 13%), #000 calc(100% - 13% + 1px));
  filter: drop-shadow(0 0 10px rgba(18, 194, 208, var(--nf-ring-glow)));
  animation: nf-spin 16s linear infinite;
}
@keyframes nf-spin { to { transform: rotate(1turn); } }

.nf-dial { width: 100%; height: 100%; overflow: visible; }
.nf-tick { stroke: var(--nf-tick); stroke-width: 2.6; stroke-linecap: round; animation: nf-tick 4s linear infinite; }
.nf-tick.t0, .nf-tick.t4, .nf-tick.t8, .nf-tick.t12 { stroke-width: 3.6; }
@keyframes nf-tick { 0% { stroke: var(--c); } 40%, 100% { stroke: var(--nf-tick); } }
.t0 { --c: #12C2D0; animation-delay: 0s; }      .t1 { --c: #F9B04E; animation-delay: .25s; }
.t2 { --c: #43D6AE; animation-delay: .5s; }     .t3 { --c: #F76334; animation-delay: .75s; }
.t4 { --c: #12C2D0; animation-delay: 1s; }      .t5 { --c: #43D6AE; animation-delay: 1.25s; }
.t6 { --c: #F9B04E; animation-delay: 1.5s; }    .t7 { --c: #F76334; animation-delay: 1.75s; }
.t8 { --c: #12C2D0; animation-delay: 2s; }      .t9 { --c: #F9B04E; animation-delay: 2.25s; }
.t10 { --c: #43D6AE; animation-delay: 2.5s; }   .t11 { --c: #F76334; animation-delay: 2.75s; }
.t12 { --c: #12C2D0; animation-delay: 3s; }     .t13 { --c: #43D6AE; animation-delay: 3.25s; }
.t14 { --c: #F9B04E; animation-delay: 3.5s; }   .t15 { --c: #F76334; animation-delay: 3.75s; }

/* Blips: lit when the sweep reaches their angle (delay = angle / 360 · 4 s). */
.nf-blip { fill: #43D6AE; opacity: 0; transform-box: fill-box; transform-origin: center; animation: nf-blip 4s ease-out infinite; }
.b0 { animation-delay: .58s; } .b1 { animation-delay: 1.67s; } .b2 { animation-delay: 2.67s; } .b3 { animation-delay: 3.39s; }
@keyframes nf-blip { 0% { opacity: .95; transform: scale(1.5); } 45%, 100% { opacity: 0; transform: scale(.8); } }

.nf-needle {
  transform-box: view-box; transform-origin: 100px 100px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
  animation: nf-search 7s ease-in-out infinite;
}
@keyframes nf-search {
  0%   { transform: rotate(-28deg); }
  11%  { transform: rotate(46deg); }
  20%  { transform: rotate(18deg); }
  31%  { transform: rotate(118deg); }
  40%  { transform: rotate(84deg); }
  52%  { transform: rotate(-62deg); }
  61%  { transform: rotate(-30deg); }
  72%  { transform: rotate(-150deg); }
  80%  { transform: rotate(-110deg); }
  90%  { transform: rotate(-8deg); }
  100% { transform: rotate(-28deg); }
}
.nf-south { fill: var(--ink); opacity: .7; }
.nf-hub { fill: var(--ink); }
.nf-hub-in { fill: var(--bg); }

/* ── Chart ────────────────────────────────────────────────────────────── */
.nf-grid { stroke: var(--nf-grid); stroke-width: 1; animation: nf-drift 16s linear infinite; }
@keyframes nf-drift { to { transform: translateX(64px); } }
.nf-current { fill: none; stroke: var(--nf-current); stroke-width: 1.4; }
.nf-current.c0 { animation: nf-flow-480 16s linear infinite; }
.nf-current.c1 { animation: nf-flow-360 20s linear infinite reverse; }
.nf-current.c2 { animation: nf-flow-480 24s linear infinite; }
.nf-current.c3 { animation: nf-flow-360 18s linear infinite reverse; }
.nf-current.c4 { animation: nf-flow-480 22s linear infinite; }
@keyframes nf-flow-480 { to { transform: translateX(480px); } }
@keyframes nf-flow-360 { to { transform: translateX(360px); } }
@keyframes nf-flow-300 { to { transform: translateX(300px); } }

.nf-pin path { opacity: .9; }
.nf-hole { fill: var(--bg); }
.nf-bob { animation: nf-bob 4s ease-in-out infinite; }
.nf-pulse { fill: none; stroke-width: 1.6; transform-box: fill-box; transform-origin: center; animation: nf-pulse 4s ease-out infinite; }
@keyframes nf-bob { 0%, 100% { transform: translateY(-4px); } 50% { transform: translateY(4px); } }
@keyframes nf-pulse { 0% { opacity: .7; transform: scale(.3); } 100% { opacity: 0; transform: scale(1.6); } }
.p1 .nf-bob, .p1 .nf-pulse { animation-delay: -.5s; }
.p2 .nf-bob, .p2 .nf-pulse { animation-delay: -1s; }
.p3 .nf-bob, .p3 .nf-pulse { animation-delay: -1.5s; }
.p4 .nf-bob, .p4 .nf-pulse { animation-delay: -2s; }
.p5 .nf-bob, .p5 .nf-pulse { animation-delay: -2.5s; }
.p6 .nf-bob, .p6 .nf-pulse { animation-delay: -3s; }
.p7 .nf-bob, .p7 .nf-pulse { animation-delay: -3.5s; }

.nf-trail { fill: none; stroke: var(--amber); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 4 9; opacity: .7; }
.nf-traveller circle { fill: var(--orange); }
.nf-traveller .nf-halo { opacity: .25; }
.nf-ask circle { fill: var(--orange); }
.nf-ask text { fill: #fff; font: 800 19px "Space Grotesk", system-ui, sans-serif; }

/* ── Sea and ferry ────────────────────────────────────────────────────── */
.nf-wave.w0 { fill: var(--nf-wave-0); animation: nf-flow-360 9s linear infinite; }
.nf-wave.w1 { fill: var(--nf-wave-1); animation: nf-flow-480 14s linear infinite reverse; }
.nf-wave.w2 { fill: var(--nf-wave-2); animation: nf-flow-300 7s linear infinite; }
.nf-ferry { animation: nf-cross 26s linear infinite; }
@keyframes nf-cross { from { transform: translateX(-120px); } to { transform: translateX(1560px); } }
.nf-ferry-bob { animation: nf-rock 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes nf-rock { 0%, 100% { transform: translateY(-2px) rotate(-2.5deg); } 50% { transform: translateY(3px) rotate(2.5deg); } }
.nf-hull { fill: var(--nf-hull); }
.nf-stripe, .nf-funnel { fill: var(--orange); }
.nf-cabin { fill: var(--nf-cabin); }
.nf-windows rect { fill: var(--amber); animation: nf-flicker 2.4s ease-in-out infinite; }
.nf-windows rect:nth-child(2n) { animation-delay: -1.2s; }
.nf-windows rect:nth-child(3n) { animation-delay: -.6s; }
@keyframes nf-flicker { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.nf-wake line { stroke: rgba(255, 255, 255, .55); stroke-width: 2; stroke-linecap: round; }
.nf-wake line:nth-child(2) { opacity: .6; } .nf-wake line:nth-child(3) { opacity: .3; }
.nf-smoke circle { fill: var(--nf-smoke); transform-box: fill-box; transform-origin: center; animation: nf-smoke 2.7s ease-out infinite; }
.nf-smoke circle:nth-child(2) { animation-delay: -.9s; }
.nf-smoke circle:nth-child(3) { animation-delay: -1.8s; }
@keyframes nf-smoke { 0% { opacity: .9; transform: translate(0, 0) scale(.6); } 100% { opacity: 0; transform: translate(-22px, -16px) scale(2.2); } }

/* ── Guide: the missing page carries the compass over its title ───────── */
.guide-missing .nf-404 { --nf-size: clamp(72px, 14vw, 120px); justify-content: flex-start; margin-bottom: 18px; }

@media (max-width: 560px) {
  .nf-main { padding-block: 84px 150px; }
  .nf-actions .btn { width: 100%; }
  .nf-sea { height: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  .nf-body *, .guide-missing .nf-404 * { animation: none !important; }
  .nf-route { display: none; }
}
