/* ==========================================================================
   Christina Sun — site stylesheet
   Design system: gallery-white, two faces, an 8px scale, one dark context.
   ========================================================================== */

:root {
  /* Colour */
  --bg: #fbfbf9;
  --ink: #1a1a1a;
  --mute: #6f6e69;               /* 4.9:1 on the background, passes AA at caption size */
  --rule: #e6e5e0;
  --dark: #0e0e0e;
  --selection: #e9e4d6;

  /* Type */
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --track: 0.18em;                 /* letterspacing for uppercase labels */
  --fs-caption: 0.75rem;           /* 12px */
  --fs-nav: 0.75rem;
  --fs-body: 1.0625rem;            /* 17px */
  --fs-title: clamp(2rem, 1.2rem + 2.6vw, 3.5rem);
  --fs-section: clamp(1.75rem, 1rem + 2vw, 2.75rem);

  /* Space (8px scale) */
  --s1: 8px;  --s2: 16px; --s3: 24px; --s4: 32px; --s6: 48px;
  --s5: 40px; --s8: 64px; --s12: 96px; --s16: 128px;

  /* Layout. content-width and frame-max-height are mirrored in
     scripts/photosite/render.py for the <img sizes> attribute. */
  --gutter: 16px;
  --content-width: 1600px;
  --text-width: 65ch;
  --frame-max-height: 88vh;
  --header-height: 64px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html { background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 300;
  font-size: var(--fs-body);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--selection); color: var(--ink); }

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

img { display: block; max-width: 100%; height: auto; }
/* On a phone, a touch that starts a scroll can land on a photograph and
   leave it selected (tinted like selected text) or flash the grey tap
   highlight. Photographs are never meant to be selected; links made of a
   photograph get no tap highlight. Long-press to save still works. */
img { -webkit-user-select: none; user-select: none; }
a:has(img) { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }

figure { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { font-weight: 300; margin: 0; }

.skip-link {
  position: absolute; left: var(--s2); top: -100px;
  padding: var(--s1) var(--s2); background: var(--ink); color: var(--bg);
  font-size: var(--fs-nav); letter-spacing: var(--track); text-transform: uppercase;
}
.skip-link:focus { top: var(--s2); z-index: 100; }

/* Small uppercase label used for nav, tags, eyebrows */
.label, .eyebrow, .tone-tag, .site-nav a, .wordmark, .menu-toggle, .landing-links a, .about-links a {
  font-family: var(--sans);
  font-size: var(--fs-nav);
  font-weight: 400;
  letter-spacing: var(--track);
  text-transform: uppercase;
}

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

.site-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--s3);
  background: rgba(251, 251, 249, 0.82);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}

.wordmark {
  letter-spacing: 0.28em;
  font-weight: 400;
  padding: var(--s2) 0;             /* 44px+ touch target */
}

.site-nav ul { display: flex; gap: var(--s4); }
.site-nav a {
  display: inline-block; padding: var(--s2) 0;
  color: var(--mute);
  transition: color 200ms var(--ease);
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

/* The landing page has no header: the hero carries the wordmark and the
   section links itself, centred inside the scrim. */
.page-landing .site-header { display: none; }

.menu-toggle {
  display: none;
  appearance: none; background: none; border: 0; color: var(--ink);
  padding: var(--s2) 0; cursor: pointer;
}

/* Six section links need about 880px beside the wordmark; below that the
   header folds them into the menu. */
@media (max-width: 880px) {
  .site-header { padding-inline: var(--gutter); }
  .menu-toggle { display: inline-block; }
  .site-nav {
    position: fixed; inset: 0; z-index: 30;
    display: none;
    background: var(--bg);
    padding: calc(var(--header-height) + var(--s6)) var(--gutter) var(--s6);
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a { display: block; padding: var(--s2) 0; font-size: 1rem; color: var(--ink); border: 0; }
  .site-nav a[aria-current="page"] { color: var(--mute); }
  body.menu-open .menu-toggle, body.menu-open .wordmark { position: relative; z-index: 40; }
  body.menu-open { overflow: hidden; }
  /* backdrop-filter makes the header the containing block for the fixed
     overlay, which would clip it to the header's height; drop it while open. */
  body.menu-open .site-header { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
}

/* --------------------------------------------------------------------------
   Main and footer
   -------------------------------------------------------------------------- */

.site-main { flex: 1; padding-inline: var(--gutter); }

.site-footer {
  padding: var(--s8) var(--gutter) var(--s6);
  font-size: var(--fs-caption);
  color: var(--mute);
  text-align: center;
}
.site-footer p { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--s3); }
.site-footer a { display: inline-block; padding: 14px 0; border-bottom: 1px solid var(--rule); transition: border-color 200ms var(--ease), color 200ms var(--ease); }
.site-footer a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* --------------------------------------------------------------------------
   Series page
   -------------------------------------------------------------------------- */

.series-head {
  max-width: var(--text-width);
  margin: var(--s12) auto var(--s12);
  text-align: center;
}
.eyebrow { margin: 0 0 var(--s2); color: var(--mute); }
.eyebrow a { display: inline-block; padding: 14px 0; }
.eyebrow a:hover { color: var(--ink); }
.series-title {
  font-family: var(--serif);
  font-size: var(--fs-title);
  font-weight: 300;
  font-optical-sizing: auto;
  line-height: 1.1;
  letter-spacing: -0.005em;
}
.tone-tag { color: var(--mute); margin: var(--s2) 0 0; }
.series-statement {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-optical-sizing: auto;
  line-height: 1.5;
  color: var(--ink);
  margin: var(--s4) auto 0;
  max-width: 44ch;
}

/* Column layout: one photograph per row, in sequence.
   Width is the content column unless that would push the height past
   --frame-max-height; then the height wins. --ratio is width / height. */
.column {
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(var(--s6), 8vw, var(--s16));
  padding-bottom: var(--s6);
}
.frame {
  width: min(100%, var(--content-width), calc(var(--frame-max-height) * var(--ratio)));
}
.frame a { display: block; }
.frame img, .cover-image img, .about-portrait img {
  width: 100%;
  aspect-ratio: var(--w, 3) / var(--h, 2);
  background: var(--tone, var(--rule));
  opacity: 0;
  transition: opacity 600ms var(--ease);
}
.frame img.is-loaded, .cover-image img.is-loaded, .about-portrait img.is-loaded { opacity: 1; }
.cover-image img, .about-portrait img { aspect-ratio: auto; }
.frame figcaption {
  margin-top: var(--s2);
  font-size: var(--fs-caption);
  color: var(--mute);
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Section index
   -------------------------------------------------------------------------- */

.section-head { max-width: var(--text-width); margin: var(--s12) auto var(--s8); text-align: center; }
.section-title { font-family: var(--serif); font-size: var(--fs-section); font-optical-sizing: auto; line-height: 1.1; }

/* Rows of covers with equal image height: each cover grows in proportion to
   its aspect ratio (--ratio = width / height), so widths differ and heights
   match. Titles hang below and line up across the row. */
.covers { max-width: var(--content-width); margin: 0 auto var(--s8); }
.cover-row { display: flex; align-items: flex-start; gap: 2%; margin-bottom: var(--s8); }
.cover-row-single { justify-content: center; }
.covers-small .cover-row { gap: 1.5%; margin-bottom: var(--s6); }
.cover { flex: 0 0 var(--w, 48%); min-width: 0; }
.cover a { display: block; }
.cover-image {
  display: block; overflow: hidden;
  aspect-ratio: var(--ratio, 1.5);
  background: var(--tone, var(--rule));
}
.cover-image img { width: 100%; height: 100%; object-fit: cover; }
.cover a:hover .cover-image img { opacity: 0.92; }
.cover-title {
  display: block; margin-top: var(--s2);
  font-family: var(--serif); font-size: 1.375rem; font-optical-sizing: auto; line-height: 1.2;
}
.covers-small .cover-title { font-size: 1.125rem; }
.cover .tone-tag { display: block; margin-top: 4px; }
.empty { text-align: center; color: var(--mute); margin: var(--s12) 0; }

@media (max-width: 800px) {
  .cover-row, .covers-small .cover-row { flex-direction: column; gap: var(--s6); margin-bottom: var(--s6); }
  .cover { flex: none; width: 100%; }
}

/* --------------------------------------------------------------------------
   About
   -------------------------------------------------------------------------- */

.about {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: var(--s8);
  max-width: 1100px; margin: var(--s12) auto var(--s8);
}
@media (max-width: 800px) { .about { grid-template-columns: minmax(0, 1fr); gap: var(--s6); margin-top: var(--s6); } }
.about-portrait { align-self: start; }
.about-text { max-width: var(--text-width); }
.prose h1, .prose h2 { font-family: var(--serif); font-size: 1.5rem; font-optical-sizing: auto; line-height: 1.3; margin: 0 0 var(--s4); }
.prose p { margin: 0 0 var(--s3); }
.prose ul { margin: 0 0 var(--s3); }
.prose li { margin-bottom: var(--s1); }
.prose a { border-bottom: 1px solid var(--rule); transition: border-color 200ms var(--ease); }
.prose a:hover { border-bottom-color: var(--ink); }
.prose blockquote { margin: var(--s4) 0; padding-left: var(--s3); border-left: 1px solid var(--rule); color: var(--mute); font-family: var(--serif); }
.about-links { display: flex; flex-wrap: wrap; gap: 0 var(--s3); margin-top: var(--s4); }
.about-links a { display: inline-block; padding: 14px 0; overflow-wrap: anywhere; }

/* --------------------------------------------------------------------------
   Landing: full-viewport crossfading slideshow
   -------------------------------------------------------------------------- */

.page-landing .site-main { padding: 0; }
.page-landing .site-footer { display: none; }
/* The landing page is built as the old Squarespace cover page was, because
   that page fills an iPhone's whole screen in Safari (iOS 26) and the earlier
   layouts here did not.

   The page itself has no height and never scrolls. The show is a box placed
   on the viewport (position: absolute, not fixed: Safari cuts a fixed box off
   at its clock and toolbar). Inside it are two layers of the same size: the
   photographs behind, the words in front. The words layer scrolls by itself
   when the words need more room than the screen has (a phone turned
   sideways), so the photograph stays still behind them.

   As on the Squarespace page, there is no page background, no theme colour,
   no viewport-fit=cover and nothing pinned: it is not known which of these
   Safari reacts to, so none is here. */
html:has(.page-landing), .page-landing { background: none; }
.page-landing { min-height: 0; }
.hero {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  /* shows through for a moment while one photograph fades into the next */
  background: var(--dark);
}
.hero-slides {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: hidden;      /* the slow zoom must not spill past the screen */
}
.hero-slide {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: var(--tone, var(--dark));
  opacity: 0;
  transform: scale(1);
  /* fade out over 1.2s; snap the scale back once invisible */
  transition: opacity 1200ms var(--ease), transform 0s linear 1200ms;
}
.hero-slide.is-active {
  opacity: 1;
  transform: scale(1.035);
  /* fade in over 1.2s; drift from 1.0 to 1.035 across the 5s hold and the
     fade out after it, the same unhurried rate as before the show sped up */
  transition: opacity 1200ms var(--ease), transform 6200ms linear;
}
/* the first slide: visible at once, at its starting scale until painted */
.hero-slide.is-entering { transform: scale(1); transition: none; }

/* The words layer: the same size as the show, scrolling inside itself if the
   words need more room. The wordmark-to-links group is centred in the space
   above the contact line, which sits at the bottom. */
.hero-copy {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  overflow-x: hidden; overflow-y: auto;
  padding-top: max(var(--s6), env(safe-area-inset-top));
  padding-bottom: max(var(--s6), env(safe-area-inset-bottom));
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  display: flex; flex-direction: column; align-items: center;
  text-align: center; color: #fff;
  /* the scrim: a soft radial gradient behind the text only, never the whole frame */
  background: radial-gradient(ellipse 64% 58% at 50% 50%, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.13) 55%, rgba(0, 0, 0, 0) 100%);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.28);
}
.hero-wordmark {
  font-family: var(--sans);
  font-size: clamp(1.25rem, 0.9rem + 2vw, 2.25rem);
  font-weight: 300;
  letter-spacing: 0.38em;
  text-indent: 0.38em;        /* balance the trailing letterspace */
  text-transform: uppercase;
  line-height: 1;
  margin: auto 0 0;
}
.hero-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-optical-sizing: auto;
  font-size: clamp(1.125rem, 1rem + 0.9vw, 1.5rem);
  line-height: 1.45;
  max-width: 34ch;
  margin: var(--s3) auto 0;
  color: rgba(255, 255, 255, 0.92);
}
.hero-nav { margin: var(--s6) 0 auto; }
.hero-nav ul { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s1) var(--s5); }
.hero-nav a {
  display: inline-block; padding: var(--s2) 0;       /* 44px touch target */
  font-family: var(--sans); font-size: 0.8125rem; font-weight: 400;
  letter-spacing: 0.24em; text-indent: 0.24em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid transparent;
  transition: color 200ms var(--ease), border-color 200ms var(--ease);
}
.hero-nav a:hover { color: #fff; border-bottom-color: rgba(255, 255, 255, 0.6); }
@media (max-width: 600px) {
  .hero-nav ul { flex-direction: column; align-items: center; gap: 0; }
  .hero-nav a { padding: 12px 0; }
}
/* A phone turned sideways has about 320px of height. A wider tagline and one
   row of links keep everything on one screen where they fit. */
@media (max-height: 480px) and (min-width: 601px) {
  .hero-tagline { max-width: 52ch; margin-top: var(--s2); font-size: 1.0625rem; }
  .hero-nav { margin-top: var(--s3); }
  .hero-foot { margin-top: var(--s2); }
  .hero-nav ul { gap: 0 clamp(var(--s2), 3vw, var(--s4)); flex-wrap: nowrap; }
  .hero-nav a { letter-spacing: 0.18em; text-indent: 0.18em; }
}

.hero-foot {
  margin: var(--s4) 0 calc(var(--s3) - var(--s6));   /* sits nearer the bottom than the padding would */
  text-shadow: none;
  display: flex; justify-content: center; gap: var(--s3);
  font-size: var(--fs-caption); letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.7);
}
.hero-foot a { display: inline-block; padding: 14px 0; transition: color 200ms var(--ease); }
.hero-foot a:hover { color: #fff; }

/* --------------------------------------------------------------------------
   Grid layout (opt-in per series): justified rows solved at build time
   -------------------------------------------------------------------------- */

.grid { max-width: var(--content-width); margin: 0 auto; padding-bottom: var(--s6); }
.grid-row { display: flex; gap: 0.5%; margin-bottom: 0.5%; }
.frame-grid { flex: 0 0 var(--w); min-width: 0; width: auto; }
.frame-grid img { aspect-ratio: var(--ratio, 1.5); transition: opacity 600ms var(--ease); }
.frame-grid a:hover img.is-loaded { opacity: 0.92; transition: opacity 200ms var(--ease); }
@media (max-width: 800px) {
  .grid-row { flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s2); }
  .frame-grid { flex: 0 0 100%; }
}

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */

.notfound { max-width: var(--text-width); margin: 22vh auto var(--s12); text-align: center; }
.notfound-text { color: var(--mute); margin: var(--s3) auto var(--s6); max-width: 40ch; }
.notfound-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s4); }
.notfound-links a { font-size: var(--fs-nav); font-weight: 400; letter-spacing: var(--track); text-transform: uppercase; color: var(--mute); padding: var(--s2) 0; }
.notfound-links a:hover { color: var(--ink); }

/* --------------------------------------------------------------------------
   Motion: one reveal per element, disabled for reduced motion
   -------------------------------------------------------------------------- */

.reveal { opacity: 0; transform: translateY(8px); transition: opacity 320ms var(--ease), transform 320ms var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .frame img, .cover-image img, .about-portrait img { transition: none; }
  .hero-slide, .hero-slide.is-active { transition: none; transform: none; }
}
.no-js .reveal { opacity: 1; transform: none; }
.no-js .frame img, .no-js .cover-image img, .no-js .about-portrait img { opacity: 1; transition: none; }

/* --------------------------------------------------------------------------
   Lightbox (PhotoSwipe) skin
   -------------------------------------------------------------------------- */

.pswp { --pswp-bg: var(--dark); --pswp-placeholder-bg: var(--dark); --pswp-icon-color: #f2f1ec; --pswp-icon-color-secondary: #0e0e0e; }
.pswp__bg { opacity: 1 !important; }
.pswp__caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: var(--s2) var(--s3) var(--s3);
  text-align: center;
  font-family: var(--sans); font-size: var(--fs-caption); letter-spacing: 0.04em;
  color: #cfcdc6;
  pointer-events: none;
}
.pswp__caption:empty { display: none; }
.pswp__counter { font-family: var(--sans); font-size: var(--fs-caption); letter-spacing: 0.08em; opacity: 0.7; }
