/*!
 * Zehao Xue — Photography (/photo). Image-forward, minimal, whitespace-heavy.
 * Consumes shared tokens from css/theme.css.
 */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body-font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

.ph-container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 1.5rem; }

/* ===== Header / nav (transparent over hero, solid after scroll) ===== */
.ph-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  transition: background .25s, box-shadow .25s;
}
.ph-header.scrolled { background: rgba(255,255,255,.96); box-shadow: 0 1px 0 var(--line); }
.ph-bar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ph-brand {
  font-family: var(--head-font);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
  text-decoration: none;
  transition: color .25s;
}
.ph-brand span { color: #d9dfd3; }
.ph-mark { width: 28px; height: 28px; border-radius: 7px; vertical-align: -7px; margin-right: .35rem; }
.ph-header.scrolled .ph-brand { color: var(--green-deep); }
.ph-header.scrolled .ph-brand span { color: var(--sage-dark); }

.ph-nav { display: flex; align-items: center; gap: 1.6rem; }
.ph-nav a {
  color: rgba(255,255,255,.9);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .8rem;
  font-weight: 800;
  transition: color .2s;
}
.ph-nav a:hover { color: var(--sage); }
.ph-nav .ph-home { color: #d9dfd3; }
.ph-nav .ph-nav-ext { font-size: .65em; margin-left: .15em; opacity: .75; }
.ph-header.scrolled .ph-nav a { color: var(--sage-dark); }
.ph-header.scrolled .ph-nav a:hover { color: var(--green-deep); }

.ph-toggle {
  display: none;
  background: none; border: 0;
  color: #fff; font-size: 1.4rem; cursor: pointer;
}
.ph-header.scrolled .ph-toggle { color: var(--green-deep); }

/* ===== Hero ===== */
.ph-hero { position: relative; height: 100vh; min-height: 560px; overflow: hidden; }
.ph-hero-slides { position: absolute; inset: 0; background: var(--green-deep); }
.ph-hero-slides picture { display: contents; }
.ph-hero-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; display: block;
  opacity: 0; transition: opacity 1.6s ease-in-out;
}
.ph-hero-img.is-active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ph-hero-img { transition: none; } }
.ph-hero-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-end;
  text-align: left;
  /* keep the frame bright; only the caption band at the bottom darkens */
  background: linear-gradient(180deg, rgba(23,43,23,.55) 0%, rgba(23,43,23,0) 30%, rgba(23,43,23,.62) 100%);
  color: #fff;
  padding: 0 clamp(1.5rem, 6vw, 5rem) clamp(3rem, 8vh, 5rem);
}
.ph-hero-overlay h1 {
  font-family: var(--head-font);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: clamp(3rem, 9vw, 6rem);
  line-height: .95;
  margin: 0 0 .3rem;
}
.ph-hero-overlay p {
  font-size: 1.15rem;
  letter-spacing: .02em;
  max-width: 22em;
  margin: 0 0 2rem;
  color: rgba(255,255,255,.92);
}
.ph-hero-overlay .ph-hero-cats {
  font-family: var(--body-font); text-transform: uppercase; letter-spacing: .12em;
  font-size: .78rem; font-weight: 800; color: rgba(255,255,255,.75); margin: -1.2rem 0 2rem;
}
.ph-scroll {
  color: #fff; text-decoration: none;
  text-transform: uppercase; letter-spacing: .12em;
  font-size: .8rem; font-weight: 800;
  border: 1px solid rgba(255,255,255,.6);
  padding: .7rem 1.4rem; border-radius: 3px;
  transition: background .2s, color .2s;
}
.ph-scroll:hover { background: #fff; color: var(--green-deep); }

/* ===== Sections ===== */
.ph-section { padding: 6rem 0; }
.ph-h2 {
  font-family: var(--head-font);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--green-head);
  font-size: 2.4rem;
  margin: 0 0 1.5rem;
}

/* ===== Filters ===== */
.ph-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.ph-filters button {
  background: none;
  border: 1px solid var(--line);
  color: var(--sage-dark);
  font-family: var(--body-font);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .75rem;
  padding: .5rem 1.1rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all .15s;
}
.ph-filters button:hover { border-color: var(--sage); color: var(--green-deep); }
.ph-filters button.is-active { background: var(--green-mid); border-color: var(--green-mid); color: #fff; }

/* ===== Gallery (masonry via CSS columns) ===== */
.ph-gallery { column-count: 3; column-gap: 1rem; }
.ph-item {
  margin: 0 0 1rem;
  break-inside: avoid;
  cursor: pointer;
  overflow: hidden;
  border-radius: 4px;
}
.ph-item img {
  width: 100%; display: block;
  transition: transform .4s ease, filter .3s ease;
}
.ph-item:hover img { transform: scale(1.04); filter: brightness(1.05); }
.ph-item.is-hidden { display: none; }
.ph-swipe-hint { display: none; }

.ph-albums-note { margin: 1.6rem 0 0; font-size: .95rem; color: var(--sage-dark); }
.ph-albums-note a { color: var(--green-mid); font-weight: 800; text-decoration: none; }
.ph-albums-note a:hover { color: var(--green-deep); }

/* ===== About ===== */
.ph-about { background: var(--bg-soft); }
.ph-about-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 3rem;
  align-items: center;
}
.ph-portrait-stack {
  position: relative; width: 100%; aspect-ratio: 1; cursor: pointer; border-radius: 50%;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; outline: none;
}
.ph-portrait-stack img { pointer-events: none; -webkit-user-drag: none; user-select: none; }
.ph-portrait-stack:focus-visible { outline: 3px solid var(--sage); outline-offset: 6px; }
.ph-portrait-stack.is-snap .ph-portrait { transition: none; }   /* click = instant swap; idle auto-cycle keeps the fade */
.ph-portrait {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 50%;
  border: 6px solid #fff;
  box-shadow: 0 0 0 2px var(--sage), 0 10px 30px rgba(23,43,23,.12);
  opacity: 0; transition: opacity 1.2s ease;
}
.ph-portrait.is-active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ph-portrait { transition: none; } }
.ph-about p { color: var(--ink); font-size: 1.05rem; max-width: 56ch; }
.ph-link {
  display: inline-block; margin-top: .5rem;
  color: var(--green-mid); font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em; font-size: .85rem;
  text-decoration: none;
}
.ph-link:hover { color: var(--green-deep); }

/* ===== Contact ===== */
.ph-contact { text-align: center; }
.ph-lead { color: var(--sage-dark); font-size: 1.15rem; max-width: 560px; margin: 0 auto 2rem; }
.ph-cta {
  display: inline-block;
  background: var(--green-mid); color: #fff;
  font-family: var(--head-font);
  text-transform: uppercase; letter-spacing: .06em;
  font-size: 1.2rem;
  padding: .8rem 2rem; border-radius: 5px;
  text-decoration: none;
  transition: background .2s;
}
.ph-cta:hover { background: var(--green-deep); }
.ph-socials { margin-top: 2rem; display: flex; justify-content: center; gap: 1.2rem; }
.ph-socials a {
  width: 46px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--sage); color: var(--green-deep);
  font-size: 1.2rem; text-decoration: none;
  transition: background .15s, color .15s, transform .15s;
}
.ph-socials a:hover { background: var(--green-mid); color: #fff; transform: translateY(-3px); }

/* ===== Footer ===== */
.ph-footer {
  background: var(--green-deep);
  color: #c8cfc2;
  text-align: center;
  padding: 2rem 0;
  font-size: .85rem;
}
.ph-footer a { color: var(--sage); text-decoration: none; }

/* ===== Lightbox ===== */
.ph-lightbox {
  position: fixed; inset: 0; z-index: 2000;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(10,16,10,.92);
}
.ph-lightbox.open { display: flex; }
.lb-img {
  max-width: 90vw; max-height: 82vh;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.lb-caption {
  position: absolute; bottom: 4vh; left: 0; right: 0;
  text-align: center; color: rgba(255,255,255,.85);
  font-size: .95rem; letter-spacing: .04em;
}
.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: none; border: 0; color: #fff;
  cursor: pointer; user-select: none;
}
.lb-close { top: 4vh; right: 5vw; font-size: 2.5rem; line-height: 1; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 2.5rem; padding: 1rem; }
.lb-prev { left: 2vw; }
.lb-next { right: 2vw; }
.lb-close:hover, .lb-prev:hover, .lb-next:hover { color: var(--sage); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .ph-gallery { column-count: 2; }
  .ph-about-grid { grid-template-columns: 1fr; gap: 1.5rem; text-align: center; }
  .ph-portrait-stack { max-width: 240px; margin: 0 auto; }
  .ph-about p { margin-left: auto; margin-right: auto; }
}
/* nav collapses to the burger earlier than the rest of the mobile layout: the brand + four
   items overflow below ~700px */
@media (max-width: 700px) {
  .ph-toggle { display: block; }
  .ph-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--green-deep);
    max-height: 0; overflow: hidden;
    transition: max-height .25s ease;
  }
  .ph-nav.open { max-height: 320px; }
  .ph-nav a { width: 100%; padding: .9rem 1.5rem; color: #fff !important; }
}

@media (max-width: 600px) {
  /* Photo wall becomes a horizontal, snap-scrolling strip: fixed height, natural widths */
  .ph-gallery {
    column-count: auto;
    display: flex; gap: .75rem; align-items: stretch;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    margin: 0 -1.5rem; padding: 0 1.5rem 1rem;
    scrollbar-width: none;
  }
  .ph-gallery::-webkit-scrollbar { display: none; }
  .ph-item { flex: 0 0 auto; margin: 0; height: min(60vh, 520px); scroll-snap-align: center; scroll-snap-stop: always; }
  .ph-item img { height: 100%; width: auto; max-width: 84vw; object-fit: cover; }
  .ph-item:hover img { transform: none; }
  .ph-swipe-hint {
    display: block; margin: -.25rem 0 .9rem;
    font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  }
}
