/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:        #f8f7f4;
  --text:      #2a2825;
  --muted:     #6b6560;
  --accent:    #b87457;
  --border:    #e5e2db;
  --white:     #ffffff;

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  --gap:        16px;
  --section-v:  96px;
  --max-w:      1280px;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
}

/* ── Header ── */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.header-identity {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-name {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: var(--text);
}

.header-subtitle {
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

nav {
  display: flex;
  gap: 32px;
}

nav a {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

nav a:hover {
  color: var(--text);
}

/* ── Gallery ── */
#work {
  padding: 64px 24px var(--section-v);
}

#gallery-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  columns: 3 280px;
  column-gap: var(--gap);
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: var(--gap);
  overflow: hidden;
  cursor: zoom-in;
  background: var(--border);
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  transition: opacity 0.3s ease, transform 0.35s ease;
  opacity: 0;
}

.gallery-item img.loaded {
  opacity: 1;
}

.gallery-item:hover img {
  transform: scale(1.025);
}

.gallery-empty {
  font-size: 0.9rem;
  color: var(--muted);
  padding: 48px 0;
  text-align: center;
}

.gallery-empty code {
  font-family: monospace;
  background: var(--border);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ── Sections (About / Contact) ── */
#about,
#contact {
  border-top: 1px solid var(--border);
  padding: var(--section-v) 24px;
}

.section-inner {
  max-width: 620px;
  margin: 0 auto;
}

h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.01em;
  color: var(--text);
  margin-bottom: 32px;
}

.section-inner p {
  font-size: 1rem;
  font-weight: 300;
  color: var(--muted);
  margin-bottom: 1.4em;
}

.section-inner p:last-of-type {
  margin-bottom: 0;
}

/* ── Contact link ── */
.contact-link {
  display: inline-block;
  margin-top: 28px;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.contact-link:hover {
  color: var(--text);
  border-color: var(--text);
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 32px;
  text-align: center;
}

footer p {
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ── Lightbox ── */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lightbox[hidden] {
  display: none;
}

#lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 16, 0.92);
  cursor: zoom-out;
}

#lb-img-wrap {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 1100px);
  max-height: 90dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lb-in 0.22s ease;
}

@keyframes lb-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

#lb-img {
  display: block;
  max-width: 100%;
  max-height: 90dvh;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

#lb-close {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 2;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  transition: color 0.18s ease;
}

#lb-close:hover {
  color: #fff;
}

#lb-prev,
#lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 16px 20px;
  transition: color 0.18s ease;
  user-select: none;
}

#lb-prev { left: 8px; }
#lb-next { right: 8px; }

#lb-prev:hover,
#lb-next:hover {
  color: #fff;
}

#lb-prev:disabled,
#lb-next:disabled {
  opacity: 0.2;
  pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .header-inner {
    padding: 14px 20px;
    gap: 16px;
  }

  nav {
    gap: 20px;
  }

  #work {
    padding: 40px 16px 72px;
  }

  #gallery-grid {
    columns: 2 160px;
    column-gap: 10px;
  }

  .gallery-item {
    margin-bottom: 10px;
  }

  #about,
  #contact {
    padding: 64px 24px;
  }

  #lb-prev { left: 2px; }
  #lb-next { right: 2px; }
}

@media (max-width: 400px) {
  #gallery-grid {
    columns: 1;
  }
}
