/* E · Monolith: shared base: tokens, type, header, buttons, dock, app-view theme, footer.
   Instrument Sans (display + text, variable width) with Fragment Mono (metadata and data only). */

:root {
  --paper: #F4F4F1;
  --white: #FFFFFF;
  --ink: #0B0B0A;
  --ink-2: #2B2B28;
  --muted: #5E5E58;
  --faint: #6B6B65;
  --line: #DCDCD6;
  --line-2: #C9C9C2;
  --wash: #ECECE7;
  --spectrum: linear-gradient(90deg, #FF4D2E 0%, #FFA51F 17%, #E8D60C 32%, #2FD38A 50%, #1BB2FF 67%, #5A5CFF 83%, #C94BFF 100%);
  --spectrum-v: linear-gradient(180deg, #FF4D2E 0%, #FFA51F 17%, #E8D60C 32%, #2FD38A 50%, #1BB2FF 67%, #5A5CFF 83%, #C94BFF 100%);
  --spectrum-c: conic-gradient(from 210deg, #FF4D2E, #FFA51F, #E8D60C, #2FD38A, #1BB2FF, #5A5CFF, #C94BFF, #FF4D2E);
  --sans: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Fragment Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pad: clamp(20px, 4.45vw, 64px);
  --gut: 24px;
  --max: 1440px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --head-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--sans); font-stretch: 100%;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; overflow-x: hidden;
}
/* Grain: one static layer, never animated. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .045; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
::selection { background: var(--ink); color: var(--paper); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.on-black :focus-visible { outline-color: var(--paper); }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; padding: 10px 14px; background: var(--ink); color: var(--paper); text-decoration: none; font-size: 14px; }
.skip:focus { top: 12px; }

/* ── grid ── */
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gut); }

/* ── type ── */
.meta { font: 400 11.5px/1.4 var(--mono); letter-spacing: .02em; color: var(--muted); font-variant-numeric: tabular-nums; }
.meta b { font-weight: 400; color: var(--ink); }
.label { font: 400 11px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.h2 { text-wrap: balance; font-size: clamp(36px, 4.9vw, 70px); line-height: .96; letter-spacing: -.045em; font-weight: 500; font-stretch: 94%; }
.lede { font-size: clamp(17px, 1.4vw, 20px); line-height: 1.45; letter-spacing: -.01em; color: var(--ink-2); max-width: 36em; }
.body { font-size: 15px; line-height: 1.55; color: var(--muted); }

/* ── buttons and links ── */
.btn {
  --b: var(--ink); --f: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 20px;
  border: 1px solid var(--b); background: var(--b); color: var(--f); border-radius: 0;
  font-size: 15px; font-weight: 500; letter-spacing: -.005em; text-decoration: none; white-space: nowrap;
  transition: background-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { --b: #262624; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; transition: transform .25s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn-ghost { --b: transparent; --f: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { --b: var(--ink); --f: var(--paper); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.on-black .btn { --b: var(--paper); --f: var(--ink); }
.on-black .btn:hover { --b: #fff; }
.on-black .btn-ghost { --b: transparent; --f: var(--paper); border-color: rgba(244, 244, 241, .5); }
.on-black .btn-ghost:hover { --b: var(--paper); --f: var(--ink); border-color: var(--paper); }

.link {
  display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 500;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 2px;
  transition: background-size .3s var(--ease);
}
.link:hover { background-size: 0 1px; background-position: 100% 100%; }
.link svg { width: 13px; height: 13px; }

.text-btn { padding: 0; border: 0; background: none; font-size: 14px; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.text-btn:hover { text-decoration-thickness: 2px; }
.on-black .text-btn { color: var(--paper); }

/* ── header ── */
.head { position: sticky; top: 0; z-index: 60; background: rgba(244, 244, 241, .94); border-bottom: 1px solid transparent; transition: border-color .2s; }
.head.is-stuck { border-bottom-color: var(--line); }
@supports (backdrop-filter: blur(1px)) { .head { background: rgba(244, 244, 241, .86); backdrop-filter: saturate(1.2) blur(10px); } }
.head-row { display: flex; align-items: center; gap: 28px; height: var(--head-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 16px; letter-spacing: -.02em; white-space: nowrap; }
.brand img { width: 22px; height: 22px; border-radius: 5px; }
.nav { display: flex; gap: 26px; margin-left: auto; }
.nav a { position: relative; font-size: 14px; color: var(--ink-2); text-decoration: none; padding: 6px 0; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .3s var(--ease); }
.nav a:hover::after { transform: scaleX(1); transform-origin: left; }
.head-end { display: flex; align-items: center; gap: 18px; }
.head-end .signin { font-size: 14px; text-decoration: none; }
.head-end .signin:hover { text-decoration: underline; text-underline-offset: 4px; }
.sel-pill { display: none; align-items: center; gap: 8px; font: 400 12px/1 var(--mono); text-decoration: none; padding: 7px 10px; border: 1px solid var(--line-2); }
.sel-pill.on { display: inline-flex; }
.sel-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--spectrum-c); }
.menu-btn { display: none; }
.nav .nav-signin { display: none; }

@media (max-width: 960px) {
  .nav { position: fixed; left: 0; right: 0; top: var(--head-h); display: none; flex-direction: column; gap: 0; margin: 0; padding: 8px var(--pad) 24px; background: var(--paper); border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  .nav a { font-size: 22px; letter-spacing: -.02em; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nav a::after { display: none; }
  .nav .nav-signin { display: block; }
  .head-end { margin-left: auto; gap: 10px; }
  .menu-btn { display: inline-flex; }
}
@media (max-width: 560px) {
  .head-end .signin { font-size: 13px; }
  .head-end .btn-req { display: none; }
  .brand { font-size: 15px; }
  .head-row { gap: 12px; }
}

/* header over the black band */
.head.inv { background: rgba(11, 11, 10, .9); color: var(--paper); border-bottom-color: rgba(244, 244, 241, .14); }
.head.inv .btn { --b: var(--paper); --f: var(--ink); }
.head.inv .btn-ghost { --b: transparent; --f: var(--paper); border-color: rgba(244, 244, 241, .5); }
.head.inv .sel-pill { border-color: rgba(244, 244, 241, .4); }
.head.inv :focus-visible { outline-color: var(--paper); }
@media (min-width: 961px) { .head.inv .nav a { color: #E6E6E0; } }
@supports (backdrop-filter: blur(1px)) { .head.inv { background: rgba(11, 11, 10, .84); } }

/* ── spectral hairline: the only UI colour ── */
.spec-line { display: block; height: 1px; background: var(--spectrum); }

/* ── dock ── */
.dock { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); row-gap: 8px; }
.dock-btn {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0;
  padding: 26px 10px 14px 0; margin: 0; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; color: var(--ink);
}
.dock-btn[data-first]::before { content: ""; position: absolute; left: 0; top: -1px; width: 28px; height: 1px; background: var(--ink); }
.dock-cat { position: absolute; left: 0; top: 7px; font: 400 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.dock-ic { position: relative; display: block; width: var(--ic, 48px); height: var(--ic, 48px); transition: transform .28s var(--ease); }
.dock-ic svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dock-ic .c { opacity: 0; transition: opacity .28s var(--ease); }
.dock-ic .m { color: var(--ink); transition: opacity .28s var(--ease); }
.dock-ic::after { /* spectral ring, drawn with a mask so only the 1.5px edge shows */
  content: ""; position: absolute; inset: -5px; border-radius: 15px; padding: 1.5px; background: var(--spectrum-c);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
  opacity: 0; transform: scale(.94); transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.dock-name { font-size: 12.5px; line-height: 1.2; letter-spacing: -.005em; color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-name .s { display: none; }
.dock-btn:hover .dock-ic, .dock-btn:focus .dock-ic { transform: translateY(-2px); }
.dock-btn:hover .c, .dock-btn:focus .c, .dock-btn[aria-pressed="true"] .c { opacity: 1; }
.dock-btn:hover .m, .dock-btn:focus .m, .dock-btn[aria-pressed="true"] .m { opacity: 0; }
.dock-btn[aria-pressed="true"] .dock-ic::after { opacity: 1; transform: none; }
.dock-btn[aria-pressed="true"] .dock-name { color: var(--ink); font-weight: 600; }
.dock-btn:focus-visible { outline: none; }
.dock-btn:focus-visible .dock-name { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.dock-btn:focus-visible .dock-ic { outline: 2px solid var(--ink); outline-offset: 8px; border-radius: 12px; }

@media (max-width: 1100px) { .dock { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .dock { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dock-cat { display: none; }
  .dock-btn { padding-top: 16px; gap: 8px; }
  .dock-name .f { display: none; }
  .dock-name .s { display: inline; }
  .dock-name { font-size: 12px; }
}

/* ── app views, re-themed ── */
.sv-root {
  --sv-bg: #FFFFFF; --sv-bg2: #F7F7F4; --sv-bg3: #EEEEEA; --sv-fg: #141413; --sv-muted: #66665F; --sv-line: #E4E4DF;
  --sv-accent: #141413;
  --sv-pii-bg: #141413; --sv-pii-fg: #F4F4F1; --sv-pii-line: #141413;
  --sv-radius: 6px; --sv-shadow: none;
  --sv-mono: "Fragment Mono", ui-monospace, Menlo, monospace;
}
.sv-root .sv-cap { background: transparent; color: var(--sv-muted); box-shadow: inset 0 0 0 1px var(--sv-line); font-family: var(--sv-mono); font-weight: 400; letter-spacing: .02em; }
.sv-root .sv-stats { border-radius: 0; }
.pii { display: inline-block; padding: 0 5px; background: var(--ink); color: var(--paper); font: 400 .82em/1.5 var(--mono); letter-spacing: -.01em; white-space: nowrap; vertical-align: baseline; }

/* ── tabs (app previews) ── */
.tabs { display: flex; gap: 0; overflow-x: auto; margin: 16px 0 14px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px 12px 0; margin-right: 8px; border: 0; background: none; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tab svg { width: 22px; height: 22px; }
.tab::after { content: ""; position: absolute; left: 0; right: 16px; bottom: 0; height: 1px; background: var(--spectrum); transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease); }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.tab[aria-selected="true"]::after { transform: none; }
.tab:hover { color: var(--ink); }
.tabpanel { transition: opacity .25s var(--ease), transform .25s var(--ease); }
.tabpanel.out { opacity: 0; transform: translateY(4px); }

/* ── black cut ── */
.on-black { background: var(--ink); color: var(--paper); border-top: 0; }
.on-black .label, .on-black .meta { color: #9A9A93; }
.on-black .lede { color: #D8D8D2; }

/* ── reveal ── */
.js .rv { opacity: 0; transform: translateY(14px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .rv { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ── footer ── */
.foot { border-top: 1px solid var(--ink); padding: 28px 0 40px; }
.foot-row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gut); row-gap: 20px; align-items: start; }
.foot .brand { grid-column: 1 / span 3; }
.foot-addr { grid-column: 4 / span 4; font-size: 14px; color: var(--ink-2); }
.foot-addr a { text-decoration: none; }
.foot-addr a:hover { text-decoration: underline; text-underline-offset: 3px; }
.foot nav { grid-column: 8 / span 3; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.foot nav a { text-decoration: none; width: max-content; }
.foot nav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.foot .meta { grid-column: 11 / span 2; text-align: right; }
@media (max-width: 860px) {
  .foot .brand, .foot-addr, .foot nav, .foot .meta { grid-column: 1 / -1; text-align: left; }
}
