/* ============ Tokens: change the background colour here ============ */
:root {
  /* phone safe areas (clock/battery bar, home indicator); 0 elsewhere */
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --bg: #f3e5df;          /* soft blush */
  --ink: #2b2220;
  --ink-soft: #2b222099;
  --font: "Instrument Serif", "Times New Roman", serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif; /* small text only */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* photo grid: tile width, column gap, vertical gap */
  --w: 19vw;
  --g: 4.4vw;
  --v: .8vw;
  --h: calc(var(--w) * 3 / 2);
  --cols: 5;

  /* placeholder tones, used until real photos are added */
  --t1: #e6d2c8; --t2: #dcc6bb; --t3: #e9dbd2; --t4: #d6c2b8; --t5: #e2cfc4;
}
@media (max-width: 900px) { :root { --w: 26vw; --g: 6vw; --cols: 4; } }
@media (max-width: 560px) { :root { --w: 40vw; --g: 7vw; --v: 2vw; --cols: 3; } }

@view-transition { navigation: auto; types: page; }
html:active-view-transition-type(page)::view-transition-old(root) { animation: page-out .45s cubic-bezier(0.76, 0, 0.24, 1) both; }
html:active-view-transition-type(page)::view-transition-new(root) { animation: page-in .8s cubic-bezier(0.16, 1, 0.3, 1) .1s both; }
@keyframes page-out { to { opacity: 0; transform: translateY(-24px); } }
@keyframes page-in { from { opacity: 0; transform: translateY(24px); } }

/* a clicked photo grows into the viewer */
::view-transition-group(photo) { animation-duration: .75s; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
::view-transition-old(photo), ::view-transition-new(photo) { height: 100%; object-fit: cover; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.25rem/1.15 var(--font);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* clip, not hidden: hidden turns the body into its own scroller on iOS */
}
a { color: inherit; text-decoration: none; }
img { display: block; }
button { font: inherit; color: inherit; text-transform: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
::selection { background: var(--ink); color: var(--bg); }

/* ============ Top link: ABOUT on the work page, WORK on About ============ */
.toplink {
  position: fixed; top: calc(16px + var(--sat)); left: 50%; z-index: 40;
  transform: translateX(-50%);
  font-size: clamp(1.5rem, 2.4vw, 2.1rem); line-height: 1;
  padding: 4px 6px;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em;
  text-decoration-color: transparent;
  transition: text-decoration-color .3s;
}
.toplink:hover { text-decoration-color: currentColor; }

/* viewer close cross */
.viewer__close { position: absolute; top: calc(14px + var(--sat)); left: 50%; z-index: 40; width: 36px; height: 36px; margin-left: -18px; }
.viewer__close::before, .viewer__close::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 24px; height: 1.5px; margin: -0.75px 0 0 -12px;
  background: var(--ink);
}
.viewer__close::before { transform: rotate(45deg); }
.viewer__close::after { transform: rotate(-45deg); }

/* ============ Centred name ============ */
.name {
  position: fixed; inset: 0; z-index: 0; margin: 0;
  display: grid; place-items: center; text-align: center; padding: 0 16px;
  font-size: clamp(2.8rem, 6vw, 5.4rem); line-height: .95; letter-spacing: -0.015em; font-weight: 400;
  pointer-events: none;
}
.name > span { display: block; }
@media (max-width: 560px) { .name > span { max-width: var(--w); } }
.name .w { display: inline-block; overflow: hidden; padding-bottom: .14em; margin-bottom: -.14em; vertical-align: top; }
.name .c { display: inline-block; transform: translateY(110%) rotate(6deg); transform-origin: left bottom; }
body.is-ready .name .c { transform: none; transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1) calc(.2s + var(--i) * 45ms); }

/* ============ Checkerboard photo grid ============ */
.grid {
  position: relative; z-index: 1;
  list-style: none; margin: 0; padding: calc(72px + var(--sat)) 0 0;
  display: grid; justify-content: center;
  grid-template-columns: repeat(var(--cols, 5), var(--w));
  grid-auto-rows: calc(var(--h) + var(--v));
  column-gap: var(--g);
  width: 100vw;
}
.grid__item {
  grid-row: var(--row); grid-column: var(--col);
  align-self: center;
  translate: 0 calc(var(--drift, 0px) + var(--par, 0px));
}
.grid__item button { display: block; width: 100%; }
.grid__item .media {
  width: 100%; aspect-ratio: 2 / 3;
  opacity: 0; transform: translateY(40px);
  transition: opacity 1s var(--ease), transform 1.2s var(--ease), filter .5s;
}
.grid__item[data-shape="landscape"] .media { aspect-ratio: 3 / 2; }
.grid__item.is-in .media { opacity: 1; transform: none; }
.grid__item.is-hidden { display: none; }
@media (hover: hover) {
  .grid__item.is-in .media { transition: opacity 1s var(--ease), transform .8s var(--ease); }
  .grid__item.is-in button:hover .media { transform: scale(1.05); }
}
/* intro: photos wait while the page drifts through their colours */
.grid { transition: opacity 1s var(--ease); }
.is-intro .grid { opacity: 0; }

.media { object-fit: cover; background: var(--tone, var(--t1)); }
div.media { display: block; }

/* ============ Viewer ============ */
.viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background-color: var(--bg);
  color: var(--ink);
  transition: background-color .9s var(--ease);
}
.viewer[open] { animation: fade .45s var(--ease); }
/* Photo-tinted backgrounds (the viewer, and the About page from the portrait).
   Colour photos: their dominant colour, kept light enough for the text but with its hue pushed.
   Black and white photos: a neutral grey following the photo's own tone, stretched so moody
   photos go deeper and bright ones lighter, never too dark for the text. */
.is-tinted { --tint: color-mix(in oklch, var(--vbg) 65%, var(--bg)); }
.is-grey { --tint: color-mix(in oklch, var(--vbg) 45%, #e9e9e9); }
@supports (color: oklch(from red l c h)) {
  .is-tinted { --tint: oklch(from var(--vbg) 0.83 clamp(0.045, calc(c * 1.5), 0.11) h); }
  .is-grey { --tint: oklch(from var(--vbg) clamp(0.7, calc(0.3 + l * 0.85), 0.92) 0 0); }
}
.is-tinted, .is-grey { background-color: var(--tint); }
body { transition: background-color .8s var(--ease); }
.viewer::backdrop { background: transparent; }
.viewer__figure {
  margin: 0; height: 100%;
  display: grid; grid-template-rows: 1fr auto; justify-items: center;
  padding: calc(72px + var(--sat)) 16px calc(20px + var(--sab)); pointer-events: none;
}
.viewer__media { min-height: 0; height: 100%; width: 100%; display: grid; place-items: center; }
.viewer__media .media {
  max-width: 100%; max-height: 100%; width: auto; height: 100%;
  animation: rise .7s var(--ease);
}
.viewer__media div.media { aspect-ratio: var(--ratio); height: auto; max-height: 100%; width: min(100%, calc((100dvh - 140px) * var(--ratio))); }
.viewer__media img.media { width: auto; height: auto; max-height: calc(100dvh - 150px); object-fit: contain; }
.viewer figcaption {
  width: 100%; display: flex; justify-content: center; padding-top: 16px;
  font: 500 .8125rem var(--sans); letter-spacing: .04em; font-variant-numeric: tabular-nums;
}
.viewer__half { position: absolute; top: 0; bottom: 0; width: 50%; }
.viewer__half--prev { left: 0; cursor: w-resize; }
.viewer__half--next { right: 0; cursor: e-resize; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.viewer.is-morphing[open], .viewer.is-morphing .media { animation: none; }

/* ============ "View" cursor over photos ============ */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none;
  width: 78px; height: 78px; margin: -39px 0 0 -39px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font: italic 1.15rem var(--font);
  scale: 0; transition: scale .5s cubic-bezier(0.16, 1, 0.3, 1);
}
.cursor.is-on { scale: 1; }
.has-cursor .grid__item button { cursor: none; }

/* ============ About page ============ */
.about {
  position: relative; z-index: 1;
  max-width: 980px; margin: 0 auto; padding: calc(120px + var(--sat)) 16px calc(160px + var(--sab));
  text-align: center;
  font-size: clamp(1.45rem, 2.7vw, 2.3rem); line-height: 1.2;
}
.about p { margin: 0 0 1.15em; }
.about__portrait { display: block; width: min(260px, 55vw); height: auto; aspect-ratio: 3 / 4; margin: 0 auto 64px; object-fit: cover; }
.about__section { margin-top: 112px; }
.about__section h2 { margin: 0 0 1.2em; font-size: .65em; font-style: italic; opacity: .55; font-weight: 400; }
.about__lede { font-size: clamp(2.2rem, 4.6vw, 3.8rem); line-height: 1.02; letter-spacing: -0.015em; max-width: 14em; margin-inline: auto !important; }
.about__text { max-width: 30em; margin: 2.2em auto 0; font-size: .72em; line-height: 1.45; }

/* testimonials: two quotes side by side, opening mark hanging above */
.quotes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3.5rem; text-align: left; }
.quote { margin: 0; }
.quote blockquote { position: relative; margin: 0; font-style: italic; font-size: .85em; line-height: 1.3; }
.quote blockquote::before {
  content: "“"; display: block; height: .5em; margin-bottom: .1em;
  font-size: 3.2em; line-height: 1; font-style: normal; opacity: .35;
}
.quote figcaption { margin-top: 1.2em; font: 500 .8125rem var(--sans); letter-spacing: .02em; opacity: .6; }
@media (max-width: 760px) { .quotes { grid-template-columns: 1fr; gap: 2.5rem; } }
.about__email { font-size: clamp(1.75rem, 5vw, 4rem); line-height: 1; word-break: break-word; }
.about__email:hover, .about a.u:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .12em; }

/* ============ CV page ============ */
.cv {
  --rule: #2b222024;
  position: relative; z-index: 1;
  max-width: 1180px; margin: 0 auto; padding: calc(120px + var(--sat)) 24px calc(160px + var(--sab));
}
.cv a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .15em; }

/* letterhead */
.cv__head { text-align: center; padding-bottom: 72px; border-bottom: 1px solid var(--rule); }
.cv__eyebrow { margin: 0 0 .8em; font-style: italic; opacity: .55; }
.cv__head h1 { margin: 0; font-weight: 400; font-size: clamp(3rem, 8.5vw, 7.75rem); line-height: .9; letter-spacing: -0.025em; }
.cv__role { margin: .45em 0 1.5em; font-style: italic; font-size: clamp(1.35rem, 2.2vw, 1.85rem); }
.cv__meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; row-gap: .3em; font-size: 1.15rem; }
.cv__meta li + li::before { content: "·"; margin: 0 .8em; opacity: .45; }

/* sections: sticky label left, content right */
.cv__section {
  display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr; gap: 0 4rem;
  padding: 72px 0; border-bottom: 1px solid var(--rule);
}
.cv__section h2 {
  position: sticky; top: calc(88px + var(--sat)); align-self: start; margin: 0;
  font-weight: 400; font-size: clamp(1.6rem, 2.4vw, 2.2rem); line-height: 1.05;
}
.cv__section h2 i { display: block; margin-bottom: .7em; font: 500 .8125rem var(--sans); opacity: .5; letter-spacing: .06em; }
.cv__body { max-width: 46rem; font-size: 1.25rem; line-height: 1.45; }
.cv__body p { margin: 0 0 1em; }
.cv__lede { font-size: clamp(1.6rem, 2.6vw, 2.2rem); line-height: 1.2; }

/* dated entries */
.cv__entry {
  display: grid; grid-template-columns: 9.5rem 1fr; gap: 0 2rem;
  padding: 28px 0; border-top: 1px solid var(--rule);
}
.cv__entry:first-child { border-top: 0; padding-top: 0; }
.cv__when { margin: 0 !important; padding-top: .45em; font: 400 .875rem var(--sans); opacity: .6; font-variant-numeric: tabular-nums; }
.cv__entry h3 { margin: 0; font-weight: 400; font-size: clamp(1.45rem, 2.2vw, 1.9rem); line-height: 1.15; }
.cv__where { margin: .2em 0 0 !important; font-style: italic; opacity: .65; font-size: 1.15rem; }
.cv__entry ul { list-style: none; margin: 1em 0 0; padding: 0; display: grid; gap: .45em; font: 400 .9375rem/1.55 var(--sans); opacity: .82; }
.cv__entry li { position: relative; padding-left: 1.25em; }
.cv__entry li::before { content: "–"; position: absolute; left: 0; opacity: .4; }
@media (hover: hover) {
  .cv__entry.is-in { transition: opacity .4s, transform 1.2s var(--ease); }
  .cv__entries:has(.cv__entry:hover) .cv__entry.is-in:not(:hover) { opacity: .4; }
}

/* strengths */
.cv__skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2.4rem 3rem; max-width: none; }
.cv__skills h3 { margin: 0 0 .25em; font-weight: 400; font-style: italic; font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1; }
.cv__skills p { margin: 0; opacity: .8; }

/* fundraising figures */
.cv__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 48px; }
.cv__stats strong { display: block; font-weight: 400; font-size: clamp(3rem, 7vw, 6rem); line-height: .9; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cv__stats span { display: block; margin-top: .7em; font: 400 .875rem var(--sans); opacity: .6; }

.cv__contact { border-bottom: 0; }
.cv__email { display: inline-block; margin-bottom: .45em; font-size: clamp(1.8rem, 4.4vw, 3.6rem); line-height: 1; word-break: break-word; }

@media (max-width: 760px) {
  .cv { padding-inline: 16px; }
  .cv__section { grid-template-columns: 1fr; padding: 56px 0; }
  .cv__section h2 { position: static; margin-bottom: 32px; }
  .cv__entry { grid-template-columns: 1fr; }
  .cv__when { padding: 0 0 .3em; }
  .cv__skills, .cv__stats { grid-template-columns: 1fr; }
}

.corner {
  position: fixed; bottom: calc(16px + var(--sab)); z-index: 5;
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
}
.corner:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .15em; }

/* series picker, bottom left of the work page */
.series { display: flex; gap: 1.1em; font: 500 .8125rem var(--sans); letter-spacing: .04em; }
.series button { opacity: .45; transition: opacity .3s; padding: 6px 0; }
.series button:hover, .series button[aria-pressed="true"] { opacity: 1; }
.series button[aria-pressed="true"] { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .35em; }

/* 404 */
.lost { min-height: 100svh; display: grid; place-content: center; gap: .6em; text-align: center; padding: 0 16px; }
.lost h1 { margin: 0; font-weight: 400; font-size: clamp(2.8rem, 6vw, 5.4rem); line-height: .95; letter-spacing: -0.015em; }
.lost a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .15em; }
.corner--l { left: 16px; }
.corner--r { right: 16px; }

[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 1s var(--ease), transform 1.2s var(--ease); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; transition-delay: 0s !important; }
  .grid__item .media, [data-reveal], .name .c { opacity: 1 !important; transform: none !important; }
  .grid__item { translate: none; }
}

/* soft fade at the top of every page (and the bottom of About and CV) so content slips under the top link and corners */
body::before, body:has(.about, .cv)::after {
  content: ""; position: fixed; left: 0; right: 0; z-index: 4; pointer-events: none;
}
/* the top fade runs up under the phone's clock and battery (viewport-fit=cover), solid there so
   nothing scrolls visibly behind the status bar */
body::before { top: 0; height: calc(72px + var(--sat)); }
body:has(.about, .cv)::after { bottom: 0; height: calc(72px + var(--sab)); }
body::before { background: linear-gradient(var(--tint, var(--bg)) calc(var(--sat) + 26px), transparent); }
body:has(.about, .cv)::after { background: linear-gradient(transparent, var(--tint, var(--bg)) calc(100% - var(--sab) - 26px)); }

/* Lenis base styles (inlined from lenis@1.1.13/dist/lenis.css) */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}

