/* Due Friday — shared gallery styles. Every category page uses this file. */

:root {
  --green: #668d28;
  --green-dark: #3f5c16;
  --navy: #172a3a;
  --ink: #1d2730;
  --muted: #5b6770;
  --paper: #ffffff;
  --tile: #eef0f1;
  --row: 120px;   /* target photo height on phones  */
  --maxrow: 480px; /* tallest a photo row may grow (keeps a short last row tidy) */
  --gap: 10px;
}

@media (min-width: 700px) {
  :root { --row: 220px; --maxrow: 380px; --gap: 14px; }   /* bigger rows on tablets/desktops */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Futura", "Century Gothic", "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
}

body:has(dialog[open]) { overflow: hidden; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.site-header { padding-top: 22px; padding-bottom: 6px; }

.back {
  display: inline-block;
  color: var(--green-dark);
  font-weight: 600;
  text-decoration: none;
  padding: 6px 0;
  margin-bottom: 10px;
}
.back:hover { text-decoration: underline; }

h1 {
  color: var(--navy);
  font-size: clamp(2rem, 7vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.05;
}

.tagline {
  color: var(--green);
  font-size: clamp(1.05rem, 3.2vw, 1.4rem);
  margin-top: 6px;
}

.intro {
  color: var(--muted);
  font-size: 1rem;
  margin-top: 10px;
  max-width: 60ch;
}

/* ---------- photo grid (keeps every photo's full shape, in order) ---------- */
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  list-style: none;
  padding: 18px 0 44px;
}

.gallery li {
  /* --r is each photo's width ÷ height, set inline on the <li> */
  flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--row));
  min-width: 0;
  max-width: calc(var(--r) * var(--maxrow));
}

/* Same-shaped photos (like video thumbnails) sit in an even grid instead */
.gallery.uniform {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.gallery.uniform li { max-width: none; }

/* One or two photos: let them fill the width on phones instead of sitting side by side tiny */
@media (max-width: 699px) {
  .gallery.few { --row: 200px; }
}

.gallery a {
  display: block;
  line-height: 0;
  background: var(--tile);
  border-radius: 6px;
  overflow: hidden;
}

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

@media (hover: hover) {
  .gallery img { transition: transform 0.25s ease; }
  .gallery a:hover img { transform: scale(1.03); }
}

.gallery figcaption {
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--muted);
  padding-top: 7px;
}

/* "Watch on YouTube" link under a caption */
.gallery figcaption .watch {
  display: block;
  line-height: 1.35;
  background: none;
  border-radius: 0;
  overflow: visible;
  margin-top: 4px;
  color: var(--green-dark);
  font-weight: 600;
  text-decoration: none;
}
.gallery figcaption .watch:hover { text-decoration: underline; }

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid #e3e6e8;
  padding-top: 22px;
  padding-bottom: 40px;
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer a { color: var(--green-dark); font-weight: 600; }
.site-footer p + p { margin-top: 4px; }

/* ---------- lightbox ---------- */
dialog.lb {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: #fff;
}
dialog.lb::backdrop { background: rgba(12, 22, 32, 0.95); }

.lb-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 14px 22px;
}

.lb-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 190px);
  max-height: calc(100dvh - 190px);
  object-fit: contain;
  border-radius: 4px;
}

.lb-video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 190px);
  max-height: calc(100dvh - 190px);
  border-radius: 4px;
  background: #000;
}
.lb-img[hidden], .lb-video[hidden] { display: none; }

.lb-cap {
  margin-top: 14px;
  max-width: 60ch;
  text-align: center;
  font-size: 1rem;
  line-height: 1.4;
}
.lb-count { margin-top: 6px; font-size: 0.8rem; opacity: 0.65; }

.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.3); }
.lb-btn:focus-visible { outline-color: #fff; }
.lb-btn svg { width: 22px; height: 22px; }

.lb-close { top: 12px; right: 12px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }

@media (max-width: 600px) {
  .lb-prev, .lb-next { top: auto; bottom: 14px; transform: none; }   /* thumb-reach on phones */
  .lb-prev { left: 14px; }
  .lb-next { right: 14px; }
  .lb-inner { padding-bottom: 76px; }
  .lb-img, .lb-video { max-height: calc(100vh - 230px); max-height: calc(100dvh - 230px); }
}

dialog.lb.single .lb-prev,
dialog.lb.single .lb-next,
dialog.lb.single .lb-count { display: none; }

@media (prefers-reduced-motion: reduce) {
  .gallery img { transition: none; }
}

/* ---------- video thumbnail play badge ---------- */
.gallery a[data-video] { position: relative; }
.gallery a[data-video]::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 64px; height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: rgba(23, 42, 58, 0.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 6l10 6-10 6z'/%3E%3C/svg%3E") 54% 50% / 34px no-repeat;
  pointer-events: none;
}

/* ---------- hub of project cards ---------- */
.cards {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
  padding: 18px 0 30px;
}
.card a {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(23, 42, 58, 0.18);
}
.card a:hover { box-shadow: 0 4px 14px rgba(23, 42, 58, 0.25); }
.card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.card h2 { color: var(--navy); font-size: 1.15rem; padding: 12px 14px 2px; }
.card p { color: var(--muted); padding: 0 14px 14px; line-height: 1.4; }

.card { display: flex; }
.card a { width: 100%; }
