/* 招待状のページ（invite.html）。色・書体はアプリ（lib/app/palette.dart）とトップページ（style.css）にそろえる。
   封筒は design/invitation_demo と同じ形: 封蝋で封をし、押すと封蝋が取れ、ふたが開いて招待状が出る。内側とふたの裏は無地。 */
:root {
  --red: #d0342a;
  --red-light: #e35a4e;
  --navy: #1e2a4a;
  --cream: #f7f0e1;
  --paper: #fffbf2;
  --mustard: #e2a93b;
  --ink-soft: #5b5f6e;
  --hill: #9dbe8e;
  --ui: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  --display: "Dela Gothic One", "Hiragino Kaku Gothic StdN", "Hiragino Sans", sans-serif;
  --glide: cubic-bezier(.3, .9, .3, 1);
  --sheet-h: 236px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--ui);
  font-weight: 700;
  color: var(--navy);
  background: var(--cream);
  letter-spacing: 0.02em;
  font-feature-settings: "pkna" 1;
  text-spacing-trim: trim-start;
  line-break: strict;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }

.scene {
  position: relative;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------- 空・丘・ポスト ---------- */
.sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(#bcd8d0 0%, #d6e5d3 52%, #eae6ce 100%);
}
.cloud { position: absolute; height: 22px; border-radius: 999px; background: rgba(255, 251, 242, .85); }
.c1 { width: 86px; top: 14%; right: -18px; }
.c2 { width: 56px; top: 30%; left: -12px; }
.c3 { width: 40px; top: 8%; left: 22%; opacity: .7; }
.hill {
  position: absolute;
  left: -30%;
  right: -30%;
  bottom: 0;
  height: calc(var(--sheet-h) + 120px);
  border-radius: 50% 50% 0 0 / 90px 90px 0 0;
  background: var(--hill);
}
.post {
  position: absolute;
  left: 18px;
  bottom: calc(var(--sheet-h) + 92px);
  width: 58px;
  height: 121px;
}

.brand {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  margin: max(18px, env(safe-area-inset-top)) 0 0 22px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 17px;
  text-decoration: none;
  /* 開いた招待状が封筒の上に出る分の余白（封筒は残りの高さの下のほうに置く） */
  margin-bottom: 190px;
}

/* ---------- 封筒 ---------- */
.envelope {
  position: relative;
  z-index: 2;
  flex: none;
  width: 260px;
  height: 172px;
  margin: auto auto 34px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: default;
  perspective: 900px;
}
.is-sealed .envelope { cursor: pointer; animation: bob 3.4s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(-10px) rotate(-3deg); }
  50% { transform: translateY(-24px) rotate(-1deg); }
}
.envelope > span { position: absolute; display: block; }
.env-in { inset: 0; border-radius: 8px; background: #e9ddc3; box-shadow: 0 12px 24px rgba(11, 15, 28, .24); }
.env-front {
  inset: 0;
  z-index: 4;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 260 172'%3E%3Cpath d='M0 0L130 98L260 0V172H0Z' fill='%23FFFBF2'/%3E%3Cpath d='M0 172L104 78M260 172L156 78M0 0L130 98L260 0' stroke='%23EADFC6' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
  border-radius: 0 0 8px 8px;
}
.flap {
  left: 0;
  top: 0;
  width: 260px;
  height: 110px;
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  /* はじめは開いた形（JS が無いとき・動きを減らす設定のとき） */
  transform: rotateX(180deg);
  z-index: 2;
}
.flap > span { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flap-face {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 260 110'%3E%3Cpath d='M0 4Q0 0 4 0H256Q260 0 260 4L137 103Q130 108 123 103Z' fill='%23F3EAD6'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
  filter: drop-shadow(0 2px 2px rgba(150, 106, 45, .22));
}
/* ふたの裏。左右に裏返す（上下に裏返すと、開いたときに三角が逆さになる）。 */
.flap-back {
  transform: rotateY(180deg);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 260 110'%3E%3Cpath d='M0 4Q0 0 4 0H256Q260 0 260 4L137 103Q130 108 123 103Z' fill='%23EDE2CA'/%3E%3C/svg%3E") no-repeat 0 0 / 100% 100%;
}
.seal {
  left: 112px;
  top: 82px;
  width: 36px;
  height: 36px;
  z-index: 6;
  border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle, var(--red-light) 0 9px, var(--red) 9.6px);
  box-shadow: 0 2px 4px rgba(90, 22, 17, .4);
  opacity: 0;
  transform: scale(.3) rotate(50deg);
}

/* 招待状のカード */
.card {
  left: 12px;
  top: 10px;
  width: 236px;
  height: 152px;
  z-index: 3;
  border-radius: 6px;
  background: var(--paper);
  box-shadow: 0 3px 10px rgba(11, 15, 28, .16);
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transform: translateY(-168px) scale(1.18);
}
.frame { position: absolute; inset: 7px; border: 1.6px solid var(--mustard); border-radius: 3px; }
.frame::after { content: ""; position: absolute; inset: 3px; border: .8px solid var(--mustard); border-radius: 1.5px; }
.mini-post { width: 15px; height: 31px; }
.title { font-family: var(--display); font-weight: 400; font-size: 24px; letter-spacing: .32em; margin-right: -.32em; line-height: 1.15; }
.rule { width: 26px; height: 3px; border-radius: 2px; background: var(--red); }
.text { font-size: 11px; line-height: 1.65; word-break: auto-phrase; }

/* 封をした状態 → 開く */
.is-sealed .card { transform: none; }
.is-sealed .flap { transform: none; z-index: 5; }
.is-sealed .seal { opacity: 1; transform: none; }
.is-opening .seal, .is-open .seal { transition: transform .4s cubic-bezier(.3, 1.45, .45, 1), opacity .2s; }
.is-opening .flap, .is-open .flap { transition: transform .6s ease .2s, z-index 0s .5s; }
.is-opening .card, .is-open .card { transition: transform .8s var(--glide) .55s; }

/* ---------- 下のシート ---------- */
.sheet {
  position: relative;
  z-index: 3;
  flex: none;
  min-height: var(--sheet-h);
  padding: 26px 24px max(20px, env(safe-area-inset-bottom));
  border-radius: 36px 36px 0 0;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.is-sealed .sheet, .is-opening:not(.is-open) .sheet { transform: translateY(105%); }
.sheet { transition: transform .55s var(--glide); }
.open-app {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 58px;
  border-radius: 999px;
  background: var(--red);
  color: var(--paper);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}
.open-app[hidden] { display: none; }
.stores { display: flex; gap: 10px; }
.store {
  flex: 1;
  height: 54px;
  border-radius: 16px;
  background: var(--navy);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
}
.store svg { width: 20px; height: 20px; flex: none; }
.store span { display: flex; flex-direction: column; }
.store small { font-size: 10px; opacity: .75; }
.after { margin: 2px 0 0; font-size: 12.5px; font-weight: 500; line-height: 1.65; word-break: auto-phrase; color: var(--ink-soft); text-align: center; }
.links { display: flex; justify-content: center; gap: 18px; font-size: 11.5px; font-weight: 500; color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  .envelope, .sheet, .card, .flap, .seal { animation: none !important; transition: none !important; }
}
