/* ================================================
   Contact Form — validation + send animation
   layout.css または contact-form.css に追記
   ================================================ */

/* ---- 入力欄の状態 ---- */
.contact-form input.input-error,
.cf-input.input-error {
  border-color: #c8102e;
  background: rgba(200, 16, 46, 0.02);
}
.contact-form input.input-valid,
.cf-input.input-valid {
  border-color: #1a7f4b;
  background: rgba(26, 127, 75, 0.02);
}

/* ---- エラーチップ ---- */
.field-error-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 0.5rem;
  padding: 0.3rem 0.75rem 0.3rem 0.55rem;
  background: rgba(200, 16, 46, 0.07);
  border: 0.5px solid rgba(200, 16, 46, 0.3);
  border-radius: 999px;
  font-size: 0.75rem;
  color: #a00d25;
  letter-spacing: 0.03em;
  line-height: 1.4;
  animation: chipIn 0.18s ease;
}
.field-error-chip::before {
  content: '!';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  min-width: 15px;
  background: #c8102e;
  color: #fff;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}
.field-error-chip[hidden] { display: none; }

@keyframes chipIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- ボタン disabled ---- */
.contact-btn:disabled {
  background: rgba(0, 0, 0, 0.13);
  color: rgba(0, 0, 0, 0.3);
  cursor: not-allowed;
  opacity: 1;
}
.contact-btn:disabled:hover { opacity: 1; }

/* ---- 送信エラーバナー ---- */
.cf-send-error-banner {
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  background: rgba(200, 16, 46, 0.06);
  border: 0.5px solid rgba(200, 16, 46, 0.3);
  border-left: 3px solid #c8102e;
  font-size: 0.82rem;
  color: #a00d25;
  line-height: 1.7;
}
.cf-send-error-banner[hidden] { display: none; }

/* ================================================
   送信中オーバーレイ
   ================================================ */
.cf-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 2rem;
}

.cf-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

/* ---- 封筒アニメーション ---- */
.cf-mail-anim {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.cf-envelope {
  position: relative;
  width: 64px;
  height: 48px;
  animation: envelopeFloat 1.6s ease-in-out infinite;
}

/* 封筒本体 */
.cf-envelope-body {
  position: absolute;
  inset: 0;
  background: #fff;
  border: 1.5px solid #c8102e;
}

/* 封筒フラップ（上部三角） */
.cf-envelope-flap {
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 26px;
  overflow: hidden;
  z-index: 2;
}
.cf-envelope-flap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  border-top: 26px solid #c8102e;
  border-left: 33px solid transparent;
  border-right: 33px solid transparent;
  animation: flapOpen 1.6s ease-in-out infinite;
  transform-origin: top center;
}

/* 封筒の中の手紙 */
.cf-envelope-letter {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 28px;
  background: #fff8f8;
  border: 1px solid rgba(200, 16, 46, 0.25);
  animation: letterRise 1.6s ease-in-out infinite;
  z-index: 1;
}
.cf-envelope-letter::before,
.cf-envelope-letter::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  height: 1px;
  background: rgba(200, 16, 46, 0.2);
}
.cf-envelope-letter::before { top: 6px; }
.cf-envelope-letter::after  { top: 12px; }

@keyframes envelopeFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
@keyframes flapOpen {
  0%, 30%   { transform: rotateX(0deg); }
  50%, 80%  { transform: rotateX(-160deg); }
  100%      { transform: rotateX(0deg); }
}
@keyframes letterRise {
  0%, 30%   { transform: translateY(0); }
  55%, 75%  { transform: translateY(-18px); }
  100%      { transform: translateY(0); }
}

/* ---- 送信中ドット ---- */
.cf-send-dots {
  display: flex;
  gap: 6px;
}
.cf-send-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c8102e;
  animation: dotBounce 1.2s ease-in-out infinite;
}
.cf-send-dots span:nth-child(2) { animation-delay: 0.2s; }
.cf-send-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* ---- 送信中テキスト ---- */
.cf-overlay-msg {
  font-size: 0.88rem;
  color: #666;
  letter-spacing: 0.06em;
  line-height: 1.7;
}

/* ================================================
   送信完了
   ================================================ */
.cf-overlay-success {
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* チェックマーク SVG */
.cf-checkmark svg { overflow: visible; }

.cf-check-circle {
  stroke: #1a7f4b;
  stroke-dasharray: 157;
  stroke-dashoffset: 157;
  animation: drawCircle 0.5s ease forwards;
}
.cf-check-tick {
  stroke: #1a7f4b;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: drawTick 0.35s ease 0.45s forwards;
}

@keyframes drawCircle {
  to { stroke-dashoffset: 0; }
}
@keyframes drawTick {
  to { stroke-dashoffset: 0; }
}

.cf-overlay-title {
  font-family: 'Noto Serif JP', serif;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 300;
  line-height: 1.6;
  color: #111;
}
.cf-overlay-sub {
  font-size: 0.82rem;
  color: #666;
  line-height: 1.9;
}

/* ================================================
   送信アニメーション・完了画面
   ================================================ */

.cf-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 2rem;
}

.cf-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

/* 送信中：細いラインが流れる */
.cf-progress-bar {
  width: 120px;
  height: 1px;
  background: rgba(200, 16, 46, 0.15);
  position: relative;
  overflow: hidden;
}

.cf-progress-bar::after {
  content: '';
  position: absolute;
  left: -40%;
  top: 0;
  width: 40%;
  height: 100%;
  background: #c8102e;
  animation: progressSweep 1.2s ease-in-out infinite;
}

@keyframes progressSweep {
  0%   { left: -40%; }
  100% { left: 140%; }
}

.cf-overlay-msg {
  font-size: 0.82rem;
  color: var(--muted-foreground);
  letter-spacing: 0.1em;
}

/* 完了 */
.cf-overlay-success {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cf-check-circle {
  stroke: #1a7f4b;
  stroke-dasharray: 157;
  stroke-dashoffset: 157;
  animation: drawCircle 0.45s ease forwards;
}

.cf-check-tick {
  stroke: #1a7f4b;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: drawTick 0.3s ease 0.4s forwards;
}

@keyframes drawCircle { to { stroke-dashoffset: 0; } }
@keyframes drawTick   { to { stroke-dashoffset: 0; } }

.cf-overlay-title {
  font-family: 'Noto Serif JP', serif;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 300;
  line-height: 1.6;
  color: var(--foreground);
}

.cf-overlay-sub {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  line-height: 1.9;
}

/* 送信エラーバナー */
.cf-send-error-banner {
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  background: rgba(200, 16, 46, 0.06);
  border: 0.5px solid rgba(200, 16, 46, 0.3);
  border-left: 3px solid #c8102e;
  border-radius: 0;
  font-size: 0.82rem;
  color: #a00d25;
  line-height: 1.7;
}

.cf-send-error-banner[hidden] { display: none; }
