/* ==========================================================================
   Erin Crawley — erin-crawley.github.io

   Palette: "Ink & Fern" — deep green-ink band, fern green accent.
   Analogous pair, ~60 degrees apart, muted. Every colour combination below
   is verified at 4.5:1 or better against WCAG AA.

   Type: Spectral (display) + Inter Tight (body).

   All colour and type live in the custom properties in this one block.
   ========================================================================== */

:root {
  /* colour: the band is a large field (header, hero, footer); the accent
     appears on links and small marks; the surface is a pale wash of the
     accent hue so both colours read as fields rather than one plus grey. */
  --bg:        #F3F7F4;
  --surface:   #E5EFE0;
  --band:      #14332F;
  --band-text: #E5F0ED;
  --band-mute: #95BCB4;
  --text:      #101F1B;
  --text-mute: #4C635B;
  --accent:    #43713C;
  --accent-lo: #2C4F27;
  --rule:      #D8E3DE;

  /* type */
  --display: "Spectral", Georgia, "Times New Roman", serif;
  --body:    "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --measure: 46rem;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- reset ---------------------------------------------------------------- */

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

html {
  font-size: 18px;
  scroll-padding-top: 5rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
}

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

a { color: var(--accent); text-decoration: none; transition: color 150ms var(--ease); }
a:hover { color: var(--accent-lo); }

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

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 300;
  line-height: 1.15;
}

::selection { background: rgba(67, 113, 60, 0.16); }

.wrapper { max-width: var(--measure); margin: 0 auto; padding: 0 1.75rem; }

/* --- header ---------------------------------------------------------------
   A distinct colour surface with a sans, uppercase wordmark. Deliberately
   NOT the display serif: on the page background in the display face it read
   as just another section heading.
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--band);
  color: var(--band-text);
  box-shadow: 0 1px 0 rgba(229, 240, 237, 0.08);
}

.header-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.95rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.wordmark {
  font-family: var(--body);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--band-text);
}

.wordmark:hover { color: var(--band-text); opacity: 0.8; }

/* Homepage: hidden while the hero (which shows the name) is on screen,
   faded in once the About section reaches the top. Toggled by home.html. */
.wordmark { transition: opacity 450ms var(--ease), transform 450ms var(--ease); }
.site-header.wordmark-hidden .wordmark {
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .wordmark { transition: none; }
}

/* On the homepage, match the wider section grid so the wordmark lines up
   with the section headings (About, Publications, ...). */
.header-inner--wide {
  max-width: 62rem;
  /* Keep the nav's right edge where it sits in the normal 46rem header:
     21.25rem right of centre. 1.75rem at <=46rem, 9.75rem at >=62rem. */
  padding-right: max(1.75rem, min(9.75rem, 50vw - 21.25rem));
}

/* --- hero: the band continues as a colour field --------------------------- */

.hero {
  background: var(--band);
  color: var(--band-text);
  padding: 4.5rem 0 4.25rem;
}

.hero .portrait {
  width: 144px;
  height: 144px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.16);
  flex-shrink: 0;
}

/* Photo and name side by side. */
.hero .identity {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.hero .identity .name { margin-bottom: 0; }

.name {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(2.6rem, 8vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin-bottom: 0.85rem;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  opacity: 0.9;
}

.affiliation {
  color: var(--band-mute);
  font-size: 0.95rem;
  margin-top: 0.4rem;
}

/* The introduction sits inside the band, under the name and affiliation. */
.hero .intro {
  max-width: 39rem;
  margin-top: 2.25rem;
}
.hero .lead { font-size: 1.08rem; }
.hero .note { color: var(--band-mute); margin-top: 1rem; }
.hero .links { margin-top: 1.75rem; }
.hero .links a { color: var(--band-text); }
.hero .links a:hover { color: #fff; }
.hero .links a::after { background: var(--band-mute); }

/* --- nav (renders only once _data/navigation.yml has entries) -------------- */

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 500;
}

.nav a { color: var(--band-mute); position: relative; padding-bottom: 3px; }
.nav a:hover,
.nav a[aria-current="page"] { color: var(--band-text); }

.nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1px;
  background: var(--band-text);
  transition: width 250ms var(--ease);
}
.nav a:hover::after,
.nav a[aria-current="page"]::after { width: 100%; }

/* --- inner page headers --------------------------------------------------- */

.page-head {
  background: var(--band);
  color: var(--band-text);
  padding: 3.25rem 0 3rem;
}

.page-title {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(2rem, 5.5vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.page-subtitle { color: var(--band-mute); margin-top: 0.5rem; }
.page-head .eyebrow { margin-bottom: 0.6rem; color: var(--band-mute); }

/* --- homepage sections ----------------------------------------------------
   One continuous pale green field under the hero. Each section is a two
   column grid: the heading in a narrow left column that stays pinned while
   the body scrolls, and a hairline across the column above every section
   after the first. The grid is wider than the reading measure so the body
   column stays at a comfortable width.
   -------------------------------------------------------------------------- */

.content { padding: 3.5rem 0 4rem; }

.home-content {
  background: var(--surface);
  padding: 1.5rem 0 3rem;
}

.home-section {
  padding: 4rem 0;
  scroll-margin-top: 4.5rem;
}

.home-section .wrapper {
  max-width: 62rem;
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.home-section + .home-section { padding-top: 0; }
.home-section + .home-section .wrapper {
  border-top: 1px solid rgba(67, 113, 60, 0.22);
  padding-top: 4rem;
}

.home-section h2 {
  grid-column: 1;
  position: sticky;
  top: 5rem;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.home-section .body { grid-column: 2; max-width: 39rem; }
.home-section .body > * + * { margin-top: 1rem; }

.home-section h3 {
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0;
}
.home-section .body > h3 + p { margin-top: 0.3rem; color: var(--text-mute); }

.section-intro { color: var(--text-mute); }

.pub {
  padding: 1.1rem 0;
  border-top: 1px solid rgba(67, 113, 60, 0.18);
  border-bottom: 1px solid rgba(67, 113, 60, 0.18);
  margin-top: 1.75rem;
}
.pub + .pub { border-top: 0; margin-top: 0; }
.pub > * + * { margin-top: 0; }

.pub-title {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 400;
}

.pub-meta {
  color: var(--text-mute);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.pub-links {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  margin-top: 0.45rem;
  text-transform: uppercase;
}

.button-placeholder {
  display: inline-block;
  border: 1px solid rgba(67, 113, 60, 0.35);
  border-radius: 3px;
  color: var(--text-mute);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-top: 1.5rem;
  padding: 0.55rem 0.85rem;
  text-transform: uppercase;
}

.lead { font-size: 1.08rem; }

/* --- prose: markdown-generated content ------------------------------------ */

.prose > * + * { margin-top: 1rem; }

.prose h2 {
  font-size: 1.7rem;
  margin-top: 2.75rem;
  margin-bottom: 0.25rem;
}

.prose h3 {
  font-family: var(--body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-top: 1.75rem;
  margin-bottom: 0.25rem;
}

.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: 0.3rem; }
.prose li::marker { color: var(--accent); }

.prose a { border-bottom: 1px solid rgba(67, 113, 60, 0.35); }
.prose a:hover { border-color: var(--accent-lo); }
.prose .links a, .prose a.plain { border-bottom: 0; }

.prose blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.25rem;
  color: var(--text-mute);
  font-style: italic;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--surface);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.prose pre {
  background: var(--band);
  color: var(--band-text);
  padding: 1.1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; color: inherit; }

.prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--rule); }
.prose th { font-weight: 600; background: var(--surface); }

.prose img { border-radius: 4px; margin-top: 1.5rem; }

.prose figure figcaption {
  font-size: 0.85rem;
  color: var(--text-mute);
  margin-top: 0.5rem;
}

.note { color: var(--text-mute); margin-top: 1rem; }

.note a {
  border-bottom: 1px solid rgba(67, 113, 60, 0.35);
  transition: border-color 150ms var(--ease), color 150ms var(--ease);
}
.note a:hover { border-color: var(--accent-lo); }

.rule { width: 3rem; height: 1px; border: 0; background: var(--rule); margin: 2.25rem 0; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.links a { position: relative; padding-bottom: 3px; }

.links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 250ms var(--ease);
}
.links a:hover::after { width: 100%; }

/* --- CV page --------------------------------------------------------------
   Each entry: a line with the role on the left and the date pushed right,
   then optional detail lines and bullets. Sub-entries (projects under a
   role) are indented.
   -------------------------------------------------------------------------- */

.prose .cv-entry { margin-top: 0.85rem; }
.prose h3 + .cv-entry { margin-top: 0.5rem; }
.cv-sub { padding-left: 1.25rem; }

.cv-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.15rem 1.5rem;
}

.cv-role { font-weight: 500; }
.cv-project { font-style: italic; }

.cv-date {
  color: var(--text-mute);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-left: auto;
}

.cv-detail { color: var(--text-mute); font-size: 0.92rem; }
.cv-entry ul { margin-top: 0.35rem; font-size: 0.95rem; }
.cv-cite + .cv-cite { margin-top: 0.35rem; }

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

.site-footer {
  background: var(--band);
  color: var(--band-mute);
  padding: 2.5rem 0;
  font-size: 0.82rem;
}

.footer-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.75rem;
  /* Links left, copyright right on one line; on narrow screens the
     copyright wraps onto its own line below, left-aligned. */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
}

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 52rem) {
  .home-section .wrapper { display: block; }
  .home-section h2 { position: static; margin-bottom: 1.25rem; }
}

@media (max-width: 46rem) {
  html { font-size: 16px; }
  .wrapper, .header-inner, .footer-inner { padding-left: 1.25rem; padding-right: 1.25rem; }
  .hero { padding: 3rem 0 2.75rem; }
  .hero .portrait { width: 96px; height: 96px; }
  .hero .identity { gap: 1.1rem; }
  .content { padding: 2.5rem 0 3rem; }
  .header-inner { align-items: flex-start; flex-direction: column; gap: 0.65rem; }
  .nav { gap: 0.9rem; }
  .home-section { padding: 2.75rem 0; }
  .home-section + .home-section .wrapper { padding-top: 2.75rem; }
}

@media (hover: none) {
  .links a::after { display: none; }
  .links a { padding: 0.35rem 0; }
}

/* --- motion ---------------------------------------------------------------
   Additive only: content is visible by default and the animation merely adds
   an entrance. If it never runs, nothing is stranded at opacity 0.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(12px);
    animation: reveal 700ms var(--ease) forwards;
  }
  .reveal-1 { animation-delay:  70ms; }
  .reveal-2 { animation-delay: 140ms; }
  .reveal-3 { animation-delay: 210ms; }
  .reveal-4 { animation-delay: 280ms; }
}

@keyframes reveal { to { opacity: 1; transform: none; } }
