/* ==========================================================
   Jeanne Pinay – personal website
   Colours and fonts copied from the original Google Site.
   ========================================================== */

:root {
  --navy: #323868;        /* dark blue: quote, footer, buttons, section titles */
  --title-blue: #1c4587;  /* paper titles and sub-section titles */
  --intro-blue: #073763;  /* biography text */
  --text: #212121;        /* normal text */
  --muted: #555;          /* co-authors and secondary lines */
  --rule: #dcdcdc;        /* thin separator lines */
  --serif: "EB Garamond", Garamond, Georgia, serif;
  --sans: "Lato", Helvetica, Arial, sans-serif;

  --max: 1120px;          /* width of the page content */
  --measure: 68ch;        /* comfortable line length for long text */
  --fig: 190px;           /* width of the paper images */
  --bar: 64px;            /* height of the top bar */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--bar) + 16px); }

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--title-blue); }

p { margin: 0 0 0.3em; }

.wrap {
  display: block;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- Top bar with menu ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  padding: 0 32px;
}
.site-name {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 20px;
  color: rgba(0, 0, 0, 0.8);
  text-decoration: none;
  white-space: nowrap;
}
.menu { display: flex; gap: 28px; }
.menu a {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--navy);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}
.menu a:hover { color: var(--title-blue); border-bottom-color: var(--title-blue); }

/* ---------- Banner and quote ---------- */
.banner {                 /* Rumold Mercator, Orbis Terrae Compendiosa Descriptio, 1587: both hemispheres, Europe always in frame */
  height: 300px;
  background: url("images/banner.jpg") 50% 15% / cover no-repeat;
}
.quote {
  background: var(--navy);
  color: #fff;
  padding: 16px 0;
  font-size: 19px;
}
.quote p {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 32px;
  text-align: right;
}
.quote .quote-translation {
  margin-top: 2px;
  font-size: 16px;
  opacity: 0.8;
}

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 64px;
  align-items: stretch;   /* photo column takes the height of the text */
  padding-top: 56px;
  padding-bottom: 32px;
}
.about-side { position: relative; }
.portrait {                /* fills the photo column, cropped around the face if needed */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 25%;
  display: block;
}
.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
  margin-top: 1.1em;
}
.contact .icons { display: flex; gap: 12px; }
.icons a { display: inline-flex; transition: transform 0.15s; }
.icons a:hover { transform: translateY(-2px); }
.icons svg { display: block; }
.about-text .email { margin: 0; font-size: 19px; }

.about-text {
  color: var(--intro-blue);
  font-size: 22px;
  line-height: 1.5;
  max-width: 34em;
}
.about-text p { margin-bottom: 0.85em; }
.about-text p:last-child { margin-bottom: 0; }

/* ---------- Section and sub-section titles ---------- */
.section { padding-top: 48px; padding-bottom: 24px; }
.section-title {
  color: var(--navy);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 8px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--navy);
}
.sub-title {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--navy);       /* same as the section titles */
  font-size: 25px;
  font-style: italic;
  font-weight: 700;
  margin: 36px 0 26px;
}
.section-title + .entries { margin-top: 24px; }   /* space between "Teaching" and the first course */
.sub-title::after {               /* thin line running to the right of the title */
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* ---------- Papers ---------- */
.paper {
  display: grid;
  grid-template-columns: var(--fig) minmax(0, 1fr);
  gap: 36px;
  align-items: center;
  margin: 0 0 32px;
}

/* Map in a frame of fixed proportions, so every paper lines up the same way */
.paper-fig {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 6px;
  margin: 0;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: zoom-in;
  transition: border-color 0.15s, box-shadow 0.15s;
  align-self: start;
  position: sticky;   /* stays in view while a long abstract is read */
  top: calc(var(--bar) + 24px);
}
.paper-fig:hover, .paper-fig:focus-visible {
  border-color: var(--title-blue);
  box-shadow: 0 4px 14px rgba(28, 69, 135, 0.12);
  outline: none;
}
.paper-fig video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.paper-meta p { color: var(--muted); margin: 0; line-height: 1.3; }
.paper-meta p + p { margin-top: 4px; }
.paper-meta p strong, .paper-meta p em { color: var(--text); }

.paper h4, .entry h4 {
  color: var(--title-blue);
  font-size: 23px;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.25;
}
.paper h4 a, .entry h4 a { text-decoration: none; }
.paper h4 a:hover, .entry h4 a:hover { text-decoration: underline; }

/* Paper status label (e.g. Submitted), shown above the buttons */
.status {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  color: #fff;
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: 2px;
  padding: 4px 8px 3px;
}
.status + .paper-links { margin-top: 8px; }
/* "Submitted" and "Abstract" share the same width, text centred
   (text-indent offsets the extra letter-spacing after the last letter) */
.status, .tag[aria-controls] {
  width: 96px;
  text-align: center;
  text-indent: 0.14em;
}

/* Small buttons under each paper: Abstract, related project */
.paper-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--navy);
  border-radius: 2px;
  padding: 4px 8px 3px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tag:hover, .tag[aria-expanded="true"] { background: var(--navy); color: #fff; }
.tag:focus-visible { outline: 2px solid var(--title-blue); outline-offset: 2px; }

.abstract { margin-top: 14px; }
.abstract p {
  color: var(--text);
  text-align: justify;
  hyphens: auto;
  line-height: 1.5;
}

/* ---------- Publications and teaching ---------- */
.entries-note {
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 20px;
}
.entry { margin-bottom: 24px; }
.entry:last-child { margin-bottom: 0; }
.entry p { color: var(--muted); margin: 0; line-height: 1.35; }
.entry p strong, .entry p em { color: var(--text); }
.plain { font-weight: 400; color: var(--text); }
.quiet-link { text-decoration: none; }
.entry p .quiet-link em { color: inherit; }
.quiet-link:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.footer {
  background: var(--navy);
  color: #fff;
  text-align: center;
  font-size: 15px;
  padding: 28px 16px;
  margin-top: 40px;
}

/* ---------- Full-screen map viewer ---------- */
#lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 94vw;
  max-height: 92vh;
  overflow: visible;
  cursor: zoom-out;
}
#lightbox::backdrop { background: rgba(20, 22, 45, 0.85); }
#lightbox img, #lightbox video {
  display: block;
  max-width: 94vw;
  max-height: 92vh;
  background: #fff;
  border-radius: 3px;
}
.lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: var(--navy);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ---------- Tablets ---------- */
@media (max-width: 980px) {
  :root { --fig: 170px; }
  .about { grid-template-columns: 260px minmax(0, 1fr); gap: 40px; }
  .paper { gap: 28px; }
}

/* ---------- Phones ---------- */
@media (max-width: 720px) {
  :root { --fig: 150px; --bar: 56px; }
  body { font-size: 18px; }
  .wrap { padding: 0 16px; }
  .topbar { padding: 0 16px; }
  .site-name { font-size: 17px; }
  .menu { gap: 16px; }
  .menu a { font-size: 12px; letter-spacing: 0.06em; }
  .menu-optional { display: none; }
  .banner { height: 180px; background-position: 82% 50%; }
  .quote { padding: 12px 0; font-size: 16px; }
  .quote .quote-translation { font-size: 14px; }
  .quote p { padding: 0 16px; }
  .about { grid-template-columns: 1fr; gap: 28px; padding-top: 32px; padding-bottom: 8px; }
  .about-side { max-width: 300px; margin: 0 auto; width: 100%; }
  .portrait { position: static; height: auto; }
  .about-text { font-size: 19px; }
  .section { padding-top: 36px; }
  .section-title { font-size: 25px; }
  .sub-title { font-size: 22px; margin: 28px 0 20px; }
  .paper { gap: 20px; margin-bottom: 26px; }
  .paper-fig { padding: 4px; }
  .paper h4, .entry h4 { font-size: 20px; }
  .entries-note { font-size: 13px; }
  .abstract p { text-align: left; }
}

/* ---------- Small phones: stacked layout ---------- */
@media (max-width: 520px) {
  .site-name { display: none; }
  .topbar { justify-content: center; }
  .paper { grid-template-columns: 1fr; gap: 14px; }
  .paper-fig { position: static; max-width: 220px; }
}

/* ---------- Page of the Italian elections app ---------- */
.app-intro { padding-top: 40px; padding-bottom: 20px; }
.app-intro h1.section-title { font-size: 28px; }
.app-intro p { max-width: var(--measure); color: var(--intro-blue); font-size: 20px; line-height: 1.5; margin-bottom: 0.6em; }
.app-intro .app-note { color: var(--muted); font-size: 17px; max-width: none; }
.app-frame-wrap { max-width: 1400px; margin: 0 auto; padding: 0 32px; }
.app-frame {
  display: block;
  width: 100%;
  height: calc(100vh - var(--bar) - 32px);
  min-height: 720px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: #fff;
}
.footer a { color: #fff; }
@media (max-width: 720px) {
  .app-intro h1.section-title { font-size: 23px; }
  .app-intro p { font-size: 18px; }
  .app-frame-wrap { padding: 0 8px; }
  .app-frame { min-height: 600px; }
}

/* ---------- Page not found ---------- */
.not-found { padding-top: 48px; padding-bottom: 64px; min-height: 40vh; }
.not-found p { color: var(--intro-blue); font-size: 21px; }
