/* TOPを開く瞬間の演出「50年を駆け抜けて、断ち切る」（functions/toseikyo-top-intro.php） */

/* JSが準備するまで、表紙が一瞬見えないように紺で覆う（5秒で自然に消える） */
html.ts50-ti-on:not(.ts50-ti-ready)::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: #001040;
  animation: ts50TiGone 0s linear 5s forwards;
}

.ts50-ti { display: none; }
html.ts50-ti-on .ts50-ti {
  --ink: #001040;
  display: block;
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow: hidden;
  cursor: pointer;
  color: #fff;
  /* 割れ終わったら、JSが止まっていても消える */
  animation: ts50TiGone 0s linear 4.5s forwards;
}

/* 紺の紙（左右の半分ずつ。最後に断裁線で割れて外へ） */
.ts50-ti__half { position: absolute; top: 0; bottom: 0; width: 50.5%; background: var(--ink); }
.ts50-ti__half--l { left: 0; animation: ts50TiSplitL .75s cubic-bezier(.7, 0, .2, 1) 3.7s both; }
.ts50-ti__half--r { right: 0; animation: ts50TiSplitR .75s cubic-bezier(.7, 0, .2, 1) 3.7s both; }
.ts50-ti__half::after {
  /* 紙の目：ごく薄い網点 */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1.2px) 0 0 / 6px 6px;
}

.ts50-ti__stage { position: absolute; inset: 0; animation: ts50TiFade .35s ease 3.62s reverse both; }

/* 真ん中：年号と罫 */
.ts50-ti__center {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: min(86vw, 640px);
  transform: translate(-50%, -50%);
  text-align: center;
}
.ts50-ti__center p { margin: 0; }
.ts50-ti__kicker { font-size: clamp(12px, 1.3vw, 15px); letter-spacing: .3em; opacity: .8; animation: ts50TiUp .5s ease .1s both; }
.ts50-ti__year {
  margin-top: .1em !important;
  font-family: "Shippori Mincho B1", "Noto Serif JP", "Yu Mincho", serif;
  font-size: clamp(88px, 15vw, 210px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 30px rgba(0, 8, 40, .5);
  animation: ts50TiUp .5s cubic-bezier(.2, .7, .2, 1) .15s both;
}
/* 罫：年号が進むのに合わせて左から伸びる（年号と同じ減速） */
.ts50-ti__rule { position: relative; height: 2px; margin: 14px auto 0 !important; width: 72%; background: rgba(255, 255, 255, .18); }
.ts50-ti__rule i { position: absolute; inset: 0; background: #15a8e2; transform-origin: left; animation: ts50TiRule 2.2s cubic-bezier(.33, 1, .68, 1) .35s both; }
.ts50-ti__cap {
  margin-top: 18px !important;
  font-family: "Shippori Mincho B1", "Noto Serif JP", "Yu Mincho", serif;
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 700;
  letter-spacing: .2em;
  animation: ts50TiUp .5s ease 2.55s both;
}
.ts50-ti__next {
  margin-top: 10px !important;
  font-family: "Shippori Mincho B1", "Noto Serif JP", "Yu Mincho", serif;
  font-size: clamp(14px, 1.5vw, 17px);
  font-weight: 700;
  letter-spacing: .24em;
  color: #15a8e2;
  animation: ts50TiUp .5s ease 2.85s both;
}
.ts50-ti__next span { margin-left: .8em; color: #fff; letter-spacing: .14em; }

/* 写真：白い縁の焼き付け写真が、上から次々に降ってきて画面を埋めつくす（2026-11-04「画面全部うめるくらい」） */
.ts50-ti__p {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 1;
  width: 21vw;
  margin: 0;
  padding: clamp(4px, .5vw, 8px);
  background: #fff;
  box-shadow: 0 14px 28px -10px rgba(0, 0, 0, .6);
  transform: rotate(var(--r));
  animation: ts50TiDrop .5s cubic-bezier(.2, .8, .25, 1) var(--d) both;
}
/* 写真は切らずに、元の縦横の形のまま（縦長の写真で顔が切れたため 2026-11-04） */
.ts50-ti__p img { display: block; width: 100%; height: auto; }

/* 写真が積もってきたら、真ん中だけ紺を重ねて年号を読みやすく */
.ts50-ti__veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(ellipse 46% 40% at 50% 50%, rgba(0, 16, 64, .88), rgba(0, 16, 64, .55) 60%, rgba(0, 16, 64, .15));
  animation: ts50TiFade .8s ease 1.1s both;
}

/* 最後：歴代議長の集合写真が真ん中に置かれ、年号の背景になる */
.ts50-ti__group {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: min(62vw, 860px);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7);
  margin: 0;
  transform: translate(-50%, -50%);
  animation: ts50TiGroup .9s cubic-bezier(.2, .8, .25, 1) 2.4s both;
}
.ts50-ti__group img { display: block; width: 100%; height: auto; }
.ts50-ti__group::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0, 16, 64, .55), rgba(0, 16, 64, .78)); }

/* 断裁の線：上から下へ一気に走る */
.ts50-ti__cut {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  z-index: 5;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 14px rgba(21, 168, 226, .9);
  transform-origin: top;
  animation: ts50TiCut .45s cubic-bezier(.7, 0, .3, 1) 3.3s both;
}

.ts50-ti__skip {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 6;
  display: inline-flex;
  gap: 8px;
  padding: 8px 4px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .45);
  background: none;
  color: #fff;
  font-size: 13px;
  letter-spacing: .1em;
  cursor: pointer;
  animation: ts50TiFade .3s ease 3.3s reverse both;
}

/* 飛ばすとき：すぐ断裁して割れる */
.ts50-ti.is-leave .ts50-ti__cut { animation: ts50TiCut .3s cubic-bezier(.7, 0, .3, 1) 0s both; }
.ts50-ti.is-leave .ts50-ti__stage,
.ts50-ti.is-leave .ts50-ti__skip { animation: ts50TiFade .25s ease .15s reverse both; }
.ts50-ti.is-leave .ts50-ti__half--l { animation: ts50TiSplitL .6s cubic-bezier(.7, 0, .2, 1) .3s both; }
.ts50-ti.is-leave .ts50-ti__half--r { animation: ts50TiSplitR .6s cubic-bezier(.7, 0, .2, 1) .3s both; }

@keyframes ts50TiUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes ts50TiRule { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ts50TiDrop {
  from { opacity: 0; transform: translateY(-40px) scale(1.35) rotate(calc(var(--r) + 12deg)); }
  to { opacity: 1; transform: rotate(var(--r)); }
}
@keyframes ts50TiGroup {
  from { opacity: 0; transform: translate(-50%, -50%) scale(1.25); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes ts50TiCut {
  0% { transform: scaleY(0); opacity: 1; }
  80% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}
@keyframes ts50TiSplitL { to { transform: translateX(-102%); } }
@keyframes ts50TiSplitR { to { transform: translateX(102%); } }
@keyframes ts50TiFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ts50TiGone { to { visibility: hidden; } }

@media (max-width: 767px) {
  .ts50-ti__p { left: var(--mx); top: var(--my); width: 40vw; }
  .ts50-ti__group { width: 92vw; }
  .ts50-ti__year { font-size: 24vw; }
  .ts50-ti__next span { display: block; margin: 6px 0 0; }
  .ts50-ti__skip { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .ts50-ti, html.ts50-ti-on::before { display: none !important; }
}
