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

:root {
  --paper: #f4f2ee;
  --ink: #16161a;
  --ink-60: rgba(22, 22, 26, .6);
  --ink-35: rgba(22, 22, 26, .35);
  --ink-12: rgba(22, 22, 26, .12);
  --rule: rgba(22, 22, 26, .14);
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --swap: 420ms cubic-bezier(.2, .8, .2, 1);
}

html.dark {
  --paper: #0e0e11;
  --ink: #eceae4;
  --ink-60: rgba(236, 234, 228, .6);
  --ink-35: rgba(236, 234, 228, .35);
  --ink-12: rgba(236, 234, 228, .12);
  --rule: rgba(236, 234, 228, .16);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--swap), color var(--swap);
}

/* Small type is the whole point, so everything structural is set in mono at 10 to 11px. */
.eyebrow, .where, .tools button, .n, .k, .y, .count, dt, label, .said, .fine, .clock, kbd, .menu-foot, h2 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
}

a { color: inherit; text-decoration: none; }

/* ---------- cursor ---------- */

.cursor { position: fixed; inset: 0; z-index: 90; pointer-events: none; }

.cursor i {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  border-radius: 50%;
  will-change: transform;
}

#dot {
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  background: var(--ink);
}

#ring {
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 1px solid var(--ink-35);
  transition: width .3s, height .3s, margin .3s, border-color .3s;
}

.cursor.hot #ring { width: 56px; height: 56px; margin: -28px 0 0 -28px; border-color: var(--ink); }

@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ---------- progress ---------- */

.progress { position: fixed; top: 0; left: 0; right: 0; height: 1px; z-index: 80; background: var(--ink-12); }
.progress i { display: block; height: 100%; width: 0; background: var(--ink); }

/* ---------- header ---------- */

.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 22px 28px;
  mix-blend-mode: normal;
  background: linear-gradient(to bottom, var(--paper) 0 72%, transparent);
  padding-bottom: 30px;
}

.sig { font-family: var(--mono); font-size: 11px; letter-spacing: .3em; }
.where { margin: 0 auto 0 0; color: var(--ink-35); transition: color .3s; }
.tools { display: flex; gap: 14px; }

.tools button, .sig, [data-row], form button {
  -webkit-tap-highlight-color: transparent;
}

.tools button {
  background: none;
  border: 0;
  padding: 2px 0;
  color: var(--ink-60);
  cursor: pointer;
  position: relative;
}

.tools button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}

.tools button:hover { color: var(--ink); }
.tools button:hover::after { transform: scaleX(1); transform-origin: left; }

kbd {
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: 4px;
  letter-spacing: .08em;
}

/* ---------- layout ---------- */

main { padding: 0 28px; }
section { padding: 0 0 18vh; }

.rail {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  margin-bottom: 32px;
}

h2 { margin: 0; font-weight: 400; }
.count { margin: 0 0 0 auto; color: var(--ink-35); }

/* ---------- hero ---------- */

.hero { padding-top: 24vh; }
.eyebrow { margin: 0 0 26px; color: var(--ink-35); }

h1 {
  margin: 0 0 7vh;
  font-size: clamp(2.1rem, 5.4vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -.035em;
  font-weight: 400;
  max-width: 17em;
}

.hero-foot { display: flex; align-items: flex-end; gap: 40px; flex-wrap: wrap; }
.note { margin: 0; max-width: 34em; color: var(--ink-60); }
.clock { margin: 0 0 0 auto; color: var(--ink-60); }
.muted { color: var(--ink-35); }

/* Every [data-split] line is rebuilt as spans so it can arrive one word at a time. */
.w { display: inline-block; overflow: hidden; vertical-align: top; }
.w > i {
  display: inline-block;
  font-style: inherit;
  transform: translateY(105%);
  transition: transform .75s cubic-bezier(.19, 1, .22, 1);
}
.in .w > i { transform: none; }

/* ---------- work rows ---------- */

.work { position: relative; }
.rows { list-style: none; margin: 0; padding: 0; }

[data-row] {
  display: grid;
  grid-template-columns: 44px 1fr 13em 4em;
  align-items: baseline;
  gap: 12px;
  padding: 16px 2px;
  border-bottom: 1px solid var(--rule);
  position: relative;
  transition: opacity .4s, padding-left .5s cubic-bezier(.2, .8, .2, 1);
}

.rows.held [data-row] { opacity: .3; }
.rows.held [data-row].on { opacity: 1; padding-left: 14px; }

[data-row] .n, [data-row] .k { color: var(--ink-35); }
[data-row] .y { color: var(--ink-35); text-align: right; }
[data-row] .t { font-size: 20px; letter-spacing: -.02em; }

/* a hairline that draws itself under the row the cursor is on */
[data-row]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}

[data-row].on::after { transform: scaleX(1); }

/* the thumbnail follows the pointer with a spring, and leans into its own velocity */
.peek {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 208px;
  height: 260px;
  margin: 0;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-50%, -50%, 0) scale(.85);
  transition: opacity .35s ease;
  will-change: transform;
}

.peek.show { opacity: 1; }
.peek canvas { width: 100%; height: 100%; display: block; background: var(--paper); border: 1px solid var(--rule); }

/* ---------- about + contact ---------- */

.prose { max-width: 42em; }
.prose p { margin: 0 0 18px; font-size: 15px; line-height: 1.75; }
.prose .big { font-size: clamp(1.5rem, 3.6vw, 2.6rem); line-height: 1.1; letter-spacing: -.03em; margin-bottom: 36px; }

.facts { margin: 36px 0 0; display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.facts > div { display: flex; gap: 16px; padding: 12px 14px; background: var(--paper); transition: background var(--swap); }
dt { margin: 0; width: 7em; color: var(--ink-35); }
dd { margin: 0; }

form { max-width: 30em; }
label { display: block; color: var(--ink-35); margin-bottom: 18px; }

input, textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  resize: vertical;
}

input:focus, textarea:focus { outline: none; border-bottom-color: var(--ink); }

form button {
  min-height: 44px;
  padding: 0 20px;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

form button i { transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
form button:hover i { transform: translateX(5px); }

.said { margin: 16px 0 0; min-height: 1.2em; color: var(--ink-60); }
.said[data-bad="1"] { color: #b3402f; }
html.dark .said[data-bad="1"] { color: #ff8b76; }

/* ---------- footer ---------- */

.end { border-top: 1px solid var(--rule); padding: 22px 0 28px; }
.marquee { overflow: hidden; }

.run {
  display: flex;
  gap: 2.5em;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .3em;
  color: var(--ink-35);
  will-change: transform;
}

.fine { margin: 18px 28px 0; color: var(--ink-35); letter-spacing: .14em; }

/* ---------- command menu ---------- */

dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  margin: 14vh auto auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .18);
}

dialog::backdrop { background: rgba(10, 10, 12, .35); backdrop-filter: blur(3px); }

dialog[open] { animation: pop .3s cubic-bezier(.2, .9, .2, 1); }
dialog[open]::backdrop { animation: fade .3s ease; }

@keyframes pop {
  from { opacity: 0; transform: translateY(-10px) scale(.97); }
  to { opacity: 1; transform: none; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.menu-head { display: flex; align-items: center; border-bottom: 1px solid var(--rule); }

#q {
  flex: 1;
  margin: 0;
  padding: 16px 16px;
  border: 0;
  font-size: 15px;
  background: none;
}

.menu-head button {
  background: none;
  border: 0;
  margin-right: 12px;
  padding: 4px 7px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--ink-35);
  border: 1px solid var(--rule);
  border-radius: 4px;
  cursor: pointer;
}

#hits { list-style: none; margin: 0; padding: 6px; max-height: 46vh; overflow: auto; }

#hits li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 5px;
  cursor: pointer;
}

#hits li[aria-selected="true"] { background: var(--ink-12); }
#hits .lbl { flex: 1; font-size: 14px; }
#hits .tag { font-family: var(--mono); font-size: 9px; letter-spacing: .2em; color: var(--ink-35); text-transform: uppercase; }
#hits .none { color: var(--ink-35); cursor: default; }

.menu-foot { margin: 0; padding: 10px 14px; border-top: 1px solid var(--rule); color: var(--ink-35); letter-spacing: .14em; }
.menu-foot kbd { margin: 0 4px 0 0; }

/* ---------- small screens ---------- */

@media (max-width: 760px) {
  main { padding: 0 18px; }
  .top { padding: 16px 18px; gap: 12px; }
  .where { display: none; }
  .tools button kbd { display: none; }
  [data-row] { grid-template-columns: 34px 1fr; gap: 6px 10px; }
  [data-row] .k { grid-column: 2; }
  [data-row] .y { grid-column: 2; text-align: left; }
  .hero { padding-top: 30vh; }
  .clock { margin-left: 0; }
  .fine { margin: 18px 18px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .w > i { transform: none; transition: none; }
  .run { animation: none !important; }
  dialog[open] { animation: none; }
}
