/* Abi Plimmer — academic site. One stylesheet, no frameworks. */

@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/pt-sans-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/pt-sans-latin-700.woff2") format("woff2");
}

:root {
  --teal: #2a9d8f;
  --ink: #222;
  --text: #404040;
  --tint: #f3f6f4;
  --tint-open: #f1decd;
  --nav-h: 4rem;
  --radius: 12px;
  --swirl: url("../images/swirl.webp");
}

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

html { scroll-padding-top: calc(var(--nav-h) + 1rem); }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  padding-top: var(--nav-h);
  min-width: 20rem;
  font-family: "PT Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: clamp(0.9rem, 0.85rem + 0.2vw, 1rem);
  line-height: 1.6;
  color: var(--text);
  background: #fff;
}

img { max-width: 100%; height: auto; }
a { color: var(--ink); }

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.5rem 1rem;
  background: #fff;
  color: var(--ink);
  border-radius: 0.4rem;
}
.skip-link:focus { top: 0.5rem; }

/* ---------- Top navigation ---------- */

.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--swirl) top left / 100% auto no-repeat, #c9b8d8;
}

.site-nav nav {
  width: 100%;
  display: flex;
  justify-content: center;
}

.site-nav ul {
  display: flex;
  gap: 0.5rem;
  width: min(100% - 3rem, 1320px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li { flex: 1 1 0; min-width: 0; }

.site-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6em 1.2em;
  border: 3px solid #fff;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: clamp(0.75rem, 1.3vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  transition: background 0.15s ease-out, color 0.15s ease-out;
}

.site-nav a:hover {
  background: #fff;
  color: #444;
  text-shadow: none;
}

.site-nav a:focus-visible { outline-color: var(--ink); }

.nav-icon { display: none; }

@media (max-width: 768px) {
  .site-nav ul { width: calc(100% - 1rem); gap: 0.4rem; }
  .site-nav a { padding: 0.5rem; }
  .nav-icon {
    display: block;
    width: clamp(1.1rem, 4.5vw, 1.5rem);
    height: clamp(1.1rem, 4.5vw, 1.5rem);
    fill: currentColor;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
  }
  .nav-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

/* ---------- Layout ---------- */

main {
  width: min(100% - 3rem, 1320px);
  margin-inline: auto;
  overflow-wrap: break-word; /* long URLs/DOIs must not force sideways scroll on phones */
}

.card {
  margin-block: 1.9rem;
  padding: clamp(0.9rem, 2.5vw, 2rem);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

/* Headings come from the Markdown: ## = section title, ### = subsection */
.md h2 {
  margin: 0 0 1.9rem;
  text-align: center;
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  line-height: 1.2;
  color: var(--ink);
}

.md h3 {
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 3px solid var(--teal);
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  line-height: 1.25;
  color: var(--teal);
}
.md h2 + h3 { margin-top: 0; }

.loading { text-align: center; color: #777; }

p { margin: 0 0 1.1rem; }

/* ---------- About ---------- */

#about .md > h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(1.9rem, 5.5vw, 3.25rem);
  line-height: 1.15;
  color: var(--teal);
}

/* the paragraph straight after the name is the job title */
#about .md > h1 + p {
  margin: 0.5rem 0 2.5rem;
  text-align: center;
  font-size: clamp(1rem, 2.6vw, 1.5rem);
  font-weight: 700;
  color: #111;
}

#about .md {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16rem;
  column-gap: 2.5rem;
}
#about .md > * { grid-column: 1; }
#about .md > h1,
#about .md > h1 + p { grid-column: 1 / -1; }
/* the image paragraph sits in the right-hand column */
#about .md > p:has(> img) {
  grid-column: 2;
  grid-row: 3 / span 6;
  align-self: start;
  margin: 0;
}

#about .md img {
  display: block;
  width: 16rem;
  height: 16rem;
  object-fit: cover;
  border-radius: 20%;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.links a {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  color: var(--ink);
  transition: background 0.15s ease-out;
}
.links a:hover { background: var(--tint-open); }
.links svg { width: 1.75rem; height: 1.75rem; fill: currentColor; }

@media (max-width: 600px) {
  main { width: calc(100% - 1rem); }
}

@media (max-width: 800px) {
  #about .md { display: block; }
  #about .md > p:has(> img) { margin: 0 0 1.1rem; }
  #about .md img { width: 10rem; height: 10rem; margin-inline: auto; }
}

/* ---------- Lists ---------- */

.md > ul {
  columns: 2;
  column-gap: 2.5rem;
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}
.md > ul > li {
  break-inside: avoid;
  margin-bottom: 0.8rem;
}

@media (max-width: 700px) {
  .md > ul { columns: 1; }
}

/* ---------- Collapsible entries (native <details>) ---------- */

details { margin-bottom: 1rem; }

summary {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.65rem 0.75rem;
  list-style: none;
  cursor: pointer;
  background: var(--tint);
  color: var(--ink);
  font-size: 1.05em;
  line-height: 1.3;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  margin-left: auto;
  padding-left: 1rem;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}
details[open] > summary::after { content: "\2212"; }
summary:hover,
details[open] > summary { background: var(--tint-open); }

summary em { font-style: normal; font-size: 0.9em; }
.summary-text { flex: 1; min-width: 0; }

.details-body {
  padding: 0.5rem 1rem 1rem;
  border-left: 3px solid var(--teal);
  font-size: 0.95em;
  line-height: 1.5;
  color: #444;
}
.details-body p:last-child { margin-bottom: 0; }
.details-body ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.details-body li { margin-bottom: 0.5rem; }

/* ---------- Footer ---------- */

.site-footer {
  padding: 1rem;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  background: var(--swirl) top left / 100% auto no-repeat, #c9b8d8;
}
.site-footer p { margin: 0; }
.site-footer a { color: inherit; }

@media print {
  .site-nav, .site-footer, .skip-link, .links { display: none; }
  body { padding-top: 0; }
  .card { box-shadow: none; padding: 0; }
  details > .details-body { display: block; }
}
