/* Fonts are hosted here rather than loaded from Google, so no visitor data goes to Google. */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-italic-latin-ext.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: "IBM Plex Sans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-italic-latin.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: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-normal-latin-ext.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: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/ibm-plex-sans-normal-latin.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: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/newsreader-italic-latin-ext.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: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/newsreader-italic-latin.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: "Newsreader";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/newsreader-normal-latin-ext.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: "Newsreader";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/newsreader-normal-latin.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: #f5f3ee;
  --ink: #1c1b19;
  --muted: #6d6a63;
  --rule: #d9d5cc;
  --accent: #9b2f1d;

  --card: #fbfaf7;
  --shadow: rgba(40, 32, 20, 0.16);

  --serif: "Newsreader", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;

  color-scheme: light;
}

/* Dark: follows the system unless the toggle has picked a theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161614;
    --ink: #e8e5de;
    --muted: #9a968d;
    --rule: #33322e;
    --accent: #e0846c;
    --card: #1e1e1b;
    --shadow: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #161614;
  --ink: #e8e5de;
  --muted: #9a968d;
  --rule: #33322e;
  --accent: #e0846c;
  --card: #1e1e1b;
  --shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

main,
footer {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

p {
  margin: 0 0 0.75em;
}

/* Theme switch: the default cross-fade is replaced by the circle in theme.js. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* Top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  font-family: var(--sans);
  font-size: 0.875rem;
}

.topbar .back {
  color: var(--accent);
  text-decoration: none;
}

.topbar .back:hover {
  text-decoration: underline;
}

.theme-toggle {
  margin-left: 0.5rem;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--ink);
}

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

.theme-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  transition: transform 0.4s ease;
}

:root[data-theme="dark"] .theme-toggle svg {
  transform: rotate(180deg);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle svg {
    transform: rotate(180deg);
  }
}

/* Full-screen hero */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  height: 100svh;
  min-height: 34rem;
  overflow: hidden;
  background: #1c1b19;
  color: #f5f3ee;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 45% 35%;
}

/* A light wash in the page colour, so the photo follows the light/dark theme. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--paper);
  opacity: 0.15;
}

/* Darkens the bottom (and a little of the top) so the text stays readable. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to top, rgba(12, 11, 10, 0.82) 0%, rgba(12, 11, 10, 0.4) 35%, rgba(12, 11, 10, 0) 60%),
    linear-gradient(to bottom, rgba(12, 11, 10, 0.3) 0%, rgba(12, 11, 10, 0) 15%);
}

.hero-bar,
.hero-text {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 82rem;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}

.hero-text > * {
  max-width: 34rem;
}

@media (min-width: 900px) {
  .hero-text > * {
    max-width: min(34rem, 38vw);
  }

  .hero .lede {
    font-size: 1.125rem;
  }
}

.hero-bar {
  display: flex;
  align-items: center;
  padding-top: 1.25rem;
}

.hero .theme-toggle {
  color: rgba(245, 243, 238, 0.85);
}

.hero .theme-toggle:hover {
  color: #fff;
}

.hero-text {
  padding-bottom: 3.5rem;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.35);
}

.hero h1 {
  color: #fff;
  font-size: clamp(2.5rem, min(6vw, 8.5vh), 4.25rem);
  margin-bottom: 0.9rem;
}

.hero .lede {
  color: rgba(255, 255, 255, 0.92);
}

.hero .toc {
  margin-top: 1.75rem;
}

.hero .toc a {
  color: #f0a58f;
}

main > section:first-child {
  border-top: 0;
}

/* Headings and intro text */

.photo {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 0.3rem 0 2rem;
}

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 7vw, 3.75rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}

.lede {
  font-size: 1.25rem;
  line-height: 1.5;
  max-width: 34rem;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin-top: 2.5rem;
  font-family: var(--sans);
  font-size: 0.875rem;
}

.toc a {
  color: var(--accent);
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
}

/* Sections */

main section {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 1rem 2rem;
  padding: 2.25rem 0 1.5rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1rem;
}

h2 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.9;
  color: var(--muted);
  margin: 0;
}

h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.35;
  margin: 0 0 0.25rem;
}

h3 a:hover {
  text-decoration-thickness: 2px;
}

h3.group {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  margin: 1.75rem 0 0.75rem;
}

h3.group:first-child {
  margin-top: 0.3rem;
}

.meta,
.when {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.9;
  margin: 0;
}

.meta {
  margin-bottom: 0.5rem;
}

.entry {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0 1.25rem;
  margin-bottom: 1.25rem;
}

.entry p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: 500;
}

ul.plain {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.plain li {
  padding-left: 1.1em;
  position: relative;
  margin-bottom: 0.5rem;
}

ul.plain li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--muted);
}

ul.links {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
}

/* Contact form */

.contact-form {
  display: grid;
  gap: 1rem;
  max-width: 32rem;
  margin-top: 1.25rem;
}

.contact-form label {
  display: grid;
  gap: 0.3rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.contact-form textarea {
  resize: vertical;
  min-height: 8rem;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

.contact-form .hp {
  position: absolute;
  left: -9999px;
}

.button {
  justify-self: start;
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.08);
}

.button:disabled {
  opacity: 0.6;
  cursor: default;
}

.form-status {
  font-family: var(--sans);
  font-size: 0.9375rem;
  margin: 0;
}

.form-status:empty {
  display: none;
}

.elsewhere {
  margin-top: 2rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--muted);
}

/* Language switch */

.lang {
  display: flex;
  gap: 0.7rem;
  margin-left: auto;
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

.lang a {
  color: var(--accent);
  text-decoration: none;
}

.lang a:hover {
  text-decoration: underline;
}

.lang [aria-current] {
  color: var(--ink);
  font-weight: 500;
}

.hero .lang a {
  color: #f0a58f;
}

.hero .lang [aria-current] {
  color: #fff;
}

/* CV page: headings above the entries, like the PDF */

.page-head .button {
  margin-top: 0.5rem;
}

.cv-page main section {
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.cv-page .entry {
  grid-template-columns: 9.5rem 1fr;
}

.cv-page .entry p {
  margin-bottom: 0.2rem;
}

/* 404 */

.notfound p {
  margin-bottom: 0.4rem;
}

footer {
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
  padding-bottom: 4rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Landing page doors */

.doors {
  padding: 2.5rem 0 3rem;
}

.door {
  display: grid;
  grid-template-columns: 11rem 1fr auto;
  gap: 0.25rem 2rem;
  align-items: baseline;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}

.door:last-child {
  border-bottom: 1px solid var(--rule);
}

.door-title {
  font-family: var(--serif);
  font-size: 1.75rem;
  line-height: 1.2;
  color: var(--accent);
}

.door-arrow {
  color: var(--accent);
  font-size: 1.25rem;
  transition: transform 0.25s ease;
}

.door:hover .door-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.door:hover .door-arrow {
  transform: translateX(4px);
}

/* Footer navigation */

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin-bottom: 0.75rem;
}

.footer-nav a {
  text-decoration: none;
}

.footer-nav a:hover {
  text-decoration: underline;
}

main section.solo {
  grid-template-columns: 1fr;
}

/* Organizing page: how the four groups connect */

.org-page main,
.org-page footer {
  max-width: 64rem;
}

.org-page #map {
  grid-template-columns: 1fr;
}

.graph {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: stretch;
  margin-top: 0.5rem;
}

.node {
  position: relative;
  padding: 1.1rem 1.1rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--card);
}

.node h3 {
  font-size: 1.15rem;
  margin-top: 0.9rem;
}

.node p {
  margin: 0;
  font-size: 0.9375rem;
}

.node-meta {
  color: var(--muted);
  font-size: 0.8125rem !important;
  margin: 0.15rem 0 0.5rem !important;
}

/* Logos keep their own colours, so they sit on a light tile in both themes. */
.node-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 6rem;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  background: #fff;
}

/* The round PSNG logo has fine lettering, so it gets a taller tile. */
.node-psng .node-logo {
  height: 10rem;
}

.node-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.node-proz { grid-column: 1 / 3; }
.node-alps { grid-column: 5 / 7; }
.node-psng,
.node-bpsa,
.link-local { grid-column: 3 / 5; }

.link {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.link span::before {
  content: "↓ ";
}

.link-led {
  grid-column: 3 / 5;
  gap: 0.6rem;
}

.link-led::before,
.link-led::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--muted);
  opacity: 0.6;
}

.link-led span::before {
  content: none;
}

.link-led span::after {
  content: " →";
}

.link-local {
  padding: 0.9rem 0;
}

.merge {
  grid-column: 1 / -1;
  position: relative;
  height: 4.5rem;
}

.merge svg {
  width: 100%;
  height: 100%;
}

.merge path {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.25;
  opacity: 0.6;
  vector-effect: non-scaling-stroke;
}

.merge span {
  position: absolute;
  top: 35%;
  padding: 0 0.4rem;
  background: var(--paper);
  font-size: 0.8125rem;
  color: var(--muted);
}

.merge-a { left: 12%; }
.merge-b { right: 12%; }

.link-merge {
  display: none;
}

@media (max-width: 760px) {
  .graph {
    grid-template-columns: 1fr;
  }

  .node-proz,
  .node-alps,
  .node-psng,
  .node-bpsa,
  .link-local,
  .link-led {
    grid-column: 1;
  }

  .link {
    padding: 0.9rem 0;
  }

  .link-led::before,
  .link-led::after {
    content: none;
  }

  .link-led span::before {
    content: "↓ ";
  }

  .link-led span::after {
    content: none;
  }

  .merge {
    display: none;
  }

  .link-merge {
    display: flex;
  }

  .door {
    grid-template-columns: 1fr auto;
  }

  .door-text {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .door-title {
    font-size: 1.5rem;
  }
}

.legal-date {
  padding: 1rem 0 2rem;
}

/* Lab */

.lab-page {
  overflow: hidden;
}

.lab-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.lab-ui {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3rem);
  pointer-events: none;
}

.lab-ui a,
.lab-ui button {
  pointer-events: auto;
}

.lab-note {
  max-width: 24rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lab-note h1 {
  font-size: 1.75rem;
  margin-bottom: 0.4rem;
}

.lab-note p {
  font-size: 0.9375rem;
}

.lab-meta {
  margin: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Websites page */

.wide main,
.wide footer {
  max-width: 74rem;
}

.page-head {
  padding: 3.5rem 0 3rem;
  max-width: 36rem;
}

.page-head h1 {
  margin-bottom: 1rem;
}

.sites {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4rem 2.5rem;
  padding-bottom: 5rem;
}

.site:first-child {
  grid-column: 1 / -1;
}

.frame {
  display: block;
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 2px var(--shadow), 0 18px 40px -22px var(--shadow);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

a.frame:hover {
  transform: translateY(-4px);
  box-shadow: 0 1px 2px var(--shadow), 0 28px 50px -24px var(--shadow);
}

.frame .bar {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
}

.site-text {
  padding-top: 1.25rem;
  max-width: 34rem;
}

.site h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 0.35rem;
}

.site h2 a {
  text-decoration: none;
}

.site h2 a:hover {
  text-decoration: underline;
}

.site .stack {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.tag {
  display: inline-block;
  vertical-align: 0.3em;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--rule);
  border-radius: 99px;
  font-family: var(--sans);
  font-size: 0.6875rem;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .frame,
  .theme-toggle svg {
    transition: none;
  }
}

/* Narrow screens */

@media (max-width: 640px) {
  body {
    font-size: 1.0625rem;
  }

  .photo {
    margin-bottom: 1.5rem;
  }

  .page-head {
    padding: 2rem 0 2.5rem;
  }

  .sites {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .site h2 {
    font-size: 1.3rem;
  }

  .lede {
    font-size: 1.25rem;
  }

  main section {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .entry,
  .cv-page .entry {
    grid-template-columns: 1fr;
  }

  h3 {
    font-size: 1.0625rem;
  }
}
