/* =============================================
   結婚式Web招待状 共通スタイルシート v4
   フォント: Zen Old Mincho + Noto Serif JP
   iPhone XS(375px)〜iPhone 15 Pro Max(430px)対応
   ============================================= */

/* --- ベース・リセット --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  background: #f5f0e8;
  color: #4a4a4a;
  line-height: 1.8;
  padding: 14px;
  min-height: 100vh;
}

/* --- 和紙風テクスチャ背景 --- */
.washi {
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm69-47c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM57 16c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm-5 66c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm48-20c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3z' fill='%23c9a227' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* --- コンテナ（カード） --- */
.container {
  max-width: 520px;
  margin: 0 auto;
  background: #fff;
  border-radius: 4px;
  padding: 24px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  border-top: 2px solid #c9a227;
  position: relative;
  z-index: 2;
}

/* --- 見出し（Zen Old Mincho） --- */
h1, h2, h3 {
  font-family: "Zen Old Mincho", "Noto Serif JP", serif;
}

h1 {
  text-align: center;
  font-size: clamp(1.35rem, 5.5vw, 1.8rem);
  margin-bottom: 6px;
  color: #c9a227;
  font-weight: 400;
  letter-spacing: 0.15em;
}

.subtitle {
  text-align: center;
  font-size: clamp(0.85rem, 3vw, 0.95rem);
  color: #888;
  margin-bottom: 24px;
  letter-spacing: 0.05em;
}

.subtitle::after {
  content: "";
  display: block;
  width: 36px;
  height: 1px;
  background: #c9a227;
  margin: 12px auto 0;
  opacity: 0.5;
}

/* --- 装飾 --- */
.ornament {
  text-align: center;
  color: #c9a227;
  font-size: 1.2rem;
  margin: 8px 0 20px;
  opacity: 0.4;
  letter-spacing: 0.3em;
}

/* --- フォーム共通 --- */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: clamp(0.88rem, 3.1vw, 0.98rem);
  margin-bottom: 6px;
  color: #555;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #e0d5c5;
  border-radius: 2px;
  font-size: clamp(1rem, 3.8vw, 1.1rem);
  font-family: inherit;
  background: #faf8f5;
  color: #4a4a4a;
  transition: border-color 0.3s, background 0.3s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #c9a227;
}

input[readonly] {
  background: #f0ece4;
  color: #888;
  cursor: default;
}

textarea {
  resize: vertical;
  min-height: 90px;
}

/* --- ラジオボタン --- */
.radio-group {
  display: flex;
  gap: 20px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  cursor: pointer;
  font-size: clamp(1rem, 3.8vw, 1.1rem);
  margin-bottom: 0;
}

input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: #c9a227;
  flex-shrink: 0;
}

/* --- ボタン --- */
.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 2px;
  font-size: clamp(1rem, 3.8vw, 1.1rem);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s;
  letter-spacing: 0.1em;
  margin-top: 8px;
}

.btn-primary {
  background: #c9a227;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #b08d1f;
}

.btn-secondary {
  background: #eee;
  color: #555;
}

.btn-secondary:hover:not(:disabled) {
  background: #e0e0e0;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- メッセージ --- */
.message {
  margin-top: 16px;
  padding: 14px;
  border-radius: 4px;
  font-size: clamp(0.9rem, 3.2vw, 1rem);
  display: none;
  text-align: center;
  line-height: 1.6;
}

.message.error {
  background: #fdf5f5;
  color: #933;
}

.message.success {
  background: #f5fdf5;
  color: #282;
}

/* --- ローディング --- */
.loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #888;
  font-size: clamp(0.9rem, 3.2vw, 1rem);
  margin-top: 16px;
}

.loading-momiji {
  font-size: 2.2rem;
  animation: momiji-bounce 1.2s ease-in-out infinite;
}

@keyframes momiji-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-6px) rotate(5deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-3px) rotate(-3deg); }
}

/* --- 画像 --- */
.preview-img,
.guest-image {
  max-width: 100%;
  height: auto;
  max-height: 220px;
  border-radius: 4px;
  margin-top: 10px;
  object-fit: cover;
}

.guest-image {
  margin-top: 8px;
}

/* --- ファイル入力 --- */
input[type="file"] {
  font-size: clamp(0.9rem, 3.2vw, 1rem);
  font-family: inherit;
  color: #555;
}

/* --- 確認画面の情報行 --- */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid #f0ece4;
  gap: 12px;
  flex-wrap: wrap;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-size: clamp(0.85rem, 3vw, 0.95rem);
  color: #888;
  flex-shrink: 0;
  min-width: 100px;
  letter-spacing: 0.05em;
}

.info-value {
  font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  color: #4a4a4a;
  text-align: right;
  flex: 1;
  word-break: break-all;
  min-width: 0;
}

/* --- 編集モード（confirm.html） --- */
.edit-mode .info-value input[type="text"],
.edit-mode .info-value input[type="email"],
.edit-mode .info-value textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e0d5c5;
  border-radius: 2px;
  font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  font-family: inherit;
  background: #faf8f5;
  color: #4a4a4a;
}

.edit-mode .info-value textarea {
  resize: vertical;
  min-height: 90px;
}

.edit-mode .info-value input[readonly] {
  background: #f0ece4;
  color: #888;
  cursor: default;
  border: 1px solid #e0d5c5;
}

.edit-mode .info-value input[readonly]:focus {
  outline: none;
}

.readonly-note {
  font-size: clamp(0.75rem, 2.6vw, 0.85rem);
  color: #aaa;
  margin-top: 4px;
  text-align: right;
}

/* --- ユーティリティ --- */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

/* =============================================
   バリデーション・フォーム強化
   ============================================= */

.required {
  color: #c44;
  font-size: 0.75em;
  margin-left: 2px;
}

.field-hint {
  font-size: clamp(0.8rem, 2.8vw, 0.88rem);
  color: #999;
  margin-top: 4px;
  line-height: 1.5;
}

.field-error {
  font-size: clamp(0.82rem, 2.9vw, 0.9rem);
  color: #933;
  margin-top: 6px;
  min-height: 1.4em;
  line-height: 1.4;
}

input.error,
textarea.error {
  border-color: #c44;
  background: #fdf5f5;
}

input.success,
textarea.success {
  border-color: #4a4;
  background: #f5fdf5;
}

.char-counter {
  text-align: right;
  font-size: clamp(0.78rem, 2.6vw, 0.85rem);
  color: #aaa;
  margin-top: 4px;
}

.char-counter.warning {
  color: #c9a227;
}

.char-counter.danger {
  color: #c44;
}

/* =============================================
   index.html 固有
   ============================================= */

.hero {
  position: relative;
  text-align: center;
  margin-bottom: 28px;
  padding: 10px 0;
}

.hero h1 {
  font-family: "Zen Old Mincho", "Noto Serif JP", serif;
  font-size: clamp(1.5rem, 6.5vw, 2.1rem);
  margin-bottom: 8px;
  font-weight: 400;
}

.hero .names {
  font-family: "Zen Old Mincho", "Noto Serif JP", serif;
  font-size: clamp(1.2rem, 5vw, 1.7rem);
  color: #c9a227;
  margin-bottom: 8px;
  letter-spacing: 0.1em;
  font-weight: 400;
}

.hero .date {
  font-size: clamp(0.95rem, 3.8vw, 1.1rem);
  color: #777;
  letter-spacing: 0.08em;
}

/* --- カウントダウン --- */
.countdown-box {
  background: #faf8f5;
  border: 1px solid #f0ece4;
  border-radius: 4px;
  padding: 20px 14px;
  margin-bottom: 28px;
  text-align: center;
}

.countdown-label {
  font-family: "Zen Old Mincho", "Noto Serif JP", serif;
  font-size: clamp(0.9rem, 3.2vw, 1rem);
  color: #888;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}

.countdown-numbers {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.countdown-item {
  display: flex;
  align-items: baseline;
  gap: 1px;
  padding: 0 3px;
}

.countdown-value {
  font-family: "Zen Old Mincho", "Noto Serif JP", serif;
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  color: #c9a227;
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1;
  min-width: 1.6em;
  text-align: center;
  display: inline-block;
}

.countdown-unit {
  font-size: clamp(0.78rem, 2.6vw, 0.88rem);
  color: #888;
}

.countdown-message {
  font-size: clamp(0.85rem, 3vw, 0.95rem);
  color: #999;
  letter-spacing: 0.05em;
}

.greeting {
  font-size: clamp(0.92rem, 3.5vw, 1.05rem);
  line-height: 2.2;
  text-align: center;
  margin-bottom: 28px;
  color: #555;
  white-space: pre-line;
}

.info-box {
  background: #faf8f5;
  border: 1px solid #f0ece4;
  border-radius: 4px;
  padding: 20px 16px;
  margin-bottom: 28px;
}

.info-box h2 {
  text-align: center;
  font-size: clamp(1rem, 3.8vw, 1.15rem);
  color: #c9a227;
  margin-bottom: 16px;
  font-weight: 400;
  letter-spacing: 0.12em;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f0ece4;
  font-size: clamp(0.9rem, 3.5vw, 1rem);
  gap: 12px;
}

.info-item:last-child {
  border-bottom: none;
}

.info-item-label {
  color: #888;
  flex-shrink: 0;
  min-width: 80px;
}

.info-item-value {
  color: #4a4a4a;
  text-align: right;
  flex: 1;
  word-break: break-all;
}

/* --- 地図セクション --- */
.map-section {
  margin-top: 16px;
}

.map-card {
  position: relative;
  width: 100%;
  height: 200px;
  background: #f0ece4;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #e0d5c5;
}

.map-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      rgba(201,162,39,0.06) 39px,
      rgba(201,162,39,0.06) 40px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 39px,
      rgba(201,162,39,0.06) 39px,
      rgba(201,162,39,0.06) 40px
    );
}

.map-road-h {
  position: absolute;
  top: 55%;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(180,160,130,0.25);
}

.map-road-v {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 45%;
  width: 3px;
  background: rgba(180,160,130,0.25);
}

.map-pin {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.map-pin::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  background: #c9a227;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.map-pin::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
}

.map-venue-label {
  position: absolute;
  top: 62%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.95);
  padding: 4px 12px;
  border-radius: 2px;
  font-size: clamp(0.8rem, 3vw, 0.9rem);
  color: #c9a227;
  letter-spacing: 0.05em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  white-space: nowrap;
}

.map-stations {
  margin-top: 12px;
  padding: 12px 16px;
  background: #faf8f5;
  border-radius: 4px;
  border: 1px solid #f0ece4;
}

.map-station-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: clamp(0.85rem, 3vw, 0.95rem);
  color: #666;
  line-height: 1.7;
  margin-bottom: 6px;
}

.map-station-item:last-child {
  margin-bottom: 0;
}

.map-station-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.map-station-icon svg {
  width: 100%;
  height: 100%;
}

.map-station-text strong {
  color: #c9a227;
  font-weight: 400;
}

.map-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e0d5c5;
  border-radius: 2px;
  color: #666;
  font-family: inherit;
  font-size: clamp(0.9rem, 3.2vw, 1rem);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: all 0.3s;
  cursor: pointer;
}

.map-btn:hover {
  background: #faf8f5;
  border-color: #c9a227;
  color: #c9a227;
}

.map-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.attendance-section {
  margin-top: 8px;
}

.attendance-section h2 {
  text-align: center;
  font-size: clamp(1rem, 3.8vw, 1.15rem);
  color: #c9a227;
  margin-bottom: 16px;
  font-weight: 400;
  letter-spacing: 0.12em;
}

.attendance-note {
  font-size: clamp(0.82rem, 3vw, 0.9rem);
  color: #999;
  text-align: center;
  margin-top: 12px;
  line-height: 1.6;
}

/* =============================================
   紅葉アニメーション（heroセクション内・前面）
   ============================================= */
.momiji-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.momiji-leaf {
  position: absolute;
  top: -40px;
  animation: momiji-fall linear infinite;
  user-select: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.08));
}

@keyframes momiji-fall {
  0% {
    transform: translateY(-10vh) rotate(0deg) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 0.5;
  }
  25% {
    transform: translateY(15vh) rotate(45deg) translateX(20px);
  }
  50% {
    transform: translateY(40vh) rotate(90deg) translateX(-10px);
  }
  75% {
    transform: translateY(65vh) rotate(135deg) translateX(15px);
    opacity: 0.4;
  }
  90% {
    opacity: 0.15;
  }
  100% {
    transform: translateY(110vh) rotate(180deg) translateX(0);
    opacity: 0;
  }
}

/* =============================================
   フードインアニメーション
   ============================================= */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* =============================================
   レスポンシブ
   ============================================= */

/* iPhone XS / 12 mini / 13 mini (375px) */
@media (max-width: 375px) {
  html {
    font-size: 15px;
  }
  body {
    padding: 12px;
  }
  .container {
    padding: 22px 14px;
  }
  .hero {
    padding: 8px 0;
  }
  .hero h1 {
    font-size: clamp(1.35rem, 5.8vw, 1.6rem);
    letter-spacing: 0.1em;
  }
  .hero .names {
    font-size: clamp(1.1rem, 4.8vw, 1.4rem);
    letter-spacing: 0.08em;
  }
  .countdown-box {
    padding: 16px 10px;
  }
  .countdown-numbers {
    gap: 2px;
  }
  .countdown-item {
    padding: 0 2px;
  }
  .countdown-value {
    font-size: clamp(1.35rem, 5vw, 1.6rem);
    min-width: 1.4em;
  }
  .countdown-unit {
    font-size: clamp(0.72rem, 2.4vw, 0.82rem);
  }
  .countdown-message {
    font-size: clamp(0.8rem, 2.8vw, 0.9rem);
  }
  .greeting {
    font-size: clamp(0.88rem, 3.3vw, 1rem);
    line-height: 2;
  }
  .info-box {
    padding: 16px 12px;
  }
  .info-item {
    font-size: clamp(0.85rem, 3.2vw, 0.95rem);
  }
  .map-card {
    height: 180px;
  }
  .map-stations {
    padding: 10px 12px;
  }
  .map-station-item {
    font-size: clamp(0.8rem, 2.9vw, 0.9rem);
  }
  .map-btn {
    padding: 10px;
    font-size: clamp(0.85rem, 3vw, 0.95rem);
  }
  .form-group {
    margin-bottom: 16px;
  }
  label {
    font-size: clamp(0.85rem, 3vw, 0.95rem);
  }
  input[type="text"],
  input[type="email"],
  textarea {
    padding: 12px 14px;
    font-size: clamp(0.95rem, 3.6vw, 1.05rem);
  }
  .btn {
    padding: 14px;
    font-size: clamp(0.95rem, 3.6vw, 1.05rem);
  }
  .attendance-note {
    font-size: clamp(0.78rem, 2.8vw, 0.88rem);
  }
  .field-hint,
  .field-error {
    font-size: clamp(0.78rem, 2.8vw, 0.88rem);
  }
  .message {
    font-size: clamp(0.85rem, 3vw, 0.95rem);
  }
}

/* iPhone 12/13/14/15 (390px) */
@media (min-width: 376px) and (max-width: 394px) {
  html {
    font-size: 15.5px;
  }
  .container {
    padding: 26px 18px;
  }
  .hero h1 {
    font-size: clamp(1.45rem, 5.8vw, 1.7rem);
  }
  .hero .names {
    font-size: clamp(1.15rem, 4.8vw, 1.5rem);
  }
  .countdown-value {
    font-size: clamp(1.45rem, 5.5vw, 1.8rem);
  }
}

/* iPhone 12/13/14/15 Pro (393px) */
@media (min-width: 395px) and (max-width: 429px) {
  html {
    font-size: 16px;
  }
  .container {
    padding: 28px 20px;
  }
  .hero h1 {
    font-size: clamp(1.5rem, 5.8vw, 1.8rem);
  }
  .hero .names {
    font-size: clamp(1.2rem, 4.8vw, 1.55rem);
  }
  .countdown-value {
    font-size: clamp(1.5rem, 5.5vw, 1.9rem);
  }
}

/* iPhone 14/15 Plus, 15 Pro Max (430px) */
@media (min-width: 430px) {
  html {
    font-size: 16.5px;
  }
  .container {
    padding: 32px 24px;
  }
  .hero h1 {
    font-size: clamp(1.6rem, 5.5vw, 2rem);
  }
  .hero .names {
    font-size: clamp(1.25rem, 4.5vw, 1.6rem);
  }
  .countdown-value {
    font-size: clamp(1.6rem, 5vw, 2rem);
  }
}

/* 大きい画面 */
@media (min-width: 480px) {
  body {
    padding: 20px;
  }
  .map-card {
    height: 220px;
  }
}

/* ラジオボタン調整 */
@media (max-width: 375px) {
  .radio-group {
    gap: 14px;
  }
  .radio-group label {
    font-size: clamp(0.95rem, 3.6vw, 1.05rem);
  }
  .info-label {
    min-width: 80px;
  }
}
