/* デモ用の案内バー（ページの一番上）。本番の店のページでは、このファイルと .demo-bar を消す。
   テーマの色に左右されないよう、色はここで固定している。 */

.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 8px var(--gutter, 16px);
  background: #1d1d1f;
  color: #f5f5f7;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
}

.demo-bar__text {
  font-weight: 700;
}

.demo-bar__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.demo-bar__nav a,
.demo-bar__back {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 10px;
  border: 1px solid #8a8a8e;
  border-radius: 999px;
  color: #f5f5f7;
  text-decoration: none;
}

.demo-bar__nav a[aria-current="page"] {
  border-color: #f5f5f7;
  background: #f5f5f7;
  color: #1d1d1f;
}

.demo-bar__back {
  order: -1;
  margin-left: auto;
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 幅1200px未満では「案内の文・一覧へ」を1行目、「業種・見比べる」（demo.js が .demo-bar__controls にまとめる）を2行目、
   スタイルの切り替えを3行目、当てているスタイルを4行目にする。1200px以上は1行（当てているスタイルだけ2行目） */
.demo-bar__text {
  order: -2;
}

.demo-bar__nav {
  flex-basis: 100%;
}

@media (min-width: 1200px) {
  .demo-bar__text {
    order: 0;
  }

  .demo-bar__back {
    order: 1;
  }

  .demo-bar__nav {
    flex-basis: auto;
  }
}

.demo-bar a:focus-visible,
.demo-bar button:focus-visible,
.demo-bar summary:focus-visible {
  outline: 3px solid #ffd60a;
  outline-offset: 2px;
}

/* ============ 業種の切り替え・見比べるボタン（template/demo.js） ============ */

/* 業種の一覧を開いている間だけ、バーをページの上に重ねる（美容室 D・外壁塗装 C のヘッダーは 60）。
   ふだんから重ねると、それらのページのスマホのメニュー（ヘッダーの中の全画面の面）の上にバーが出てしまう */
.demo-bar {
  position: relative;
}

.demo-bar:has(.demo-bar__industry[open]) {
  z-index: 70;
}

.demo-bar__industry {
  position: relative;
}

.demo-bar__industry > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 2px 10px 2px 12px;
  border: 1px solid #8a8a8e;
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
}

.demo-bar__industry > summary::-webkit-details-marker {
  display: none;
}

.demo-bar__industry > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin: -3px 2px 0 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.demo-bar__industry[open] > summary::after {
  margin-top: 3px;
  transform: rotate(225deg);
}

.demo-bar__industry-label {
  color: #c7c7cc;
  font-weight: 400;
}

.demo-bar__industry-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  max-width: calc(100vw - 2 * var(--gutter, 16px));
  max-height: min(70vh, 460px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #48484a;
  border-radius: 12px;
  background: #2c2c2e;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.45);
}

.demo-bar__industry-list ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-bar__industry-list a {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 8px;
  color: #f5f5f7;
  text-decoration: none;
  /* 狭い画面で2行になるとき、語の途中（「リラ／クゼーション」）や1文字だけで折らない。入らないときだけどこでも折る */
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.demo-bar__industry-list a:hover {
  background: #3a3a3c;
}

.demo-bar__industry-list a[aria-current] {
  background: #f5f5f7;
  color: #1d1d1f;
  font-weight: 700;
}

.demo-bar__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  flex-basis: 100%;
}

@media (min-width: 1200px) {
  .demo-bar__controls {
    flex-basis: auto;
  }
}

.demo-bar__open,
.demo-bar__reset {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 12px;
  border: 1px solid #ffd60a;
  border-radius: 999px;
  background: transparent;
  color: #ffd60a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.demo-bar__open:hover {
  background: #ffd60a;
  color: #1d1d1f;
}

.demo-bar__reset {
  border-color: #8a8a8e;
  color: #f5f5f7;
  font-weight: 500;
}

.demo-bar__reset:hover {
  border-color: #f5f5f7;
}

.demo-bar__reset[hidden] {
  display: none;
}

.demo-bar__applied {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  order: 2;
  flex-basis: 100%;
}

.demo-bar__applied:has(.is-empty) {
  display: contents;
}

.demo-bar__status {
  margin: 0;
}

/* 何も当てていないときの読み上げ用の枠は、見えなくても置いておく（role="status" の変化を読ませるため） */
.demo-bar__status.is-empty {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* サムネイルの撮影（scripts/thumbs.py）では、前からある部品だけを写す */
html[data-shot] .demo-bar__industry,
html[data-shot] .demo-bar__controls,
html[data-shot] .demo-bar__applied {
  display: none;
}

/* ?theme= のスタイルを読み込み終えるまで隠す（デモ用バーの印の中のスクリプトが付け、demo.js が外す）。
   地の色は body から画面全体に広がるので、html にも白を敷く。demo.js が動かなくても3秒で必ず見せる
   （!important は、一覧のカードで動きを止める指定に負けないため） */
html.demo-pending {
  background: #ffffff;
}

html.demo-pending body {
  visibility: hidden;
  animation: demo-reveal 0s 3s forwards !important;
}

@keyframes demo-reveal {
  to {
    visibility: visible;
  }
}

/* ============ 見比べる画面の中の表示（?embed=） ============ */

html[data-demo-embed] .demo-bar,
html[data-demo-embed] .skip-link {
  display: none !important;
}

/* 一覧のカード：最初の画面にかかる部分だけを描き、動きと操作を止める */
html[data-demo-embed="card"] {
  scrollbar-width: none;
}

html[data-demo-embed="card"]::-webkit-scrollbar {
  display: none;
}

html[data-demo-embed="card"] [data-block]:not([data-block="hero"]):not([data-block="cta-top"]):not([data-block="about"]),
html[data-demo-embed="card"] .site-footer {
  display: none;
}

html[data-demo-embed="card"] *,
html[data-demo-embed="card"] *::before,
html[data-demo-embed="card"] *::after {
  transition: none !important;
  animation: none !important;
}

/* ============ 他の業種のスタイルを当てたときの補正（html[data-demo-cross]。demo.js が付ける） ============ */

/* 施工の前と後の組（data-pairs）は、組が行をまたがないよう2列にし、前・後の説明を必ず出す */
html[data-demo-cross] .works__grid[data-pairs] {
  --works-cols: 2;
  --works-cols-lg: 2;
  --works-caption-display: block;
  /* 前後の写真は横長なので、縦長の比率のスタイルでも横長で見せる（この6業種の元のスタイルは 4:3・3:2） */
  --works-ratio: 4 / 3;
}

/* 屋号は demo.js が1行に収まるまで小さくする。それでも入らない長さのときだけ折り返し、1文字だけ次の行に落とさない */
html[data-demo-cross] .hero__title {
  text-wrap: balance;
}

/* 動きのあるスタイルのページ（美容室 D・外壁塗装 C）で全画面のメニューを開いたとき、デモ用バーの高さぶん下がった
   ヘッダーがメニューの項目に重ならないよう、画面の上に留める */
html.is-nav-open .pm-header,
html.is-nav-open .iso-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
}

/* ============ 見比べる画面（<dialog class="ds">。demo.js が作る） ============ */

html.demo-studio-open {
  overflow: hidden;
}

.ds {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  border: 0;
  background: #1d1d1f;
  color: #f5f5f7;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-size: 0.875rem;
  line-height: 1.6;
  letter-spacing: 0;
}

/* DOM では一覧が先（フォーカスが一覧から始まる）。幅900px以上では、選んだスタイルの大きな表示を左に置く */
.ds[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "panel";
}

.ds::backdrop {
  background: rgb(0 0 0 / 0.6);
}

.ds button,
.ds input {
  font: inherit;
}

.ds :focus-visible {
  outline: 3px solid #ffd60a;
  outline-offset: 2px;
}

.ds__stage {
  display: none;
  grid-area: stage;
}

.ds__panel {
  display: flex;
  flex-direction: column;
  grid-area: panel;
  min-width: 0;
  min-height: 0;
}

@media (min-width: 900px) {
  .ds[open] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "stage panel";
  }

  .ds__stage {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border-right: 1px solid #3a3a3c;
  }

  .ds__hint--narrow {
    display: none;
  }
}

.ds__stage-head {
  padding: 10px 16px;
  border-bottom: 1px solid #3a3a3c;
}

.ds__stage-caption {
  margin: 0;
  font-weight: 700;
}

.ds__stage-note,
.ds__hint {
  margin: 2px 0 0;
  color: #c7c7cc;
  font-size: 0.8125rem;
}

.ds__stage-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #ffffff;
}

.ds__stage-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.ds__loading {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  margin: 0;
  background: #2c2c2e;
  color: #f5f5f7;
}

.ds__stage-frame.is-loading .ds__loading {
  display: grid;
}

.ds__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #3a3a3c;
}

/* 見出しと説明は1行を広く使い、「一覧の表示」と「一覧を閉じる」は次の行に置く（説明が細い列で語の途中で折れないように） */
.ds__titles {
  flex: 1 1 100%;
  min-width: 0;
}

.ds__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.5;
}

.ds__lead {
  margin: 2px 0 0;
  color: #c7c7cc;
  font-size: 0.8125rem;
}

.ds__view {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
}

.ds__view-legend {
  float: left;
  margin-right: 6px;
  padding: 0;
  color: #c7c7cc;
  font-size: 0.8125rem;
}

.ds__view label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 2px 12px;
  border: 1px solid #8a8a8e;
  border-radius: 999px;
  cursor: pointer;
}

.ds__view input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.ds__view label:has(input:checked) {
  border-color: #f5f5f7;
  background: #f5f5f7;
  color: #1d1d1f;
  font-weight: 700;
}

.ds__view label:has(input:focus-visible) {
  outline: 3px solid #ffd60a;
  outline-offset: 2px;
}

.ds__close {
  margin-left: auto;
  min-height: 36px;
  padding: 4px 16px;
  border: 1px solid #ffd60a;
  border-radius: 999px;
  background: #ffd60a;
  color: #1d1d1f;
  font-weight: 700;
  cursor: pointer;
}

.ds__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 16px 32px;
}

.ds-group__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 20px 0 10px;
  font-size: 0.9375rem;
  font-weight: 700;
}

.ds-group__tag {
  padding: 0 8px;
  border-radius: 999px;
  background: #3a3a3c;
  color: #f5f5f7;
  font-size: 0.75rem;
  font-weight: 500;
}

.ds-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ds[data-view="pc"] .ds-cards {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.ds-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ds-card__frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 390 / 780;
  border-radius: 8px;
  background: #2c2c2e;
}

.ds[data-view="pc"] .ds-card__frame {
  aspect-ratio: 1280 / 800;
}

.ds-card__viewport iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 390px;
  height: 780px;
  border: 0;
  background: #ffffff;
  transform: scale(var(--ds-scale, 0.4));
  transform-origin: 0 0;
  pointer-events: none;
  opacity: 0;
}

.ds[data-view="pc"] .ds-card__viewport iframe {
  width: 1280px;
  height: 800px;
}

.ds-card.is-loaded .ds-card__viewport iframe {
  opacity: 1;
}

.ds-card__message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  color: #c7c7cc;
  font-size: 0.75rem;
  text-align: center;
}

.ds-card.is-loaded .ds-card__message {
  display: none;
}

/* ボタン（リンク）の押せる範囲をカード全体に広げる */
.ds-card__btn {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ds-card__btn::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 10px;
}

.ds-card__btn:focus-visible {
  outline: none;
}

.ds-card__btn:focus-visible::after {
  outline: 3px solid #ffd60a;
}

.ds-card:hover .ds-card__frame {
  box-shadow: 0 0 0 2px #8a8a8e;
}

.ds-card__ind {
  color: #c7c7cc;
  font-size: 0.75rem;
}

.ds-card__name {
  flex-basis: 100%;
  font-weight: 700;
  line-height: 1.45;
}

.ds-card__now {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: #ffd60a;
  color: #1d1d1f;
  font-size: 0.75rem;
  font-weight: 700;
}

.ds-card.is-current .ds-card__now {
  display: block;
}

/* 札の上を押しても、カード全体のボタンに届くようにする */
.ds-card__now {
  pointer-events: none;
}

/* 表示中のカードは白い枠、キーボードのフォーカスは黄色い枠（色だけに頼らず「表示中」の札も付ける） */
.ds-card.is-current .ds-card__frame {
  box-shadow: 0 0 0 3px #f5f5f7;
}

.ds-card__chips {
  display: flex;
  gap: 4px;
}

.ds-card__chips span {
  width: 14px;
  height: 14px;
  border: 1px solid rgb(255 255 255 / 0.25);
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .ds-card.is-loaded .ds-card__viewport iframe {
    transition: opacity 0.2s ease;
  }
}

/* 高さが足りない画面（横向きのスマホ・大きく拡大したとき）は、見出しの部分ごと一覧を送れるようにする */
@media (max-height: 500px) {
  .ds__list {
    flex: none;
    height: 100vh;
    height: 100dvh;
    overscroll-behavior: auto;
  }
}

/* 幅が狭い画面では一覧が画面いっぱいになるので、押す部品を指で押しやすい高さにし、見出しの部分を低くする
   （説明文と「一覧の表示」は画面から外すが、読み上げの説明と選択肢のまとまりの名前には残す） */
@media (max-width: 899px) {
  .ds__close,
  .ds__view label {
    min-height: 44px;
  }

  .ds__head {
    gap: 6px 12px;
    padding: 8px 16px;
  }

  .ds__lead,
  .ds__view-legend {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
