/* ChaosDivergence: world lines. Blue traces rise like the tracks of a circuit board, run in buses,
   split, come back together and part around the name. Only one of them is lit. */

@font-face {
  font-family: "Funnel Display";
  src: url("/fonts/FunnelDisplay-300-800-normal.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: "Funnel Sans";
  src: url("/fonts/FunnelSans-300-800-normal.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --bg: #05070c;
  --bg-2: #0a0f19;
  --rule: #18202e;
  --rule-2: #283750;
  --ink: #e8edf6;
  --ink-2: #9ba5b9;
  --blue: #5b8cff;
  --blue-2: #a3c3ff;
  --selection: #2a4fc0;

  --display: "Funnel Display", "Helvetica Neue", Arial, sans-serif;
  --sans: "Funnel Sans", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(18px, 4vw, 48px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
  background: var(--bg);
  color: var(--ink);
  font: 400 18px/1.6 var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scrollbar-color: var(--rule-2) var(--bg);
  scrollbar-width: thin;
  caret-color: var(--blue);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font: 400 18px/1.6 var(--sans);
}

::selection {
  background: var(--selection);
  color: var(--ink);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

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

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -60px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  font: 600 15px/1 var(--sans);
  text-decoration: none;
}
.skip:focus {
  top: 12px;
}

/* ---------- the hero: the world lines, the name in the gap they open ---------- */

.hero {
  position: relative;
  isolation: isolate;
  min-height: max(640px, 100svh);
  overflow: hidden;
  background: var(--bg);
  cursor: crosshair;
}

.field {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* the dark that lets the name and the caption read over the far lines */
.veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(var(--clear-rx, 320px) var(--clear-ry, 150px) at var(--clear-x, 50%) var(--clear-y, 47%), rgb(5 7 12 / 0.9) 0%, rgb(5 7 12 / 0.72) 55%, rgb(5 7 12 / 0) 100%),
    radial-gradient(var(--plate-rx, 320px) var(--plate-ry, 70px) at var(--plate-x, 50%) var(--plate-y, 92%), rgb(5 7 12 / 0.92) 0%, rgb(5 7 12 / 0.75) 50%, rgb(5 7 12 / 0) 100%),
    linear-gradient(to bottom, rgb(5 7 12 / 0.9) 0, rgb(5 7 12 / 0) 15%, rgb(5 7 12 / 0) 72%, rgb(5 7 12 / 0.94) 100%);
}

.bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px var(--gutter);
  cursor: auto;
}

.mark {
  display: block;
  flex: none;
  border-radius: 6px;
}
.mark img {
  display: block;
  width: 34px;
  height: 34px;
}

.bar-end {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 32px);
}

.menu {
  display: flex;
  gap: clamp(14px, 2.2vw, 28px);
}
.menu a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--ink-2);
  font: 500 15px/1 var(--sans);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}
.menu a:hover {
  color: var(--ink);
}

.lang {
  display: flex;
  gap: 2px;
}
.lang button {
  min-width: 36px;
  min-height: 40px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: 600 15px/1 var(--sans);
  cursor: pointer;
}
.lang button[aria-pressed="true"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* the name, the handle on one line, in the gap the near traces open for it */
.lockup {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: var(--ly, 47%);
  width: max-content;
  max-width: calc(100% - 2 * var(--gutter));
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.title {
  margin: 0;
  /* as wide as the screen allows, and never wider than the room the traces need to go round it */
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(28px, min(calc((100vw - 2 * var(--gutter)) / 9.4), calc(12.6svh - 20px)), 92px);
  line-height: 1;
  letter-spacing: -0.015em;
  white-space: nowrap;
  color: var(--ink);
}

.plate {
  position: absolute;
  z-index: 3;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  cursor: auto;
}
.caption {
  max-width: 56ch;
  margin: 0;
  color: var(--ink-2);
  font: 400 14.5px/1.45 var(--sans);
  text-wrap: balance;
}
.pause {
  min-height: 40px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 14.5px/1 var(--sans);
  text-decoration: underline;
  text-decoration-color: var(--rule-2);
  text-underline-offset: 5px;
  cursor: pointer;
}
.pause:hover {
  text-decoration-color: var(--blue);
}
.is-static .pause {
  display: none;
}

/* the name arrives once the lines have risen past it */
.lockup {
  opacity: 0;
  transition: opacity 1s var(--ease-out);
}
.is-in .lockup {
  opacity: 1;
}

/* ---------- the projects ---------- */

main {
  background: var(--bg);
}

.project {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(36px, 6vw, 96px);
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(80px, 10vw, 140px) var(--gutter);
  border-top: 1px solid var(--rule);
}

/* every rule is a trace, with a via where the content starts */
.project::before,
.contact::before {
  content: "";
  position: absolute;
  top: -5px;
  left: calc(var(--gutter) - 4.5px);
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--rule-2);
  border-radius: 50%;
  background: var(--bg);
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  color: var(--ink-2);
  font: 500 15px/1.2 var(--sans);
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue-2);
}

.project-name {
  margin: 0;
  font: 700 clamp(44px, 5.6vw, 80px) / 0.95 var(--display);
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.provisional {
  display: block;
  margin-top: 12px;
  color: var(--ink-2);
  font: 400 16px/1.3 var(--sans);
  letter-spacing: 0;
}

.project-lead {
  max-width: 30ch;
  margin: 24px 0 0;
  font: 500 clamp(20px, 1.8vw, 25px) / 1.4 var(--sans);
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.facts {
  display: grid;
  gap: 10px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
}
.facts li {
  position: relative;
  max-width: 50ch;
  padding-left: 24px;
}
.facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.8em;
  width: 12px;
  height: 2px;
  background: var(--blue);
}

.buy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-top: 34px;
}
.cta {
  min-height: 50px;
  padding: 0 26px;
  border: 1.5px dashed var(--ink-2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: 600 16px/1 var(--sans);
}
.cta:disabled {
  cursor: not-allowed;
}
.cta:not(:disabled) {
  border-style: solid;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
}
.buy-note {
  max-width: 38ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.5;
}
.buy-note strong {
  color: var(--ink);
  font-weight: 600;
}

.project-visual {
  display: grid;
  place-items: center;
  min-width: 0;
  margin: 0;
}

.readout {
  width: min(440px, 100%);
  padding: 22px 26px 8px;
  border: 1.5px solid var(--rule-2);
  border-radius: 4px;
  background: var(--bg-2);
}
.readout-head {
  display: flex;
  justify-content: space-between;
  margin: 0 0 10px;
  color: var(--ink-2);
  font: 500 15px/1 var(--sans);
}
.readout dl {
  margin: 0;
}
.readout dl > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}
.readout dt {
  color: var(--ink-2);
  font-size: 15.5px;
}
.readout dd {
  margin: 0;
  text-align: right;
  font-weight: 500;
}
.readout-out dd {
  color: var(--blue-2);
  font-weight: 700;
}

/* ---------- contact ---------- */

.contact {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(80px, 10vw, 140px) var(--gutter) 30px;
  border-top: 1px solid var(--rule);
}
.contact-title {
  margin: 0;
  font: 700 clamp(34px, 4.2vw, 56px) / 1 var(--display);
  letter-spacing: -0.03em;
}
.contact-lead {
  max-width: 48ch;
  margin: 16px 0 0;
  color: var(--ink-2);
}
.mail {
  display: inline-block;
  margin-top: 20px;
  /* on one line while it fits (the address is 14.4 times its size), after the @ on phones */
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(30px, min(5.6vw, calc((100vw - 2 * var(--gutter)) / 14.6)), 76px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.14em;
  transition: color 0.2s var(--ease-out);
}
.mail:hover {
  color: var(--blue-2);
}
.colophon {
  margin: clamp(72px, 9vw, 120px) 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 15px;
}

/* ---------- narrower screens ---------- */

@media (max-width: 880px) {
  .project {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .mail {
    font-size: calc((100vw - 2 * var(--gutter)) / 10.2);
  }
}

@media (max-width: 420px) {
  .menu {
    gap: 12px;
  }
  .bar-end {
    gap: 10px;
  }
}

@media (max-width: 360px) {
  .bar {
    gap: 10px;
  }
  .menu {
    gap: 10px;
  }
  .bar-end {
    gap: 6px;
  }
  .lang button {
    min-width: 30px;
    padding: 0 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- 404 ---------- */

.lost {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--gutter);
  text-align: center;
}
.lost h1 {
  margin: 0;
  font: 700 clamp(32px, 5vw, 60px) / 1.05 var(--display);
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.lost p {
  margin: 16px 0 0;
  color: var(--ink-2);
}
.lost a {
  display: inline-flex;
  margin-top: 26px;
  color: var(--ink);
  font-weight: 600;
  text-decoration-color: var(--blue);
  text-underline-offset: 6px;
}
