/*------------------------------------------------------------------------------
CHARACTERS
登場人物の一覧（肖像の額を並べた名簿）と、プロフィール（共通のダイアログ .lv-dialog--full の中身）。
mobile.css / style.css の共通パーツとトークンを前提に、このページ固有のレイアウトだけを定義する。

人物が増えても崩れないよう、一覧は画面幅に合わせて列の数が変わる格子に並べる。
画像がまだ無い人物は、名前の頭文字を置いた仮の肖像（.chara-placeholder）で見せる。
動きは、一覧が一度だけ浮かび上がる（[data-reveal]）のと、プロフィールが現れるときのフェードだけ。

レイアウトの切り替え条件
- 縦長構図（初期値）
- 横長構図: (min-width: 769px) and (orientation: landscape), (min-width: 1200px)
------------------------------------------------------------------------------*/
.chara,
.chara-dialog {
  --chara-gold: var(--lv-color-accent-gold);
  --chara-gold-light: var(--lv-color-accent-gold-light);
  --chara-line: rgba(var(--lv-gold-rgb), 0.36);
  --chara-rule: rgba(var(--lv-gold-rgb), 0.18);
  --chara-ink-soft: rgba(242, 246, 250, 0.76);
  --chara-ease: var(--lv-ease-out);
  --chara-gutter: max(5.2vw, 20px);
}

/*------------------------------------------------------------------------------
一覧
------------------------------------------------------------------------------*/
.chara {
  position: relative;
  padding: clamp(24px, 5vh, 56px) var(--chara-gutter) clamp(96px, 16vh, 180px);
}
/* 人数：菱形・英字・線・数字 */
.chara__count {
  display: flex;
  align-items: center;
  column-gap: 14px;
  max-width: 1280px;
  margin: 0 auto 26px;
  color: var(--chara-gold);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.32em;
}
.chara__count::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background-color: var(--chara-gold);
  transform: rotate(45deg);
}
.chara__count::after {
  content: "";
  order: 2;
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, var(--chara-line), transparent);
}
.chara__count-number {
  order: 3;
  color: var(--lv-color-white);
  font-size: 13px;
  letter-spacing: 0.14em;
}
.chara__empty {
  margin: 0;
  color: var(--chara-ink-soft);
  letter-spacing: 0.3em;
  text-align: center;
}

.chara-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px 14px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.chara-list__item {
  min-width: 0;
}
.chara-card {
  display: block;
  width: 100%;
  padding: 0;
  color: var(--lv-color-white);
  font: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.chara-card:focus-visible {
  outline: none;
}
/* 肖像の額：金の細い枠と、内側の細い余白（夜色のマット）。上端の中央に菱形 */
.chara-card__frame {
  position: relative;
  display: block;
  padding: 5px;
  border: 1px solid var(--chara-line);
  transition:
    border-color 0.5s ease,
    box-shadow 0.5s ease;
}
.chara-card__frame::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  z-index: 2;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  background-color: var(--lv-color-navy);
  border: 1px solid var(--chara-gold);
  transform: rotate(45deg);
  transition: background-color 0.5s ease;
}
.chara-card__window {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background-color: #cfc9bf;
}
.chara-card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  transition: transform 1.4s var(--chara-ease);
}
/* 明るい背景の肖像を夜の地になじませる：下端に夜色を重ね、四隅をわずかに沈める */
.chara-card__window::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(var(--lv-navy-rgb), 0) 66%, rgba(var(--lv-navy-rgb), 0.5)),
    radial-gradient(
      ellipse 90% 75% at 50% 42%,
      rgba(var(--lv-navy-rgb), 0) 64%,
      rgba(var(--lv-navy-rgb), 0.22)
    );
  pointer-events: none;
}
/* 番号：額の左下に、輪郭だけの数字 */
.chara-card__no {
  position: absolute;
  bottom: 12px;
  left: 14px;
  z-index: 1;
  color: transparent;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.04em;
  -webkit-text-stroke: 1px rgba(243, 220, 174, 0.92);
}
.chara-card__name {
  display: grid;
  row-gap: 6px;
  margin-top: 14px;
}
.chara-card__name-en {
  position: relative;
  width: fit-content;
  max-width: 100%;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0.1em;
  overflow-wrap: anywhere;
  transition: color 0.4s ease;
}
/* 重ねる・選ぶと、名前の下に金の線が引かれる */
.chara-card__name-en::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--chara-gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--chara-ease);
}
.chara-card__name-ja {
  color: var(--chara-ink-soft);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.14em;
}
.chara-card:focus-visible .chara-card__frame {
  border-color: var(--chara-gold);
  box-shadow: 0 0 0 1px var(--chara-gold);
}
.chara-card:focus-visible .chara-card__name-en::after {
  transform: scaleX(1);
}
@media (hover: hover) and (pointer: fine) {
  .chara-card:hover .chara-card__frame {
    border-color: var(--chara-gold);
  }
  .chara-card:hover .chara-card__frame::before {
    background-color: var(--chara-gold);
  }
  .chara-card:hover .chara-card__image {
    transform: scale(1.05);
  }
  .chara-card:hover .chara-card__name-en {
    color: var(--chara-gold-light);
  }
  .chara-card:hover .chara-card__name-en::after {
    transform: scaleX(1);
  }
}

/*------------------------------------------------------------------------------
プロフィール（共通のダイアログの中身）
Mobile は肖像の下に名前と本文。横長構図は左に肖像（読み進めても残る）、右に本文
------------------------------------------------------------------------------*/
.chara-profile[hidden],
.chara-dialog__step[hidden] {
  display: none;
}
.chara-dialog__scroll {
  overflow-x: hidden;
  padding: 72px var(--chara-gutter) 56px;
}
.chara-profile {
  position: relative;
  display: grid;
  row-gap: 30px;
  max-width: 1240px;
  margin: 0 auto;
}
/* 背景の大きな英字（輪郭だけ。下層ヘッダーの残響と同じ意匠） */
.chara-profile__echo {
  position: absolute;
  top: -10px;
  left: 50%;
  z-index: 0;
  margin: 0;
  color: transparent;
  font-size: clamp(64px, 19vw, 240px);
  line-height: 1;
  letter-spacing: 0.04em;
  white-space: nowrap;
  -webkit-text-stroke: 1px rgba(var(--lv-gold-rgb), 0.16);
  transform: translateX(-50%);
  pointer-events: none;
}
.chara-profile__visual {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0;
}
/* 額：金の細い枠と、内側の細い余白。上下の中央に菱形 */
.chara-profile__frame {
  position: relative;
  display: block;
  padding: 6px;
  border: 1px solid var(--chara-line);
}
.chara-profile__frame::before,
.chara-profile__frame::after {
  content: "";
  position: absolute;
  left: 50%;
  z-index: 1;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  background-color: var(--chara-gold);
  transform: rotate(45deg);
}
.chara-profile__frame::before {
  top: -4px;
}
.chara-profile__frame::after {
  bottom: -4px;
}
.chara-profile__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  background-color: #cfc9bf;
}
/* 画像がまだ無い人物の仮の肖像（inc/characters/data.php）：夜の地に、名前の頭文字を輪郭だけの金の文字で置く。
   画像と同じクラス（.chara-card__image・.chara-profile__image）も付くので、大きさとホバーの拡大は画像と同じ。
   上の画像の指定より後に置いて、背景などを上書きする */
.chara-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  row-gap: 14px;
  overflow: hidden;
  background:
    radial-gradient(
      ellipse 70% 55% at 50% 34%,
      rgba(var(--lv-gold-rgb), 0.2),
      rgba(var(--lv-gold-rgb), 0) 72%
    ),
    linear-gradient(rgba(var(--lv-gold-light-rgb), 0.07), rgba(var(--lv-gold-light-rgb), 0.07)),
    url(../img/bg-black-sp.webp) center / cover,
    var(--lv-color-navy);
}
.chara-placeholder__initial {
  color: transparent;
  font-size: clamp(76px, 13vw, 132px);
  line-height: 1;
  -webkit-text-stroke: 1px rgba(var(--lv-gold-light-rgb), 0.78);
  text-shadow: 0 0 40px rgba(var(--lv-gold-rgb), 0.35);
}
/* 金の線と、中央の菱形（下層ヘッダーの線と同じ意匠） */
.chara-placeholder__rule {
  position: relative;
  display: block;
  width: 44%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--chara-gold), transparent);
}
.chara-placeholder__rule::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background-color: var(--chara-gold);
  transform: translate(-50%, -50%) rotate(45deg);
}
/* プロフィールの正方形の肖像は、一覧の額より大きい */
.chara-profile__frame .chara-placeholder__initial {
  font-size: clamp(120px, 28vw, 240px);
}
.chara-profile__body {
  position: relative;
  z-index: 1;
  min-width: 0;
}
/* No.01 / 05 */
.chara-profile__index {
  display: flex;
  align-items: center;
  column-gap: 12px;
  margin: 0 0 16px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.3em;
}
.chara-profile__index::before {
  content: "";
  width: 6px;
  height: 6px;
  background-color: var(--chara-gold);
  transform: rotate(45deg);
}
.chara-profile__no {
  color: var(--chara-gold);
}
.chara-profile__total {
  color: var(--chara-ink-soft);
}
.chara-profile__name {
  display: grid;
  row-gap: 10px;
  margin: 0;
  font-weight: normal;
}
.chara-profile__name-en {
  font-size: clamp(32px, 9.4vw, 44px);
  line-height: 1.12;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}
.chara-profile__name-ja {
  color: var(--chara-gold);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.24em;
}
/* 名前の下の金の線 */
.chara-profile__name::after {
  content: "";
  display: block;
  width: 72px;
  height: 1px;
  margin-top: 8px;
  background: linear-gradient(90deg, var(--chara-gold), rgba(var(--lv-gold-rgb), 0));
}
/* 台詞：左に金の線を引き、大きめの文字で */
.chara-profile__quote {
  margin: 30px 0 0;
  padding: 2px 0 2px 20px;
  border-left: 1px solid var(--chara-line);
}
.chara-profile__quote p {
  margin: 0;
  font-size: clamp(18px, 4.8vw, 21px);
  line-height: 1.85;
  letter-spacing: 0.06em;
}
.chara-profile__quote--sub p {
  color: var(--chara-ink-soft);
  font-size: 16px;
}
/* 所属・出身地：細い罫線で区切った二列 */
.chara-profile__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
  margin: 30px 0 0;
  border-top: 1px solid var(--chara-rule);
}
.chara-profile__meta-item {
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--chara-rule);
}
.chara-profile__meta dt {
  color: var(--chara-gold);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.24em;
}
.chara-profile__meta dd {
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0.08em;
}
.chara-profile__description {
  margin-top: 28px;
}
.chara-profile__description p {
  margin: 0;
  color: rgba(242, 246, 250, 0.88);
  font-size: 15px;
  line-height: 2.1;
  letter-spacing: 0.06em;
}
.chara-profile__description rt {
  color: var(--chara-gold-light);
}

/* 前後の人物：ダイアログの下端の帯（本文はこの帯の上までスクロールする）。上端の中央に菱形 */
.chara-dialog__nav {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  column-gap: 12px;
  padding: 8px calc(var(--chara-gutter) - 4px) calc(8px + env(safe-area-inset-bottom, 0px));
  background-color: rgba(var(--lv-navy-rgb), 0.94);
  border-top: 1px solid var(--chara-rule);
}
.chara-dialog__nav::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  background-color: var(--lv-color-navy);
  border: 1px solid var(--chara-gold);
  transform: rotate(45deg);
}
.chara-dialog__step {
  display: inline-flex;
  align-items: center;
  column-gap: 12px;
  min-width: 0;
  min-height: 52px;
  padding: 0 4px;
  color: var(--lv-color-white);
  font: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
.chara-dialog__step:focus-visible {
  outline: none;
  border-radius: var(--lv-radius-soft);
  box-shadow: 0 0 0 1px var(--chara-gold);
}
.chara-dialog__step-text {
  display: grid;
  row-gap: 4px;
  min-width: 0;
  text-align: left;
}
.chara-dialog__step--next .chara-dialog__step-text {
  text-align: right;
}
.chara-dialog__step-label {
  color: var(--chara-gold);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.3em;
}
.chara-dialog__step-name {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 矢印：細い線と、先端の折れ */
.chara-dialog__arrow {
  position: relative;
  flex: 0 0 auto;
  display: block;
  width: 30px;
  height: 1px;
  background-color: var(--chara-gold);
  transition: width 0.5s var(--chara-ease);
}
.chara-dialog__arrow::before {
  content: "";
  position: absolute;
  top: -3.5px;
  width: 7px;
  height: 7px;
  border-top: 1px solid var(--chara-gold);
  border-left: 1px solid var(--chara-gold);
}
.chara-dialog__step--prev .chara-dialog__arrow::before {
  left: 0;
  transform: rotate(-45deg);
}
.chara-dialog__step--next .chara-dialog__arrow::before {
  right: 0;
  transform: rotate(135deg);
}
@media (hover: hover) and (pointer: fine) {
  .chara-dialog__step:hover .chara-dialog__arrow {
    width: 44px;
  }
  .chara-dialog__step:hover .chara-dialog__step-name {
    color: var(--chara-gold-light);
  }
}

/* プロフィールが現れるとき（開いたとき・前後へ切り替えたとき）：肖像と文字が順に浮かび上がる */
@media (prefers-reduced-motion: no-preference) {
  .chara-profile.is-current .chara-profile__frame {
    animation: chara-rise 1s var(--chara-ease) both;
  }
  .chara-profile.is-current .chara-profile__echo {
    animation: chara-echo 1.6s var(--chara-ease) both;
  }
  .chara-profile.is-current .chara-profile__body > * {
    animation: chara-rise 0.9s var(--chara-ease) 0.12s both;
  }
  .chara-profile.is-current .chara-profile__body > :nth-child(2) {
    animation-delay: 0.18s;
  }
  .chara-profile.is-current .chara-profile__body > :nth-child(3) {
    animation-delay: 0.26s;
  }
  .chara-profile.is-current .chara-profile__body > :nth-child(4) {
    animation-delay: 0.32s;
  }
  .chara-profile.is-current .chara-profile__body > :nth-child(n + 5) {
    animation-delay: 0.38s;
  }
}
@keyframes chara-rise {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }
}
@keyframes chara-echo {
  from {
    opacity: 0;
    transform: translateX(-47%);
  }
}

/*------------------------------------------------------------------------------
縦向きタブレット：一覧は三列、プロフィールの肖像は幅を抑える
------------------------------------------------------------------------------*/
@media (min-width: 600px) and (orientation: portrait) {
  .chara-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 48px 20px;
  }
  .chara-profile__visual {
    max-width: 560px;
  }
}

/*------------------------------------------------------------------------------
横長構図
------------------------------------------------------------------------------*/
@media (min-width: 769px) and (orientation: landscape), (min-width: 1200px) {
  .chara {
    --chara-gutter: 3.2vw;
    padding-top: 32px;
  }
  .chara__count {
    margin-bottom: 40px;
    font-size: 11px;
  }
  /* 列の数は画面幅で決まる（1280px の幅に最大 5 列） */
  .chara-list {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    gap: 64px 28px;
  }
  .chara-card__no {
    font-size: clamp(32px, 2.6vw, 44px);
  }
  .chara-card__name {
    margin-top: 18px;
  }
  .chara-card__name-en {
    font-size: clamp(17px, 1.3vw, 22px);
  }
  .chara-card__name-ja {
    font-size: 13px;
  }

  .chara-dialog {
    --chara-gutter: 7vw;
  }
  .chara-dialog__scroll {
    padding: clamp(88px, 13vh, 132px) var(--chara-gutter) 72px;
  }
  .chara-profile {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    column-gap: 6vw;
    align-items: start;
  }
  .chara-profile__echo {
    top: -56px;
    font-size: clamp(120px, 15vw, 280px);
  }
  /* 本文を読み進めても肖像は残る */
  .chara-profile__visual {
    position: sticky;
    top: 0;
  }
  .chara-profile__body {
    padding-top: 12px;
  }
  .chara-profile__name-en {
    font-size: clamp(44px, 4.2vw, 80px);
  }
  .chara-profile__name-ja {
    font-size: clamp(14px, 1.1vw, 18px);
  }
  .chara-profile__quote p {
    font-size: clamp(19px, 1.6vw, 27px);
  }
  .chara-profile__quote--sub p {
    font-size: clamp(16px, 1.25vw, 20px);
  }
  .chara-profile__meta dd {
    font-size: clamp(15px, 1.15vw, 18px);
  }
  .chara-profile__description p {
    max-width: 36em;
    font-size: clamp(15px, 1.12vw, 18px);
  }
  .chara-dialog__nav {
    padding: 12px var(--chara-gutter) 14px;
  }
  .chara-dialog__step-name {
    font-size: 14px;
  }
}
