/* Jan Corazza's homepage.
   Colours follow the lambda avatar (~/personal/profile/lambda): cream and indigo in light mode,
   near-black navy with cyan, violet and pink in dark mode. Each colour is defined once with
   light-dark(); the color-scheme follows the system unless the toggle sets data-theme. */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-serif-4-latin-opsz-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: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-serif-4-latin-ext-opsz-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-serif-4-latin-opsz-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;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-serif-4-latin-ext-opsz-italic.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-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: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;

  --bg: light-dark(#fbf9f4, #0d0e15);
  --surface: light-dark(#f2eee6, #161827);
  --text: light-dark(#1d1b24, #e7e5ef);
  --muted: light-dark(#5e5a68, #a19db3);
  --line: light-dark(#e3ded3, #262840);
  --accent: light-dark(#3a35b5, #a9b4ff);
  --accent-hover: light-dark(#a3189f, #ff8ad3);
  --gradient: linear-gradient(90deg, light-dark(#2b2d8f, #7df9ff), light-dark(#6d28d9, #a78bfa), light-dark(#c026d3, #ff6ec7));

  --serif: "Source Serif 4", "Source Serif Pro", Charter, "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --width: 46rem;
  --label: 7.5rem;
}
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  border-top: 3px solid transparent;
  border-image: var(--gradient) 1;
}
a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 0.18em;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
h1,
h2,
h3 {
  line-height: 1.2;
  font-weight: 650;
  text-wrap: balance;
}
p {
  text-wrap: pretty;
}
img {
  max-width: 100%;
  height: auto;
}
.icon {
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.125em;
}
.wrap {
  max-width: var(--width);
  margin-inline: auto;
  padding-inline: 1.25rem;
}
.skip {
  position: absolute;
  left: -100vw;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
}

/* ------------------------------------------------------------------ header and footer */

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.brand img {
  border-radius: 7px;
}
.brand:hover {
  color: var(--text);
}
.nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--text);
}
.theme-toggle {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover {
  color: var(--text);
}
.when-dark {
  display: none;
}
:root[data-theme="dark"] .when-dark {
  display: contents;
}
:root[data-theme="dark"] .when-light {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .when-dark {
    display: contents;
  }
  :root:not([data-theme="light"]) .when-light {
    display: none;
  }
}
.site-footer {
  margin-top: 4.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-block: 1.4rem;
}
.footer-row a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1rem;
}
.footer-row a:hover {
  color: var(--text);
}

/* ------------------------------------------------------------------ home */

.hero {
  display: grid;
  grid-template-columns: 1fr 12rem;
  gap: 2.25rem;
  align-items: start;
  margin-top: 2.5rem;
}
.hero h1 {
  margin: 0 0 0.35rem;
  font-size: 2.4rem;
  letter-spacing: -0.01em;
}
.hero .role {
  margin: 0 0 1.2rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
}
.hero .role a {
  color: inherit;
}
.portrait {
  width: 12rem;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
  margin-top: 0.4rem;
  box-shadow: 0 0 0 1px var(--line), 0 12px 32px -14px light-dark(#3a35b555, #000);
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}
.links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
section {
  margin-top: 3.2rem;
}
section > h2 {
  margin: 0 0 1.2rem;
  font-size: 1.35rem;
}
.dated {
  margin: 0;
  padding: 0;
  list-style: none;
}
.dated li {
  display: grid;
  grid-template-columns: var(--label) minmax(0, 1fr);
  gap: 1rem;
  padding-block: 0.3rem;
  font-size: 1rem;
}
.dated a {
  color: var(--text);
  text-decoration: none;
}
.dated a:hover {
  color: var(--accent);
}
.date,
.pub-venue,
.tag,
.lang {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 2.2;
  color: var(--muted);
}
.more {
  margin: 0.9rem 0 0;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.more a {
  text-decoration: none;
}
.note {
  margin: 1rem 0 0 calc(var(--label) + 1rem);
  font-size: 0.9rem;
  color: var(--muted);
}

/* publications */

.pub {
  display: grid;
  grid-template-columns: var(--label) minmax(0, 1fr);
  gap: 1rem;
  padding-block: 0.9rem;
  border-top: 1px solid var(--line);
}
.pub:first-of-type,
.pub-group + .pub {
  border-top: 0;
  padding-top: 0;
}
.pub-group {
  margin: 2.2rem 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
}
.pub-venue {
  color: var(--accent);
  line-height: 1.9;
}
.pub-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 620;
  line-height: 1.35;
}
.pub-title a {
  color: var(--text);
  text-decoration: none;
}
.pub-title a:hover {
  color: var(--accent);
}
.pub-authors {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}
.pub-authors strong {
  color: var(--text);
  font-weight: 620;
}
.pub-summary {
  margin: 0.3rem 0 0;
  font-size: 0.98rem;
}
.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
  margin: 0.4rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.pub-links a,
.bib-toggle,
.bib-copy {
  color: var(--accent);
  text-decoration: none;
}
.pub-links a::before,
.bib-toggle::before {
  content: "[";
  color: var(--muted);
}
.pub-links a::after,
.bib-toggle::after {
  content: "]";
  color: var(--muted);
}
.bib-toggle,
.bib-copy {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}
.bib-toggle:hover,
.bib-copy:hover,
.pub-links a:hover {
  color: var(--accent-hover);
}
.bib {
  position: relative;
  margin-top: 0.6rem;
}
.bib-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  font-family: var(--mono);
  font-size: 0.72rem;
}

/* projects */

.projects {
  margin: 0;
  padding: 0;
  list-style: none;
}
.projects li {
  padding-block: 0.45rem;
}
.project-name {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}
.projects .lang {
  margin-left: 0.6rem;
}
.projects p {
  margin: 0.1rem 0 0;
  font-size: 0.98rem;
}

/* ------------------------------------------------------------------ posts */

.page-title {
  margin: 2.5rem 0 0.5rem;
  font-size: 2.2rem;
}
.year h2 {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.year {
  margin-top: 2rem;
}
.post-header {
  margin-top: 2.5rem;
}
.post-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.3rem);
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
  margin: 0.8rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.tag::before {
  content: "#";
}
.prose {
  margin-top: 2rem;
}
.prose h2 {
  margin: 2.4rem 0 0.8rem;
  font-size: 1.45rem;
}
.prose h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.2rem;
}
.prose img {
  display: block;
  margin: 1.6rem auto;
  border-radius: 8px;
}
.prose blockquote {
  margin: 1.4rem 0;
  padding: 0.1rem 1.2rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.prose table {
  border-collapse: collapse;
  font-size: 0.95rem;
}
.prose th,
.prose td {
  padding: 0.35rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4rem 0;
}
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 3.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.post-nav a {
  text-decoration: none;
}
.post-nav .next {
  text-align: right;
}

/* code */

code,
pre {
  font-family: var(--mono);
  font-size: 0.84em;
  font-variant-ligatures: none;
}
:not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--surface);
}
pre {
  overflow-x: auto;
  margin: 1.4rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.55;
  tab-size: 4;
}
.bib pre {
  margin: 0;
  font-size: 0.74rem;
}
.prose div.highlighter-rouge {
  margin: 1.4rem 0;
}
.prose div.highlighter-rouge pre {
  margin: 0;
}

/* Rouge token colours */
.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cs,
.highlight .cp {
  color: light-dark(#7a7685, #7f7b93);
  font-style: italic;
}
.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kc,
.highlight .ow {
  color: light-dark(#a3189f, #ff8ad3);
}
.highlight .kt,
.highlight .nc,
.highlight .nn {
  color: light-dark(#3a35b5, #a9b4ff);
}
.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .sc,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sx,
.highlight .sr {
  color: light-dark(#2f6f4f, #8fd6a8);
}
.highlight .m,
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .mo,
.highlight .il {
  color: light-dark(#a1401c, #f2a37f);
}
.highlight .nf,
.highlight .fm,
.highlight .na,
.highlight .nd {
  color: light-dark(#0b6477, #7df9ff);
}
.highlight .nb,
.highlight .bp,
.highlight .no {
  color: light-dark(#6d28d9, #c4a7ff);
}
.highlight .err {
  color: inherit;
}

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

@media (max-width: 640px) {
  body {
    font-size: 1.0625rem;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-top: 1.5rem;
  }
  .portrait {
    order: -1;
    width: 8.5rem;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .nav {
    gap: 0.8rem;
  }
  .brand span {
    display: none;
  }
  .pub,
  .dated li {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .note {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
