/* ==========================================================================
   Dave's Photos
   Dark slate "gallery wall" so photographs read true. One accent (safelight
   amber) is used only for focus, the current page and the current filter.
   Type: Archivo (variable width, so names can condense and relax) + Newsreader.
   ========================================================================== */

:root {
  --ground: #25282a;
  --ground-deep: #1b1d1f;
  --raised: #303436;
  --bone: #ece9e2;
  --ash: #a4a5a2;
  --line: rgba(236, 233, 226, 0.16);
  --safelight: #f2a640;

  --display: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --text: "Newsreader", Georgia, "Times New Roman", serif;

  --gutter: clamp(16px, 3vw, 40px);
  --header-h: 60px;
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--bone);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

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

.skip {
  position: absolute; left: var(--gutter); top: -60px; z-index: 100;
  background: var(--bone); color: var(--ground-deep);
  font-family: var(--display); font-weight: 600; padding: 10px 16px;
}
.skip:focus { top: 10px; }

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

.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--gutter);
  background: linear-gradient(rgba(27, 29, 31, 0.7), rgba(27, 29, 31, 0));
  transition: background-color 0.3s;
}
.site-header.is-solid {
  background: rgba(37, 40, 42, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--line);
}

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  font-variation-settings: "wdth" 72;
  letter-spacing: 0.005em;
  text-decoration: none;
}

.site-nav { display: flex; gap: clamp(16px, 3vw, 36px); }
.site-nav a {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.975rem;
  text-decoration: none;
  padding-block: 6px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--line); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--safelight); }

/* ---------- Home: collection index over a full-bleed photograph ---------- */

.hero {
  position: relative;
  min-height: 560px;
  height: 100vh; height: 100svh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: calc(var(--header-h) + 24px) var(--gutter) clamp(20px, 4vh, 44px);
  overflow: hidden;
  background: var(--ground-deep);
}
.hero-bg { position: absolute; inset: 0; }
.hero-bg img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0;
  transition: opacity 1.4s ease;
}
.hero-bg img.is-on { opacity: 1; }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to top, rgba(22, 24, 25, 0.82) 0%, rgba(22, 24, 25, 0.35) 55%, rgba(22, 24, 25, 0.5) 100%);
}
.hero > :not(.hero-bg) { position: relative; z-index: 1; }

.hero-intro {
  max-width: 30ch;
  margin-bottom: clamp(12px, 3vh, 32px);
  font-size: clamp(1.1rem, 1.6vw, 1.4rem);
  font-style: italic;
  line-height: 1.4;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.5);
}

.index a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  text-decoration: none;
}
.index .name {
  font-family: var(--display);
  font-weight: 650;
  font-size: clamp(2.6rem, min(11.5vw, 12.5vh), 9.5rem);
  line-height: 0.93;
  letter-spacing: -0.012em;
  font-variation-settings: "wdth" 62;
  transition: font-variation-settings 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.index .count {
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ash);
  white-space: nowrap;
  transition: color 0.4s;
}
.index li { transition: opacity 0.5s; }
.index[data-lit] li { opacity: 0.38; }
.index[data-lit] li.is-lit { opacity: 1; }
.index li.is-lit .name { font-variation-settings: "wdth" 100; }
.index li.is-lit .count { color: var(--bone); }
.index a:focus-visible { outline-offset: 0; }

/* ---------- Generic sections ---------- */

.section { padding: clamp(56px, 9vw, 120px) var(--gutter) 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin-bottom: clamp(18px, 3vw, 32px);
}
.section-head h2 {
  font-family: var(--display); font-weight: 650;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-variation-settings: "wdth" 75;
  line-height: 1;
}

.textlink {
  font-family: var(--display); font-weight: 500; font-size: 0.975rem;
  text-decoration: none; border-bottom: 2px solid var(--line);
  padding-bottom: 2px; white-space: nowrap;
}
.textlink:hover { border-bottom-color: var(--safelight); }

.statement {
  max-width: 30ch;
  font-size: clamp(1.6rem, 3.4vw, 2.7rem);
  line-height: 1.22;
  font-weight: 400;
}
.statement + .textlink { display: inline-block; margin-top: 28px; }

/* ---------- Justified photo grid ---------- */

.grid { display: flex; flex-direction: column; gap: var(--gap, 12px); }
.grid-row { display: flex; gap: var(--gap, 12px); }

.ph {
  position: relative; display: block; flex: none; overflow: hidden;
  border-radius: 6px;
  background: var(--c, var(--raised));
}
/* Lift: each tile grows by 3px on every side (--sx / --sy are set per tile in grid.js),
   then settles back when the pointer leaves. The wider gap above leaves room for it. */
@media (prefers-reduced-motion: no-preference) {
  .ph {
    transition: scale 0.28s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.28s ease;
  }
  .ph:hover, .ph:focus-visible {
    z-index: 2;
    scale: var(--sx, 1.02) var(--sy, 1.02);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  }
}
.ph img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity 0.5s ease;
}
.ph img.is-loaded { opacity: 1; }

.ph .cap {
  position: absolute; inset: auto 0 0 0;
  padding: 36px 12px 10px;
  font-family: var(--display); font-weight: 500; font-size: 0.9rem; line-height: 1.25;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
  opacity: 0; transition: opacity 0.25s;
}
.ph:hover .cap, .ph:focus-visible .cap { opacity: 1; }
@media (hover: none) { .ph .cap { display: none; } }

.empty { padding: 48px 0; color: var(--ash); font-style: italic; }
.grid-sentinel { height: 1px; }

/* ---------- Gallery page ---------- */

.gallery-page { padding: calc(var(--header-h) + clamp(28px, 6vw, 72px)) var(--gutter) 0; }

.gallery-head h1 {
  font-family: var(--display); font-weight: 650;
  font-size: clamp(3.2rem, 12vw, 10rem);
  line-height: 0.92; letter-spacing: -0.012em;
  font-variation-settings: "wdth" 62;
}
.gallery-head .blurb {
  max-width: 44ch; margin-top: 14px;
  font-style: italic; color: var(--ash); font-size: 1.2rem;
}
.gallery-head .tally { margin-top: 6px; color: var(--ash); font-size: 1rem; }

.filters {
  position: sticky; top: var(--header-h); z-index: 20;
  margin: clamp(24px, 4vw, 44px) calc(var(--gutter) * -1) clamp(14px, 2vw, 22px);
  padding: 12px var(--gutter) 14px;
  background: rgba(37, 40, 42, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--line);
}
.coll-nav { display: flex; flex-wrap: wrap; gap: 4px clamp(14px, 2.4vw, 30px); }
.coll-nav a {
  font-family: var(--display); font-weight: 550; font-size: 1.05rem;
  text-decoration: none; padding-block: 4px;
  border-bottom: 2px solid transparent;
  color: var(--ash);
}
.coll-nav a:hover { color: var(--bone); }
.coll-nav a[aria-current="true"] { color: var(--bone); border-bottom-color: var(--safelight); }
.coll-nav small { font-size: 0.78em; font-weight: 400; margin-left: 5px; opacity: 0.75; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tags:empty { display: none; }
.tags a {
  font-family: var(--display); font-size: 0.85rem; font-weight: 500;
  text-decoration: none; padding: 4px 13px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--ash);
}
.tags a:hover { color: var(--bone); border-color: var(--ash); }
.tags a[aria-current="true"] { background: var(--bone); color: var(--ground-deep); border-color: var(--bone); }

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

.page { padding: calc(var(--header-h) + clamp(28px, 6vw, 72px)) var(--gutter) 0; }
.page h1 {
  font-family: var(--display); font-weight: 650;
  font-size: clamp(3.2rem, 12vw, 10rem);
  line-height: 0.92; letter-spacing: -0.012em;
  font-variation-settings: "wdth" 62;
}
.prose { max-width: 38em; margin-top: clamp(24px, 4vw, 48px); font-size: 1.3rem; line-height: 1.65; }
.prose p + p { margin-top: 1.1em; }
.contact { margin-top: clamp(56px, 9vw, 110px); padding-top: 28px; border-top: 1px solid var(--line); }
.contact h2 {
  font-family: var(--display); font-weight: 650;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-variation-settings: "wdth" 75; line-height: 1;
}
.contact p { max-width: 38em; margin-top: 14px; }
.contact .email {
  display: inline-block; margin-top: 18px;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.4rem, 3.4vw, 2.4rem);
  text-decoration: none; border-bottom: 3px solid var(--safelight);
  word-break: break-all;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: clamp(64px, 10vw, 140px);
  padding: 24px var(--gutter) 32px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  color: var(--ash); font-size: 0.95rem;
}
.site-footer a { text-decoration: none; border-bottom: 1px solid var(--line); }
.site-footer a:hover { color: var(--bone); }

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

html.lb-open { overflow: hidden; }

.lb {
  position: fixed; inset: 0; z-index: 200;
  display: grid; grid-template-rows: 56px minmax(0, 1fr) auto;
  background: #101112;
  animation: lb-in 0.22s ease;
}
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }

.lb-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 var(--gutter); }
.lb-count { font-family: var(--display); font-size: 0.9rem; color: var(--ash); font-variant-numeric: tabular-nums; }
.lb-tools { display: flex; gap: 2px; }

.lb-btn, .lb-nav {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: var(--bone);
}
.lb-btn:hover, .lb-nav:hover { background: rgba(236, 233, 226, 0.12); }
.lb-btn svg, .lb-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lb-btn[aria-pressed="true"] { color: var(--safelight); }

.lb-stage { position: relative; min-height: 0; margin-inline: clamp(0px, 5vw, 76px); touch-action: pan-y; }
.lb-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.lb-lo { opacity: 0.55; }
.lb-hi { opacity: 0; transition: opacity 0.3s ease; }
.lb-hi.is-on { opacity: 1; }

.lb-nav { position: absolute; top: 50%; translate: 0 -50%; background: rgba(16, 17, 18, 0.45); }
.lb-prev { left: clamp(4px, 1vw, 12px); margin-left: calc(clamp(0px, 5vw, 76px) * -1); }
.lb-next { right: clamp(4px, 1vw, 12px); margin-right: calc(clamp(0px, 5vw, 76px) * -1); }

.lb-cap { padding: 14px var(--gutter) 20px; text-align: center; min-height: 72px; }
.lb-title { font-family: var(--display); font-weight: 600; font-size: 1.1rem; line-height: 1.3; }
.lb-meta { color: var(--ash); font-style: italic; font-size: 1rem; }

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  :root { --header-h: 54px; }
  body { font-size: 1.05rem; }
  .index .count { font-size: 0.9rem; }
  .wordmark { font-size: 1.1rem; }
  .site-nav { gap: 18px; }
  .site-nav a[href$="#contact"] { display: none; }
  .lb-nav { width: 40px; height: 40px; }
  .lb-prev { margin-left: 0; left: 6px; }
  .lb-next { margin-right: 0; right: 6px; }
  .lb-stage { margin-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
