/* =============================================================
 * www / inquiry (問い合わせフォーム + 完了画面)
 *
 * デザイン方針 (2026 トレンド):
 *   - フローティングラベル (placeholder-shown 連動 / 透明背景でも崩れないトリック)
 *   - フィールドはカード化せず横線レス。下線アンダーラインだけで区切る
 *   - フォーカス時に primary 色のリングを 3px softly 拡張
 *   - エラーは "shake" + 赤縁 + 下にメッセージをスライドイン
 *   - 成功時は緑のチェックマークをサフィックスに表示
 *   - 概要(チェック)・性別/年齢(ラジオ)は "セグメンテッド・ピル" 風
 *   - SP 縦積み / PC 1 カラム中央 720px 幅 (フォームは横に長過ぎない方が完了率が高い)
 *   - ステップ進捗バー (10 段階の入力完了率を上部に視覚化)
 * ============================================================= */

/* ───── ベース ───── */
.inquiry-page {
  --iq-radius: 14px;
  --iq-radius-sm: 10px;
  --iq-primary: #44a162;
  --iq-primary-d: #357f4d;
  --iq-primary-l: #e7f4ec;
  --iq-danger: #d64545;
  --iq-danger-l: #fdecec;
  --iq-success: #2eb67d;
  --iq-text: #1f2937;
  --iq-text-2: #6b7280;
  --iq-text-3: #9ca3af;
  --iq-border: #e5e7eb;
  --iq-border-strong: #d1d5db;
  --iq-bg: #fafaf7;
  --iq-card: #fff;
  --iq-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.12);

  background: linear-gradient(180deg, #fff7d6 0%, #fffefb 280px, #fffefb 100%);
  padding-bottom: var(--sp-8, 64px);
  /* 入力エラー時の shake animation や box-shadow で内側要素が一瞬 viewport を
     越えることがあっても、ページ全体の水平スクロールに繋がらないようここでもクリップ。
     clip は scroll container を作らないため、内部の sticky (.inquiry-progress) に影響しない。 */
  overflow-x: hidden;
  overflow-x: clip;
}

.inquiry-page__body {
  position: relative;
  max-width: 760px;
  margin-inline: auto;
}

/* sub-hero (旧 .inquiry-hero-summary__* / .house-hero--inquiry) は
   public/css/www/components/sub-hero.css に切り出し済 (sub-hero.blade.php が @push で読み込み)。 */

/* ───── 満室時の強い注意ブロック
   フォーム入力前にユーザに気付かせるため、目立つ赤系グラデ + 太め文字 + アイコン
   role="alert" でスクリーンリーダにも伝達 ─────────────────────── */
.inquiry-full-alert {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 var(--sp-4);
  padding: 14px 18px;
  background: linear-gradient(135deg, #fff1ea 0%, #ffd7c8 100%);
  border: 1px solid #ff7a3a;
  border-left: 5px solid #d12c1a;
  border-radius: var(--iq-radius);
  color: #8a0e1d;
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 6px 18px rgba(209, 44, 26, .15), 0 1px 3px rgba(0, 0, 0, .06);
  animation: inquiry-full-alert-pulse 2.4s ease-in-out 2;
}
.inquiry-full-alert > i {
  flex-shrink: 0;
  font-size: 22px;
  color: #d12c1a;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .15));
}
.inquiry-full-alert strong {
  color: #b41a2b;
  font-weight: 900;
  padding: 0 2px;
  background: linear-gradient(180deg, transparent 60%, #ffe082 60%);
}
@keyframes inquiry-full-alert-pulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(209, 44, 26, .15), 0 1px 3px rgba(0, 0, 0, .06); }
  50%      { box-shadow: 0 8px 22px rgba(209, 44, 26, .35), 0 1px 3px rgba(0, 0, 0, .08); }
}
@media (prefers-reduced-motion: reduce) {
  .inquiry-full-alert { animation: none; }
}

/* ───── 案内文 ───── */
.inquiry-lead {
  text-align: center;
  margin: 0 0 6px;
  line-height: 1.7;
  color: var(--iq-text);
}
.inquiry-caution {
  text-align: center;
  color: var(--iq-danger);
  font-size: var(--fs-sm);
  margin: 0 0 var(--sp-4);
}

/* ───── プログレス (PC/SP 共通: position: sticky でスクロール追従)
   ─ DOM 上は .inquiry-page__body 直下にいるが、sticky の top はヘッダ / グローバルナビの
     現在の見え方に合わせて切り替える。各値は実際のレンダリング高に基づく:
       - 通常時 (PC): site-header (84px) + global-nav (60px) を避ける位置 = 152px
       - 通常時 (SP): site-header のみ (64px) を避ける = 72px
       - 圧縮時 (.site-header.is-compact 付与時): 圧縮ヘッダ実高 + 余白 (body の padding-top
         値は単なるスペーサーで実ヘッダ高より小さいため、目視高に合わせる必要あり)
           PC = 96px (圧縮ヘッダ実高 ~88px + 8px 余白)
           SP = 86px (圧縮ヘッダ実高 ~78px + 8px 余白)
   ─ z-index は global-nav (z-sticky=200) より高くしないと裏に隠れるので 250 とする ─ */
.inquiry-progress {
  position: sticky;
  top: 152px;
  z-index: 250;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border: 1px solid var(--iq-border);
  border-radius: 999px;
  padding: 8px 14px;
  margin: 0 auto var(--sp-4);
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--iq-shadow);
  transition: top .2s ease;
}
body.is-header-compact .inquiry-progress { top: 96px; }
@media (max-width: 767px) {
  /* SP は site header + house-sticky-nav (物件名 + タブ行) の二段固定ヘッダ。
     house-sticky-nav.blade.php の JS が下記 2 変数に実高をリアルタイム反映するので、
     progress bar の top をそれに追従させて固定ヘッダ全体と重ならないようにする。
     (8px は視覚的な余白) */
  .inquiry-progress,
  body.is-header-compact .inquiry-progress {
    top: calc(var(--house-sticky-site-top, 48px) + var(--house-sticky-nav-h, 60px) + 8px);
  }
}
.inquiry-progress__bar {
  flex: 1 1 auto;
  height: 6px;
  border-radius: 999px;
  background: var(--iq-border);
  overflow: hidden;
}
.inquiry-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--iq-primary), #6dd49a);
  transition: width .35s cubic-bezier(.2,.8,.2,1);
  border-radius: 999px;
}
.inquiry-progress__text {
  flex: 0 0 auto;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--iq-text-2);
  font-variant-numeric: tabular-nums;
}

/* ───── 物件サマリー (リッチカード) ───── */
.inquiry-summary {
  background: var(--iq-card);
  border: 1px solid var(--iq-border);
  border-radius: var(--iq-radius);
  margin-bottom: var(--sp-4);
  overflow: hidden;
  box-shadow: var(--iq-shadow);
}
.inquiry-summary__head {
  background: linear-gradient(180deg, #fffdf3, #fff);
  border-bottom: 1px solid var(--iq-border);
  padding: 12px 16px;
  font-weight: 700;
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  gap: 8px;
}
.inquiry-summary__head::before {
  content: '';
  width: 4px; height: 16px; border-radius: 2px;
  background: var(--iq-primary);
}
.inquiry-summary__body {
  display: flex;
  gap: 16px;
  padding: 16px;
  align-items: flex-start;
}
.inquiry-summary__thumb {
  flex: 0 0 140px;
  aspect-ratio: 4 / 3;
  border-radius: var(--iq-radius-sm);
  overflow: hidden;
  background: var(--iq-bg);
}
.inquiry-summary__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inquiry-summary__info { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.inquiry-summary__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.inquiry-summary__row--access { color: var(--iq-text-2); font-size: var(--fs-xs); }
.inquiry-summary__row--access span { display: inline-flex; align-items: center; gap: 4px; }
.inquiry-summary__price { font-weight: 700; color: var(--iq-text); }
.inquiry-summary__rooms { color: var(--iq-text-2); }
.inquiry-summary__vacancy {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: #fff;
  letter-spacing: .04em;
}
.inquiry-summary__vacancy--vacant { background: linear-gradient(135deg, #ff6f8b, #e85d75); }
.inquiry-summary__vacancy--soon   { background: linear-gradient(135deg, #ffb74d, #f5a623); }
.inquiry-summary__vacancy--full   { background: linear-gradient(135deg, #b0b0b0, #888); }
.inquiry-summary__cond { list-style: none; padding: 0; margin: 4px 0 0; display: flex; gap: 10px; font-size: var(--fs-xs); }
.inquiry-summary__cond .is-ng         { color: var(--iq-text-3); }
.inquiry-summary__cond .is-ok-man     { color: #1f80b6; font-weight: 700; }
.inquiry-summary__cond .is-ok-woman   { color: #d34e6c; font-weight: 700; }
.inquiry-summary__cond .is-ok-foreign { color: #2f9e6a; font-weight: 700; }
.inquiry-summary__cond-note { font-size: var(--fs-xs); color: var(--iq-text-2); margin: 4px 0 0; }

/* ───── トップエラーまとめ ───── */
.inquiry-errors {
  background: var(--iq-danger-l);
  border: 1px solid #f5b8b8;
  border-radius: var(--iq-radius);
  padding: 12px 16px;
  margin-bottom: var(--sp-3);
  color: #8a2a2a;
}
.inquiry-errors__head { font-weight: 700; margin: 0 0 6px; display: flex; align-items: center; gap: 6px; }
.inquiry-errors__head::before { content: '⚠'; font-size: 1em; }
.inquiry-errors ul { margin: 0; padding-left: 1.2em; font-size: var(--fs-sm); }

/* ───── フォーム ───── */
.inquiry-form {
  background: var(--iq-card);
  border: 1px solid var(--iq-border);
  border-radius: var(--iq-radius);
  box-shadow: var(--iq-shadow);
  padding: 8px 0;
}

/* 行 (フローティングラベル + 下線) */
.inquiry-field {
  position: relative;
  padding: 18px 20px 14px;
  border-bottom: 1px dashed var(--iq-border);
}
.inquiry-field:last-of-type { border-bottom: 0; }
.inquiry-field__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.inquiry-field__label {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--iq-text);
}
.inquiry-field__hint {
  font-size: var(--fs-xs);
  color: var(--iq-text-2);
  margin: 4px 0 6px;
}

/* 必須/任意バッジ */
.inquiry-required, .inquiry-optional {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: .04em;
}
.inquiry-required { background: #ffeaea; color: #c53030; }
.inquiry-optional { background: #eef6ee; color: #2f7a48; }

/* ───── テキスト系 (フローティングラベル) ───── */
.inquiry-input {
  position: relative;
  display: block;
}
.inquiry-input input,
.inquiry-input textarea {
  width: 100%;
  padding: 18px 44px 8px 14px;  /* 上余白で float ラベルの居場所を確保 + 右はサフィックスアイコン用 */
  /* iOS Safari は input/textarea/select の font-size が 16px 未満だと focus 時に自動ズームし、
     ズームに伴って viewport より広い領域が出来るため、ページ全体が水平スクロール可能になる。
     SP では html の font-size が 15px で var(--fs-base) = 15px となり閾値割れするため、
     16px を下限にした max() で固定する。 */
  font-size: max(16px, var(--fs-base));
  background: #fff;
  border: 1.5px solid var(--iq-border-strong);
  border-radius: var(--iq-radius-sm);
  box-sizing: border-box;
  color: var(--iq-text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  appearance: none;
}
.inquiry-input textarea {
  padding-top: 24px;
  resize: vertical;
  min-height: 9em;
  line-height: 1.65;
}
.inquiry-input input::placeholder,
.inquiry-input textarea::placeholder {
  color: transparent; /* placeholder-shown 判定用に空文字ではなく透明にする */
  transition: color .15s ease;
}
.inquiry-input input:focus,
.inquiry-input textarea:focus {
  outline: none;
  border-color: var(--iq-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(68, 161, 98, .18);
}
.inquiry-input input:focus::placeholder,
.inquiry-input textarea:focus::placeholder { color: var(--iq-text-3); }

/* フローティングラベル */
.inquiry-input__label {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 0 4px;
  font-size: var(--fs-base);
  color: var(--iq-text-3);
  pointer-events: none;
  background: transparent;
  transition: transform .15s ease, color .15s ease, font-size .15s ease, top .15s ease;
}
.inquiry-input input:focus + .inquiry-input__label,
.inquiry-input input:not(:placeholder-shown) + .inquiry-input__label,
.inquiry-input textarea:focus + .inquiry-input__label,
.inquiry-input textarea:not(:placeholder-shown) + .inquiry-input__label {
  top: -8px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--iq-primary-d);
  background: linear-gradient(180deg, #fff 50%, #fff 50%);
}

/* サフィックス (バリデーション結果アイコン) */
.inquiry-input__suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transform-origin: center;
  transition: opacity .2s ease, transform .2s ease;
}
.inquiry-input--ok .inquiry-input__suffix {
  opacity: 1;
  background: var(--iq-success);
  color: #fff;
}
.inquiry-input--ng .inquiry-input__suffix {
  opacity: 1;
  background: var(--iq-danger);
  color: #fff;
}
.inquiry-input--ok input,
.inquiry-input--ok textarea {
  border-color: var(--iq-success);
  box-shadow: 0 0 0 3px rgba(46, 182, 125, .15);
}
.inquiry-input--ng input,
.inquiry-input--ng textarea {
  border-color: var(--iq-danger);
  box-shadow: 0 0 0 3px rgba(214, 69, 69, .15);
}

/* textarea のときサフィックスは右上に */
.inquiry-input--textarea .inquiry-input__suffix { top: 14px; transform: none; }

/* エラー文 (スライドイン) */
.inquiry-msg {
  display: block;
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--iq-danger);
  min-height: 1em;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
}
.inquiry-msg.is-shown {
  opacity: 1;
  transform: translateY(0);
}
.inquiry-counter {
  display: inline-block;
  margin-left: 8px;
  font-size: var(--fs-xs);
  color: var(--iq-text-3);
  font-variant-numeric: tabular-nums;
}
.inquiry-counter.is-near { color: #c97a04; }
.inquiry-counter.is-over { color: var(--iq-danger); font-weight: 700; }

/* NG 入力時のフィードバック (旧 shake アニメ)
   かつて translateX(±4px) で要素ごと左右に揺らしていたが、iOS Safari ではこの transform が
   ドキュメントの scrollWidth を一瞬広げ、それを契機にページ全体が水平スクロール可能に
   なってしまう事象 (キャッシュクリア後・iPhone SE3 でも再現) があった。
   transform は完全に廃止し、レイアウトに影響しない outline / box-shadow のフラッシュで
   「赤くピカっと光る」フィードバックに置き換える。 */
@keyframes inquiryShake {
  0%   { box-shadow: 0 0 0 0 rgba(214, 69, 69, .55); }
  40%  { box-shadow: 0 0 0 6px rgba(214, 69, 69, .35); }
  100% { box-shadow: 0 0 0 3px rgba(214, 69, 69, .15); }
}
.inquiry-input.is-shake input,
.inquiry-input.is-shake textarea {
  animation: inquiryShake .45s cubic-bezier(.2, .8, .2, 1) both;
}

/* ───── セグメンテッド・ピル (チェックボックス / ラジオ) ───── */
.inquiry-pills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.inquiry-pills--age {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.inquiry-pills li { margin: 0; }
.inquiry-pills label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1.5px solid var(--iq-border-strong);
  background: #fff;
  border-radius: 999px;
  font-size: var(--fs-sm);
  cursor: pointer;
  user-select: none;
  transition: all .15s ease;
  white-space: nowrap;
  width: 100%;
}
.inquiry-pills--age label { font-weight: 600; }
.inquiry-pills label:hover {
  border-color: var(--iq-primary);
  color: var(--iq-primary-d);
  background: var(--iq-primary-l);
}
.inquiry-pills input { position: absolute; opacity: 0; pointer-events: none; }
.inquiry-pills input:checked + span,
.inquiry-pills label:has(input:checked) {
  background: var(--iq-primary);
  color: #fff;
  border-color: var(--iq-primary);
  box-shadow: 0 4px 14px -6px rgba(68,161,98,.5);
  font-weight: 700;
}
.inquiry-pills input:focus-visible + span,
.inquiry-pills label:has(input:focus-visible) {
  outline: 2px solid rgba(68,161,98,.5);
  outline-offset: 2px;
}

/* ───── セレクト (ネイティブ + 矢印デザイン) ───── */
.inquiry-select {
  position: relative;
  display: block;
}
.inquiry-select select {
  width: 100%;
  padding: 18px 40px 8px 14px;
  /* input と同様、iOS Safari の focus 時ズーム防止のため 16px を下限にする */
  font-size: max(16px, var(--fs-base));
  background: #fff;
  border: 1.5px solid var(--iq-border-strong);
  border-radius: var(--iq-radius-sm);
  appearance: none;
  -webkit-appearance: none;
  color: var(--iq-text);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.inquiry-select select:focus {
  outline: none;
  border-color: var(--iq-primary);
  box-shadow: 0 0 0 3px rgba(68, 161, 98, .18);
}
.inquiry-select::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--iq-text-2);
  border-bottom: 2px solid var(--iq-text-2);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.inquiry-select__label {
  position: absolute;
  left: 14px;
  top: -8px;
  padding: 0 4px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--iq-primary-d);
  background: #fff;
  pointer-events: none;
}
.inquiry-select--ok select {
  border-color: var(--iq-success);
  box-shadow: 0 0 0 3px rgba(46, 182, 125, .15);
}
.inquiry-select--ng select {
  border-color: var(--iq-danger);
  box-shadow: 0 0 0 3px rgba(214, 69, 69, .15);
}

/* ───── 送信エリア ───── */
.inquiry-submit {
  padding: 24px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inquiry-submit .btn {
  height: 56px;
  font-size: var(--fs-base);
  font-weight: 800;
  letter-spacing: .04em;
  border-radius: 999px;
  box-shadow: 0 8px 22px -10px rgba(68,161,98,.6);
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.inquiry-submit .btn:active { transform: translateY(1px); }
.inquiry-submit .btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.inquiry-submit__note {
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--iq-text-2);
  margin: 0;
}

/* honeypot (Bot 用、人間には絶対に見せない)
   かつて left: -10000px で画面外に飛ばしていたが、それだと iOS Safari でドキュメントの
   scrollWidth が拡張され、submit 後に水平スクロールが効くようになってしまうため、
   .sr-only 同等の「1×1 / margin -1 / clip」パターンで完全に layout 影響を消す。 */
.inquiry-hp {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  pointer-events: none !important;
}

/* ───── SP (max-width: 640px) ───── */
@media (max-width: 640px) {
  .inquiry-page { padding-bottom: 40px; }
  .inquiry-summary__body { flex-direction: column; }
  .inquiry-summary__thumb { width: 100%; flex: 1 1 auto; aspect-ratio: 16/9; }
  .inquiry-field { padding: 16px 14px 12px; }
  .inquiry-pills { gap: 6px; }
  .inquiry-pills--age { grid-template-columns: repeat(2, 1fr); }
  .inquiry-progress { max-width: none; margin-left: 8px; margin-right: 8px; }
}

/* ───── 完了画面 ───── */
.inquiry-complete {
  text-align: center;
  padding: 48px 20px;
  background: var(--iq-card);
  border: 1px solid var(--iq-border);
  border-radius: var(--iq-radius);
  box-shadow: var(--iq-shadow);
}
.inquiry-complete__icon {
  font-size: 72px;
  color: var(--iq-success);
  line-height: 1;
  margin-bottom: 16px;
  animation: inquiryPop .5s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes inquiryPop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.inquiry-complete__lead { margin: 0 0 12px; font-size: var(--fs-lg); font-weight: 700; }
.inquiry-complete__note { margin: 0 0 24px; color: var(--iq-text-2); font-size: var(--fs-sm); }
.inquiry-complete__actions {
  display: flex;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
  flex-wrap: wrap;
}
.inquiry-complete__actions .btn { flex: 1 1 200px; height: 48px; border-radius: 999px; }
