/* Shared stylesheet for Samuel Lisi's pages.
   No external fonts or scripts. Colors are defined once below;
   all text/background pairs meet WCAG 2.1 AA contrast (4.5:1 or better). */

:root {
  --bg: #fdfdfb;
  --text: #1c1c1c;
  --muted: #4f4f4f;
  --link: #0b4f9c;
  --link-visited: #5b2a86;
  --rule: #c9c9c4;
  --accent: #14213d;
  --panel: #f2f2ee;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --text: #e8e8e6;
    --muted: #b8b8b4;
    --link: #8ab8ff;
    --link-visited: #c9a4f0;
    --rule: #4a4d55;
    --accent: #e8e8e6;
    --panel: #20232a;
  }
}

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

html {
  font-size: 100%;            /* respect the reader's browser setting */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Skip link: hidden until it receives keyboard focus */
.skip {
  position: absolute;
  left: -999rem;
  top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip:focus {
  left: 0;
}

/* Header and navigation */
.site-header {
  border-bottom: 2px solid var(--accent);
  padding: 1.25rem 0 0.75rem;
  margin-bottom: 2rem;
}

.site-name {
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1.75rem;
  font-weight: bold;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  color: var(--accent);
}
.site-name a {
  color: inherit;
  text-decoration: none;
}
.site-name a:hover {
  text-decoration: underline;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1rem;
}
.site-nav a {
  display: inline-block;
  padding: 0.35rem 0;      /* comfortable touch target */
}
.site-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: bold;
  text-decoration: none;
  border-bottom: 3px solid var(--accent);
}

/* Headings */
h1,
h2,
h3 {
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.25;
  color: var(--accent);
}
h1 {
  font-size: 1.75rem;
  margin: 0 0 1rem;
}
h2 {
  font-size: 1.3rem;
  margin: 2.25rem 0 0.75rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--rule);
}
h3 {
  font-size: 1.0625rem;
  margin: 1.75rem 0 0.4rem;
}

p {
  margin: 0 0 1rem;
}

/* Links: always underlined, so color is never the only cue */
a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
a:visited {
  color: var(--link-visited);
}
a:hover {
  text-decoration-thickness: 2px;
}
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Home page: photo beside the introduction */
.intro {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
}
.intro-text {
  flex: 1 1 18rem;
}
.portrait {
  margin: 0;
  flex: 0 0 11rem;
  max-width: 11rem;
}
.portrait img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
}
.portrait figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

address {
  font-style: normal;
  margin: 0 0 1rem;
}

/* Definition lists: contact details, CV entries */
dl.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1.25rem;
  margin: 0 0 1rem;
}
dl.facts dt {
  font-weight: bold;
}
dl.facts dd {
  margin: 0;
}

dl.cv {
  margin: 0;
}
dl.cv dt {
  font-weight: bold;
  margin-top: 1rem;
}
dl.cv dd {
  margin: 0;
}
dl.cv .when {
  color: var(--muted);
}

/* Publication list */
ol.pubs {
  margin: 0;
  padding-left: 2.25rem;
}
ol.pubs li {
  margin-bottom: 0.9rem;
}
.pub-title {
  font-style: italic;
}

/* Notes on individual papers */
.note {
  margin-bottom: 0.5rem;
}
.note .ref {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

details {
  background: var(--panel);
  border-left: 3px solid var(--rule);
  padding: 0.5rem 1rem;
  margin: 0 0 1rem;
}
details summary {
  cursor: pointer;
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.95rem;
  padding: 0.25rem 0;
}
details[open] summary {
  margin-bottom: 0.75rem;
}
details p:last-child {
  margin-bottom: 0.25rem;
}

blockquote {
  margin: 0 0 1rem;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 3px solid var(--rule);
  font-style: italic;
}
blockquote p:last-child {
  margin-bottom: 0;
}

ul.plain {
  padding-left: 1.25rem;
  margin: 0 0 1rem;
}
ul.plain li {
  margin-bottom: 0.35rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding: 1rem 0 2rem;
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer p {
  margin: 0;
}

@media (max-width: 30rem) {
  dl.facts {
    grid-template-columns: 1fr;
    gap: 0;
  }
  dl.facts dd {
    margin-bottom: 0.5rem;
  }
  .portrait {
    flex-basis: 9rem;
    max-width: 9rem;
  }
}

@media print {
  .skip,
  .site-nav {
    display: none;
  }
  body {
    font-size: 11pt;
  }
  a {
    color: inherit;
  }
  details {
    background: none;
    border: 0;
    padding: 0;
  }
}
