/*
 * Contact Form Styles - /contact/ page
 * Phase 7.1.3 - RCT Brand Design System
 *
 * Tokens consumed from common.css :root
 * Mobile-first; no Tailwind; no emoji (SVG icons rendered by Hugo partials).
 */

/* ---------- Page wrapper ---------- */
.cf-page {
  padding: 2rem var(--container-padding) calc(3rem + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
  font-family: var(--font-primary);
  color: var(--color-black);
}

/* common.css の `section { padding: var(--spacing-xxl) 0 }` (6rem) を contact ページ内では無効化。
   Hero / form-wrap / success の section が二重に巨大な余白を持つのを防ぐ。 */
.cf-page > section,
.cf-hero,
.cf-form-wrap,
.cf-success {
  padding: 0;
}

/* ---------- Hero ---------- */
.cf-hero {
  text-align: center;
  margin-bottom: 1.75rem;
}

.cf-title {
  font-family: var(--font-primary);
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.005em;
  color: var(--color-black);
  margin-bottom: 0.75rem;
}

.cf-subtitle {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: rgba(18, 12, 15, 0.72);
  margin: 0 auto 1.25rem;
  max-width: 36rem;
}

.cf-reply-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-gold-light);
  color: #7A5A1F;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid rgba(0, 0, 0, 0.10);
}

.cf-reply-badge .cf-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  flex-shrink: 0;
}

/* ---------- Form wrapper ---------- */
.cf-form-wrap {
  background: transparent;
}

.cf-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ---------- Visually-hidden utility (sr-only) ---------- */
.cf-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Status (sr-only live region) ---------- */
.cf-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Error summary (top alert) ---------- */
.cf-error-summary {
  background: rgba(185, 28, 28, 0.06);
  border: 1px solid rgba(185, 28, 28, 0.25);
  border-radius: 10px;
  padding: 14px 16px;
  color: #7F1D1D;
  font-size: 0.9375rem;
  line-height: 1.55;
}

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

.cf-error-summary ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 6px 0 0;
}

.cf-error-summary li {
  margin: 4px 0;
}

/* ---------- Field block ---------- */
.cf-field {
  display: flex;
  flex-direction: column;
  position: relative;
}

.cf-field[hidden] { display: none; }

.cf-label {
  display: inline-flex;
  align-items: center;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-black);
  margin-bottom: 10px;
  letter-spacing: 0.005em;
}

.cf-required-mark {
  color: var(--color-primary);
  margin-left: 4px;
  font-weight: 700;
}

.cf-field--invalid .cf-label {
  color: #B91C1C;
}

/* ---------- Inputs / Textarea ---------- */
.cf-input,
.cf-textarea {
  width: 100%;
  padding: 14px 16px;
  min-height: 56px;
  border: 1px solid rgba(18, 12, 15, 0.16);
  border-radius: 10px;
  background: #ffffff;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-black);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.cf-textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.6;
}

.cf-textarea--auto {
  overflow: hidden;
  resize: none;
}

.cf-input::placeholder,
.cf-textarea::placeholder {
  color: rgba(18, 12, 15, 0.4);
}

.cf-input:hover,
.cf-textarea:hover {
  border-color: rgba(18, 12, 15, 0.32);
}

.cf-input:focus,
.cf-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(191, 26, 32, 0.15);
  outline: none;
}

.cf-field--invalid .cf-input,
.cf-field--invalid .cf-textarea {
  border-color: #B91C1C;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}

.cf-input:disabled,
.cf-textarea:disabled {
  background: rgba(18, 12, 15, 0.04);
  color: rgba(18, 12, 15, 0.5);
  cursor: not-allowed;
}

/* ---------- Helper / Error text ---------- */
.cf-helper {
  color: rgba(18, 12, 15, 0.6);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-top: 6px;
}

.cf-error {
  color: #B91C1C;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-top: 6px;
  display: flex;
  gap: 6px;
  align-items: center;
}

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

.cf-error .cf-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  flex-shrink: 0;
}

/* ---------- Email typo suggestion ---------- */
.cf-typo-suggest {
  background: rgba(240, 204, 126, 0.18);
  border-left: 3px solid var(--color-gold);
  padding: 12px 14px;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  font-size: 0.9375rem;
  color: #7A5A1F;
}

.cf-typo-suggest[hidden] { display: none; }

.cf-typo-text {
  flex: 1 1 auto;
  line-height: 1.5;
}

.cf-typo-text strong {
  color: var(--color-primary);
  font-weight: 600;
}

.cf-typo-apply {
  background: transparent;
  border: 0;
  color: var(--color-primary);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 4px;
  cursor: pointer;
  min-height: 44px;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

.cf-typo-apply:hover { opacity: 0.78; }

.cf-typo-ignore {
  background: transparent;
  border: 0;
  color: rgba(122, 90, 31, 0.7);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.cf-typo-ignore:hover {
  background: rgba(122, 90, 31, 0.12);
  color: #7A5A1F;
}

.cf-typo-ignore:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ---------- Counter (textarea) ---------- */
.cf-counter {
  text-align: right;
  color: rgba(18, 12, 15, 0.5);
  font-size: 0.8125rem;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

/* Hide the counter while the textarea is empty — the helper alone communicates
   the 5-2000 range. The counter fades in once the user starts typing. */
.cf-counter[data-empty="true"] {
  opacity: 0;
  pointer-events: none;
}

.cf-counter[data-state="warn"] {
  color: #B45309;
}

.cf-counter[data-state="danger"] {
  color: #B91C1C;
  font-weight: 600;
}

.cf-counter--near {
  color: #92400E;
}

.cf-counter--over {
  color: #B91C1C;
  font-weight: 600;
}

.cf-meta-row {
  /* layout container; styling delegated to children */
}

/* ---------- Combobox (suggest panel) ---------- */
.cf-combobox-wrap {
  position: relative;
}

.cf-combobox-input[aria-expanded="true"] {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* Chrome URL bar style ghost text — the auto-suggested suffix is rendered
   as a real selection in the input, so the OS / browser highlights it. We
   tint it with the warm cream brand color so it reads as a hint, not a
   hard selection. */
.cf-combobox-input::selection {
  background-color: rgba(240, 204, 126, 0.45);
  color: var(--color-black);
}
.cf-combobox-input::-moz-selection {
  background-color: rgba(240, 204, 126, 0.45);
  color: var(--color-black);
}

.cf-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--color-primary);
  border-top: none;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  box-shadow: 0 12px 24px rgba(18, 12, 15, 0.10);
  z-index: 10;
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.9375rem;
}

.cf-suggest[hidden] { display: none; }

.cf-suggest-item {
  padding: 10px 16px;
  cursor: pointer;
  /* Non-matched text is faded; the <mark> portion overrides to full black. */
  color: rgba(18, 12, 15, 0.5);
  line-height: 1.4;
  /* block レイアウト + 通常 inline で <mark> と前後テキストが隙間なく繋がる */
  display: block;
  transition: background-color var(--transition-fast);
}

.cf-suggest-item:hover,
.cf-suggest-item--active {
  background-color: rgba(248, 241, 223, 0.7);
  color: rgba(191, 26, 32, 0.6);
}

.cf-suggest-item mark {
  background: transparent;
  color: var(--color-black);
  font-weight: 600;
  text-decoration: none;
  padding: 0;
}

.cf-suggest-item:hover mark,
.cf-suggest-item--active mark {
  color: var(--color-primary);
}

/* ---------- Toggle (already-booked checkbox) + conditional reveal ---------- */
.cf-field--toggle {
  /* visually align with other fields; the conditional area appears below */
}

.cf-toggle-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid rgba(18, 12, 15, 0.12);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  user-select: none;
}

.cf-toggle-line:hover {
  border-color: rgba(191, 26, 32, 0.35);
}

.cf-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  margin: 0;
}

.cf-toggle-box {
  width: 20px;
  height: 20px;
  border: 1.5px solid rgba(18, 12, 15, 0.3);
  border-radius: 4px;
  background: #fff;
  flex-shrink: 0;
  position: relative;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.cf-toggle-input:checked + .cf-toggle-box {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.cf-toggle-input:checked + .cf-toggle-box::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.cf-toggle-input:focus-visible + .cf-toggle-box {
  box-shadow: 0 0 0 3px rgba(191, 26, 32, 0.18);
}

.cf-toggle-text {
  color: var(--color-black);
  font-size: 0.9375rem;
  line-height: 1.4;
}

.cf-conditional {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  transition:
    max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease 0.05s,
    margin-top 0.3s ease;
}

.cf-conditional[data-state="open"] {
  /* enough for label (sr-only) + 56px input + error */
  max-height: 180px;
  opacity: 1;
  margin-top: 0.625rem;
}

@media (prefers-reduced-motion: reduce) {
  .cf-conditional {
    transition: none;
  }
}

/* ---------- Honeypot (visually + a11y hidden) ---------- */
.cf-honeypot {
  position: absolute !important;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Turnstile wrapper ----------
   Invisible mode: Turnstile renders nothing in the DOM until the challenge
   actually fires (it only briefly shows an iframe overlay). We therefore keep
   the wrapper at zero height by default — the form's `gap` already provides
   the breathing room. If we ever switch back to Managed/visible mode, restore
   `min-height: 65px` here. */
.cf-turnstile-wrap {
  display: flex;
  justify-content: center;
  margin: 0;
  min-height: 0;
}

.cf-turnstile {
  max-width: 100%;
}

/* ---------- Submit button ---------- */
.cf-submit {
  width: 100%;
  min-height: 56px;
  background: var(--color-primary);
  color: #ffffff;
  border: 0;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 14px rgba(191, 26, 32, 0.18);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background-color var(--transition-fast), opacity var(--transition-fast);
  margin-top: 0.25rem;
}

.cf-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(191, 26, 32, 0.24);
}

.cf-submit:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(191, 26, 32, 0.2);
}

.cf-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(191, 26, 32, 0.25), 0 6px 14px rgba(191, 26, 32, 0.18);
}

.cf-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 10px rgba(191, 26, 32, 0.12);
}

.cf-submit-label[hidden] { display: none; }

/* ---------- Spinner ---------- */
.cf-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  display: inline-block;
  animation: cf-spin 0.7s linear infinite;
}

.cf-spinner[hidden] { display: none; }

.cf-submit[data-state="loading"] .cf-spinner { display: inline-block; }
/* Keep the label visible (it has been swapped to "Sending…") so users
   get a clear text cue, plus the spinner sits next to it. */

@keyframes cf-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Inline submit error (mobile-visible, sits under .cf-submit) ---------- */
.cf-submit-error {
  margin-top: 0.75rem;
  padding: 12px 14px;
  background: rgba(185, 28, 28, 0.06);
  border: 1px solid rgba(185, 28, 28, 0.25);
  border-radius: 10px;
  color: #7F1D1D;
  font-size: 0.9375rem;
  line-height: 1.45;
  text-align: center;
}

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

/* ---------- Fallback (shown only on network error) ---------- */
.cf-fallback {
  text-align: center;
  color: rgba(18, 12, 15, 0.6);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-top: 1.5rem;
}

.cf-fallback[hidden] { display: none; }

.cf-fallback a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

/* ---------- Success card ---------- */
.cf-success {
  margin-top: var(--spacing-md);
}

.cf-success[hidden] { display: none; }

.cf-success-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: 0 10px 30px rgba(18, 12, 15, 0.08);
  border: 1px solid rgba(240, 204, 126, 0.4);
  text-align: center;
}

.cf-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #ffffff;
  margin-bottom: 1.25rem;
  animation: cf-check-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.cf-success-icon svg,
.cf-success-icon .cf-icon {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

@keyframes cf-check-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.cf-success-title {
  font-family: var(--font-primary);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-black);
  margin: 0 0 0.75rem;
}

.cf-success-message {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: rgba(18, 12, 15, 0.78);
  margin: 0 auto 0.5rem;
  max-width: 32rem;
}

/* ---------- Confirmation notice (email check) ---------- */
.cf-confirmation-notice {
  background: rgba(248, 241, 223, 0.7);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 1.5rem 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  border: 1px solid rgba(240, 204, 126, 0.35);
}

.cf-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--color-primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.cf-info-icon svg,
.cf-info-icon .cf-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.cf-confirmation-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-black);
  margin: 0;
  flex: 1 1 auto;
}

.cf-confirmation-text strong {
  font-weight: 600;
  color: var(--color-primary);
  word-break: break-all;
}

.cf-resubmit-link {
  background: transparent;
  border: 0;
  color: var(--color-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px 0 0;
  cursor: pointer;
  display: inline-block;
  transition: opacity var(--transition-fast);
}

.cf-resubmit-link:hover { opacity: 0.78; }

.cf-resubmit-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.cf-bookmark-tip {
  font-size: 0.875rem;
  line-height: 1.55;
  color: rgba(18, 12, 15, 0.6);
  margin: 1rem auto 0;
  max-width: 30rem;
}

/* ---------- CTA row (Instagram / FAQ / Email) ---------- */
.cf-cta-row {
  display: flex;
  gap: 12px;
  margin-top: 1.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.cf-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid var(--color-primary);
  border-radius: 10px;
  background: #ffffff;
  color: var(--color-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  min-height: 44px;
  transition: background-color var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
}

.cf-cta:hover {
  background: var(--color-primary);
  color: #ffffff;
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(191, 26, 32, 0.18);
}

.cf-cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(191, 26, 32, 0.2);
}

.cf-cta-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.cf-cta-icon svg,
.cf-cta-icon .cf-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

/* ---------- Generic icon class ---------- */
.cf-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  flex-shrink: 0;
  vertical-align: middle;
}

.rct-icon {
  display: inline-block;
  vertical-align: middle;
}

/* ---------- Responsive: small phones ---------- */
@media (max-width: 480px) {
  .cf-page {
    padding: 1.25rem 1rem calc(2rem + env(safe-area-inset-bottom));
  }

  .cf-hero {
    margin-bottom: 1.25rem;
  }

  .cf-title {
    font-size: 1.875rem;
  }

  .cf-subtitle {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  .cf-suggest {
    max-height: 50vh;
    font-size: 1rem;
  }

  .cf-success-card {
    padding: 2rem 1.25rem;
  }

  .cf-success-title {
    font-size: 1.5rem;
  }

  .cf-cta {
    width: 100%;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .cf-input,
  .cf-textarea,
  .cf-submit,
  .cf-cta,
  .cf-typo-apply,
  .cf-typo-ignore,
  .cf-resubmit-link,
  .cf-counter,
  .cf-suggest-item {
    transition: none !important;
  }

  .cf-success-icon {
    animation: none !important;
  }

  .cf-spinner {
    animation-duration: 1.6s;
  }

  .cf-submit:hover,
  .cf-cta:hover {
    transform: none;
  }
}
