/* ============================================================
   Michael Patrick Photography — minimal portfolio stylesheet
   ============================================================ */

:root {
  --bg:        #ffffff;
  --fg:        #141414;
  --muted:     #6b6b6b;
  --line:      #e6e6e6;
  --accent:    #141414;
  --maxw:      1400px;
  --gutter:    clamp(1rem, 4vw, 3rem);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --brand: #3d8f83;
}

.name-accent { color: var(--brand); }

/* Display serif for names & titles; sans stays for nav, labels, body. */
.wordmark,
.hero-caption h1,
.album-header h1,
.album-card figcaption .name,
.prose h1 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:    #0e0e0e;
    --fg:    #f2f2f2;
    --muted: #9a9a9a;
    --line:  #262626;
    --accent:#f2f2f2;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }
a:hover { opacity: 0.6; }

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

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

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 2rem var(--gutter);
  border-bottom: 1px solid var(--line);
}

.site-header .wordmark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-nav a[aria-current="page"] { border-bottom: 1px solid currentColor; }

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

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 5rem;
  padding: 2.5rem var(--gutter);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------- Hero (home) ---------- */

.hero {
  position: relative;
  width: 100%;
  height: min(82vh, 900px);
  overflow: hidden;
  background: var(--line);
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero .hero-caption {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(1.5rem, 5vw, 3rem);
  color: #fff;
  text-shadow: 0 1px 20px rgba(0,0,0,0.5);
}

.hero .hero-caption h1 {
  font-family: var(--font-display);
  margin: 0;
  font-size: clamp(1.9rem, 5.5vw, 3.4rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.08;
}

.hero .hero-caption p {
  margin: 0.25rem 0 0;
  font-size: clamp(0.85rem, 2vw, 1rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Section headings ---------- */

.section {
  margin: clamp(3rem, 8vw, 6rem) 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-head a {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Album index grid ---------- */

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(1rem, 2.5vw, 2rem);
}

.album-card figure { margin: 0; }

.album-card .frame {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--line);
}

.album-card .frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.album-card:hover .frame img { transform: scale(1.04); }

.album-card figcaption {
  margin-top: 0.75rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.album-card figcaption .name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.album-card figcaption .count { font-size: 0.8rem; color: var(--muted); }

/* ---------- Photo grid (inside an album + featured) ---------- */

/* Row-major masonry: equal columns, each tile spans a computed number of
   grid rows (see setMasonrySpans in main.js) so reading order stays
   left-to-right, top-to-bottom. Falls back to a plain grid before JS runs. */
.photo-grid {
  --cols: 3;
  --row: 8px;
  --gap: clamp(0.75rem, 2vw, 1.5rem);
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: var(--gap);
  grid-auto-rows: var(--row);
}

@media (max-width: 900px) { .photo-grid { --cols: 2; } }
@media (max-width: 560px) { .photo-grid { --cols: 1; } }

.photo-grid .tile {
  cursor: zoom-in;
  background: var(--line);
  grid-row-end: span 40; /* provisional; JS overwrites once dimensions known */
  overflow: hidden;
}

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

/* ---------- Album header ---------- */

.album-header { margin: 2.5rem 0 2rem; }
.album-header h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.8rem, 4.5vw, 2.7rem);
  font-weight: 500;
}
.album-header p { margin: 0; color: var(--muted); max-width: 48ch; }
.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Text pages (about / contact) ---------- */

.prose {
  max-width: 62ch;
  margin: clamp(3rem, 8vw, 5rem) auto;
}
.prose h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 500;
  margin: 0 0 1.5rem;
}
.prose p { margin: 0 0 1.2rem; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }

/* About page — portrait beside the bio, stacked on narrow screens */
.prose.about { max-width: 780px; }
.about-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: clamp(1.5rem, 5vw, 3rem);
  align-items: start;
}
.about-portrait {
  width: 100%;
  height: auto;
  background: var(--line);
}
.about-text p:last-child { margin-bottom: 0; }

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

.contact-links {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  font-size: 1.05rem;
}
.contact-links li { margin-bottom: 0.6rem; }
.contact-links .label {
  display: inline-block;
  width: 7rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Loading / empty states ---------- */

.state {
  padding: 4rem 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

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

.lb {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10,10,10,0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.lb.open { opacity: 1; pointer-events: auto; }

.lb figure {
  margin: 0;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lb img {
  max-width: 92vw;
  max-height: 84vh;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
}

.lb figcaption {
  margin-top: 0.9rem;
  color: #d8d8d8;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-align: center;
}

.lb button {
  position: absolute;
  background: none;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 1rem;
  opacity: 0.75;
  transition: opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.lb button:hover { opacity: 1; }
.lb .lb-close { top: 0.5rem; right: 0.75rem; font-size: 1.6rem; line-height: 1; }
.lb .lb-prev, .lb .lb-next { top: 50%; transform: translateY(-50%); font-size: 2.5rem; line-height: 1; }
.lb .lb-prev { left: 0.5rem; }
.lb .lb-next { right: 0.5rem; }
.lb .lb-counter {
  position: absolute;
  top: 1rem;
  left: 1rem;
  color: #bdbdbd;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
}

@media (max-width: 560px) {
  .lb .lb-prev, .lb .lb-next { font-size: 1.8rem; padding: 0.5rem; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
