/* =========================================================
   Shared stylesheet for cu2mauro.github.io
   Edit CSS variables in :root to retheme the whole site.
   ========================================================= */

:root {
  --bg: #eef4e8;            /* faint green */
  --bg-card: #f7faf3;       /* slightly lighter for cards */
  --fg: #1c1c1c;
  --muted: #5a5a5a;
  --accent: #297437;        /* deep forest green */
  --accent-soft: #cfe0c8;
  --border: #d8e2d2;
  --max-width: 860px;
  --font-serif: "Charter", "Georgia", "Cambria", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  overflow-y: scroll;        /* always reserve scrollbar — prevents layout shift */
  scrollbar-gutter: stable;  /* modern browsers */
}
body {
  margin: 0;
  font-family: var(--font-serif);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: 17px;
}

/* ---------- Top navigation ---------- */
nav.topnav {
  position: sticky;
  top: 0;
  background: var(--accent);
  border-bottom: 4px solid var(--accent-soft);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 100;
}
nav.topnav .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.85rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
nav.topnav .name {
  font-weight: 600;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
nav.topnav .name a { color: #fff; text-decoration: none; }
nav.topnav ul {
  list-style: none;
  display: flex;
  gap: 1.4rem;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 0.92rem;
}
nav.topnav a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  transition: color 0.15s;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}
nav.topnav a:hover { color: #fff; }
nav.topnav a.active {
  color: #fff;
  border-bottom-color: #fff;
}

/* ---------- Layout ---------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.2rem 4rem;
}
section {
  margin-bottom: 3rem;
  scroll-margin-top: 4rem;
}

h1, h2, h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.25;
}
h1 { font-size: 2rem; margin: 0 0 0.3rem; }
h2 {
  font-size: 1.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-top: 2rem;
}
h3 { font-size: 1.1rem; margin-bottom: 0.3rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

p { margin: 0.7rem 0; }

/* ---------- Hero (used on index) ---------- */
.hero {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.hero .text { flex: 1 1 320px; }
.hero .photo { flex: 0 0 220px; text-align: center; }
.hero .photo img {
  width: 220px;
  height: 220px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
}
.subtitle {
  color: var(--muted);
  font-style: italic;
  margin: 0 0 1rem;
}

/* ---------- Contact icons ---------- */
.icons {
  display: flex;
  gap: 0.9rem;
  margin-top: 1.2rem;
  flex-wrap: wrap;
}
.icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  transition: all 0.15s;
}
.icons a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}
.icons svg,
.icons img {
  width: 20px;
  height: 20px;
  display: block;
}
.icons svg {
  fill: var(--fg);
}
.icons a:hover svg { fill: var(--accent); }

/* ---------- CV ---------- */
.cv-block strong { font-family: var(--font-sans); }
.cv-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cv-header h1 { margin: 0; }
.cv-header p  { margin: 0; }
.cv-download {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}
.cv-download:hover { background: #224d2a; text-decoration: none; }

.cv-entry {
  margin-bottom: 1.2rem;
  padding-left: 1rem;
  border-left: 3px solid var(--accent-soft);
}
.cv-entry .when {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Highlights / cards ---------- */
.highlight {
  margin-bottom: 2rem;
  padding-left: 1rem;
  border-left: 3px solid var(--accent-soft);
}
.highlight .date {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.highlight img {
  max-width: 100%;
  margin-top: 0.7rem;
  border-radius: 4px;
}

/* ---------- Research / outreach figure layout ---------- */
.figure-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}
.figure-row .fig {
  flex: 0 0 240px;
  text-align: center;
}
.figure-row .fig img {
  width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.figure-row .fig figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
  font-style: italic;
}
.figure-row .text { flex: 1 1 320px; }

/* ---------- Publications list ---------- */
.pub-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 1.5rem;
  margin-top: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-list li {
  padding: 0.9rem 0;
  border-bottom: 1px dashed var(--border);
}
.pub-list li:last-child { border-bottom: none; }
.pub-title { font-weight: 600; font-family: var(--font-sans); }
.pub-authors { color: var(--muted); font-size: 0.92rem; margin-top: 0.15rem; }
.pub-venue { font-style: italic; font-size: 0.92rem; margin-top: 0.15rem; }
.pub-links { font-family: var(--font-sans); font-size: 0.85rem; margin-top: 0.3rem; }
.pub-links a { margin-right: 0.6rem; }
.pub-loading { color: var(--muted); font-style: italic; }

/* ---------- Past research box ---------- */
.past-research {
  margin-top: 3rem;
  padding: 1.5rem 1.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.past-research h2 {
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
  font-size: 1.2rem;
  color: var(--muted);
}

/* ---------- Talks list ---------- */
.talks-list { list-style: none; padding: 0; }
.talks-list li {
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--border);
}
.talks-list li:last-child { border-bottom: none; }
.talks-list .talk-date {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--muted);
  margin-right: 0.5rem;
}

/* ---------- Footer ---------- */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.2rem 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .hero { flex-direction: column-reverse; align-items: center; text-align: center; }
  .hero .text { text-align: left; }
  h1 { font-size: 1.6rem; }
  nav.topnav ul { gap: 0.8rem; }
  nav.topnav .inner { justify-content: center; }
}
