@import url('https://fonts.googleapis.com/css2?family=Courier+Prime&family=Homemade+Apple&family=Imbue:opsz,wght@10..100,100..900&display=swap');

/* Not on Google Fonts; self-hosted. */
@font-face {
  font-family: 'High Cruiser';
  src: url('../fonts/high-cruiser.otf') format('opentype');
  font-display: swap;
}

/* Hero title: Halimun by Creatype Studio (1001fonts demo, personal use only;
   commercial licence at creatypestudio.co/halimun). */
@font-face {
  font-family: 'Halimum';
  src: url('../fonts/halimum.otf') format('opentype');
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --ink: #1b1a17;
  --ink-soft: #55524a;
  --line: rgba(27, 26, 23, 0.14);
  --night: #0c0c0b;
  --accent: #e4b923;
  --font-display: 'Imbue', Georgia, serif;
  --font-sans: 'Imbue', Georgia, serif;
  --font-nav: 'High Cruiser', var(--font-sans);
  --gutter: clamp(20px, 5vw, 96px);
  --content-width: 820px;
  --page-max: 1380px;
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-variation-settings: 'opsz' 72;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body > .category-hero,
body > .project-grid,
body > .home-intro,
body > .subproject,
body > .justified-grid,
body > .grid-intro,
body > .closing { flex: 1 0 auto; }

img, video { max-width: 100%; display: block; }

a { color: inherit; }

.home-intro {
  min-height: 115svh; /* the hero video runs 15% past the first screen */
  display: flex;
  flex-direction: column;
}

/* Landing: the video fills the screen below the nav, edge to edge (cropped
   to fit, so a phone shows the part around her). */
.home-hero {
  flex: 1;
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--night);
}

.home-hero video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 38% center; /* she stands left of centre */
}

/* "Lily Mio" over the video: centred, a bit above the middle, wiped in left to right. */
.hero-title {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  margin: 0;
  color: #fff;
  font-family: 'Halimum', 'Homemade Apple', cursive;
  font-weight: normal;
  font-size: clamp(3rem, 10vw, 9rem);
  line-height: 1.4;
  white-space: nowrap;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .25);
  clip-path: inset(-20% 100% -20% -5%);
  animation: hero-write 2.4s ease-in-out .4s forwards;
}

@keyframes hero-write {
  to { clip-path: inset(-20% -5% -20% -5%); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-title { animation: none; clip-path: none; }
}

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

.wordmark {
  font-family: var(--font-nav); /* same as the menu */
  font-size: 1.15rem;
  text-decoration: none;
}

/* ---------- Category pages ---------- */

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 28px;
  padding: 22px var(--gutter);
}

.site-nav-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  font-family: var(--font-nav);
}

.site-nav-links a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.2s ease;
}

/* Photography dropdown; on touch screens the sub-links sit inline instead. */
.has-menu { position: relative; }

.nav-menu {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  position: absolute;
  top: 100%;
  left: -12px;
  z-index: 10;
  min-width: max-content;
  display: none;
}

.nav-menu li { background: var(--paper); padding: 5px 12px; }

.has-menu:hover .nav-menu,
.has-menu:focus-within .nav-menu { display: block; }

@media (hover: none) {
  .nav-menu,
  .has-menu:hover .nav-menu,
  .has-menu:focus-within .nav-menu {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    padding: 6px 0 0;
    font-size: 0.85em;
  }
  .nav-menu li { padding: 0; }
}

/* Burger menu on phones. main.js adds .has-toggle, so without JS the links
   just show. */
.nav-toggle { display: none; }

@media (max-width: 700px) {
  .has-toggle .nav-toggle {
    display: block;
    position: relative;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
  }
  .nav-toggle span,
  .nav-toggle span::before,
  .nav-toggle span::after {
    position: absolute;
    left: 4px;
    width: 24px;
    height: 1.5px;
    background: currentColor;
    transition: transform 0.25s ease, opacity 0.2s ease;
  }
  .nav-toggle span { top: 15px; }
  .nav-toggle span::before,
  .nav-toggle span::after { content: ""; left: 0; }
  .nav-toggle span::before { transform: translateY(-7px); }
  .nav-toggle span::after { transform: translateY(7px); }
  .open .nav-toggle span { background: transparent; }
  .open .nav-toggle span::before { transform: rotate(45deg); background: currentColor; }
  .open .nav-toggle span::after { transform: rotate(-45deg); background: currentColor; }

  .has-toggle .site-nav-links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    gap: 14px;
    padding: 12px 0 8px;
    font-size: 1.1rem;
  }
  .has-toggle.open .site-nav-links { display: flex; }
  .has-toggle .nav-menu,
  .has-toggle .has-menu:hover .nav-menu,
  .has-toggle .has-menu:focus-within .nav-menu {
    position: static;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 0 0 18px;
    font-size: 0.85em;
  }
  .has-toggle .nav-menu li { padding: 0; }
}

.site-nav-links a:hover,
.site-nav-links a:focus-visible,
.site-nav-links a[aria-current='page'] { border-color: currentColor; }

.category-hero {
  width: min(var(--page-max), calc(100% - 2 * var(--gutter)));
  margin: clamp(28px, 5vw, 64px) auto 0;
}

.category-hero img,
.category-hero video { width: 100%; height: auto; }

.category-intro {
  width: min(690px, calc(100% - 2 * var(--gutter)));
  text-align: center;
  margin: clamp(20px, 4vw, 32px) auto 0;
  font-size: 0.98rem;
  color: var(--ink-soft);
}

.subproject {
  padding-top: clamp(40px, 6vw, 88px);
  width: min(var(--page-max), calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
}

/* Text is secondary, like benrichards.co: a quiet centred block after the photos. */
.subproject h1,
.subproject h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.25rem, 1.8vw, 1.6rem);
  max-width: 760px;
  margin: 0 auto 0.6em;
  text-align: center;
}

.subproject .caption {
  max-width: 760px;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 1.3vw, 1.2rem);
  line-height: 1.7;
  margin: 0 auto;
  text-align: center;
  white-space: pre-line;
}

.stagger-grid + h1,
.stagger-grid + h2 { margin-top: clamp(64px, 9vw, 140px); }

/* Photo spreads after benrichards.co: a 12-column grid, one big and one small
   image per row (sized by orientation, never cropped), the second one dropped
   a little lower. */
.stagger-grid {
  display: grid;
  row-gap: clamp(72px, 11vw, 180px);
  max-width: 1100px;
  margin-inline: auto;
}

/* Project photos as justified rows (benrichards.co/travel): photos keep
   their shape, every photo in a row has the same height, and rows fill the
   width. Each .strip is one of the client's "a+b+c" groups and never splits;
   groups pack onto rows near --h tall, and every row (the last too) fills
   the width. --a is a photo's aspect ratio, --r a
   group's total and --n its photo count. */
.strips {
  --w: min(1920px, calc(100vw - 2 * clamp(16px, 2vw, 48px)));
  --g: clamp(8px, 1.4vw, 28px);
  --h: clamp(150px, 16vw, 320px);
  width: var(--w);
  margin-inline: calc((100% - var(--w)) / 2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--g);
}

.strip {
  display: flex;
  gap: var(--g);
  min-width: 0;
  /* Grow factors are scaled by 1000: a line whose factors add up to less
     than 1 (one portrait) would otherwise only take part of its space. */
  flex: calc(var(--r) * 1000) calc(var(--r) * 1000) calc(var(--r) * var(--h) + (var(--n) - 1) * var(--g));
}

.strip img { flex: calc(var(--a) * 1000) 1 0%; min-width: 0; height: auto; }

/* A lone number fills a row of its own (so does a merged run of them, see
   MERGE_SINGLES in build-pages.py); a portrait one is kept under 85vh
   tall, so it is narrower than the other rows. */
.strip--solo { flex: 0 0 100%; justify-content: center; }
.strip--solo img:only-child { flex: 0 1 auto; width: 100%; }
.strip--solo img.tall:only-child { max-width: calc(var(--a) * 85vh); }

.row--full img,
.row--full video { width: 100%; height: auto; }

.row--split {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(12px, 2vw, 30px);
  row-gap: 28px;
  align-items: start;
  --stagger: clamp(24px, 4.5vw, 68px);
}

.row--split img,
.row--split video,
.project-card img { width: 100%; height: auto; }

@media (min-width: 701px) {
  .row--split > * { grid-row: 1; }
  .row--split > .wide { --span: 7; }
  .row--split > .tall { --span: 4; }
  .row--split > .wide + .wide { --span: 4; }
  .row--split > .wide + .tall,
  .row--split > .tall:has(+ .wide) { --span: 3; }
  .row--split > .tall:has(+ .tall) { --span: 6; }
  .row--split > .tall + .tall { --span: 5; }

  .row--split > :first-child { grid-column: 1 / span var(--span); }
  .row--split > :last-child { grid-column: span var(--span) / -1; margin-top: var(--stagger); }
  .row--split.reverse > :first-child { grid-column: span var(--span) / -1; }
  .row--split.reverse > :last-child { grid-column: 1 / span var(--span); }
  /* Every third row pulls its first photo one column in from the edge. */
  .row--split.inset > :first-child { grid-column: 2 / span var(--span); }
  .row--split.inset.reverse > :first-child { grid-column: span var(--span) / 12; }
  /* Numbered cards (homepage): a reverse row drops its first card on the left
     instead of moving it right, so 3 stays before 4. */
  .row--split.reverse.ordered > :first-child:not(:only-child) { grid-column: 1 / span var(--span); margin-top: var(--stagger); }
  .row--split.reverse.ordered > :last-child:not(:only-child) { grid-column: span var(--span) / -1; margin-top: 0; }
  .row--split > :only-child { grid-column: 1 / -1; justify-self: center; width: 42%; margin-top: 0; } /* a lone item, centred */
}

@media (max-width: 700px) {
  .row--split > * { grid-column: 1 / -1; }
  .row--split > .tall { grid-column: 1 / span 9; }
  .row--split > .tall + .tall { grid-column: 4 / -1; }
  .row--split > .tall:only-child { grid-column: 2 / span 10; } /* a lone portrait video, centred */
  /* Project cards stack full width on phones, no staggering. */
  .project-grid .row--split > .project-card.project-card { grid-column: 1 / -1; margin-top: 0; }
  /* One gap between every stacked card, inside a row and between rows. */
  .project-grid { display: flex; flex-direction: column; row-gap: 56px; }
  /* A plain column, not a grid: grid rows size from the images' natural
     height and leave uneven space below portrait cards. */
  .project-grid .row--split { display: flex; flex-direction: column; align-items: stretch; row-gap: 56px; }
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .stagger-grid img,
    .stagger-grid video {
      animation: photo-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 70%;
    }
  }
}

@keyframes photo-in { from { opacity: 0; } }

.project-grid {
  width: min(var(--page-max), calc(100% - 2 * var(--gutter)));
  margin: clamp(40px, 6vw, 88px) auto 0;
}

.project-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.project-card h2 {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: clamp(1.25rem, 1.8vw, 1.6rem);
  color: var(--ink);
  letter-spacing: 0.01em;
  margin: 0.9em 0 0;
}

.back-link {
  width: min(var(--page-max), calc(100% - 2 * var(--gutter)));
  margin: clamp(20px, 4vw, 32px) auto 0;
  font-size: 0.92rem;
}

.back-link a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.back-link a:hover,
.back-link a:focus-visible { color: var(--ink); border-color: var(--accent); }

.grid-intro {
  width: min(680px, calc(100% - 2 * var(--gutter)));
  margin: clamp(28px, 5vw, 56px) auto 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.7;
}

.justified-grid {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(3px, 0.6vw, 8px);
  width: min(1600px, calc(100% - 2 * var(--gutter)));
  margin: clamp(28px, 5vw, 56px) auto 0;
}

.grid-item {
  margin: 0;
  overflow: hidden;
}

.grid-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-facade {
  position: relative;
  cursor: pointer;
  background: var(--night);
}

.video-facade img { width: 100%; opacity: 0.9; }

.video-facade .play-btn {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.8);
  background: rgba(12,12,11,0.35);
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.video-facade iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

.closing {
  width: min(var(--page-max), calc(100% - 2 * var(--gutter)));
  margin: clamp(64px, 10vw, 140px) auto 0;
}

.closing img { width: 100%; height: auto; }

.closing-caption {
  text-align: center;
  color: var(--ink-soft);
  font-family: var(--font-display);
  margin: 24px 0 0;
}

.site-footer {
  margin-top: clamp(48px, 8vw, 96px);
  padding: 22px var(--gutter);
  text-align: center;
  background: var(--night);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}


/* ---------- About (homepage) ---------- */

.about {
  margin-top: clamp(72px, 11vw, 180px);
  padding: clamp(64px, 10vw, 140px) var(--gutter);
  background: #f6f5f1;
}

.about + .site-footer { margin-top: 0; }
.site-nav + .about { margin-top: 0; }

/* After the client's reference: a narrow block, script heading, photo left,
   typewriter text beside it (first paragraph at the top, the rest at the
   bottom). */
.about h2,
.about-body {
  max-width: 900px;
  margin-inline: auto;
}

.about h2 {
  font-family: 'Homemade Apple', cursive;
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin-bottom: clamp(28px, 4vw, 56px);
}

.about-body {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  column-gap: 16px;
  row-gap: 24px;
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
}

.about-body p { margin: 0 0 1em; }
.about-body p:last-child { margin-bottom: 0; }
.about-body img { width: 100%; height: auto; }

@media (min-width: 701px) {
  /* A portrait photo gets a narrower column so it isn't too tall. */
  .about-body:has(> img.tall) { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .about-body img { grid-row: 1 / 3; }
  .about-text { align-self: end; }
}

@media (max-width: 700px) {
  .about-body { grid-template-columns: 1fr; }
}

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

.contact {
  padding: clamp(48px, 8vw, 96px) var(--gutter);
  background: #f6f5f1;
  text-align: center;
  color: var(--ink-soft);
}

.about + .contact { padding-top: 0; }
.contact + .site-footer { margin-top: 0; }
.subproject + .contact { margin-top: clamp(72px, 11vw, 180px); }

.contact h2 {
  font-family: 'Homemade Apple', cursive;
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--ink);
  margin: 0 0 0.6em;
}

.contact p { margin: 0; }

/* ---------- Lightbox ---------- */

.lightbox-trigger { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(10, 10, 9, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 56px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox[hidden] { display: flex; pointer-events: none; }
.lightbox.is-open { opacity: 1; pointer-events: auto; }
.lightbox.is-open[hidden] { display: flex; }

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: clamp(18px, 3vw, 36px);
  right: var(--gutter);
  appearance: none;
  background: none;
  border: 0;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox { transition: none; }
}
