/* td-ui.css — テラデザイン公式サイト 共通UI（相談ポップアップ・固定相談バナー・出現アニメの補助）
 * 色は各ページの :root 変数（--ink / --accent / --paper / --cream / --line / --accent-ink）を使い、
 * 変数が無いページでも崩れないよう既定値を持たせています。
 * 設置: <link rel="stylesheet" href="/assets/td/td-ui.css"> と <script src="/assets/td/td-consult.js" defer></script>
 */

/* ---------- 出現アニメ（1文字ずつ） ---------- */
.td-letter { display: inline-block; }

/* ---------- 相談ポップアップ ---------- */
html.td-consult-lock { overflow: hidden; }

.td-consult {
  box-sizing: border-box;
  width: min(520px, calc(100% - 32px));
  max-height: calc(100svh - 32px);
  margin: auto;
  padding: 46px 28px 22px;
  border: 1px solid var(--line, #E7E5E4);
  border-radius: 18px;
  background: var(--paper, #FFFEFC);
  color: var(--ink, #1F2937);
  box-shadow: 0 24px 60px rgba(31, 41, 55, .22);
  overflow: auto;
  font-family: "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.75;
  text-align: center;
}
.td-consult::backdrop { background: rgba(31, 41, 55, .45); backdrop-filter: blur(3px); }
.td-consult[open] { animation: td-consult-in .32s cubic-bezier(.16, 1, .3, 1); }
@keyframes td-consult-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.td-consult__close {
  position: absolute; top: 8px; right: 8px;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--muted, #6B7280);
  font-size: 26px; line-height: 1; cursor: pointer;
}
.td-consult__close:hover { background: var(--cream, #F9F7F2); color: var(--ink, #1F2937); }

.td-consult__eyebrow {
  margin: 0 0 6px;
  font-family: "Cormorant Garamond", serif;
  font-size: 13px; letter-spacing: .24em;
  color: var(--accent-ink, #0E8A7D);
}
.td-consult__title {
  margin: 0 0 10px;
  font-family: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-weight: 600;
  font-size: clamp(21px, 5.4vw, 26px);
  line-height: 1.55; letter-spacing: .02em;
}
.td-consult__lead { margin: 0 0 20px; font-size: 14px; color: var(--ink-soft, #374151); }
/* 日本語の折り返し：禁則を厳しめに、文節単位（対応ブラウザのみ）。主要な文言はJS側で文節ごとに区切っています */
.td-consult { line-break: strict; word-break: auto-phrase; }

/* 選択肢（ホバー / フォーカスでふわっと浮く） */
.td-consult__choices { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 10px; }
.td-consult__choice {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; min-height: 58px; padding: 12px 18px;
  border: 1px solid var(--line-2, #D6D3CF); border-radius: 12px;
  background: #fff; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
  transition: transform .28s cubic-bezier(.16, 1, .3, 1), box-shadow .28s ease, border-color .2s ease;
}
.td-consult__choice-main { display: grid; gap: 1px; }
.td-consult__choice-title { font-size: 15px; font-weight: 600; }
.td-consult__choice-hint { font-size: 12px; color: var(--muted, #6B7280); }
.td-consult__choice-arrow { color: var(--accent-ink, #0E8A7D); font-size: 18px; transition: transform .28s cubic-bezier(.16, 1, .3, 1); }
.td-consult__choice:hover,
.td-consult__choice:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent, #14B8A6);
  box-shadow: 0 12px 26px rgba(31, 41, 55, .12);
}
.td-consult__choice:hover .td-consult__choice-arrow,
.td-consult__choice:focus-visible .td-consult__choice-arrow { transform: translateX(4px); }
@media (hover: none) { .td-consult__choice:hover { transform: none; box-shadow: none; } .td-consult__choice:active { transform: translateY(-2px); } }

/* 回答ステップ */
.td-consult__answer-title {
  margin: 4px 0 10px;
  font-family: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-weight: 600; font-size: clamp(19px, 5vw, 23px); line-height: 1.6;
}
.td-consult__answer-body { margin: 0 0 20px; font-size: 14px; color: var(--ink-soft, #374151); }
.td-consult__cta {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 12px 16px; margin: 0 0 10px;
  border-radius: 10px; font-size: 15px; font-weight: 700; text-decoration: none;
  transition: transform .25s cubic-bezier(.16, 1, .3, 1), box-shadow .25s ease;
}
.td-consult__cta--line { background: #06c755; color: #1F2937; }   /* 2026-11-09 白文字だと約2.3:1で読みにくいため、濃い文字色(約6.5:1)に変更 */
.td-consult__cta--sub { background: #fff; color: var(--ink, #1F2937); border: 1px solid var(--line-2, #D6D3CF); font-weight: 500; font-size: 14px; }
.td-consult__cta:hover, .td-consult__cta:focus-visible { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(31, 41, 55, .14); }

.td-consult__text-btn {
  display: block; margin: 8px auto 0; min-height: 44px; padding: 8px 16px;
  border: 0; background: transparent; color: var(--muted, #6B7280);
  font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer;
}
.td-consult__text-btn:hover { color: var(--ink, #1F2937); }
.td-consult :focus-visible, .td-consult-banner :focus-visible, .td-consult-fab :focus-visible { outline: 2px solid var(--accent-ink, #0E8A7D); outline-offset: 3px; }
.td-consult-fab :focus-visible { outline-color: #fff; }
.td-consult [hidden] { display: none !important; }

/* ---------- 固定の相談バナー（PCのみ。スマホは既存の下部固定バーを使う） ---------- */
.td-consult-banner { display: none; }
@media (min-width: 900px) and (hover: hover) {
  .td-consult-banner {
    position: fixed; right: 20px; bottom: 20px; z-index: 60;
    display: flex; align-items: stretch;
    border: 1px solid var(--line, #E7E5E4); border-radius: 14px;
    background: var(--paper, #FFFEFC);
    box-shadow: 0 10px 28px rgba(31, 41, 55, .16);
    overflow: hidden;
  }
  .td-consult-banner[hidden] { display: none; }
  .td-consult-banner__open {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px 12px 14px; border: 0; background: transparent; color: var(--ink, #1F2937);
    font: inherit; text-align: left; cursor: pointer;
    border-left: 4px solid var(--accent, #14B8A6);
    transition: background .2s ease;
  }
  .td-consult-banner__open:hover { background: var(--cream, #F9F7F2); }
  .td-consult-banner__ttl { display: block; font-size: 14px; font-weight: 700; line-height: 1.4; }
  .td-consult-banner__sub { display: block; font-size: 11px; color: var(--muted, #6B7280); }
  .td-consult-banner__arrow { color: var(--accent-ink, #0E8A7D); }
  .td-consult-banner__close {
    width: 44px; border: 0; border-left: 1px solid var(--line, #E7E5E4);
    background: transparent; color: var(--muted, #6B7280); font-size: 16px; cursor: pointer;
  }
  .td-consult-banner__close:hover { background: var(--cream, #F9F7F2); color: var(--ink, #1F2937); }
}

/* 「ページ上へ」ボタン（右下）があるページでは、バナーを上にずらして重ねない */
@media (min-width: 900px) and (hover: hover) {
  .td-consult-banner--raised { bottom: 92px; }
}

/* ---------- スマホ用の小さな固定ボタン（下部固定バーが無いページのみ） ---------- */
.td-consult-fab {
  position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: stretch;
  border-radius: 999px; overflow: hidden;
  background: var(--ink, #1F2937); color: #fff;
  box-shadow: 0 10px 24px rgba(31, 41, 55, .28);
}
.td-consult-fab[hidden] { display: none; }
.td-consult-fab__open {
  min-height: 48px; padding: 0 16px 0 20px; border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 14px; font-weight: 700; letter-spacing: .04em; cursor: pointer;
}
.td-consult-fab__close {
  width: 44px; border: 0; border-left: 1px solid rgba(255, 255, 255, .22);
  background: transparent; color: rgba(255, 255, 255, .8); font-size: 16px; cursor: pointer;
}
@media (min-width: 900px) and (hover: hover) { .td-consult-fab { display: none; } }
/* 2026-11-09 追記：「ページ上へ」ボタン(#scroll-top・右下)があるページでは、相談ボタンを上にずらして重ねない（/services/ のスマホで重なりを確認） */
body:has(#scroll-top) .td-consult-fab { bottom: calc(84px + env(safe-area-inset-bottom)); }

/* 印刷時は表示しない */
@media print { .td-consult, .td-consult-banner, .td-consult-fab { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  .td-consult[open] { animation: none; }
  .td-consult__choice, .td-consult__cta, .td-consult__choice-arrow { transition: none; }
  .td-consult__choice:hover, .td-consult__choice:focus-visible, .td-consult__cta:hover, .td-consult__cta:focus-visible { transform: none; }
}
