@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400&display=swap');

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

:root {
  --cream: #f7f4ef;
  --warm-white: #faf9f7;
  --text: #2a2520;
  --text-light: #9a9089;
  --accent: #c4a882;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--warm-white);
  color: var(--text);
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-weight: 400;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 2rem 3rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(to bottom, var(--warm-white) 60%, transparent);
}

.contact-link {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-weight: 400;
  font-size: 0.875rem;
  letter-spacing: 0.12em;
  color: #5a5450;
  text-decoration: none;
  text-transform: lowercase;
  text-align: center;
  transition: color 0.3s ease;
}

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

.nav-link {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--text-light);
  text-decoration: none;
  text-transform: lowercase;
  transition: color 0.3s ease;
}

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

.logo-link {
  display: block;
  line-height: 0;
  justify-self: end;
}

.logo {
  height: 96px;
  width: auto;
  object-fit: contain;
}

/* ── Main / Collage ── */
main {
  flex: 1;
  padding: 140px 3rem 4rem;
}

.collage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 340px;
  grid-auto-flow: dense;
  gap: 0.75rem;
  max-width: 1400px;
  margin: 0 auto;
}

.collage-item {
  overflow: hidden;
  animation: fadeUp 0.9s ease both;
}

.collage-item.wide {
  grid-column: span 2;
}

.collage-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 0.5s ease;
  filter: saturate(0.9);
}

@media (hover: hover) {
  .collage-item:hover img {
    transform: scale(1.04);
    filter: saturate(1.1);
  }
}

/* ── Personal portfolio ── */
.personal-collage {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 280px;
  grid-auto-flow: dense;
  gap: 0.75rem;
  max-width: 1400px;
  margin: 0 auto;
}

.personal-item {
  overflow: hidden;
  animation: fadeUp 0.9s ease both;
}

.personal-item:nth-child(3n+1) { animation-delay: 0.05s; }
.personal-item:nth-child(3n+2) { animation-delay: 0.15s; }
.personal-item:nth-child(3n)   { animation-delay: 0.25s; }

.personal-item.wide {
  grid-column: span 2;
}

.personal-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 0.5s ease;
  filter: saturate(0.9);
}

@media (hover: hover) {
  .personal-item:hover img {
    transform: scale(1.04);
    filter: saturate(1.1);
  }
}

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 22, 18, 0.96);
  z-index: 1000;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  cursor: default;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 2.5rem;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: color 0.2s;
  padding: 0.25rem 0.5rem;
}

.lightbox-close:hover {
  color: white;
}

/* ── Footer ── */
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2.5rem 3rem;
  border-top: 1px solid rgba(196, 168, 130, 0.25);
  margin-top: 2rem;
}

.footer-center {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-style: italic;
  font-weight: 400;
  font-size: 1rem;
  color: var(--text-light);
  letter-spacing: 0.03em;
  text-align: center;
}

.footer-center a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.footer-center a:hover {
  color: var(--accent);
  border-color: transparent;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--text-light);
  text-decoration: none;
  text-transform: lowercase;
  transition: color 0.3s ease;
}

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

.footer-link svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.footer-link-right {
  justify-content: flex-end;
}

@media (max-width: 700px) {
  footer {
    flex-direction: column;
    gap: 1.25rem;
    text-align: center;
    padding: 2rem 1.5rem;
  }

  .footer-link-right {
    justify-content: center;
  }
}

/* ── Animations ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  header {
    padding: 1.25rem 1.5rem;
  }

  main {
    padding: 110px 1.5rem 3rem;
  }

  .collage {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 260px;
  }

  .collage-item.wide {
    grid-column: auto;
  }

  .personal-collage {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 220px;
  }

  .personal-item.wide {
    grid-column: auto;
  }
}

@media (max-width: 540px) {
  /* Header: drop email (it's in the footer), nav left / logo right */
  header {
    grid-template-columns: 1fr auto;
    padding: 1rem 1.25rem;
  }

  .contact-link {
    display: none;
  }

  .logo {
    height: 56px;
  }

  main {
    padding: 88px 0.75rem 2.5rem;
  }

  /* Single-column photo grids */
  .collage {
    grid-template-columns: 1fr;
    grid-auto-rows: 240px;
  }

  .personal-collage {
    grid-template-columns: 1fr;
    grid-auto-rows: 220px;
  }

  /* Larger tap target for lightbox close */
  .lightbox-close {
    top: 0.75rem;
    right: 0.75rem;
    font-size: 2rem;
    padding: 0.5rem 0.75rem;
  }
}

/* (aspect-ratio-driven items need no height overrides at 380px) */
