/* mattmead.co.uk — single stylesheet */

:root {
  --text: #333;
  --text-strong: #111;
  --muted: #666;
  --rule: #e4e4e4;
  --accent: #d6006f;        /* passes 4.5:1 on white */
  --bg: #fff;
  --measure: 680px;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Crimson Text", Georgia, serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: #a80057; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 72px 24px 96px;
}

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

.site-header { text-align: center; margin-bottom: 48px; }

.site-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(30px, 9vw, 52px);
  line-height: 1.15;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.site-name a { color: var(--accent); text-decoration: none; }

.tagline {
  margin: 12px 0 0;
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #444;
}

.headshot {
  width: 240px;
  height: 240px;
  margin: 0 auto 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #eee;
}

/* ---------- Text ---------- */

p { margin: 0 0 1.1em; }
.lead { font-size: 20px; line-height: 1.55; color: #222; }
.muted { color: var(--muted); font-size: 15px; }
strong { font-weight: 600; color: var(--text-strong); }

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

section {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}

h2 {
  margin: 0 0 20px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 21px;
  line-height: 1.3;
  color: var(--text-strong);
}
h2 + .muted { margin-top: -14px; }

h3 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 17px;
  color: var(--text-strong);
}

/* ---------- Credit rows ---------- */

.credits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.credit { display: flex; justify-content: space-between; gap: 16px; }
.credit .meta { display: block; color: var(--muted); font-size: 15px; }
.credit .year { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.case-link { font-size: 14px; text-decoration: none; margin-left: 6px; white-space: nowrap; }
@media (max-width: 480px) { .credit .case-link { display: inline-block; margin-left: 0; } }
.case-link:hover { text-decoration: underline; }

/* ---------- Accolades ---------- */

.accolades { display: flex; flex-direction: column; gap: 28px; }
.accolades .sub { color: var(--muted); font-size: 15px; }

blockquote {
  margin: 14px 0 8px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  line-height: 1.5;
  color: #222;
}
blockquote cite {
  font-family: var(--sans);
  font-style: normal;
  font-size: 15px;
  color: var(--muted);
}

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

.contact { margin-top: 64px; padding-top: 40px; text-align: center; }
.contact h2 {
  font-size: 15px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #444;
  margin-bottom: 16px;
}
.contact .email {
  display: inline-block;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(18px, 4.6vw, 24px);
  text-decoration: none;
  padding: 8px 0;
}
.contact p { margin: 4px 0 0; color: #555; }

/* ---------- Case study pages ---------- */

.back {
  display: inline-block;
  margin-bottom: 40px;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: #444;
}
.back:hover { color: var(--accent); }

.case-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(30px, 7vw, 42px);
  line-height: 1.15;
  color: var(--text-strong);
}
.case-meta { margin: 0 0 32px; color: var(--muted); font-size: 15px; }

/* Media can run wider than the text column */


.video { position: relative; margin: 0 0 40px; background: #000; aspect-ratio: 16 / 9; }
.video:has(+ .video-caption) { margin-bottom: 8px; }
.video.portrait { width: min(100%, 340px); margin-left: auto; margin-right: auto; }
.video-caption { margin: 0 0 40px; text-align: center; color: var(--muted); font-size: 14px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 40px 0; }
.gallery img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #eee; }
.gallery.scope img { aspect-ratio: 2048 / 858; }
.gallery.single { grid-template-columns: minmax(0, 1fr); }
.gallery.single img { aspect-ratio: auto; }
@media (max-width: 560px) { .gallery { grid-template-columns: minmax(0, 1fr); } }

ul.plain { margin: 0 0 1.1em; padding-left: 1.2em; }
ul.plain li { margin-bottom: 4px; }

dl.people { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; font-size: 16px; }
dl.people dt { color: var(--muted); }
dl.people dd { margin: 0; }
@media (max-width: 480px) {
  dl.people { grid-template-columns: minmax(0, 1fr); gap: 0; }
  dl.people dd { margin-bottom: 10px; }
}

.site-footer { margin-top: 72px; text-align: center; font-size: 15px; color: var(--muted); }
.site-footer a { margin: 0 8px; }

/* ---------- Enlarge stills ---------- */

a.zoom { display: block; cursor: zoom-in; overflow: hidden; }
a.zoom img { transition: transform .3s ease, opacity .3s ease; }
a.zoom:hover img { transform: scale(1.02); opacity: .92; }

dialog.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 56px 72px; border: 0;
  background: rgba(10, 10, 10, .96);
  display: none; align-items: center; justify-content: center;
}
dialog.lightbox[open] { display: flex; }
dialog.lightbox::backdrop { background: rgba(10, 10, 10, .96); }
dialog.lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }

.lightbox button {
  position: absolute; border: 0; background: none; color: #fff;
  font: 300 44px/1 var(--sans); width: 56px; height: 56px; cursor: pointer;
  opacity: .75; border-radius: 50%;
}
.lightbox button:hover, .lightbox button:focus-visible { opacity: 1; background: rgba(255,255,255,.1); outline: none; }
.lb-close { top: 8px; right: 8px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: 16px; left: 0; right: 0; margin: 0; text-align: center; color: #bbb; font-size: 14px; }

@media (max-width: 600px) {
  dialog.lightbox { padding: 56px 0; }
  .lb-prev, .lb-next { top: auto; bottom: 4px; transform: none; }
  .lb-count { bottom: 20px; }
}
@media (prefers-reduced-motion: reduce) { a.zoom img { transition: none; } }

/* ---------- 404 ---------- */
.notfound { text-align: center; }
.notfound h2 { margin-top: 8px; }

/* ---------- Next case study ---------- */
.next-case {
  margin-top: 72px; padding-top: 32px; border-top: 1px solid var(--rule);
  text-align: center;
}
.next-label {
  display: block; margin-bottom: 6px;
  font-family: var(--display); font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
}
.next-case a {
  font-family: var(--display); font-weight: 500; font-size: clamp(20px, 5vw, 26px);
  text-decoration: none; display: inline-block; padding: 6px 0;
}
.next-case a:hover { text-decoration: underline; }
.next-case + .site-footer { margin-top: 40px; }

/* ---------- Case study cards (home) ---------- */
.cases {
  border-top: 0; padding-top: 0;
  margin: 72px calc(50% - min(50vw - 24px, 560px)) 0;
}
.cases-head {
  border-top: 1px solid var(--rule); padding-top: 32px; margin-bottom: 24px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 6px 16px; flex-wrap: wrap;
}
.cases-head h2 { margin: 0; }
.card-grid {
  display: grid; gap: 40px 32px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}
.card { display: block; text-decoration: none; color: inherit; }
.card:hover { color: inherit; }
.card img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #111;
  transition: opacity .3s ease;
}
.card:hover img { opacity: .88; }
.card h3 { margin: 14px 0 0; font-size: 18px; line-height: 1.3; }
.card .arrow { color: var(--accent); font-size: .9em; display: inline-block; transition: transform .2s ease; }
.card:hover .arrow { transform: translateX(4px); }
.card:hover h3 { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.card-meta { margin: 2px 0 0; font-size: 15px; color: var(--muted); }
.card-lead { grid-column: 1 / -1; }
.card-lead img { aspect-ratio: 2048 / 858; }
.card-lead h3 { font-size: 22px; margin: 0; }
.card-row { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; margin-top: 14px; }
.card-award { font-size: 14px; font-weight: 600; letter-spacing: .04em; color: var(--accent); }
@media (max-width: 720px) { .cases { margin-left: 0; margin-right: 0; } }
@media (prefers-reduced-motion: reduce) { .card img, .card .arrow { transition: none; } }

/* Media wider than the text column (declared last so it wins over .video / .gallery margins) */
.video.wide, .gallery.wide { margin-left: calc(50% - min(50vw - 32px, 560px)); margin-right: calc(50% - min(50vw - 32px, 560px)); }
@media (max-width: 720px) { .video.wide, .gallery.wide { margin-left: -24px; margin-right: -24px; } }
