/* ================================
   Design tokens (from Figma)
   ================================ */
:root {
  --text: #656565;
  --text-muted: #8d8d8d;
  --accent: #e29f95;        /* coral: 席次ボタン・卓の円・飾り文字 */
  --accent-thumb: #e39e94;
  --sage: #7d8c87;          /* メニューボタン・高砂・カテゴリ */
  --line: #eae0dc;
  --track: #ebe0db;
  --canvas: #e2ece9;        /* PC で見たときの余白の色 */

  --font: "DM Sans", "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
  --font-script: "Parisienne", cursive;

  /* 席次カード。ゲスト名を大きくするときは幅も一緒に広げる */
  --guest-font-size: 8px;
  --table-card-width: 150px;
}

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

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

body {
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font);
  font-variation-settings: "opsz" 14;
  font-size: 16px;
  line-height: normal;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

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

/* 1 画面 = 白いカード。PC では Figma のキャンバスのように中央に浮かせる */
.screen {
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 12px 24px rgba(48, 27, 27, 0.1);
  position: relative;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* ================================
   Top
   ================================ */
/* スマホのブラウザは上下のバーで表示領域が短いので、
   1 画面に収まるように高さに応じて余白とイラストを詰める */
.screen--top {
  min-height: 100vh;
  min-height: 100svh;
  /* 縦中央揃えはしない: モバイルでツールバーの出入りで高さが変わると内容が上下に動いてしまう */
  /* 葉が外にはみ出してページのスクロール範囲を伸ばさないように（iOS 対策） */
  overflow: hidden;
  overflow: clip;
}

@media (max-height: 780px) {
  .screen--top {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .screen--top .hero {
    height: 184px;
  }

  .screen--top .hero img {
    width: 288px;
    height: 180px;
  }

  .screen--top .header-text {
    gap: 8px;
    padding-bottom: 12px;
  }

  .screen--top .welcome {
    padding: 8px 32px;
  }

  .screen--top .actions {
    gap: 12px;
    padding: 16px 32px;
  }
}

@media (max-height: 660px) {
  .screen--top .hero {
    height: 150px;
  }

  .screen--top .hero img {
    width: 240px;
    height: 150px;
  }

  .screen--top .welcome p {
    font-size: 12px;
  }

  .screen--top .btn {
    padding: 15px;
  }
}

@media (max-height: 600px) {
  .screen--top .hero {
    height: 120px;
  }

  .screen--top .hero img {
    width: 192px;
    height: 120px;
  }

  .screen--top .header-text {
    padding-bottom: 8px;
  }

  .screen--top .welcome {
    padding: 4px 32px;
  }
}

.hero {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero img {
  width: 320px;
  height: 200px;
  object-fit: cover;
}

.header-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 24px 24px;
}

.welcome-title {
  width: 100%;
  aspect-ratio: 354 / 104;
  object-fit: cover;
}

.date {
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  text-align: center;
  word-break: break-word;
}

.welcome h1 {
  font-size: 16px;
  font-weight: 700;
}

.welcome p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 32px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 18px;
  border: 1px solid;
  border-radius: 100px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.btn img {
  width: 20px;
  height: 20px;
}

.btn--seating {
  border-color: var(--accent);
  box-shadow: 0 6px 6px rgba(226, 159, 149, 0.2);
}

.btn--menu {
  border-color: var(--sage);
  box-shadow: 0 6px 6px rgba(125, 140, 135, 0.15);
}

.btn {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

@media (hover: hover) {
  .btn:hover {
    transform: translateY(-2px);
  }

  .btn--seating:hover {
    box-shadow: 0 10px 16px rgba(226, 159, 149, 0.3);
  }

  .btn--menu:hover {
    box-shadow: 0 10px 16px rgba(125, 140, 135, 0.22);
  }
}

.btn:active {
  transform: translateY(1px) scale(0.985);
  transition-duration: 0.1s;
}

/* ================================
   Nav header (席次表 / メニュー表)
   ================================ */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
}

.nav__back {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: #fff;
}

/* 見た目は 30px のまま、タップ領域だけ広げる */
.nav__back::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.nav__back {
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.nav__back:active {
  transform: scale(0.9);
  background: #faf6f5;
}

.nav__back img {
  width: 14px;
  height: 14px;
}

.nav__title {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.nav__spacer {
  width: 38px;
  height: 38px;
}

/* 飾り見出し（Guest Tables / La Cuisine） */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.divider img {
  width: 24px;
  height: 16px;
}

.divider span {
  font-family: var(--font-script);
  font-size: 20px;
  color: var(--accent);
  white-space: nowrap;
}

/* ================================
   Seating
   ================================ */
.seating {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 12px 20px 24px;
}

.head-table-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.head-table {
  padding: 14px 48px;
  border: 1px solid var(--sage);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 4px rgba(125, 140, 135, 0.13);
  text-align: center;
  white-space: nowrap;
}

.head-table__title {
  font-size: 16px;
  font-weight: 700;
}

.head-table__sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* 4 行まとめて横スクロール */
.tables-scroll {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tables-scroll::-webkit-scrollbar {
  display: none;
}

.table-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: max-content;
}

.table-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: var(--table-card-width);
  flex-shrink: 0;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 4px 8px rgba(78, 62, 60, 0.03);
  overflow: hidden;
  scroll-snap-align: start;
}

.table-card__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--sage);
  white-space: nowrap;
}

.table-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.guests {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.guests span {
  display: block;
  padding: 1px;
  font-size: var(--guest-font-size);
  white-space: nowrap;
}

.table-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.scroll-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 12px;
}

.scroll-indicator[hidden] {
  display: none;
}

.scroll-indicator__track {
  position: relative;
  width: 60px;
  height: 3px;
  border-radius: 2px;
  background: var(--track);
}

.scroll-indicator__thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent-thumb);
  will-change: transform;
  transition: transform 0.12s ease-out;
}

/* ================================
   Menu
   ================================ */
.menu-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 12px 24px 24px;
}

.menu-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 8px 8px rgba(78, 62, 60, 0.02);
}

.menu-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: center;
  word-break: break-word;
}

.menu-item__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
}

.menu-item__icon img {
  width: 44px;
  height: 44px;
  object-fit: cover;
}

.menu-item__text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.menu-item__category {
  font-size: 12px;
  font-weight: 700;
  color: var(--sage);
  text-transform: uppercase;
  white-space: nowrap;
}

.menu-item__title {
  font-size: 16px;
  font-weight: 700;
}

.menu-item__desc {
  font-size: 12px;
  color: var(--text-muted);
}

.menu-sep {
  width: 48px;
  height: 1px;
}

.note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 0.5px solid var(--sage);
  border-radius: 16px;
  background: #fff;
}

.note img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.note p {
  flex: 1;
  font-size: 11px;
  line-height: 1.4;
  color: var(--sage);
}

/* ================================
   Motion
   すべて prefers-reduced-motion で無効化される。
   .reveal / .reveal-scroll は JS が動く環境（html.js）でだけ非表示から始める。
   ================================ */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes sway {
  from {
    transform: rotate(-7deg);
  }
  to {
    transform: rotate(7deg);
  }
}

@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  8% {
    opacity: var(--o, 0.4);
  }
  90% {
    opacity: var(--o, 0.4);
  }
  100% {
    transform: translate3d(var(--sway, 30px), var(--travel, calc(100vh + 80px)), 0);
    opacity: 0;
  }
}

@keyframes petal-sway {
  from {
    transform: translateX(-10px) rotate(-30deg);
  }
  to {
    transform: translateX(10px) rotate(30deg);
  }
}

/* 出現アニメーション（読み込み時、--d で時間差） */
html.js .reveal {
  animation: fade-in 0.9s ease-out var(--d, 0ms) both;
}

/* 出現アニメーション（スクロールで見えたとき） */
html.js .reveal-scroll {
  opacity: 0;
  transition: opacity 0.9s ease-out var(--d, 0ms);
}

html.js .reveal-scroll.is-visible {
  opacity: 1;
}

/* 飾り見出し: 葉が揺れ、筆記体が書き上がる */
.divider img {
  transform-origin: 50% 100%;
  animation: sway 3.2s ease-in-out infinite alternate;
}

.divider img + span + img {
  animation-delay: -1.6s;
}

/* トップの背景を漂う葉 */
.petals {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.petal {
  position: absolute;
  top: -40px;
  left: var(--x, 50%);
  display: block;
  opacity: 0;
  animation: drift var(--t, 16s) linear var(--delay, 0s) infinite;
  will-change: transform, opacity;
}

.petal img {
  display: block;
  width: var(--s, 18px);
  height: auto;
  animation: petal-sway var(--sw, 3s) ease-in-out infinite alternate;
}

/* 葉より前に描画されるように、本文側を positioned にする */
.screen > :not(.petals) {
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  html.js .reveal-scroll {
    opacity: 1;
  }

  .petals {
    display: none;
  }
}
