/* Luca Miglior: a modern page with a LaTeX accent. No build step, no JS (except the cat). */

@font-face { font-family: "CMU Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/cmu-serif-500-roman.woff2") format("woff2"); }
@font-face { font-family: "CMU Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/cmu-serif-500-italic.woff2") format("woff2"); }
@font-face { font-family: "CMU Serif"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/cmu-serif-700-roman.woff2") format("woff2"); }
@font-face { font-family: "CMU Serif"; font-style: italic; font-weight: 700; font-display: swap; src: url("fonts/cmu-serif-700-italic.woff2") format("woff2"); }
@font-face { font-family: "CMU Typewriter Text"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/cmu-typewriter-text-500-roman.woff2") format("woff2"); }

:root {
  --bg: #fbfaf6;
  --ink: #1b1b1b;
  --muted: #6b6a66;
  --rule: #d9d6cc;
  --hl: #f3efe2;
  /* hyperref, colorlinks=true */
  --link: #a3241c;   /* linkcolor  = red!65!black   */
  --url: #1f4f8f;    /* urlcolor   = blue!60!black  */
  --cite: #2e6b30;   /* citecolor  = green!45!black */

  --serif: "CMU Serif", "Latin Modern Roman", "Computer Modern", Georgia, serif;
  --mono: "CMU Typewriter Text", "Latin Modern Mono", ui-monospace, monospace;

  --measure: 40rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --ink: #e6e3da;
    --muted: #9a978e;
    --rule: #34332f;
    --hl: #24231f;
    --link: #f08a7e;
    --url: #8db6f2;
    --cite: #8fcf8a;
    color-scheme: dark;
  }
}

@view-transition { navigation: auto; }

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 112.5%;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 900px) { html { font-size: 118.75%; } }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  padding: 0 1.25rem;
  counter-reset: section;
}

::selection { background: color-mix(in srgb, var(--link) 22%, transparent); }

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
}

/* ---------- header: a running head ---------- */

.site-head { padding-top: 2rem; }
.site-head .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .25rem 1.5rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--rule);
}
.site-head .name {
  color: inherit;
  text-decoration: none;
  font-variant-caps: small-caps;
  letter-spacing: .04em;
  font-size: 1.05rem;
}
.site-head nav { display: flex; gap: 1.25rem; font-style: italic; }
.site-head nav a { color: var(--muted); text-decoration: none; }
.site-head nav a:hover, .site-head nav a[aria-current="page"] { color: var(--ink); }

main { flex: 1; padding: 3.5rem 0 4.5rem; }

/* ---------- \maketitle ---------- */

.maketitle { text-align: center; margin-bottom: 2.75rem; }
.maketitle h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 2.7rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.maketitle p { margin: .55rem 0 0; text-align: center; text-indent: 0; }
.maketitle .sub { font-size: 1.1rem; margin-top: 1rem; }
.maketitle .affil { color: var(--muted); }
.maketitle .date { color: var(--muted); font-size: .92rem; margin-top: 1rem; }

/* ---------- abstract ---------- */

.abstract { max-width: 33rem; margin: 0 auto 1rem; font-size: .93rem; }
.abstract .label {
  display: block;
  text-align: center;
  font-weight: 700;
  font-size: .9rem;
  margin-bottom: .35rem;
}

/* ---------- body text ---------- */

p { margin: 0; text-align: justify; hyphens: auto; text-wrap: pretty; }
p + p { text-indent: 1.5em; }

em, i { font-style: italic; }
b, strong { font-weight: 700; }
.sc { font-variant-caps: small-caps; letter-spacing: .03em; }
.tt, code { font-family: var(--mono); font-size: .94em; }
.muted { color: var(--muted); }
sup { font-size: .68em; line-height: 0; vertical-align: .6em; }

/* \section, numbered */
h2 {
  counter-increment: section;
  margin: 2.75rem 0 .9rem;
  font-size: 1.4rem;
  line-height: 1.25;
  font-weight: 700;
  scroll-margin-top: 1.5rem;
}
h2::before {
  content: counter(section);
  display: inline-block;
  min-width: 1.75em;
  color: var(--muted);
  font-weight: 400;
}
h2 + p, h2 + figure + p { text-indent: 0; }

/* hyperref colorlinks */
a { color: var(--link); text-decoration: none; }
a[href^="http"], a[href^="mailto:"] { color: var(--url); }
a.cite { color: var(--cite); white-space: nowrap; hyphens: manual; }
main a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 2px; }

/* figure */
figure.portrait {
  float: right;
  width: 9.5rem;
  margin: .3rem 0 .75rem 1.5rem;
  scroll-margin-top: 1.5rem;
}
figure.portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
}
figcaption {
  margin-top: .45rem;
  font-size: .8rem;
  line-height: 1.35;
  text-align: center;
  color: var(--muted);
}
figcaption b { color: var(--ink); font-weight: 400; }

/* key / value list */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.5rem; margin: .9rem 0 0; }
.kv dt { font-variant-caps: small-caps; letter-spacing: .03em; color: var(--muted); }
.kv dd { margin: 0; }

ul.plain { margin: .5rem 0; padding-left: 1.2em; }
ul.plain li { margin: .3rem 0; }
ul.plain li::marker { content: "–  "; color: var(--muted); }

/* ---------- CV entries ---------- */

.entries { display: grid; grid-template-columns: 7.5rem 1fr; gap: .9rem 1.5rem; margin: .75rem 0; }
.entries .when { color: var(--muted); font-size: .9rem; padding-top: .12rem; font-variant-numeric: tabular-nums; }
.entries .what p { text-indent: 0; }
.entries .detail { color: var(--muted); font-size: .92rem; margin-top: .15rem; }

/* ---------- thebibliography ---------- */

.bib { list-style: none; margin: .75rem 0; padding: 0; }
.bib > li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0 1rem;
  margin: 0 -.75rem .5rem;
  padding: .6rem .75rem;
  border-radius: 6px;
  scroll-margin-top: 1.5rem;
  transition: background-color .4s;
}
.bib .label { color: var(--muted); }
.bib .me { font-weight: 700; }
.bib .title { font-style: italic; }
.bib .links { display: flex; flex-wrap: wrap; gap: .1rem .9rem; margin-top: .3rem; font-family: var(--mono); font-size: .8rem; }
.bib .note { display: block; margin-top: .4rem; font-size: .88rem; line-height: 1.5; color: var(--muted); }
.bib > li:target { background: var(--hl); }
.bib.compact > li { padding-block: .3rem; margin-bottom: .2rem; }

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

.site-foot { padding-bottom: 2.25rem; font-size: .85rem; color: var(--muted); }
.site-foot .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  padding-top: .7rem;
  border-top: 1px solid var(--rule);
}
.site-foot a { color: inherit; }
.site-foot .host { flex-basis: 100%; }
.site-foot a:hover { color: var(--ink); }

/* shown by esp32/fallback-worker when the ESP32 is offline */
.notice {
  margin: 0 0 2.5rem;
  padding: .8rem 1rem;
  background: var(--hl);
  border-radius: 6px;
  font-size: .9rem;
}

/* the \TeX logo */
.TeX .e { position: relative; top: .22em; margin: 0 -.1667em 0 -.125em; }

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

.texerr {
  margin: 1.5rem 0 2rem;
  padding: 1.1rem 1.25rem;
  background: var(--hl);
  border-radius: 6px;
  font: .9rem/1.5 var(--mono);
  white-space: pre-wrap;
  overflow-x: auto;
}

/* ---------- small screens ---------- */

@media (max-width: 600px) {
  .site-head { padding-top: 1.25rem; }
  main { padding-top: 2.25rem; }
  figure.portrait { float: none; width: 9rem; margin: 0 auto 1.25rem; }
  .entries { grid-template-columns: 1fr; gap: 0; }
  .entries .when { padding-top: .9rem; }
  .entries .when:first-child { padding-top: 0; }
  .bib > li { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: .6rem; }
}

/* the cat chases the mouse; with no mouse it would just sit in the corner */
@media (hover: none) {
  #oneko { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

@media print {
  html { background: #fff; color: #000; font-size: 11pt; }
  .site-head nav, .site-foot { display: none; }
  a { color: inherit !important; }
}
