/* ==========================================================================
   Guido Ardizzone — personal site
   One stylesheet, shared across all pages. No build step, no external requests.
   Palette: "Léman blue" — a single desaturated blue accent on warm off-white.
   ========================================================================== */

:root {
  /* Type */
  --font-serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Modular scale, 1.25 ratio, 18px base */
  --step-0: 1.125rem;   /* 18px */
  --step-1: 1.406rem;   /* ~22.5px */
  --step-2: 1.758rem;   /* ~28px */
  --step-3: 2.197rem;   /* ~35px */
  --step--1: 0.9rem;    /* ~14.4px, metadata */

  /* Light theme */
  --bg: #faf9f6;
  --fg: #1a1a1a;
  --muted: #5a5f66;
  --accent: #1f5fa8;      /* same blue as the CV PDF (cvblue); ~6:1 on --bg */
  --accent-hover: #174a85;
  --rule: #e4e2dc;
  --card: #ffffff;        /* clean white panels with a hairline border */
  --ink: #1e252e;         /* near-black for pill buttons */
  --ink-fg: #f7f6f2;

  --measure: 76rem;     /* one centred column for every page: nav, content, footer share edges */
  --gap: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d;
    --fg: #e6e6e3;
    --muted: #9aa1a9;
    --accent: #86b4ea;
    --accent-hover: #aecdf2;
    --rule: #2a3038;
    --card: #1b2027;
    --ink: #e9e9e6;
    --ink-fg: #14181d;
  }
}

/* ------------------------------------------------------------------ Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: var(--step-0);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

/* ------------------------------------------------------------------ Layout */
.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding: 1.75rem clamp(1.25rem, 4vw, 3.5rem) 5rem;
}

/* Inner pages use the full column; running text keeps a readable line length */
.prose p { max-width: 70ch; }

/* ------------------------------------------------------------------ Nav */
.site-nav {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  padding-bottom: 1rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--rule);
}
.site-nav .brand {
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-right: auto;
}
.site-nav a { color: var(--fg); text-decoration: none; }
.site-nav .brand a { color: var(--fg); }
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* ------------------------------------------------------------------ Type */
h1, h2, h3 { font-family: var(--font-sans); line-height: 1.2; font-weight: 650; }
/* Bare headings (e.g. CV sections): serif, with a hairline underline for rhythm */
main h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--step-2);
  letter-spacing: -0.01em;
  margin: 2.75rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}
p { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
strong { font-weight: 700; }

/* ------------------------------------------------------------------ Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21rem;
  gap: 4.5rem;
  align-items: center;
  margin: 1rem 0 3rem;
}
.hero .name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2.3rem, 4.4vw, 3.8rem);
  line-height: 1.03;
  letter-spacing: -0.015em;
  margin: 0 0 1.15rem;
}
.hero .intro { max-width: 64ch; }
.hero .intro p { font-size: 1.125rem; line-height: 1.65; margin: 0 0 0.9rem; }
.hero .intro p:last-child { margin-bottom: 0; }
.hero .photo {
  width: 21rem;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--card);
}
@media (max-width: 72rem) {
  .hero { grid-template-columns: minmax(0, 1fr) 16rem; gap: 3rem; }
  .hero .photo { width: 16rem; }
}
@media (max-width: 56rem) {
  .hero { grid-template-columns: minmax(0, 1fr) 12rem; gap: 2rem; }
  .hero .photo { width: 12rem; }
}
@media (max-width: 40rem) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero .photo { width: 9rem; order: -1; }
}

/* Pill buttons — Roldán-style solid dark squircles */
.btn-row { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.6rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 550;
  line-height: 1;
  text-decoration: none;
  padding: 0.65rem 1.1rem 0.65rem 0.95rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.btn .icon { width: 1.05rem; height: 1.05rem; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--ink-fg); }
.btn-primary:hover { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--card); border-color: var(--rule); color: var(--fg); }
.btn-ghost .icon { color: var(--accent); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------------ Flat content card */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.4rem 1.6rem 1.2rem;
  margin: 0 0 1.75rem;
}
.card-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--step-1);
  margin: 0 0 0.4rem;
  padding: 0;
  border: 0;
  letter-spacing: -0.01em;
}
.card .news li:last-child { border-bottom: 0; padding-bottom: 0; }

h1.page-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--step-3);
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
}

/* ------------------------------------------------------------------ News list */
.news { list-style: none; padding: 0; margin: 1rem 0 0; }
.news li {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.5rem 1.25rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}
.news .date { font-family: var(--font-sans); font-size: var(--step--1); color: var(--muted); padding-top: 0.15rem; }
@media (max-width: 34rem) { .news li { grid-template-columns: 1fr; gap: 0.15rem; } }

/* ------------------------------------------------------------------ Research entries */
.paper { margin: 0 0 2rem; }
.paper .title { font-weight: 600; font-size: var(--step-1); font-family: var(--font-serif); line-height: 1.3; margin: 0 0 0.3rem; letter-spacing: -0.01em; }
.paper .title a { text-decoration: none; }
.paper .title a:hover { text-decoration: underline; }
.paper .meta { font-family: var(--font-sans); font-size: var(--step--1); color: var(--muted); margin: 0 0 0.5rem; }
.paper .coverage { font-family: var(--font-sans); font-size: var(--step--1); }
.paper .meta-venue { font-style: italic; margin-top: -0.35rem; }

/* Small uppercase labels — one style shared by section headings and status tags */
.section-label,
.tag {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.section-label { margin: 3rem 0 1rem; padding: 0; border: 0; }
/* Papers within a section are separated by hairlines */
.paper + .paper { border-top: 1px solid var(--rule); padding-top: 1.5rem; }

/* Title row: title left, status tag right; the tag wraps under the title on narrow screens */
.paper-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem 1rem;
}
.paper-head .title { flex: 1 1 20rem; }
.tag {
  white-space: nowrap;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  margin-bottom: 0.4rem;
}

/* Job market paper: its own card with an accent bar */
.paper-featured {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 1.3rem 1.6rem 0.4rem;
  margin: 2rem 0 0;
}
.paper-featured .section-label { color: var(--accent); margin: 0 0 0.6rem; }
.paper-featured .paper { margin-bottom: 1rem; }
.paper-featured .tag { background: var(--bg); }
/* Action row under each paper: [Abstract ▾] [Draft]. The abstract drops down
   below the row (native <details>, no JS). The summary has a fixed width so the
   Draft button can sit beside it and stay put when the abstract opens. */
.paper-actions { position: relative; margin-top: 0.7rem; }
.paper-btn,
details.abstract > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 2.1rem;
  padding: 0 0.95rem;
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 550;
  line-height: 1;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
a.paper-btn:hover,
details.abstract > summary:hover,
details.abstract[open] > summary { border-color: var(--accent); color: var(--accent); }

details.abstract > summary {
  width: 7.25rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
details.abstract > summary::-webkit-details-marker { display: none; }
/* Chevron: flips when the abstract is open */
details.abstract > summary::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
  transition: transform 0.15s ease;
}
details.abstract[open] > summary::after { transform: translateY(0.12rem) rotate(225deg); }

/* Draft button beside the summary: offset = summary width + gap */
details.abstract + .paper-btn { position: absolute; top: 0; left: calc(7.25rem + 0.6rem); }

details.abstract > p {
  margin: 0.6rem 0 0;
  padding: 1rem 1.2rem;
  max-width: 80ch;
  color: var(--fg);
  font-size: 1.0625rem;
  line-height: 1.6;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  animation: abstract-drop 0.18s ease-out;
}
@keyframes abstract-drop {
  from { opacity: 0; transform: translateY(-0.35rem); }
  to   { opacity: 1; transform: none; }
}

/* Dated one-line entries (CV page, Policy & Teaching): date in a narrow left column */
.vitae {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.55rem 1.25rem;
  margin: 0;
}
.vitae dt {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  color: var(--muted);
  padding-top: 0.15rem;
  white-space: nowrap;
}
.vitae dd { margin: 0; }
/* Lists of linked titles read calmer without underlines; colour marks the link */
.vitae dd a { text-decoration: none; }
.vitae dd a:hover { text-decoration: underline; }
@media (max-width: 34rem) {
  .vitae { grid-template-columns: 1fr; gap: 0.1rem; }
  .vitae dd { margin-bottom: 0.6rem; }
}

/* ------------------------------------------------------------------ Footer */
.site-foot {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  color: var(--muted);
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

/* ------------------------------------------------------------------ Photo banner
   Inner pages open with one of Guido's photos behind the nav and the page
   title (white text over a dark scrim). Remove the <header class="banner">
   and the body class to go back to the plain layout. */
.banner {
  position: relative;
  color: #fff;
  background:
    linear-gradient(rgba(10, 14, 20, 0.40), rgba(10, 14, 20, 0.10) 45%, rgba(10, 14, 20, 0.20)),
    var(--bg-photo) var(--bg-pos, center) / cover no-repeat,
    #2a3038;
}
.banner-inner {
  display: flex;
  flex-direction: column;
  min-height: clamp(22rem, 58vh, 36rem);
  padding-bottom: 3rem;
}
.banner-inner h1.banner-title { margin-block: auto; }
.banner .site-nav { border-bottom-color: rgba(255, 255, 255, 0.28); margin-bottom: 3.5rem; }
.banner .site-nav a,
.banner .site-nav .brand a { color: #fff; }
.banner .site-nav a:hover { color: #fff; text-decoration: underline; }
.banner .site-nav a[aria-current="page"] { color: #fff; text-decoration: underline; text-underline-offset: 6px; }
h1.banner-title {
  display: table;
  margin: 0 auto;
  padding: 0.6rem 2.5rem;
  border: 3px solid #fff;
  color: #fff;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  text-align: center;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.55);
  background: rgba(10, 14, 20, 0.18);
}
.banner + .wrap { padding-top: 0.5rem; }
.bg-research { --bg-photo: url("assets/bg/titicaca.jpg");          --bg-pos: center 45%; }
.bg-vitae    { --bg-photo: url("assets/bg/san-siro.jpg");           --bg-pos: center 65%; }
.bg-teaching { --bg-photo: url("assets/bg/lake-geneva.jpg");        --bg-pos: center 45%; }

/* ------------------------------------------------------------------ A11y */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.skip-link {
  position: absolute; left: -9999px; top: 0;
  font-family: var(--font-sans); background: var(--accent); color: #fff;
  padding: 0.5rem 1rem; z-index: 10;
}
.skip-link:focus { left: 0; }

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

/* ------------------------------------------------------------------ Print */
@media print {
  :root { --bg: #fff; --fg: #000; --muted: #333; --accent: #000; --rule: #999; --ink: #000; --ink-fg: #fff; }
  body { font-size: 11pt; }
  .site-nav, .skip-link, .btn-row { display: none; }
  .banner { background: none; color: #000; }
  h1.banner-title { color: #000; border: 0; padding: 0; margin: 0; text-shadow: none; }
  a { color: #000; text-decoration: underline; }
  details.abstract > summary, .paper-btn { display: none; }
  details.abstract > p { display: block !important; background: none; border: 0; padding: 0; }
  .paper { page-break-inside: avoid; }
}
