/* スマホ下の固定ボタン(OwnerLayout.astro の .mobile-cta-bar)。
   見た目は白の帯に明朝の文字(たいち 11/08 に B 案で決定)。並びは らくらく賃料査定 / 部屋探し / お問い合わせ。
   査定は、ページ内の査定ボタンと同じ黒地に黄緑の光が回る見た目(style.css の共有の決まり)。
   部屋探しを押すと、帯の上に2店舗の広告が横に並んで出る(たいち 11/08)。
   色と書体は style.css の :root の変数だけを使う */

.mobile-cta-bar .bar-label {
  white-space: nowrap;
}
.mobile-cta-bar .bar-rooms[hidden] {
  display: none;
}

@media (max-width: 760px) {
  /* iPhone の画面下の帯の分だけ、ボタンの下と本文の下を空ける(帯の無い端末では 0) */
  .mobile-cta-bar {
    grid-template-columns: 1.15fr 1fr 1fr;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--color-base);
    border-top: 1px solid var(--color-text);
    box-shadow: none;
  }
  /* 下の帯の高さ(上の線 1px + ボタン 60px)。本文の下の空きとメニューの高さで同じ値を使い、帯との間に白いすき間を作らない */
  :root {
    --mobile-bar-h: calc(61px + env(safe-area-inset-bottom, 0px));
  }
  body {
    padding-bottom: var(--mobile-bar-h);
  }

  /* ===== 帯の3つ(白の帯に明朝の文字。お問い合わせは濃いグレーの板) ===== */
  .mobile-cta-bar > :is(a, button) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 60px;
    margin: 0;
    padding: 0 4px;
    color: var(--color-text);
    background: transparent;
    border: 0;
    border-left: 1px solid var(--color-line);
    border-radius: 0;
    font-family: var(--font-display);
    font-weight: var(--font-display-weight);
    font-size: 13px;
    letter-spacing: 0.04em;
    text-decoration: none;
    cursor: pointer;
  }
  .mobile-cta-bar > :first-child {
    border-left: 0;
  }
  .mobile-cta-bar .bar-svg {
    display: block;
    width: 20px;
    height: 20px;
  }
  .mobile-cta-bar > a.is-primary {
    background: var(--color-primary);
    color: #fff;
  }
  .mobile-cta-bar .bar-rooms-toggle[aria-expanded="true"] {
    background: var(--color-soft);
  }
  .mobile-cta-bar > :is(a, button):focus-visible {
    outline: 2px solid var(--brand-green);
    outline-offset: -4px;
  }

  /* ===== 部屋探しで出てくる部分: 帯のすぐ上に、下から少し上がって出る。2店舗の広告を横に並べる ===== */
  .mobile-cta-bar .bar-rooms {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    padding: 16px var(--gutter) 14px;
    background: var(--color-base);
    border-top: 1px solid var(--color-text);
    box-shadow: 0 -12px 28px rgba(20, 20, 20, 0.12);
    opacity: 0;
    transform: translateY(12px);
    transition:
      opacity 0.22s var(--ease),
      transform 0.32s var(--ease);
  }
  .mobile-cta-bar .bar-rooms.is-open {
    opacity: 1;
    transform: none;
  }
  .bar-rooms-title {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-weight: var(--font-display-weight);
    font-size: 14px;
    letter-spacing: 0.06em;
  }
  .bar-rooms-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  /* 帯のボタンの決まり(style.css の .mobile-cta-bar a)を、店舗の入口では打ち消す */
  .mobile-cta-bar .bar-rooms-list a {
    display: grid;
    gap: 6px;
    min-height: 0;
    padding: 0;
    color: inherit;
    background: none;
    border: 0;
    font-size: inherit;
    text-align: center;
    text-decoration: none;
  }
  .bar-rooms-list img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(20, 20, 20, 0.12);
  }
  /* 広告の中の文字は小さくなるので、店名を下に添えて読めるようにする */
  .bar-rooms-name {
    font-family: var(--font-display);
    font-weight: var(--font-display-weight);
    font-size: 13px;
    letter-spacing: 0.04em;
    line-height: 1.4;
  }
  .bar-rooms-name::after {
    content: " ↗";
    font-family: var(--font-sans);
  }
  .mobile-cta-bar .bar-rooms-list a:focus-visible {
    outline: 2px solid var(--brand-green);
    outline-offset: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-cta-bar .bar-rooms {
    transition: none;
  }
}
