/* ============================================================
   Davide La Cara — personal site
   ============================================================ */

:root {
  --paper:   #fdfdfc;
  --tint:    #f3f2ee;
  --ink:     #17171a;
  --muted:   #6b6b73;
  --rule:    #dedcd6;
  --accent:  #7a2e2e;

  --display: "EB Garamond", Georgia, serif;
  --body:    "Source Serif 4", Georgia, serif;
  --sans:    ui-sans-serif, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.62;
}

/* Horizontal padding only — never the shorthand, or it wipes out
   the vertical padding set on the elements that use this class. */
.wrap {
  max-width: 52rem;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* ---------- masthead --------------------------------------- */

.masthead { padding-top: 3.25rem; }

.masthead-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem 2.5rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--accent);
}

.wordmark {
  font-family: var(--display);
  font-size: 1.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 0;
}

.wordmark a { color: inherit; text-decoration: none; border: 0; }

.masthead nav ul {
  display: flex;
  gap: 1.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.masthead nav a {
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.015em;
  color: var(--muted);
  text-decoration: none;
  border: 0;
  padding-bottom: 2px;
}

.masthead nav a:hover { color: var(--ink); }
.masthead nav a[aria-current="page"] { color: var(--ink); border-bottom: 1px solid var(--accent); }

/* ---------- generic ---------------------------------------- */

.content { padding-top: 3rem; padding-bottom: 8rem; }

p { margin: 0 0 1.1rem; }

a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent); }
a:hover { color: var(--accent); }

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

.band {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 1.1rem;
}

.divider { height: 1px; background: var(--rule); border: 0; margin: 2.75rem 0; }

.band-gap { margin-top: 3.25rem; }

.page-note {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0 0 2rem;
}

.page-note a { color: var(--muted); border-bottom-color: var(--rule); }
.page-note a:hover { color: var(--accent); border-bottom-color: var(--accent); }

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

.lead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12rem;
  gap: 2.75rem;
  align-items: start;
}

.lead-text p {
  font-size: 1.125rem;
  line-height: 1.7;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}
.lead-text p:last-child { margin-bottom: 0; }

.portrait { margin: 0; }

.portrait img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--tint);
  border: 1px solid var(--rule);
}

.portrait figcaption {
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.75;
  color: var(--muted);
  margin-top: 0.75rem;
}

.portrait figcaption a { color: var(--muted); border-bottom-color: var(--rule); }
.portrait figcaption a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.interest-line {
  font-family: var(--display);
  font-size: 1.25rem;
  margin: 0;
}

.selected { background: var(--tint); padding: 1.6rem 1.75rem; }

.selected h3 {
  font-family: var(--display);
  font-size: 1.4375rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.45rem;
}

.selected h3 a { border: 0; }
.selected h3 a:hover { color: var(--accent); }
.selected p { margin: 0; }

.laurel { font-family: var(--sans); font-size: 0.8125rem; color: var(--accent); }

/* ---------- research --------------------------------------- */

.paper { padding-bottom: 2.5rem; margin-bottom: 2.5rem; border-bottom: 1px solid var(--rule); }
.paper:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }

.paper h3 {
  font-family: var(--display);
  font-size: 1.4375rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.4rem;
}

.meta { font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); margin: 0 0 0.45rem; }

.abstract {
  margin: 0;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.venues {
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--muted);
  margin: 0;
}

.venues a { color: var(--muted); border-bottom-color: var(--rule); }
.venues a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.award { color: var(--accent); }

/* collapsible abstract — native <details>, no JavaScript */
.abs { margin-top: 1rem; }

.abs summary {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.15rem 0;
}

.abs summary::-webkit-details-marker { display: none; }

.abs summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid var(--accent);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
}

.abs[open] summary::before { transform: rotate(90deg); }
.abs summary:hover { color: var(--ink); }
.abs .abstract { margin-top: 0.85rem; }

/* ---------- teaching --------------------------------------- */

.courses { margin: 0; }

.courses > div {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--rule);
}

.courses > div:last-child { border-bottom: 0; }

.code { font-family: var(--sans); font-size: 0.8125rem; color: var(--accent); padding-top: 0.3rem; }
.title { font-family: var(--display); font-size: 1.1875rem; }

/* ---------- personal --------------------------------------- */

.note {
  max-width: 36rem;
  font-size: 1.125rem;
  line-height: 1.7;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.plate { margin: 0; max-width: 40rem; }

.plate-gap { margin-top: 2.75rem; }

.plate img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--tint);
  border: 1px solid var(--rule);
}

.plate figcaption {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.6rem;
}

.reading { margin: 0; padding: 0; list-style: none; }
.reading li { padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
.reading li:last-child { border-bottom: 0; }
.reading .book { font-family: var(--display); font-size: 1.1875rem; line-height: 1.3; }
.reading .author { font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); margin-top: 0.1rem; }

/* ---------- responsive ------------------------------------- */

@media (max-width: 44rem) {
  .wrap { padding-left: 1.25rem; padding-right: 1.25rem; }
  .masthead { padding-top: 2rem; }
  .masthead-inner { gap: 0.85rem; padding-bottom: 0.8rem; }
  .wordmark { font-size: 1.625rem; }
  .masthead nav ul { gap: 1.1rem; flex-wrap: wrap; }

  .content { padding-top: 2rem; padding-bottom: 6rem; }
  .divider { margin: 2rem 0; }

  .lead { grid-template-columns: 1fr; gap: 1.5rem; }
  .portrait { order: -1; max-width: 10rem; }
  .lead-text p, .note { font-size: 1.0625rem; }

  .interest-line { font-size: 1.1875rem; }

  .selected { padding: 1.25rem 1.15rem; }
  .courses > div { display: block; padding: 0.8rem 0; }
  .code { padding-top: 0; margin-bottom: 0.15rem; }
  .title { font-size: 1.125rem; }
}

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