:root {
  --bg: #ffffff;
  --ink: #171717;
  --muted: #6b6b6b;
  --line: #e7e7e7;
  --surface: #f1f1f1;
  --accent: #2da7e0;
  --maxw: 1320px;
  --gap: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}
[data-theme="dark"] {
  --bg: #0f0f0f;
  --ink: #ededed;
  --muted: #8c8c8c;
  --line: #272727;
  --surface: #1b1b1b;
  --accent: #5bb8e6;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--muted); }
img { display: block; max-width: 100%; }

/* Graceful image fade-in (only when JS is active, so no-JS still shows images) */
.js img.ph { opacity: 0; transition: opacity 0.7s ease; }
.js img.ph.is-loaded { opacity: 1; }

/* Top header + centered content */
.site-header { position: relative; text-align: center; padding: 46px 24px 30px; }
.site-title {
  font-family: var(--font-display); font-optical-sizing: auto;
  font-size: 1.7rem; font-weight: 500; letter-spacing: 0.01em; margin: 0 0 18px;
}
.top-nav {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px;
  font-size: 0.76rem; letter-spacing: 0.11em; text-transform: uppercase;
}
.top-nav a { color: var(--muted); }
.top-nav a:hover { color: var(--ink); }
.top-nav a.active { color: var(--ink); }

.theme-toggle {
  position: absolute; top: 40px; right: 28px;
  background: none; border: 1px solid var(--line); border-radius: 999px;
  width: 34px; height: 34px; cursor: pointer; color: var(--ink);
  font-size: 0.95rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.theme-toggle:hover { color: var(--muted); }
.theme-toggle .t-sun { display: none; }
.theme-toggle .t-moon { display: inline; }
[data-theme="dark"] .theme-toggle .t-sun { display: inline; }
[data-theme="dark"] .theme-toggle .t-moon { display: none; }

.content { max-width: var(--maxw); margin: 0 auto; padding: 10px 24px 0; }

/* Page heading */
.page-head { text-align: center; margin: 6px 0 40px; }
.page-head h1 {
  font-family: var(--font-display); font-optical-sizing: auto;
  font-weight: 400; font-size: 2rem; letter-spacing: -0.01em; margin: 0 0 8px;
}
.page-desc { color: var(--muted); max-width: 560px; margin: 0 auto 14px; font-size: 0.95rem; }
.page-desc a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.page-desc a:hover { color: var(--muted); }
.back-link { font-size: 0.76rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }

/* Index of galleries */
.index-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px 26px; margin: 6px 0 56px; }
.index-card { display: block; }
.cover-frame { display: block; overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface); }
.index-card .cover {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.7s ease;
}
.index-card:hover .cover { transform: scale(1.045); }
.index-card .label { margin-top: 12px; font-size: 0.9rem; display: flex; justify-content: space-between; gap: 12px; }
.index-card .label .count { color: var(--muted); }
.cover-film { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #bbb; font-size: 2.4rem; background: #1a1a1a; }

/* Photo grid */
.photo-grid { column-count: 3; column-gap: var(--gap); margin-bottom: 56px; }
.photo-grid figure { margin: 0 0 var(--gap); break-inside: avoid; cursor: zoom-in; overflow: hidden; background: var(--surface); }
.photo-grid img { width: 100%; height: auto; transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.7s ease; }
.photo-grid figure:hover img { transform: scale(1.04); }

/* About / text pages */
.prose { max-width: 680px; margin: 0 auto 64px; }
.prose h2 { font-size: 0.92rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 30px 0 8px; }
.prose p { margin: 0 0 14px; }
.prose ul { margin: 0 0 14px; padding-left: 1.2em; }
.about-portrait { width: 100%; max-width: 360px; margin: 0 auto 30px; }
.about-portrait figcaption { font-size: 0.78rem; color: var(--muted); text-align: center; margin-top: 8px; }

/* Feature page */
.feature { max-width: 760px; margin: 0 auto 60px; text-align: center; }
.feature .dedication { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 22px; }
.feature-grid { column-count: 1; margin-bottom: 0; }
.feature-grid figure { cursor: zoom-in; margin-bottom: 0; }
.feature-caption { color: var(--muted); font-size: 0.95rem; max-width: 560px; margin: 0 auto 22px; }

/* Video */
.video-embed { position: relative; width: 100%; max-width: 900px; margin: 0 auto 56px; aspect-ratio: 16 / 9; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 30px 0 52px; text-align: center; color: var(--muted); font-size: 0.8rem; }
.site-footer a { color: var(--muted); margin: 0 8px; }
.site-footer a:hover { color: var(--ink); }

/* Lightbox */
.lb { position: fixed; inset: 0; z-index: 1000; background: rgba(10, 10, 10, 0.95); display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.25s ease; }
.lb.open { display: flex; opacity: 1; }
.lb img { max-width: 92vw; max-height: 88vh; width: auto; height: auto; }
.lb.open img { animation: lb-in 0.35s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes lb-in { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.38); border: 0; cursor: pointer;
  color: #fff; font-size: 1.5rem; line-height: 1; padding: 0 0 3px;
  opacity: 0.85; transition: opacity 0.2s ease, background 0.2s ease;
}
.lb-btn:hover { opacity: 1; background: rgba(0, 0, 0, 0.6); }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-close { position: absolute; top: 16px; right: 20px; z-index: 3; background: none; border: 0; color: #fff; font-size: 1.8rem; cursor: pointer; line-height: 1; opacity: 0.8; width: 3rem; height: 3rem; }
.lb-close:hover { opacity: 1; }
.lb-count { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: #fff; font-size: 0.8rem; opacity: 0.6; letter-spacing: 0.08em; }

@media (max-width: 820px) {
  .site-header { padding: 30px 20px 22px; }
  .site-title { font-size: 1.4rem; }
  .theme-toggle { top: 22px; right: 18px; }
  .content { padding: 8px 20px 0; }
  .index-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .photo-grid { column-count: 2; }
}
@media (max-width: 520px) {
  .index-grid { grid-template-columns: 1fr; }
  .photo-grid { column-count: 1; }
  .lb-btn { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .js img.ph { opacity: 1; }
  * { transition: none !important; animation: none !important; }
}
