/* TensorML. Paper for reading, a dark band for the work, and one cobalt accent throughout. */

:root {
  --paper: #F2F4F0;
  --ink: #1B2440;
  --graphite: #566070;
  --rule: #C9D0CA;
  --cobalt: #2238D9;

  --night: #0C1126;
  --night-rule: rgba(226, 232, 255, 0.16);
  --night-text: #E6E9F2;
  --night-dim: #97A0B8;
  --signal: #8B9BFF;

  --serif: "STIX Two Text", "STIX Two", "Times New Roman", serif;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --measure: 62ch;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration-color: var(--cobalt); text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
a:hover { color: var(--cobalt); }

:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, p, ul, figure, table { margin: 0; }
img { display: block; max-width: 100%; height: auto; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; font-family: var(--sans); font-size: 0.9rem; }
.skip:focus { left: var(--gutter); top: 0.5rem; z-index: 10; }

/* Masthead */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.4rem var(--gutter) 1.1rem;
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
}

.wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.6rem;
  line-height: 1;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.wordmark sup {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
  font-stretch: 88%;
  font-size: 0.5em;
  letter-spacing: 0.04em;
  margin-left: 0.12em;
  vertical-align: 0.95em;
  line-height: 0;
}

.masthead nav { display: flex; gap: clamp(1rem, 2.4vw, 2.2rem); align-items: baseline; }
.masthead nav a {
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid transparent;
}
.masthead nav a:hover { border-bottom-color: var(--rule); color: var(--ink); }
.masthead nav a[aria-current="page"] { border-bottom-color: var(--cobalt); color: var(--cobalt); }

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 4vw, 4.5rem);
  align-items: start;
  padding: clamp(2rem, 5vw, 4.5rem) var(--gutter) clamp(3rem, 6vw, 5rem);
}

.hero h1 {
  font-weight: 400;
  font-size: clamp(2.6rem, 5vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.lede { margin-top: 1.7rem; max-width: 33rem; font-size: 1.28rem; line-height: 1.55; }

/* Graph */

.graph { min-width: 0; }
.graph-canvas svg { display: block; width: 100%; height: auto; overflow: visible; }

.graph-legend {
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.72rem;
  color: var(--graphite);
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.4rem;
}
.graph-readout {
  font-family: var(--sans);
  font-stretch: 92%;
  font-size: 0.88rem;
  line-height: 1.45;
  margin-top: 0.7rem;
  min-height: 4.4em;
  padding-left: 0.9rem;
  border-left: 2px solid var(--cobalt);
  max-width: 40rem;
}
.graph-readout:empty { border-left-color: transparent; }
.graph-readout strong { font-weight: 650; }

.key { display: inline-flex; align-items: center; gap: 0.45rem; white-space: nowrap; }
.dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 1.5px solid var(--ink); display: inline-block; }
.dot-filled { background: var(--ink); }

.g-col { font-family: var(--mono); font-stretch: 87.5%; font-size: 10.5px; fill: var(--graphite); }
.g-edge { fill: none; stroke: var(--ink); stroke-width: 1; opacity: 0.42; }
.g-edge.carry { stroke-dasharray: 3 4; }
.g-node { cursor: pointer; }
.g-node circle.mark { stroke: var(--ink); stroke-width: 1.6; fill: var(--paper); }
.g-node.shipped circle.mark { fill: var(--ink); }
.g-node circle.hit { fill: transparent; stroke: none; }
.g-node text {
  font-family: var(--sans);
  font-stretch: 90%;
  font-size: 13.5px;
  fill: var(--ink);
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 5px;
  stroke-linejoin: round;
}
.g-node.shipped text { font-weight: 650; }
.g-node:focus { outline: none; }
.g-node:focus-visible circle.mark { stroke: var(--cobalt); stroke-width: 3; }

.graph-canvas.has-focus .g-node { opacity: 0.28; }
.graph-canvas.has-focus .g-edge { opacity: 0.08; }
.graph-canvas.has-focus .g-node.on { opacity: 1; }
.graph-canvas.has-focus .g-edge.on { opacity: 1; stroke: var(--cobalt); stroke-width: 1.6; }
.graph-canvas.has-focus .g-node.self circle.mark { stroke: var(--cobalt); }
.graph-canvas.has-focus .g-node.self.shipped circle.mark { fill: var(--cobalt); }
.graph-canvas.has-focus .g-node.self text { fill: var(--cobalt); }

.g-node, .g-edge { transition: opacity 160ms ease, stroke 160ms ease; }

@media (prefers-reduced-motion: no-preference) {
  .graph-canvas.draw .g-edge:not(.carry) {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 900ms cubic-bezier(.3,.6,.2,1) forwards;
    animation-delay: calc(var(--i) * 28ms + 150ms);
  }
  .graph-canvas.draw .g-edge.carry { opacity: 0; animation: appear-edge 500ms ease forwards; animation-delay: 150ms; }
  .graph-canvas.draw .g-node { opacity: 0; animation: appear 400ms ease forwards; animation-delay: calc(var(--i) * 30ms); }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @keyframes appear { to { opacity: 1; } }
  @keyframes appear-edge { to { opacity: 0.42; } }
}

/* Work: the dark band. Each row is an index, an account, and where one exists a plate. */

.work {
  background: var(--night);
  color: var(--night-text);
  padding: clamp(2.5rem, 5vw, 4.5rem) var(--gutter) clamp(3rem, 6vw, 5rem);
  background-image:
    linear-gradient(var(--night-rule) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 232, 255, 0.045) 1px, transparent 1px);
  background-size: 100% 100%, calc((100% - 2 * var(--gutter)) / 12) 100%;
  background-position: 0 0, var(--gutter) 0;
  background-repeat: no-repeat, repeat-x;
}
.work a { text-decoration-color: var(--signal); }
.work a:hover { color: var(--signal); }
.work :focus-visible { outline-color: var(--signal); }

.work-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.work-head h2 { font-weight: 400; font-style: italic; font-size: clamp(1.7rem, 2.6vw, 2.3rem); line-height: 1.15; }

.tick, .idx, .plate figcaption, .role {
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.72rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
}
.tick { color: var(--night-dim); }

.row {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 5fr) minmax(0, 6fr);
  gap: 1rem clamp(1.5rem, 3.5vw, 4rem);
  align-items: start;
  padding: clamp(1.6rem, 3vw, 2.6rem) 0;
  border-top: 1px solid var(--night-rule);
  margin-top: 0;
  scroll-margin-top: 5rem;
}
.work-head + .row { margin-top: clamp(1.4rem, 2.5vw, 2.2rem); }

.idx { color: var(--signal); padding-top: 0.55rem; }
.row-lead .idx { padding-top: 1.3rem; }

.row h3 { font-weight: 400; font-size: clamp(1.7rem, 2.4vw, 2.2rem); line-height: 1.12; letter-spacing: -0.012em; }
.row-lead h3 { font-size: clamp(2.6rem, 4.6vw, 4.2rem); line-height: 1; }
.row h3 a { text-decoration: none; background: linear-gradient(var(--signal), var(--signal)) 0 100% / 0 2px no-repeat; transition: background-size 220ms ease; }
.row h3 a:hover { color: inherit; background-size: 100% 2px; }
.row:target h3 { color: var(--signal); }

.role { color: var(--night-dim); margin-top: 0.7rem; }
.role a { color: var(--night-text); }

.row-text > p:not(.role):not(.links) { margin-top: 1rem; max-width: 34rem; font-size: 1.1rem; line-height: 1.58; color: var(--night-text); }
.row-lead .row-text > p:not(.role):not(.links) { font-size: 1.22rem; }

.links { margin-top: 1.1rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.links a {
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: 0.42rem 0.7rem;
  border: 1px solid var(--night-rule);
  border-radius: 2px;
}
.links a:hover { border-color: var(--signal); }

/* Plates */

.plate { position: relative; }
.plate img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: center;
  background: #05070F;
  border: 1px solid var(--night-rule);
}
.plate::before, .plate::after {
  content: "";
  position: absolute;
  width: 0.7rem;
  height: 0.7rem;
  border: 0 solid var(--signal);
  pointer-events: none;
}
.plate::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.plate::after { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.plate figcaption { color: var(--night-dim); margin-top: 0.6rem; }

.plate-logo img { object-fit: contain; background: #211F20; padding: 5%; }
.plate-invert img { filter: invert(1) hue-rotate(180deg); object-fit: contain; background: #fff; padding: 3%; }
.plate-tall img { aspect-ratio: 16 / 13; object-fit: cover; object-position: top; padding: 0; }
.plate-pixel img { image-rendering: pixelated; }
.row-lead .plate img { aspect-ratio: 1500 / 1044; }
.plate-light::before, .plate-light::after { border-color: var(--cobalt); }
.plate-light img { aspect-ratio: 1; border-color: var(--rule); }

.also {
  margin-top: 0;
  padding-top: 1.8rem;
  border-top: 1px solid var(--night-rule);
  padding-left: calc(3.2rem + clamp(1.5rem, 3.5vw, 4rem));
  max-width: calc(var(--measure) + 8rem);
  font-size: 1.02rem;
  color: var(--night-dim);
}
.also a { color: var(--night-text); }

/* Inner pages */

.page { padding: clamp(2rem, 5vw, 4rem) var(--gutter) clamp(3rem, 6vw, 5rem); }
.page > h1 { font-weight: 400; font-size: clamp(2.6rem, 5vw, 4.6rem); line-height: 1.02; letter-spacing: -0.02em; }

.page-cols {
  margin-top: clamp(1.8rem, 3.5vw, 3rem);
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}

.prose { max-width: var(--measure); }
.prose p + p { margin-top: 1.1em; }
.prose h2 { font-weight: 500; font-size: 1.45rem; line-height: 1.2; margin-top: 2.2rem; }
.prose h2 + p, .prose h2 + table { margin-top: 0.6rem; }

.side { font-family: var(--sans); font-stretch: 92%; font-size: 0.95rem; line-height: 1.5; }
.side h2 { font-family: var(--mono); font-stretch: 87.5%; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.02em; color: var(--graphite); margin-top: 1.8rem; }
.side > h2:first-child { margin-top: 0.4rem; }
.side ul { list-style: none; padding: 0; margin-top: 0.45rem; }
.side li + li { margin-top: 0.3rem; }

.ledger { width: 100%; border-collapse: collapse; font-size: 1.05rem; }
.ledger th, .ledger td { text-align: left; vertical-align: baseline; padding: 0.55rem 0; border-top: 1px solid var(--rule); }
.ledger th { font-weight: 500; width: 38%; padding-right: 1rem; }
.ledger td { font-family: var(--mono); font-stretch: 87.5%; font-size: 0.74rem; color: var(--graphite); }
.ledger tr:last-child th, .ledger tr:last-child td { border-bottom: 1px solid var(--rule); }

.ket { margin-top: 1.2rem; max-width: 22rem; }
.ket img { mix-blend-mode: multiply; aspect-ratio: 3.4; object-fit: cover; }

/* Contact */

.contact-form {
  margin-top: 2.2rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.3rem 2rem;
  max-width: 46rem;
}
.field-wide { grid-column: 1 / -1; }
.field label { display: block; font-family: var(--mono); font-stretch: 87.5%; font-size: 0.72rem; letter-spacing: 0.02em; margin-bottom: 0.45rem; }
.field input, .field textarea {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--graphite);
  border-radius: 2px;
  padding: 0.7rem 0.8rem;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus-visible, .field textarea:focus-visible { outline-offset: 1px; }
.field [aria-invalid="true"] { border-color: #A3261B; box-shadow: 0 0 0 1px #A3261B; }

.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.form-status { font-family: var(--sans); font-stretch: 92%; font-size: 0.95rem; }
.form-status:empty { display: none; }

.button {
  display: inline-block;
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  line-height: 1;
  padding: 0.95rem 1.6rem;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 2px;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--cobalt); color: #fff; }

/* Colophon */

.colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 1.6rem var(--gutter) 2.4rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.72rem;
  color: var(--graphite);
}
.work + .colophon, main:has(> .work:last-child) + .colophon { border-top: 0; }

/* Narrow screens */

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .lede { max-width: var(--measure); }
  .page-cols { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: 2.4rem minmax(0, 1fr); }
  .row .plate { grid-column: 2; margin-top: 0.6rem; }
  .also { padding-left: calc(2.4rem + clamp(1.5rem, 3.5vw, 4rem)); }
  .side .plate { max-width: 22rem; }
}

@media (max-width: 700px) {
  body { font-size: 1.09rem; }
  .masthead { padding-top: 1rem; padding-bottom: 0.7rem; flex-wrap: wrap; row-gap: 0.6rem; }
  .masthead nav { gap: 1rem; }
  .lede { font-size: 1.16rem; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }
  .row .plate { grid-column: 1; margin-top: 1rem; }
  .idx, .row-lead .idx { padding-top: 0; }
  .also { padding-left: 0; }
  .contact-form { grid-template-columns: minmax(0, 1fr); }
  .graph-readout { min-height: 6.5em; }
  .work { background-image: linear-gradient(var(--night-rule) 1px, transparent 1px); background-size: 100% 100%; background-position: 0 0; background-repeat: no-repeat; }
}
