/* トップページ専用。共通レイアウトや他ページには読み込まない。
   ファーストビューに 3カード段（新着情報・イベント情報・活動紹介）を入れるための余白・高さ調整のみ。
   使わないこと: height:100vh の強制、overflow:hidden、transform:scale、文字の極端な縮小、AOS の上書き、
   3カード内 SVG への width:auto（幅が 0 になりアイコンが消える）。
   地図画像を短くする場合は、既存の imageMapResize() が座標を合わせる。 */

@media screen and (min-width: 769px) {
  /* 以前の height: calc(100vh - 68px) と min-height: 862px は、
     中身が入りきらないときにはみ出し・欠け・重なりの原因になるため解除する */
  .p-top1 {
    height: auto;
    min-height: 0;
    padding: 16px 0 12px;
  }

  .p-top1__column {
    margin-top: 16px;
  }

  .p-top1__item--line-1 {
    margin-bottom: 24px;
  }

  .p-top1__content2 {
    margin-top: 12px;
  }

  .p-top1 .c-boxmap {
    padding: 6px;
  }

  .p-top1 .c-boxmap p.title {
    height: auto;
    margin: 4px 0 0;
    bottom: 0;
  }
}

@media screen and (min-width: 769px) and (max-height: 900px) {
  .p-top1 .c-boxmap > img[usemap] {
    max-height: 470px;
    height: auto;
    max-width: 100%;
  }
}

@media screen and (min-width: 769px) and (max-height: 800px) {
  .p-top1 {
    padding: 10px 0 8px;
  }
  .p-top1__column {
    margin-top: 10px;
  }
  .p-top1__content2 {
    margin-top: 8px;
  }
  .p-top1__item--line-1 {
    margin-bottom: 18px;
  }
  .p-top1__item--line-1 .c-box {
    height: 188px;
  }
  .p-top1__item--line-2 .c-box {
    height: 174px;
  }
  /* 3カードの高さは元の 116px のまま（アイコンが欠けないようにする） */
  .p-top1 .c-boxmap > img[usemap] {
    max-height: 360px;
  }
  /* 地図を低くしたとき、案内文を地図の下（タイトルの上）に移し、地方・ボタンと重ねない */
  .p-top1 .c-boxmap > p:not(.title) {
    position: relative;
    top: auto;
    left: auto;
    bottom: auto;
    width: 100%;
    max-width: none;
    text-align: center;
    margin: 4px 0 0;
    line-height: 1.3;
    z-index: 3;
    pointer-events: none;
  }
}

@media screen and (min-width: 769px) and (max-height: 680px) {
  .p-top1 {
    padding: 6px 0 4px;
  }
  .p-top1__column {
    margin-top: 6px;
  }
  .p-top1__item--line-1 {
    margin-bottom: 12px;
  }
  /* 地図より左カードが高くなると、地図を縮めてもファーストビューに入らない */
  .p-top1__item--line-1 .c-box,
  .p-top1__item--line-2 .c-box {
    height: auto;
    min-height: 136px;
  }
  .p-top1__content2 {
    margin-top: 6px;
  }
  .p-top1__content2 .c-box,
  .p-top1__item--line-3 .c-box {
    height: 100px;
  }
  .p-top1 .c-boxmap > img[usemap] {
    max-height: 220px;
  }
}

@media screen and (max-width: 768px) {
  .p-top1 {
    height: auto;
  }
}


/* 文字サイズ「大」(html 75%) で説明文の固定改行・ボタン/ラベルの1文字落ちを防ぐ。
   小・中の見た目は変えない。consultation-ui.css は使わない（トップでは未読込）。 */
html[data-font-size="large"] .p-top1__desc-break,
html[style*="font-size: 75%"] .p-top1__desc-break {
  display: none;
}

.p-top1 .c-box,
.p-top1 .c-box__list-btn a {
  container-type: inline-size;
}

html[data-font-size="large"] .p-top1 .c-box p,
html[style*="font-size: 75%"] .p-top1 .c-box p {
  word-break: keep-all;
  line-break: strict;
  letter-spacing: 0;
}

/* PCの狭いカードだけ、語が収まるよう字サイズを少し抑える。スマホでは小さくしすぎない。 */
@media screen and (min-width: 769px) {
  html[data-font-size="large"] .p-top1 .c-box p,
  html[style*="font-size: 75%"] .p-top1 .c-box p {
    font-size: min(1.6rem, 10.5cqw);
  }

  html[data-font-size="large"] .p-top1 .c-box p .p-top1__phrase,
  html[style*="font-size: 75%"] .p-top1 .c-box p .p-top1__phrase {
    white-space: nowrap;
  }
}

html[data-font-size="large"] .p-top1 .c-box__list-btn a span,
html[style*="font-size: 75%"] .p-top1 .c-box__list-btn a span {
  word-break: keep-all;
  line-break: strict;
  white-space: nowrap;
  letter-spacing: 0;
  font-size: min(1.6rem, 20cqw);
}

/* スマホ幅だけ、地図（公認フォーラム）をメニューボタン・NEWS/イベント/活動紹介の下へ。
   PC（769px以上）の並びは変えない。原因は .p-top1__content の flex-wrap: wrap-reverse。 */
@media screen and (max-width: 768px) {
  .p-top1 .l-container {
    display: flex;
    flex-direction: column;
  }
  .p-top1__desc {
    order: 1;
  }
  .p-top1__content {
    display: contents;
  }
  .p-top1__content .p-top1__column:first-child {
    order: 2;
  }
  .p-top1__content2 {
    order: 3;
  }
  .p-top1__content .p-top1__column:last-child {
    order: 4;
  }
}
