/* ---------- Tokens ---------- */
:root {
  --bg: #F7F5F0;
  --ink: #17140F;
  --muted: #6B6456;
  --line: #DEDACF;
  --placeholder: #E7E3DA;
  --panel: #F7F5F0;
  --video-fill: #E1DCD1;
  --play-icon: #8C8473;
  --accent: #B23A2E;
}

/* Dark theme: follows the system preference by default, or the
   visitor's own choice (saved via the nav toggle) once they set one. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15130F;
    --ink: #F2EFE8;
    --muted: #9C9686;
    --line: #2B2820;
    --placeholder: #221F19;
    --panel: #15130F;
    --video-fill: #221F19;
    --play-icon: #9C9686;
  }
}
:root[data-theme="dark"] {
  --bg: #15130F;
  --ink: #F2EFE8;
  --muted: #9C9686;
  --line: #2B2820;
  --placeholder: #221F19;
  --panel: #15130F;
  --video-fill: #221F19;
  --play-icon: #9C9686;
}

* { box-sizing: border-box; }

body { transition: background-color .2s ease, color .2s ease; }

html {
  scrollbar-gutter: stable;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Scrollbar ---------- */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--line);
  border-radius: 10px;
  border: 3px solid var(--bg);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--muted);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

body > * {
  width: 100%;
}

.site-main {
  flex: 1 0 auto;
}

a { color: inherit; text-decoration: none; }

.serif-italic {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
}

/* ---------- Nav ---------- */
.site-nav {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40px 140px 24px 140px;
  flex-wrap: wrap;
  gap: 20px;
}
.site-nav .brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}
.site-nav .brand-name {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.site-nav .brand-role {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
}
.site-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.nav-link { color: var(--muted); }
.nav-link:hover { color: var(--accent); }
.nav-link.is-active {
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 3px;
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* Mobile nav (dropdown) */
.mobile-nav {
  display: none;
  position: relative;
  align-items: flex-start;
  justify-content: space-between;
  padding: 32px 28px 24px 28px;
  border-bottom: 1px solid var(--line);
}
.mobile-nav .brand-name {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 17px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.mobile-nav .brand-role {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.menu-btn {
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
}
.mobile-menu {
  display: none;
  position: absolute;
  top: 56px;
  right: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 0;
  min-width: 168px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.15);
  z-index: 10;
}
.mobile-menu.is-open { display: block; }
.mobile-menu a {
  display: block;
  padding: 11px 18px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.mobile-menu a.is-active { color: var(--ink); }
.mobile-menu a:hover { color: var(--accent); }

/* ---------- Page heading ---------- */
.page-heading {
  max-width: 1440px;
  margin: 40px auto 0 auto;
  padding: 0 140px;
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 28px;
}

/* ---------- Project rows (Selected / category pages) ---------- */
.project-rows {
  max-width: 1440px;
  margin: 32px auto 0 auto;
  padding: 0 140px 120px 140px;
  display: flex;
  flex-direction: column;
  gap: 56px;
}
.project-row { display: block; }
.project-row .stills-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  align-items: start;
}
.project-row .still {
  background: var(--placeholder);
  border: 1px solid var(--line);
  box-sizing: border-box;
  border-radius: 20px;
  transition: border-color .2s;
  width: 100%;
  height: auto;
  display: block;
}
.project-row .still:not(img) {
  aspect-ratio: 3 / 2;
}
.project-row:hover .still { border-color: var(--accent); }
.project-row .caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  margin-top: 20px;
}
.project-row .caption-title {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 19px;
}
.project-row .caption-cat {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Mobile: single auto-advancing still */
.mobile-project-rows {
  display: none;
  padding: 24px 28px 80px 28px;
  flex-direction: column;
  gap: 40px;
}
.mobile-project-rows .slide {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-sizing: border-box;
  display: block;
  transition: opacity .8s ease;
}
.mobile-project-rows div.slide {
  aspect-ratio: 3 / 2;
}
.mobile-project-rows .dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.mobile-project-rows .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line);
  transition: background-color .3s ease;
}
.mobile-project-rows .dot.is-active { background: var(--ink); }
.mobile-project-rows .caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  margin-top: 12px;
}
.mobile-project-rows .caption-title {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 15px;
}
.mobile-project-rows .caption-cat {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.mobile-heading {
  display: none;
  padding: 28px 28px 0 28px;
  text-align: center;
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 21px;
}

/* ---------- Project detail ---------- */
.project-detail {
  max-width: 1440px;
  margin: 40px auto 0 auto;
  padding: 0 140px 120px 140px;
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 80px;
  align-items: start;
}
.project-detail .info {
  position: sticky;
  top: 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.project-detail .info-title {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 24px;
  line-height: 1.3;
}
.project-detail .meta-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.project-detail .meta-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.project-detail .meta-value { font-size: 14px; margin-top: 3px; }
.project-detail .description {
  font-size: 13px;
  line-height: 1.7;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.project-detail .media {
  display: flex;
  flex-direction: column;
  gap: 48px;
}
.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: var(--ratio, 16 / 9);
  background: var(--video-fill);
  border: 1px solid var(--line);
  box-sizing: border-box;
  overflow: hidden;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.video-label {
  font-family: 'EB Garamond', Georgia, serif;
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  margin-top: 10px;
}
.stills-section-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-bottom: 16px;
}
.stills-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}
.stills-detail-grid img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--placeholder);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-sizing: border-box;
  cursor: zoom-in;
  transition: opacity .2s ease;
}
.stills-detail-grid img:hover {
  opacity: 0.85;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 9, 7, 0.92);
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-sizing: border-box;
  cursor: zoom-out;
}
.lightbox.is-open {
  display: flex;
}
.lightbox img {
  /* Exact pixel width/height are computed in JS (see main.js) so the
     image box always matches the visible picture -- filling as much of
     an 85vw x 85vh rectangle as the still's own ratio allows, touching
     whichever side it reaches first, scaling up a small/low-res still
     too. The percentages below are just a fallback before JS runs. */
  max-width: 85vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 12px;
  cursor: default;
}
.lightbox-close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(242, 239, 232, 0.3);
  background: transparent;
  color: #F2EFE8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lightbox-close:hover {
  border-color: #F2EFE8;
}
.lightbox-arrow {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(242, 239, 232, 0.3);
  background: transparent;
  color: #F2EFE8;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lightbox-arrow:hover {
  border-color: #F2EFE8;
}
.lightbox.has-multiple .lightbox-arrow {
  display: flex;
}
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }
@media (max-width: 860px) {
  .lightbox {
    padding: 20px;
  }
  .lightbox-close {
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
  }
  .lightbox-arrow {
    width: 40px;
    height: 40px;
  }
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
}
.back-link {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.back-link:hover { color: var(--accent); }

/* ---------- About ---------- */
.about-body {
  max-width: 1440px;
  margin: 56px auto 0 auto;
  padding: 0 140px 120px 140px;
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(280px, 400px);
  justify-content: center;
  gap: 100px;
  align-items: center;
}
.about-left { display: flex; flex-direction: column; gap: 28px; }
.about-bio { font-size: 14px; line-height: 1.75; }
.about-contact {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.about-contact-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.about-contact-email:hover {
  color: var(--accent);
}
.about-portrait {
  position: sticky;
  top: 40px;
}
.about-portrait img,
.about-portrait .placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--placeholder);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 140px 32px 140px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.email { font-size: 12px; color: var(--muted); }
.email:hover { color: var(--accent); }
.social-links { display: flex; gap: 20px; align-items: center; }
.social-links a { display: flex; color: var(--muted); }
.footer-copyright {
  flex-basis: 100%;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}
.mobile-footer-copyright { font-size: 10px; color: var(--muted); text-align: center; }
.social-links a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
/* The nav switches to the mobile dropdown earlier than the rest of the
   layout, since seven top-level links no longer fit comfortably above
   that width. */
@media (max-width: 1023px) {
  .site-nav { display: none; }
  .mobile-nav { display: flex; }
}
@media (min-width: 1024px) {
  .mobile-nav { display: none; }
}
@media (min-width: 1024px) and (max-width: 1409px) {
  .site-nav {
    padding-left: 48px;
    padding-right: 48px;
  }
  .site-nav .brand {
    gap: 10px;
  }
  .site-nav .brand-name {
    font-size: 16px;
  }
  .site-nav .brand-role {
    font-size: 13px;
  }
  .site-nav .nav-links {
    gap: 14px;
    font-size: 11px;
    letter-spacing: 0.06em;
  }
}
@media (max-width: 860px) {
  .site-nav, .page-heading, .project-rows, .back-link,
  .project-detail, .about-body, .site-footer, .footer-copyright {
    display: none !important;
  }
  .mobile-nav { display: flex; }
  .mobile-heading { display: block; }
  .mobile-project-rows { display: flex; }

  .mobile-project-detail { display: block !important; padding: 0 0 60px 0; }
  .mobile-about { display: block !important; }
  .mobile-footer { display: flex !important; }
}
@media (min-width: 861px) {
  .mobile-project-detail, .mobile-about, .mobile-footer { display: none !important; }
}
