/* ==========================================================
   CapturedByMelli — Photography Website
   Palette: Warm beige / cream / earth tones
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Lato:wght@300;400;700&display=swap');

/* ── Variables ── */
:root {
  --bg-primary: #faf7f2;
  --bg-secondary: #f0ebe3;
  --bg-card: #ffffff;
  --text-primary: #2c2c2c;
  --text-secondary: #6b5e50;
  --text-light: #9b8e7e;
  --accent: #8b7355;
  --accent-hover: #725e44;
  --accent-light: #c9b99a;
  --border: #e5ddd3;
  --shadow: rgba(139, 115, 85, 0.08);
  --font-heading: 'Cormorant Garamond', serif;
  --font-body: 'Lato', sans-serif;
  --max-width: 1200px;
  --nav-height: 80px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.7;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

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

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.2;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.4rem, 3vw, 1.8rem); }

p {
  color: var(--text-secondary);
  max-width: 65ch;
}

/* ── Container ── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Navigation ── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 1000;
  background: rgba(250, 247, 242, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.nav.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 2px 20px var(--shadow);
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color 0.3s;
}

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

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary);
  padding: 8px;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 14px 36px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: 1px solid var(--accent);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.btn-sm {
  padding: 8px 20px;
  font-size: 0.72rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Hero ── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--nav-height) 24px 60px;
  background: linear-gradient(160deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, #e8dfcf 100%);
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.hero h1 {
  margin-bottom: 24px;
  font-weight: 300;
  color: var(--text-primary);
}

.hero p {
  font-size: 1.1rem;
  margin-bottom: 40px;
  margin-left: auto;
  margin-right: auto;
}

.hero-ctas {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Sections ── */
.section {
  padding: 100px 0;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-header h2 {
  margin-bottom: 16px;
}

.section-header p {
  margin-left: auto;
  margin-right: auto;
}

.section-label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  font-family: var(--font-body);
}

/* ── Portfolio Grid ── */
.portfolio-grid {
  columns: 3;
  column-gap: 20px;
}

.portfolio-item {
  break-inside: avoid;
  margin-bottom: 20px;
  overflow: hidden;
  border-radius: 4px;
  position: relative;
}

.portfolio-item img {
  width: 100%;
  transition: transform 0.6s ease;
}

.portfolio-item:hover img {
  transform: scale(1.03);
}

.portfolio-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-light);
  font-style: italic;
  grid-column: 1 / -1;
}

/* ── Page Hero (sub-pages) ── */
.page-hero {
  padding: calc(var(--nav-height) + 60px) 0 60px;
  text-align: center;
  background: var(--bg-secondary);
}

.page-hero h1 {
  margin-bottom: 12px;
}

.page-hero p {
  margin-left: auto;
  margin-right: auto;
}

/* ── About ── */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.about-image {
  border-radius: 4px;
  overflow: hidden;
}

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

.about-placeholder {
  width: 100%;
  height: 500px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  border-radius: 4px;
  font-style: italic;
}

.about-text h2 {
  margin-bottom: 24px;
}

.about-text p {
  margin-bottom: 16px;
}

/* ── Contact ── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  max-width: 900px;
  margin: 0 auto;
}

.contact-item {
  margin-bottom: 32px;
}

.contact-item h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.contact-item p,
.contact-item a {
  color: var(--text-secondary);
  font-size: 1rem;
}

.contact-item a:hover {
  color: var(--accent);
}

/* ── Login (View Photos) ── */
.login-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--nav-height) 24px 60px;
  background: linear-gradient(160deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-card {
  background: var(--bg-card);
  padding: 48px;
  border-radius: 8px;
  box-shadow: 0 4px 40px var(--shadow);
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-card h2 {
  margin-bottom: 8px;
}

.login-card > p {
  margin-bottom: 32px;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-btn {
  width: 100%;
  margin-top: 8px;
}

.login-error {
  color: #b34040;
  font-size: 0.85rem;
  margin-top: 16px;
  display: none;
}

.login-error.show {
  display: block;
}

/* ── Gallery (Private) ── */
.gallery-header {
  padding: calc(var(--nav-height) + 40px) 24px 40px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.gallery-header h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin-bottom: 8px;
}

.gallery-meta {
  color: var(--text-light);
  font-size: 0.9rem;
}

.gallery-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.gallery-grid {
  columns: 3;
  column-gap: 16px;
  padding: 40px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 16px;
  cursor: pointer;
  overflow: hidden;
  border-radius: 4px;
  position: relative;
  background: var(--bg-secondary);
}

.gallery-item img {
  width: 100%;
  transition: transform 0.4s ease, opacity 0.4s;
  opacity: 0;
}

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

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

.gallery-item .download-icon {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 1rem;
  color: var(--text-primary);
}

.gallery-item:hover .download-icon {
  opacity: 1;
}

.gallery-item .download-icon:hover {
  background: var(--accent);
  color: #fff;
}

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

.lightbox.active {
  display: flex;
}

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

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.3s;
  padding: 8px;
  line-height: 1;
}

.lightbox-close:hover {
  color: #fff;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 2rem;
  padding: 20px 16px;
  cursor: pointer;
  transition: background 0.3s;
  line-height: 1;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.15);
}

.lightbox-prev { left: 0; }
.lightbox-next { right: 0; }

.lightbox-download {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.9);
  padding: 10px 24px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s;
  border-radius: 2px;
}

.lightbox-download:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-counter {
  position: absolute;
  bottom: 28px;
  left: 24px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
}

/* ── Loading ── */
.loader {
  display: flex;
  justify-content: center;
  padding: 80px 0;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.footer p {
  margin: 0 auto;
  font-size: 0.85rem;
  color: var(--text-light);
}

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

.footer-links a {
  color: var(--text-light);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-links a:hover {
  color: var(--accent);
}

/* ── Divider ── */
.divider {
  width: 40px;
  height: 1px;
  background: var(--accent-light);
  margin: 24px auto;
}

/* ── 404 ── */
.not-found {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.not-found h1 {
  font-size: 6rem;
  color: var(--border);
  margin-bottom: 16px;
}

.not-found p {
  margin-bottom: 32px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav {
    padding: 0 20px;
  }

  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(250, 247, 242, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 32px 0;
    gap: 24px;
    border-bottom: 1px solid var(--border);
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s ease;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }

  .portfolio-grid,
  .gallery-grid {
    columns: 2;
    column-gap: 12px;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .about-placeholder,
  .about-image img {
    height: 350px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .hero-ctas {
    flex-direction: column;
    align-items: center;
  }

  .hero-ctas .btn {
    width: 220px;
  }

  .login-card {
    padding: 32px 24px;
  }

  .gallery-grid {
    padding: 24px 16px;
  }

  .lightbox-nav {
    padding: 16px 12px;
    font-size: 1.5rem;
  }
}

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