/* INSTRUMENT
   A quiet face over the lattice. The lattice is the display: tune a site and
   its picture lights up out of the squares themselves. One colour at a time,
   the site that is tuned. */

:root {
  --bg: #ffffff; --fg: #111111; --mute: #8a8a8a;
  --line: rgba(18, 18, 17, .14);
  --acc: var(--fg);
  --sans: "Instrument Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --pad: clamp(22px, 3.4vw, 56px);
  --out: cubic-bezier(.16, 1, .3, 1);
  --snap: cubic-bezier(.3, 1.5, .5, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a09; --fg: #ebeae6; --mute: #74736d;
    --line: rgba(235, 234, 230, .12);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a09; --fg: #ebeae6; --mute: #74736d;
  --line: rgba(235, 234, 230, .12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  background: var(--bg); color: var(--fg);
  font: 400 15px/1.45 var(--sans); letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
::selection { background: var(--acc); color: var(--bg); }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 1.5px solid var(--acc); outline-offset: 4px; border-radius: 2px; }

#field { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; height: 100lvh; pointer-events: none;
  opacity: 0; animation: fade 1.6s .1s var(--out) forwards; }

/* ---- face ------------------------------------------------------------------ */
.face { position: relative; z-index: 2; min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; }
.top, .deck, .foot { width: 100%; max-width: 1400px; margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 76px; animation: fade 1s .25s var(--out) both; }
.me { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14.5px; letter-spacing: -.015em; }
.led { width: 6px; height: 6px; background: var(--acc); transition: background-color .5s; }
.me .nm-b { font: 400 13px/1.2 var(--mono); letter-spacing: 0; }
.read { display: flex; align-items: center; gap: 18px; font: 400 12px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--mute); }
.clock { display: inline-flex; gap: 10px; }
#time { color: var(--fg); }
.hold { padding: 4px 6px 3px; background: var(--fg); color: var(--bg); text-transform: uppercase; letter-spacing: .08em; font-size: 10px;
  opacity: 0; transform: scale(.8); transition: opacity .2s, transform .4s var(--snap); }
.held .hold { opacity: 1; transform: none; }

/* ---- deck ------------------------------------------------------------------ */
.deck { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .74fr); grid-template-rows: auto 1fr auto;
  column-gap: clamp(36px, 5vw, 96px); padding-top: clamp(24px, 6vh, 80px); padding-bottom: clamp(32px, 7vh, 72px); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* An empty slot: field.js reads its box and draws each site's picture there,
   in the lattice itself. */
.stage { grid-column: 2; grid-row: 1 / 4; position: relative; min-height: 440px; }

/* ---- the list ----------------------------------------------------------------
   No numbers, no rules. One square, the lattice's own unit, springs to the
   tuned site and stretches as it travels. */
.tuner { grid-column: 1; grid-row: 1 / 4; align-self: center; position: relative; --gut: 28px; }
.tuner ol { list-style: none; margin: 0; padding: 0; }
.tuner li { animation: in 1.1s var(--out) both; animation-delay: calc(var(--i, 0) * 70ms + 650ms); }
.st { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto 12px; align-items: center; column-gap: 22px;
  height: 58px; padding-left: var(--gut); transition: opacity .6s var(--out); }
.tuner.live .st:not(.on) { opacity: .3; }
.tuner.live.scan .st:not(.on) { opacity: .55; }
.st:focus-visible { outline: none; }

.mark { position: absolute; left: 0; top: 0; width: 6px; height: 6px; margin-top: -3px; background: var(--acc);
  opacity: 0; will-change: transform; transition: opacity .3s, background-color .5s; }
.tuner.live .mark { opacity: 1; }

/* Names roll a letter at a time into the site's own wordmark (main.js splits
   them into .l). Transform and opacity only, on CSS transitions: the
   compositor runs them, so they hold the display's full rate. */
.nm { position: relative; display: inline-grid; justify-self: start; overflow: hidden; padding: .1em .08em .16em; margin: -.1em -.08em -.16em; }
.st .nm { font-weight: 500; font-size: clamp(22px, 1.6vw + 6px, 30px); line-height: 1.12; letter-spacing: -.03em; }
.nm-a, .nm-b { grid-area: 1 / 1; white-space: nowrap; align-self: center; }
.l { display: inline-block; white-space: pre; transition: transform .8s var(--out), opacity .55s var(--out); transition-delay: calc(var(--i) * 16ms); }
.nm-b .l { transform: translate3d(0, 115%, 0) rotate(6deg); opacity: 0; }
.st.on .nm-a .l, .me:hover .nm-a .l, .me:focus-visible .nm-a .l { transform: translate3d(0, -115%, 0) rotate(-4deg); opacity: 0; }
.st.on .nm-b .l, .me:hover .nm-b .l, .me:focus-visible .nm-b .l { transform: none; opacity: 1; }

.ty { font-size: 13px; color: var(--mute); white-space: nowrap; transition: color .5s var(--out); }
.st.on .ty { color: var(--fg); }

.go { position: relative; width: 12px; height: 12px; overflow: hidden; color: var(--mute); transition: color .5s var(--out), transform .25s var(--out); }
.go svg { position: absolute; inset: 0; transition: transform .7s var(--out); }
.go svg + svg { transform: translate3d(-130%, 130%, 0); }
.st.on .go { color: var(--a); }
.st.on .go svg:first-child { transform: translate3d(130%, -130%, 0); }
.st.on .go svg + svg { transform: none; transition-delay: .06s; }
.st.press .go, .st:active .go { transform: scale(.8); }
.go svg, .gh svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }

/* The wordmarks: each site's own logo face, weight, case and colour. */
.wm-vuely { font-family: Inter, var(--sans); font-weight: 700; letter-spacing: -.02em; font-stretch: 100%; }
.wm-vuely .l { color: transparent; -webkit-background-clip: text; background-clip: text; background-repeat: no-repeat;
  background-image: linear-gradient(110deg, #5aa8f6 0%, #387ef0 50%, #1958eb 100%); }
.wm-llm { font-family: Geist, var(--sans); font-weight: 500; letter-spacing: -.01em; font-size: .9em; font-stretch: 100%; }
.wm-llm .dim { color: var(--mute); }
.wm-gs { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-weight: 700; letter-spacing: -.03em; font-stretch: 100%; }
.wm-gs .dim { color: var(--mute); font-weight: 500; }
.wm-vq { font-family: "League Spartan", var(--sans); font-weight: 700; letter-spacing: -.02em; font-size: 1.02em; font-stretch: 100%; }
.wm-mt { font-family: var(--serif); font-weight: 400; letter-spacing: 0; font-size: 1.14em; font-stretch: 100%; }
.wm-mt .dot { color: #c9a878; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wm-vuely .l { background-image: linear-gradient(110deg, #a6d1fc 0%, #8eb8fa 50%, #779ef8 100%); }
}
:root[data-theme="dark"] .wm-vuely .l { background-image: linear-gradient(110deg, #a6d1fc 0%, #8eb8fa 50%, #779ef8 100%); }

/* ---- foot ------------------------------------------------------------------ */
.foot { display: flex; align-items: center; gap: 28px; min-height: 76px; padding-bottom: env(safe-area-inset-bottom);
  font-size: 13px; color: var(--mute); animation: fade 1s 1s var(--out) both; }
.gh { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); position: relative; }
.gh::after { content: ""; position: absolute; left: 0; right: 18px; bottom: -3px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .6s var(--out); }
.gh:hover::after { transform: scaleX(1); transform-origin: left; }
.gh svg { width: 10px; height: 10px; transition: transform .6s var(--snap); }
.gh:hover svg { transform: translate(2px, -2px); }
.sw { margin-left: auto; position: relative; width: 30px; height: 16px; padding: 0; border: 1px solid var(--line); border-radius: 3px; background: transparent; cursor: pointer; }
.sw i { position: absolute; left: 3px; top: 3px; width: 8px; height: 8px; background: var(--fg); transition: transform .55s var(--snap); }
.sw[aria-checked="true"] i { transform: translateX(14px); }
.sw:active i { transform: scaleX(1.4); }
.sw[aria-checked="true"]:active i { transform: translateX(12px) scaleX(1.4); }

/* ---- keys sheet: ? ---------------------------------------------------------- */
.sheet { position: fixed; z-index: 40; right: var(--pad); bottom: 84px; width: 196px; padding: 14px 16px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; transform-origin: 100% 100%; animation: pop .45s var(--snap); }
.sheet[hidden] { display: none; }
.sheet ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 13px; }
.sheet li { display: flex; justify-content: space-between; align-items: center; color: var(--mute); }
.sheet li span { order: 2; display: inline-flex; gap: 4px; }
kbd { min-width: 20px; text-align: center; font: 400 10px/1 var(--mono); padding: 4px 5px; border-radius: 3px; border: 1px solid var(--line); border-bottom-width: 2px; color: var(--fg); background: var(--bg); }

/* ---- motion ---------------------------------------------------------------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { to { transform: none; } }
@keyframes in { from { opacity: 0; transform: translate3d(0, 16px, 0); } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.96); } }

/* ---- narrower: the pictures move under the headline ------------------------- */
@media (max-width: 900px) {
  .deck { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; }
  .stage { grid-column: 1; grid-row: 2; min-height: 0; aspect-ratio: 2 / 1; margin-top: 0; }
  .tuner { grid-row: 3; align-self: start; margin-top: 40px; }
}
@media (max-width: 560px) {
  :root { --pad: 20px; }
  .top { height: 64px; }
  .deck { padding-top: 22px; }
  .stage { aspect-ratio: 4 / 3; margin-top: 0; }
  .tuner { margin-top: 30px; --gut: 22px; }
  .st { grid-template-columns: minmax(0, 1fr) 12px; grid-template-rows: auto auto; align-content: center; row-gap: 3px; height: 72px; }
  .st .nm { grid-column: 1; grid-row: 1; font-size: 24px; }
  .ty { grid-column: 1; grid-row: 2; font-size: 12.5px; }
  .go { grid-column: 2; grid-row: 1 / 3; }
  .foot { gap: 20px; font-size: 12.5px; }
  .sheet { right: 12px; left: 12px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  #field { opacity: 1; }
}
