/* WCAG 2.2 1.4.3 contrast on white:
 * navy 16.59:1 / text-secondary 9.03:1 / muted 4.83:1
 * gold is used as a filled CTA with navy text for 8.84:1 contrast.
 */

:root {
  --font-public: "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  --navy: #0e1e3a;
  --navy-2: #1a2332;
  --text-secondary: #3d4a5a;
  --text-muted: #6b7280;
  --bg-tint: #f6f8fb;
  --public-border: #d8dee8;
  --success: #00876a;
  --success-text: #006b4f;
  --gold: #f5b04a;
  --gold-strong: #f2a52f;
  --gold-soft: #fff7e6;
  --gold-border: #f1d59b;
  --focus: #005bd3;
  --danger: #b42318;
}

/* サポートページ。語彙は LP（app/routes/_index/）から借りる。
 * 角丸は 4px 単一、面の区切りは 1px の罫線だけ。 */

.support-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px 96px;
  line-height: 1.8;
  color: var(--navy);
}

.support-page h1 {
  margin: 0;
  font-size: 40px;
  font-weight: 300;
  letter-spacing: -0.024em;
  line-height: 1.3;
  word-break: keep-all;
}

.support-lead {
  margin: 16px 0 0;
  color: var(--text-secondary);
  font-size: 16px;
}

.support-section {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--public-border);
}

/* 直前の差し色面が border-bottom と下余白を持つので、最初の節は罫線も上余白も重ねない */
.public-site-tint-surface + .support-section {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.support-section > h2 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.support-section > p {
  margin: 0;
  color: var(--text-secondary);
}

/* FAQ は枠を作らず行の罫線だけで割る。開閉は右端の ＋ / − で示す。 */
.support-faq-list {
  margin-top: 20px;
}

.support-faq-item {
  border-top: 1px solid var(--public-border);
}

.support-faq-item:last-child {
  border-bottom: 1px solid var(--public-border);
}

.support-faq-item > summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  word-break: keep-all;
}

.support-faq-item > summary::-webkit-details-marker {
  display: none;
}

.support-faq-item > summary::after {
  content: "＋";
  color: var(--text-muted);
  font-weight: 500;
}

.support-faq-item[open] > summary::after {
  content: "−";
}

.support-faq-answer {
  margin: 0 0 20px;
  color: var(--text-secondary);
  font-size: 15px;
}

.support-note {
  margin-top: 20px;
  padding: 20px;
  border-radius: 4px;
  background: var(--bg-tint);
  font-size: 14px;
  color: var(--text-secondary);
}

.support-note > p {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--navy);
}

.support-note > ul {
  margin: 0;
  padding-left: 20px;
}

.support-form {
  display: grid;
  gap: 24px;
  margin-top: 28px;
}

.support-field {
  display: grid;
  gap: 8px;
}

.support-field > label {
  font-size: 14px;
  font-weight: 700;
}

.support-required {
  color: var(--danger);
}

.support-input,
.support-select,
.support-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  /* 白地に 3.37:1。WCAG 2.2 1.4.11 は form border に 3:1 を要求する */
  border: 1px solid #828d9c;
  border-radius: 4px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-size: 16px;
}

.support-textarea {
  min-height: 160px;
  /* 入力量に応じて伸びるので、長文を貼られても画面を覆わない高さで止める。 */
  max-height: 60vh;
  overflow-y: auto;
  resize: vertical;
}

.support-hint,
.support-counter {
  font-size: 13px;
  color: var(--text-muted);
}

.support-counter-critical {
  font-size: 13px;
  color: var(--danger);
}

.support-error {
  font-size: 13px;
  color: var(--danger);
}

/* エラー要約は読み飛ばされると入力を直せないので、左の太い罫で位置を示す。 */
.support-error-summary {
  padding: 16px 20px;
  border-left: 3px solid var(--danger);
  background: #fff5f5;
}

.support-error-summary > p {
  margin: 0 0 6px;
  font-weight: 700;
}

.support-error-summary ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.support-error-summary a,
.support-error-summary span {
  color: var(--danger);
}

.support-submit {
  justify-self: start;
  min-height: 48px;
  padding: 0 26px;
  border: none;
  border-radius: 4px;
  background: var(--gold);
  color: var(--navy);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.support-submit:hover:not(:disabled) {
  background: var(--gold-strong);
}

.support-submit:disabled {
  background: var(--gold-border);
  cursor: not-allowed;
}

.support-success {
  margin-top: 28px;
  padding: 20px;
  border-radius: 4px;
  background: #eef6f2;
  color: var(--navy);
  font-size: 15px;
}

.support-mail-link {
  color: var(--success-text);
}

.support-page a:focus-visible,
.support-input:focus-visible,
.support-select:focus-visible,
.support-textarea:focus-visible,
.support-submit:focus-visible,
.support-faq-item > summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .support-page {
    padding: 0 20px 64px;
  }

  .support-page h1 {
    font-size: 27px;
  }
}

/* 質問する画面。面を 1 枚にして、ログと入力欄を上下に並べる。 */
.support-chat-panel {
  display: grid;
  gap: 0;
  margin-top: 20px;
  padding: 0;
  /* 直前の差し色面と地続きに見えないよう、罫線より一段濃い枠で面を閉じる。 */
  border: 1px solid #b9c3d2;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

/* 会話が伸びてもページごと下に流れないよう、ログ側だけを送る。 */
.support-chat-log {
  min-height: 300px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 28px 20px;
}

.support-chat-log-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  /* 会話が無いあいだは空状態を中央に置き、下の空洞を作らない。 */
  justify-content: center;
  min-height: 100%;
}

/* 回答内の小見出し。節の区切りだと分かれば十分なので、本文より少しだけ強める。 */
.qa-answer-text h4 {
  margin: 16px 0 8px;
  font-size: 15px;
  font-weight: 700;
}

.qa-answer-text ol {
  margin: 0 0 12px;
  padding-left: 20px;
}

.support-chat-empty {
  align-self: center;
  max-width: 32em;
  text-align: center;
  color: var(--text-secondary);
}

.support-chat-empty-title {
  margin: 0;
  font-size: 14px;
}

/* 何を聞けるのかを先に見せる。空の入力欄の前で止まらないための足場。 */
.support-chat-samples {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.support-chat-sample {
  padding: 8px 14px;
  border: 1px solid var(--public-border);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.support-chat-sample:hover {
  background: var(--bg-tint);
}

/* 誰が答えているのかを明示する。AI だと分からないまま読ませない。 */
.support-chat-speaker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.support-chat-row {
  display: flex;
}

.support-chat-row-question {
  justify-content: flex-end;
}

/* 質問と回答は、色ではなく位置と地の濃さで分ける。 */
.support-chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 4px;
}

.support-chat-question {
  background: var(--bg-tint);
}

.support-chat-question p {
  margin: 0;
  white-space: pre-wrap;
}

.support-chat-answer {
  width: 100%;
}

.support-chat-thinking {
  margin: 0;
  color: var(--text-muted);
}

/* 回答は 10 秒を超えることがあるため、止まっていないことを点の動きで示す。 */
.support-chat-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
  vertical-align: baseline;
}

.support-chat-dots > span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: support-chat-dot 1.2s ease-in-out infinite;
}

.support-chat-dots > span:nth-child(2) {
  animation-delay: 0.2s;
}

.support-chat-dots > span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes support-chat-dot {
  0%,
  60%,
  100% {
    opacity: 0.25;
  }
  30% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .support-chat-dots > span {
    animation: none;
    opacity: 0.6;
  }
}

.support-chat-notice {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* 答えられなかった時の導線。回答の直後に置き、次の一手を 1 つに絞る。 */
.support-chat-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 4px;
  background: var(--bg-tint);
  font-size: 14px;
  color: var(--text-secondary);
}

.support-chat-chip-button {
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--gold-border);
  border-radius: 4px;
  background: var(--gold);
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.support-chat-chip-button:disabled {
  background: transparent;
  color: var(--text-muted);
  cursor: not-allowed;
}

.support-chat-composer {
  display: grid;
  gap: 8px;
  padding: 20px;
  border-top: 1px solid var(--public-border);
  background: #fff;
}

/* 入力欄は 1 行の細いバーを既定にし、入力量に応じて上へ伸びる。 */
.support-chat-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  /* 白地に 3.37:1。WCAG 2.2 1.4.11 は form border に 3:1 を要求する */
  border: 1px solid #828d9c;
  border-radius: 22px;
  background: #fff;
}

.support-chat-bar:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.support-chat-bar-invalid {
  border-color: var(--danger);
}

.support-chat-input {
  flex: 1;
  /* 高さは入力量に応じて JS が設定する。ここでは 1 行分を下限にする。 */
  height: 32px;
  max-height: 40vh;
  padding: 5px 0;
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
}

.support-chat-input:focus-visible {
  outline: none;
}

.support-chat-send-wrap {
  flex: none;
  display: inline-flex;
}

.support-chat-send {
  flex: none;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.support-chat-send:hover:not(:disabled) {
  background: var(--gold-strong);
}

.support-chat-send:disabled {
  background: var(--gold-border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.support-chat-open-contact {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.qa-answer-text > :first-child {
  margin-top: 0;
}

.qa-answer-text > :last-child {
  margin-bottom: 0;
}

.qa-answer-text p {
  margin: 0 0 12px;
}

.qa-answer-text ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

.qa-answer-text li {
  margin-bottom: 4px;
}

.qa-answer-text a {
  color: var(--navy);
  overflow-wrap: anywhere;
}

.support-ask-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.support-ask-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.support-ask-count-over {
  color: var(--danger);
  font-weight: 700;
}

.support-ask-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.support-chat-send:focus-visible,
.support-chat-sample:focus-visible,
.support-chat-chip-button:focus-visible,
.support-chat-open-contact:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
