/* Matteo Pagliero — responsive beta.
   Keep this file beside index-v2.html and the existing image files. */

:root {
  --page-width: 68.75rem;
  --gutter: clamp(1.125rem, 3.5vw, 3rem);
  --text: #232d35;
  --muted-text: #59636b;
  --link: #0066cc;
  /* Change these colours to customise the full-width introduction band. */
  --hero-background: #1c2b35;
  --hero-text: #edf1f4;
  --hero-link: #b0dcfa;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  min-width: 0;
  background: #fff;
  color: var(--text);
  font-family: "Roboto", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
}

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

h1,
h2 {
  overflow-wrap: anywhere;
}

a {
  color: var(--link);
  text-decoration: none;
  overflow-wrap: anywhere;
}

a:hover {
  color: #004c99;
}

a:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 0.1875rem solid currentColor;
  outline-offset: 0.25rem;
  border-radius: 0.125rem;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: var(--gutter);
  z-index: 10;
  padding: 0.65rem 1rem;
  transform: translateY(-200%);
  background: #fff;
  color: var(--text);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
main {
  width: 100%;
}

/* One introductory screen: equal white bands above and below the dark panel.
   The menu sits at the top of the upper band. The minimum height can grow
   naturally when a small screen or enlarged text needs more room. */
.site-header {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(5rem, 1fr) auto minmax(5rem, 1fr);
  background: #fff;
}

.site-header::after {
  content: "";
  grid-row: 3;
}

.nav-links,
.wrapper,
.papers-list,
.talks-list {
  width: calc(100% - var(--gutter) - var(--gutter));
  max-width: var(--page-width);
  margin-inline: auto;
}

/* Navigation remains available at every screen size. */
.site-nav {
  grid-row: 1;
  align-self: start;
  background: #fff;
}

.nav-links ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0.5rem 0;
  list-style: none;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.25rem 0.125rem;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 400;
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--link);
}

/* Full browser width, with height determined by the photo and text. */
.hero {
  grid-row: 2;
  width: 100%;
  padding-block: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--hero-background);
  color: var(--hero-text);
}

.wrapper {
  max-width: 62rem;
  display: grid;
  grid-template-columns: minmax(12rem, 17rem) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.75rem, 4vw, 3.5rem);
}

.left,
.right {
  min-width: 0;
}

.left {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-picture {
  width: min(100%, 16.25rem);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 0;
  border-radius: 50%;
}

.roboto-title {
  margin: 1rem 0 0.25rem;
  font-size: clamp(1.35rem, 1.15rem + 0.4vw, 1.5rem);
  font-weight: 400;
  line-height: 1.3;
}

.roboto-light {
  font-weight: 400;
  font-style: normal;
}

.right {
  font-size: clamp(1rem, 0.93rem + 0.15vw, 1.0625rem);
  line-height: 1.65;
}

.right p {
  margin: 0 0 1em;
}

.right p:last-child {
  margin-bottom: 0;
}

.roboto-links {
  font-weight: 400;
  font-style: normal;
}

.hero .roboto-links {
  color: var(--hero-link);
}

.hero .roboto-links:hover {
  color: #fff;
}

.email-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  min-height: 2.75rem;
  padding-block: 0.6rem;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.84375rem;
  line-height: 1.6;
  text-decoration: none;
}

main {
  padding-block: clamp(2.5rem, 5vw, 4rem) 1rem;
}

.papers-list,
.talks-list {
  margin-bottom: 2rem;
}

.papers-list h2,
.talks-list h2 {
  margin: 0 0 2rem;
  color: var(--text);
  font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.65rem);
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
}

/* Native numbering avoids rotating the list and keeps keyboard/screen-reader
   order consistent with the visible, newest-first publication order. */
.papers-list ol {
  margin: 0;
  padding-inline-start: 2rem;
}

.papers-list li {
  margin: 0 0 1.75rem;
  padding-inline-start: 0.5rem;
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.papers-list li:last-child {
  margin-bottom: 0;
}

.papers-list li::marker {
  color: var(--muted-text);
  font-weight: 400;
}

.papers-list b,
.talks-list b {
  font-weight: 500;
}

.publication-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.5rem;
}

.publication-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.talks-list table {
  width: 100%;
  border-collapse: collapse;
}

.talks-list td {
  padding: 0.75rem;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.talks-list td:first-child {
  white-space: nowrap;
}

footer {
  padding: 1rem var(--gutter) 1.5rem;
  color: var(--muted-text);
  font-size: 0.8125rem;
  text-align: center;
}

footer p {
  margin: 0;
}

/* Phones, portrait tablets and narrow windows: photo above the introduction.
   No fixed heights or spacing offsets, so longer/zoomed text can grow freely. */
@media (max-width: 47.5rem) {
  .wrapper {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .profile-picture {
    width: clamp(10rem, 38vw, 13rem);
  }

  .right {
    width: 100%;
    max-width: 36rem;
    margin-inline: auto;
  }

  .nav-links ul {
    justify-content: center;
  }
}

@media (max-width: 24rem) {
  .papers-list ol {
    padding-inline-start: 1.5rem;
  }

  .papers-list li {
    padding-inline-start: 0.25rem;
  }
}

/* A straightforward, ink-friendly layout when printing or saving to PDF. */
@media print {
  :root {
    --gutter: 0rem;
    --page-width: 100%;
  }

  .site-nav,
  .skip-link,
  .site-header::after,
  footer {
    display: none;
  }

  .site-header {
    display: block;
    min-height: 0;
  }

  .hero {
    padding-block: 0 1.5rem;
    background: #fff;
    color: #000;
  }

  .hero .roboto-links,
  a {
    color: #000;
  }

  .profile-picture {
    width: 10rem;
    border: 0;
  }

  .wrapper {
    grid-template-columns: 13rem minmax(0, 1fr);
    gap: 1.5rem;
  }

  main {
    padding-block: 1rem 0;
  }

  .papers-list li {
    break-inside: avoid;
  }
}
