/* ============================================================
   Peter O'Brien — personal academic site
   Light, content-first, dependency-free (system fonts only).
   ============================================================ */

:root {
  color-scheme: light;
  --bg:        #fdfcfa;  /* warm off-white page */
  --surface:   #ffffff;
  --ink:       #1c1c1a;  /* near-black, warm */
  --muted:     #6a6a62;  /* secondary text  */
  --faint:     #8c8c84;
  --accent:    #2f5d4f;  /* deep pine green */
  --accent-dk: #244a3f;
  --rule:      #e7e3db;  /* hairline rules  */
  --rule-soft: #efece6;
  --maxw:      720px;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
           Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Layout shell ---------------------------------------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Top navigation -------------------------------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(253, 252, 250, 0.9);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-nav .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 15px;
  padding-bottom: 15px;
}
.nav-name {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}
.nav-name:hover { color: var(--accent); }
.nav-links {
  display: flex;
  gap: 22px;
}
.nav-links a {
  font-size: 0.93rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Hero ------------------------------------------------- */
.hero {
  display: flex;
  align-items: center;
  gap: 34px;
  padding: 54px 0 40px;
}
.portrait {
  flex: 0 0 auto;
  width: 188px;
  height: 188px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 14px rgba(28, 28, 26, 0.12),
              0 0 0 1px var(--rule);
}
.hero-text { min-width: 0; }
.hero-text h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2.3rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.affil {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.45;
}
.intro {
  margin: 0 0 16px;
  font-size: 1.04rem;
}
.jm-line {
  margin: 20px 0 4px;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
}
.jm-line a {
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid #bcd0c8;
}
.jm-line a:hover { color: var(--accent-dk); border-bottom-color: var(--accent-dk); }
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 4px;
}
.hero-links a {
  position: relative;
  font-size: 0.97rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid #bcd0c8;
  padding-bottom: 1px;
}
.hero-links a:hover {
  color: var(--accent-dk);
  border-bottom-color: var(--accent-dk);
}

/* ---- Sections -------------------------------------------- */
main { padding-bottom: 20px; }

section { padding: 10px 0 6px; }

h2.section-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 26px 0 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

h3.sub {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--accent);
  margin: 30px 0 14px;
}

/* ---- Papers ---------------------------------------------- */
.paper { margin: 0 0 26px; }
.paper:last-child { margin-bottom: 8px; }

.paper-title {
  font-family: var(--serif);
  font-size: 1.16rem;
  font-weight: 600;
  line-height: 1.32;
  margin: 0 0 4px;
}
.paper-meta {
  margin: 0 0 9px;
  font-size: 0.95rem;
  color: var(--muted);
}
.paper-meta a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid #bcd0c8;
}
.paper-meta a:hover { color: var(--accent-dk); border-bottom-color: var(--accent-dk); }

.abstract {
  margin: 0;
  font-size: 0.99rem;
  color: #35352f;
  line-height: 1.62;
}
.abstract .lead {
  font-variant-caps: small-caps;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-size: 0.82rem;
  margin-right: 2px;
}
.note {
  margin: 4px 0 0;
  font-size: 0.95rem;
  color: var(--faint);
  font-style: italic;
}

/* ---- CV page --------------------------------------------- */
.cv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 40px;
}
.cv-head h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.9rem;
  margin: 0;
}
.cv-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  font-size: 0.9rem;
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 7px;
  border: 1px solid var(--rule);
  color: var(--ink);
  background: var(--surface);
  transition: border-color .15s, background .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #cfc9bd; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); color:#fff; }

.cv-sub {
  margin: 10px 0 18px;
  font-size: 0.92rem;
  color: var(--faint);
}
.pdf-frame {
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  background: #f3f1ec;
  box-shadow: 0 1px 10px rgba(28,28,26,0.05);
}
.pdf-frame iframe {
  display: block;
  width: 100%;
  height: 84vh;
  min-height: 520px;
  border: 0;
}
.pdf-fallback {
  margin: 14px 2px 0;
  font-size: 0.92rem;
  color: var(--muted);
}
.pdf-fallback a { color: var(--accent); }

/* ---- Footer ---------------------------------------------- */
.site-foot {
  margin-top: 46px;
  border-top: 1px solid var(--rule);
  padding: 22px 0 44px;
  color: var(--faint);
  font-size: 0.86rem;
}
.site-foot a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--rule); }
.site-foot a:hover { color: var(--ink); }

/* ---- Responsive ------------------------------------------ */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .hero {
    flex-direction: column;
    text-align: center;
    gap: 20px;
    padding: 36px 0 30px;
  }
  .portrait { width: 150px; height: 150px; }
  .hero-text h1 { font-size: 2rem; }
  .hero-links { justify-content: center; }
  .nav-links { gap: 16px; }
  .cv-head { padding-top: 30px; }
  .pdf-frame iframe { height: 72vh; }
}

a:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
