/* ============================================
   Peter Nunnery — Artist Portfolio
   Clean, contemporary, gallery-focused
   Light / Eggshell variant
   ============================================ */

:root {
  --color-bg: #f6f4f0;
  --color-bg-alt: #edeae4;
  --color-text: #2a2825;
  --color-text-muted: #6b6560;
  --color-text-dim: #9a948e;
  --color-accent: #8a7e70;
  --color-dark: #1a1816;
  --color-white: #ffffff;
  --color-border: #ddd8d0;
  --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-logo: 'Playfair Display', Georgia, serif;
  --nav-height: 72px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  font-weight: 300;
  overflow-x: hidden;
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover { color: var(--color-dark); }

/* ---- Container ---- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 60px);
}

.container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 60px);
}

/* ---- Navigation ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-height);
  background: rgba(246, 244, 240, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), background var(--transition);
}

.nav.scrolled {
  border-bottom-color: var(--color-border);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 60px);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: 'Marcellus', serif;
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--color-dark);
  text-decoration: none;
}

.nav-logo:hover { color: var(--color-dark); }

.nav-links {
  list-style: none;
  display: flex;
  gap: clamp(24px, 3vw, 48px);
}

.nav-link {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  transition: color var(--transition);
}

.nav-link:hover { color: var(--color-dark); }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 28px;
  height: 20px;
  position: relative;
  z-index: 1001;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--color-dark);
  position: absolute;
  left: 0;
  transition: var(--transition);
}

.nav-toggle span:first-child { top: 4px; }
.nav-toggle span:last-child { bottom: 4px; }

.nav-toggle.active span:first-child {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.nav-toggle.active span:last-child {
  bottom: 50%;
  transform: translateY(50%) rotate(-45deg);
}

/* ---- Hero ---- */
.hero {
  width: 100%;
  padding-top: var(--nav-height);
  background: var(--color-bg);
}

.hero-image {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(20px, 4vw, 60px);
}

.hero-image img {
  width: 100%;
  height: auto;
  display: block;
}

.hero-info {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px clamp(20px, 4vw, 60px) clamp(40px, 5vw, 64px);
}

.hero-info .painting-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 400;
  font-style: italic;
  color: var(--color-text-muted);
}

.hero-info .painting-detail {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--color-text-dim);
  margin-top: 2px;
}

/* ---- Sections ---- */
.section {
  padding: clamp(80px, 10vw, 140px) 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--color-dark);
  margin-bottom: 8px;
}

.section-subtitle {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-text-dim);
  margin-bottom: clamp(40px, 5vw, 64px);
}

/* ---- Gallery (grid fallback for drawings) ---- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: clamp(16px, 2vw, 24px);
}

.gallery-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--color-white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow var(--transition);
}

.gallery-item:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ---- Editorial Layout (paintings) ---- */
.editorial {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 4vw, 48px);
}

.editorial .gallery-item {
  box-shadow: none;
  background: transparent;
}

/* Full-width pieces */
.ed-full {
  width: 100%;
}

.ed-full img {
  width: 100%;
  height: auto;
}

/* Pair — two side by side */
.ed-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(16px, 2vw, 24px);
}

.ed-pair .gallery-item img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Asymmetric — large + small */
.ed-asym {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: clamp(16px, 2vw, 24px);
  align-items: start;
}

.ed-asym-reverse {
  grid-template-columns: 1fr 1.6fr;
}

.ed-asym-large img,
.ed-asym-small img {
  width: 100%;
  height: auto;
}

/* Triple — three across */
.ed-triple {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: clamp(16px, 2vw, 24px);
}

.ed-triple .gallery-item img {
  width: 100%;
  height: auto;
}

/* Pull quotes between groups */
.ed-quote {
  padding: clamp(32px, 5vw, 64px) clamp(40px, 8vw, 120px);
  text-align: center;
}

.ed-quote p {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.5vw, 2rem);
  font-weight: 300;
  font-style: italic;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Editorial captions — below image */
.ed-caption {
  padding: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ed-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  font-style: italic;
  color: var(--color-text);
}

.ed-info {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--color-text-dim);
}

/* Full-width pieces get slightly larger captions */
.ed-full .ed-title {
  font-size: 1.3rem;
}

.ed-full .ed-info {
  font-size: 0.85rem;
}

/* Hover captions for grid-style galleries (drawings) */
.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 16px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gallery-item:hover .gallery-caption {
  opacity: 1;
}

.gallery-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  color: #ffffff;
  font-style: italic;
}

.gallery-info {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.7);
}

/* Drawings gallery — slightly smaller grid */
.gallery-drawings {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* ---- About ---- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: clamp(40px, 6vw, 80px);
  align-items: start;
}

.artist-statement p {
  font-family: var(--font-sans);
  font-size: clamp(0.9rem, 1.2vw, 1rem);
  font-weight: 300;
  line-height: 1.85;
  color: var(--color-text);
  margin-bottom: 1.4em;
}

.artist-statement p:last-child { margin-bottom: 0; }

.about-image img {
  width: 100%;
  object-fit: cover;
}

/* ---- Contact ---- */
.contact-content {
  text-align: center;
}

.contact-content p {
  font-size: 1rem;
  font-weight: 300;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.contact-email {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 400;
  color: var(--color-dark);
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 4px;
  transition: border-color var(--transition);
}

.contact-email:hover {
  border-bottom-color: var(--color-accent);
  color: var(--color-dark);
}

.social-links {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  gap: 24px;
}

.social-links a {
  color: var(--color-text-dim);
  transition: color var(--transition);
}

.social-links a:hover { color: var(--color-dark); }

/* ---- Footer ---- */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--color-border);
}

.footer p {
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--color-text-dim);
  text-align: center;
  text-transform: uppercase;
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: default;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
}

.lightbox-info {
  margin-top: 16px;
  text-align: center;
}

.lightbox-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-style: italic;
  color: #ffffff;
}

.lightbox-detail {
  display: block;
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.6);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: color var(--transition);
  z-index: 2001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  color: #ffffff;
}

.lightbox-close {
  top: 24px;
  right: 32px;
  font-size: 2.5rem;
  font-weight: 200;
  line-height: 1;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  font-weight: 200;
  padding: 20px;
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

/* ---- Mobile ---- */
@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-image {
    order: -1;
    max-width: 400px;
  }
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    background: var(--color-bg);
    flex-direction: column;
    padding: calc(var(--nav-height) + 40px) 40px 40px;
    gap: 32px;
    transform: translateX(100%);
    transition: transform var(--transition);
    border-left: 1px solid var(--color-border);
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-link {
    font-size: 0.9rem;
    letter-spacing: 0.15em;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
  }

  .gallery-drawings {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .gallery-caption {
    opacity: 1;
    padding: 16px 12px 12px;
  }

  /* Editorial mobile — pairs go single column, triples go 2-up */
  .ed-pair {
    grid-template-columns: 1fr;
  }

  .ed-asym,
  .ed-asym-reverse {
    grid-template-columns: 1fr;
  }

  .ed-triple {
    grid-template-columns: 1fr 1fr;
  }

  .ed-quote {
    padding: 24px 20px;
  }

  .lightbox-prev,
  .lightbox-next {
    font-size: 2rem;
    padding: 10px;
  }

  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: 1fr;
  }

  .gallery-drawings {
    grid-template-columns: repeat(2, 1fr);
  }

  .ed-triple {
    grid-template-columns: 1fr;
  }
}

/* ---- Animations ---- */
@media (prefers-reduced-motion: no-preference) {
  .gallery-item {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
  }

  .gallery-item:nth-child(1) { animation-delay: 0.05s; }
  .gallery-item:nth-child(2) { animation-delay: 0.1s; }
  .gallery-item:nth-child(3) { animation-delay: 0.15s; }
  .gallery-item:nth-child(4) { animation-delay: 0.2s; }
  .gallery-item:nth-child(5) { animation-delay: 0.25s; }
  .gallery-item:nth-child(6) { animation-delay: 0.3s; }

  @keyframes fadeInUp {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
