/* =========================================================
   応募フォーム (apply.html) のスタイル
   採用ページと同じ配色。送信は /api/apply（api/src/functions/apply.js）。
   管理画面のプレビューも希望職種の見た目に使うので、
   ページ内 <style> ではなく別ファイルにしている。セレクタは .ap-* に限る。
   ========================================================= */
/* 採用ページと同じく、共通スクリプトが追加する買取価格タブは出さない。 */
.apply-page .price-side-tab { display: none; }

.ap-page {
  --ap-blue:  #1379c2;
  --ap-error: #c62828;
  --ap-ease:  cubic-bezier(0.22, 0.61, 0.36, 1);
}
.ap-inner { max-width: 1280px; margin: 0 auto; padding-inline: var(--pad-x); }
.ap-inner--form { max-width: 1040px; }
.ap-page a:focus-visible,
.ap-page button:focus-visible { outline: 3px solid var(--ap-blue); outline-offset: 4px; }
/* 和文を句の途中で改行させない */
.ap-ib { display: inline-block; }
/* エラー時のフォーカス移動で、固定ヘッダーの下に隠れないようにする */
.ap-page :is(input, select, textarea, [tabindex]) { scroll-margin-top: 120px; }

/* ---- パンくず・見出し ---- */
.ap-breadcrumb { padding-block: 22px; color: var(--muted); font-size: 12px; }
.ap-breadcrumb ol { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.ap-breadcrumb li + li::before { content: "/"; margin-right: 14px; color: var(--muted); }
.ap-breadcrumb a:hover { color: var(--accent); text-decoration: underline; }

.ap-hero { padding-block: clamp(44px, 6vw, 88px); background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.ap-hero__label { font-family: var(--font-display); font-size: clamp(16px, 2vw, 24px); letter-spacing: .06em; color: var(--ap-blue); margin-bottom: 14px; }
.ap-hero h1 { color: var(--accent); font-family: var(--font-display); font-size: clamp(30px, 4.7vw, 62px); font-weight: 900; line-height: 1.35; letter-spacing: .02em; }
.ap-hero__lead { max-width: 780px; margin-top: 22px; color: var(--text); font-size: clamp(14px, 1.15vw, 17px); line-height: 2.1; }

/* ---- フォーム本体 ---- */
.ap-body { padding-block: clamp(48px, 7vw, 110px); }
.ap-required-note { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 13px; }

.ap-badge {
  display: inline-block;
  flex-shrink: 0;
  padding: 3px 8px 2px;
  border-radius: 2px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: .06em;
}
.ap-badge--opt { background: #e3e8f2; color: var(--muted); }

.ap-alert {
  margin-bottom: 28px;
  padding: 16px 20px;
  border-left: 4px solid var(--ap-error);
  background: #fdf1f1;
  color: #8e1c1c;
  font-size: 14px;
  line-height: 1.9;
}
.ap-alert a { text-decoration: underline; }

.ap-form { border-bottom: 1px solid var(--line); }
.ap-field {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px 40px;
  padding: 30px 0;
  border: 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}
/* fieldset の legend はグリッドに乗らないため、ラベル列の幅をそろえて左に置く */
fieldset.ap-field { display: block; position: relative; padding-left: 300px; }
fieldset.ap-field > legend { float: left; width: 260px; margin-left: -300px; padding: 0; }
fieldset.ap-field::after { content: ""; display: table; clear: both; }

.ap-label {
  display: flex;
  flex-wrap: wrap;
  align-self: start;
  align-items: center;
  gap: 8px 10px;
  padding-top: 12px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
}
.ap-control { min-width: 0; }

.ap-input,
.ap-select,
.ap-textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid #c9d2e3;
  border-radius: 3px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* iOS の自動ズームを防ぐ */
  line-height: 1.6;
  transition: border-color .2s var(--ap-ease), box-shadow .2s var(--ap-ease);
}
.ap-input::placeholder,
.ap-textarea::placeholder { color: #9aa8b8; }
.ap-input:focus,
.ap-select:focus,
.ap-textarea:focus { outline: none; border-color: var(--ap-blue); box-shadow: 0 0 0 3px rgba(19,121,194,.18); }
.ap-textarea { min-height: 160px; resize: vertical; }
.ap-input--tel { max-width: 320px; }

.ap-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23093e92' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
  cursor: pointer;
}
.ap-birth { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 8px; }
.ap-birth__unit { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; }
.ap-birth .ap-select { width: auto; }
.ap-birth__y .ap-select { min-width: 200px; }
.ap-birth__md .ap-select { min-width: 86px; }

.ap-help { margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.ap-err { margin-top: 10px; color: var(--ap-error); font-size: 13px; font-weight: 700; line-height: 1.7; }
.ap-err::before { content: "！"; }
.ap-field.is-invalid .ap-input,
.ap-field.is-invalid .ap-select,
.ap-field.is-invalid .ap-textarea { border-color: var(--ap-error); }
.ap-field.is-invalid .ap-choice { border-color: var(--ap-error); }

/* ---- 希望職種（ラジオ） ---- */
.ap-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ap-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #c9d2e3;
  border-radius: 3px;
  background: #fff;
  font-size: 15px;
  line-height: 1.6;
  cursor: pointer;
  transition: border-color .2s var(--ap-ease), background-color .2s var(--ap-ease);
}
.ap-choice:hover { border-color: var(--ap-blue); }
.ap-choice input { width: 18px; height: 18px; flex-shrink: 0; margin: 0; accent-color: var(--accent); }
.ap-choice:has(input:checked) { border-color: var(--accent); background: var(--bg-soft); color: var(--accent); font-weight: 700; }
.ap-choice:has(input:focus-visible) { outline: 3px solid var(--ap-blue); outline-offset: 2px; }

/* ---- 個人情報の取り扱い・同意 ---- */
.ap-privacy {
  margin-top: 8px;
  padding: 24px 28px;
  background: var(--bg-soft);
  font-size: 14px;
  line-height: 1.9;
}
.ap-privacy__ttl { color: var(--accent); font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.ap-privacy ul { display: grid; gap: 6px; margin-bottom: 10px; }
.ap-privacy li { position: relative; padding-left: 1.1em; }
.ap-privacy li::before { content: ""; position: absolute; left: 0; top: .8em; width: 6px; height: 6px; background: var(--ap-blue); }
.ap-privacy a { color: var(--accent); text-decoration: underline; white-space: nowrap; }

.ap-consent-wrap { padding: 28px 0 0; text-align: center; }
.ap-consent {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.ap-consent input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }
.ap-consent-wrap.is-invalid .ap-consent { color: var(--ap-error); }

/* ---- 送信 ---- */
.ap-actions { display: grid; justify-items: center; gap: 16px; padding: 28px 0 0; }
.ap-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: min(100%, 360px);
  padding: 20px 40px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .08em;
  cursor: pointer;
  transition: background .3s var(--ap-ease), border-color .3s var(--ap-ease);
}
.ap-submit svg { width: 14px; height: 14px; transition: transform .3s var(--ap-ease); }
.ap-submit:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.ap-submit:hover svg { transform: translateX(4px); }
.ap-submit[disabled] { opacity: .6; cursor: progress; }
.ap-actions__note { color: var(--muted); font-size: 13px; line-height: 1.8; text-align: center; }

/* ---- 送信完了 ---- */
.ap-done { padding: clamp(40px, 6vw, 80px) clamp(24px, 5vw, 64px); background: var(--bg-soft); text-align: center; }
.ap-done:focus { outline: none; }
.ap-done__label { font-family: var(--font-display); color: var(--ap-blue); font-size: clamp(16px, 2vw, 22px); letter-spacing: .06em; margin-bottom: 12px; }
.ap-done h2 { color: var(--accent); font-family: var(--font-display); font-size: clamp(24px, 3vw, 38px); font-weight: 900; line-height: 1.5; margin-bottom: 20px; }
.ap-done p { font-size: 15px; line-height: 2; }
.ap-done p a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.ap-done__back {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  padding: 16px 30px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .06em;
  transition: background .3s var(--ap-ease), color .3s var(--ap-ease);
}
.ap-done__back:hover { background: var(--accent); color: #fff; }

/* ボット対策の入力欄（人には見えない） */
.ap-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 860px) {
  .ap-field { grid-template-columns: 1fr; gap: 10px; padding: 24px 0; }
  fieldset.ap-field { padding-left: 0; }
  /* float のままにして、legend が上罫線に重なる既定の描画を避ける */
  fieldset.ap-field > legend { width: 100%; margin: 0 0 10px; }
  fieldset.ap-field > .ap-control { clear: both; }
  .ap-label { padding-top: 0; }
  .ap-choices { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .ap-privacy { padding: 20px; }
  .ap-input--tel { max-width: none; }
  .ap-birth__y .ap-select { min-width: 0; width: 100%; }
  .ap-birth__y { flex: 1 1 100%; }
  .ap-birth__y .ap-select + span { flex-shrink: 0; }
  .ap-consent { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-page * { transition: none !important; }
}
