/* ==========================================================
   Meaghan N. Evans — academic site
   Field-notebook / specimen-label aesthetic
   ========================================================== */

:root {
  --paper: #f5f1ea;
  --paper-2: #ece5d9;
  --card: #fbf9f5;
  --ink: #1c2226;
  --ink-soft: #454d52;
  --muted: #7a776f;
  --rule: #d8cfc1;
  --night: #15212a;
  --night-2: #1e2e39;
  --night-text: #e8e2d6;
  --night-muted: #9aa5ab;
  --rust: #a8432a;
  --rust-bright: #d2734f;

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --wrap: 1120px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--rust); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper); padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- Type ---------- */

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 .6em;
  font-variation-settings: 'opsz' 96;
}
h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); }
h3 { font-size: 1.35rem; font-variation-settings: 'opsz' 36; }

p { margin: 0 0 1.1em; }

.kicker {
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--rust);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.kicker .num { color: var(--muted); }
.kicker::after {
  content: "";
  flex: 0 0 3rem;
  height: 1px;
  background: currentColor;
  opacity: .5;
}

.lede {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.5;
  color: var(--ink-soft);
  font-variation-settings: 'opsz' 36;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: rgba(245, 241, 234, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}
.brand {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand span { color: var(--rust); }

.nav-links {
  display: flex;
  gap: clamp(1rem, 2.2vw, 2rem);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding: .35rem 0;
  border-bottom: 1px solid transparent;
}
.nav-links a:hover { color: var(--ink); border-color: var(--rule); }
.nav-links a[aria-current="page"] { color: var(--rust); border-color: var(--rust); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .45rem .7rem;
  color: var(--ink);
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: .5rem var(--gutter) 1rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: .8rem 0; border-bottom: 1px solid var(--rule); }
  .nav-links li:last-child a { border-bottom: 0; }
}

/* ---------- Hero (home) ---------- */

.hero {
  padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4.5rem);
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  line-height: 1.02;
  font-weight: 400;
  margin-bottom: .35em;
  font-variation-settings: 'opsz' 144;
}
.hero h1 em { font-style: italic; color: var(--rust); font-weight: 300; }
.hero .role {
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--muted);
  letter-spacing: .02em;
  margin: 1.5rem 0 2rem;
  line-height: 1.6;
}
.hero .role strong { color: var(--ink); font-weight: 500; }

.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: .85rem 1.3rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  color: var(--ink);
  transition: background .2s, color .2s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.solid { background: var(--rust); border-color: var(--rust); color: #fff; }
.btn.solid:hover { background: var(--ink); border-color: var(--ink); }

/* Specimen-label figure */
.specimen {
  margin: 0;
  position: relative;
}
.specimen img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 2px;
  object-position: 80% 50%;
  filter: saturate(.92);
}
.specimen figcaption {
  position: relative;
  margin: -2.25rem 0 0 auto;
  width: min(86%, 300px);
  background: var(--card);
  border: 1px solid var(--rule);
  padding: .8rem 1rem;
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.55;
  color: var(--ink-soft);
  box-shadow: 0 6px 18px rgba(28, 34, 38, .08);
  transform: rotate(-1.2deg);
}
.specimen figcaption b {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: .98rem;
  color: var(--ink);
  margin-bottom: .2rem;
}

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .specimen { max-width: 440px; }
}

/* ---------- Field strip ---------- */

.field-strip {
  border-block: 1px solid var(--rule);
  background: var(--paper-2);
}
.field-strip dl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
}
.field-strip dl > div {
  padding: 1.25rem 1.25rem 1.25rem 0;
  border-right: 1px solid var(--rule);
  padding-left: 1.25rem;
}
.field-strip dl > div:first-child { padding-left: 0; }
.field-strip dl > div:last-child { border-right: 0; }
.field-strip dt {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .25rem;
}
.field-strip dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.4;
}
@media (max-width: 860px) {
  .field-strip dl { grid-template-columns: 1fr 1fr; column-gap: 1.25rem; }
  .field-strip dl > div { border-right: 0; padding-left: 0; border-bottom: 1px solid var(--rule); }
  .field-strip dl > div:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 480px) {
  .field-strip dl { grid-template-columns: 1fr; }
  .field-strip dl > div:nth-last-child(2) { border-bottom: 1px solid var(--rule); }
}

/* ---------- Sections ---------- */

.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section + .section { border-top: 1px solid var(--rule); }

.split {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(1.5rem, 5vw, 4.5rem);
}
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.aside-card {
  border-top: 2px solid var(--ink);
  padding-top: 1rem;
  font-size: .95rem;
}
.aside-card h4 {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
  margin: 1.4rem 0 .4rem;
}
.aside-card h4:first-child { margin-top: 0; }
.aside-card ul { list-style: none; margin: 0; padding: 0; }
.aside-card li { padding: .15rem 0; }

/* Numbered theme list */
.themes { list-style: none; margin: 2.5rem 0 0; padding: 0; counter-reset: theme; }
.themes > li {
  counter-increment: theme;
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1.5rem;
  padding: 1.75rem 0;
  border-top: 1px solid var(--rule);
}
.themes > li:last-child { border-bottom: 1px solid var(--rule); }
.themes > li::before {
  content: counter(theme, decimal-leading-zero);
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 300;
  line-height: 1;
  color: var(--rust);
}
.themes h3 { margin-bottom: .35rem; }
.themes p { margin: 0; color: var(--ink-soft); }
.themes .tags {
  margin-top: .8rem;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .04em;
}
@media (max-width: 560px) {
  .themes > li { grid-template-columns: 1fr; gap: .5rem; }
}

/* Dark "night" band */
.night {
  background: var(--night);
  color: var(--night-text);
}
.night h2, .night h3 { color: #fff; }
.night .kicker { color: var(--rust-bright); }
.night .kicker .num { color: var(--night-muted); }
.night p { color: var(--night-muted); }
.night a { color: var(--rust-bright); }
.night a:hover { color: #fff; }
.night .themes > li { border-color: rgba(255,255,255,.12); }
.night .themes > li::before { color: var(--rust-bright); }
.night .themes p { color: var(--night-muted); }
.night .themes .tags { color: #7f8c93; }

/* ---------- Publications ---------- */

.pub-list { list-style: none; margin: 0; padding: 0; }
.pub {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1.5rem;
  padding: 1.35rem 0;
  border-top: 1px solid var(--rule);
}
.pub:last-child { border-bottom: 1px solid var(--rule); }
.pub-year {
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--muted);
  padding-top: .2rem;
}
.pub-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 0 0 .3rem;
  font-variation-settings: 'opsz' 24;
}
.pub-title a { color: var(--ink); text-decoration: none; }
.pub-title a:hover { color: var(--rust); text-decoration: underline; }
.pub-authors { font-size: .92rem; color: var(--ink-soft); margin: 0 0 .15rem; }
.pub-authors strong { color: var(--ink); font-weight: 600; }
.pub-venue { font-size: .88rem; font-style: italic; color: var(--muted); margin: 0; }
.pub-cites {
  font-family: var(--mono);
  font-style: normal;
  font-size: .72rem;
  color: var(--rust);
  margin-left: .5rem;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .pub { grid-template-columns: 1fr; gap: .25rem; }
}

.pub-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.pub-tools input {
  font: inherit;
  font-size: .95rem;
  padding: .65rem .9rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--card);
  width: min(100%, 360px);
  color: var(--ink);
}
.pub-tools input:focus { outline: 2px solid var(--rust); outline-offset: 1px; }
.pub-meta {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
}

.year-group h3 {
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .14em;
  color: var(--rust);
  margin: 2.5rem 0 .25rem;
}
.year-group:first-child h3 { margin-top: 0; }
.year-group .pub { grid-template-columns: 1fr; }
.year-group .pub-year { display: none; }

/* ---------- Page header (inner pages) ---------- */

.page-head {
  padding-block: clamp(3rem, 7vw, 5rem) clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--rule);
}
.page-head h1 {
  font-size: clamp(2.4rem, 5.5vw, 4rem);
  font-weight: 400;
  font-variation-settings: 'opsz' 144;
  max-width: 18ch;
}
.page-head .lede { max-width: 60ch; margin: 0; }

/* Research detail blocks */
.research-block {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
}
.research-block.flip { grid-template-columns: 1fr 1.3fr; }
.research-block.flip .research-media { order: -1; }
.research-media { margin: 0; }
.research-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 2px;
}
.research-media img.natural { aspect-ratio: auto; height: auto; }
.research-media figcaption {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  margin-top: .6rem;
}
.photo-slot {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  text-align: center;
  background: repeating-linear-gradient(135deg, var(--paper-2) 0 12px, var(--paper) 12px 24px);
  border: 1px dashed var(--rule);
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.key-papers {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  border-left: 2px solid var(--rust);
  padding-left: 1rem;
  font-size: .9rem;
}
.key-papers li { margin-bottom: .55rem; color: var(--ink-soft); }
.key-papers em { color: var(--muted); }
@media (max-width: 860px) {
  .research-block, .research-block.flip { grid-template-columns: 1fr; }
  .research-block.flip .research-media { order: 0; }
}

/* Plain ruled list (methods, partners, courses) */
.ruled {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  column-gap: 2.5rem;
}
.ruled li {
  padding: .9rem 0;
  border-top: 1px solid var(--rule);
}
.ruled li b {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.05rem;
}
.ruled li span { font-size: .92rem; color: var(--ink-soft); }
.night .ruled li { border-color: rgba(255,255,255,.12); }
.night .ruled li span { color: var(--night-muted); }

/* Course "catalogue cards" */
.courses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  max-width: 900px;
  gap: 1.25rem;
  margin-top: 2rem;
}
.course {
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 1.4rem 1.4rem 1.2rem;
  position: relative;
}
.course .code {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--rust);
}
.course h3 { margin: .35rem 0 .5rem; font-size: 1.2rem; }
.course p { font-size: .93rem; color: var(--ink-soft); margin: 0; }

blockquote.pull {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  line-height: 1.35;
  color: var(--ink);
  border-left: 2px solid var(--rust);
  padding-left: 1.5rem;
  font-variation-settings: 'opsz' 72;
}

/* ---------- Contact / footer ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: end;
}
@media (max-width: 760px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-links { list-style: none; margin: 0; padding: 0; }
.contact-links li { border-top: 1px solid rgba(255,255,255,.12); }
.contact-links li:last-child { border-bottom: 1px solid rgba(255,255,255,.12); }
.contact-links a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 0;
  text-decoration: none;
  color: var(--night-text);
  font-family: var(--mono);
  font-size: .85rem;
}
.contact-links a:hover { color: var(--rust-bright); }
.contact-links a span:last-child { color: var(--night-muted); overflow-wrap: anywhere; text-align: right; }

.site-footer {
  background: var(--night);
  color: var(--night-muted);
  border-top: 1px solid rgba(255,255,255,.08);
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .04em;
  padding-block: 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.site-footer a { color: var(--night-muted); }

/* ---------- Motion ---------- */

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
