/* ============================================================
   1729 Photography — styles
   Minimal, image-forward portfolio. Light + dark aware.
   ============================================================ */

/* ---- Design tokens ------------------------------------------------ */
:root {
  --bg: #fbfbfa;
  --bg-alt: #f2f1ee;
  --fg: #16150f;
  --fg-soft: #55534c;
  --fg-faint: #8a887f;
  --line: #e2e0da;
  --accent: #16150f;
  --overlay: rgba(12, 12, 11, 0.94);
  --card-shadow: 0 1px 2px rgba(0,0,0,.05), 0 10px 30px rgba(0,0,0,.06);
  --maxw: 1240px;
  --gap: clamp(10px, 1.4vw, 20px);
  --header-h: 64px;
  --serif: "Cormorant Garamond", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0c;
    --bg-alt: #161615;
    --fg: #f2f1ec;
    --fg-soft: #b8b6ad;
    --fg-faint: #7d7b73;
    --line: #26261f;
    --accent: #f2f1ec;
    --overlay: rgba(0, 0, 0, 0.95);
    --card-shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 34px rgba(0,0,0,.5);
  }
}

/* ---- Reset / base ------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 4vw, 44px); }

/* ---- Header / nav ------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.55rem;
  letter-spacing: .06em;
  line-height: 1;
  display: inline-flex; align-items: baseline; gap: .5ch;
}
.brand .brand-sub {
  font-family: var(--sans);
  font-size: .62rem; font-weight: 500; letter-spacing: .34em;
  text-transform: uppercase; color: var(--fg-faint);
}
.nav { display: flex; align-items: center; gap: clamp(14px, 2vw, 30px); }
.nav a {
  font-size: .82rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-soft); padding: 6px 0; position: relative; font-weight: 500;
  transition: color .18s ease;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
  background: var(--fg); transform: scaleX(0); transform-origin: left;
  transition: transform .22s ease;
}
.nav a:hover { color: var(--fg); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--fg); }

.nav-toggle { display: none; width: 40px; height: 40px; margin-right: -8px; position: relative; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  content: ""; position: absolute; left: 9px; width: 22px; height: 1.6px;
  background: var(--fg); transition: transform .25s ease, opacity .2s ease;
}
.nav-toggle span { top: 19px; }
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }
.nav-open .nav-toggle span { background: transparent; }
.nav-open .nav-toggle span::before { transform: translateY(6px) rotate(45deg); }
.nav-open .nav-toggle span::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 760px) {
  .nav-toggle { display: block; z-index: 60; }
  .nav {
    /* .site-header has backdrop-filter, which makes it the containing block
       for this fixed element — so size the overlay explicitly to the viewport. */
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh; height: 100dvh;
    flex-direction: column; justify-content: center; gap: 26px;
    background: var(--bg);
    transform: translateY(-100%); opacity: 0; pointer-events: none;
    transition: transform .32s ease, opacity .32s ease;
  }
  .nav-open .nav { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav a { font-size: 1.15rem; letter-spacing: .1em; }
}

/* ---- Hero --------------------------------------------------------- */
.hero {
  position: relative; height: min(88vh, 820px); min-height: 440px;
  display: flex; align-items: flex-end;
  overflow: hidden; background: var(--bg-alt);
}
.hero img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.6) 0%, rgba(0,0,0,.12) 42%, rgba(0,0,0,.28) 100%);
}
.hero-inner { position: relative; z-index: 2; color: #fff; padding-bottom: clamp(34px, 6vw, 72px); }
.hero-title {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.8rem, 9vw, 6.2rem); line-height: .95; margin: 0;
  letter-spacing: .02em; text-shadow: 0 2px 30px rgba(0,0,0,.4);
}
.hero-tagline {
  margin: .7rem 0 0; font-size: clamp(.78rem, 1.6vw, .98rem);
  letter-spacing: .28em; text-transform: uppercase; color: rgba(255,255,255,.92);
  font-weight: 500;
}

/* ---- Section scaffolding ----------------------------------------- */
.section { padding: clamp(48px, 8vw, 104px) 0; }
.section-head { margin-bottom: clamp(24px, 4vw, 46px); }
.eyebrow {
  font-size: .72rem; letter-spacing: .3em; text-transform: uppercase;
  color: var(--fg-faint); font-weight: 600; margin: 0 0 .6rem;
}
.section-title {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.02; margin: 0;
  letter-spacing: .01em;
}
.lead { color: var(--fg-soft); max-width: 60ch; font-size: 1.06rem; }

/* ---- Collection cards (home) ------------------------------------- */
.collections {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 900px) { .collections { grid-template-columns: repeat(4, 1fr); } }
.card {
  position: relative; display: block; overflow: hidden; border-radius: 3px;
  background: var(--bg-alt); aspect-ratio: 3 / 4;
}
.card img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .7s cubic-bezier(.2,.7,.2,1), filter .5s ease;
  filter: brightness(.92);
}
.card:hover img { transform: scale(1.05); filter: brightness(.7); }
.card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,0) 55%);
}
.card-label {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 18px 20px; color: #fff;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.card-label .name {
  font-family: var(--serif); font-size: 1.7rem; font-weight: 500; letter-spacing: .02em;
}
.card-label .count { font-size: .72rem; letter-spacing: .18em; opacity: .85; }

/* ---- Gallery (masonry) ------------------------------------------- */
.gallery-head { padding: clamp(40px, 7vw, 88px) 0 clamp(20px, 3vw, 34px); }
.gallery {
  column-count: 3; column-gap: var(--gap); padding-bottom: clamp(48px, 8vw, 96px);
}
@media (max-width: 900px) { .gallery { column-count: 2; } }
@media (max-width: 560px) { .gallery { column-count: 1; } }
.tile {
  break-inside: avoid; margin: 0 0 var(--gap); width: 100%;
  display: block; overflow: hidden; background: var(--bg-alt); border-radius: 2px;
  position: relative; line-height: 0;
}
.tile img {
  width: 100%; height: auto;
  transition: transform .6s cubic-bezier(.2,.7,.2,1), opacity .6s ease, filter .4s ease;
  opacity: 0;
}
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.03); filter: brightness(1.06); }
.tile::after {
  content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
  pointer-events: none;
}

/* ---- About / Contact --------------------------------------------- */
.prose { max-width: 62ch; }
.prose p { margin: 0 0 1.2rem; color: var(--fg-soft); font-size: 1.1rem; }
.prose p:first-of-type { color: var(--fg); font-size: 1.22rem; }

.contact-grid { display: grid; gap: clamp(30px, 5vw, 64px); grid-template-columns: 1fr; }
@media (min-width: 820px) { .contact-grid { grid-template-columns: 1fr 1fr; align-items: start; } }

.form { display: grid; gap: 16px; max-width: 520px; }
.field { display: grid; gap: 6px; }
.field label {
  font-size: .74rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--fg-faint); font-weight: 600;
}
.field input, .field textarea {
  font: inherit; color: var(--fg); background: var(--bg-alt);
  border: 1px solid var(--line); border-radius: 3px; padding: 12px 14px;
  transition: border-color .18s ease, background .18s ease;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--fg-soft);
  background: color-mix(in srgb, var(--bg-alt) 60%, var(--bg));
}
.btn {
  justify-self: start; margin-top: 4px;
  background: var(--accent); color: var(--bg);
  padding: 13px 30px; border-radius: 3px; font-weight: 600;
  font-size: .82rem; letter-spacing: .14em; text-transform: uppercase;
  transition: opacity .18s ease, transform .18s ease;
}
.btn:hover { opacity: .86; }
.btn:active { transform: translateY(1px); }
.form-note { font-size: .86rem; color: var(--fg-faint); }
.form-status { font-size: .95rem; margin: 4px 0 0; min-height: 1.2em; }
.form-status.ok { color: #2e7d54; }
.form-status.err { color: #c0392b; }

/* ---- Footer ------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line); padding: 44px 0;
  color: var(--fg-faint); font-size: .84rem;
}
.site-footer .wrap {
  display: flex; flex-wrap: wrap; gap: 14px 28px;
  align-items: center; justify-content: space-between;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-nav a { color: var(--fg-soft); letter-spacing: .06em; }
.footer-nav a:hover { color: var(--fg); }
.footer-brand { font-family: var(--serif); font-size: 1.1rem; letter-spacing: .08em; color: var(--fg-soft); }

/* ---- Lightbox ----------------------------------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: var(--overlay);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .28s ease;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lb-figure { margin: 0; max-width: 94vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center; }
.lb-img {
  max-width: 94vw; max-height: 86vh; width: auto; height: auto; object-fit: contain;
  box-shadow: 0 20px 70px rgba(0,0,0,.6); border-radius: 2px;
  opacity: 0; transition: opacity .3s ease;
}
.lb-img.loaded { opacity: 1; }
.lb-counter { color: rgba(255,255,255,.75); font-size: .78rem; letter-spacing: .2em; margin-top: 16px; }
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(255,255,255,.08);
  transition: background .18s ease; z-index: 2;
}
.lb-btn:hover { background: rgba(255,255,255,.2); }
.lb-prev { left: clamp(8px, 3vw, 34px); }
.lb-next { right: clamp(8px, 3vw, 34px); }
.lb-btn svg { width: 22px; height: 22px; }
.lb-close {
  position: absolute; top: 18px; right: 18px; width: 46px; height: 46px;
  border-radius: 50%; color: #fff; background: rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center; z-index: 2;
  transition: background .18s ease;
}
.lb-close:hover { background: rgba(255,255,255,.2); }
@media (max-width: 640px) {
  .lb-btn { width: 44px; height: 44px; }
  .lb-img { max-height: 78vh; }
}

/* ---- Utility ------------------------------------------------------ */
.center { text-align: center; }
.mt-l { margin-top: clamp(28px, 5vw, 56px); }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--fg); color: var(--bg);
  padding: 8px 14px; z-index: 200;
}
.skip-link:focus { left: 8px; top: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .tile img { opacity: 1; }
}
