/* =========================================================
   トークン
   ========================================================= */
:root{
  --ivory:      #FBF7EF;
  --ivory-deep: #F5EEDD;
  --white:      #FFFFFF;
  --gold:       #BC9654;
  --gold-light: #D6B884;
  --gold-deep:  #9C7A3C;
  --ink:        #3E362A;
  --ink-soft:   #6E6153;
  --error:      #A6432F;

  --font-serif: "Shippori Mincho", "Noto Serif JP", "Noto Serif CJK JP", serif;
  --font-latin: "Cormorant Garamond", "Shippori Mincho", serif;
  --font-sans:  "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Kaku Gothic ProN", sans-serif;

  --radius: 4px;
}

*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; }
[hidden]{ display: none !important; }

/* 日本語テキストの安全な折り返し（孤立した1文字が出るのを防ぐ） */
p, h1, h2{
  overflow-wrap: break-word;
  word-break: normal;
  text-wrap: pretty;
}
body{
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

button, input{ font-family: inherit; }

.sr-only{
  position:absolute; width:1px; height:1px; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap;
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* =========================================================
   共通ボタン
   ========================================================= */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height: 56px;
  padding: 0 28px;
  border-radius: 2px;
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:active{ transform: scale(0.98); }
.btn:focus-visible{
  outline: 3px solid var(--gold-deep);
  outline-offset: 3px;
}

.btn-primary{
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #E8CE9C 0%, var(--gold) 45%, var(--gold-deep) 100%);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(156,122,60,0.38), inset 0 1px 0 rgba(255,255,255,0.35);
  text-shadow: 0 1px 1px rgba(0,0,0,0.12);
}
.btn-primary::after{
  content: "";
  position: absolute;
  top: -50%; left: -20%;
  width: 30%; height: 200%;
  background: rgba(255,255,255,0.35);
  transform: rotate(20deg);
  pointer-events: none;
}
.btn-primary:hover{ background: linear-gradient(135deg, #EFDBAE 0%, var(--gold-deep) 55%, #7E5F2C 100%); }

.btn-large{ width:100%; max-width: 360px; font-size: 1.1rem; }

.btn-gold{
  background: var(--white);
  color: var(--gold-deep);
  border: 1.5px solid var(--gold);
  min-height: 48px;
  padding: 0 22px;
  font-size: 1rem;
}
.btn-gold:hover{ background: var(--ivory-deep); }

.btn-text{
  display:block;
  margin: 28px auto 0;
  background:none;
  border:none;
  color: var(--ink-soft);
  font-size: 0.95rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor:pointer;
  padding: 8px;
}

/* =========================================================
   共通：mizuhiki モチーフ
   ========================================================= */
.motif{ color: var(--gold); margin-bottom: 24px; opacity: 0.95; }
.motif svg{ filter: drop-shadow(0 0 10px rgba(214,184,132,0.65)); }
.motif-small{ margin-bottom: 16px; }

/* =========================================================
   1. トップページ
   ========================================================= */
.view{ width:100%; }

.view-fade-out{
  opacity: 0 !important;
  transition: opacity 0.9s ease;
}
.view-fade-in-start{ opacity: 0; }
.view-fade-in-active{
  opacity: 1;
  transition: opacity 1.1s ease 0.15s;
}

.view-top{
  min-height: 100vh;
  min-height: 100dvh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 40px 24px 56px;
  background:
    radial-gradient(circle 2px at 12% 18%, rgba(214,184,132,0.55), rgba(214,184,132,0)),
    radial-gradient(circle 1.5px at 85% 14%, rgba(214,184,132,0.5), rgba(214,184,132,0)),
    radial-gradient(circle 2px at 80% 62%, rgba(214,184,132,0.4), rgba(214,184,132,0)),
    radial-gradient(circle 1.5px at 18% 78%, rgba(214,184,132,0.5), rgba(214,184,132,0)),
    radial-gradient(circle 1px at 92% 85%, rgba(214,184,132,0.45), rgba(214,184,132,0)),
    radial-gradient(circle at 50% 0%, var(--ivory-deep) 0%, var(--ivory) 55%);
}

.top-inner{
  max-width: 480px;
  width:100%;
  text-align:center;
}

@keyframes fade-up{
  from{ opacity:0; transform: translateY(16px); }
  to{ opacity:1; transform: translateY(0); }
}

.top-inner > *{
  opacity: 0;
  animation: fade-up 1.4s cubic-bezier(.19,.7,.15,1) both;
}
.top-inner .motif{        animation-delay: 0.10s; }
.top-inner .eyebrow{      animation-delay: 0.42s; }
.top-inner .couple-name{  animation-delay: 0.74s; }
.top-inner .top-date{     animation-delay: 1.06s; }
.top-inner .top-message{  animation-delay: 1.38s; }
.top-inner .btn{          animation-delay: 1.74s; }

.eyebrow{
  font-family: var(--font-latin);
  font-style: italic;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.34em;
  color: var(--gold-deep);
  text-transform: uppercase;
  margin: 0 0 16px;
}

.couple-name{
  font-family: var(--font-latin);
  font-size: clamp(2.3rem, 10vw, 3.1rem);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 14px;
  letter-spacing: 0.015em;
}

.top-date{
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--gold-deep);
  letter-spacing: 0.22em;
  margin: 0 0 8px;
}

.top-date::after{
  content: "";
  display: block;
  width: 44px;
  height: 1.5px;
  background: linear-gradient(to right, transparent, var(--gold) 50%, transparent);
  margin: 22px auto 0;
}

.top-message{
  font-size: 1.03rem;
  line-height: 2;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  white-space: pre-line;
  margin-top: 40px;
  margin-bottom: 48px;
}
.top-message p{ margin: 0 0 1.4em; }
.top-message p:last-child{ margin-bottom: 0; }

/* =========================================================
   2. 合言葉ページ
   ========================================================= */
.view-password{
  min-height: 100vh;
  min-height: 100dvh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 40px 24px;
  background: var(--ivory);
}

.password-inner{
  max-width: 400px;
  width:100%;
  text-align:center;
}

.password-title{
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  margin: 0 0 14px;
  color: var(--ink);
}

.password-desc{
  font-size: 0.98rem;
  color: var(--ink-soft);
  margin: 0 0 32px;
}

#password-form{ display:flex; flex-direction:column; gap:16px; align-items:center; }

.password-input{
  width:100%;
  min-height: 58px;
  padding: 0 8px 12px;
  font-family: var(--font-latin);
  font-size: 1.35rem;
  letter-spacing: 0.1em;
  text-align:center;
  border: none;
  border-bottom: 1.5px solid var(--gold-light);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
}
.password-input::placeholder{ font-family: var(--font-sans); font-size: 1rem; letter-spacing: 0.02em; color: #B7A98F; }
.password-input:focus{
  outline:none;
  border-bottom-color: var(--gold-deep);
  box-shadow: 0 1px 0 0 var(--gold-deep);
}

.password-error{
  width:100%;
  margin: -4px 0 0;
  padding: 12px 14px;
  background: #FBEAE6;
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: var(--radius);
  font-size: 0.95rem;
  text-align:left;
}

/* =========================================================
   3. アルバムページ
   ========================================================= */
.view-album{ min-height: 100vh; min-height: 100dvh; background: var(--ivory); padding-bottom: 60px; }

.album-header{
  z-index: 5;
  background: var(--ivory);
  border-bottom: 1px solid var(--ivory-deep);
  text-align:center;
  padding: 18px 16px 14px;
}
.album-header-title{
  font-family: var(--font-latin);
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0 0 4px;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.album-header-date{
  font-family: var(--font-serif);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  color: var(--gold-deep);
  margin: 0;
}

.section-nav{
  position: sticky;
  top: 0;
  z-index: 5;
  display:flex;
  gap: 4px;
  overflow-x: auto;
  padding: 10px 12px;
  background: rgba(251,247,239,0.94);
  backdrop-filter: saturate(1.1) blur(4px);
  border-bottom: 1px solid var(--ivory-deep);
  scrollbar-width: none;
}
.section-nav::-webkit-scrollbar{ display:none; }

.nav-link{
  flex: 0 0 auto;
  display:flex;
  align-items:center;
  min-height: 40px;
  padding: 6px 14px;
  font-family: var(--font-latin);
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav-link:hover,
.nav-link:focus-visible{
  color: var(--gold-deep);
  border-bottom-color: var(--gold-light);
  outline: none;
}

.album-section{
  padding: 56px 20px;
  scroll-margin-top: 56px;
  max-width: 720px;
  margin: 0 auto;
}
.album-section:nth-child(odd){ background: var(--ivory); }
.album-section:nth-child(even){ background: var(--white); }

.section-title-wrap{ text-align:center; margin-bottom: 34px; }
.section-title{
  font-family: var(--font-latin);
  font-weight: 600;
  font-size: 1.7rem;
  letter-spacing: 0.05em;
  color: var(--ink);
  margin: 0;
}
.section-title-ja{
  font-family: var(--font-serif);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--gold-deep);
  margin: 6px 0 0;
}
.section-rule{
  width: 40px;
  height: 1.5px;
  background: linear-gradient(to right, transparent, var(--gold) 50%, transparent);
  margin: 18px auto 0;
}

/* ---- Our Wedding（イントロ） ---- */
.intro-hero{
  width: 100%;
  border-radius: 3px;
  box-shadow: 0 6px 22px rgba(120,96,56,0.16);
  margin-bottom: 30px;
  display:block;
}
.intro-text p{
  font-size: 1.02rem;
  line-height: 2;
  color: var(--ink-soft);
  text-align:center;
  margin: 0 0 1.2em;
}
.intro-text p:last-child{ margin-bottom: 0; }

/* ---- ギャラリー（Masonry） ---- */
.gallery-group-label{
  font-family: var(--font-latin);
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--gold-deep);
  text-align:center;
  margin: 30px 0 16px;
}
.gallery-group-label:first-of-type{ margin-top: 0; }

.masonry-grid{
  column-count: 2;
  column-gap: 12px;
}
.masonry-item{
  position: relative;
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--ivory-deep);
  border: 1px solid var(--ivory-deep);
  box-shadow: 0 2px 10px rgba(120,96,56,0.08);
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease;
}
.masonry-item::before{
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(to right, transparent, #E9CB8B 15%, var(--gold) 50%, #8C6A2E 85%, transparent);
  z-index: 1;
}
.masonry-item:active{ transform: scale(0.98); }
.masonry-item img{
  width: 100%;
  height: auto;
  display: block;
}
.masonry-item:focus-visible{ outline: 3px solid var(--gold-deep); outline-offset: 2px; }

/* ---- Movies（YouTube） ---- */
.movie-item{ margin-bottom: 36px; }
.movie-item:last-child{ margin-bottom: 0; }
.movie-frame{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(120,96,56,0.16);
  background: #000;
}
.movie-frame iframe{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.movie-thumb-btn{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.movie-thumb-img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  transition: opacity .15s ease, transform .2s ease;
}
.movie-thumb-btn:hover .movie-thumb-img{ opacity: 1; transform: scale(1.02); }
.movie-play-icon{
  position: relative;
  z-index: 1;
  display: flex;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
  transition: transform .15s ease;
}
.movie-thumb-btn:hover .movie-play-icon{ transform: scale(1.08); }
.movie-thumb-btn:focus-visible{ outline: 3px solid var(--gold-deep); outline-offset: 3px; }
.movie-caption{
  text-align:center;
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 14px 0 0;
}

/* ---- 外部動画（Googleドライブ等）カード ---- */
.movie-thumb-external{
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 55%, var(--gold-deep) 100%);
}

/* ---- 外部動画の再生モーダル ---- */
.ext-modal{
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.ext-modal.is-visible{ opacity: 1; }
.ext-modal-overlay{
  position: absolute;
  inset: 0;
  background: rgba(30,26,20,0.92);
}
.ext-modal-panel{
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--ivory);
  border-radius: 4px;
  padding: 44px 16px 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.ext-modal-close{
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(62,54,42,0.08);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
}
.ext-modal-title{
  text-align: center;
  font-size: 1rem;
  color: var(--ink);
  margin: 0 0 14px;
}
.ext-modal-title[hidden]{ display: none; }
.ext-modal-body{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 2px;
  overflow: hidden;
}
.ext-modal-body iframe,
.ext-modal-body video{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- チャプター一覧 ---- */
.ext-modal-chapters{
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--ivory-deep);
}
.ext-chapters-heading{
  font-family: var(--font-serif);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: var(--gold-deep);
  margin: 0 0 10px;
}
.ext-chapters-list{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ext-chapter-btn{
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--ivory-deep);
  border-radius: 3px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.ext-chapter-btn:hover,
.ext-chapter-btn:focus-visible{
  background: var(--ivory-deep);
  border-color: var(--gold-light);
  outline: none;
}
.ext-chapter-time{
  flex: 0 0 auto;
  font-family: var(--font-latin);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--gold-deep);
  min-width: 58px;
}
.ext-chapter-title{
  font-size: 0.95rem;
  color: var(--ink);
}

/* ---- Thank You（アウトロ） ---- */
.section-outro{ text-align:center; }
.outro-motif{ display:flex; justify-content:center; margin-bottom: 18px; }
.outro-title{
  font-family: var(--font-latin);
  font-weight: 600;
  font-size: 1.7rem;
  color: var(--ink);
  margin: 0 0 28px;
}
.outro-text p{
  font-size: 1.02rem;
  line-height: 2;
  color: var(--ink-soft);
  margin: 0 0 0.4em;
}
.outro-sign{
  font-family: var(--font-latin);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--gold-deep);
  margin-top: 26px;
}

.empty-state{
  text-align:center;
  color: var(--ink-soft);
  font-size: 1rem;
  padding: 40px 20px;
}

.btn-load-more{
  display: block;
  margin: 28px auto 0;
  min-height: 48px;
  padding: 0 28px;
  border-radius: 2px;
  border: 1.5px solid var(--gold-light);
  background: var(--white);
  color: var(--gold-deep);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.btn-load-more:hover{ background: var(--ivory-deep); }
.btn-load-more:focus-visible{ outline: 3px solid var(--gold-deep); outline-offset: 2px; }

/* =========================================================
   ライトボックス
   ========================================================= */
.lightbox{
  position:fixed; inset:0; z-index:100;
  background: rgba(30,26,20,0.96);
  display:flex; flex-direction:column;
  touch-action: none;
  opacity: 0;
  transition: opacity 0.75s ease;
}
.lightbox.is-visible{ opacity: 1; }
.lb-stage{
  flex:1;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
  position:relative;
}
.lb-stage img{
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  user-select:none;
  -webkit-user-drag: none;
  opacity: 1;
  transition: opacity 0.45s ease;
}
.lb-stage img.is-fading{ opacity: 0; }
.lb-close{
  position:absolute; top:14px; right:14px; z-index:5;
  width:48px; height:48px;
  border-radius:50%;
  border:none;
  background: rgba(255,255,255,0.14);
  color:#fff;
  font-size:1.3rem;
  cursor:pointer;
}
.lb-nav{
  position:absolute; top:50%; transform: translateY(-50%);
  width:52px; height:52px;
  border-radius:50%;
  border:none;
  background: rgba(255,255,255,0.14);
  color:#fff;
  font-size:1.8rem;
  line-height:1;
  cursor:pointer;
  z-index:5;
}
.lb-prev{ left:10px; }
.lb-next{ right:10px; }
.lb-footer{
  padding: 16px;
  display:flex; justify-content:center;
}

@media (min-width: 600px){
  .gallery-grid{ grid-template-columns: repeat(3, 1fr); }
}

/* =========================================================
   デスクトップ／タブレット幅（パソコンのブラウザ表示）
   ========================================================= */
@media (min-width: 900px){
  .album-header{
    max-width: 920px;
    margin: 0 auto;
  }
  .section-nav{
    justify-content: center;
    overflow-x: visible;
  }
  .album-section{
    max-width: 860px;
    padding: 72px 24px;
  }
  .masonry-grid{
    column-count: 3;
    column-gap: 20px;
  }
  .masonry-item{ margin-bottom: 20px; cursor: zoom-in; }
  .masonry-item:hover{ box-shadow: 0 6px 18px rgba(120,96,56,0.16); }

  .top-inner{ max-width: 520px; }
  .password-inner{ max-width: 420px; }

  .lb-stage img{ max-width: 760px; max-height: 82vh; }
  .lb-nav{ width:60px; height:60px; font-size:2.1rem; }
}
