/* ============================================================
   Ceremony · 婚礼影像 — Design Tokens
   ============================================================ */
:root {
  --color-bg-primary: #FFFFFF;
  --color-bg-subtle: #F2F4F7;
  --color-text-primary: #262A36;
  --color-text-secondary: #636363;
  --color-text-muted: #474747;
  --color-border-subtle: rgba(90, 98, 113, 0.2);
  --color-border-medium: rgba(90, 98, 113, 0.5);
  --color-accent: #5A6271;

  --font-display: "Instrument Serif", "Noto Serif SC", "Songti SC", serif;
  --font-body: "Source Sans 3", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-ui: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;

  --content-max: 1080px;
  --content-narrow: 720px;
  --nav-h: 72px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--color-text-secondary);
  background: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-ui); cursor: pointer; border: none; background: none; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--color-text-primary);
  line-height: 1.2;
}

/* ============================================================
   Typography helpers
   ============================================================ */
.eyebrow {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 18px;
}
.eyebrow-light { color: rgba(255, 255, 255, 0.85); }

.section-head { text-align: center; max-width: 640px; margin: 0 auto 56px; }
.section-head h2 { font-size: clamp(32px, 4vw, 44px); margin-bottom: 16px; }
.section-desc { font-size: 16px; color: var(--color-text-secondary); }

.body-text { margin-bottom: 18px; }
.body-text:last-child { margin-bottom: 0; }

/* ============================================================
   Layout
   ============================================================ */
.section { padding: 110px 24px; }
.section-subtle { background: var(--color-bg-subtle); }
.container { max-width: var(--content-max); margin: 0 auto; }
.container-narrow { max-width: var(--content-narrow); margin: 0 auto; }
.center { text-align: center; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  padding: 14px 30px;
  border-radius: 8px;
  transition: opacity 0.25s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.btn-primary { background: var(--color-text-primary); color: #fff; }
.btn-primary:hover { opacity: 0.85; }
.btn-light {
  background: rgba(255, 255, 255, 0.94);
  color: var(--color-text-primary);
}
.btn-light:hover { background: #fff; }
.btn-ghost {
  border: 1px solid var(--color-border-medium);
  color: var(--color-text-primary);
  background: transparent;
}
.btn-ghost:hover { background: var(--color-text-primary); color: #fff; border-color: var(--color-text-primary); }

/* ============================================================
   Fixed Nav
   ============================================================ */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--nav-h);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}
.nav-inner {
  max-width: 1240px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 22px;
  color: #fff;
  transition: color 0.35s ease;
}
.nav-logo .amp { font-style: italic; }

.nav-links { display: flex; align-items: center; gap: 34px; }
.nav-links a {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  transition: color 0.35s ease, opacity 0.2s ease;
}
.nav-links a:hover { opacity: 0.7; }
.nav-cta {
  padding: 9px 20px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 7px;
  transition: all 0.3s ease;
}
.nav-cta:hover { background: #fff; color: var(--color-text-primary) !important; opacity: 1 !important; }

/* Scrolled state */
.nav.scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--color-border-subtle);
}
.nav.scrolled .nav-logo,
.nav.scrolled .nav-links a { color: var(--color-text-primary); }
.nav.scrolled .nav-cta { border-color: var(--color-border-medium); }
.nav.scrolled .nav-cta:hover { background: var(--color-text-primary); color: #fff !important; border-color: var(--color-text-primary); }
.nav.scrolled .nav-burger span { background: var(--color-text-primary); }

/* Burger (mobile) */
.nav-burger { display: none; width: 40px; height: 40px; position: relative; z-index: 110; }
.nav-burger span {
  position: absolute;
  left: 9px; right: 9px;
  height: 1.5px;
  background: #fff;
  transition: transform 0.3s ease, top 0.3s ease, background 0.3s ease;
}
.nav-burger span:nth-child(1) { top: 15px; }
.nav-burger span:nth-child(2) { top: 24px; }
.nav-burger.open span:nth-child(1) { top: 19px; transform: rotate(45deg); background: var(--color-text-primary); }
.nav-burger.open span:nth-child(2) { top: 19px; transform: rotate(-45deg); background: var(--color-text-primary); }

/* Mobile menu overlay */
@media (max-width: 809px) {
  .nav-burger { display: block; }

  /* When menu is open, neutralize backdrop-filter on .nav — it would otherwise
     become the containing block for the position:fixed fullscreen overlay. */
  .nav.menu-open {
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .nav-links {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 105;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 80px 24px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s;
  }
  .nav-links.open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }
  .nav-links a {
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 1.2;
    color: var(--color-text-primary) !important;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
  .nav-links.open a {
    opacity: 1;
    transform: translateY(0);
  }
  .nav-links.open a:nth-child(1) { transition-delay: 0.05s; }
  .nav-links.open a:nth-child(2) { transition-delay: 0.10s; }
  .nav-links.open a:nth-child(3) { transition-delay: 0.15s; }
  .nav-links.open a:nth-child(4) { transition-delay: 0.20s; }
  .nav-links.open a:nth-child(5) { transition-delay: 0.25s; }
  .nav-links.open a:nth-child(6) { transition-delay: 0.30s; }
  .nav-cta { border: none !important; padding: 0; }
  .nav-cta:hover { background: none; }
}

/* Short / landscape phones: tighten menu */
@media (max-width: 809px) and (max-height: 620px) {
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 22px; }
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  height: 100svh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-slides, .hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-slide {
  opacity: 0;
  transition: opacity 1.6s ease;
}
.hero-slide.active { opacity: 1; }
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(20, 22, 30, 0.35), rgba(20, 22, 30, 0.15) 45%, rgba(20, 22, 30, 0.45));
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
  padding: 0 24px;
}
.hero-title {
  font-size: clamp(34px, 8.5vw, 100px);
  white-space: nowrap;
  color: #fff;
  letter-spacing: 0.01em;
  margin-bottom: 14px;
}
.hero-title .amp { font-style: italic; }
.hero-sub {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 22px;
}
.hero-lead {
  font-size: 17px;
  opacity: 0.88;
  max-width: 460px;
  margin: 0 auto 36px;
}
.hero-dots {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  gap: 10px;
}
.hero-dots button {
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.4);
  transition: background 0.3s ease;
}
.hero-dots button.active { background: #fff; }

/* ============================================================
   Intro
   ============================================================ */
.intro { text-align: center; }
.intro-title {
  font-size: clamp(30px, 4vw, 42px);
  margin-bottom: 32px;
}
.intro .body-text { font-size: 17px; }

/* ============================================================
   Collections
   ============================================================ */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}
.collection-card {
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s ease;
}
.collection-card:hover, .collection-card:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 18px 44px rgba(38, 42, 54, 0.12);
  outline: none;
}
.collection-img { aspect-ratio: 3 / 4; overflow: hidden; }
.collection-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-out);
}
.collection-card:hover .collection-img img { transform: scale(1.05); }
.collection-meta { padding: 20px 20px 22px; }
.collection-meta h3 { font-size: 21px; margin-bottom: 2px; }
.collection-en {
  font-size: 12.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}
.collection-count {
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-accent);
  border: 1px solid var(--color-border-subtle);
  border-radius: 999px;
  padding: 3px 12px;
}

/* ============================================================
   Gallery — Sticky Filter (A1)
   ============================================================ */
.gallery-sticky-wrap {
  position: sticky;
  top: calc(var(--nav-h) - 1px);
  z-index: 90;
  background: var(--color-bg-primary);
  padding: 16px 0 12px;
  margin-bottom: 36px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.gallery-sticky-wrap.is-stuck {
  border-bottom-color: var(--color-border-subtle);
  box-shadow: 0 8px 24px rgba(38, 42, 54, 0.06);
}
.filter-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-btn {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  padding: 9px 20px;
  border-radius: 999px;
  border: 1px solid var(--color-border-subtle);
  transition: all 0.25s ease;
}
.filter-btn:hover { border-color: var(--color-border-medium); color: var(--color-text-primary); }
.filter-btn.active {
  background: var(--color-text-primary);
  border-color: var(--color-text-primary);
  color: #fff;
}

.masonry { columns: 3; column-gap: 22px; }
.g-item {
  position: relative;
  break-inside: avoid;
  margin-bottom: 22px;
  border-radius: 8px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--color-bg-subtle);
}
.g-item img {
  width: 100%;
  height: auto;
  transition: transform 0.8s var(--ease-out), opacity 0.35s ease;
}
.g-item:hover img, .g-item:focus-visible img { transform: scale(1.04); }
.g-item:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.g-item figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 44px 18px 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: linear-gradient(to top, rgba(20, 22, 30, 0.55), transparent);
  color: #fff;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.g-item:hover figcaption, .g-item:focus-visible figcaption { opacity: 1; }
.g-cat {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
}
.g-title { font-family: var(--font-display); font-size: 18px; }

.g-item.hidden { display: none; }

/* ============================================================
   Story
   ============================================================ */
.story-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}
.story-img { border-radius: 8px; overflow: hidden; }
.story-img img { width: 100%; height: auto; }

/* Mobile-only section heading (matches other chapters); hidden on desktop */
.story-head-mobile { display: none; }
.story-quote {
  font-size: clamp(28px, 3.4vw, 38px);
  margin-bottom: 28px;
}
.story-quote em { font-style: italic; }

/* ============================================================
   Stats
   ============================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  text-align: center;
}
.stat {
  padding: 34px 16px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
}
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(36px, 4vw, 52px);
  color: var(--color-text-primary);
  line-height: 1;
  margin-bottom: 10px;
}
.stat-label {
  font-size: 14px;
  color: var(--color-text-secondary);
}

/* ============================================================
   Guestbook (B1: Minimal Editorial)
   ============================================================ */
#guestbook h2 { font-size: clamp(30px, 4vw, 42px); margin-bottom: 12px; }
.gb-register { margin: 40px auto 0; max-width: 420px; }
.gb-hint { font-size: 15px; color: var(--color-text-secondary); margin-bottom: 16px; }
.gb-input-row { display: flex; gap: 10px; }
.gb-input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 16px;
  padding: 13px 18px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  background: #fff;
  color: var(--color-text-primary);
  transition: border-color 0.25s ease;
}
.gb-input:focus { outline: none; border-color: var(--color-accent); }
.gb-input::placeholder { color: #aaa; }
.gb-note { margin-top: 14px; font-size: 14px; color: var(--color-text-secondary); }
.gb-note strong { color: var(--color-text-primary); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.gb-compose { margin-top: 36px; text-align: left; }
.gb-textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  padding: 18px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  background: #fff;
  color: var(--color-text-primary);
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.25s ease;
}
.gb-textarea:focus { outline: none; border-color: var(--color-accent); }
.gb-textarea::placeholder { color: #aaa; }
.gb-compose-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}
.gb-char-count { font-size: 13px; color: var(--color-text-muted); }

.gb-list { margin-top: 48px; text-align: left; }
.gb-loading { text-align: center; color: var(--color-text-muted); padding: 40px 0; }
.gb-empty { text-align: center; color: var(--color-text-muted); padding: 40px 0; font-style: italic; }

.gb-item {
  padding: 28px 0;
  border-bottom: 1px solid var(--color-border-subtle);
}
.gb-item:first-child { padding-top: 0; }
.gb-item:last-child { border-bottom: none; }
.gb-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.gb-item-name {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--color-text-primary);
}
.gb-item-date { font-size: 13px; color: var(--color-text-muted); }
.gb-item-content {
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-text-secondary);
  white-space: pre-wrap;
}

.gb-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 40px;
}
.gb-page-info { font-size: 14px; color: var(--color-text-secondary); }
.gb-pagination .btn { padding: 10px 22px; font-size: 14px; }
.gb-pagination .btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  padding: 72px 24px 56px;
  text-align: center;
  border-top: 1px solid var(--color-border-subtle);
}
.footer-names {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--color-text-primary);
  margin-bottom: 10px;
}
.footer-names .amp { font-style: italic; }
.footer-meta { font-size: 14px; margin-bottom: 6px; }
.footer-copy { font-size: 13px; color: var(--color-text-muted); opacity: 0.7; }

/* ============================================================
   Lightbox
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(18, 20, 27, 0.94);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lbFade 0.3s ease;
}
@keyframes lbFade { from { opacity: 0; } to { opacity: 1; } }
.lightbox[hidden] { display: none; }

.lb-stage {
  max-width: min(88vw, 1100px);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.lb-stage img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.lb-caption {
  display: flex;
  gap: 16px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
}
#lbCounter { opacity: 0.6; }

.lb-close, .lb-prev, .lb-next {
  position: absolute;
  z-index: 2;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border-radius: 50%;
  transition: background 0.25s ease;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255, 255, 255, 0.14); }
.lb-close { top: 22px; right: 22px; }
.lb-prev { left: 22px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 22px; top: 50%; transform: translateY(-50%); }

/* ============================================================
   Reveal animation (scroll-triggered fade-up)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-slide { transition: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   Responsive — Tablet: 810–1199px
   ============================================================ */
@media (max-width: 1199px) {
  .section { padding: 88px 24px; }
  .collection-grid { grid-template-columns: repeat(2, 1fr); }
  .masonry { columns: 2; }
  .story-grid { gap: 44px; }
}

/* ============================================================
   Responsive — Mobile: ≤809px
   ============================================================ */
@media (max-width: 809px) {
  body { font-size: 16px; }
  .section { padding: 72px 20px; }
  .hero { min-height: 540px; }
  .hero-lead { font-size: 16px; margin-bottom: 28px; }

  .collection-grid { grid-template-columns: 1fr; gap: 18px; }
  .masonry { columns: 1; column-gap: 0; }

  .story-grid { grid-template-columns: 1fr; gap: 36px; }
  .story-img { order: -1; }

  /* Story chapter: centered head like other sections, quote becomes subhead */
  .story-head-mobile {
    display: block;
    text-align: center;
    margin-bottom: 36px;
  }
  .story-head-mobile h2 { font-size: clamp(28px, 7vw, 36px); margin: 0; }
  .story-text > .eyebrow { display: none; }
  .story-quote {
    font-size: 22px;
    line-height: 1.45;
    text-align: center;
    margin-bottom: 22px;
  }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 14px; }

  .filter-bar { gap: 6px; margin-bottom: 36px; }
  .filter-btn { padding: 8px 16px; font-size: 13.5px; }

  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
  .lb-close { top: 12px; right: 12px; }
  .lb-stage { max-width: 94vw; }
}
