/* おつり道場 LP 専用レイヤ（PRJ-034）
 *
 * site.css（トークン・.button・.brush-title・基本組版）の上に載る。
 * 演出はすべて transform / opacity / clip-path のみ（合成レイヤで完結、リフローさせない）。
 * prefers-reduced-motion では無限ループ系を全停止し、出現系は即時表示に落とす。
 */

/* ---------- 汎用: スクロール出現 ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--d, 0s);
}
.is-in .reveal,
.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- ヒーロー ---------- */

.hero {
  position: relative;
  text-align: center;
  padding: 0 var(--gap) clamp(3rem, 7vw, 5rem);
  overflow: hidden;
}

.hero-noren {
  width: min(360px, 60vw);
  margin: 0 auto;
  transform-origin: 50% 0;
  animation: noren-drop 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.1) both,
             noren-sway 7s ease-in-out 0.9s infinite alternate;
}
.hero-noren img { display: block; width: 100%; height: auto; }

@keyframes noren-drop {
  from { transform: translateY(-104%); }
  to   { transform: translateY(0); }
}
@keyframes noren-sway {
  from { transform: rotate(-1.4deg); }
  to   { transform: rotate(1.4deg); }
}

.hero-title {
  position: relative;
  display: inline-block;
  margin-top: clamp(1.6rem, 4vw, 2.8rem);
}

/* 題字の筆ワイプ: 外側の窓を広げる（マスク方式の .brush-title と干渉しない） */
.hero-wipe {
  display: inline-block;
  overflow: hidden;
  clip-path: inset(-8% 100% -8% 0);
  animation: brush-wipe 1.05s cubic-bezier(0.65, 0, 0.25, 1) 0.55s both;
}
@keyframes brush-wipe {
  to { clip-path: inset(-8% 0% -8% 0); }
}
.hero-title .brush-title {
  width: min(560px, 78vw);
  aspect-ratio: 1024 / 274;
}

/* 落款印: 題字の右下へ「ドン」 */
.hero-seal {
  position: absolute;
  right: -1.1em;
  bottom: -0.9em;
  width: clamp(52px, 9vw, 76px);
  transform: rotate(-6deg);
  animation: seal-stamp 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) 1.75s both;
  filter: drop-shadow(0 1px 0 rgba(28, 26, 23, 0.15));
}
@keyframes seal-stamp {
  0%   { opacity: 0; transform: scale(2.4) rotate(-18deg); }
  60%  { opacity: 1; transform: scale(0.94) rotate(-4deg); }
  100% { opacity: 1; transform: scale(1) rotate(-6deg); }
}

.hero-copy {
  margin: 1.4rem auto 0;
  max-width: 34em;
  font-family: var(--mincho);
  font-size: clamp(1.02rem, 2.6vw, 1.25rem);
  line-height: 2;
  letter-spacing: 0.08em;
}

.hero-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.3rem;
  flex-wrap: wrap;
}
.badge-free {
  display: inline-block;
  font-family: var(--mincho);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.2em;
  padding: 0.32em 0.9em 0.28em 1.1em;
  color: var(--surface);
  background: var(--shu);
  border-radius: 3px;
  box-shadow: var(--shadow-fuda);
}
.badge-note {
  font-size: 0.82rem;
  color: var(--ink-2, var(--ink));
  opacity: 0.75;
  letter-spacing: 0.04em;
}

.hero-cta { margin-top: 1.6rem; }

.hero-scrollcue {
  margin: 2.6rem auto 0;
  width: 1px;
  height: 44px;
  background: linear-gradient(var(--rule), transparent);
  animation: cue-pulse 1.8s ease-in-out infinite;
}
@keyframes cue-pulse {
  0%, 100% { transform: scaleY(0.5); transform-origin: top; opacity: 0.4; }
  50%      { transform: scaleY(1); opacity: 0.9; }
}

/* ---------- 客レーン（マーキー） ---------- */

.lane {
  position: relative;
  overflow: hidden;
  padding: clamp(0.8rem, 2vw, 1.4rem) 0 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  background:
    linear-gradient(to top, color-mix(in srgb, var(--rule) 14%, transparent) 0 2px, transparent 2px);
}
.lane-track {
  display: flex;
  align-items: flex-end;
  gap: clamp(2.2rem, 6vw, 4.5rem);
  width: max-content;
  transform: translateX(-50%);
  animation: lane-walk 52s linear infinite;
}
.lane:hover .lane-track,
.lane:focus-within .lane-track { animation-play-state: paused; }
@keyframes lane-walk {
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}
.walker {
  height: clamp(88px, 14vw, 138px);
  width: auto;
  animation: walker-bob 0.72s ease-in-out infinite alternate;
}
.walker:nth-child(5n + 2) { animation-duration: 0.66s; }
.walker:nth-child(5n + 3) { animation-duration: 0.79s; }
.walker:nth-child(5n + 4) { animation-duration: 0.62s; }
.walker:nth-child(5n)     { animation-duration: 0.86s; }
@keyframes walker-bob {
  from { transform: translateY(0) rotate(-0.6deg); }
  to   { transform: translateY(-5px) rotate(0.8deg); }
}
.lane-caption {
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  opacity: 0.65;
  padding: 0.5rem 1rem 0.7rem;
}

/* ---------- ミニ道場（腕試しウィジェット） ---------- */

.dojo-card {
  max-width: 30rem;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: var(--shadow-lift);
  padding: clamp(1.2rem, 4vw, 2rem);
  position: relative;
  overflow: hidden;
}

.dojo-progress {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--mincho);
  letter-spacing: 0.12em;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.dojo-progress .tally {
  display: inline-block;
  min-width: 1.9em;
  text-align: center;
  border: 1px solid var(--hair);
  border-radius: 3px;
  padding: 0.15em 0;
  background: var(--sunk);
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.dojo-progress .tally.won {
  background: var(--shu);
  border-color: var(--shu);
  color: var(--surface);
}

.dojo-question {
  font-family: var(--mincho);
  text-align: center;
  line-height: 1.9;
  min-height: 5.6em;
}
.dojo-question .price,
.dojo-question .paid {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 1.9em;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0 0.1em;
}
.dojo-question .ask {
  display: block;
  letter-spacing: 0.3em;
  font-size: 0.95em;
  margin-top: 0.2em;
}

.dojo-cells {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.9rem 0 1.1rem;
}
.dojo-cells .cell {
  width: 2.4em;
  height: 2.9em;
  border: 1.5px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  transition: border-color 0.2s, transform 0.12s;
}
.dojo-cells .cell.filled { border-color: var(--ai); transform: translateY(-2px); }

.dojo-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  max-width: 17rem;
  margin: 0 auto;
}
.dojo-pad button {
  font: 600 1.25rem/1 -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 0.72em 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.06s, background 0.06s;
  touch-action: manipulation;
}
.dojo-pad button:active { transform: scale(0.96); background: var(--sunk); }
.dojo-pad .pad-zero { grid-column: 2; }
.dojo-pad .pad-util {
  font-family: var(--mincho);
  font-size: 0.95rem;
  background: var(--sunk);
}

/* 正誤オーバーレイ（朱○ / 墨×） */
.dojo-mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.dojo-mark.show { opacity: 1; }
.dojo-mark svg { width: min(46%, 190px); height: auto; overflow: visible; }
.dojo-mark .stroke {
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
}
.dojo-mark.show .stroke { animation: draw-stroke 0.45s cubic-bezier(0.5, 0, 0.4, 1) forwards; }
.dojo-mark.show .stroke.s2 { animation-delay: 0.18s; }
@keyframes draw-stroke { to { stroke-dashoffset: 0; } }
.dojo-mark .mark-note {
  font-family: var(--mincho);
  letter-spacing: 0.1em;
  margin-top: 0.4rem;
  text-align: center;
  line-height: 1.8;
}

/* 合格免状オーバーレイ */
.dojo-pass {
  position: absolute;
  inset: 0;
  background: var(--surface);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.4rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s;
}
.dojo-pass.show { opacity: 1; visibility: visible; }
.dojo-pass .pass-inner { position: relative; font-family: var(--mincho); }
.dojo-pass h3 {
  font-size: 1.6rem;
  letter-spacing: 0.34em;
  margin: 0 0 0.6rem;
}
.dojo-pass p { line-height: 2; letter-spacing: 0.08em; margin: 0 0 1.1rem; }
.dojo-pass .pass-seal {
  position: absolute;
  top: -1.6rem;
  right: -1.2rem;
  width: 64px;
  transform: rotate(8deg);
}
.dojo-pass.show .pass-seal { animation: seal-stamp 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) 0.55s both; }

.dojo-reset {
  margin-top: 0.9rem;
  font-size: 0.82rem;
  background: none;
  border: none;
  color: var(--ai);
  cursor: pointer;
  letter-spacing: 0.1em;
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

/* ---------- 段位ラダー ---------- */

.ladder {
  position: relative;
  padding: 1.2rem 0 0.4rem;
}
.ladder-rail {
  position: absolute;
  top: 0;
  left: 2%;
  right: 2%;
  height: 3px;
  background: var(--hair);
  border-radius: 2px;
  overflow: hidden;
}
.ladder-rail::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--ai), var(--kin));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 2.4s cubic-bezier(0.3, 0, 0.2, 1) 0.2s;
}
.ladder.is-in .ladder-rail::after { transform: scaleX(1); }
.ladder-ranks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem 0.55rem;
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}
.ladder-ranks li {
  font-family: var(--mincho);
  font-size: clamp(0.78rem, 1.9vw, 0.95rem);
  letter-spacing: 0.14em;
  padding: 0.3em 0.6em;
  border: 1px solid var(--hair);
  border-radius: 3px;
  background: var(--surface);
  transition: opacity 0.4s ease var(--d), transform 0.4s ease var(--d),
              border-color 0.4s, color 0.4s;
}
.js .ladder-ranks li { opacity: 0; transform: translateY(8px); }
.js .ladder.is-in .ladder-ranks li { opacity: 1; transform: none; }
.ladder-ranks li.dan { border-color: var(--rule); }
.ladder-ranks li.top {
  color: var(--kin);
  border-color: var(--kin);
  font-weight: 600;
  font-size: 1.05em;
}
.ladder-ranks li.top ruby rt { font-size: 0.5em; letter-spacing: 0.2em; }

/* ---------- 幕（出稽古） ---------- */

.maku { position: relative; overflow: hidden; }
.js .maku::before,
.js .maku::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 51%;
  /* 布は「実体のある藍染」— ダークテーマの文字用 --ai（明色）に引きずられないよう実色固定 */
  background:
    repeating-linear-gradient(90deg, rgba(251, 247, 238, 0.07) 0 2px, transparent 2px 56px),
    #2a4a73;
  z-index: 3;
  transition: transform 1.1s cubic-bezier(0.7, 0, 0.2, 1) 0.15s;
}
.maku::before { left: 0; }
.maku::after { right: 0; }
.maku.is-in::before { transform: translateX(-102%); }
.maku.is-in::after { transform: translateX(102%); }

.degeiko-flex {
  display: flex;
  gap: clamp(1.4rem, 4vw, 3rem);
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.degeiko-copy { max-width: 26em; }
.degeiko-copy .brush-degeiko {
  width: min(240px, 46vw);
  aspect-ratio: 451 / 160;
  margin-bottom: 0.9rem;
}

/* ---------- 画面写真・端末フレーム ---------- */

.shot {
  border: 6px solid var(--bezel);
  border-radius: 26px;
  box-shadow: var(--shadow-lift);
  width: min(240px, 62vw);
  height: auto;
  display: block;
}
.shots-row {
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
}
.shot-fig { margin: 0; text-align: center; }
.shot-fig figcaption {
  font-family: var(--mincho);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  margin-top: 0.7rem;
  opacity: 0.8;
}

/* 認定証チルト */
.cert-tilt {
  perspective: 700px;
}
.cert-tilt img {
  width: min(300px, 74vw);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-lift);
  transition: transform 0.18s ease-out;
  will-change: transform;
}

/* ---------- 広告方針（静のセクション） ---------- */

.honesty {
  max-width: 36rem;
  margin: 0 auto;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--hair);
}
.honesty dl { margin: 0; }
.honesty .row {
  display: flex;
  gap: 1.2rem;
  padding: 1rem 0.2rem;
  border-bottom: 1px solid var(--hair);
  align-items: baseline;
}
.honesty dt {
  font-family: var(--mincho);
  letter-spacing: 0.12em;
  white-space: nowrap;
  min-width: 9.5em;
}
.honesty dd { margin: 0; line-height: 1.9; font-size: 0.95rem; }

/* ---------- ギャラリー ---------- */

.gallery {
  display: flex;
  gap: 1.2rem;
  overflow-x: auto;
  padding: 0.4rem 0.2rem 1rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.gallery .shot-fig { scroll-snap-align: center; flex: 0 0 auto; }
.gallery .shot { width: min(200px, 56vw); }

/* ---------- セクション骨格 ---------- */

.lp-section { padding: clamp(3rem, 8vw, 5.5rem) var(--gap); }
.lp-section.tight { padding-top: clamp(2rem, 5vw, 3rem); }
.lp-inner { max-width: var(--wrap); margin: 0 auto; }
.lp-kicker {
  font-family: var(--mincho);
  color: var(--shu);
  letter-spacing: 0.42em;
  font-size: 0.85rem;
  text-align: center;
  margin: 0 0 0.7rem;
}
.lp-h2 {
  font-family: var(--mincho);
  font-weight: 600;
  font-size: clamp(1.45rem, 4vw, 2rem);
  letter-spacing: 0.18em;
  text-align: center;
  margin: 0 0 1.6rem;
  line-height: 1.7;
}
.lp-lead {
  text-align: center;
  line-height: 2.1;
  letter-spacing: 0.06em;
  max-width: 36em;
  margin: 0 auto 2.2rem;
}

.cta-block { text-align: center; }
.cta-block .badge-note { display: block; margin-top: 0.8rem; }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .hero-noren,
  .lane-track,
  .walker,
  .hero-scrollcue { animation: none !important; }
  .hero-wipe { clip-path: inset(-8% 0% -8% 0); animation: none; }
  .hero-seal,
  .dojo-pass.show .pass-seal { animation: none; opacity: 1; }
  .reveal,
  .ladder-ranks li {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .ladder-rail::after { transform: scaleX(1); transition: none; }
  .maku::before, .maku::after { display: none; }
  .dojo-mark.show .stroke { animation: none; stroke-dashoffset: 0; }
  .cert-tilt img { transition: none; }
}

@media (max-width: 560px) {
  .honesty dt { min-width: 7em; }
  .hero-seal { right: -0.5em; }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
