# #046 — Cartographic Vector Studio

> Parchment-toned vector cartography workbench with toggleable contour layers, PMTiles inspector, and sheet coordinates.

## Metadata

- **Index**: #046
- **Slug**: `cartographic-vector-studio`
- **Kind**: `style`
- **Family**: Telemetry & Cartographic
- **Theme**: `light`
- **Mobile Strength**: `high`
- **Tags**: `cartography`, `topographic`, `vector-tiles`, `gis`, `parchment`, `technical`
- **Best For**: Open-source GIS and vector tile inspection tools, Trail, terrain, and regional cartography explorers, Urban planning and cadastral map interfaces
- **Real-World Inspiration**: [Protomaps](https://protomaps.com/)
- **Detail Page**: https://templates.michaelpitts.net/t/cartographic-vector-studio
- **Live Demo**: https://templates.michaelpitts.net/demos/cartographic-vector-studio.html
- **JSON API**: https://templates.michaelpitts.net/api/templates/cartographic-vector-studio

## Why This Aesthetic Is Unique

Honors classic USGS topographic map sheets in a modern browser-native vector tile inspector, pairing warm parchment contours with crisp technical tile-coordinate readouts.

## Color Palette

| Role | Name | Hex |
|------|------|-----|
| `canvas` | Parchment Contour | `#F4F1E8` |
| `surface` | Map Legend Sheet | `#FCFBF7` |
| `ink` | Cartographic Ink | `#1F2421` |
| `accent` | Topographic Teal | `#1B6B63` |
| `muted` | Contour Ochre | `#7E7866` |

## Typography

- **Display**: `Instrument Sans`
- **Body**: `Inter`
- **Mono**: `IBM Plex Mono`
- **Scale Notes**: Crisp 11px monospace map-sheet border ticks and z/x/y tile addresses paired with clean 14px layer control labels.
- **Google Fonts**: https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Instrument+Sans:wght@500;600;700&family=Inter:wght@400;500;600&display=swap
  ```html
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Instrument+Sans:wght@500;600;700&family=Inter:wght@400;500;600&display=swap">
  ```

## Layout Architecture

Framed topographic map sheet with degree-tick margins, paired with a compact layer-toggle and PMTiles byte-range inspector sidebar.

## Interaction & Micro-Motion Rules

Toggle Elevation Contours, Hydrography, Transit Roads, and Map Labels independently; click tile cells to inspect z/x/y coordinates, feature count, and gzipped byte size.

## Mobile & Responsive Rules

Map sheet remains full-bleed inside a clean frame while layer toggles and tile metadata stack below as 44px touch switches.

## Agent Guardrails

### DO
- Use subtle map-sheet border hairlines and coordinate ticks to establish cartographic authenticity
- Differentiate hydrography, contour lines, and transit layers with harmonious muted earth/teal tones
- Keep tile metadata (z/x/y, bytes, schema) strictly aligned in monospace

### DON'T
- Do not use saturated primary colors that fight with topographic contour lines
- Do not obscure the map viewport with oversized floating marketing copy

## Complete Standalone Starter Code

File: `demos/cartographic-vector-studio.html`

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Meridian — Open-Source Vector Cartography &amp; PMTiles Explorer</title>
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&family=Newsreader:ital,opsz,wght@0,6..72,500;0,6..72,600;1,6..72,400&display=swap" rel="stylesheet">
  <style>
    :root {
      --canvas: #F4F1E8;
      --surface: #FCFBF7;
      --ink: #1F2421;
      --accent: #1B6B63;
      --accent-soft: rgba(27, 107, 99, 0.11);
      --muted: #7E7866;
      --rule: #DDD6C5;
      --rule-strong: #C2B89F;
      --contour: #B57B4C;
      --contour-index: #91582C;
      --hydro: #3A7A9C;
      --hydro-fill: #D8E7EC;
      --road-major: #C0563B;
      --road-minor: #6A6557;
      --map-bg: #EFEAD9;
      --font-serif: 'Newsreader', Georgia, serif;
      --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
      --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
    }

    [data-basemap="relief"] {
      --map-bg: #E7E3D2;
      --hydro-fill: #C6DCE5;
      --contour: #8C6A4A;
      --contour-index: #6B4728;
    }

    [data-basemap="mono"] {
      --map-bg: #F7F6F2;
      --hydro-fill: #E4E4DF;
      --hydro: #4A4D4B;
      --contour: #96948C;
      --contour-index: #52504A;
      --road-major: #262A28;
      --road-minor: #787A76;
    }

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

    html, body {
      margin: 0;
      padding: 0;
      background: var(--canvas);
      color: var(--ink);
      font-family: var(--font-sans);
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
      overflow-x: hidden;
    }

    /* Header */
    .topbar {
      position: sticky;
      top: 0;
      z-index: 40;
      background: rgba(244, 241, 232, 0.94);
      backdrop-filter: blur(8px);
      border-bottom: 1px solid var(--rule);
    }

    .topbar-inner {
      max-width: 1320px;
      margin: 0 auto;
      padding: 0.75rem 1.25rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 0.7rem;
      text-decoration: none;
      color: var(--ink);
      min-width: 0;
    }

    .brand-mark {
      width: 34px;
      height: 34px;
      flex-shrink: 0;
    }

    .brand-text {
      display: flex;
      flex-direction: column;
      line-height: 1.15;
    }

    .brand-name {
      font-family: var(--font-serif);
      font-size: 1.25rem;
      font-weight: 600;
      letter-spacing: -0.01em;
    }

    .brand-sub {
      font-family: var(--font-mono);
      font-size: 0.68rem;
      color: var(--muted);
      letter-spacing: 0.06em;
      text-transform: uppercase;
    }

    .nav-links {
      display: flex;
      align-items: center;
      gap: 1.5rem;
    }

    .nav-links a {
      text-decoration: none;
      color: var(--ink);
      font-size: 0.88rem;
      font-weight: 500;
      padding: 0.35rem 0;
      border-bottom: 2px solid transparent;
      transition: color 0.15s, border-color 0.15s;
    }

    .nav-links a:hover,
    .nav-links a.active {
      color: var(--accent);
      border-bottom-color: var(--accent);
    }

    .archive-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      padding: 0.35rem 0.7rem;
      background: var(--surface);
      border: 1px solid var(--rule);
      border-radius: 999px;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--muted);
      white-space: nowrap;
    }

    .archive-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--accent);
    }

    .menu-toggle {
      display: none;
      align-items: center;
      justify-content: center;
      min-width: 44px;
      min-height: 44px;
      background: var(--surface);
      border: 1px solid var(--rule-strong);
      border-radius: 6px;
      color: var(--ink);
      cursor: pointer;
    }

    .mobile-drawer {
      display: none;
      border-top: 1px solid var(--rule);
      background: var(--surface);
      padding: 0.75rem 1.25rem 1rem;
    }

    .mobile-drawer.open {
      display: block;
    }

    .mobile-drawer a {
      display: flex;
      align-items: center;
      min-height: 44px;
      text-decoration: none;
      color: var(--ink);
      font-weight: 500;
      border-bottom: 1px solid var(--rule);
    }

    .mobile-drawer a:last-child {
      border-bottom: none;
    }

    /* Main Container */
    .shell {
      max-width: 1320px;
      margin: 0 auto;
      padding: 1.5rem 1.25rem 3rem;
    }

    .hero-bar {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-end;
      justify-content: space-between;
      gap: 1rem;
      padding-bottom: 1.25rem;
      border-bottom: 1px solid var(--rule);
      margin-bottom: 1.5rem;
    }

    .hero-copy {
      max-width: 680px;
    }

    .eyebrow {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--accent);
      margin: 0 0 0.35rem;
      font-weight: 600;
    }

    h1 {
      font-family: var(--font-serif);
      font-size: clamp(1.75rem, 3.2vw, 2.5rem);
      font-weight: 600;
      line-height: 1.12;
      margin: 0 0 0.5rem;
      letter-spacing: -0.015em;
    }

    .hero-desc {
      margin: 0;
      color: var(--muted);
      font-size: 0.95rem;
    }

    .style-switcher {
      display: inline-flex;
      background: var(--surface);
      border: 1px solid var(--rule-strong);
      border-radius: 6px;
      padding: 3px;
      gap: 2px;
    }

    .style-btn {
      min-height: 38px;
      padding: 0 0.85rem;
      border: none;
      background: transparent;
      color: var(--muted);
      font-family: var(--font-mono);
      font-size: 0.75rem;
      font-weight: 500;
      border-radius: 4px;
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
    }

    .style-btn.active {
      background: var(--accent);
      color: #FCFBF7;
    }

    /* Workbench Grid */
    .workbench {
      display: grid;
      grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.85fr);
      gap: 1.25rem;
      align-items: start;
    }

    /* Map Sheet Frame with Margin Coordinates */
    .map-sheet {
      background: var(--surface);
      border: 1px solid var(--rule-strong);
      border-radius: 6px;
      padding: 0.85rem;
      box-shadow: 0 2px 10px rgba(31, 36, 33, 0.05);
    }

    .sheet-header {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      gap: 0.5rem;
      padding-bottom: 0.65rem;
      margin-bottom: 0.65rem;
      border-bottom: 1px solid var(--rule);
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--muted);
    }

    .sheet-title {
      color: var(--ink);
      font-weight: 600;
      letter-spacing: 0.04em;
    }

    .neatline-wrapper {
      display: grid;
      grid-template-columns: 26px 1fr 26px;
      grid-template-rows: 22px auto 22px;
      align-items: center;
    }

    .coord-top, .coord-bottom {
      grid-column: 2;
      display: flex;
      justify-content: space-between;
      padding: 0 6%;
      font-family: var(--font-mono);
      font-size: 0.65rem;
      color: var(--muted);
      user-select: none;
    }

    .coord-left, .coord-right {
      grid-row: 2;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      height: 100%;
      padding: 12% 0;
      font-family: var(--font-mono);
      font-size: 0.62rem;
      color: var(--muted);
      user-select: none;
    }

    .coord-left span {
      writing-mode: vertical-rl;
      transform: rotate(180deg);
      text-align: center;
    }

    .coord-right span {
      writing-mode: vertical-rl;
      text-align: center;
    }

    .map-viewport {
      grid-column: 2;
      grid-row: 2;
      position: relative;
      border: 1.5px solid var(--ink);
      background: var(--map-bg);
      overflow: hidden;
      transition: background 0.25s ease;
    }

    .map-svg {
      display: block;
      width: 100%;
      height: auto;
      aspect-ratio: 3 / 2;
    }

    .map-layer {
      transition: opacity 0.22s ease;
    }

    .map-layer.hidden {
      opacity: 0;
      pointer-events: none;
    }

    .tile-cell {
      fill: transparent;
      stroke: rgba(27, 107, 99, 0.38);
      stroke-width: 1;
      stroke-dasharray: 4 3;
      cursor: pointer;
      transition: fill 0.15s, stroke 0.15s;
    }

    .tile-cell:hover {
      fill: rgba(27, 107, 99, 0.09);
      stroke: var(--accent);
      stroke-dasharray: none;
    }

    .tile-cell.selected {
      fill: rgba(27, 107, 99, 0.14);
      stroke: var(--accent);
      stroke-width: 2.2;
      stroke-dasharray: none;
    }

    .tile-tag {
      font-family: var(--font-mono);
      font-size: 11px;
      fill: var(--accent);
      font-weight: 600;
      pointer-events: none;
    }

    .sheet-footer {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      gap: 0.75rem;
      padding-top: 0.7rem;
      margin-top: 0.65rem;
      border-top: 1px solid var(--rule);
      font-family: var(--font-mono);
      font-size: 0.7rem;
      color: var(--muted);
    }

    .scale-bar {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
    }

    .scale-graphic {
      display: inline-flex;
      width: 96px;
      height: 6px;
      border: 1px solid var(--ink);
    }

    .scale-graphic span:nth-child(odd) {
      flex: 1;
      background: var(--ink);
    }

    .scale-graphic span:nth-child(even) {
      flex: 1;
      background: var(--surface);
    }

    /* Sidebar Panels */
    .sidebar {
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    .panel {
      background: var(--surface);
      border: 1px solid var(--rule-strong);
      border-radius: 6px;
      padding: 1rem 1.1rem;
    }

    .panel-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.85rem;
      padding-bottom: 0.55rem;
      border-bottom: 1px solid var(--rule);
    }

    .panel-title {
      margin: 0;
      font-family: var(--font-mono);
      font-size: 0.76rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--ink);
    }

    .panel-badge {
      font-family: var(--font-mono);
      font-size: 0.7rem;
      color: var(--accent);
      background: var(--accent-soft);
      padding: 0.15rem 0.5rem;
      border-radius: 4px;
      font-weight: 600;
    }

    /* Layer Toggles */
    .layer-list {
      display: flex;
      flex-direction: column;
      gap: 0.45rem;
    }

    .layer-toggle {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: 44px;
      padding: 0.45rem 0.7rem;
      border: 1px solid var(--rule);
      border-radius: 5px;
      background: var(--canvas);
      cursor: pointer;
      transition: border-color 0.15s, background 0.15s;
      user-select: none;
    }

    .layer-toggle:hover {
      border-color: var(--accent);
    }

    .layer-toggle-left {
      display: flex;
      align-items: center;
      gap: 0.65rem;
    }

    .layer-swatch {
      width: 14px;
      height: 14px;
      border-radius: 3px;
      flex-shrink: 0;
    }

    .layer-name {
      font-size: 0.86rem;
      font-weight: 500;
      color: var(--ink);
    }

    .layer-meta {
      font-family: var(--font-mono);
      font-size: 0.7rem;
      color: var(--muted);
    }

    .layer-toggle input {
      width: 18px;
      height: 18px;
      accent-color: var(--accent);
      cursor: pointer;
    }

    /* Tile Inspector */
    .kv-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.6rem;
      margin-bottom: 0.9rem;
    }

    .kv-box {
      background: var(--canvas);
      border: 1px solid var(--rule);
      border-radius: 4px;
      padding: 0.55rem 0.65rem;
    }

    .kv-label {
      display: block;
      font-family: var(--font-mono);
      font-size: 0.64rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--muted);
      margin-bottom: 0.15rem;
    }

    .kv-val {
      font-family: var(--font-mono);
      font-size: 0.84rem;
      font-weight: 600;
      color: var(--ink);
      word-break: break-all;
    }

    .range-box {
      background: #1F2421;
      color: #F4F1E8;
      border-radius: 4px;
      padding: 0.6rem 0.75rem;
      font-family: var(--font-mono);
      font-size: 0.71rem;
      margin-bottom: 0.9rem;
      overflow-x: auto;
      white-space: nowrap;
    }

    .range-box .hl {
      color: #7AD4C9;
    }

    .budget-list {
      display: flex;
      flex-direction: column;
      gap: 0.45rem;
    }

    .budget-row {
      display: grid;
      grid-template-columns: 82px 1fr 46px;
      align-items: center;
      gap: 0.5rem;
      font-family: var(--font-mono);
      font-size: 0.7rem;
    }

    .budget-track {
      height: 7px;
      background: var(--rule);
      border-radius: 99px;
      overflow: hidden;
    }

    .budget-fill {
      height: 100%;
      background: var(--accent);
      border-radius: 99px;
      transition: width 0.25s ease;
    }

    /* Spec Strip */
    .spec-strip {
      margin-top: 1.5rem;
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1rem;
    }

    .spec-card {
      background: var(--surface);
      border: 1px solid var(--rule);
      border-radius: 6px;
      padding: 1rem 1.1rem;
    }

    .spec-card h3 {
      margin: 0 0 0.35rem;
      font-family: var(--font-serif);
      font-size: 1.08rem;
      font-weight: 600;
    }

    .spec-card p {
      margin: 0;
      font-size: 0.84rem;
      color: var(--muted);
    }

    .cli-bar {
      margin-top: 1.25rem;
      background: var(--surface);
      border: 1px solid var(--rule-strong);
      border-radius: 6px;
      padding: 0.85rem 1.1rem;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
    }

    .cli-code {
      font-family: var(--font-mono);
      font-size: 0.8rem;
      color: var(--ink);
      overflow-x: auto;
    }

    .cli-code .cmd {
      color: var(--accent);
      font-weight: 600;
    }

    .copy-btn {
      min-height: 44px;
      padding: 0 1rem;
      background: var(--accent);
      color: #FCFBF7;
      border: none;
      border-radius: 5px;
      font-family: var(--font-mono);
      font-size: 0.76rem;
      font-weight: 600;
      cursor: pointer;
    }

    .copy-btn:hover {
      filter: brightness(1.08);
    }

    @media (max-width: 960px) {
      .workbench {
        grid-template-columns: 1fr;
      }
      .spec-strip {
        grid-template-columns: 1fr;
      }
    }

    @media (max-width: 720px) {
      .nav-links, .archive-pill {
        display: none;
      }
      .menu-toggle {
        display: inline-flex;
      }
      .shell {
        padding: 1rem 0.85rem 2.5rem;
      }
      .style-switcher {
        width: 100%;
      }
      .style-btn {
        flex: 1;
        min-height: 44px;
        padding: 0 0.4rem;
      }
      .neatline-wrapper {
        grid-template-columns: 20px 1fr 20px;
      }
      .coord-top, .coord-bottom {
        font-size: 0.56rem;
        padding: 0 2%;
      }
      .coord-left, .coord-right {
        font-size: 0.54rem;
      }
      .kv-grid {
        grid-template-columns: 1fr 1fr;
      }
    }
  </style>
</head>
<body data-basemap="topo">
  <header class="topbar">
    <div class="topbar-inner">
      <a href="#workbench" class="brand">
        <svg class="brand-mark" viewBox="0 0 36 36" fill="none" aria-hidden="true">
          <circle cx="18" cy="18" r="16" stroke="#1F2421" stroke-width="1.5"/>
          <circle cx="18" cy="18" r="11" stroke="#1B6B63" stroke-width="1" stroke-dasharray="2 2"/>
          <path d="M18 4L21.5 18L18 32L14.5 18L18 4Z" fill="#1B6B63"/>
          <path d="M4 18L18 14.5L32 18L18 21.5L4 18Z" stroke="#1F2421" stroke-width="1.2" fill="#FCFBF7"/>
          <circle cx="18" cy="18" r="2.2" fill="#1F2421"/>
        </svg>
        <span class="brand-text">
          <span class="brand-name">Meridian</span>
          <span class="brand-sub">PMTiles v3 Vector Atlas</span>
        </span>
      </a>

      <nav class="nav-links" aria-label="Primary">
        <a href="#workbench" class="active">Tile Explorer</a>
        <a href="#spec">Archive Spec</a>
        <a href="#cli">Extract CLI</a>
        <a href="#workbench" id="nav-reset-tile">Reset View</a>
      </nav>

      <div class="archive-pill" title="Cloud-native single-file vector archive">
        <span class="archive-dot"></span>
        <span>cascadia-202604.pmtiles · 1.84 GB</span>
      </div>

      <button class="menu-toggle" id="menuToggle" aria-expanded="false" aria-controls="mobileDrawer" aria-label="Toggle navigation menu">
        <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8">
          <path d="M3 5h14M3 10h14M3 15h14"/>
        </svg>
      </button>
    </div>
    <div class="mobile-drawer" id="mobileDrawer">
      <a href="#workbench">Tile Explorer</a>
      <a href="#spec">Archive Spec</a>
      <a href="#cli">Extract CLI</a>
      <a href="#workbench" id="mobile-reset-tile">Reset Active Tile</a>
    </div>
  </header>

  <main class="shell">
    <section class="hero-bar">
      <div class="hero-copy">
        <p class="eyebrow">Sheet 14-NW · WGS84 / Web Mercator · Zero-Server Vector Tiles</p>
        <h1>Single-file vector cartography over HTTP Range requests.</h1>
        <p class="hero-desc">Inspect topographic contour layers, hydrography, and compressed MVT tile payloads directly from an object-storage archive. Tap any grid cell to inspect its Hilbert index and byte range.</p>
      </div>
      <div class="style-switcher" role="group" aria-label="Basemap theme">
        <button class="style-btn active" data-style="topo">Light Topo</button>
        <button class="style-btn" data-style="relief">Terrain</button>
        <button class="style-btn" data-style="mono">Print Mono</button>
      </div>
    </section>

    <section class="workbench" id="workbench">
      <!-- Map Sheet -->
      <div class="map-sheet">
        <div class="sheet-header">
          <span class="sheet-title">CASCADIA SOUND — QUADRANGLE 47122-E3</span>
          <span>DATUM: WGS84 · CONTOUR INTERVAL: 200M · ZOOM 12</span>
        </div>

        <div class="neatline-wrapper">
          <div class="coord-top">
            <span>122°26'W</span>
            <span>122°22'W</span>
            <span>122°18'W</span>
            <span>122°14'W</span>
          </div>

          <div class="coord-left">
            <span>47°40'N</span>
            <span>47°36'N</span>
          </div>

          <div class="map-viewport">
            <svg class="map-svg" viewBox="0 0 900 600" role="img" aria-label="Interactive topographic vector map of Cascadia Sound with clickable PMTiles grid">
              <defs>
                <pattern id="marshPattern" width="12" height="12" patternUnits="userSpaceOnUse">
                  <path d="M2 8h6M4 5h4" stroke="#3A7A9C" stroke-width="0.8" opacity="0.45"/>
                </pattern>
              </defs>

              <!-- Layer: Hydrography -->
              <g id="layer-hydro" class="map-layer">
                <path d="M0 0 H310 C295 85 255 120 278 195 C298 260 220 315 245 395 C265 460 195 515 215 600 H0 Z" fill="var(--hydro-fill)"/>
                <path d="M310 0 C295 85 255 120 278 195 C298 260 220 315 245 395 C265 460 195 515 215 600" fill="none" stroke="var(--hydro)" stroke-width="2"/>
                <!-- Bathymetry lines -->
                <path d="M250 0 C235 85 205 125 225 198 C242 260 172 315 192 395 C208 455 155 515 168 600" fill="none" stroke="var(--hydro)" stroke-width="0.9" stroke-dasharray="6 4" opacity="0.65"/>
                <path d="M180 0 C170 90 140 140 160 215 C175 275 115 330 130 415 C140 475 95 530 105 600" fill="none" stroke="var(--hydro)" stroke-width="0.8" stroke-dasharray="3 4" opacity="0.45"/>
                <!-- Tributary River & Estuary -->
                <path d="M268 188 C345 198 408 165 485 178 C565 192 612 145 702 135 C775 126 838 148 900 128" fill="none" stroke="var(--hydro)" stroke-width="3.2" stroke-linecap="round"/>
                <path d="M485 178 C515 235 558 275 628 312 C698 348 765 332 900 368" fill="none" stroke="var(--hydro)" stroke-width="2" stroke-linecap="round"/>
                <!-- Alpine Lake -->
                <path d="M645 435 C680 415 735 422 752 455 C766 482 722 515 676 508 C638 502 622 458 645 435 Z" fill="var(--hydro-fill)" stroke="var(--hydro)" stroke-width="1.6"/>
                <!-- Delta Marsh -->
                <path d="M265 162 C308 158 340 178 332 212 C320 232 276 226 268 198 Z" fill="url(#marshPattern)"/>
              </g>

              <!-- Layer: Elevation Contours -->
              <g id="layer-contours" class="map-layer" fill="none">
                <!-- Northern Ridge -->
                <path d="M355 0 C385 45 455 72 535 65 C625 58 690 22 775 42 C825 54 868 35 900 22" stroke="var(--contour)" stroke-width="1"/>
                <path d="M398 0 C432 32 492 48 562 42 C640 35 705 8 785 24" stroke="var(--contour-index)" stroke-width="1.6"/>
                <!-- Central Massif -->
                <path d="M342 308 C392 248 488 228 565 256 C638 282 652 356 602 412 C548 472 418 486 355 432 C312 396 308 348 342 308 Z" stroke="var(--contour)" stroke-width="1"/>
                <path d="M382 322 C422 276 495 262 552 284 C605 304 612 358 575 398 C532 442 435 452 388 412 C356 385 354 352 382 322 Z" stroke="var(--contour-index)" stroke-width="1.7"/>
                <path d="M424 338 C452 308 502 298 538 314 C572 328 575 362 548 386 C518 412 456 418 426 392 C406 375 406 356 424 338 Z" stroke="var(--contour)" stroke-width="1"/>
                <path d="M462 350 C482 336 512 334 528 348 C542 360 532 378 508 384 C482 390 452 374 462 350 Z" stroke="var(--contour-index)" stroke-width="1.5"/>
                <!-- Eastern Summit -->
                <path d="M715 198 C768 168 852 178 885 228 C910 268 872 324 812 328 C746 332 688 282 702 228 C705 214 708 202 715 198 Z" stroke="var(--contour)" stroke-width="1"/>
                <path d="M752 222 C788 202 840 212 858 242 C872 268 846 302 806 302 C762 302 732 268 742 238 C745 230 748 226 752 222 Z" stroke="var(--contour-index)" stroke-width="1.6"/>
                <!-- Southern Foothills -->
                <path d="M275 512 C348 486 435 518 525 505 C605 494 695 542 785 526 C835 518 872 542 900 555" stroke="var(--contour)" stroke-width="1"/>
                <path d="M312 562 C392 536 472 562 565 552 C652 542 742 582 845 568" stroke="var(--contour-index)" stroke-width="1.5"/>
              </g>

              <!-- Layer: Transit Roads & Rail -->
              <g id="layer-roads" class="map-layer" fill="none">
                <!-- Coastal Highway -->
                <path d="M332 0 C328 78 308 135 322 208 C335 278 292 342 302 422 C310 486 276 545 288 600" stroke="var(--road-major)" stroke-width="3.2" stroke-linecap="round"/>
                <!-- Cross-Pass Arterial -->
                <path d="M322 208 C412 222 495 215 588 188 C675 162 768 182 900 172" stroke="var(--road-major)" stroke-width="2.4" stroke-linecap="round"/>
                <!-- Secondary Mountain Road -->
                <path d="M302 422 C378 446 462 478 552 465 C625 455 685 398 768 388 C822 382 868 418 900 412" stroke="var(--road-minor)" stroke-width="1.6" stroke-dasharray="1 0"/>
                <!-- Ferry Route -->
                <path d="M0 245 C88 232 182 218 272 206" stroke="var(--accent)" stroke-width="1.6" stroke-dasharray="5 5"/>
                <!-- Rail Corridor -->
                <path d="M348 0 C342 84 328 145 344 218 C360 288 322 355 332 436 C338 492 315 552 325 600" stroke="#1F2421" stroke-width="1.1" stroke-dasharray="8 4"/>
              </g>

              <!-- Layer: Cartographic Labels -->
              <g id="layer-labels" class="map-layer" font-family="IBM Plex Sans, sans-serif">
                <text x="86" y="138" font-size="15" font-style="italic" font-family="Newsreader, Georgia, serif" fill="#2E6482" letter-spacing="2.5">CASCADIA</text>
                <text x="102" y="158" font-size="15" font-style="italic" font-family="Newsreader, Georgia, serif" fill="#2E6482" letter-spacing="2.5">SOUND</text>
                <text x="72" y="232" font-size="10" font-family="IBM Plex Mono, monospace" fill="#1B6B63">FERRY · 24 MIN</text>

                <!-- Summit marker -->
                <path d="M498 358 l5 9 h-10 z" fill="#1F2421"/>
                <text x="458" y="346" font-size="12" font-weight="600" fill="#1F2421">Mt. Alder</text>
                <text x="466" y="382" font-size="10" font-family="IBM Plex Mono, monospace" fill="#7E7866">1,420m</text>

                <path d="M802 252 l4.5 8 h-9 z" fill="#1F2421"/>
                <text x="768" y="242" font-size="11" font-weight="600" fill="#1F2421">Granite Pk</text>
                <text x="778" y="274" font-size="9.5" font-family="IBM Plex Mono, monospace" fill="#7E7866">1,180m</text>

                <!-- Town & Hydro labels -->
                <circle cx="322" cy="208" r="4" fill="#FCFBF7" stroke="#1F2421" stroke-width="2"/>
                <text x="334" y="203" font-size="12" font-weight="600" fill="#1F2421">Port Meridian</text>
                <text x="656" y="472" font-size="10.5" font-style="italic" font-family="Newsreader, Georgia, serif" fill="#2E6482">Mirror Tarn</text>
                <text x="530" y="166" font-size="10" font-style="italic" fill="#2E6482">Skagit Fork</text>
                <text x="394" y="294" font-size="9" font-family="IBM Plex Mono, monospace" fill="#91582C">800m</text>
                <text x="562" y="438" font-size="9" font-family="IBM Plex Mono, monospace" fill="#91582C">600m</text>
              </g>

              <!-- Interactive PMTiles 3x2 Grid (z=12) -->
              <g id="tile-grid">
                <rect class="tile-cell" data-tile="12/654/1432" x="0" y="0" width="300" height="300"/>
                <text class="tile-tag" x="12" y="22">12/654/1432</text>

                <rect class="tile-cell selected" data-tile="12/655/1432" x="300" y="0" width="300" height="300"/>
                <text class="tile-tag" x="312" y="22">12/655/1432</text>

                <rect class="tile-cell" data-tile="12/656/1432" x="600" y="0" width="300" height="300"/>
                <text class="tile-tag" x="612" y="22">12/656/1432</text>

                <rect class="tile-cell" data-tile="12/654/1433" x="0" y="300" width="300" height="300"/>
                <text class="tile-tag" x="12" y="322">12/654/1433</text>

                <rect class="tile-cell" data-tile="12/655/1433" x="300" y="300" width="300" height="300"/>
                <text class="tile-tag" x="312" y="322">12/655/1433</text>

                <rect class="tile-cell" data-tile="12/656/1433" x="600" y="300" width="300" height="300"/>
                <text class="tile-tag" x="612" y="322">12/656/1433</text>
              </g>
            </svg>
          </div>

          <div class="coord-right">
            <span>47°40'N</span>
            <span>47°36'N</span>
          </div>

          <div class="coord-bottom">
            <span>122°26'W</span>
            <span>122°22'W</span>
            <span>122°18'W</span>
            <span>122°14'W</span>
          </div>
        </div>

        <div class="sheet-footer">
          <div class="scale-bar">
            <span class="scale-graphic"><span></span><span></span><span></span><span></span></span>
            <span>0 — 2 — 4 km (1:50,000)</span>
          </div>
          <span>CLICK ANY TILE CELL TO INSPECT MVT PAYLOAD</span>
        </div>
      </div>

      <!-- Right Controls & Inspector -->
      <aside class="sidebar">
        <div class="panel">
          <div class="panel-head">
            <h2 class="panel-title">Vector Layers</h2>
            <span class="panel-badge" id="activeLayerCount">4 / 4 Active</span>
          </div>
          <div class="layer-list">
            <label class="layer-toggle">
              <span class="layer-toggle-left">
                <span class="layer-swatch" style="background: var(--contour-index);"></span>
                <span>
                  <span class="layer-name">Elevation Contours</span><br>
                  <span class="layer-meta">contours_200m · LineString</span>
                </span>
              </span>
              <input type="checkbox" data-target="layer-contours" checked>
            </label>

            <label class="layer-toggle">
              <span class="layer-toggle-left">
                <span class="layer-swatch" style="background: var(--hydro);"></span>
                <span>
                  <span class="layer-name">Hydrography</span><br>
                  <span class="layer-meta">water_poly + rivers · Polygon</span>
                </span>
              </span>
              <input type="checkbox" data-target="layer-hydro" checked>
            </label>

            <label class="layer-toggle">
              <span class="layer-toggle-left">
                <span class="layer-swatch" style="background: var(--road-major);"></span>
                <span>
                  <span class="layer-name">Transit Roads</span><br>
                  <span class="layer-meta">roads + rail + ferry · LineString</span>
                </span>
              </span>
              <input type="checkbox" data-target="layer-roads" checked>
            </label>

            <label class="layer-toggle">
              <span class="layer-toggle-left">
                <span class="layer-swatch" style="background: var(--ink);"></span>
                <span>
                  <span class="layer-name">Map Labels</span><br>
                  <span class="layer-meta">places + peaks · Point</span>
                </span>
              </span>
              <input type="checkbox" data-target="layer-labels" checked>
            </label>
          </div>
        </div>

        <div class="panel" aria-live="polite">
          <div class="panel-head">
            <h2 class="panel-title">Tile Inspector</h2>
            <span class="panel-badge" id="inspTileId">12/655/1432</span>
          </div>

          <div class="kv-grid">
            <div class="kv-box">
              <span class="kv-label">Hilbert TileID</span>
              <span class="kv-val" id="inspHilbert">19,482,104</span>
            </div>
            <div class="kv-box">
              <span class="kv-label">Gzipped Size</span>
              <span class="kv-val" id="inspSize">42.8 KB</span>
            </div>
            <div class="kv-box">
              <span class="kv-label">MVT Features</span>
              <span class="kv-val" id="inspFeatures">1,842</span>
            </div>
            <div class="kv-box">
              <span class="kv-label">Quadrant Focus</span>
              <span class="kv-val" id="inspRegion">Port Meridian</span>
            </div>
          </div>

          <div class="range-box" id="inspRange">
            GET /cascadia-202604.pmtiles<br>
            <span class="hl">Range: bytes=84192044-84235871</span> · 206 Partial
          </div>

          <div class="budget-list" id="budgetList">
            <div class="budget-row">
              <span>contours</span>
              <div class="budget-track"><div class="budget-fill" id="bar-contours" style="width: 44%"></div></div>
              <span id="pct-contours">44%</span>
            </div>
            <div class="budget-row">
              <span>roads</span>
              <div class="budget-track"><div class="budget-fill" id="bar-roads" style="width: 28%"></div></div>
              <span id="pct-roads">28%</span>
            </div>
            <div class="budget-row">
              <span>hydro</span>
              <div class="budget-track"><div class="budget-fill" id="bar-hydro" style="width: 19%"></div></div>
              <span id="pct-hydro">19%</span>
            </div>
            <div class="budget-row">
              <span>labels</span>
              <div class="budget-track"><div class="budget-fill" id="bar-labels" style="width: 9%"></div></div>
              <span id="pct-labels">9%</span>
            </div>
          </div>
        </div>
      </aside>
    </section>

    <section class="spec-strip" id="spec">
      <article class="spec-card">
        <h3>Zero Tile Server Infrastructure</h3>
        <p>Host a single immutable <code>.pmtiles</code> archive on S3, R2, or GCS. Browsers fetch exact vector tiles with standard HTTP 206 byte-range requests.</p>
      </article>
      <article class="spec-card">
        <h3>Hilbert Curve Spatial Locality</h3>
        <p>Adjacent z/x/y tiles are packed sequentially along a Hilbert space-filling curve, coalescing directory lookups into minimal CDN cache entries.</p>
      </article>
      <article class="spec-card">
        <h3>Deduplicated Ocean &amp; Uniform Tiles</h3>
        <p>Identical open-water or empty tiles collapse to a single shared byte offset in the archive directory, trimming planet builds by over 18%.</p>
      </article>
    </section>

    <section class="cli-bar" id="cli">
      <div class="cli-code" id="cliText">
        <span class="cmd">pmtiles extract</span> https://data.meridian.map/planet-202604.pmtiles cascadia.pmtiles --bbox=-122.44,47.56,-122.22,47.69 --maxzoom=14
      </div>
      <button class="copy-btn" id="copyCli">Copy Extract Command</button>
    </section>
  </main>

  <script>
    const TILE_DATA = {
      "12/654/1432": {
        hilbert: "19,482,101",
        size: "14.2 KB",
        features: "418",
        region: "Cascadia Sound",
        range: "bytes=84112000-84126540",
        budget: { contours: 8, roads: 12, hydro: 68, labels: 12 }
      },
      "12/655/1432": {
        hilbert: "19,482,104",
        size: "42.8 KB",
        features: "1,842",
        region: "Port Meridian",
        range: "bytes=84192044-84235871",
        budget: { contours: 44, roads: 28, hydro: 19, labels: 9 }
      },
      "12/656/1432": {
        hilbert: "19,482,107",
        size: "36.5 KB",
        features: "1,490",
        region: "Granite Peak",
        range: "bytes=84235872-84273248",
        budget: { contours: 62, roads: 18, hydro: 13, labels: 7 }
      },
      "12/654/1433": {
        hilbert: "19,482,102",
        size: "11.6 KB",
        features: "294",
        region: "South Sound",
        range: "bytes=84126541-84138419",
        budget: { contours: 6, roads: 10, hydro: 76, labels: 8 }
      },
      "12/655/1433": {
        hilbert: "19,482,105",
        size: "49.1 KB",
        features: "2,115",
        region: "Mt. Alder Massif",
        range: "bytes=84273249-84323527",
        budget: { contours: 58, roads: 22, hydro: 11, labels: 9 }
      },
      "12/656/1433": {
        hilbert: "19,482,108",
        size: "31.4 KB",
        features: "1,208",
        region: "Mirror Tarn",
        range: "bytes=84323528-84355681",
        budget: { contours: 46, roads: 16, hydro: 31, labels: 7 }
      }
    };

    // Tile selection
    const tileCells = document.querySelectorAll('.tile-cell');
    function selectTile(tileKey) {
      const data = TILE_DATA[tileKey];
      if (!data) return;
      tileCells.forEach(c => c.classList.toggle('selected', c.dataset.tile === tileKey));
      document.getElementById('inspTileId').textContent = tileKey;
      document.getElementById('inspHilbert').textContent = data.hilbert;
      document.getElementById('inspSize').textContent = data.size;
      document.getElementById('inspFeatures').textContent = data.features;
      document.getElementById('inspRegion').textContent = data.region;
      document.getElementById('inspRange').innerHTML =
        `GET /cascadia-202604.pmtiles<br><span class="hl">Range: ${data.range}</span> · 206 Partial`;

      ['contours', 'roads', 'hydro', 'labels'].forEach(k => {
        const pct = data.budget[k];
        document.getElementById(`bar-${k}`).style.width = `${pct}%`;
        document.getElementById(`pct-${k}`).textContent = `${pct}%`;
      });
    }

    tileCells.forEach(cell => {
      cell.addEventListener('click', () => selectTile(cell.dataset.tile));
    });

    // Layer toggles
    const checkboxes = document.querySelectorAll('.layer-toggle input[type="checkbox"]');
    function syncLayerCount() {
      const active = Array.from(checkboxes).filter(cb => cb.checked).length;
      document.getElementById('activeLayerCount').textContent = `${active} / ${checkboxes.length} Active`;
    }

    checkboxes.forEach(cb => {
      cb.addEventListener('change', () => {
        const layerEl = document.getElementById(cb.dataset.target);
        if (layerEl) layerEl.classList.toggle('hidden', !cb.checked);
        syncLayerCount();
      });
    });

    // Basemap switcher
    const styleBtns = document.querySelectorAll('.style-btn');
    styleBtns.forEach(btn => {
      btn.addEventListener('click', () => {
        styleBtns.forEach(b => b.classList.remove('active'));
        btn.classList.add('active');
        document.body.setAttribute('data-basemap', btn.dataset.style);
      });
    });

    // Reset view links
    function resetView() {
      selectTile('12/655/1432');
      checkboxes.forEach(cb => {
        cb.checked = true;
        document.getElementById(cb.dataset.target).classList.remove('hidden');
      });
      syncLayerCount();
    }
    document.getElementById('nav-reset-tile').addEventListener('click', resetView);
    document.getElementById('mobile-reset-tile').addEventListener('click', () => {
      resetView();
      mobileDrawer.classList.remove('open');
      menuToggle.setAttribute('aria-expanded', 'false');
    });

    // Mobile drawer
    const menuToggle = document.getElementById('menuToggle');
    const mobileDrawer = document.getElementById('mobileDrawer');
    menuToggle.addEventListener('click', () => {
      const open = mobileDrawer.classList.toggle('open');
      menuToggle.setAttribute('aria-expanded', String(open));
    });

    // Copy CLI
    const copyBtn = document.getElementById('copyCli');
    copyBtn.addEventListener('click', () => {
      const cmd = document.getElementById('cliText').textContent.trim();
      if (navigator.clipboard) {
        navigator.clipboard.writeText(cmd).catch(() => {});
      }
      copyBtn.textContent = 'Copied to Clipboard';
      setTimeout(() => { copyBtn.textContent = 'Copy Extract Command'; }, 1800);
    });
  </script>
</body>
</html>
```
