/* Luca Brodo — academic website
   Two typefaces from the system (no web-font requests): a serif for headings
   and titles, a neutral sans-serif for running text and metadata.
   Layout: a label column and a text column, aligned on every page. */

:root {
  --bg: #ffffff;
  --text: #20252b;
  --text-2: #59636e;
  --accent: #254a70;
  --accent-hover: #1a3654;
  --rule: #e5e7eb;
  --award: #9b2226;
  --code-bg: #f7f8f9;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --container: 64rem;
  --label: 12rem;
  --gap: 3rem;
  --measure: 38rem;
}

*, *::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(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: rgba(37, 74, 112, 0.35);
}
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }

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

h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 400; color: var(--text); }
p, ul, ol, dl, address { margin: 0; }

.muted { color: var(--text-2); }
.small { font-size: 0.9rem; }
.sep { margin: 0 0.45em; color: var(--text-2); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  padding: 0.4rem 0.8rem;
  background: var(--accent); color: #fff; font-size: 0.9rem;
}
.skip-link:focus { top: 0.75rem; color: #fff; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 600px) { .container { padding: 0 2rem; } }

/* Lists of inline links separated by middle dots */
.inline-list {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  list-style: none;
}
.inline-list li + li::before {
  content: "·";
  margin: 0 0.55em;
  color: var(--text-2);
}

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

.site-header { border-bottom: 1px solid var(--rule); }
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 1.4rem;
  padding-bottom: 1.25rem;
}
.site-name {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}
.site-name:hover { color: var(--accent); }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.6rem;
  padding: 0;
  list-style: none;
}
.site-nav a {
  font-size: 0.95rem;
  color: var(--text-2);
  text-decoration: none;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

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

.site-footer {
  margin-top: 5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--text-2);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
}
/* Footer links follow the style of shenkler.github.io: inherited colour,
   1px underline that thickens on hover. */
.site-footer a {
  color: inherit;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}
.site-footer a:hover { color: inherit; text-decoration-thickness: 2px; }

/* ---------- Rows: label column + text column ---------- */

.site-main { padding-top: 3rem; }
main:focus { outline: none; }

.row { padding: 2.25rem 0; border-top: 1px solid var(--rule); }
.row:first-child { padding-top: 0; border-top: 0; }

.row__label {
  margin-bottom: 1rem;
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.35;
}
.row__label:empty, .row__label--num { display: none; }

.row__body { max-width: var(--measure); }

@media (min-width: 860px) {
  .row {
    display: grid;
    grid-template-columns: var(--label) minmax(0, var(--measure));
    column-gap: var(--gap);
    align-items: start;
  }
  .row__label {
    display: block;
    margin: 0;
    font-size: 1.05rem;
    padding-top: 0.15rem;
    color: var(--text);
  }
  .row__label:empty { display: block; }
  .row__label--num {
    display: block;
    font-size: 1.05rem;
    color: var(--text-2);
  }
}

.prose p + p { margin-top: 1rem; }
.prose p { max-width: 68ch; }

.more { margin-top: 1.5rem; font-size: 0.95rem; }

/* ---------- Page heads ---------- */

.page-head h1 { font-size: 2rem; line-height: 1.2; letter-spacing: -0.005em; }
.lede { margin-top: 0.75rem; color: var(--text-2); max-width: 68ch; }

/* ---------- Home ---------- */

.portrait img {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 2px;
  background: #f1f2f4;
}
@media (min-width: 860px) {
  .portrait img { width: 176px; height: 176px; }
}

.intro .row__label { margin-bottom: 1.5rem; }
.intro__name { font-size: 2rem; line-height: 1.2; letter-spacing: -0.005em; }
.intro__role {
  margin: 0.5rem 0 1.5rem;
  color: var(--text-2);
  line-height: 1.5;
}
.intro__role a { color: var(--text-2); }
.intro__role a:hover { color: var(--accent); }

.topic + .topic { margin-top: 1.5rem; }
.topic__title {
  font-size: 1.12rem;
  line-height: 1.4;
  margin-bottom: 0.3rem;
}
.topic__title a { color: var(--text); text-decoration: none; }
.topic__title a:hover { color: var(--accent); text-decoration: underline; }

.contact { line-height: 1.6; margin-bottom: 0.75rem; }

/* ---------- Research ---------- */

.area__title { font-size: 1.4rem; line-height: 1.3; margin-bottom: 1rem; }
.subhead {
  margin-top: 2rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* ---------- Publications (bibliography) ---------- */

.pub-list { padding: 0; list-style: none; }
.pub { padding: 1.15rem 0; }
.pub:first-child { padding-top: 0; }
.pub + .pub { border-top: 1px solid var(--rule); }
.subhead + .pub-list { margin-top: 0.75rem; }

.pub__title {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.4;
}
.pub__title a { color: var(--accent); text-decoration: none; }
.pub__title a:hover { text-decoration: underline; }

.pub__authors,
.pub__venue,
.pub__links {
  font-size: 0.93rem;
  line-height: 1.5;
  color: var(--text-2);
}
.pub__authors { margin-top: 0.3rem; }
.me { color: var(--text); font-weight: 600; }
.pub__venue-name { font-style: italic; }

.award { color: var(--award); font-weight: 600; }

.pub__desc { margin-top: 0.5rem; font-size: 0.98rem; line-height: 1.6; }
.pub__links { margin-top: 0.45rem; }

/* ---------- Paper page ---------- */

.breadcrumb { font-family: var(--sans); font-size: 0.93rem; }
.breadcrumb a { color: var(--text-2); }

.paper__title { font-size: 1.9rem; line-height: 1.25; letter-spacing: -0.005em; }
.paper__authors { margin-top: 1rem; }
.paper__venue { margin-top: 0.25rem; color: var(--text-2); }
.paper__venue cite { font-style: italic; }
.paper__award { margin-top: 0.4rem; }

.facts {
  margin-top: 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: 0.93rem;
  display: grid;
  gap: 0.35rem;
}
.facts div { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; }

.paper__links { margin-top: 1.1rem; font-size: 0.98rem; }

.paper__summary h3 {
  font-size: 1.12rem;
  line-height: 1.4;
  margin: 1.75rem 0 0.4rem;
}
.paper__summary h3:first-child { margin-top: 0; }
.paper__summary p + p { margin-top: 1rem; }
.paper__summary ul, .paper__summary ol { margin: 0.75rem 0 1rem; padding-left: 1.3rem; }
.paper__summary li + li { margin-top: 0.35rem; }

.keywords { color: var(--text-2); }

.citation {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--code-bg);
}
.citation__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem 0.4rem 0.9rem;
  border-bottom: 1px solid var(--rule);
}
.citation__label { font-size: 0.85rem; color: var(--text-2); }
.citation__copy {
  font: inherit;
  font-size: 0.85rem;
  min-height: 2rem;
  padding: 0.15rem 0.75rem;
  color: var(--accent);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
}
.citation__copy:hover { border-color: var(--accent); }
.citation__copy[hidden] { display: none; }
.citation__code {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre;
}
.citation__status { padding: 0 1rem; font-size: 0.85rem; color: var(--text-2); }
.citation__status:not(:empty) { padding-bottom: 0.7rem; }

/* ---------- Teaching ---------- */

.material-list { padding: 0; list-style: none; }
.material + .material { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.material__title { font-size: 1.12rem; line-height: 1.4; }
.material__meta { margin-top: 0.2rem; font-size: 0.93rem; color: var(--text-2); }
.material__desc { margin-top: 0.5rem; }
.material .inline-list { margin-top: 0.5rem; }

/* ---------- Tutorials ---------- */

/* Header uses the row grid; the body gets a wider text column and a sticky
   table of contents in the label column on wide screens. */
.tutorial__header .row__body { max-width: 44rem; }
.tutorial__byline { margin-top: 1.25rem; font-size: 0.9rem; color: var(--text-2); }
.tutorial__updated { display: block; margin-top: 0.2rem; }
.tutorial__prerequisites { margin-top: 0.75rem; font-size: 0.93rem; color: var(--text-2); }

.tutorial__layout { border-top: 1px solid var(--rule); padding-top: 2.25rem; }

.toc {
  margin-bottom: 2.5rem;
  padding: 0 0 1.5rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.93rem;
}
.toc__title {
  margin-bottom: 0.5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
}
.toc__list { margin: 0; padding: 0; list-style: none; line-height: 1.45; }
.toc__list li + li { margin-top: 0.4rem; }
.toc__list a { text-decoration: none; }
.toc__list a:hover { text-decoration: underline; }

@media (max-width: 859px) {
  .toc__list { columns: 2; column-gap: 1.5rem; }
  .toc__list li { break-inside: avoid; }
}

@media (min-width: 860px) {
  .tutorial__layout {
    display: grid;
    grid-template-columns: var(--label) minmax(0, 44rem);
    column-gap: var(--gap);
    align-items: start;
  }
  .toc {
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font-size: 0.88rem;
  }
}

/* Long-form documentation text */
.doc > section + section { margin-top: 2.75rem; padding-top: 2rem; border-top: 1px solid var(--rule); }
.doc section[id] { scroll-margin-top: 1.5rem; }
.doc h2 { font-size: 1.55rem; line-height: 1.3; margin-bottom: 1rem; scroll-margin-top: 1rem; }
.doc h3 { font-size: 1.15rem; line-height: 1.4; margin: 2rem 0 0.5rem; scroll-margin-top: 1rem; }
.doc h2 + h3 { margin-top: 0.5rem; }
.doc p, .doc ul, .doc ol, .doc dl { max-width: 68ch; }
.doc p + p, .doc p + ul, .doc p + ol, .doc ul + p, .doc ol + p,
.doc p + .formula, .doc .formula + p, .doc p + dl { margin-top: 1rem; }
.doc ul, .doc ol { padding-left: 1.3rem; }
.doc ul, .doc ol { margin-top: 0.75rem; margin-bottom: 0.75rem; }
.doc li + li { margin-top: 0.4rem; }
.doc > section > * + .citation,
.doc > section > * + .table-wrap,
.doc > section > * + figure,
.doc > section > * + .callout,
.doc > section > * + .paper-card,
.doc .citation + *,
.doc .table-wrap + p,
.doc .figure + p,
.doc .paper-card + p { margin-top: 1.25rem; }
.doc code {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 0.05em 0.3em;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow-wrap: anywhere;
}
.doc pre code { padding: 0; background: none; border: 0; font-size: inherit; overflow-wrap: normal; }
.doc .citation__code { font-size: 0.8rem; }
.code-block--output .citation__code { background: var(--bg); }

/* Mathematical notation: system serif, no JavaScript renderer. */
.math { font-family: var(--serif); font-size: 1.05em; white-space: nowrap; }
.formula {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: var(--code-bg);
  font-family: var(--serif);
  font-size: 1.08rem;
  overflow-x: auto;
}
.formula__note { display: block; margin-top: 0.3rem; font-family: var(--sans); font-size: 0.9rem; color: var(--text-2); }

.definition {
  margin-top: 1.25rem;
  padding: 0.25rem 0 0.25rem 1.1rem;
  border-left: 2px solid var(--rule);
}
.definition__title { font-weight: 600; }
.definition ol { margin-bottom: 0; }

.callout {
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  font-size: 0.93rem;
  color: var(--text-2);
}

.table-wrap { overflow-x: auto; }
.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.5;
}
.doc caption {
  caption-side: top;
  text-align: left;
  padding-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-2);
}
.doc th, .doc td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}
.doc thead th { border-bottom: 2px solid var(--rule); font-weight: 600; }
.doc tbody th { font-weight: 600; }
.doc td code, .doc th code { white-space: nowrap; overflow-wrap: normal; }
.figure { margin: 0; overflow-x: auto; }
.figure svg { display: block; width: 100%; height: auto; min-width: 36rem; max-width: 40rem; }
.figure figcaption { margin-top: 0.6rem; font-size: 0.9rem; color: var(--text-2); max-width: 68ch; }
.diagram text { font-family: var(--mono); font-size: 12px; fill: var(--text); }
.diagram .label { font-family: var(--sans); font-size: 12px; fill: var(--text-2); }
.diagram .node rect { fill: var(--bg); stroke: var(--text-2); stroke-width: 1; }
.diagram .node--keep rect { fill: #edf2f7; stroke: var(--accent); stroke-width: 1.5; }
.diagram .edge { stroke: var(--accent); stroke-width: 1.5; fill: none; }
.diagram .edge--joint { stroke-dasharray: 5 4; }
.diagram .arrow { fill: var(--accent); }

.paper-card {
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--rule);
}
.paper-card__title { font-family: var(--serif); font-size: 1.12rem; line-height: 1.4; }
.paper-card__title a { text-decoration: none; }
.paper-card__title a:hover { text-decoration: underline; }
.paper-card__meta { margin-top: 0.3rem; font-size: 0.93rem; color: var(--text-2); }
.paper-card__actions { margin-top: 0.8rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; font-size: 0.95rem; }

.faq h3 { margin-top: 1.75rem; }

.references { padding-left: 1.6rem; font-size: 0.93rem; line-height: 1.55; }
.references li + li { margin-top: 0.55rem; }
.references li:target { background: #fff8db; }

/* ---------- Legal ---------- */

address { font-style: normal; }
.legal-contact { margin-top: 1rem; }

/* ---------- Print ---------- */

@media print {
  .site-header, .site-footer, .skip-link, .citation__copy, .toc { display: none; }
  body { font-size: 10.5pt; }
  a { color: inherit; text-decoration: none; }
  .row { border: 0; padding: 0.75rem 0; }
}
