/* eliasmueller.dev, design G1
   One two-column grid (168 px | 48 px gap | text), blue-black ground,
   teal for links only. Two quiet nods to the work: the diffusion steps under the
   portrait and the closing figure, which is the only thing that moves. */

/* Source Serif 4 for the name and titles, Source Sans 3 for everything read:
   the same superfamily as the PDF CV. */
@font-face {
  font-family: "Source Serif 4";
  src: url("assets/fonts/source-serif-4-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("assets/fonts/source-sans-3-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* The blue-black and teal of the first version of the site. */
  --paper: #12181C;
  --ink: #E2E8EA;      /* 14.5 : 1  name, titles, header rule, figure */
  --ink-2: #BCC6CB;    /* 10.4 : 1  body, entry details, idle nav */
  --muted: #8F9CA4;    /*  6.6 : 1  dates, organisation lines, labels, footer */
  --accent: #8BC4CB;   /*  9.4 : 1  links only */
  --underline: color-mix(in srgb, var(--accent) 45%, transparent);  /* link underlines at rest */
  --rule: #34414A;     /* section and footer rules (decorative) */
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  color-scheme: dark;
}

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

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 26px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

p, ul, dl, dd, figure { margin: 0; }
img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}
a:hover { text-decoration-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* ---------- Grid ---------- */

.frame { max-width: 960px; margin: 0 auto; padding: 0 32px; }   /* 896 px of grid + 32 px padding each side */
.row { display: grid; grid-template-columns: 168px minmax(0, 1fr); column-gap: 48px; }
.gut { min-width: 0; }
.print { display: none; }      /* shown on paper only */
.nw { white-space: nowrap; }   /* keep VQ-GAN, p-alm and the like on one line */

/* ---------- Header ---------- */

.top {
  align-items: center;
  padding: 22px 0;
  border-bottom: 1px solid var(--ink);
  font-size: 15px;
  font-weight: 500;
}
.top .site { color: var(--ink); text-decoration: none; }
.top-r { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; }
.top nav { display: flex; flex-wrap: wrap; gap: 6px 26px; }
.top nav a { color: var(--ink-2); text-decoration: none; }
.top nav a:hover { color: var(--ink); }
.loc { color: var(--muted); }

/* ---------- Hero ---------- */

.hero { padding: 88px 0 72px; }
/* The photo (cropped to the figure by tools/portrait.py) and the tiles are
   640 x 888. Their height is never set here: the width/height attributes
   reserve the space and the file's own proportions decide, so an image can
   never be shown stretched, whatever file a browser has cached. */
.pf { width: 168px; height: auto; }
.steps { margin-top: 12px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.steps img { width: 100%; height: auto; }
.tlab {
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 40px;
  line-height: 44px;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.lede { margin-top: 20px; font-size: 21px; line-height: 29px; color: var(--ink); text-wrap: pretty; }
.now { margin-top: 14px; text-wrap: pretty; }
.links { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 6px 24px; font-weight: 500; }

/* ---------- Sections and entries ---------- */

.sec {
  align-items: baseline;          /* title on the baseline of the first entry title */
  border-top: 1px solid var(--rule);
  padding-top: 24px;
  margin-bottom: 60px;
  scroll-margin-top: 24px;
}
h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 26px;
  font-weight: 400;
  color: var(--ink);
  text-align: right;
}

.ent + .ent { margin-top: 28px; }
.eh { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 20px; }
h3 { margin: 0; font-size: 17px; line-height: 26px; font-weight: 600; color: var(--ink); }
.when {
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.org { font-size: 15px; line-height: 22px; color: var(--muted); }
.det { margin-top: 8px; text-wrap: pretty; }
/* Projects inside an entry (TomoRay, TopAneu, the course papers): set in from
   the entry behind a hairline, so they read as part of it, never as a new entry.
   The name is a run-in label one step below the entry title (500, not 600). */
.proj {
  margin-top: 10px; padding: 0 0 0 14px; list-style: none;
  border-left: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 8px;
}
.proj li { text-wrap: pretty; }
.pn { color: var(--ink); font-weight: 500; margin-right: 0.35em; }
/* A closing remark under a section's entries, set like the organisation lines. */
.note { margin-top: 28px; font-size: 15px; line-height: 22px; color: var(--muted); }

.skills { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px 20px; }
.skills dt { color: var(--ink); font-weight: 500; }
.members { grid-template-columns: max-content minmax(0, 1fr); column-gap: 32px; }   /* names are the labels */

/* ---------- Off the clock ---------- */

.outro { border-top: 1px solid var(--rule); padding-top: 40px; }
.cap { margin-top: 22px; align-items: baseline; }

/* The closing figure: a small network settling into five mountain ranges
   (generated by tools/figure.mjs). Hover runs one forward pass. */
.net { overflow: visible; }
.net .n { fill: var(--paper); }
.net .sig { stroke-dasharray: 22 2400; stroke-dashoffset: 22; opacity: 0; }
@keyframes nr-fire { 0% { fill: var(--paper); } 30% { fill: var(--ink); } 100% { fill: var(--paper); } }
@keyframes nr-run { 0% { opacity: 1; stroke-dashoffset: 22; } 92% { opacity: 1; } 100% { opacity: 0; stroke-dashoffset: -930; } }
.net:hover .n { animation: nr-fire .8s ease-out both; }
.net:hover .sig { animation: nr-run 1.9s cubic-bezier(.45, .1, .4, 1) both; }
.net:hover .c1 { animation-delay: 90ms; }
.net:hover .c2 { animation-delay: 180ms; }
.net:hover .c3 { animation-delay: 270ms; }
.net:hover .c4 { animation-delay: 360ms; }
.net:hover .c5 { animation-delay: 450ms; }
.net:hover .c6 { animation-delay: 540ms; }
.net:hover .s0 { animation-delay: 560ms; }
.net:hover .s1 { animation-delay: 630ms; }
.net:hover .s2 { animation-delay: 700ms; }
.net:hover .s3 { animation-delay: 770ms; }
.net:hover .s4 { animation-delay: 840ms; }
@media (prefers-reduced-motion: reduce) {
  .net:hover .n, .net:hover .sig { animation: none; }
}

/* ---------- Footer ---------- */

.foot {
  margin-top: 72px;
  padding: 20px 0 40px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  line-height: 20px;
  color: var(--muted);
}

/* ---------- One breakpoint ---------- */

@media (max-width: 720px) {
  body { font-size: 16px; line-height: 25px; }
  .row { grid-template-columns: minmax(0, 1fr); }
  .top { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 18px 0; }
  .top-r { flex-basis: 100%; }
  .loc { display: none; }

  /* Portrait large, with the strip standing beside it as a column that runs
     t = 1000 at the top to 0 at the bottom, exactly as tall as the photo.
     --pw is the portrait width: the strip column is (--pw - 11.5px) / 5 wide
     (five tiles of the photo's 640 / 888 ratio and four 4 px gaps fill its
     height), and the unit is about 1.2 x --pw + 57 px wide with gaps and
     labels, so it is capped to fit the 64 px of frame padding (the img
     sizes attribute in index.html repeats this formula). Name goes below. */
  .hero { padding: 32px 0 48px; }
  .hero .gut { --pw: min(232px, calc((100vw - 124px) / 1.2)); display: flex; align-items: flex-start; gap: 12px; }
  .pf { width: var(--pw); flex: none; }
  .stepbox { display: flex; gap: 8px; }
  .steps {
    margin-top: 0;
    width: calc((var(--pw) - 11.5px) / 5);
    display: flex; flex-direction: column; justify-content: space-between;
  }
  .tlab { margin-top: 0; flex-direction: column; justify-content: space-between; white-space: nowrap; }
  h1 { margin-top: 26px; font-size: 34px; line-height: 38px; }
  .lede { margin-top: 24px; font-size: 19px; line-height: 27px; }
  .now { margin-top: 12px; }
  .links { margin-top: 20px; gap: 6px 22px; font-size: 16px; }

  .sec { padding-top: 20px; margin-bottom: 44px; }
  h2 { text-align: left; margin-bottom: 12px; }

  /* Dates always on their own line under the title, so every entry looks the same. */
  .eh { display: block; }
  h3 { font-size: 16px; line-height: 24px; }
  .when { display: block; font-size: 14px; line-height: 20px; }
  .org { font-size: 14px; line-height: 20px; }
  .det, .proj { margin-top: 6px; }
  .ent + .ent { margin-top: 24px; }

  .skills, .members { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .skills dd { margin-bottom: 10px; }

  /* The whole figure stays (network and ranges are the point); it bleeds
     16 px past the text on both sides to gain a little size. */
  .outro { padding-top: 32px; }
  .net { width: calc(100% + 32px); margin-left: -16px; }
  .cap { margin-top: 18px; }
  .foot { margin-top: 56px; }
}

/* ---------- Print: light, plain ---------- */

@media print {
  :root {
    --paper: #fff; --ink: #1D2730; --ink-2: #33404A; --muted: #56616B; --accent: #0E5A66; --underline: #9FB3B7; --rule: #C9D3D6;
    color-scheme: light;
  }
  html, body { background: #fff; }
  body { font-size: 10pt; line-height: 1.45; }
  .frame { max-width: none; padding: 0; }
  .row { grid-template-columns: 110px minmax(0, 1fr); column-gap: 24px; }
  .top nav, .loc, .stepbox, .outro svg { display: none; }
  .top { padding: 0 0 8px; }
  .hero { padding: 20px 0 24px; }
  .pf { width: 110px; }
  h1 { font-size: 26pt; line-height: 1.1; }
  .lede { font-size: 12.5pt; line-height: 1.4; }
  h2 { font-size: 13pt; line-height: 1.3; }
  h3 { font-size: 10.5pt; line-height: 1.45; }
  .org { font-size: 9pt; line-height: 1.45; }
  .when { font-size: 8.5pt; }
  .print { display: inline; font-weight: 400; }
  .links a[href$=".pdf"] { display: none; }
  .sec { margin-bottom: 18px; padding-top: 12px; }
  .ent + .ent { margin-top: 12px; }
  .outro { padding-top: 12px; }
  .foot { margin-top: 24px; padding: 8px 0 0; }
  h2, h3, .eh { break-after: avoid; }
  .ent, .skills > * { break-inside: avoid; }
  .links a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: var(--muted); }
}
