/* Gianguido Dall'Agata — site stylesheet (classic look: grey shading, dark menu bar, Trebuchet) */

:root {
  --text: #4a4a4a;
  --ink: #1e1e1e;
  --muted: #777;
  --rule: #dcdcdc;
  --link: #3a3f73;
  --link-hover: #e08600;
  --frame-bg: #e7f1ff;
  --frame: #006ac3;
  --font: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 10px 0 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  background: #fefefe linear-gradient(#aeadad 0, #cdcdcd 180px, #f3f3f3 360px, #fefefe 540px) no-repeat;
  min-height: 100vh;
}

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

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px dotted var(--link);
}
a:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--frame); outline-offset: 2px; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; margin: 0; font-weight: bold; }
h3 { color: #444; }
p { margin: 0 0 .9em; }

.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- Page container ---------- */

.container {
  max-width: 902px;
  margin: 0 auto;
  background: #fff;
  border-left: 1px solid #cbcbcb;
  border-right: 1px solid #cbcbcb;
  box-shadow: 0 0 12px rgba(0, 0, 0, .06);
}

.masthead { display: block; border: 0; background: #0143f9; }
.masthead img { width: 100%; }

/* ---------- Menu bar ---------- */

.nav {
  position: relative;
  z-index: 50;
  background: #3a3b3c linear-gradient(#000 0, #000 1px, #7d7e7f 1px, #5b5c5e 4px, #404143 8px, #222327 14px, #26272b 20px, #2b2c30 25px, #3a3b3c 28px) repeat-x;
  background-size: 100% 28px;
}
.menu, .sub { list-style: none; margin: 0; padding: 0; }
.menu { display: flex; flex-wrap: wrap; padding: 0 4px; }
.menu > li { position: relative; }
.menu a {
  display: block;
  border: 0;
  color: #fff;
  font-size: 14px;
  line-height: 18px;
  padding: 5px 10px;
  white-space: nowrap;
}
.menu a:hover, .menu li:hover > a, .menu li:focus-within > a { background: #000; color: #f90; }
.menu > li > a.is-section { background: #000; }

.has-sub > a::after { content: ""; display: inline-block; margin-left: 7px; vertical-align: 2px;
  border: 4px solid transparent; border-top-color: currentColor; border-bottom-width: 0; }
.has-sub--side > a::after { position: absolute; right: 10px; top: 11px; margin: 0;
  border: 4px solid transparent; border-left-color: currentColor; border-right-width: 0; }

.sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 215px;
  background: #414141;
  box-shadow: 3px 4px 8px rgba(0, 0, 0, .35);
}
.sub li { position: relative; }
.sub a { font-size: 13px; padding: 7px 28px 7px 11px; border-bottom: 1px solid #5f5f5f; }
.sub a[aria-current="page"] { color: #f90; }
.sub--side { top: 0; left: 100%; }

.has-sub:hover > .sub,
.has-sub:focus-within > .sub,
.has-sub.open > .sub { display: block; }

/* ---------- Content ---------- */

main { padding: 26px 30px 36px; }

.page-head { margin-bottom: 22px; padding-bottom: 12px; border-bottom: 1px solid #999; }
.page-head h1 { font-size: 24px; margin-bottom: 4px; }
.page-head .lede { margin: 0; color: var(--muted); }

.meta { font-size: 13px; color: var(--muted); }

section + section { margin-top: 28px; }
section > h2 { font-size: 19px; margin-bottom: 10px; }
h3 { font-size: 16px; margin-bottom: 4px; }

ul.plain { list-style: none; padding: 0; margin: 0; }
.prose ul:not(.plain) { padding-left: 1.3rem; margin: 0 0 1em; }
.prose li { margin-bottom: .3em; }

.frame { background: var(--frame-bg); padding: 4px; border: 1px solid var(--frame); }

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

.home {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  grid-template-areas: "aside intro" "aside main";
  column-gap: 34px;
  align-items: start;
}
.home__aside { grid-area: aside; }
.home__intro { grid-area: intro; }
.home__main { grid-area: main; }
.portrait { width: 100%; aspect-ratio: 365 / 351; object-fit: cover; }
.home__aside .frame { margin-bottom: 16px; }

.contact { font-style: normal; font-size: 13.5px; line-height: 1.5; }
.contact p { margin: 0 0 10px; }
.contact dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.contact dt { color: var(--muted); }
.contact dd { margin: 0; overflow-wrap: break-word; }
.reveal {
  font: inherit; color: var(--link); background: none; border: 0; padding: 0; cursor: pointer;
  border-bottom: 1px dotted var(--link); text-align: left;
}
.reveal:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }

.home__intro h1 { font-size: 28px; margin-bottom: 8px; }
.affil { margin: 0 0 22px; padding-bottom: 16px; border-bottom: 1px solid #999; }
.affil span { display: block; font-weight: bold; color: #555; font-size: 15.5px; line-height: 1.6; }

.home section > h2 { padding-bottom: 4px; border-bottom: 1px solid var(--rule); }
.course-list li { padding: 6px 0; }
.course-list a { font-weight: bold; }
.course-list .meta { display: block; }

.book { display: grid; grid-template-columns: 90px 1fr; gap: 16px; align-items: start; }
.book > a { border: 0; }

.links { display: flex; flex-wrap: wrap; gap: 4px 20px; }

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

.areas { display: grid; gap: 16px; }

/* ---------- Collapsible panels (courses, student projects) ---------- */

details.panel { margin: 0 0 6px; }
details.panel > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 6px;
  background: #8c8c8c linear-gradient(#a3a3a3, #7e7e7e);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before {
  content: "";
  flex: none;
  border: 5px solid transparent;
  border-left: 7px solid #fff;
  border-right-width: 0;
  transition: transform .15s ease;
}
details.panel[open] > summary::before { transform: rotate(90deg); }
details.panel > summary:hover { background: #6f6f6f linear-gradient(#8a8a8a, #646464); }
details.panel .count { font-weight: normal; opacity: .9; }
.panel__body {
  margin-top: 4px;
  padding: 14px 16px 6px;
  background: #f8f9f9;
  border-radius: 8px;
}

dl.info { margin: 0; }
dl.info dt { font-weight: bold; color: var(--ink); }
dl.info dd { margin: 0 0 10px; }
dl.info ul { margin: 2px 0 0; padding-left: 1.3rem; }

.course-head .facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 22px; color: #555; }

.table-wrap { overflow-x: auto; margin: 4px 0 14px; }
table.schedule { border-collapse: collapse; min-width: 22rem; width: 100%; text-align: center; }
table.schedule th, table.schedule td { border: 1px solid #666; padding: 4px 14px; color: #000; }
table.schedule th { background: #fee4a9; }
table.schedule tbody tr:nth-child(odd) td { background: #fefef2; }
table.schedule tbody tr:nth-child(even) td { background: #fcf6cf; }

ol.syllabus { list-style: none; padding: 0; margin: 0 0 10px; }
ol.syllabus > li { padding: 6px 0 8px; border-bottom: 1px solid #e3e3e3; }
ol.syllabus > li:last-child { border-bottom: 0; }
ol.syllabus h3 { font-size: 15px; }
ol.syllabus p { margin: 0; }
.refs { display: block; font-size: 13px; color: var(--muted); font-style: italic; }
.note { color: var(--muted); font-size: 14px; }
.archived { background: #fcf6cf; border: 1px solid #e2cf7a; border-radius: 6px; padding: 8px 12px; margin: 0 0 16px; color: #4a4a4a; }

.lectures { list-style: none; padding: 0; margin: 0 0 12px; }
.lectures li { display: grid; grid-template-columns: 50px 1fr; gap: 10px; padding: 3px 0; border-bottom: 1px solid #e6e6e6; }
.lectures time { color: var(--muted); font-size: 13.5px; padding-top: 1px; font-variant-numeric: tabular-nums; }
.lectures .refs { display: inline; margin-left: 4px; }
.part { margin: 14px 0 4px; font-size: 15.5px; }
.part:first-of-type { margin-top: 4px; }

.course-index li { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.course-index a { font-weight: bold; font-size: 16px; }
.course-index .meta { display: block; }

/* ---------- Student projects ---------- */

.people > li { padding: 8px 0 12px; border-bottom: 1px solid #e3e3e3; }
.people > li:last-child { border-bottom: 0; }
.people h3 { font-size: 16px; }
.people .now { margin: 1px 0 4px; }
.people ul { margin: 2px 0 0; padding-left: 1.3rem; }

.theses { list-style: none; padding: 0; margin: 0 0 8px; }
.theses li { display: grid; grid-template-columns: 70px 1fr; gap: 14px; padding: 7px 0; border-bottom: 1px solid #e3e3e3; }
.theses li:last-child { border-bottom: 0; }
.theses .year { color: var(--muted); font-size: 13.5px; padding-top: 1px; }
.theses .name { font-weight: bold; color: var(--ink); }
.theses .title { display: block; font-style: italic; }
.theses .after { display: block; font-size: 13.5px; color: var(--muted); }

/* ---------- About ---------- */

.cv { list-style: none; padding: 0; margin: 0; }
.prose ul.cv { padding: 0; }
.cv li { display: grid; grid-template-columns: 175px 1fr; gap: 16px; padding: 7px 0; border-bottom: 1px solid #e3e3e3; margin: 0; }
.cv li:first-child { border-top: 1px solid #e3e3e3; }
.cv .when { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- Book ---------- */

.book-head { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 30px; align-items: start; margin-bottom: 30px; }
.book-head > a { border: 0; }
.book-head .page-head h1 { font-size: 22px; }

.errata { width: 100%; border-collapse: collapse; }
.errata th { text-align: left; font-size: 13px; color: var(--muted); padding: 0 12px 6px 0; border-bottom: 1px solid #999; }
.errata td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.errata td:first-child { white-space: nowrap; color: var(--ink); width: 150px; }
.errata .wrong { color: var(--muted); }
.errata mjx-container { max-width: 100%; overflow-x: auto; overflow-y: hidden; }

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

.footer { background: #333; color: #eee; text-align: center; font-size: 12px; line-height: 1.5; padding: 8px 16px; }
.footer p { margin: 2px 0; }
.footer a { color: #eee; border-bottom-color: #aaa; }
.footer a:hover { color: #f90; }

/* ---------- Small screens ---------- */

@media (max-width: 700px) {
  body { padding-top: 0; font-size: 15px; }
  .container { border: 0; }
  main { padding: 20px 16px 30px; }
  .nav { background-size: 100% 100%; }
  .menu a { padding: 8px 9px; }
  .menu > li { position: static; }
  .menu > li > .sub { left: 0; right: 0; min-width: 0; }
  .sub--side { position: static; display: block; box-shadow: none; background: #353535; }
  .sub--side a { padding-left: 24px; }
  .has-sub--side > a::after { display: none; }

  .home { grid-template-columns: 1fr; grid-template-areas: "intro" "aside" "main"; }
  .home__aside { display: grid; grid-template-columns: 110px 1fr; gap: 14px; margin-bottom: 24px; align-items: start; }
  .home__aside .frame { margin: 0; }

  .book-head { grid-template-columns: 1fr; }
  .book-head > a { max-width: 170px; }
  .theses li, .cv li { grid-template-columns: 1fr; gap: 0; }

  .errata thead { display: none; }
  .errata, .errata tbody, .errata tr, .errata td { display: block; width: auto; }
  .errata tr { padding: 10px 0; border-bottom: 1px solid var(--rule); }
  .errata td { border: 0; padding: 2px 0; }
  .errata td:first-child { width: auto; font-weight: bold; }
  .errata td:first-child .meta { font-weight: normal; }
  .errata td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); }
}

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

@media print {
  body { background: none; padding: 0; }
  .nav, .skip { display: none; }
  .container { border: 0; box-shadow: none; }
}
