Globe arcs hero

A dotted canvas globe rises from a jade horizon under a centered headline. Pink arcs run to service pills, with glass case-study cards on each side.

Open preview
snippet.html473 lines
<section class="hgl" aria-labelledby="hgl-title">
  <div class="hgl__art" aria-hidden="true"><div class="hgl__paint"></div></div>

  <header class="hgl__bar">
    <a class="hgl__brand" href="#">
      <svg viewBox="0 0 32 32" width="30" height="30" aria-hidden="true">
        <defs><linearGradient id="hgl-mark" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#74ffed"/><stop offset="1" stop-color="#2a7d90"/></linearGradient></defs>
        <circle cx="16" cy="16" r="14" fill="none" stroke="url(#hgl-mark)" stroke-width="2"/>
        <ellipse cx="16" cy="16" rx="6" ry="14" fill="none" stroke="url(#hgl-mark)" stroke-width="1.4"/>
        <path d="M3 12h26M3 20h26" stroke="url(#hgl-mark)" stroke-width="1.4"/>
        <circle cx="22.5" cy="9.5" r="2.6" fill="#fe81d1"/>
      </svg>
      <span>MERIDIAN WORKS</span>
    </a>
    <nav aria-label="Primary">
      <ul class="hgl__nav">
        <li><a href="#" aria-current="page">Home</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Process</a></li>
        <li><a href="#">Case studies</a></li>
        <li><a href="#">About</a></li>
      </ul>
    </nav>
    <a class="hgl__bar-cta" href="#">Book a call</a>
    <button class="hgl__menu" type="button" aria-label="Open menu">
      <svg width="18" height="18" viewBox="0 0 18 18" fill="none" aria-hidden="true"><path d="M2.5 6h13M2.5 12h13" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>
    </button>
  </header>

  <div class="hgl__copy">
    <h1 class="hgl__title" id="hgl-title"><span>AI that fits the work</span> <span>your team already does.</span></h1>
    <p class="hgl__sub">We sit with your team, map the process, build the system, then stay on to run it and make it better.</p>
    <a class="hgl__cta" href="#">Walk us through it
      <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M3 8h9.5M8.5 4l4 4-4 4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>
    </a>
  </div>

  <div class="hgl__stage">
    <canvas class="hgl__globe" aria-hidden="true"></canvas>
    <ul class="hgl__pills" aria-label="Services, from Denver">
      <li class="hgl__home" data-lat="39.74" data-lon="-104.99"><i></i>Denver, CO</li>
      <li data-lat="66" data-lon="-60"><i></i>Workflow automation</li>
      <li data-lat="28" data-lon="-48"><i></i>AI agents</li>
      <li data-lat="10" data-lon="-82"><i></i>Custom apps</li>
      <li data-lat="58" data-lon="-165"><i></i>Advisory</li>
    </ul>
  </div>

  <div class="hgl__proof">
    <article class="hgl__card">
      <span class="hgl__sector">Freight brokerage</span>
      <h2>Load matching on one screen</h2>
      <p>Replaced nine carrier boards and a shared spreadsheet.</p>
    </article>
    <article class="hgl__card">
      <span class="hgl__sector">Dental group</span>
      <h2>Insurance checks before check-in</h2>
      <p>The front desk got 14 hours a week back.</p>
    </article>
  </div>
</section>

<style>
  .hgl {
    --hgl-abyss: #171f44;
    --hgl-abyss-deep: #0f1533;
    --hgl-jade: #74ffed;
    --hgl-horizon: #5fe3da;
    --hgl-pink: #fe81d1;
    --hgl-pink-hover: #ff9adb;
    --hgl-ink: #ffffff;
    --hgl-body: #c9d1ee;
    --hgl-pill: #f4f7ff;
    --hgl-glass: rgba(23, 31, 68, 0.72);
    --hgl-glass-line: rgba(196, 226, 255, 0.22);
    --hgl-gutter: clamp(16px, 4vw, 56px);
    --hgl-font: ui-sans-serif, system-ui, sans-serif;
    /* Drop a painting or photo in here, e.g. url(fresco.jpg). It gets graded to the abyss blue. */
    --hgl-art: none;
    position: relative;
    isolation: isolate;
    min-height: max(100svh, 760px);
    overflow: hidden;
    color: var(--hgl-ink);
    font-family: var(--hgl-font);
    -webkit-font-smoothing: antialiased;
    background:
      linear-gradient(180deg, rgba(95, 227, 218, 0) calc(100% - 72px), var(--hgl-horizon) 100%),
      radial-gradient(120% 60% at 50% 104%, rgba(116, 255, 237, 0.95) 0%, rgba(77, 214, 214, 0.62) 22%, rgba(40, 120, 150, 0.32) 46%, rgba(23, 31, 68, 0) 72%),
      radial-gradient(70% 45% at 50% 0%, rgba(58, 74, 150, 0.45) 0%, rgba(23, 31, 68, 0) 70%),
      linear-gradient(180deg, #121839 0%, var(--hgl-abyss) 38%, #1b3560 66%, #2a7d90 88%, var(--hgl-horizon) 100%);
  }
  .hgl *, .hgl *::before, .hgl *::after { box-sizing: border-box; }
  .hgl a { color: inherit; text-decoration: none; }
  .hgl a:focus-visible, .hgl button:focus-visible { outline: 2px solid var(--hgl-pink); outline-offset: 3px; border-radius: 999px; }
  /* Fine grain so the gradient doesn't band on wide screens. */
  .hgl::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0.07; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  /* Backdrop: a fresco graded to the abyss hue and veiled hardest behind the headline.
     With no --hgl-art, warm plaster forms stand in for figures reaching toward the globe. */
  .hgl__art {
    position: absolute; inset: 0; isolation: isolate; pointer-events: none;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 220px), rgba(0, 0, 0, 0.3) calc(100% - 80px), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 220px), rgba(0, 0, 0, 0.3) calc(100% - 80px), transparent 100%);
  }
  .hgl__paint {
    position: absolute; inset: 0; z-index: -1;
    background:
      var(--hgl-art) center 60% / cover no-repeat,
      radial-gradient(28% 22% at 13% 66%, #e2bc93 0%, #c99c74 40%, transparent 100%),
      radial-gradient(18% 9% at 28% 56%, #d9b38c 0%, transparent 100%),
      radial-gradient(30% 26% at 86% 50%, #e7dccb 0%, #c7a989 45%, transparent 100%),
      radial-gradient(16% 8% at 72% 54%, #dcbc98 0%, transparent 100%),
      radial-gradient(40% 30% at 92% 42%, #a35b4a 0%, transparent 70%),
      radial-gradient(60% 40% at 50% 20%, #d7cbb6 0%, transparent 80%),
      linear-gradient(180deg, #bfb09a, #8d8377 60%, #6d665e);
  }
  .hgl__art::before, .hgl__art::after { content: ""; position: absolute; inset: 0; }
  .hgl__art::before { background: #26386f; mix-blend-mode: color; }
  .hgl__art::after {
    background:
      radial-gradient(44% 32% at 50% 24%, rgba(15, 21, 51, 0.66), rgba(15, 21, 51, 0.5) 62%, rgba(15, 21, 51, 0) 100%),
      linear-gradient(180deg, rgba(15, 21, 51, 0.6), rgba(15, 21, 51, 0.3) 42%, rgba(15, 21, 51, 0.04)),
      #a9b6e6;
    mix-blend-mode: multiply;
  }

  /* Header */
  .hgl__bar {
    position: absolute; z-index: 5; top: 0; left: 0; right: 0;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    padding: 22px var(--hgl-gutter);
  }
  .hgl__brand { display: inline-flex; align-items: center; gap: 10px; justify-self: start; font-size: 12.5px; font-weight: 500; letter-spacing: 0.22em; }
  .hgl__nav {
    display: flex; gap: 2px; padding: 4px; margin: 0; list-style: none;
    border-radius: 999px; background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--hgl-glass-line);
    backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 24px -12px rgba(5, 8, 25, 0.6);
  }
  .hgl__nav a {
    display: block; padding: 9px 15px; border-radius: 999px;
    font-size: 13.5px; font-weight: 500; color: var(--hgl-body);
    transition: background-color 0.2s ease, color 0.2s ease;
  }
  .hgl__nav a:hover { color: var(--hgl-ink); background: rgba(255, 255, 255, 0.07); }
  .hgl__nav a[aria-current="page"] { color: var(--hgl-ink); background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18); }
  .hgl__bar-cta {
    justify-self: end; padding: 10px 16px; border-radius: 999px;
    font-size: 13.5px; font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.42); background: rgba(255, 255, 255, 0.04);
    transition: background-color 0.2s ease, border-color 0.2s ease;
  }
  .hgl__bar-cta:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.7); }
  .hgl__menu { display: none; }

  /* Copy */
  .hgl__copy {
    position: relative; z-index: 4;
    width: min(100% - 2 * var(--hgl-gutter), 860px); margin: 0 auto;
    padding-top: clamp(132px, 15vh, 168px);
    text-align: center;
  }
  .hgl__title {
    margin: 0; font-weight: 500;
    font-size: clamp(40px, 5.4vw, 78px); line-height: 1.02; letter-spacing: -0.036em;
    text-wrap: balance; text-shadow: 0 2px 30px rgba(15, 21, 51, 0.5);
  }
  .hgl__title span { display: block; }
  .hgl__sub {
    margin: 22px auto 0; max-width: 54ch;
    font-size: clamp(15.5px, 1.15vw, 17.5px); line-height: 1.55; color: var(--hgl-body);
    text-wrap: pretty;
  }
  .hgl__cta {
    display: inline-flex; align-items: center; gap: 10px; margin-top: 30px;
    height: 48px; padding: 0 24px; border-radius: 999px;
    background: var(--hgl-pink); color: var(--hgl-abyss) !important;
    font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em;
    box-shadow: 0 10px 30px -10px rgba(254, 129, 209, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    transition: background-color 0.2s ease, box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .hgl__cta svg { transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
  .hgl__cta:hover { background: var(--hgl-pink-hover); box-shadow: 0 16px 40px -10px rgba(254, 129, 209, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.55); transform: translateY(-1px); }
  .hgl__cta:hover svg { transform: translateX(3px); }

  /* Stage: the globe on a canvas, the pills over it in HTML */
  .hgl__stage { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
  .hgl__globe { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
  @media (min-width: 981px) {
    .hgl__globe {
      -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 190px), rgba(0, 0, 0, 0.35) calc(100% - 70px), transparent 100%);
      mask-image: linear-gradient(to bottom, #000 calc(100% - 190px), rgba(0, 0, 0, 0.35) calc(100% - 70px), transparent 100%);
    }
  }
  .hgl__pills { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; }
  .hgl__pills li {
    position: absolute; left: 0; top: 0;
    display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
    padding: 6px 11px 6px 9px; border-radius: 999px;
    background: var(--hgl-pill); color: var(--hgl-abyss);
    font-size: 11.5px; font-weight: 600;
    box-shadow: 0 6px 18px -6px rgba(10, 14, 40, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.6);
    opacity: 0; will-change: transform, opacity;
  }
  .hgl__pills i { width: 7px; height: 7px; border-radius: 50%; background: var(--hgl-pink); box-shadow: 0 0 0 3px rgba(254, 129, 209, 0.25); }
  .hgl__pills .hgl__home { background: var(--hgl-abyss); color: var(--hgl-ink); box-shadow: 0 6px 18px -6px rgba(10, 14, 40, 0.7), 0 0 0 1px rgba(254, 129, 209, 0.7); }
  .hgl__pills .hgl__home i { background: var(--hgl-jade); box-shadow: 0 0 0 3px rgba(116, 255, 237, 0.25); }

  /* Glass proof cards, placed beside the globe by the script */
  .hgl__proof { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
  .hgl__card {
    position: absolute; left: 0; top: 0; width: min(290px, 22vw); padding: 18px 20px 19px;
    border-radius: 18px; pointer-events: auto;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03) 60%), var(--hgl-glass);
    border: 1px solid var(--hgl-glass-line);
    backdrop-filter: blur(16px) saturate(150%); -webkit-backdrop-filter: blur(16px) saturate(150%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 24px 48px -24px rgba(6, 10, 32, 0.7);
  }
  .hgl__card h2 { margin: 0; font-size: 16px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.25; }
  .hgl__card p { margin: 8px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--hgl-body); }
  .hgl__sector { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 10px; font-size: 12px; font-weight: 500; color: var(--hgl-body); }
  .hgl__sector::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--hgl-jade); box-shadow: 0 0 10px rgba(116, 255, 237, 0.9); }

  @media (max-width: 980px) {
    .hgl { min-height: 0; padding-bottom: 32px; }
    .hgl__bar { grid-template-columns: 1fr auto; }
    .hgl__bar > nav, .hgl__bar-cta { display: none; }
    .hgl__menu {
      display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
      border-radius: 999px; border: 1px solid var(--hgl-glass-line); background: rgba(255, 255, 255, 0.06); color: var(--hgl-ink);
      backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); cursor: pointer;
    }
    .hgl__copy { padding-top: 116px; }
    .hgl__stage { position: relative; inset: auto; height: min(112vw, 600px); margin-top: 4px; }
    .hgl__proof {
      position: relative; inset: auto; z-index: 3; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px;
      width: min(100% - 2 * var(--hgl-gutter), 680px); margin: -48px auto 0;
    }
    .hgl__card { position: relative; width: auto; transform: none !important; }
  }
  @media (prefers-reduced-motion: reduce) {
    .hgl__cta, .hgl__cta svg { transition: none; }
  }
</style>

<script>
  // Dotted globe with arcs from home base to each service. Land is a 180x90 bitmask
  // (Natural Earth 110m, public domain), one bit per 2 degrees, so nothing is fetched.
  document.querySelectorAll(".hgl").forEach((root) => {
    if (root.dataset.hglReady) return;
    root.dataset.hglReady = "1";
    const LAND = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOh/gP8HAAAAAAAAAAAAAAAAAAAAAAD8/////wcAAAAEAAAHAAAAAAAAAAAApv/9//8fAPgDAAAA4AMAAAAAAAAA4ADPx////wAABgAACADgAQAAAAAAAAD40T8A/v8PAAAAABwA/n8AOAEAAAAA+LPvD8D/fwAAAAAwIPz//wMDAADAAwD50/4H/P8HAAAcAIP//////x8AgP///3+++4D/HwAA/B8A///////////w/////x9++B8AAOD/9///////////zP//////+QM/wAeA3+///////////w/w/////xE88AEAAP7+////////////gP////8HeAAcAADw5////////////ADgAf//f4AvAAAAAH78/////////8YAACyA//8f+AcAAIDB4/////////8ADwAQAPD//5//AQAAPBz/////////A3AAAAAA/v///T8AAGD3//////////8DAwAAAMD/////AwAA+P//////////LwAAAAAA+P///2MAAAD///////////8CAAAAAAD///8/DAAA4P//////////JwAAAAAA8P///wcAAAD+/+3//////38AAAAAAAD///8HAAAA/tkP/P//////MQAAAAAA8P//PwAAAOBH/v///////wcBAAAAAAD///8BAAAAPkT7//////8xEAAAAAAA4P//DwAAAMB5Iv//////f8YBAAAAAAD8//8AAAAA+AdA//////8jDwAAAAAAgP//AwAAAOD/Afj/////fxgAAAAAAADw/x8AAAAA/n////////8HAAAAAAAAAP8HAwAAAPD////7////fwAAAAAAAACgPyAAAACA//9/f/////8DAAAAAAAAAPQBAAAAAPz///8v////fwAAAAAAAAAAHiAAAADA/////g////8EAAAAAAAAAOAjCAAAAPz//9//4D//AgAAAAAAAAAAPAMOAADA/////Qf84BcAAAAAAAAAAAA/AAAAAPz//78fgAf+QAAAAAAAAAAAAA8AAADg////+wA4gB8EAAAAAAAAAADAAAAAAP7///8BgAP4wQAAAAAAAAAAAAgPAADA////7wAwgAwYAAAAAAAAAAAA/w8AAPj///8HAAcIgAEAAAAAAAAAAID/AQAA////fwBAAAEQAAAAAAAAAAAA+P8AAODz//8DAAA0GAAAAAAAAAAAAID/HwAAAPj/HwAAgMMBAAAAAAAAAAAA/P8BAACA//8AAAA43wAAAAAAAAAAAMD/fwAAAPz/BwAAAOMFAQAAAAAAAAAA/P8/AACA/z8AAABgbvQBAAAAAAAAAOD//w8AAPD/AwAAAAQIfAIAAAAAAAAA/P//AQAA/z8AAACAA4APAAAAAAAAAMD//w8AAPD/AwAAAAAWsAEAAAAAAAAA+P//AAAA/j8AAAAAAAAAAAAAAAAAAAD//wcAAPD/QwAAAACAIwAAAAAAAAAA8P9/AAAA/z8GAAAAAD8GAAAAAAAAAAD8/wcAAPD/cwAAAAD4fwCAAAAAAAAAgP8/AAAA/w8HAAAAgP8PAAAAAAAAAAD4/wMAAOD/MAAAAAD//wEBAAAAAAAAgP8fAAAA/g8DAAAA+P8/AAAAAAAAAAD4PwAAAOB/EAAAAID//wMAAAAAAAAAwP8DAAAA/AMAAAAA+P9/AAAAAAAAAAD8HwAAAMA/AAAAAID//wcAAAAAAAAAwP8BAAAA+AEAAAAA8P9/AAAAAAAAAAD8DwAAAIAPAAAAAAAf/gMAAAAAAAAAwH8AAAAAAAAAAAAAEIAfAAAAAAAAAAD+AwAAAAAAAAAAAAAA8AEgAAAAAAAA4A8AAAAAAAAAAAAAAAAAAAYAAAAAAAB+AAAAAAAAAAAAAAAAgAAwAAAAAAAA4AMAAAAAAAAAAAAAAAAIgAEAAAAAAAAeAAAAAAAAAAAAAAAAAAAOAAAAAAAA8AEAAAAAAAAAAAAAAAAAAAAAAAAAAAAfAAAAAAAAAAABAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD8APj///8HAAAAAAAAAAA0AAAAAADA/P/h/////w8AAAAAAAAA4AcAAAD5////z///////fwAAAAAAvAf+AADA//////////////8HAAD4/////wMAAP7/////////////HwCA/f////8DAID///////////////8AAPP/////DwAO////////////////HwAA/v/////v+Pz//////////////38AAOD/////////////////////////P6Dj//////////////////////////9/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
    const bits = Uint8Array.from(atob(LAND), (c) => c.charCodeAt(0));
    const isLand = (lat, lon) => {
      const x = Math.min(179, Math.floor((lon + 180) / 2)), y = Math.min(89, Math.floor((90 - lat) / 2));
      const i = y * 180 + x;
      return (bits[i >> 3] >> (i & 7)) & 1;
    };

    const stage = root.querySelector(".hgl__stage");
    const canvas = root.querySelector(".hgl__globe");
    const ctx = canvas.getContext("2d");
    const cta = root.querySelector(".hgl__cta");
    const cards = [...root.querySelectorAll(".hgl__card")];
    const reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
    const still = reduce ? 99 : null;
    const D = Math.PI / 180;
    const vec = (lat, lon) => [Math.cos(lat * D) * Math.sin(lon * D), Math.sin(lat * D), Math.cos(lat * D) * Math.cos(lon * D)];

    // Fibonacci sphere: evenly spread points, each marked land or ocean.
    const N = 6400, golden = Math.PI * (3 - Math.sqrt(5)), pts = [];
    for (let i = 0; i < N; i++) {
      const y = 1 - (i / (N - 1)) * 2, r = Math.sqrt(1 - y * y), th = golden * i;
      const lat = Math.asin(y) / D;
      const lon = ((Math.atan2(Math.sin(th) * r, Math.cos(th) * r) / D) + 540) % 360 - 180;
      pts.push({ v: vec(lat, lon), land: !!isLand(lat, lon), seed: Math.random() });
    }
    // Plexus: join some land points to their nearest neighbours.
    const land = pts.filter((p) => p.land), links = [];
    for (let i = 0; i < land.length; i++) {
      const best = [];
      for (let j = 0; j < land.length; j++) {
        if (i === j) continue;
        const a = land[i].v, b = land[j].v;
        const d = (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2 + (a[2] - b[2]) ** 2;
        if (d < 0.0042) best.push([d, j]);
      }
      best.sort((x, y) => x[0] - y[0]).slice(0, 2).forEach(([, j]) => { if (j > i && land[i].seed < 0.55) links.push([land[i], land[j]]); });
    }

    const anchors = [...root.querySelectorAll(".hgl__pills li")].map((el) => ({ el, v: vec(+el.dataset.lat, +el.dataset.lon) }));
    const arcs = anchors.slice(1).map((a, i) => ({ from: anchors[0], to: a, delay: 0.35 + i * 0.22, speed: 0.11 + i * 0.015, phase: i * 0.27 }));

    // Desktop: the stage is the whole hero and the globe rises from under the CTA.
    // Narrow: the stage is its own block and the cards stack below it.
    let W = 0, H = 0, dpr = 1, cx = 0, cy = 0, R = 0;
    function resize() {
      const b = stage.getBoundingClientRect();
      dpr = Math.min(2, devicePixelRatio || 1);
      W = b.width; H = b.height;
      canvas.width = Math.round(W * dpr); canvas.height = Math.round(H * dpr);
      cx = W / 2;
      if (W < 980) {
        R = Math.min(W * 0.36, H * 0.34);
        cy = H * 0.5;
      } else {
        const top = cta.getBoundingClientRect().bottom - b.top + 56;
        R = Math.min(W * 0.19, (H - top) * 0.62, 320);
        cy = top + R;
        const [l, r] = cards, gap = 36;
        l.style.transform = `translate(${Math.max(24, cx - R - gap - l.offsetWidth).toFixed(0)}px, ${(cy - R * 0.42 - l.offsetHeight / 2).toFixed(0)}px)`;
        r.style.transform = `translate(${Math.min(W - 24 - r.offsetWidth, cx + R + gap * 2).toFixed(0)}px, ${Math.min(H - r.offsetHeight - 28, cy + R * 0.08 - r.offsetHeight / 2).toFixed(0)}px)`;
      }
      if (still !== null) draw(0);
    }

    // North tipped toward the viewer so North America sits mid-face.
    const TILT = 24 * D, ct = Math.cos(TILT), st = Math.sin(TILT);
    let rot = 0;
    function project(v, lift = 1) {
      const cr = Math.cos(rot), sr = Math.sin(rot);
      const x = v[0] * cr + v[2] * sr, z0 = -v[0] * sr + v[2] * cr;
      const y = v[1] * ct - z0 * st, z = v[1] * st + z0 * ct;
      return [cx + x * R * lift, cy - y * R * lift, z];
    }
    function slerp(a, b, t) {
      const dot = Math.max(-1, Math.min(1, a[0] * b[0] + a[1] * b[1] + a[2] * b[2]));
      const om = Math.acos(dot), so = Math.sin(om) || 1;
      const k1 = Math.sin((1 - t) * om) / so, k2 = Math.sin(t * om) / so;
      return [a[0] * k1 + b[0] * k2, a[1] * k1 + b[1] * k2, a[2] * k1 + b[2] * k2];
    }
    const ease = (t) => 1 - Math.pow(1 - Math.min(1, Math.max(0, t)), 4);
    function line(fn, a, b) {
      ctx.beginPath();
      let pen = false;
      for (let s = a; s <= b; s += 4) {
        const p = project(fn(s));
        if (p[2] > 0) { pen ? ctx.lineTo(p[0], p[1]) : ctx.moveTo(p[0], p[1]); pen = true; } else pen = false;
      }
      ctx.stroke();
    }

    const start = performance.now();
    function draw(now) {
      const t = still !== null ? still : (now - start) / 1000;
      rot = (100 + Math.sin(t * 0.12) * 26) * D; // sway around home base
      const intro = ease(t / 1.6);
      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
      ctx.clearRect(0, 0, W, H);

      const halo = ctx.createRadialGradient(cx, cy, R * 0.8, cx, cy, R * 1.5);
      halo.addColorStop(0, "rgba(116, 255, 237, 0.22)");
      halo.addColorStop(1, "rgba(116, 255, 237, 0)");
      ctx.fillStyle = halo;
      ctx.fillRect(0, 0, W, H);
      const body = ctx.createRadialGradient(cx - R * 0.35, cy - R * 0.45, R * 0.1, cx, cy, R);
      body.addColorStop(0, "rgba(34, 78, 120, 0.7)");
      body.addColorStop(0.65, "rgba(14, 28, 64, 0.72)");
      body.addColorStop(1, "rgba(80, 210, 215, 0.5)");
      ctx.globalAlpha = intro;
      ctx.beginPath(); ctx.arc(cx, cy, R, 0, Math.PI * 2); ctx.fillStyle = body; ctx.fill();
      ctx.lineWidth = 1.2; ctx.strokeStyle = "rgba(150, 255, 240, 0.55)"; ctx.stroke();

      ctx.lineWidth = 0.6;
      ctx.strokeStyle = "rgba(170, 220, 255, 0.10)";
      for (let lat = -60; lat <= 60; lat += 30) line((l) => vec(lat, l), -180, 180);
      for (let lon = -180; lon < 180; lon += 30) line((l) => vec(l, lon), -90, 90);

      links.forEach(([a, b]) => {
        const p = project(a.v), q = project(b.v);
        if (p[2] <= 0 || q[2] <= 0) return;
        ctx.strokeStyle = `rgba(150, 255, 240, ${(0.34 * p[2]).toFixed(3)})`;
        ctx.beginPath(); ctx.moveTo(p[0], p[1]); ctx.lineTo(q[0], q[1]); ctx.stroke();
      });

      const sc = 0.92 + 0.08 * intro;
      for (const p of pts) {
        let [x, y, z] = project(p.v);
        x = cx + (x - cx) * sc; y = cy + (y - cy) * sc;
        if (z < 0) {
          if (!p.land) continue;
          ctx.fillStyle = `rgba(150, 230, 255, ${(0.08 * intro).toFixed(3)})`;
          ctx.fillRect(x, y, 1.2, 1.2);
        } else if (p.land) {
          ctx.fillStyle = `rgba(${(200 + 40 * p.seed) | 0}, 255, 248, ${((0.4 + 0.6 * z) * intro).toFixed(3)})`;
          ctx.beginPath(); ctx.arc(x, y, (1.4 + z * 1.6) / 2, 0, Math.PI * 2); ctx.fill();
        } else {
          ctx.fillStyle = `rgba(150, 220, 255, ${(0.22 * z * intro).toFixed(3)})`;
          ctx.fillRect(x, y, 1.2, 1.2);
        }
      }
      ctx.globalAlpha = 1;

      arcs.forEach((arc) => {
        const grow = ease((t - arc.delay) / 1.2);
        if (grow <= 0) return;
        const steps = 64, end = Math.round(steps * grow);
        ctx.lineWidth = 1.6;
        ctx.shadowColor = "rgba(254, 129, 209, 0.9)";
        ctx.shadowBlur = 8;
        let prev = null;
        for (let i = 0; i <= end; i++) {
          const k = i / steps;
          const p = project(slerp(arc.from.v, arc.to.v, k), 1 + 0.22 * Math.sin(Math.PI * k));
          if (prev) {
            ctx.strokeStyle = Math.min(prev[2], p[2]) > -0.15 ? "rgba(254, 129, 209, 0.9)" : "rgba(254, 129, 209, 0.15)";
            ctx.beginPath(); ctx.moveTo(prev[0], prev[1]); ctx.lineTo(p[0], p[1]); ctx.stroke();
          }
          prev = p;
        }
        if (!reduce && grow >= 1) {
          const k = (t * arc.speed + arc.phase) % 1;
          const p = project(slerp(arc.from.v, arc.to.v, k), 1 + 0.22 * Math.sin(Math.PI * k));
          const g = ctx.createRadialGradient(p[0], p[1], 0, p[0], p[1], 9);
          g.addColorStop(0, "rgba(255, 230, 246, 1)");
          g.addColorStop(0.35, "rgba(254, 129, 209, 0.8)");
          g.addColorStop(1, "rgba(254, 129, 209, 0)");
          ctx.fillStyle = g;
          ctx.beginPath(); ctx.arc(p[0], p[1], 9, 0, Math.PI * 2); ctx.fill();
        }
        ctx.shadowBlur = 0;
      });

      anchors.forEach((a, i) => {
        const p = project(a.v);
        if (p[2] < -0.1) return;
        const col = i === 0 ? "116, 255, 237" : "254, 129, 209";
        const g = ctx.createRadialGradient(p[0], p[1], 0, p[0], p[1], 12);
        g.addColorStop(0, `rgba(${col}, 0.9)`);
        g.addColorStop(1, `rgba(${col}, 0)`);
        ctx.fillStyle = g;
        ctx.beginPath(); ctx.arc(p[0], p[1], 12, 0, Math.PI * 2); ctx.fill();
        ctx.fillStyle = "#fff";
        ctx.beginPath(); ctx.arc(p[0], p[1], 2.4, 0, Math.PI * 2); ctx.fill();
      });

      // Pills follow their nodes; labels that would overlap are nudged apart.
      const boxes = [];
      anchors.forEach((a, i) => {
        const p = project(a.v, 1.04);
        const appear = ease((t - (i ? arcs[i - 1].delay + 0.9 : 0.4)) / 0.6);
        const vis = Math.max(0, Math.min(1, (p[2] + 0.05) * 5)) * appear;
        const el = a.el, w = el.offsetWidth, h = el.offsetHeight;
        let x = i === 0 ? p[0] - w - 12 : p[0] + 12;
        if (x + w > W - 8) x = p[0] - w - 12;
        if (x < 8) x = p[0] + 12;
        let y = p[1] - h / 2;
        for (const b of boxes) {
          if (x < b.x + b.w + 6 && x + w + 6 > b.x && y < b.y + b.h + 4 && y + h + 4 > b.y) y = y < b.y ? b.y - h - 4 : b.y + b.h + 4;
        }
        boxes.push({ x, y, w, h });
        el.style.transform = `translate(${x.toFixed(1)}px, ${y.toFixed(1)}px) scale(${0.9 + 0.1 * appear})`;
        el.style.opacity = vis.toFixed(3);
      });
    }

    new ResizeObserver(resize).observe(root);
    resize();
    if (still !== null) return;
    // Only animate while the globe is on screen and the tab is visible.
    let running = false, raf = 0;
    const loop = (now) => { draw(now); if (running) raf = requestAnimationFrame(loop); };
    const set = (on) => { running = on; cancelAnimationFrame(raf); if (on) raf = requestAnimationFrame(loop); };
    let seen = true;
    new IntersectionObserver(([e]) => { seen = e.isIntersecting; set(seen && !document.hidden); }).observe(stage);
    document.addEventListener("visibilitychange", () => set(seen && !document.hidden));
  });
</script>

Kind
Section
Category
Hero
Added
5 Nov 2026
Canvas
Full width
File
snippet.html
Size
473 lines · 26.3 KB
  • dark
  • canvas
  • globe
  • glassmorphism
  • gradient

One file: HTML, a style block and, when needed, a small script. Paste it anywhere. Nothing to install.