/* =========================
   Contact
========================= */

.contact {
  position: relative;
  /* 見出しの上端をページ上端から230pxにする（ヘッダー下端108px + 122px） */
  padding-top: calc(var(--header-top) + var(--header-height) + 122px);
  padding-bottom: 200px;
}

/* 共通コンテナ（1100px + 左右padding 16px / SP 20px） */
.contact-inner {
  position: relative;
  width: 100%;
  max-width: calc(1100px + 32px);
  margin: 0 auto;
  padding: 0 16px;
}

.contact-title {
  margin: 0;
  font-family: var(--font-en);
  font-size: 80px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-text);
}

.contact-kana {
  margin: 8px 0 0;
}

.contact-lead {
  width: 619px;
  max-width: 100%;
  margin: 100px auto 0;
  font-size: 15px;
  line-height: 1.5;
}

/* 投稿の「お問い合わせはこちら」から来たときの対象の投稿(inc/contact-form.php)。フォームと同じ幅でフォームの上に置く */
.contact-ref {
  width: 900px;
  max-width: 100%;
  margin: 60px auto 0;
  padding: 24px 40px;
  border-left: 4px solid var(--color-pink);
  background: var(--color-grey);
}

.contact-ref-label {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.contact-ref-title {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.5;
}

.contact-ref + .wpcf7 .contact-form {
  margin-top: 20px;
}

/* フォーム: 900px / padding 40 / gap 40 */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: 900px;
  max-width: 100%;
  margin: 60px auto 0;
  padding: 40px;
  background: var(--color-grey);

  input,
  textarea,
  button {
    font: inherit;
    color: inherit;
  }

  fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }

  legend {
    padding: 0;
  }
}

.contact-form-item {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* fieldset 内の legend は flex の gap が効かないため余白で指定 */
fieldset.contact-form-item > legend {
  margin-bottom: 20px;
}

.contact-form-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.contact-form-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 5px;
  background: var(--color-pink);
  font-size: 14px;
  font-weight: 700;
  line-height: 17px;
  color: var(--color-white);
}

.contact-form-badge.is-optional {
  background: var(--color-grey-deep);
}

.contact-form-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--color-grey-deep);
  border-radius: 0;
  background: var(--color-white);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease;
}

.contact-form-input:focus {
  border-color: var(--color-pink);
}

.contact-form-textarea {
  height: 250px;
  padding: 16px;
  line-height: 1.5;
  resize: vertical;
}

/* Contact Form 7 の入力欄の包み(エラー文の置き場所)。入力欄を幅いっぱいにする */
.contact-form .wpcf7-form-control-wrap {
  display: block;
}

/* 選択肢(Contact Form 7 の radio / checkbox。use_label_element で <label> に包む) */
.contact-form .wpcf7-radio,
.contact-form .wpcf7-checkbox {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-form .wpcf7-list-item {
  margin: 0;

  label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
  }

  input {
    appearance: none;
    display: grid;
    place-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    background: var(--color-grey-deep);
    cursor: pointer;
  }

  input:focus-visible {
    outline: 2px solid var(--color-pink);
    outline-offset: 2px;
  }
}

/* ラジオ: 選択時にピンクの丸 */
.contact-form .wpcf7-radio input {
  border-radius: 50%;

  &::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-pink);
    transform: scale(0);
    transition: transform 0.15s ease;
  }

  &:checked::before {
    transform: scale(1);
  }
}

/* チェックボックス: 選択時にピンクのチェックマーク */
.contact-form .wpcf7-checkbox input {
  &::before {
    content: "";
    width: 12px;
    height: 7px;
    margin-top: -3px;
    border-left: 2.5px solid var(--color-pink);
    border-bottom: 2.5px solid var(--color-pink);
    transform: rotate(-45deg) scale(0);
    transition: transform 0.15s ease;
  }

  &:checked::before {
    transform: rotate(-45deg) scale(1);
  }
}

/* 入力エラー: 枠をピンクにし、項目の下にエラー文 */
.contact-form .wpcf7-not-valid {
  border-color: var(--color-pink);
}

.contact-form .wpcf7-not-valid-tip {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-pink);
}

/* 送信結果のメッセージ(送信ボタンの下) */
.wpcf7 form.contact-form .wpcf7-response-output {
  margin: 0;
  padding: 16px;
  font-size: 14px;
  line-height: 1.5;
  background: var(--color-white);
}

.contact-form-submit {
  display: flex;
  justify-content: center;
}

/* 送信ボタン: 400 × 64 / yellow / 文字左寄せ・矢印右 */
.contact-submit-btn {
  position: relative;
  width: 400px;
  max-width: 100%;
  height: 64px;
  padding: 0 32px;
  border: 0;
  border-radius: 50px;
  background: var(--color-yellow);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  transition: opacity 0.2s ease;

  &:hover {
    opacity: 0.8;
  }
}

.contact-submit-arrow {
  position: absolute;
  top: 50%;
  right: 32px;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  transform: translateY(-50%);

  &::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: 7px;
    height: 7px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: translateY(-50%) rotate(45deg);
  }
}

/* 確認画面(js/contact-confirm.js)。表示中は入力欄を隠す */
.contact-form,
.contact-ref {
  scroll-margin-top: calc(var(--header-top) + var(--header-height) + 20px);
}

.contact-form.is-confirm > :not(.contact-confirm) {
  display: none;
}

/* 入力チェックを通ったときの応答文は出さない(「戻る」で入力欄に戻ったときも) */
.wpcf7 form.contact-form.custom-wisa-checked > .wpcf7-response-output {
  display: none;
}

/* 送信の失敗・スパム判定のメッセージは確認画面でも出す */
.wpcf7 form.contact-form.is-confirm:is(.failed, .spam, .aborted) > .wpcf7-response-output {
  display: block;
}

.contact-confirm {
  display: flex;
  flex-direction: column;
  gap: 40px;
  outline: none;
}

.contact-confirm-lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.contact-confirm-list {
  margin: 0;
  border-bottom: 1px solid var(--color-grey-deep);
}

.contact-confirm-row {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 0;
  border-top: 1px solid var(--color-grey-deep);
  font-size: 15px;
  line-height: 1.5;
}

.contact-confirm-label {
  font-weight: 700;
}

.contact-confirm-value {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.contact-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.contact-submit-btn.is-back {
  padding-left: 64px;
  background: var(--color-white);
}

.contact-submit-btn.is-back .contact-submit-arrow {
  right: auto;
  left: 32px;
  transform: translateY(-50%) scaleX(-1);
}

@media (max-width: 960px) {
  .contact-title {
    font-size: 48px;
  }
}

/* SP: 左右余白 20px */
@media (max-width: 768px) {
  .contact {
    /* 見出しの上端をページ上端から160pxにする */
    padding-top: calc(var(--header-top) + var(--header-height) + 52px);
    padding-bottom: 100px;
  }

  .contact-inner {
    padding: 0 20px;
  }

  .contact-form {
    margin-top: 147px;
    padding: 40px 20px;
  }

  .contact-ref {
    margin-top: 147px;
    padding: 20px;
  }

  /* 確認ボタンはフォーム幅いっぱい・矢印なし */
  .contact-form-submit {
    margin: 0 -20px;
  }

  .contact-submit-btn {
    width: 100%;
  }

  .contact-submit-arrow {
    display: none;
  }

  .contact-confirm-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .contact-confirm-actions {
    flex-direction: column-reverse;
    margin: 0 -20px;
  }

  .contact-submit-btn.is-back {
    padding-left: 32px;
  }
}
