/*
 * CALP-CONTACT-FORM-007 — contact.css
 *
 * Standalone stylesheet for site/contact/. Does not load styles.css or
 * diagnosis.css. Reuses the LP's approved color tokens / font / corner
 * radius language (same tokens as diagnosis.css) but does not reuse
 * Snap markup or diagnosis-question markup.
 */

:root {
  --paper: #fffaf3;
  --ink: #07111c;
  --orange: #ef3c0b;
  --orange-pale: #ffe3cf;
  color-scheme: light;
}

* { box-sizing: border-box; }

/* UA [hidden] must win over author display rules below (e.g. .contact-branch
   uses display:flex). Without this, [hidden] has no visible effect and
   hidden branches (generic message / chatgpt-ads / start / consult) would
   render simultaneously with the active one. */
[hidden] { display: none !important; }

/* JS-disabled fallback: keep only the <noscript> notice visible. */
.no-js .contact-app { display: none; }

/* Honeypot field (CALP-FORM-SEND-THANKS-008 §11-A): visually hidden but
   still reachable in the DOM for naive bots that fill every input. */
.hp-field {
  position: absolute;
  left: -9999px;
  height: 0;
  opacity: 0;
  overflow: hidden;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, a, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, p, fieldset, legend, ul, li { margin: 0; padding: 0; border: 0; }
ul { list-style: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.contact-noscript {
  padding: 24px;
  text-align: center;
}
.contact-noscript a {
  display: inline-block;
  margin-top: 12px;
  color: var(--orange);
  font-weight: 700;
  text-decoration: underline;
}

.contact-app {
  min-height: 100svh;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 20px max(40px, env(safe-area-inset-bottom));
}

/* ---------- Topbar ---------- */

.contact-topbar {
  display: flex;
  align-items: center;
  padding: 4px 0 18px;
}

.contact-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 10px 0 0;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
}
.contact-back::before {
  content: "‹";
  display: inline-block;
  margin-right: 2px;
  color: var(--orange);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}
.contact-back:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 8px;
}

.contact-title {
  margin-bottom: 20px;
  color: var(--ink);
  font-size: clamp(24px, 7vw, 28px);
  font-weight: 900;
  letter-spacing: -.02em;
}

/* ---------- Diagnosis handoff notice ---------- */

.contact-handoff {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1.5px solid var(--orange-pale);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(7,17,28,.05);
}
.contact-handoff__label {
  margin-bottom: 6px;
  color: #5a5049;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.contact-handoff__row {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
}
.contact-handoff__row + .contact-handoff__row {
  margin-top: 2px;
}
.contact-handoff__row strong {
  color: var(--orange);
  font-weight: 900;
}

/* ---------- Notices (error summary / submit notice) ---------- */

.contact-notice {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
}
.contact-notice:focus-visible,
.contact-notice:focus {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.contact-notice--error {
  border: 1.5px solid var(--orange);
  color: var(--orange);
  background: var(--orange-pale);
}
.contact-notice--error ul {
  margin-top: 8px;
}
.contact-notice--error li + li {
  margin-top: 4px;
}
.contact-notice--error a {
  color: var(--orange);
  text-decoration: underline;
}

.contact-notice--status {
  border: 1.5px solid rgba(7,17,28,.14);
  color: var(--ink);
  background: #fff;
}

/* ---------- Form layout ---------- */

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

.contact-field {
  display: flex;
  flex-direction: column;
}

.contact-field label,
.contact-field legend {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.contact-field .contact-optional {
  margin-left: 6px;
  color: #8a7f76;
  font-size: 12px;
  font-weight: 500;
}

.contact-field input[type="text"],
.contact-field input[type="email"],
.contact-field select,
.contact-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid rgba(7,17,28,.16);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.4;
}

.contact-field textarea {
  min-height: 96px;
  resize: vertical;
}

.contact-field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% - 3px), calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.contact-field input:focus-visible,
.contact-field select:focus-visible,
.contact-field textarea:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  border-color: var(--ink);
}

.contact-field[aria-invalid="true"] input,
.contact-field input[aria-invalid="true"],
.contact-field select[aria-invalid="true"],
.contact-field textarea[aria-invalid="true"] {
  border-color: var(--orange);
}

.contact-field__error {
  margin-top: 6px;
  color: var(--orange);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- ChatGPT ads intent cards (same visual language as diagnosis cards) ---------- */

.contact-fieldset {
  padding: 16px;
  border: 1.5px solid rgba(7,17,28,.12);
  border-radius: 16px;
  background: #fffdf9;
}
.contact-fieldset legend {
  margin-bottom: 12px;
}

.contact-intent-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.contact-intent-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 12px;
  border: 1.5px solid rgba(7,17,28,.12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 14px rgba(7,17,28,.05);
  text-align: center;
  cursor: pointer;
}
.contact-intent-card input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.contact-intent-card span {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}
.contact-intent-card.is-selected,
.contact-intent-card:has(input:checked) {
  border-color: var(--orange);
  background: var(--orange-pale);
  box-shadow: 0 6px 14px rgba(239,60,11,.16);
}
.contact-intent-card.is-selected span,
.contact-intent-card:has(input:checked) span {
  color: var(--orange);
}
.contact-intent-card:has(input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- consult_topic 4-choice radio row ---------- */

.contact-topic-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.contact-topic-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px;
  border: 1.5px solid rgba(7,17,28,.12);
  border-radius: 12px;
  background: #fff;
  text-align: center;
  cursor: pointer;
}
.contact-topic-card input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.contact-topic-card span {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
.contact-topic-card.is-selected,
.contact-topic-card:has(input:checked) {
  border-color: var(--orange);
  background: var(--orange-pale);
}
.contact-topic-card.is-selected span,
.contact-topic-card:has(input:checked) span {
  color: var(--orange);
}
.contact-topic-card:has(input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- Branch containers ---------- */

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

/* ---------- Submit ---------- */

.contact-submit-row {
  margin-top: 4px;
}

.contact-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(98deg, #ef2307, #f75418);
  box-shadow: 0 10px 20px rgba(239,60,11,.2);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}
.contact-submit:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  .contact-intent-card,
  .contact-topic-card {
    transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
  }
}
