@font-face {
  font-family: 'ABC Diatype';
  src: url('../fonts/ABCDiatype-Regular-Trial.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'ABC Diatype';
  src: url('../fonts/ABCDiatype-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'ABC Diatype Mono';
  src: url('../fonts/ABCDiatypeMono-Regular-Trial.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f9f8f3;
  --paper-seen: #ecebe6; /* paper after grain + vignette */
  --ink: #282828;        /* the logo's type */
  --ink-2: #6f6d68;
  --ink-3: #a3a19b;
  --line: rgba(40, 40, 40, 0.16);
  --blue: #2a3bb8;       /* the logo's delta */
  --on-blue: #f9f8f3;
  --mono: 'ABC Diatype Mono', 'SF Mono', Menlo, monospace;
  --sans: 'ABC Diatype', Helvetica, Arial, sans-serif;
  --gutter: 56px;
}
:root.dark {
  --paper: #141412;
  --paper-seen: #151513;
  --ink: #ecebe6;
  --ink-2: #a3a19b;
  --ink-3: #6f6d68;
  --line: rgba(236, 235, 230, 0.16);
  --blue: #7383ff;
  --on-blue: #141412;
}
:root.dark .paper-grain { opacity: 0.09; box-shadow: inset 0 0 22vmax rgba(0, 0, 0, 0.35); }

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  background: var(--paper-seen);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* the globe page: the WebGL canvas is see-through, this is the paper under it and the copy */
html:not(.pp), html:not(.pp) body { background: var(--paper); }

canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#gl { z-index: 0; touch-action: none; cursor: grab; }
#gl.dragging { cursor: grabbing; }
#gl.over-node { cursor: pointer; }
#ink { z-index: 3; pointer-events: none; }

.paper-grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.16;
  box-shadow: inset 0 0 22vmax rgba(40, 36, 28, 0.16);
}

/* The page sits over the globe; only its own controls take the pointer, the
   rest of it lets drags and scrolls through to the globe. */
.page {
  position: fixed; inset: 0; z-index: 4; pointer-events: none;
  display: flex; flex-direction: column;
  padding: calc(26px + env(safe-area-inset-top)) var(--gutter) calc(22px + env(safe-area-inset-bottom));
}
.page a, .page button, .page input, .page select, .page label, .quote { pointer-events: auto; }

a { color: inherit; }

/* Nav */
.nav { display: flex; align-items: center; gap: 40px; }
/* The lockup (assets/logo.svg, inlined): the type takes the ink, the delta the blue. */
.logo { display: inline-flex; line-height: 0; }
.logo-svg { height: 40px; width: auto; display: block; }
.logo-type { fill: var(--ink); }
.logo-delta { fill: var(--blue); }
.nav-links { display: flex; gap: 28px; margin-left: auto; font-size: 14px; }
.nav-links a { text-decoration: none; color: var(--ink-2); }
.nav-links a:hover { color: var(--ink); }
/* The one real tab: always shown, underlined when it is the page you are on */
.nav-tab { font-size: 14px; text-decoration: none; color: var(--ink); padding: 4px 0; border-bottom: 1px solid transparent; }
.nav-tab:hover { border-bottom-color: var(--ink-3); }
.nav-tab.is-on { border-bottom-color: var(--blue); }

.btn {
  font: inherit; font-weight: 700; font-size: 14px; letter-spacing: 0.01em;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 0; cursor: pointer; text-decoration: none;
  background: var(--blue); color: var(--on-blue); padding: 13px 20px;
}
.btn:hover { background: var(--ink); }
.btn-small { padding: 9px 14px; font-size: 13px; }

/* Hero */
.hero { flex: 1; display: flex; flex-direction: column; justify-content: center; width: min(440px, 100%); padding: 24px 0; }
.eyebrow, .q-label, .q-head, .foot, .q-note, .seg label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase;
}
.eyebrow { color: var(--ink-2); margin-bottom: 18px; }
h1 { font-weight: 700; font-size: clamp(36px, 4vw, 54px); line-height: 1.02; letter-spacing: -0.035em; margin-bottom: 18px; position: relative; left: -0.03em; } /* left: the C's own side bearing, so it lines up with the eyebrow */
.lede { color: var(--ink-2); font-size: 16px; max-width: 400px; margin-bottom: 30px; }
.faint { color: var(--ink-3); }

/* Quote */
.quote { background: var(--paper); border: 1px solid var(--line); padding: 18px 18px 14px; display: grid; gap: 14px; }
.q-head { display: flex; justify-content: space-between; color: var(--ink); }
.q-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 5px; }
.q-label { color: var(--ink-2); }
select, input {
  font: inherit; font-size: 15px; color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--ink-3); border-radius: 0; padding: 4px 0 5px; outline: none; width: 100%;
  -webkit-appearance: none; appearance: none;
}
select {
  cursor: pointer; padding-right: 18px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(-45deg, transparent 50%, var(--ink) 50%);
  background-size: 4px 4px; background-position: right 6px center, right 2px center; background-repeat: no-repeat;
}
select option { color: #282828; }
select:focus, input:focus { border-bottom-color: var(--blue); }
.unit { display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--ink-3); }
.unit:focus-within { border-bottom-color: var(--blue); }
.unit input { border: 0; }
.unit span { color: var(--ink-2); font-size: 13px; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

.seg { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--ink-3); }
.seg label { position: relative; text-align: center; padding: 8px 4px; cursor: pointer; color: var(--ink-2); }
.seg label + label { border-left: 1px solid var(--ink-3); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--ink); color: var(--paper); }
.seg label:has(input:focus-visible) { outline: 1px solid var(--blue); outline-offset: 1px; }

/* four columns with q-two's gap: the estimate spans two, so Transit starts under To */
.q-out { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.q-out > div:first-child { grid-column: span 2; }
.q-price { font-weight: 700; font-size: 22px; letter-spacing: -0.02em; color: var(--blue); white-space: nowrap; }
.q-val { font-size: 15px; padding-top: 5px; white-space: nowrap; }
.q-was { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.q-back { font-size: 13px; line-height: 1.45; color: var(--ink-2); margin-top: -4px; }
.q-back b { color: var(--blue); font-weight: 700; }
.q-note { text-transform: none; letter-spacing: 0.02em; }
.quote .btn { width: 100%; }

/* The copy rises in once the map is loaded, one block after another (--i is
   each block's place in the line). html.ready is set by the script. */
.rise {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.22, 0.61, 0.36, 1), transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(0.25s + var(--i, 0) * 0.14s);
}
.ready .rise { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .rise { transform: none; transition-property: opacity; }
}

/* Footer */
.foot { display: flex; justify-content: space-between; gap: 20px; color: var(--ink-3); }
.foot a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--ink-3); }
.foot a:hover { color: var(--ink); }

@media (max-height: 820px) and (min-width: 901px) {
  .lede { display: none; }
  h1 { margin-bottom: 22px; }
}
@media (max-width: 1100px) {
  :root { --gutter: 36px; }
  .nav-links { display: none; }
  .nav .nav-tab { margin-left: auto; }
}

/* Phones and narrow windows: the globe stays fixed below the nav (the script
   sets --globe-end to where it ends), the page scrolls over it on paper. */
@media (max-width: 900px) {
  :root { --gutter: 22px; }
  html, body { overflow: auto; height: auto; overscroll-behavior: auto; }
  /* the copy sits on one full-width sheet of paper from where the globe ends; the grain lies over both, so they read as one surface */
  .page { background: linear-gradient(to bottom, transparent var(--globe-end, 62vh), var(--paper) calc(var(--globe-end, 62vh) + 36px)); }
  html:not(.pp) .paper-grain { z-index: 5; }
  .paper-grain { bottom: auto; height: 100vh; height: 100lvh; } /* the full height behind the browser's toolbar too, so no strip goes ungrained */
  .page { position: relative; inset: auto; min-height: 100dvh; padding-top: calc(24px + env(safe-area-inset-top)); padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  .hero { flex: none; width: 100%; padding: var(--globe-end, 62vh) 0 44px; justify-content: flex-start; }
  .hero > * { pointer-events: auto; }
  #gl { touch-action: pan-y; } /* vertical swipes scroll the page; sideways drags turn the globe */
  .eyebrow, h1, .lede { margin: 0; }
  .eyebrow { padding: 14px 0 14px; line-height: 1.7; }
  h1 { font-size: clamp(38px, 10.6vw, 50px); line-height: 1.04; padding: 0 0 16px; }
  .lede { font-size: 16px; line-height: 1.6; padding-bottom: 36px; max-width: none; }
  .quote { padding: 22px 20px 18px; gap: 20px; }
  .q-two, .q-out { column-gap: 16px; }
  .foot { flex-direction: column; gap: 8px; padding-top: 22px; border-top: 1px solid var(--line); line-height: 1.7; }
}
/* The phone nav: the lockup and one menu icon (two hairlines, the lower one shorter);
   the icon opens a full-screen sheet. */
.nav-menu, .sheet { display: none; }
.nav-menu, .nav-close { width: 44px; height: 44px; margin-right: -11px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); position: relative; }
.nav-menu i, .nav-close i { position: absolute; right: 11px; height: 1.5px; background: currentColor; transition: width 0.25s ease, transform 0.25s ease; }
.nav-menu i { width: 22px; top: 18px; }
.nav-menu i + i { width: 14px; top: 25px; }
.nav-menu:hover i + i { width: 22px; }
.nav-close i { width: 22px; top: 21px; transform: rotate(45deg); }
.nav-close i + i { transform: rotate(-45deg); }
@media (max-width: 900px) {
  .logo-svg { height: 34px; }
  .nav .nav-tab, .nav .btn-small, .nav .nav-links { display: none; }
  .nav-menu { display: block; margin-left: auto; pointer-events: auto; }
  .sheet {
    display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 20; overflow-y: auto;
    background: var(--paper-seen); padding: calc(24px + env(safe-area-inset-top)) var(--gutter) calc(28px + env(safe-area-inset-bottom));
    visibility: hidden; opacity: 0; transition: opacity 0.3s ease, visibility 0s linear 0.3s;
  }
  .sheet.open { visibility: visible; opacity: 1; transition: opacity 0.3s ease; }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; }
  .sheet-head .logo { pointer-events: auto; }
  .sheet-links { display: grid; gap: 6px; padding: 13vh 0 40px; }
  .sheet-links a {
    display: flex; align-items: center; gap: 14px; width: max-content;
    font-weight: 700; font-size: clamp(34px, 10vw, 46px); line-height: 1.12; letter-spacing: -0.035em; text-decoration: none; color: var(--ink);
    opacity: 0; transform: translateY(18px);
    transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .sheet.open .sheet-links a { opacity: 1; transform: none; transition-delay: calc(0.06s + var(--i, 0) * 0.05s); }
  .sheet-links a.is-on { color: var(--blue); }
  .sheet-links a.is-on::before { content: ''; width: 0.42em; height: 0.36em; background: var(--blue); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
  .sheet .btn { align-self: stretch; }
  .sheet-foot { margin-top: auto; padding-top: 32px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }
  html.menu-open, html.menu-open body { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet-links a { transform: none; }
}
@media (max-width: 420px) {
  .q-out { grid-template-columns: 1fr 1fr; }
  .q-out > div:first-child { grid-column: 1 / -1; }
  .seg label { padding: 8px 2px; font-size: 10px; }
}

/* ---------------------------------------------------------------------------
   Pattern generator (pattern.html)
   --------------------------------------------------------------------------- */
html.pp, html.pp body { height: auto; min-height: 100%; overflow: auto; overscroll-behavior: auto; }
.pp-page { position: relative; z-index: 4; min-height: 100dvh; display: flex; flex-direction: column; padding: calc(26px + env(safe-area-inset-top)) var(--gutter) calc(26px + env(safe-area-inset-bottom)); }
.pp-main { flex: 1; display: grid; grid-template-columns: 320px 1fr; gap: 48px; padding-top: 40px; min-height: 0; }
.pp-panel { display: grid; gap: 18px; align-content: start; }
.pp-panel .eyebrow { margin-bottom: 0; }
.pp-title { font-weight: 700; font-size: 34px; line-height: 1.02; letter-spacing: -0.03em; }
.pp-lede { color: var(--ink-2); font-size: 14px; }
.pp-hint { font-size: 12.5px; line-height: 1.4; min-height: 3.6em; }

.pp-modes { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--ink-3); }
.pp-modes label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; padding: 9px 10px; cursor: pointer; color: var(--ink-2); position: relative; }
.pp-modes label:nth-child(even) { border-left: 1px solid var(--ink-3); }
.pp-modes label:nth-child(n + 3) { border-top: 1px solid var(--ink-3); }
.pp-modes input, .pp-palettes input { position: absolute; opacity: 0; pointer-events: none; }
.pp-modes label:has(input:checked) { background: var(--ink); color: var(--paper); }
.pp-modes label:has(input:focus-visible), .pp-pal:has(input:focus-visible) { outline: 1px solid var(--blue); outline-offset: 1px; }

.pp-palettes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pp-pal { position: relative; cursor: pointer; display: grid; gap: 4px; }
.pp-chips { display: flex; gap: 3px; padding: 6px; height: 30px; border: 1px solid var(--line); }
.pp-chips i { flex: 1; display: block; }
.pp-pal-name { font-family: var(--mono); font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-2); }
.pp-pal:has(input:checked) .pp-chips { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pp-pal:has(input:checked) .pp-pal-name { color: var(--ink); }

.pp-range .q-label { display: flex; justify-content: space-between; }
.pp-range b { font-weight: 400; color: var(--ink); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; border: 0; padding: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 1px; background: var(--ink-3); }
input[type=range]::-moz-range-track { height: 1px; background: var(--ink-3); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -5.5px; background: var(--blue); border: 0; border-radius: 0; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; background: var(--blue); border: 0; border-radius: 0; }

.pp-row { display: flex; align-items: end; gap: 14px; }
.pp-row .field { flex: 1; }
.pp-seed { font-family: var(--mono); font-size: 15px; padding: 4px 0 5px; border-bottom: 1px solid var(--ink-3); }
.pp-btn { font: inherit; font-size: 13px; font-weight: 700; background: transparent; color: var(--ink); border: 1px solid var(--ink); padding: 9px 14px; cursor: pointer; border-radius: 0; white-space: nowrap; }
.pp-btn:hover { background: var(--ink); color: var(--paper); }
.pp-check { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px; padding-bottom: 10px; cursor: pointer; color: var(--ink-2); }
.pp-check input { -webkit-appearance: checkbox; appearance: auto; width: auto; border: 0; padding: 0; accent-color: var(--blue); }
.pp-check:has(input:disabled) { opacity: 0.4; cursor: default; }
.pp-export { display: grid; gap: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.pp-export .btn { flex: 1; }

.pp-stage { position: sticky; top: 26px; height: calc(100dvh - 160px); min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.pp-stage canvas { display: block; position: static; box-shadow: 0 0 0 1px var(--line); }
.pp-meta { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }

@media (max-width: 900px) {
  .pp-page { padding-top: calc(24px + env(safe-area-inset-top)); }
  .pp-main { grid-template-columns: 1fr; gap: 40px; padding-top: 44px; }
  .pp-panel { gap: 24px; }
  .pp-title { font-size: 38px; }
  .pp-stage { position: relative; top: 0; height: 58vh; order: -1; }
}
