/* ============================================================
   HAL探偵社 東京赤坂支店 — 非公開相談フォーム
   Form Stylesheet 旧版
   ------------------------------------------------------------
   - LP同梱時は .hal-lp のCSS変数を継承
   - 単体設置（WordPressテーマ内）でも成立するようフォールバックを定義
   - 赤い必須バッジ・派手なエラー・強い角丸/影・青/緑ボタンは使用しない
   ============================================================ */

.hal-form-section {
  --hal-ink: #1b1813; /* 旧版 自己参照サイクル修正（値は.hal-lpと同一） */
  --hal-sumi: #23211d;
  --hal-body: #5c574e;
  --hal-body-deep: #3a362f;
  --hal-muted: #8b8478;
  --hal-bg: #f5f2ea;
  --hal-bg-alt: #ece7db;
  --hal-bg-box: #efeae0;
  --hal-line: #e6e0d2;
  --hal-line-deep: #ddd6c8;
  --hal-gold: #9c8456;
  --hal-gold-deep: #7B6A50;
  --hal-gold-hover: #8A7658;
  --hal-serif: 'Zen Old Mincho', serif;
  --hal-sans:  'Zen Kaku Gothic New', sans-serif;
  --hal-mono:  'Space Mono', monospace;
  /* エラー表示：赤を強く使わない。墨に寄せた深い赤褐でコントラスト確保 */
  --hal-err:   #7a4a3a;
  --hal-err-line: #b08a7a;

  background: var(--hal-bg);
  border-top: 1px solid var(--hal-line);
  padding-block: 72px;
  font-family: var(--hal-sans);
  color: var(--hal-sumi);
  letter-spacing: 0.035em;
}
.hal-form-section *, .hal-form-section *::before, .hal-form-section *::after { box-sizing: border-box; }

.hal-form-wrap {
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  padding-inline: 28px;
}

.hal-form-label-en {
  font-family: var(--hal-mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--hal-gold);
}
.hal-form-title {
  font-family: var(--hal-serif);
  font-weight: 600;
  font-size: clamp(24px, 2.4vw, 30px);
  line-height: 1.55;
  letter-spacing: 0.02em;
  margin: 20px 0 0;
  color: var(--hal-sumi);
}
.hal-form-intro {
  font-size: 13.5px;
  line-height: 1.95;
  color: var(--hal-body);
  margin: 22px 0 0;
}
.hal-form-intro p { margin: 0 0 14px; }
.hal-form-intro p:last-child { margin-bottom: 0; }

/* 旧版 ⑭ Astra親テーマ／WordPress実機とのCSS衝突対策
   （実機でラベル・ラジオ・selectの位置がずれていた根本原因への防御的リセット）
   本セクション配下のフォーム要素は、親テーマのグローバルスタイルの影響を
   受けないよう、box-sizing・line-height・vertical-alignを明示的に固定する。 */
.hal-form-section,
.hal-form-section * {
  box-sizing: border-box;
}
.hal-form-section label,
.hal-form-section legend {
  line-height: 1.5;
  vertical-align: baseline;
}
.hal-form-section input,
.hal-form-section select,
.hal-form-section textarea,
.hal-form-section button {
  font-family: inherit;
  line-height: normal;
  vertical-align: middle;
  box-shadow: none;
  border-radius: 0;
}
.hal-form-section input[type="radio"],
.hal-form-section input[type="checkbox"] {
  width: auto;
  height: auto;
  margin: 0;
}

/* ---- フィールド ---- */
.hal-form { margin-top: 40px; }
.hal-field { margin-top: 30px; }
.hal-field:first-child { margin-top: 0; }

.hal-field > label,
.hal-fieldset legend {
  display: block;
  font-family: var(--hal-serif);
  font-size: 14.5px;
  letter-spacing: 0.05em;
  color: var(--hal-sumi);
  padding: 0;
}
.hal-field__hint {
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--hal-muted);
  margin-top: 6px;
}
.hal-field__hint p { margin: 0 0 6px; }
.hal-field__hint p:last-child { margin-bottom: 0; }

.hal-input,
.hal-select,
.hal-textarea {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px 40px 12px 14px; /* 旧版 ⑭ select矢印との重なり防止で右padding確保 */
  min-height: 46px;
  font-family: var(--hal-sans);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0.03em;
  color: var(--hal-sumi);
  background: #fdfcf8;
  border: 1px solid var(--hal-line-deep);
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  vertical-align: middle;
}
.hal-input,
.hal-textarea { padding-right: 14px; } /* select以外は右余白不要 */
.hal-textarea { min-height: 180px; resize: vertical; }
.hal-input:focus-visible,
.hal-select:focus-visible,
.hal-textarea:focus-visible {
  outline: 2px solid var(--hal-gold);
  outline-offset: 2px;
  border-color: var(--hal-gold);
}
.hal-select-wrap { position: relative; }
.hal-select-wrap::after {
  content: "";
  position: absolute;
  right: 16px;
  top: calc(50% + 4px);
  width: 8px; height: 8px;
  border-right: 1px solid var(--hal-gold);
  border-bottom: 1px solid var(--hal-gold);
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
}

/* ---- ラジオ / チェックボックス ---- */
.hal-fieldset {
  border: 0;
  margin: 30px 0 0;
  padding: 0;
  min-width: 0;
}
.hal-radio-group {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
}
.hal-radio {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 12px 18px;
  border: 1px solid var(--hal-line-deep);
  background: #fdfcf8;
  font-size: 13.5px;
  line-height: 1.4; /* 旧版 ⑭ テキストの縦位置をmarkと揃える */
  color: var(--hal-body-deep);
  cursor: pointer;
}
.hal-radio input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  left: 0; top: 0;
  margin: 0;
  cursor: pointer;
}
.hal-radio__mark {
  flex: none;
  align-self: center; /* 旧版 ⑭ 複数行ラベル時も1行目基準ではなくmark自体を確実に中央固定 */
  width: 14px; height: 14px;
  border: 1px solid var(--hal-line-deep);
  border-radius: 50%;
  background: #fff;
  position: relative;
  margin-top: 0;
}
.hal-radio input:checked + .hal-radio__mark {
  border-color: var(--hal-gold-deep);
}
.hal-radio input:checked + .hal-radio__mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--hal-gold-deep);
}
.hal-radio:has(input:checked) {
  border-color: var(--hal-gold-deep);
  background: var(--hal-bg-box);
}
.hal-radio input:focus-visible ~ .hal-radio__mark {
  outline: 2px solid var(--hal-gold);
  outline-offset: 3px;
}

.hal-check {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--hal-body-deep);
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
}
.hal-check input {
  position: absolute;
  opacity: 0;
  width: 24px; height: 24px;
  margin: 0;
  cursor: pointer;
}
.hal-check__mark {
  flex: none;
  width: 18px; height: 18px;
  margin-top: 3px;
  border: 1px solid var(--hal-line-deep);
  background: #fff;
  position: relative;
}
.hal-check input:checked + .hal-check__mark {
  border-color: var(--hal-gold-deep);
  background: var(--hal-gold-deep);
}
.hal-check input:checked + .hal-check__mark::after {
  content: "";
  position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border-right: 1.5px solid #F7F3EA;
  border-bottom: 1.5px solid #F7F3EA;
  transform: rotate(42deg);
}
.hal-check input:focus-visible ~ .hal-check__mark {
  outline: 2px solid var(--hal-gold);
  outline-offset: 3px;
}
.hal-check a { color: var(--hal-gold-deep); text-decoration: none; border-bottom: 1px solid #c9bda3; }
.hal-check a[aria-disabled="true"] { border-bottom-style: dotted; cursor: default; }

/* ---- 連絡先ペア ---- */
.hal-contact-note {
  margin-top: 30px;
  padding: 14px 16px;
  border-left: 2px solid var(--hal-gold-line, #cbbd9f);
  background: var(--hal-bg-box);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--hal-body-deep);
}

/* ---- エラー（控えめ・色だけに依存しない） ---- */
.hal-error {
  display: none;
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 2px solid var(--hal-err-line);
  background: #f2ece4;
  font-size: 12px;
  line-height: 1.7;
  color: var(--hal-err);
}
.hal-error.is-visible { display: block; }
.hal-field.has-error .hal-input,
.hal-field.has-error .hal-select,
.hal-field.has-error .hal-textarea,
.hal-fieldset.has-error .hal-radio {
  border-color: var(--hal-err-line);
}
.hal-error-summary {
  display: none;
  margin: 32px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--hal-err-line);
  background: #f2ece4;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--hal-err);
}
.hal-error-summary.is-visible { display: block; }
.hal-error-summary ul { margin: 8px 0 0; padding-left: 1.2em; }

/* ---- Honeypot（視覚的に隠すが display:none にはしない） ---- */
.hal-hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ---- ボタン ---- */
.hal-form-actions { margin-top: 44px; text-align: center; }
.hal-form-actions .hal-btn {
  display: inline-block;
  border: 1px solid var(--hal-gold-deep);
  background: var(--hal-gold-deep);
  color: #F7F3EA;
  font-family: var(--hal-sans);
  font-size: 15px;
  letter-spacing: 0.1em;
  text-decoration: none;
  padding: 19px 40px;
  min-height: 44px;
  cursor: pointer;
  border-radius: 0;
  transition: background .2s ease, border-color .2s ease;
}
.hal-form-actions .hal-btn:hover { background: var(--hal-gold-hover); border-color: var(--hal-gold-hover); }
.hal-form-actions .hal-btn:focus-visible { outline: 2px solid var(--hal-gold); outline-offset: 3px; }
.hal-form-actions .hal-btn[disabled] { opacity: .55; cursor: default; }
.hal-btn--ghost {
  display: inline-block;
  border: 1px solid var(--hal-line-deep);
  background: transparent;
  color: var(--hal-body-deep);
  font-family: var(--hal-sans);
  font-size: 14px;
  letter-spacing: 0.08em;
  padding: 18px 32px;
  min-height: 44px;
  cursor: pointer;
  border-radius: 0;
  transition: border-color .2s ease, color .2s ease;
}
.hal-btn--ghost:hover { border-color: var(--hal-gold-deep); color: var(--hal-gold-deep); }
.hal-btn--ghost:focus-visible { outline: 2px solid var(--hal-gold); outline-offset: 3px; }
.hal-form-actions--pair {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  justify-content: center;
}

/* ---- 確認画面 ---- */
.hal-confirm-list {
  margin-top: 36px;
  border-top: 1px solid var(--hal-line-deep);
}
.hal-confirm-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 16px 0;
  border-bottom: 1px solid var(--hal-line-deep);
}
.hal-confirm-row dt {
  font-family: var(--hal-serif);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--hal-gold-deep);
}
.hal-confirm-row dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.85;
  color: var(--hal-sumi);
  white-space: pre-wrap;
  word-break: break-word;
}
@media (min-width: 640px) {
  .hal-confirm-row { grid-template-columns: 220px 1fr; gap: 0 24px; }
  .hal-confirm-row dt { padding-top: 2px; }
}

/* ---- 完了画面 ---- */
.hal-complete { text-align: center; }
.hal-complete__title {
  font-family: var(--hal-serif);
  font-weight: 500;
  font-size: clamp(22px, 2.2vw, 27px);
  line-height: 1.7;
  color: var(--hal-sumi);
  margin: 28px 0 0;
}
.hal-complete__text {
  font-size: 13.5px;
  line-height: 2;
  color: var(--hal-body);
  margin: 22px 0 0;
}
.hal-complete__line {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--hal-line-deep);
}
.hal-complete__line p {
  font-size: 13px;
  line-height: 1.95;
  color: var(--hal-body);
  margin: 0 0 20px;
}
.hal-preview-notice {
  margin: 0 0 28px;
  padding: 12px 16px;
  border: 1px dashed var(--hal-line-deep);
  background: var(--hal-bg-box);
  font-family: var(--hal-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.8;
  color: var(--hal-muted);
  text-align: left;
}

/* ---- 画面切替 ---- */
.hal-form-step[hidden] { display: none; }

@media (min-width: 1024px) {
  .hal-form-section { padding-block: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  .hal-form-section * { transition-duration: 0.01ms !important; }
}

/* ============================================================
   Mobile完成品質ブラッシュアップ（Owner指示・Mobile専用スコープのみ）
   iOS Safariはinput/select/textareaのfont-sizeが16px未満だと
   フォーカス時に自動ズームが発生し可読性・操作性を損なう。
   Desktop/Tablet（.hal-input等の基本15pxルールは無変更）には影響させず、
   max-width:767.98px内でのみ16pxへ引き上げる。
   ============================================================ */
@media (max-width: 767.98px) {
  .hal-input,
  .hal-select,
  .hal-textarea {
    font-size: 16px;
  }
}

/* ==========================================================================
   v1.0.52 §4 Mobile同意文の明示2行化（Human Owner承認・Mobile専用スコープ）
   --------------------------------------------------------------------------
   確定表示（max-width: 767.98px のみ）
     1行目：個人情報の取扱いとプライバシーポリシーを
     2行目：確認し、同意します。
   自然折返しには依存させない。DOMは .hal-check__copy > .hal-check__line × 2 とし、
   Tablet・PC では両spanをインラインへ戻して元の1文として表示する（下記 base 規則）。

   `.hal-field > label`（詳細度 0,1,1）が `.hal-check`（0,1,0）へ勝つため、
   同意欄のレイアウトは専用セレクタ
   `.hal-lp .hal-field[data-field="privacy_agree"] > label.hal-check`（0,4,1）で確定する。
   文言・リンク・チェック機能・必須判定・エラー表示は変更しない。
   フォーム全体の文字サイズ・左右余白は変更しない（本ブロックは同意欄のみを対象とする）。
   ========================================================================== */

/* base（全幅共通）：2spanはインライン。Tablet・PCは v1.0.51 と同一の1文表示になる。 */
.hal-check__copy { display: inline; }
.hal-check__line { display: inline; }

@media (max-width: 767.98px) {
  /* 同意欄だけを flex 化し、チェックマークと本文の横並びを確定させる。
     text-align は .hal-lp .hal-check の center を left へ戻し、2行の行頭を揃える。
     ブロック全体の中央配置は justify-content: center が担うため、
     v1.0.51 の「中央に置かれた同意欄」という見え方は維持される。 */
  .hal-lp .hal-field[data-field="privacy_agree"] > label.hal-check {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    text-align: left;
    font-size: clamp(11.2px, 3.5vw, 13px);
    letter-spacing: 0;
    line-height: 1.75;
  }
  /* チェックマークは flex アイテムとして 18×18px を維持する（縮小しない）。 */
  .hal-lp .hal-field[data-field="privacy_agree"] > label.hal-check .hal-check__mark {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 2px;
  }
  /* タップ領域：checkbox は <label class="hal-check"> に内包されるため、
     ラベル矩形全体（min-height:44px × フォーム幅）が実際の活性領域である。
     入力要素そのもの（24×24px・opacity:0・position:absolute）は v1.0.51 から変更しない。
     44×44px へ拡大すると不可視の入力矩形がプライバシーポリシーリンクへ重なり、
     リンクのクリック範囲を奪うことを実測で確認したため採用しない。 */
  /* 本文ブロック：2行を明示改行する。 */
  .hal-lp .hal-field[data-field="privacy_agree"] .hal-check__copy { display: block; }
  .hal-lp .hal-field[data-field="privacy_agree"] .hal-check__line { display: block; }
}

/* FormFix2: keep the consent mark a sized flex item at every viewport. */
.hal-lp .hal-field[data-field="privacy_agree"] > label.hal-check {
  display: flex;
}
.hal-lp .hal-field[data-field="privacy_agree"] > label.hal-check .hal-check__mark {
  display: block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
}
