/* レイアウト別スタイル */

/* ============ default ============ */
.slide-head { margin: 0 0 26px; }
.slide-head h1, .slide-head h2 {
  font-size: 44px;
  padding-bottom: 12px;
  border-bottom: 4px double var(--line);
}
.layout-default[data-heading-level="2"] .slide-head h2 { font-size: 40px; }

/* 見出しだけのスライド */
.layout-default.section-divider {
  justify-content: center;
  align-items: center;
  text-align: center;
}
.layout-default.section-divider .slide-head h1,
.layout-default.section-divider .slide-head h2 {
  font-size: 64px;
  border: 0;
}

/* ============ big: 一言をでかく ============ */
.layout-big {
  justify-content: center;
  align-items: center;
  text-align: center;
}
.layout-big h1, .layout-big h2 { font-size: 40px; color: var(--sumi-2); margin-bottom: 28px; }
.layout-big .content {
  flex: 0 0 auto;
  font-family: var(--font-dot);
  font-size: 52px;
  line-height: 1.5;
  color: var(--kani);
}
.layout-big .content p { margin: 0 0 18px; }
.layout-big .content small, .layout-big .content .note {
  font-family: var(--font-body);
  font-size: 22px;
  color: var(--sumi-2);
}
.layout-big .content blockquote {
  font-size: 34px;
  line-height: 1.6;
  text-align: left;
  color: var(--sumi);
  font-family: var(--font-body);
  padding: 26px 36px;
  max-width: 980px;
}

/* ============ shot: スクショ → 幕 ============ */
.layout-shot {
  padding: 28px 40px calc(var(--footer-h) + 20px);
  background:
    radial-gradient(circle at 1px 1px, rgba(201, 138, 58, 0.18) 1px, transparent 0) 0 0 / 16px 16px,
    var(--shiro-2);
}
.shot-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.shot-frame {
  margin: 0;
  height: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shot-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  background: var(--card);
  border: 3px solid var(--sumi);
  box-shadow: 8px 8px 0 var(--kani);
}
.shot-stage[data-count="1"] .shot-frame { width: 100%; }
/* 縦長の画像を2〜3枚並べる時 */
.shot-stage[data-count="2"] .shot-frame,
.shot-stage[data-count="3"] .shot-frame { flex: 0 1 auto; }

/* 見出しの札（スクショの左上に貼る） */
.shot-label {
  position: absolute;
  top: 22px;
  left: 28px;
  z-index: 3;
  max-width: 70%;
  background: var(--kani);
  color: var(--shiro);
  padding: 10px 20px 12px;
  box-shadow: 5px 5px 0 var(--kani-deep);
  transition: opacity 240ms ease;
}
.shot-label .eyebrow { color: var(--sky-1); font-size: 14px; margin-bottom: 2px; }
.shot-label h1, .shot-label h2 {
  color: var(--shiro);
  font-size: 28px;
  line-height: 1.3;
}
.layout-shot[data-step]:not([data-step="0"]) .shot-label { opacity: 0; }

/* 幕：身の白を半透明にかけて、その上に詳細 */
.shot-overlay {
  position: absolute;
  inset: 0 0 var(--footer-h) 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 72px;
  background: rgba(255, 246, 236, 0.82);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transform: none;
}
.shot-overlay.step { transform: none; }
.shot-panel {
  width: 100%;
  max-width: 1060px;
  max-height: 100%;
  background: var(--card);
  border: 3px solid var(--sumi);
  box-shadow: 10px 10px 0 var(--kani);
  padding: 30px 44px 26px;
  transform: translateY(16px);
  transition: transform 300ms ease;
  overflow: hidden;
}
.shot-overlay.shown .shot-panel { transform: none; }
.shot-panel h1, .shot-panel h2 {
  font-size: 34px;
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 4px double var(--line);
}
.shot-panel .content { font-size: 24px; line-height: 1.65; }
.shot-panel .content li { margin-bottom: 6px; }

/* ============ 夕焼けの空（cover / chapter / end） ============ */
.layout-cover, .layout-chapter, .layout-end {
  padding: 0;
  color: var(--shiro);
  background: var(--sky-4);
}
.sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--sky-4) 0%, var(--sky-3) 42%, var(--sky-2) 72%, var(--sky-1) 100%);
}
.sky.night {
  background: linear-gradient(180deg, #0E1C2A 0%, #172C40 45%, #1E3A50 75%, #2B4A63 100%);
}
.stars { position: absolute; inset: 0; }
.star {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--shiro);
  opacity: 0.7;
  animation: twinkle 3.6s steps(2) infinite;
}
.star.big { width: 5px; height: 5px; }
@keyframes twinkle {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.25; }
}

.nagaya { position: relative; width: 100%; }
.nagaya > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.nagaya-sign {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-dot);
  color: var(--sumi);
  font-size: calc(var(--nagaya-px, 1px) * 2.4);
  line-height: 1;
  white-space: nowrap;
}
.nagaya-sign.active { color: var(--kani); }
.nagaya-glow {
  position: absolute;
  background: radial-gradient(ellipse at 50% 70%, rgba(242, 193, 78, 0.85), rgba(242, 193, 78, 0) 70%);
  mix-blend-mode: screen;
  animation: glow 2.4s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}
.nagaya-crab { position: absolute; }
.nagaya-crab svg { width: 100%; height: 100%; display: block; overflow: visible; }
.nagaya-crab.active { animation: crab-hop 0.8s steps(2) infinite; }
@keyframes crab-hop {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6%); }
}

/* ============ cover ============ */
.cover-inner {
  position: relative;
  z-index: 2;
  padding: 62px 96px 0;
}
.cover-kicker {
  font-family: var(--font-dot);
  font-size: 18px;
  letter-spacing: 0.14em;
  margin: 0 0 10px;
  color: var(--sky-1);
}
.cover-title {
  color: var(--shiro);
  font-size: 76px;
  line-height: 1.12;
  text-shadow: 4px 4px 0 rgba(36, 32, 28, 0.35);
}
.cover-subtitle {
  font-family: var(--font-dot);
  font-size: 34px;
  margin: 10px 0 0;
  color: var(--shiro);
}
.cover-meta {
  margin-top: 26px;
  font-size: 20px;
  line-height: 1.6;
}
.cover-meta p { margin: 0; }
.cover-author { font-size: 26px; font-weight: 700; }
.cover-author-id { margin-left: 14px; font-weight: 400; font-size: 20px; opacity: 0.85; }
.cover-date { margin-left: 14px; font-family: var(--font-dot); }
.cover-venue { opacity: 0.85; }
.cover-nagaya {
  position: absolute !important;
  left: 96px;
  right: 96px;
  bottom: 0;
  width: auto !important;
  --nagaya-px: calc((1280px - 192px) / var(--nw));
}

/* ============ chapter ============ */
.chapter-text {
  position: relative;
  z-index: 2;
  padding: 92px 110px 0;
}
.chapter-text .eyebrow { color: var(--sky-1); font-size: 22px; }
.chapter-text h1, .chapter-text h2 {
  color: var(--shiro);
  font-size: 72px;
  text-shadow: 4px 4px 0 rgba(36, 32, 28, 0.35);
}
.chapter-text .lede {
  margin-top: 18px;
  font-size: 26px;
  line-height: 1.6;
  max-width: 900px;
  color: var(--shiro);
}
.chapter-text .lede p { margin: 0; }
.chapter-nagaya {
  position: absolute !important;
  left: 64px;
  right: 64px;
  bottom: 0;
  width: auto !important;
  --nagaya-px: calc((1280px - 128px) / var(--nw));
}

/* ============ 2column: 左に札、右に本文 ============ */
.layout-2column.active { flex-direction: row; gap: 56px; align-items: stretch; }
.two-col-left {
  flex: 0 0 auto;
  max-width: 40%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.two-col-left img {
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
  display: block;
  box-shadow: 8px 8px 0 var(--line);
}
.two-col-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.two-col-right h1, .two-col-right h2 {
  font-size: 40px;
  margin: 0 0 22px;
  padding-bottom: 10px;
  border-bottom: 4px double var(--line);
}
.two-col-right .content { flex: 0 1 auto; font-size: 24px; }

/* ============ cover-all ============ */
.layout-cover-all { padding: 0; background: var(--sumi); }
.cover-all-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.cover-all-caption {
  position: absolute;
  left: 0; right: 0;
  padding: 22px 64px;
  color: var(--shiro);
  font-family: var(--font-dot);
  font-size: 30px;
  text-align: center;
  z-index: 5;
}
.cover-all-caption.upper { top: 0; background: linear-gradient(180deg, rgba(36,32,28,.75), rgba(36,32,28,0)); padding-bottom: 44px; }
.cover-all-caption.lower { bottom: 0; background: linear-gradient(0deg, rgba(36,32,28,.75), rgba(36,32,28,0)); padding-top: 44px; }

/* ============ end: カニのダンス ============ */
.end-text {
  position: relative;
  z-index: 2;
  text-align: center;
  padding-top: 70px;
}
.end-text h1 {
  color: var(--shiro);
  font-size: 64px;
  text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
}
.end-text .lede {
  margin-top: 14px;
  font-family: var(--font-dot);
  font-size: 24px;
  color: var(--sky-1);
}
.end-text .lede p { margin: 4px 0; }
.dance-stage {
  position: absolute;
  left: 120px;
  right: 120px;
  bottom: 0;
  --nagaya-px: calc((1280px - 240px) / var(--nw));
}
.dance-stage .nagaya-sign { color: var(--sumi); }
.dance-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6%;
  height: 92px;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 0 10px;
}
.dancer {
  width: 72px;
  animation:
    dance-hop 0.5s steps(2) infinite alternate,
    dance-side 2s steps(8) infinite alternate;
  animation-delay: calc(var(--i) * -0.13s), calc(var(--i) * -0.37s);
  transform-origin: 50% 100%;
}
.dancer svg { width: 100%; height: auto; display: block; overflow: visible; }
.dancer-kogani { width: 52px; }
.dancer-takaashi { width: 72px; }
.dancer-chikuwa { width: 64px; animation-duration: 0.35s, 1.6s; }
.dancer-usui { opacity: 0.6; }
@keyframes dance-hop {
  from { translate: 0 0; }
  to { translate: 0 -22px; }
}
@keyframes dance-side {
  0% { rotate: -8deg; }
  50% { rotate: 8deg; }
  100% { rotate: -8deg; }
}

/* パターンB: h3 で左右に割る */
.layout-2column.pattern-b.active { flex-direction: column; gap: 0; }
.two-col-columns {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
.two-col-col {
  background: var(--card);
  border: 3px solid var(--sumi);
  box-shadow: 7px 7px 0 var(--line);
  padding: 20px 26px;
  font-size: 19px;
  line-height: 1.55;
  overflow: hidden;
}
.two-col-col h3 { color: var(--kani); font-size: 28px; margin: 0 0 8px; }
.two-col-col p { margin: 0 0 10px; color: var(--sumi-2); }
.two-col-col ul { margin: 0; padding-left: 1.2em; }
.two-col-col li { margin-bottom: 5px; }
.two-col-col li::marker { color: var(--kani); }
.two-col-col strong { background: linear-gradient(transparent 62%, rgba(242, 193, 78, 0.55) 62%); }
.two-col-col code { font-family: var(--font-mono); font-size: 0.88em; }

/* 札と QR を縦に並べる時 */
.two-col-left img.qr { width: 150px; height: 150px; box-shadow: none; border: 3px solid var(--sumi); flex-shrink: 0; }
.two-col-left img:not(.qr) { flex: 0 1 auto; }

/* QR だけのスライド */
.qr-slide .content img.qr {
  width: 320px;
  height: 320px;
  max-height: none;
  border: 4px solid var(--sumi);
  box-shadow: 10px 10px 0 var(--kani);
  margin-bottom: 18px;
}

/* 本文中に挟む細長いスクショ */
.content img.inline-shot {
  display: block;
  margin-top: 8px;
  max-width: 820px;
  border: 3px solid var(--sumi);
  box-shadow: 6px 6px 0 var(--line);
}

/* 横に広い表 */
.wide-table table { width: 100%; font-size: 19px; }
.wide-table .content { font-size: 23px; }
.kor-table table { font-size: 18px; }
.kor-table th:first-child, .kor-table td:first-child { white-space: nowrap; }
.kor-table td:nth-child(2) { white-space: nowrap; }

/* ===== 直し（2周目） ===== */
/* 札は画像にかぶせず、上の帯に置く */
.layout-shot.active { gap: 16px; }
.shot-label {
  position: relative;
  top: auto;
  left: auto;
  align-self: flex-start;
  max-width: 100%;
  flex: 0 0 auto;
}
.layout-shot[data-step]:not([data-step="0"]) .shot-label { opacity: 1; }
.shot-caption {
  margin: 4px 0 0;
  font-size: 20px;
  color: var(--shiro);
  font-family: var(--font-body);
}
.shot-caption a { color: var(--shiro); }

/* 横長のスクショは縦に積む */
.stack .shot-stage { flex-direction: column; gap: 18px; }
.stack .shot-frame { height: auto; flex: 1 1 0; min-height: 0; width: 100%; }

/* 章扉の見出し */
.chapter-text h1, .chapter-text h2 { font-size: 58px; }

/* 詰め込みスライド */
.dense .content { font-size: 22px; line-height: 1.6; }
.dense .slide-head { margin-bottom: 18px; }

/* カニのダンス: 長屋の前の通りで踊る */
.dance-stage { bottom: 120px; left: 160px; right: 160px; --nagaya-px: calc((1280px - 320px) / var(--nw)); }
.dance-floor {
  bottom: 0;
  height: 120px;
  background:
    repeating-linear-gradient(90deg, var(--c-ground-h) 0 4px, transparent 4px 20px) 0 0 / 100% 4px no-repeat,
    var(--c-ground);
  justify-content: space-evenly;
  align-items: center;
  padding: 0 40px;
}
.dancer { width: 84px; }
.dancer-kogani { width: 60px; }
.dancer-chikuwa { width: 70px; }

/* ===== 直し（3周目） ===== */
/* 住人の札を同じ大きさで 6×2 に並べる */
.grid .shot-stage {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: start;
}
.grid .shot-frame { height: 100%; width: 100%; align-items: flex-start; }
.grid .shot-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top center;
  border: 0;
  box-shadow: none;
  background: none;
}

/* ドット絵の花火 */
.hanabi { position: absolute; inset: 0; pointer-events: none; }
.hanabi-burst {
  position: absolute;
  width: 0;
  height: 0;
  --cycle: 6.6s;
}
.hanabi-rocket, .hanabi-spark {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  image-rendering: pixelated;
}
.hanabi-rocket {
  width: 5px;
  height: 12px;
  margin-left: -2px;
  animation: hanabi-rise var(--cycle) linear infinite;
  animation-delay: var(--delay);
}
.hanabi-spark {
  width: var(--sz);
  height: var(--sz);
  margin: calc(var(--sz) / -2) 0 0 calc(var(--sz) / -2);
  animation: hanabi-spark var(--cycle) cubic-bezier(0.15, 0.7, 0.3, 1) infinite;
  animation-delay: var(--delay);
}
@keyframes hanabi-rise {
  0% { opacity: 1; transform: translateY(var(--rise)); }
  14% { opacity: 1; transform: translateY(0); }
  15%, 100% { opacity: 0; transform: translateY(0); }
}
@keyframes hanabi-spark {
  0%, 14% { opacity: 0; transform: translate(0, 0); }
  15% { opacity: 1; transform: translate(0, 0); }
  42% { opacity: 1; transform: translate(var(--dx), var(--dy)); }
  58% { opacity: 0.55; transform: translate(var(--dx), calc(var(--dy) + 24px)); }
  66%, 100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 40px)); }
}

/* 2枚を同じ幅で並べる（本投稿＋返信） */
.pair .shot-stage { align-items: center; }
.pair .shot-stage[data-count] .shot-frame { flex: 1 1 0; height: 100%; }
.pair .shot-frame img { width: auto; }

/* ===== 直し（4周目） ===== */
/* 長屋の看板の文字を大きく */
.nagaya-sign { font-size: calc(var(--nagaya-px, 1px) * 2.9); }

/* full: スクショを大きく。札は画像の上に重ねる */
.full.layout-shot .shot-label {
  position: absolute;
  top: 22px;
  left: 28px;
  z-index: 4;
  max-width: 60%;
}
.full .shot-stage { margin-top: -12px; }

/* side: スクショの右脇に添え書き */
.side .shot-stage { flex-direction: row; align-items: center; gap: 32px; }
.shot-frames {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.stack .shot-frames { flex-direction: column; }
.shot-side {
  flex: 0 0 310px;
  align-self: center;
  background: var(--card);
  border: 3px solid var(--sumi);
  box-shadow: 7px 7px 0 var(--kani);
  padding: 20px 24px;
  font-size: 22px;
  line-height: 1.6;
}
.shot-side p { margin: 0 0 14px; }
.shot-side p:last-child { margin-bottom: 0; }
.shot-side strong { color: var(--kani); }

/* 引用の中の傍線 */
.ul {
  text-decoration: underline;
  text-decoration-color: var(--kani);
  text-decoration-thickness: 4px;
  text-underline-offset: 7px;
  text-decoration-skip-ink: none;
}

/* エンドの夜空に浮かぶ QR */
.end-qr {
  position: absolute;
  left: 50%;
  top: 330px;
  z-index: 3;
  transform: translate(-50%, -50%);
  display: block;
  line-height: 0;
}
.end-qr img.qr {
  width: 132px;
  height: 132px;
  border: 4px solid var(--sumi);
  box-shadow: 6px 6px 0 var(--kani);
}
.end-credit {
  position: absolute;
  left: 0;
  right: 0;
  top: 412px;
  z-index: 3;
  margin: 0;
  text-align: center;
  font-family: var(--font-dot);
  font-size: 17px;
  color: var(--sky-1);
  opacity: 0.85;
}
.end-text .lede a { color: var(--sky-1); text-decoration-color: rgba(247, 200, 166, 0.5); text-underline-offset: 4px; }
.end-text .lede { font-size: 26px; }
.side .shot-frames { justify-content: flex-end; }
.stack.side .shot-frames { justify-content: center; align-items: flex-end; }
.shot-side { margin-right: 24px; }
/* 看板の --nagaya-px は --nw を持つ .nagaya 自身で決める（.dance-stage では --nw が見えない） */
.dance-stage .nagaya { --nagaya-px: calc((1280px - 320px) / var(--nw)); }

/* 住人の札（カニだけ10枚）を 5×2 で大きめに */
.grid-5 .shot-stage { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px 18px; }
.grid-5 .shot-frame { align-items: center; }
.grid-5 .shot-frame img { object-position: center; }
/* 札はモデル名まで（背の低い札を大きく） */
.grid-5 .shot-stage { align-content: center; grid-template-rows: repeat(2, auto); gap: 18px 16px; }
.grid-5 .shot-frame { height: auto; }
.grid-5 .shot-frame img { height: auto; }

/* caption-out: 札の添え書きを札の外（右隣）に出す。スクショに掛かってもよい */
.caption-out .shot-label { position: relative; }
.caption-out .shot-caption {
  position: absolute;
  left: calc(100% + 22px);
  bottom: 10px;
  margin: 0;
  white-space: nowrap;
  color: var(--sumi);
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 0 6px var(--shiro-2), 0 0 2px var(--shiro-2);
}

/* スクショの右脇に置く QR */
.shot-qr { flex: 0 0 auto; align-self: flex-end; margin-bottom: 8px; }
.shot-qr img.qr {
  display: block;
  width: 150px;
  height: 150px;
  border: 3px solid var(--sumi);
  box-shadow: 6px 6px 0 var(--kani);
}
.shot-stage:has(.shot-qr) .shot-frame { width: auto; flex: 0 1 auto; }
.shot-stage:has(.shot-qr) { justify-content: flex-end; padding-right: 12px; }

/* flow: 「AだからB」を一言でかく */
.flow .content { font-size: 40px; line-height: 1.6; }
.flow .content p:first-child { font-size: 30px; color: var(--sumi-2); }
.flow .flow-item {
  display: inline-block;
  margin: 6px 0;
  padding: 4px 22px 6px;
  background: var(--card);
  border: 3px solid var(--sumi);
  box-shadow: 5px 5px 0 var(--line);
  color: var(--sumi);
}
.flow .flow-item strong { color: var(--kani); font-weight: 400; }
.flow .content > p:nth-of-type(3) { margin-top: 10px; }
.flow .content > p:nth-of-type(3) strong { font-weight: 400; background: linear-gradient(transparent 62%, rgba(242, 193, 78, 0.6) 62%); }
.flow .flow-item strong { background: none; }

/* まきのお詫び */
.maki .content { font-size: 40px; }
.maki .content small { display: block; margin-top: 18px; font-size: 24px; line-height: 1.7; }
.maki .content small a { font-family: var(--font-dot); color: var(--kani); }
