/* ─────────────────────────────────────────────────────────────
   CSS Custom Properties — dark/light mode via class on <html>
   ───────────────────────────────────────────────────────────── */
:root {
  --bg:           #f4f4f4;
  --surface:      #ffffff;
  --text:         #1a1a1a;
  --text-muted:   #666666;
  --border:       #e0e0e0;
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --overlay:      rgba(0, 0, 0, 0.88);
  --header-bg:    rgba(244, 244, 244, 0.92);
  --shadow:       0 1px 6px rgba(0, 0, 0, 0.08);
  --radius:       6px;
  --gap:          4px;        /* grid gap on mobile */
  --gap-desk:     8px;        /* masonry gap on desktop */
  --header-h:     52px;
}

.dark {
  --bg:           #111111;
  --surface:      #1c1c1c;
  --text:         #ededed;
  --text-muted:   #888888;
  --border:       #2e2e2e;
  --accent:       #3b82f6;
  --accent-hover: #60a5fa;
  --overlay:      rgba(0, 0, 0, 0.94);
  --header-bg:    rgba(17, 17, 17, 0.92);
  --shadow:       0 1px 6px rgba(0, 0, 0, 0.4);
}

/* ─────────────────────────────────────────────────────────────
   Reset / Base
   ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.25s, color 0.25s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ─────────────────────────────────────────────────────────────
   Header
   ───────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s, border-color 0.25s;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 16px;
  max-width: 1800px;
  margin: 0 auto;
}

.site-logo {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
  text-decoration: none;
}
.site-logo:hover { color: var(--accent); text-decoration: none; }

/* ── Site navigation (between logo and dark-mode button) ────────────────── */
.site-nav {
  display: flex;
  gap: 24px;
  margin-left: auto;
  margin-right: 16px;
}

.site-nav a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* On very narrow screens hide the nav to keep the header clean —
   logo and dark toggle remain. Could be replaced with a hamburger later. */
@media (max-width: 480px) {
  .site-nav { gap: 14px; margin-right: 10px; }
  .site-nav a { font-size: 13px; }
}

/* ────────────────────────────────────────────────────────────────────────
   About page
   ──────────────────────────────────────────────────────────────────────── */
.about-main {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  font-size: 15px;
  line-height: 1.7;
}

.about-hero {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.about-name {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.about-tagline {
  color: var(--text-muted);
  font-size: 15px;
}

.about-section {
  margin-bottom: 40px;
}

.about-section h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.about-section p { margin-bottom: 14px; }
.about-section p:last-child { margin-bottom: 0; }

.about-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.about-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--text);
}

/* Small italic helper text — visible in development so the
   user knows which paragraphs to replace */
.about-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}

.about-contact a {
  font-size: 17px;
  font-weight: 500;
}

.about-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* On wider screens give the body a touch more breathing room */
@media (min-width: 768px) {
  .about-main { padding: 80px 24px 100px; }
  .about-name { font-size: 40px; }
}

/* Dark-mode toggle button */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.icon-btn:hover { background: var(--border); }

/* Show moon in light mode, sun in dark mode */
.icon-moon { display: block; }
.icon-sun  { display: none;  }
.dark .icon-moon { display: none;  }
.dark .icon-sun  { display: block; }

/* ─────────────────────────────────────────────────────────────
   Project filter pills
   ───────────────────────────────────────────────────────────── */
.project-filters {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-top: 1px solid var(--border);
  max-width: 1800px;
  margin: 0 auto;
}
.project-filters::-webkit-scrollbar { display: none; }

.filter-pill {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.filter-pill:hover,
.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─────────────────────────────────────────────────────────────
   Main content area
   ───────────────────────────────────────────────────────────── */
main {
  padding: var(--gap);
  max-width: 1800px;
  margin: 0 auto;
}

/* ─────────────────────────────────────────────────────────────
   Photo grid — MOBILE FIRST (3-column squares)
   ─────────────────────────────────────────────────────────────
   Uses display:grid with a 1:1 aspect ratio so every thumb is
   a uniform square and distortion is prevented with object-fit.
   ───────────────────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.photo-item {
  aspect-ratio: 1;          /* force 1:1 square on mobile */
  overflow: hidden;
  cursor: pointer;
  border-radius: var(--radius);
  background: var(--surface);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;        /* crop to fill the square without distortion */
  display: block;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;               /* fade in once loaded */
}
.photo-item img.loaded { opacity: 1; }

.photo-item:hover img { transform: scale(1.04); }

/* ─────────────────────────────────────────────────────────────
   Desktop masonry — >= 768 px
   ─────────────────────────────────────────────────────────────
   JavaScript switches .photo-grid to display:block and gives
   each .photo-item position:absolute with computed left/top.
   We only need CSS to:
     • undo the mobile 1:1 ratio so images show natural height
     • ensure the container has position:relative (set by JS)
   ───────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  main { padding: var(--gap-desk); }

  /* JS masonry sets position:relative + explicit height on this element */
  .photo-grid {
    /* display:block is applied by JS; gap handled by JS column math */
  }

  /* Items are position:absolute from JS — remove the mobile square constraint */
  .photo-item {
    aspect-ratio: unset;
    border-radius: var(--radius);
  }

  /* Natural height — fills column width, height from the stored aspect ratio */
  .photo-item img {
    height: auto;
    object-fit: cover;      /* still covers nicely if sizes mismatch slightly */
  }
}

/* ─────────────────────────────────────────────────────────────
   Infinite-scroll sentinel & status messages
   ───────────────────────────────────────────────────────────── */
.sentinel {
  display: flex;
  justify-content: center;
  padding: 32px 0;
  min-height: 80px;
}

/* CSS-only spinner */
.spinner {
  display: block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.end-msg, .empty-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 16px 0 40px;
  font-size: 13px;
}

/* ─────────────────────────────────────────────────────────────
   Lightbox modal
   ───────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none; }

/* Semi-transparent backdrop — click triggers close */
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  cursor: pointer;
}

/* Close button — fixed so it stays top-right even for tall images */
.lightbox-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.15); }

/* Content card sits above the backdrop */
.lightbox-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: min(92vw, 1400px);
  max-height: 92vh;
}

.lightbox-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 80vh;
  overflow: hidden;
  border-radius: var(--radius);
}
.lightbox-img-wrap img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
}

.lightbox-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: center;
  max-width: 600px;
  text-align: center;
}
.lb-title   { font-weight: 600; font-size: 15px; color: #fff; }
.lb-taken   { font-size: 13px; color: rgba(255,255,255,0.85); }
.lb-date    { font-size: 11px; color: rgba(255,255,255,0.45); }
.lb-project {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
}
