@charset "UTF-8";

/* =========================================================
   佐々木あやのに聞いてみる（/policy/ask/）専用スタイル
   page.css の後に読み込む。<main> の中の .policy-ask だけを担当する
   ========================================================= */

.policy-ask__intro p {
  font-size: 15px;
  line-height: 1.8;
}

.policy-ask__notice {
  margin-top: 24px;
  padding: 16px;
  background: var(--color-primary-light);
  border-radius: 8px;
}

/* ---------------------------------------------------------
   1. やりとりの欄
   質問は右寄せ・薄いグレー、こたえは左寄せ・薄い水色。
   こたえの左に「AI」の丸を付けて、だれが返しているかを見せる
   --------------------------------------------------------- */
.policy-ask__log {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 32px;
}

.policy-ask__log:empty {
  display: none;
}

/* はじめのあいさつ（吹き出しにしない。ページの文として読む） */
.content-section .policy-ask__greet p {
  font-size: 15px;
  line-height: 1.8;
}

.content-section .policy-ask__greet p + p {
  margin-top: .5em;
}

.policy-ask__msg {
  /* 画面を動かしたとき、上の固定ヘッダー（PC。SP は html の scroll-padding-top）と
     下に留めた入力欄に隠れないようにする */
  scroll-margin-top: calc(var(--pc-header-h, 0px) + 16px);
  scroll-margin-bottom: 150px;
  max-width: 92%;
  padding: 14px 16px;
  border-radius: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.policy-ask__msg--you {
  align-self: flex-end;
  background: var(--color-light-gray);
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}

.policy-ask__msg--bot {
  position: relative;
  align-self: flex-start;
  max-width: calc(100% - 44px);
  margin-left: 44px;
  background: var(--color-primary-light);
  border-top-left-radius: 4px;
}

/* 「AI」の丸（読み上げは吹き出しの「AI のこたえ」に任せる） */
.policy-ask__msg--bot::before {
  content: "AI";
  content: "AI" / "";
  position: absolute;
  top: 0;
  left: -44px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-primary-dark);
  color: var(--color-white);
  font: 700 13px/1 var(--font-en);
  letter-spacing: .02em;
}

.policy-ask__msg.is-loading {
  color: var(--color-primary-dark);
}

.content-section .policy-ask__msg p + p {
  margin-top: .5em;
}

/* 読み上げ用の見えない見出し（「あなたの質問」など）のあとは間をあけない。あけると文字が下に寄る */
.content-section .policy-ask__msg .visually-hidden + p {
  margin-top: 0;
}

/* 頭の一行（「「子育て・教育」の政策から、近いところを見つけました。」）。本文と同じ大きさで話しかける */
.content-section .policy-ask__head {
  margin: 0;
}

/* 公式サイトの原文の囲み。会話の文と分けて、書いてあるとおりの文だと分かるようにする */
.policy-ask__quote {
  margin: .6em 0 0;
  padding: 12px 14px;
  background: var(--color-white);
  border-left: 3px solid var(--color-primary);
  border-radius: 4px 8px 8px 4px;
  font-size: 15px;
  line-height: 1.8;
}

.content-section .policy-ask__quote p + p {
  margin-top: .4em;
}

/* 原文の中の見出し（柱・施策の名前）。太字にして、前の説明と少し離す */
.content-section .policy-ask__quote .policy-ask__sub {
  font-weight: 700;
  color: var(--color-primary-dark);
}

.content-section .policy-ask__quote p + .policy-ask__sub {
  margin-top: 1em;
}

/* 政策の全体の答え：1 分野ずつ区切る（分野名の小さな札 → 目指す姿 → 説明文 → その分野のページ） */
.policy-ask__part + .policy-ask__part {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border, #e3e8ec);
}

.content-section .policy-ask__quote .policy-ask__label {
  display: inline-block;
  margin: 0 0 .3em;
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.8;
}

.content-section .policy-ask__part .policy-ask__sub {
  margin-top: 0;
  font-size: 16px;
  line-height: 1.6;
}

.content-section .policy-ask__part .policy-ask__sub + p {
  margin-top: .6em;
}

.content-section .policy-ask__quote .policy-ask__more {
  margin-top: .6em;
  font-size: 14px;
}

/* 分野を選ぶボタン。分野名と目指す姿を 1 つのボタンに（.content-section ul の点と字下げを打ち消すため 2 段で指定） */
.policy-ask__msg .policy-ask__choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin: .8em 0 0;
  padding: 0;
  list-style: none;
}

.policy-ask__msg .policy-ask__choices > li {
  margin: 0;
}

.policy-ask__choice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  height: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-primary);
  border-radius: 8px;
  background: var(--color-white);
  color: var(--color-black);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s;
}

.policy-ask__choice:hover {
  background: var(--color-primary-light);
}

.policy-ask__choice:focus-visible {
  outline: 2px solid var(--color-primary-dark);
  outline-offset: 2px;
}

.policy-ask__choice[aria-pressed="true"] {
  border-width: 2px;
  padding: 9px 11px;
}

.policy-ask__choice-name {
  color: var(--color-primary-dark);
  font-size: 15px;
  font-weight: 700;
}

.policy-ask__choice-note {
  font-size: 13px;
  line-height: 1.6;
}

/* 分野の全体の答えで、頭の「目指す姿」のあとの柱の見出しとの間を空ける */
.content-section .policy-ask__part + .policy-ask__sub {
  margin-top: 1.2em;
  padding-top: 1em;
  border-top: 1px solid var(--color-border, #e3e8ec);
}

/* スマホは「AI」の丸と余白を小さくして、文の幅を広く取る */
@media (max-width: 599px) {
  .policy-ask__msg--bot {
    max-width: calc(100% - 36px);
    margin-left: 36px;
    padding: 12px 14px;
  }

  .policy-ask__msg--bot::before {
    left: -36px;
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .policy-ask__quote {
    padding: 10px 12px;
  }
}

/* 探しているあいだの「…」 */
.policy-ask__dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.policy-ask__dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: policy-ask-dot 1.2s infinite ease-in-out;
}

.policy-ask__dots span:nth-child(2) { animation-delay: .2s; }
.policy-ask__dots span:nth-child(3) { animation-delay: .4s; }

@keyframes policy-ask-dot {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .policy-ask__dots span { animation: none; opacity: .6; }
}

.content-section .policy-ask__source {
  margin-top: .5em;
  font-size: .8125rem;
  color: var(--color-text-light, #666);
  line-height: 1.6;
}

.content-section .policy-ask__link {
  margin-top: .75em;
}

.content-section .policy-ask__link a {
  color: var(--color-primary-dark);
  font-weight: 700;
}

/* ---------------------------------------------------------
   2. 入力欄
   画面の下に留めておく（position: sticky）。ページを開いてすぐ書けて、
   答えを読むために上へ戻らなくてよい。ページの終わり（お問い合わせ）まで来たら元の場所に戻る
   --------------------------------------------------------- */
.policy-ask__form {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 24px;
  padding: 12px 0 8px;
  background: var(--color-white);
  box-shadow: 0 -1px 0 var(--color-border, #e3e8ec);
}

/* SP は左右いっぱいに白を敷き、下の文が透けて見えないようにする */
@media (max-width: 1199px) {
  .policy-ask__form {
    margin-inline: calc(-1 * var(--col-main-pad-x));
    padding-inline: var(--col-main-pad-x);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .08);
  }
}

/* 質問の欄と「聞いてみる」を横に並べる */
.policy-ask__row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.policy-ask__form[hidden] {
  display: none;
}

.policy-ask__label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.policy-ask__input {
  display: block;
  box-sizing: border-box;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 64px;
  max-height: 30vh;
  padding: 10px 12px;
  border: 1px solid #9e9e9e;
  border-radius: 8px;
  background: #fff;
  color: var(--color-black);
  font: inherit;
  font-size: 16px;               /* iPhone で入力時に拡大されない大きさ */
  line-height: 1.6;
  resize: vertical;
}

.policy-ask__input:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary-dark);
}

.content-section .policy-ask__count {
  margin-top: 2px;
  color: #616161;
  font-size: 12px;
  text-align: right;
}

.content-section .policy-ask__count.is-over {
  color: #b3261e;
  font-weight: 700;
}

.policy-ask__turnstile:not(:empty) {
  margin-top: 12px;
}

.policy-ask__submit {
  display: block;
  flex: 0 0 auto;
  min-height: var(--tap-size);
  padding: 10px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--color-primary-dark);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .05em;
  cursor: pointer;
}

.policy-ask__submit:hover {
  background: var(--color-primary);
}

.policy-ask__submit:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.policy-ask__submit:disabled {
  opacity: .6;
  cursor: wait;
}

/* ---------------------------------------------------------
   3. 下の案内
   --------------------------------------------------------- */
.content-section .policy-ask__more {
  margin-top: 40px;
}

.content-section .policy-ask__contact {
  margin-top: 8px;
  font-size: 14px;
}

/* ---------------------------------------------------------
   4. 政策ページの骨格（policy.css の .pv）の中に置くときの幅
   見出しは政策の全体像と同じ。質問欄は読みやすい幅にとどめ、PC では見出しと左をそろえる
   --------------------------------------------------------- */
.policy-ask-page .policy-ask {
  max-width: 760px;
  margin-top: 32px;
}

/* 見出しは「佐々木あやのについて／AIに聞いてみる」の切れ目でだけ折り返す */
.policy-ask-page__nb {
  display: inline-block;
}

/* SP は「佐々木あやのについて」（10字）が1行に入る大きさまで下げる（32px が上限） */
@media (max-width: 1199px) {
  .policy-ask-page .pv-head__title {
    font-size: min(32px, calc((100vw - 64px) / 10.4));
  }
}
