/* Cymantics: site styles. Colors live in :root. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "STIX Math";
  src: url("fonts/stix-math.woff") format("woff");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --void: #06070B;
  --raise: #0C0F17;
  --line: #1B2030;
  --line-strong: #2E3548;
  --text: #E9ECF5;
  --dim: #8C93A8;
  --accent: #8EA8FF;
  --accent-hi: #B9C9FF;

  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --math: "STIX Math", "STIX Two Math", "Cambria Math", serif;

  --wrap: 1240px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

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

html { background: var(--void); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  font-weight: 380;
  line-height: 1.6;
}

::selection { background: var(--accent); color: var(--void); }

a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-hi); }

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

.skip {
  position: absolute; left: -9999px; top: 1rem; z-index: 20;
  background: var(--text); color: var(--void); padding: 0.5rem 1rem;
}
.skip:focus { left: var(--gutter); }

.math { font-family: var(--math); font-weight: 400; font-style: normal; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Type */

h1, h2, h3 { margin: 0; font-weight: 300; text-wrap: balance; }

h1 {
  font-size: clamp(2.3rem, 1rem + 4.4vw, 4.6rem);
  font-stretch: 125%;
  font-weight: 250;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(1.9rem, 1.1rem + 2.6vw, 3.1rem);
  font-stretch: 125%;
  font-weight: 260;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

h3 {
  font-size: 1.2rem;
  font-stretch: 112%;
  font-weight: 480;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

p { margin: 0; }

/* Header */

.site-header { position: absolute; inset: 0 0 auto; z-index: 5; }

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-stretch: 125%;
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand svg { width: 22px; height: 22px; flex: none; }

.nav ul { display: flex; gap: 0.25rem 2rem; margin: 0; padding: 0; list-style: none; }
.nav a { color: var(--dim); text-decoration: none; font-size: 0.95rem; }
.nav a:hover { color: var(--text); }

/* Hero */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-block: clamp(10rem, 22vh, 14rem) clamp(3.5rem, 8vh, 6rem);
}

.hero > .wrap { width: 100%; position: relative; }
.hero-copy { position: relative; z-index: 2; max-width: 50rem; }
.hero-copy p {
  margin-top: 1.75rem;
  max-width: 31rem;
  font-size: 1.125rem;
  color: var(--dim);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.25rem; }

.button {
  display: inline-block;
  padding: 0.85rem 1.4rem;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 500;
  text-decoration: none;
  background: rgba(6, 7, 11, 0.6);
}
.button:hover { border-color: var(--accent); color: var(--text); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--void); }
.button.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: var(--void); }

/* The lattice: a wave moving across a 17 x 17 grid, drawn with CSS 3D */

.field {
  position: absolute;
  top: -15rem;
  bottom: -2rem;
  left: 34%;
  right: -16%;
  z-index: 1;
  display: grid;
  place-items: center;
  perspective: 1100px;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 50%, transparent 100%);
          mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 50%, transparent 100%);
}

.tilt {
  --tilt: 64deg;
  --turn: 34deg;
  --shift-x: 0px;
  --shift-y: 0px;
  transform-style: preserve-3d;
  transform: translate(var(--shift-x), var(--shift-y)) rotateX(var(--tilt)) rotateZ(var(--turn));
}

.plane {
  --s: 40px;
  --amp: 150px;
  position: relative;
  width: calc(var(--s) * 16 + 1px);
  height: calc(var(--s) * 16 + 1px);
  transform-style: preserve-3d;
  background-image:
    linear-gradient(rgba(142, 168, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(142, 168, 255, 0.07) 1px, transparent 1px);
  background-size: var(--s) var(--s);
}

.plane i {
  position: absolute;
  left: calc(var(--x) * var(--s));
  top: calc(var(--y) * var(--s));
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px 1px rgba(142, 168, 255, 0.7);
  animation: ripple 7s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  animation-delay: calc((var(--d) - 12) * 1.4s);
}

/* Each point rises and falls; the counter-rotation keeps it facing the viewer */
@keyframes ripple {
  0%, 100% {
    transform: translateZ(calc(var(--a) * var(--amp) * -0.35)) rotateZ(calc(var(--turn) * -1)) rotateX(calc(var(--tilt) * -1));
    opacity: 0.1;
  }
  50% {
    transform: translateZ(calc(var(--a) * var(--amp))) rotateZ(calc(var(--turn) * -1)) rotateX(calc(var(--tilt) * -1));
    opacity: 1;
  }
}

/* Sections */

.section {
  padding-block: clamp(4.5rem, 10vw, 8rem);
  border-top: 1px solid var(--line);
}
.section h2 { margin-bottom: clamp(2.5rem, 5vw, 4rem); }

/* Research fields */

.fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fields article { padding: 2.5rem 2.5rem 2.75rem 0; }
.fields article + article { padding-left: 2.5rem; border-left: 1px solid var(--line); }
.fields article:last-child { padding-right: 0; }

.fields svg { display: block; width: 100%; max-width: 240px; height: auto; margin-bottom: 2rem; overflow: visible; }

.notation { display: block; font-size: 1.6rem; line-height: 1; color: var(--accent); margin-bottom: 1.1rem; }
.fields h3 { margin-bottom: 0.6rem; }
.fields p { color: var(--dim); max-width: 30ch; }

/* Figure strokes */
.fig .faint { stroke: var(--line-strong); }
.fig .dim   { stroke: var(--dim); }
.fig .hi    { stroke: var(--accent); }
.fig .ink   { stroke: var(--text); }
.fig .dot   { fill: var(--dim); }
.fig .dot-hi{ fill: var(--accent); }
.fig .dot-ink { fill: var(--text); }
.fig text   { font-family: var(--math); fill: var(--dim); font-size: 13px; }
.fig text.hi-t { fill: var(--accent); }

/* Papers */

.papers { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.papers li { border-bottom: 1px solid var(--line); }

.papers a {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) 9rem;
  gap: 0.25rem 2rem;
  align-items: baseline;
  padding-block: 1.5rem;
  color: var(--text);
  text-decoration: none;
}
.papers a:hover .title { color: var(--accent); }

.papers .year,
.papers .area { color: var(--dim); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.papers .area { text-align: right; }
.papers .title { font-size: 1.2rem; font-stretch: 108%; font-weight: 380; line-height: 1.35; }

/* Contact */

.contact h2 { max-width: 16ch; margin-bottom: 2.5rem; }
.email {
  font-size: clamp(1.25rem, 1rem + 1.1vw, 1.9rem);
  font-stretch: 115%;
  font-weight: 350;
  letter-spacing: -0.01em;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 0.15rem;
}

/* Footer */

.site-footer { border-top: 1px solid var(--line); padding-block: 2rem; color: var(--dim); font-size: 0.9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem 2rem; }
.site-footer .brand { font-size: 1rem; }
.site-footer .brand svg { width: 18px; height: 18px; }

/* 404 */

.lost .hero-copy p { max-width: 26rem; }

/* Responsive */

@media (max-width: 960px) {
  .fields { grid-template-columns: 1fr; border-bottom: 0; }
  .fields article,
  .fields article + article { padding: 2.5rem 0; border-left: 0; }
  .fields article + article { border-top: 1px solid var(--line); }
  .fields article { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 0 2.5rem; align-items: center; }
  .fields svg { margin-bottom: 0; grid-row: span 3; }
  .fields article:last-child { border-bottom: 1px solid var(--line); }

  .field {
    top: auto;
    bottom: calc(100% - 3rem);
    left: -10%;
    right: -10%;
    height: 440px;
  }
  .plane { --s: 26px; --amp: 52px; }
  .hero { min-height: 0; align-items: flex-start; padding-top: 32rem; }
}

@media (max-width: 640px) {
  .nav ul { gap: 0.25rem 1.25rem; }
  .plane { --s: 23px; --amp: 80px; }
  .tilt { --tilt: 58deg; }
  .field { height: 320px; bottom: calc(100% - 2rem); }
  .hero { padding-top: 24rem; }
  .fields article { grid-template-columns: 1fr; }
  .fields svg { max-width: 200px; margin-bottom: 1.75rem; grid-row: auto; }
  .papers a { grid-template-columns: 3.5rem minmax(0, 1fr); gap: 0.35rem 1rem; }
  .papers .area { grid-column: 2; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .plane i { animation-play-state: paused; }
}
