/* ---------------------------------------------------------
   Simple static portfolio site — no build step, no plugins.
   Edit colors/fonts here; edit photos in js/images.js.
--------------------------------------------------------- */

:root{
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #767676;
  --line: #e7e7e7;
  --max-width: 1400px;
  --header-h: 96px;
}

*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

a{ color: inherit; text-decoration: none; }
a:hover{ opacity: 0.65; }

/* ---------- Header ---------- */

.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 28px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.site-title{
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
}

.site-logo-img{
  display: block;
  height: 56px;
  width: auto;
  max-width: 280px;
  object-fit: contain;
}

.site-nav{
  display: flex;
  gap: 28px;
}

.site-nav a{
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}

.site-nav a.active,
.site-nav a:hover{
  color: var(--fg);
  opacity: 1;
}

.site-nav a.active{
  font-weight: 700;
}

.nav-toggle{
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span{
  display: block;
  height: 1px;
  width: 100%;
  background: var(--fg);
}

/* ---------- Category tabs ---------- */

.category-tabs{
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 24px 28px 0;
}

.category-tab{
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 18px;
  cursor: pointer;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.category-tab:hover{ opacity: 1; color: var(--fg); }

.category-tab.active{
  background: var(--fg);
  border-color: var(--fg);
  color: #fff;
}

/* ---------- Gallery grid (masonry) ---------- */

/* This is a CSS Grid, not CSS multi-column. Multi-column masonry
   (column-count) always fills one column completely top-to-bottom before
   moving to the next, which visually reorders items (item #2 lands BELOW
   item #1, not beside it) compared to the admin panel's plain left-to-
   right, top-to-bottom list. A grid keeps items in that same left-to-
   right, top-to-bottom (row-major) reading order while JS (js/gallery.js)
   gives each item a computed row-span so the packed "masonry" look is
   preserved — see calculateSpan()/layoutMasonry() there. */

.gallery{
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.gallery-grid{
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  /* A small grid-auto-rows unit keeps the row-span rounding (in
     js/gallery.js's calculateSpan()) close to the image's real height, so
     the vertical gap between rows stays visually close to the 6px
     column-gap instead of rounding up to a much coarser step. */
  grid-auto-rows: 1px;
  column-gap: 6px;
  row-gap: 6px;
}

@media (min-width: 640px){
  .gallery-grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px){
  .gallery-grid{ grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px){
  .gallery-grid{ grid-template-columns: repeat(4, 1fr); }
}

.gallery-item{
  /* Placeholder span until js/gallery.js measures the loaded image and
     sets the real grid-row-end span; keeps roughly the old 180px min-height
     look before that happens. */
  grid-row-end: span 27;
  /* <figure> has a browser-default margin (1em 40px) — zero it out, or
     grid items shrink and shift instead of stretching to fill their
     column, which is what was eating the spacing between images. */
  margin: 0;
  cursor: zoom-in;
  display: block;
  overflow: hidden;
  position: relative;
}

.gallery-item img{
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(.2,0,0,1), filter 0.35s ease, opacity 0.4s ease;
}

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

.gallery-item:hover img{
  transform: scale(1.035);
  filter: brightness(0.92);
}

.gallery-item-video{ background: #111; }

/* Shown while an image is loading (or hasn't scrolled into view yet for
   lazy-loaded photos further down the page). Min-height gives the shimmer
   something to show, since a not-yet-loaded <img> has no natural size. */
.gallery-item.is-loading{
  min-height: 180px;
  background: linear-gradient(100deg, #eee 30%, #f6f6f4 45%, #eee 60%);
  background-size: 250% 100%;
  animation: gallery-shimmer 1.4s ease-in-out infinite;
}

@keyframes gallery-shimmer{
  0%{ background-position: 100% 0; }
  100%{ background-position: -100% 0; }
}

.gallery-spinner{
  width: 100%;
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-spinner::after{
  content: "";
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--fg);
  animation: gallery-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce){
  .gallery-item.is-loading{ animation: none; background: #eee; }
  .gallery-spinner::after{ animation-duration: 1.6s; }
}

.video-play-badge{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  pointer-events: none;
}
.video-play-badge::after{
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent #fff;
}

/* ---------- Lightbox ---------- */

.lightbox{
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(255,255,255,0.8);
  align-items: center;
  justify-content: center;
}
.lightbox.is-open{ display: flex; }

.lightbox-figure{
  margin: 0;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img{
  max-width: 92vw;
  max-height: 80vh;
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

.lightbox-video{
  width: min(92vw, 1100px);
  height: min(80vh, calc(min(92vw, 1100px) * 0.5625));
  border: none;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

.lightbox-caption{
  margin-top: 14px;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--fg);
  text-align: center;
  max-width: 640px;
  padding: 0 20px;
}
.lightbox-caption[hidden]{ display: none; }

.lightbox-close,
.lightbox-prev,
.lightbox-next{
  position: absolute;
  background: none;
  border: none;
  color: var(--fg);
  font-size: 32px;
  cursor: pointer;
  padding: 12px;
  line-height: 1;
  opacity: 0.7;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover{ opacity: 1; }

.lightbox-close{ top: 12px; right: 16px; font-size: 28px; }
.lightbox-prev{ left: 8px; top: 50%; transform: translateY(-50%); font-size: 48px; }
.lightbox-next{ right: 8px; top: 50%; transform: translateY(-50%); font-size: 48px; }

/* ---------- About / Contact pages ---------- */

.page{
  min-height: calc(100vh - var(--header-h) - 60px);
  display: flex;
  justify-content: center;
}

.page-inner{
  max-width: 620px;
  width: 100%;
  padding: 100px 28px 60px;
}

.page-inner h1{
  font-weight: 400;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.page-inner p{
  font-size: 16px;
  line-height: 1.7;
  color: #333;
  margin-bottom: 16px;
}

/* ---------- Footer ---------- */

.site-footer{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 28px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ---------- Mobile ---------- */

@media (max-width: 720px){
  .site-nav{
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .site-nav.is-open{ max-height: 240px; }
  .site-nav a{
    padding: 16px 28px;
    border-bottom: 1px solid var(--line);
    width: 100%;
  }
  .nav-toggle{ display: flex; }
  .lightbox-prev, .lightbox-next{ font-size: 34px; }
}

/* ---------------------------------------------------------
   Email obfuscation note (optional):
   Instead of <a href="mailto:hello@example.com">, you can write:
     <span data-user="hello" data-domain="example.com"></span>
   and add a small script that assembles it on load. This isn't
   bulletproof, but it stops the simplest scraper bots. Ask if
   you want this wired in.
--------------------------------------------------------- */
