/* ========================================
   今日の色紙（/{lang}/daily/）とデモ（/{lang}/demo/）— パステル版
   色紙をスマホの枠の中の sandbox iframe で再生するプレビューと、その選択肢（日付・サンプル）。
   - プレビュー・全画面表示: js/daily.js・js/demo.js が使うクラス（.demo-shell / .demo-stage / .demo-frame /
     .demo-overlay / .demo-exit と body.demo-fullscreen）
   - 日付の切り替えと一覧: js/daily.js が作る .daily-item / .daily-item-date / .daily-item-title（aria-current）
   - サンプルの切り替え: js/demo.js が付け外しする .demo-tab.is-active
   配色トークンは css/site.css、台紙とカードは css/cards.css・css/page.css
   ======================================== */

/* ── 並び: 左にプレビュー、右に選択肢と説明（スマホでは縦に積む） ── */
.showcase-layout {
  display: grid;
  gap: 40px;
  justify-items: center;
}

.showcase-player {
  width: 100%;
  max-width: 330px;
}

.showcase-side {
  display: grid;
  gap: 32px;
  width: 100%;
  max-width: 440px;
}

@media (min-width: 1024px) {
  .showcase-layout {
    grid-template-columns: 330px minmax(0, 440px);
    justify-content: center;
    align-items: start;
    gap: 56px;
  }
}

/* ── スマホの枠（トップの .bcard--phone .phone-frame と同じ見た目） ── */
/* 全画面表示は position: fixed で画面に広げるため、枠とその祖先には transform を付けない
   （.bcard は常に transform を持つので、枠を .bcard の中に入れない） */
.demo-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 19.5;
  border: 12px solid var(--c-ink);
  border-radius: 3rem;
  overflow: hidden;
  background: var(--c-white);
  box-shadow: 0 24px 48px rgba(58, 46, 63, 0.22);
}

.demo-stage {
  position: absolute;
  inset: 0;
  background: var(--c-white);
}

.demo-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.demo-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: var(--c-white);
  color: var(--c-ink-soft);
  font-size: 0.875rem;
  line-height: 1.75;
}

/* クラス指定の display が preflight の [hidden] に勝ってしまうため明示的に打ち消す */
.demo-overlay[hidden] {
  display: none;
}

.demo-overlay .icon {
  width: 36px;
  height: 36px;
  color: var(--c-pink-deep);
  stroke-width: 1.8;
}

.demo-spinner {
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  border: 4px solid var(--c-pink);
  border-top-color: var(--c-berry);
  animation: demo-spin 0.9s linear infinite;
}

@keyframes demo-spin {
  to { transform: rotate(360deg); }
}

/* もう一度再生・全画面のボタン（主な行動ではないので、小さめのゴーストボタン） */
.showcase-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.showcase-controls .btn {
  min-height: 46px;
  padding: 0 20px;
  font-size: 0.875rem;
}

/* 「VRで見る」は VR の色紙のときだけ出す。.btn の display が [hidden] に勝たないよう打ち消す */
.showcase-controls .btn[hidden] {
  display: none;
}

.showcase-controls .btn .icon {
  width: 18px;
  height: 18px;
}

/* ── 全画面表示 ── */
/* ネイティブの全画面APIが使えない環境（iOS Safari など）でも同じ見え方になるよう、
   位置指定はCSSで完結させる。API はブラウザUIまで隠せる時の上乗せ */
.demo-exit {
  display: none;
}

body.demo-fullscreen {
  overflow: hidden;
}

body.demo-fullscreen .demo-shell {
  position: fixed;
  inset: 0;
  z-index: 200;
  width: 100%;
  max-width: none;
  height: 100%;
  aspect-ratio: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--c-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 横長の画面では色紙が間延びしないよう、縦横比を保って中央に置く */
body.demo-fullscreen .demo-stage {
  position: relative;
  inset: auto;
  width: min(100%, calc(100vh * 9 / 19.5));
  height: 100%;
}

/* サンプル側のヘッダーと重なっても見失わないよう、濃い縁と影を付けて浮かせる */
body.demo-fullscreen .demo-exit {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 9999px;
  background: var(--c-white);
  color: var(--c-ink);
  box-shadow: 0 0 0 2px var(--c-ink), 0 4px 14px rgba(58, 46, 63, 0.3);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

/* ── 選択肢のチップ（日付の前後・サンプルの切り替え） ── */
.daily-step,
.demo-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 9999px;
  border: 2px solid var(--c-ink);
  background: var(--c-white);
  color: var(--c-ink);
  font-family: var(--font-headline);
  font-weight: 800;
  font-size: 0.875rem;
  box-shadow: 0 3px 0 var(--c-ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.daily-step .icon,
.demo-tab .icon {
  width: 18px;
  height: 18px;
}

.daily-step:hover:not(:disabled),
.daily-step:focus-visible,
.demo-tab:hover,
.demo-tab:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--c-ink);
}

.daily-step:disabled {
  opacity: 0.4;
  box-shadow: none;
  cursor: default;
}

.daily-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.demo-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
}

/* 選んでいるサンプルは、そのサンプルの説明の付箋と同じ色で塗る */
.demo-tab {
  padding-left: 8px;
}

.demo-tab-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  background: var(--tab-bg);
  color: var(--tab-deep);
}

.demo-tab.is-lemon { --tab-bg: var(--c-lemon); --tab-deep: var(--c-lemon-deep); }
.demo-tab.is-sky   { --tab-bg: var(--c-sky);   --tab-deep: var(--c-sky-deep); }
.demo-tab.is-pink  { --tab-bg: var(--c-pink);  --tab-deep: var(--c-pink-deep); }

.demo-tab.is-active {
  background: var(--tab-bg);
}

.demo-tab.is-active .demo-tab-icon {
  background: var(--c-white);
}

/* ── 今日の色紙: 選んでいる日 ── */
.showcase-now {
  --tape: var(--c-mint-tint);
}

.showcase-date {
  font-family: var(--font-headline);
  font-weight: 800;
  font-size: 0.875rem;
  color: var(--c-pink-deep);
}

/* 読み込むまで日付と題名は空。空のまま余白だけ残らないようにする */
.showcase-date:empty,
.showcase-now h2:empty {
  display: none;
}

/* ── 今日の色紙: これまでの色紙の一覧 ── */
.showcase-archive {
  --tape: var(--c-lavender-tint);
}

.daily-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding: 4px;
}

.daily-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  border: 2px solid transparent;
  background: var(--c-cream);
  color: var(--c-ink);
  text-align: left;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.daily-item:hover,
.daily-item:focus-visible {
  border-color: var(--c-pink-tint);
}

.daily-item[aria-current="true"] {
  border-color: var(--c-ink);
  background: var(--c-pink);
}

.daily-item-date {
  flex-shrink: 0;
  min-width: 5.5em;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--c-pink-deep);
}

.daily-item-title {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.5;
}

/* ── 見本の説明（画びょう留めのカード） ── */
.showcase-sample h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.showcase-sample h3 .icon {
  width: 22px;
  height: 22px;
  color: var(--note-deep);
}

/* ── 最後の案内（虹色のカード） ── */
.bcard .showcase-cta-lead {
  font-family: var(--font-headline);
  font-weight: 800;
  font-size: 1.125rem;
  line-height: 1.6;
}

.showcase-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 24px;
}

@media (prefers-reduced-motion: reduce) {
  .demo-spinner {
    animation: none;
  }

  .daily-step,
  .demo-tab,
  .daily-item {
    transition: none;
  }
}
