/* ============================================================
   CHRIS CORNISH
   ============================================================ */

:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #777777;
  --lightbox-bg: rgba(0, 0, 0, 0.94);
  --page-padding-x: clamp(20px, 4vw, 56px);
  --page-padding-y: clamp(20px, 3vw, 40px);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, system-ui, "Segoe UI", sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

h1, h2, h3 { font-weight: 500; margin: 0; }

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--page-padding-y) var(--page-padding-x);
  gap: 24px;
  flex-wrap: wrap;
}

.site-title {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  gap: clamp(16px, 2vw, 28px);
  font-size: 15px;
}

.site-nav a.active {
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1px;
}

.site-nav a.active:hover { text-decoration: none; }

/* ============================================================
   GALLERY (work / index)
   ============================================================ */

.gallery-wrap {
  padding: clamp(20px, 3vw, 40px) var(--page-padding-x) clamp(60px, 8vw, 96px);
}

/* 3-column masonry on wide screens - matches the original site's rhythm.
   Column-count keeps images at natural aspect ratios.
   Small gaps to keep the grid dense but breathable. */
.gallery {
  column-count: 3;
  column-gap: clamp(8px, 1vw, 16px);
}

.gallery-item {
  margin: 0 0 clamp(8px, 1vw, 16px);
  break-inside: avoid;
  cursor: pointer;
  position: relative;
  /* subtle fade in when the image finishes loading */
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-item:hover img {
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

/* ============================================================
   ABOUT
   Two-column layout: image on the left, all text on the right
   ============================================================ */

.about-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 40px) var(--page-padding-x) clamp(60px, 8vw, 96px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 4vw, 72px);
  align-items: start;
}

.about-image {
  margin: 0;
}

.about-body p {
  margin: 0 0 1em;
}

.about-body p:last-child { margin-bottom: 0; }

.about-section {
  margin-top: clamp(28px, 3vw, 44px);
}

.about-section h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 8px;
}

.about-section p { margin: 0 0 6px; }

.contact {
  margin-top: clamp(28px, 3vw, 44px);
}

.contact p { margin: 0 0 4px; }

/* ============================================================
   LIGHTBOX
   ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  background: var(--lightbox-bg);
  display: none;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 60px);
}

.lightbox.open {
  display: flex;
}

.lightbox-image-wrap {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.lightbox-image {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

.lightbox-caption {
  color: #eee;
  font-size: 14px;
  text-align: center;
  max-width: 720px;
  line-height: 1.4;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  z-index: 10;
}

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

.lightbox-prev { left: clamp(12px, 3vw, 32px); }
.lightbox-next { right: clamp(12px, 3vw, 32px); }

.lightbox-close {
  position: absolute;
  top: clamp(12px, 3vw, 24px);
  right: clamp(12px, 3vw, 32px);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.lightbox-counter {
  position: absolute;
  top: clamp(12px, 3vw, 24px);
  left: clamp(12px, 3vw, 32px);
  color: #eee;
  font-size: 13px;
  z-index: 10;
}

/* body class added when lightbox is open, prevents scroll */
body.lightbox-open { overflow: hidden; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 900px) {
  .gallery { column-count: 2; }

  .lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  /* Stack the about page columns on smaller screens */
  .about-wrap {
    grid-template-columns: 1fr;
  }
}

/* Very small */
@media (max-width: 480px) {
  .gallery { column-count: 1; }
}
