/* ==========================================================================
   De Stijl / Bauhaus. Black rules, primary colour blocks, geometric lowercase type.
   The palette lives in :root; change a colour there and it changes everywhere.
   ========================================================================== */

@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/jost-latin-wght-normal.woff2') format('woff2-variations'),
       url('../fonts/jost-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/jost-latin-ext-wght-normal.woff2') format('woff2-variations'),
       url('../fonts/jost-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Jost';
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/jost-latin-wght-italic.woff2') format('woff2-variations'),
       url('../fonts/jost-latin-wght-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #f3efe4;
  --ink: #121212;
  --red: #d42a1f;
  --blue: #1d3f91;
  --yellow: #f5c518;
  --muted: #5b5850;

  --rule: clamp(6px, 0.8vw, 11px);   /* thickness of the black lines */
  --thin: 3px;
  --pad: clamp(1.1rem, 2.4vw, 2.1rem);

  --font: 'Jost', 'Futura', 'Century Gothic', 'Avenir Next', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(1.03rem, 0.98rem + 0.25vw, 1.15rem);
  line-height: 1.55;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: .6rem 1rem;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 600;
}
.skip:focus { top: 1rem; }

.muted { color: var(--muted); }

/* ---------------------------------------------------------------- canvas */

.canvas {
  max-width: 1280px;
  margin: clamp(0px, 3vw, 44px) auto;
  padding: var(--rule);
  background: var(--ink);
  display: grid;
  gap: var(--rule);
}

.cell {
  background: var(--paper);
  min-width: 0;
}

.swatch {
  cursor: pointer;
  transition: background-color .3s ease;
}
.swatch[data-c="red"]    { background: var(--red); }
.swatch[data-c="yellow"] { background: var(--yellow); }
.swatch[data-c="blue"]   { background: var(--blue); }
.swatch[data-c="paper"]  { background: var(--paper); }
.swatch[data-c="ink"]    { background: var(--ink); }

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

.hero {
  display: grid;
  gap: var(--rule);
  grid-template-columns:
    minmax(44px, .55fr) minmax(0, 3.3fr) minmax(0, 2.35fr) minmax(52px, .7fr);
  grid-template-rows: auto auto auto auto;
  grid-template-areas:
    "s1    kicker photo s2"
    "s3    name   photo s2"
    "s3    role   photo s4"
    "links links  links s4";
}

.kicker {
  grid-area: kicker;
  display: flex;
  align-items: center;
  padding: 1.1rem var(--pad);
  font-size: .9rem;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: lowercase;
}

.name {
  grid-area: name;
  display: flex;
  align-items: flex-end;
  padding: clamp(2rem, 5vw, 4.5rem) var(--pad) clamp(1.4rem, 3vw, 2.4rem);
  container-type: inline-size;
}

.name h1 {
  margin: 0;
  /* As large as fits: "katzhendler." is about 5.5em wide. */
  font-size: clamp(2.4rem, 6vw, 5.75rem);
  font-size: min(6.5rem, 100cqi / 5.4);
  font-weight: 700;
  line-height: .84;
  letter-spacing: -.045em;
  text-transform: lowercase;
  white-space: nowrap;
}
/* A red square for a full stop. */
.name h1::after {
  content: "";
  display: inline-block;
  width: .17em;
  height: .17em;
  margin-left: .06em;
  background: var(--red);
}

.role {
  grid-area: role;
  padding: 1.2rem var(--pad);
  display: flex;
  align-items: center;
}
.role p {
  margin: 0;
  font-size: clamp(1.05rem, .9rem + .5vw, 1.3rem);
  font-weight: 500;
  line-height: 1.25;
  text-transform: lowercase;
}
.role a { text-decoration: none; }
.role a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

.photo {
  grid-area: photo;
  position: relative;
  margin: 0;
  overflow: hidden;
  min-height: 20rem;
  background: var(--ink);
}
.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 27% 36%;
  display: block;
}

.links {
  grid-area: links;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--rule);
}
.links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: 1rem var(--pad);
  font-weight: 600;
  text-decoration: none;
  text-transform: lowercase;
  transition: background-color .2s ease, color .2s ease;
}
.links a::after {
  content: "↗";
  font-weight: 400;
}
.links a:nth-child(1):hover { background: var(--red); color: #fff; }
.links a:nth-child(2):hover { background: var(--blue); color: #fff; }
.links a:nth-child(3):hover { background: var(--yellow); }
.links a:nth-child(4):hover { background: var(--ink); color: var(--paper); }

/* ---------------------------------------------------------------- sections */

.board {
  display: grid;
  gap: var(--rule);
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-areas:
    "about news"
    "pubs  pubs"
    "toys  toys";
}
.about { grid-area: about; }
.news  { grid-area: news; }
.pubs  { grid-area: pubs; }
.interactive { grid-area: toys; }

.section {
  padding: var(--pad);
}

.section h2 {
  display: flex;
  align-items: center;
  gap: .45em;
  margin: 0 0 1.1rem;
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
  text-transform: lowercase;
}

/* Kandinsky's three: red square, yellow triangle, blue circle. */
.shape {
  flex: none;
  display: inline-block;
  width: .62em;
  height: .62em;
}
.shape.square   { background: var(--red); }
.shape.circle   { background: var(--blue); border-radius: 50%; }
.shape.triangle { background: var(--yellow); clip-path: polygon(50% 0, 100% 100%, 0 100%); width: .72em; }
.shape.half     { background: var(--ink); border-radius: .4em .4em 0 0; width: .76em; height: .38em; margin-top: .2em; }

.prose { max-width: 62ch; }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }

.prose a,
.news-body a,
.pub-abstract a,
.pub-authors a {
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.prose a:hover,
.news-body a:hover,
.pub-abstract a:hover,
.pub-authors a:hover {
  background: var(--yellow);
  text-decoration-color: var(--ink);
}

/* ---------------------------------------------------------------- news */

.news-list ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.news-list li {
  padding: .85rem 0;
  border-top: var(--thin) solid var(--ink);
}
.news-list li:last-child { padding-bottom: 0; }
.news-list time {
  display: inline-block;
  margin-bottom: .35rem;
  padding: .12em .5em .16em;
  background: var(--ink);
  color: var(--paper);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .08em;
  line-height: 1.3;
}
.news-body p { margin: 0 0 .5em; }
.news-body p:last-child { margin-bottom: 0; }
.news-body ul, .news-body ol { margin: .3em 0; padding-left: 1.2em; list-style: square; }
.news-body li { border: 0; padding: .1em 0; }
.news-body img { max-width: 100%; height: auto; }
.news-list .more { margin-top: 1rem; }

/* ---------------------------------------------------------------- publications */

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  margin-bottom: 1.1rem;
}
.section-head h2 { margin: 0; }

.filter {
  display: flex;
}
.filter:empty { display: none; }
.filter button {
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  text-transform: lowercase;
  padding: .45em 1em;
  background: var(--paper);
  color: var(--ink);
  border: var(--thin) solid var(--ink);
  cursor: pointer;
}
.filter button + button { border-left: 0; }
.filter button[aria-pressed="true"] { background: var(--yellow); }
/* The red square of featured papers, as a key. */
.filter button[data-filter="selected"]::before {
  content: "";
  display: inline-block;
  width: .5em;
  height: .5em;
  margin-right: .45em;
  vertical-align: .1em;
  background: var(--red);
}
.filter .count {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  margin-left: .2em;
}

.year-group {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding: 1.4rem 0 1.6rem;
  border-top: var(--thin) solid var(--ink);
}
.year-group:last-child { padding-bottom: 0; }

.year {
  margin: 0;
  align-self: start;
  position: sticky;
  top: 1rem;
  font-size: clamp(1.9rem, 1.4rem + 1.4vw, 2.6rem);
  font-weight: 700;
  line-height: .9;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.pub + .pub { margin-top: 1.7rem; }

.pub-title {
  margin: 0 0 .3rem;
  font-size: clamp(1.15rem, 1.05rem + .4vw, 1.38rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.005em;
}
.pub-title a {
  text-decoration: none;
  background-image: linear-gradient(var(--red), var(--red));
  background-size: 0 3px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size .25s ease;
}
.pub-title a:hover { background-size: 100% 3px; }

/* Featured papers carry a small red square, in both views (only when there is a filter to explain it). */
.marks-selected .is-selected .pub-title::before {
  content: "";
  display: inline-block;
  width: .5em;
  height: .5em;
  margin-right: .45em;
  vertical-align: .1em;
  background: var(--red);
}

.pub-authors,
.pub-venue {
  margin: 0;
  font-size: .98rem;
  line-height: 1.45;
}
.pub-authors .me {
  font-weight: 600;
  box-shadow: inset 0 -.32em 0 var(--yellow);
}
.pub-venue {
  color: var(--muted);
  font-style: italic;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .7rem;
}

.tag {
  --c: var(--ink);
  --c-text: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding: .38em .7em .42em;
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  text-transform: lowercase;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.tag::before {
  content: "";
  width: .5em;
  height: .5em;
  background: var(--c);
  transition: background-color .15s ease;
}
.tag[data-c="yellow"] { --c: var(--yellow); --c-text: var(--ink); }
.tag[data-c="red"]    { --c: var(--red);    --c-text: #fff; }
.tag[data-c="blue"]   { --c: var(--blue);   --c-text: #fff; }
.tag[data-c="paper"]::before { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }

.tag[aria-expanded="true"] {
  background: var(--c);
  color: var(--c-text);
}
.tag[aria-expanded="true"]::before {
  background: var(--c-text);
  box-shadow: none;
}

.pub-abstract {
  margin-top: .9rem;
  padding: .1rem 0 .1rem 1.1rem;
  border-left: 6px solid var(--yellow);
  max-width: 78ch;
  font-size: .98rem;
}
.pub-abstract p { margin: 0; }

.pub-bibtex {
  position: relative;
  margin-top: .9rem;
  background: var(--ink);
  color: var(--paper);
}
.pub-bibtex pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .78rem;
  line-height: 1.5;
}
.pub-bibtex .copy {
  position: absolute;
  top: 0;
  right: 0;
  padding: .4em .8em;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  background: var(--yellow);
  color: var(--ink);
  border: 0;
  cursor: pointer;
}

/* Hover effects for buttons that stay on the page, only where there is a real pointer:
   on a touch screen a tapped button keeps :hover until the next tap elsewhere.
   A closed toggle only tints, so the full colour always means "open". */
@media (hover: hover) {
  a.tag:hover { background: var(--c); color: var(--c-text); }
  a.tag:hover::before { background: var(--c-text); box-shadow: none; }
  button.tag:not([aria-expanded="true"]):hover { background: color-mix(in srgb, var(--c) 22%, transparent); }
  .filter button:not([aria-pressed="true"]):hover { background: #fff8dc; }
  .pub-bibtex .copy:hover { background: var(--paper); }
}

.sc { font-variant: small-caps; }
code { font-family: var(--mono); font-size: .9em; }

/* ---------------------------------------------------------------- interactive */

.toy {
  display: grid;
  grid-template-columns: minmax(0, 27rem) minmax(0, 1fr);
  gap: 1.25rem 2rem;
  align-items: center;
  padding-top: 1.4rem;
  border-top: var(--thin) solid var(--ink);
  color: inherit;
  text-decoration: none;
}
.toy + .toy { margin-top: 1.6rem; }
.toy img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: var(--thin) solid var(--ink);
}
.toy-text { display: flex; flex-direction: column; align-items: flex-start; gap: .55rem; }
.toy-title {
  font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.025em;
  text-transform: lowercase;
  background-image: linear-gradient(var(--red), var(--red));
  background-size: 0 4px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size .25s ease;
}
.toy-desc { max-width: 46ch; }
.toy .tag { margin-top: .35rem; }
.toy:hover .toy-title { background-size: 100% 4px; }
.toy:hover .tag { background: var(--yellow); }
.toy:hover .tag::before { background: var(--ink); }

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

.foot {
  display: grid;
  gap: var(--rule);
  grid-template-columns: minmax(0, 1fr) minmax(3rem, 9rem) minmax(1.5rem, 2.5rem) minmax(3rem, 6rem);
  min-height: 3.6rem;
}
.foot > .cell:first-child {
  display: flex;
  align-items: center;
  padding: .9rem var(--pad);
  font-size: .9rem;
  font-weight: 500;
  text-transform: lowercase;
}

/* ---------------------------------------------------------------- tablet */

@media (max-width: 900px) {
  .board {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "about" "news" "pubs" "toys";
  }
}

/* ---------------------------------------------------------------- phone */

@media (max-width: 640px) {
  .canvas { margin: 0; }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 2.6rem;
    grid-template-rows: none;
    grid-template-areas:
      "kicker kicker s1"
      "name   name   s2"
      "photo  photo  s2"
      "photo  photo  s3"
      "role   role   s3"
      "links  links  links";
  }
  .hero .swatch[style*="s4"] { display: none; }

  .kicker { font-size: .78rem; letter-spacing: .18em; }
  .name { padding-top: 2.2rem; }

  .photo {
    min-height: 0;
    aspect-ratio: 1 / 1;
  }

  .links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .links a { justify-content: center; padding: .9rem .5rem; font-size: .95rem; }
  .links a::after { display: none; }

  .year-group {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 1rem;
  }
  .toy { grid-template-columns: minmax(0, 1fr); }
  .year {
    position: static;
    margin-bottom: .9rem;
  }

  .foot { grid-template-columns: minmax(0, 1fr) 3rem 1.2rem 2.4rem; }
}

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

@media print {
  .canvas { background: none; padding: 0; margin: 0; }
  .swatch, .links, .filter, .pub-links { display: none !important; }
  .hero { display: block; }
  .photo { display: none; }
}

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

.lost {
  display: grid;
  gap: var(--rule);
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, .5fr);
  grid-template-areas:
    "code code s1"
    "code code s2"
    "msg  s3   s3";
  min-height: 70vh;
}
.lost-code { grid-area: code; display: flex; align-items: flex-end; padding: var(--pad); }
.lost-code h1 {
  margin: 0;
  font-size: clamp(5rem, 22vw, 16rem);
  font-weight: 700;
  line-height: .8;
  letter-spacing: -.05em;
}
.lost-msg { grid-area: msg; padding: var(--pad); font-size: 1.2rem; font-weight: 500; }
.lost-msg p { margin: 0; }
.lost-msg a { text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 3px; }
