/* =========================================================================
   Kavin Krishnam — Photography Portfolio
   ========================================================================= */

:root {
  --bg: #fbfbfa;
  --ink: #1a1a1a;
  --muted: #b9b9b9;
  --muted-hover: #1a1a1a;
  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --maxw: 1680px;
  --pad: 48px;
  --gap: 10px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

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

/* ---------------------------------------------------------------- header -- */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 30px var(--pad) 24px;
  flex-wrap: wrap;
}

.site-title {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.1;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 26px;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.site-nav a {
  color: var(--ink);
  padding-bottom: 2px;
  transition: opacity 0.2s ease;
}
.site-nav a:hover { opacity: 0.5; }
.site-nav a.active { border-bottom: 1px solid var(--ink); }

/* ----------------------------------------------------------------- main --- */
main { padding: 0 var(--pad) 80px; }

.wrap { max-width: var(--maxw); margin: 0 auto; }

/* ----------------------------------------------------- cover index grid --- */
/* Homepage (4 covers) and Street/Travel sub-index (3 covers) */
.covers {
  display: grid;
  gap: 14px;
  max-width: 1500px;
  margin: 18px auto 0;
}
.covers.cols-2 { grid-template-columns: repeat(2, 1fr); }
.covers.cols-3 { grid-template-columns: repeat(3, 1fr); }

.cover {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #ececec;
}
.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s cubic-bezier(.2,.7,.2,1), filter 0.5s ease;
  filter: brightness(0.86);
}
.cover:hover img { transform: scale(1.04); filter: brightness(0.72); }

.cover .cover-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 18px;
  color: #fff;
  font-size: clamp(1.6rem, 3vw, 3rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 22px rgba(0,0,0,0.45);
  pointer-events: none;
}

/* ------------------------------------------------------ justified grid --- */
#gallery { margin: 8px auto 0; }

.row { display: flex; gap: var(--gap); margin-bottom: var(--gap); }

.tile {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  margin: 0;
  background: #ececec;
  cursor: pointer;
  overflow: hidden;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.6s ease, transform 0.9s cubic-bezier(.2,.7,.2,1);
  opacity: 0;
}
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.03); }

/* ----------------------------------------------------- page title (sub) -- */
.page-heading {
  text-align: center;
  font-size: clamp(1.8rem, 3.4vw, 3rem);
  font-weight: 500;
  margin: 6px 0 22px;
  letter-spacing: 0.01em;
}

/* ----------------------------------------------- bottom text-link nav ----- */
.gallery-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 34px;
  margin: 64px auto 10px;
  max-width: 1100px;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
}
.gallery-footer a {
  color: var(--muted);
  transition: color 0.25s ease;
}
.gallery-footer a:hover { color: var(--muted-hover); }
.gallery-footer a.active { color: var(--ink); font-weight: 600; }

/* --------------------------------------------------------- text pages ----- */
.text-page {
  max-width: 640px;
  margin: 6vh auto 0;
  text-align: center;
}
.text-page h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 500;
  margin: 0 0 26px;
}
.text-page p {
  font-size: 1.4rem;
  line-height: 1.6;
  margin: 0 0 18px;
}
.text-page a.link { border-bottom: 1px solid currentColor; }
.text-page .contact-list { list-style: none; padding: 0; font-size: 1.4rem; line-height: 2; }
.about-photo {
  display: block;
  margin: 38px auto 0;
  max-width: 360px;
  width: 100%;
  height: auto;
}

/* ------------------------------------------------------- contact form ----- */
.contact-title {
  text-align: center;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  font-weight: 500;
  margin: 4vh 0 6vh;
  letter-spacing: 0.01em;
}

.contact-form {
  max-width: 940px;
  margin: 0 auto;
  font-family: var(--sans);
}

.field { margin-bottom: 30px; }

.field > label,
.field-group-label {
  display: block;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 8px;
}
.field .req { color: #8a8a8a; font-size: 0.82rem; }
.field .help {
  font-size: 0.82rem;
  color: #8a8a8a;
  margin: 0 0 10px;
  line-height: 1.45;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form input[type="date"],
.contact-form textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  background: #fcfcfc;
  border: 1px solid #c9c9c9;
  padding: 12px 13px;
  border-radius: 1px;
  outline: none;
  transition: border-color 0.2s ease;
}
.contact-form input:focus,
.contact-form textarea:focus { border-color: #6f6f6f; }
.contact-form textarea { min-height: 150px; resize: vertical; }
.contact-form input[type="date"] { width: auto; min-width: 220px; }

.name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.name-row .sub-label { font-size: 0.82rem; color: #6f6f6f; margin-bottom: 6px; display: block; }
.name-row .sub-label .req { color: #8a8a8a; }

.submit-btn {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: #fff;
  background: #a59f99;
  border: 0;
  padding: 13px 30px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.submit-btn:hover { background: #8d8781; }

.form-note { font-family: var(--sans); font-size: 0.85rem; color: #8a8a8a; margin-top: 16px; }

@media (max-width: 640px) {
  .name-row { grid-template-columns: 1fr; gap: 18px; }
}

/* ----------------------------------------------------------- lightbox ----- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(250, 250, 249, 0.985);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lb.open { display: flex; opacity: 1; }

.lb-img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 10px 60px rgba(0,0,0,0.18);
  user-select: none;
  -webkit-user-drag: none;
}

.lb-btn {
  position: absolute;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--serif);
  line-height: 1;
  opacity: 0.55;
  transition: opacity 0.2s ease;
  user-select: none;
}
.lb-btn:hover { opacity: 1; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 3rem; padding: 18px; }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
.lb-close { top: 14px; right: 22px; font-size: 2.4rem; }
.lb-count {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  opacity: 0.5;
}

/* ---------------------------------------------------------- responsive ---- */
@media (max-width: 820px) {
  :root { --pad: 22px; }
  .site-header { padding-top: 22px; }
  .site-title { font-size: 1.35rem; white-space: normal; }
  .site-nav { font-size: 1rem; gap: 18px; }
  .covers.cols-2, .covers.cols-3 { grid-template-columns: 1fr; }
  .cover { aspect-ratio: 3 / 2; }
  .gallery-footer { font-size: 1.2rem; gap: 12px 24px; }
  .lb-prev, .lb-next { font-size: 2.2rem; padding: 10px; }
}
