/* joshdavy.co.uk
   Palette taken from a bar magnet on a lab bench:
   cool paper, deep ink, and the two pole colours used sparingly. */
:root {
  --paper: #EEF2F4;
  --panel: #FFFFFF;
  --ink: #14213A;
  --steel: #5B6879;
  --line: #C9D2DA;
  --north: #C8322B;
  --south: #2456A6;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Newsreader", Georgia, "Times New Roman", serif;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --measure: 38rem;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.1875rem;
  line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; border-radius: 4px; background: var(--line); }

a { color: var(--south); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--north); }
a:focus-visible, .skip:focus { outline: 3px solid var(--south); outline-offset: 3px; border-radius: 2px; }

h1, h2, .site-name, nav, .footer-name {
  font-family: var(--display);
}

h1 {
  font-size: clamp(2.25rem, 5.4vw, 4.25rem);
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
}

p { margin: 0 0 1rem; max-width: var(--measure); }

.skip {
  position: absolute; left: -999px; top: 0.5rem;
  background: var(--panel); padding: 0.5rem 0.75rem; z-index: 10;
}
.skip:focus { left: 0.5rem; }

/* ---------- header ---------- */
.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 1.25rem var(--gutter);
  position: relative; z-index: 2;
}
.site-name {
  font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none;
}
.site-name:hover { color: var(--ink); }
.site-header ul { list-style: none; display: flex; gap: 1.5rem; margin: 0; padding: 0; }
.site-header nav a {
  color: var(--ink); text-decoration: none; font-size: 1rem; font-weight: 400;
  padding-bottom: 0.2rem; border-bottom: 2px solid transparent;
}
.site-header nav a:hover { border-bottom-color: var(--south); color: var(--ink); }
.site-header nav a[aria-current="page"] { border-bottom-color: var(--north); font-weight: 600; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: min(78vh, 40rem);
  display: flex; align-items: center;
  padding: 3rem var(--gutter) 4rem;
  margin-top: -4.5rem; padding-top: 7.5rem;
}
.field { position: absolute; inset: 0; width: 100%; height: 100%; }
.field-lines path {
  stroke: var(--steel); stroke-width: 1.1; opacity: 0.38;
  stroke-dasharray: 4200; stroke-dashoffset: 4200;
  animation: draw 2.4s cubic-bezier(.3,.6,.2,1) forwards;
}
.field-lines path:nth-child(n+5)  { animation-delay: .12s; }
.field-lines path:nth-child(n+9)  { animation-delay: .24s; }
.field-lines path:nth-child(n+13) { animation-delay: .36s; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.hero-text { position: relative; max-width: 44rem; }
.hero-text p {
  font-size: clamp(1.1875rem, 1.6vw, 1.375rem);
  margin: 1.5rem 0 0; max-width: 32rem;
}

/* ---------- home sections ---------- */
main { padding: 0 var(--gutter) 4rem; }

.intro {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem 4rem; align-items: start;
  padding: 3.5rem 0;
}
.intro figure { margin: 0; }

.topic {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1.5rem 4rem;
  padding: 3rem 0;
  border-top: 1px solid var(--line);
}
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.gallery .wide { grid-column: 1 / -1; }
.gallery img { width: 100%; }
.gallery img:not(.wide) { aspect-ratio: 1; object-fit: cover; }

.onward {
  border-top: 1px solid var(--line); padding-top: 2rem; margin: 0;
  font-family: var(--display); font-weight: 600; font-size: 1.25rem; max-width: none;
}

/* ---------- inner pages ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem;
  padding: 3rem 0 2.5rem;
}
.page-photo { width: clamp(6rem, 14vw, 10rem); aspect-ratio: 1; object-fit: cover; border-radius: 50%; }

.prose.narrow { max-width: var(--measure); padding-bottom: 3rem; }

.project {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1rem 4rem;
  padding: 2.5rem 0;
  border-top: 1px solid var(--line);
}
.project h2 { margin: 0; }
.project-body > img, .project-body > .pair { margin-top: 1.25rem; }
.project-body > img { max-height: 26rem; width: auto; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.video { aspect-ratio: 16 / 9; background: var(--ink); border-radius: 4px; overflow: hidden; }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }

/* publications list (see template in publications/index.html) */
.pubs { padding-left: 1.25rem; }
.pubs li { margin-bottom: 1.25rem; }
.pubs span { display: block; }
.pub-title { font-weight: 500; }
.pub-authors, .pub-venue { color: var(--steel); font-size: 1.0625rem; }
.pub-venue { font-style: italic; }

/* ---------- footer ---------- */
.site-footer {
  background: var(--ink); color: #DCE3EA;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem;
  padding: 2.5rem var(--gutter);
  font-size: 1.0625rem;
  border-top: 4px solid; border-image: linear-gradient(90deg, var(--north) 50%, var(--south) 50%) 1;
}
.site-footer address { font-style: normal; }
.footer-name { font-weight: 600; margin: 0 0 0.25rem; color: #fff; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 0.25rem; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: #fff; text-decoration-thickness: 2px; }
.site-footer a:focus-visible { outline-color: #fff; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  body { font-size: 1.125rem; }
  .hero { min-height: 0; padding-bottom: 3rem; }
  .field { opacity: 0.55; }
  .intro, .topic, .project { grid-template-columns: minmax(0, 1fr); }
  .field { opacity: 0.4; }
  .intro { padding: 2.5rem 0; }
  .pair { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .field-lines path { animation: none; stroke-dashoffset: 0; }
}
