/* ---------- Tokens ---------- */
:root {
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --on-ink: #ffffff;      /* text/icon colour for things sitting on an --ink background */
  --bg: #ffffff;
  --line: #e6e6e6;
  --surface: #f2f2f2;     /* raised UI bits: image placeholders, form fields */
  --serif-display: "Cormorant", "Times New Roman", serif;      /* ≈ orpheus-pro */
  --serif-body: "EB Garamond", "Times New Roman", serif;        /* ≈ adobe-garamond-pro */
  --gutter: clamp(20px, 4vw, 54px);
  --maxw: 1500px;
  color-scheme: light;
}
/* Dark theme: auto by default (prefers-color-scheme), overridable by a
   .theme-toggle click which stamps data-theme and pins it via localStorage —
   see the inline script in <head>. Deliberately NOT touched: the fixed
   #4d4d4d dark backdrop on reel/strips/slideshow sections — a per-project
   photo-display accent carried over from the live site's own design, not
   page chrome, so it stays constant regardless of theme (same logic as why
   the reel arrows stay black-on-#4d4d4d rather than swapping colour).
   Café Clock's off-white grid tint, by contrast, uses var(--surface) rather
   than a fixed hex, so it reads as "a shade off the page background" in
   both directions — slightly darker than white in light mode, slightly
   lighter than near-black in dark mode — instead of staying a fixed pale
   grey that would look like a stark bright patch on a dark page. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ededed;
    --ink-soft: #a8a8a8;
    --on-ink: #121212;
    --bg: #1a1a1a;
    --line: #383838;
    --surface: #242424;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #ededed;
  --ink-soft: #a8a8a8;
  --on-ink: #121212;
  --bg: #1a1a1a;
  --line: #383838;
  --surface: #242424;
  color-scheme: dark;
}

/* ---------- Reset-ish ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: 20px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

h1, h2, h3, h4 {
  font-family: var(--serif-display);
  font-weight: 400;
  line-height: 1.1;
  margin: 0;
  letter-spacing: 0.01em;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 4vw, 60px);
  padding: 34px var(--gutter) 30px;
  max-width: var(--maxw);
  margin: 0 auto;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--serif-display);
  font-size: clamp(24px, 2.4vw, 31px);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand a:hover { text-decoration: none; }
.header-menu { display: flex; align-items: center; gap: clamp(20px, 4vw, 60px); flex-wrap: wrap; }
.main-nav { display: flex; gap: clamp(14px, 1.6vw, 24px); font-size: 21px; }
.main-nav a { padding-bottom: 2px; }
.main-nav a.active { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.social { display: flex; align-items: center; gap: 18px; }
.social a { display: inline-flex; }
/* Icon svg viewBoxes (here and on .theme-toggle below) are cropped tight to
   each glyph's own drawn bounds (Instagram's icon originally had ~17 units
   of empty viewBox margin per side; the moon/sun paths fill nearly all of
   theirs) — so a single shared box size now maps directly to the same
   visual glyph size and left edge for all of them, instead of needing a
   different magic-number size per icon to compensate for mismatched
   padding. */
.social svg { width: 14px; height: 14px; fill: currentColor; display: block; }

/* ---- dark mode toggle: shows a moon when currently light (click for dark),
   a sun when currently dark (click for light) — same not([data-theme="light"])
   pattern as the token overrides above, so it stays in sync with them exactly */
.theme-toggle { background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); display: flex; align-items: center; }
.theme-toggle svg { width: 14px; height: 14px; display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}

/* ---- mobile nav toggle: hidden on desktop, hamburger + fullscreen overlay on mobile ---- */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 7px;
  width: 30px; height: 24px; border: 0; background: none; padding: 0; cursor: pointer; flex-shrink: 0;
  /* Mobile browsers can tint an unstyled <button>'s foreground with the
     system accent colour (shows up as blue) unless both appearance and
     colour are set explicitly — currentColor below is only as reliable as
     this. */
  color: var(--ink); -webkit-appearance: none; appearance: none;
}
.nav-toggle span {
  display: block; width: 100%; height: 1.5px; background: currentColor;
  transition: transform .3s ease; transform-origin: center;
}
/* Hamburger -> X while the menu is open */
body.nav-open .nav-toggle span:first-child { transform: translateY(4.25px) rotate(45deg); }
body.nav-open .nav-toggle span:last-child { transform: translateY(-4.25px) rotate(-45deg); }

/* ---------- Home grid ---------- */
main { padding-bottom: 40px; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(18px, 3vw, 46px);
}
.tile { display: block; }
.tile:hover { text-decoration: none; }
.tile-img { display: block; overflow: hidden; background: var(--surface); }
.tile-img img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1 / 1; transition: transform .6s ease; }
.tile:hover .tile-img img { transform: scale(1.03); }
.tile-title {
  display: block; margin-top: 15px;
  color: var(--ink); font-family: var(--serif-display); font-weight: 400;
  font-size: clamp(19px, 1.8vw, 23px);
  text-align: left;
}

/* ---------- Home bio ---------- */
.home-bio {
  max-width: 620px; margin: clamp(60px, 9vw, 130px) 0 clamp(50px, 7vw, 90px);
  text-align: left;
}
.home-bio p { font-family: var(--serif-display); font-size: clamp(22px, 2.1vw, 28px); line-height: 1.35; margin: 0 0 1em; }
.home-bio .cta a { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }

/* ---------- Project page ---------- */
/* project pages don't use .wrap on <main> — galleries need to bleed full-width;
   .wrap is applied per-block instead (head / quote / nav) */
.project-head { max-width: 820px; margin: clamp(30px, 5vw, 70px) 0 clamp(40px, 5vw, 64px); }
.project-head h1 { font-size: clamp(40px, 6vw, 68px); margin-bottom: .5em; }
.project-head p { font-size: clamp(19px, 1.5vw, 22px); color: var(--ink); margin: 0 0 1em; max-width: 62ch; }
.project-head p:last-child { margin-bottom: 0; }
/* when a project has a head photo (e.g. Travel guidebooks): text + image
   side by side, ~50/50 split matching the live site's measured proportions */
.project-head.has-image {
  max-width: none; display: flex; align-items: flex-start;
  gap: clamp(30px, 5vw, 64px); flex-wrap: wrap;
}
.project-head.has-image .project-head-text { flex: 1 1 480px; max-width: 620px; }
.project-head-img { flex: 1 1 420px; max-width: 570px; width: 100%; height: auto; }
@media (max-width: 680px) { .project-head.has-image { flex-direction: column; } }

/* No gap here — on the live site, sections sit flush against each other
   (measured: 0px between every pair of gallery-sections) and each section's
   own padding is what creates visual spacing. An extra gap here double-counts
   that padding, which is exactly what made the off-white section look
   over-spaced. Non-gallery blocks (quote/text) supply their own margin below. */
.project-sections { display: flex; flex-direction: column; }
/* .wrap's own `margin: 0 auto` is meant for normal block-context centering —
   but as a flex item here, an auto side-margin with an auto (unset) width
   makes it shrink-to-fit its content and center that instead of stretching
   (a flexbox quirk), pulling quote/text sections in from the gutter. Giving
   it a definite width fixes the shrink-to-fit without losing the max-width
   centering itself — width:100% alone would stretch it to the (uncapped)
   full-bleed <main>, drifting from the header/footer's capped, centred
   max-width on wide viewports. min() reproduces the same capped width here. */
.project-sections > .wrap { width: min(100%, var(--maxw)); }
.sec-gallery figure { margin: 0; }
.sec-gallery img { width: 100%; height: 100%; display: block; object-fit: cover; }

/* ---- scroll reveal: fade + slide up as images enter the viewport ---- */
/* Exact values read from the live site's own CSS (@keyframes tmpl-anim-fade-up):
   opacity 0->1, translateY(25px)->0, 800ms, cubic-bezier(.4,0,.2,1). Applied to
   <img> rather than <figure> so it never fights masonry's own transform, which
   positions the figure itself. */
.g-grid img, .g-masonry img, .g-strips img { opacity: 0; transform: translateY(25px); }
.g-grid img.reveal-in, .g-masonry img.reveal-in, .g-strips img.reveal-in {
  animation: reveal-fade-up 800ms cubic-bezier(.4, 0, .2, 1) both;
}
@keyframes reveal-fade-up {
  from { opacity: 0; transform: translateY(25px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .g-grid img, .g-masonry img, .g-strips img { opacity: 1; transform: none; }
  .g-grid img.reveal-in, .g-masonry img.reveal-in, .g-strips img.reveal-in { animation: none; }
}

/* ---- grid: columns + crop ratio set per-instance via --cols / --ar ---- */
/* vertical padding matches the horizontal gutter on the live site (54px at
   1360px wide) — visible whenever a section has bg set, invisible (but present)
   otherwise, so kept consistent across all three gallery kinds below too. */
.g-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: clamp(24px, 2.8vw, 42px); padding: var(--gutter); }
.g-grid figure { aspect-ratio: var(--ar, 1); overflow: hidden; }
@media (max-width: 680px) { .g-grid { grid-template-columns: repeat(min(var(--cols, 3), 2), 1fr); gap: 14px; } }

/* ---- masonry: true shortest-column-first packing, laid out by JS ----
   (the live site positions each item absolutely via JS, not CSS multi-column —
   column-count fills top-to-bottom-per-column in source order, which visibly
   reorders/pairs images differently from real masonry and reads as "wrong"
   spacing; this matches the live behaviour instead) */
.g-masonry { position: relative; padding: var(--gutter); }
.g-masonry figure { position: absolute; margin: 0; top: 0; left: 0; will-change: transform; }
.g-masonry img { height: auto; object-fit: initial; }
.g-masonry:not(.laid-out) { visibility: hidden; }
@media (max-width: 680px) { .g-masonry { padding-left: var(--gutter); padding-right: var(--gutter); } }

/* ---- strips: justified rows, laid out by JS using known aspect ratios ---- */
.g-strips { display: flex; flex-wrap: wrap; gap: clamp(12px, 1.5vw, 22px); padding: var(--gutter); }
.g-strips.dark { background: #4d4d4d; }
.g-strips figure { margin: 0; overflow: hidden; }
.g-strips img { height: 100%; width: 100%; object-fit: cover; }
/* Only zero vertical padding pre-layout (to truly collapse to 0 height) — the
   horizontal padding must stay intact, since gallery.js reads it via
   getComputedStyle to work out how much width is actually available for images. */
.g-strips:not(.laid-out) { visibility: hidden; height: 0; overflow: hidden; padding-top: 0; padding-bottom: 0; }

/* ---- reel: horizontal scrolling filmstrip, loops both directions ---- */
/* items sit flush (0 gap, confirmed on the live site — 4 consecutive item
   pairs measured with exactly 0px between them); height is a near-fixed
   pixel value per instance (like strips' targetHeight), set via --reel-h. */
.g-reel-wrap { position: relative; padding: var(--gutter) 0; }
.g-reel-wrap.dark { background: #4d4d4d; }
.g-reel {
  display: flex; overflow-x: auto; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 0 var(--gutter);
}
.g-reel::-webkit-scrollbar { display: none; }
.g-reel figure { flex: 0 0 auto; height: var(--reel-h, 340px); scroll-snap-align: start; }
.g-reel img { height: 100%; width: auto; object-fit: cover; }
.reel-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 44px; border: 0; cursor: pointer; background: none; padding: 0;
  display: flex; align-items: center; justify-content: center; opacity: .75; transition: opacity .2s;
  color: #000; /* always black, even on the dark backdrop — matches the live site exactly */
}
.reel-btn:hover { opacity: 1; }
.reel-btn svg { width: 28px; height: 28px; }
.reel-btn.prev { left: calc(var(--gutter) - 10px); } .reel-btn.next { right: calc(var(--gutter) - 10px); }
@media (max-width: 680px) { .reel-btn { display: none; } }

/* ---- photo: a single full-bleed, full-viewport-height static image ---- */
.g-photo { height: 100vh; overflow: hidden; }
.g-photo figure { height: 100%; }
.g-photo img { width: 100%; height: 100%; object-fit: cover; }

/* ---- slideshow: fullscreen one-at-a-time, full viewport height ---- */
.g-slideshow {
  position: relative; background: #4d4d4d; height: 100vh;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.g-slideshow figure { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; margin: 0; }
.g-slideshow figure.active { display: flex; }
.g-slideshow img { width: 100%; height: 100%; object-fit: cover; }
.ss-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 44px; border: 0; cursor: pointer; background: none; padding: 0; color: #fff;
  display: flex; align-items: center; justify-content: center; opacity: .75; transition: opacity .2s;
}
.ss-btn:hover { opacity: 1; }
.ss-btn svg { width: 20px; height: 20px; }
.ss-btn.prev { left: calc(var(--gutter) - 10px); } .ss-btn.next { right: calc(var(--gutter) - 10px); }
.ss-dots { position: absolute; bottom: 24px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; z-index: 2; }
.ss-dots button { width: 7px; height: 7px; border-radius: 50%; border: 0; padding: 0; background: rgba(255,255,255,.4); cursor: pointer; }
.ss-dots button.active { background: #fff; }

/* ---- quote block: a true pull-quote (e.g. a press review) ---- */
.sec-quote { max-width: 640px; margin: clamp(50px, 7vw, 90px) auto; text-align: center; }
.sec-quote p { font-family: var(--serif-display); font-size: clamp(24px, 2.6vw, 32px); line-height: 1.3; font-style: italic; margin: 0 0 .6em; }
.sec-quote p.cite { font-family: var(--serif-body); font-size: 17px; font-style: normal; color: var(--ink-soft); }
.sec-quote a, .sec-text a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---- plain text block, optionally with an image below (e.g. a book cover) ---- */
.sec-text { max-width: 820px; margin: clamp(50px, 7vw, 90px) 0; }
.sec-text p { font-size: clamp(19px, 1.5vw, 22px); color: var(--ink); margin: 0 0 1em; max-width: 62ch; }
.sec-text p:last-of-type { margin-bottom: 0; }
.sec-text img { display: block; width: 100%; max-width: 420px; height: auto; margin-top: clamp(24px, 3vw, 40px); }

/* prev / next project */
.project-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin: clamp(60px, 9vw, 120px) auto 20px; gap: 20px;
  font-family: var(--serif-display); font-size: 22px;
}
.project-nav a { display: inline-flex; align-items: center; gap: 12px; }
.project-nav .spacer { flex: 1; }

/* ---------- About ---------- */
.page { max-width: 760px; margin: clamp(30px, 5vw, 70px) 0 clamp(60px, 8vw, 100px); }
.page .lead { font-family: var(--serif-display); font-size: clamp(26px, 2.6vw, 36px); line-height: 1.22; margin-bottom: 1em; }
.page p { margin: 0 0 1em; }
.page h2 { font-size: 30px; margin: 1.6em 0 .4em; }
.page ul { list-style: none; padding: 0; margin: 0; columns: 2; max-width: 460px; }
.page ul li { padding: 3px 0; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(40px, 7vw, 100px); max-width: 1100px; margin: clamp(30px, 5vw, 70px) 0 clamp(60px, 8vw, 100px); }
.contact-intro { font-family: var(--serif-display); font-size: clamp(24px, 2.4vw, 32px); line-height: 1.25; }
.contact-meta { margin-top: 2em; font-size: 19px; }
.contact-meta a { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
form.contact-form label { display: block; margin: 0 0 18px; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
form.contact-form input, form.contact-form textarea {
  display: block; width: 100%; margin-top: 7px; padding: 12px 14px;
  font-family: var(--serif-body); font-size: 18px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 0; background: var(--surface);
}
form.contact-form textarea { min-height: 150px; resize: vertical; }
form.contact-form input:focus, form.contact-form textarea:focus { outline: none; border-color: var(--ink); }
form.contact-form button {
  font-family: var(--serif-display); font-size: 21px; letter-spacing: .02em;
  background: var(--ink); color: var(--on-ink); border: 0; padding: 12px 34px; cursor: pointer;
}
form.contact-form button:hover { opacity: .82; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: clamp(50px, 7vw, 90px);
  padding: 40px var(--gutter);
  max-width: var(--maxw); margin-left: auto; margin-right: auto;
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  font-size: 18px; color: var(--ink-soft);
}
.site-footer a:hover { color: var(--ink); }
.site-footer .foot-social { display: flex; gap: 16px; align-items: center; }
.site-footer svg { width: 24px; height: 24px; fill: currentColor; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  body { font-size: 18px; }
  .site-header { padding: 22px var(--gutter); gap: 14px; }
  .grid { grid-template-columns: 1fr; gap: 32px; }

  /* z-index above .header-menu's overlay (100) — otherwise the fullscreen
     menu paints over the button that's supposed to close it. */
  .nav-toggle { display: flex; position: relative; z-index: 101; }
  .header-menu {
    position: fixed; inset: 0; z-index: 100; background: var(--bg);
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 28px;
    padding: 0 var(--gutter) 0 clamp(40px, 15vw, 72px);
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
  }
  body.nav-open .header-menu {
    opacity: 1; visibility: visible; transform: translateY(0);
    transition: opacity .25s ease, transform .25s ease;
  }
  .header-menu .main-nav { flex-direction: column; gap: 18px; font-size: 34px; }
  .header-menu .social { gap: 24px; }
  body.nav-open { overflow: hidden; }

  /* Menu items cascade in with a fade + slight rise, each one a beat behind
     the last, once the overlay itself is open. */
  body.nav-open .header-menu .main-nav a,
  body.nav-open .header-menu .social a,
  body.nav-open .header-menu .theme-toggle {
    animation: menu-item-in .4s ease both;
  }
  body.nav-open .header-menu .main-nav a:nth-child(1) { animation-delay: .08s; }
  body.nav-open .header-menu .main-nav a:nth-child(2) { animation-delay: .14s; }
  body.nav-open .header-menu .main-nav a:nth-child(3) { animation-delay: .2s; }
  body.nav-open .header-menu .social a { animation-delay: .26s; }
  body.nav-open .header-menu .theme-toggle { animation-delay: .32s; }
  @keyframes menu-item-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @media (prefers-reduced-motion: reduce) {
    body.nav-open .header-menu .main-nav a,
    body.nav-open .header-menu .social a,
    body.nav-open .header-menu .theme-toggle { animation: none; }
  }
}
