/* 聯絡（L5 3.7）：左邊標題 + 一句話 + 深圳時間 + 提交以後三步；右邊一張浮起的表單面 */
#contact {
  --contact-face: rgba(255, 255, 255, 0.03);
  --contact-edge: rgba(255, 255, 255, 0.07);
  --contact-in: rgba(255, 255, 255, 0.035);
  --contact-in-edge: rgba(255, 255, 255, 0.09);
  --contact-in-hover: rgba(255, 255, 255, 0.16);
  --contact-h: 52px;
  border-top: 1px solid var(--line);
}

/* 版式：桌面左右兩欄（左：head + side，右：表單跨兩行）；手機 head → 表單 → 三步 */
#contact .contact-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  grid-template-areas: "head panel" "side panel"; grid-template-rows: auto 1fr; column-gap: clamp(48px, 7vw, 120px); align-items: start; }
#contact .contact-head { grid-area: head; }
#contact .contact-side { grid-area: side; }
#contact .contact-panel { grid-area: panel; }

#contact .contact-nb { display: inline-block; }
#contact .contact-title { font-size: clamp(38px, 4.4vw, 64px); font-weight: 680; line-height: 1.1; letter-spacing: -0.02em; color: var(--ink-1); }
#contact .contact-lead { margin-top: 24px; max-width: 28em; font-size: 17px; line-height: 1.7; color: var(--ink-2); }
#contact .contact-now { display: inline-flex; align-items: center; gap: 10px; margin-top: 28px; font-size: 13px; letter-spacing: 0.04em; color: var(--ink-3); }
#contact .contact-now time { color: var(--ink-1); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
#contact .contact-now-dot { position: relative; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); transition: background-color .7s var(--ease); }
#contact .contact-now-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: var(--amber); opacity: 0;
  animation: contact-breathe 3.2s var(--ease) infinite; }
#contact.is-paused .contact-now-dot::after { animation-play-state: paused; }
@keyframes contact-breathe { 0% { transform: scale(.4); opacity: .35; } 70%, 100% { transform: scale(1.6); opacity: 0; } }
/* 提交成功後「當前」交給第 1 步，時鐘點變灰：一屏只有一處琥珀 */
#contact.is-done .contact-now-dot { background: var(--ink-4); }
#contact.is-done .contact-now-dot::after { display: none; }

/* 直接聯絡方式（有內容時替換三步） */
#contact .contact-ways { margin: 64px 0 0; max-width: 420px; }
#contact .contact-ways[hidden], #contact .contact-next[hidden] { display: none; }
#contact .contact-ways div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 16px 0; border-top: 1px solid var(--contact-edge); }
#contact .contact-ways dt { font-size: 14px; color: var(--ink-3); }
#contact .contact-ways dd { margin: 0; font-size: 15px; color: var(--ink-1); overflow-wrap: anywhere; }
#contact .contact-ways a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; transition: text-decoration-color .2s var(--ease); }
#contact .contact-ways a:hover { text-decoration-color: var(--ink-1); }

/* 提交以後：豎排三步，一根細線把三個序號串起來 */
#contact .contact-next { margin-top: 72px; max-width: 400px; }
#contact .contact-next-t { font-size: 13px; letter-spacing: 0.04em; color: var(--ink-3); }
#contact .contact-next-list { list-style: none; margin: 22px 0 0; padding: 0; position: relative; }
#contact .contact-next-list li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 18px; padding-bottom: 26px; }
#contact .contact-next-list li:last-child { padding-bottom: 0; }
#contact .contact-next-list li:not(:last-child)::before { content: ""; position: absolute; left: 13.5px; top: 34px; bottom: 6px; width: 1px;
  background: linear-gradient(var(--contact-edge), rgba(255, 255, 255, 0.04)); }
#contact .contact-next-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.12); font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums;
  transition: border-color .7s var(--ease), color .7s var(--ease), box-shadow .7s var(--ease); }
#contact .contact-next-h { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding-top: 3px; font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--ink-1); }
#contact .contact-next-p { margin-top: 4px; font-size: 14px; line-height: 1.7; color: var(--ink-3); }
#contact .contact-next-now { font-size: 12px; font-weight: 500; letter-spacing: 0.04em; color: var(--amber); opacity: 0; transform: translateX(-4px);
  transition: opacity .7s var(--ease), transform .7s var(--ease); }
#contact.is-done .contact-next-list li[data-step="1"] .contact-next-n { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
#contact.is-done .contact-next-now { opacity: 1; transform: none; }

/* 表單面：一層浮起的面，頂上一抹很淡的白光 */
#contact .contact-panel { position: relative; padding: clamp(28px, 3vw, 40px); border-radius: 16px; background: var(--contact-face);
  border: 1px solid var(--contact-edge); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 40px 100px -40px rgba(0, 0, 0, 0.7); isolation: isolate; }
#contact .contact-panel::before { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 60% at 20% 0%, rgba(255, 255, 255, 0.045), transparent 60%); }
#contact .contact-form { display: grid; gap: 28px; }
#contact .contact-form[hidden] { display: none; }
#contact .contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
#contact .contact-field { min-width: 0; margin: 0; padding: 0; border: 0; display: grid; gap: 10px; align-content: start; }
#contact .contact-field > label, #contact .contact-field > legend, #contact .contact-label-row label { padding: 0; font-size: 14px; font-weight: 500; color: var(--ink-2); }
#contact .contact-field > legend { margin-bottom: 10px; }
#contact .contact-opt { margin-left: 8px; font-weight: 400; font-size: 13px; letter-spacing: 0.04em; color: var(--ink-3); }
#contact .contact-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
#contact .contact-count { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; transition: color .2s var(--ease); }
#contact .contact-count.is-low { color: var(--ink-2); }

/* 輸入框：大、圓角 10、聚焦琥珀細邊 */
#contact input[type="text"], #contact input[type="tel"], #contact input[type="email"], #contact textarea, #contact .contact-combo {
  width: 100%; min-width: 0; height: var(--contact-h); padding: 0 16px; box-sizing: border-box; border-radius: 10px;
  border: 1px solid var(--contact-in-edge); background: var(--contact-in); color: var(--ink-1); font: inherit; font-size: 16px; outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease); }
#contact textarea { height: auto; min-height: 148px; padding: 14px 16px; line-height: 1.7; resize: vertical; }
#contact input::placeholder, #contact textarea::placeholder { color: var(--ink-4); }
#contact input[list]::-webkit-calendar-picker-indicator { display: none !important; opacity: 0; }
#contact input:hover, #contact textarea:hover, #contact .contact-combo:hover { border-color: var(--contact-in-hover); }
#contact input:focus, #contact textarea:focus, #contact .contact-combo:focus-within {
  border-color: var(--amber); box-shadow: 0 0 0 3px rgba(242, 179, 61, 0.1); background-color: rgba(255, 255, 255, 0.05); outline: none; }

/* 聯絡方式：型別 + 號碼 合成一個框 */
#contact .contact-combo { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: stretch; padding: 0; }
#contact .contact-combo input[type] { height: 100%; border: 0; background: transparent; box-shadow: none; border-radius: 0 10px 10px 0; }
#contact .contact-combo input[type]:focus { box-shadow: none; background: transparent; }
#contact .contact-select { position: relative; display: flex; border-right: 1px solid var(--contact-in-edge); }
#contact .contact-select::after { content: ""; position: absolute; right: 14px; top: 50%; width: 6px; height: 6px; margin-top: -5px;
  border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg); pointer-events: none; }
#contact .contact-select select { appearance: none; -webkit-appearance: none; height: 100%; min-width: 0; padding: 0 36px 0 16px; border: 0; border-radius: 10px 0 0 10px;
  background: transparent; color: var(--ink-1); font: inherit; font-size: 15px; cursor: pointer; outline: none; }
#contact .contact-select select:focus-visible { box-shadow: inset 0 0 0 1px var(--amber); }
#contact .contact-select option { background: var(--surface); color: var(--ink-1); }

/* 想做哪些部分：一張 4×2 的選項格，不做成標籤條 */
#contact .contact-opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
#contact .contact-opts label { position: relative; cursor: pointer; min-width: 0; }
#contact .contact-opts input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
#contact .contact-opts span { position: relative; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--contact-in-edge); background: transparent; font-size: 14px; color: var(--ink-2); user-select: none; white-space: nowrap;
  transition: border-color .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease); }
#contact .contact-opts span::before { content: ""; flex: none; width: 14px; height: 14px; box-sizing: border-box; border-radius: 4px; border: 1px solid var(--ink-4);
  transition: background-color .2s var(--ease), border-color .2s var(--ease); }
#contact .contact-opts span::after { content: ""; position: absolute; left: 15px; top: 50%; width: 7px; height: 4px; margin-top: -3.5px;
  border-left: 1.75px solid var(--bg); border-bottom: 1.75px solid var(--bg); transform: rotate(-45deg) scale(.3); opacity: 0; transform-origin: 30% 70%;
  transition: transform .2s var(--ease), opacity .12s linear; }
#contact .contact-opts label:hover span { border-color: var(--contact-in-hover); color: var(--ink-1); }
#contact .contact-opts input:checked + span { border-color: rgba(255, 255, 255, 0.28); background-color: rgba(255, 255, 255, 0.06); color: var(--ink-1); }
#contact .contact-opts input:checked + span::before { background-color: var(--ink-1); border-color: var(--ink-1); }
#contact .contact-opts input:checked + span::after { transform: rotate(-45deg) scale(1); opacity: 1; }
#contact .contact-opts input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }

/* 更多資訊（選填）：可展開 */
#contact .contact-more { border-top: 1px solid var(--contact-edge); margin-bottom: -10px; }
#contact .contact-more summary { list-style: none; display: flex; align-items: center; gap: 12px; height: 56px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink-2);
  transition: color .2s var(--ease); }
#contact .contact-more summary::-webkit-details-marker { display: none; }
#contact .contact-more summary:hover { color: var(--ink-1); }
#contact .contact-more summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 4px; border-radius: 4px; }
#contact .contact-more summary > span:first-child { flex: 1; }
#contact .contact-more-sub { font-size: 13px; font-weight: 400; color: var(--ink-4); }
#contact .contact-more-ic { position: relative; flex: none; width: 12px; height: 12px; }
#contact .contact-more-ic::before, #contact .contact-more-ic::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1.5px; margin-top: -.75px;
  background: var(--ink-3); border-radius: 1px; transition: transform .6s var(--ease); }
#contact .contact-more-ic::after { transform: rotate(90deg); }
#contact .contact-more[open] .contact-more-ic::after { transform: rotate(0deg); }
#contact .contact-more-body { overflow: hidden; }
#contact .contact-more-body > .contact-row { padding: 4px 0 24px; }

#contact .is-bad input[type="text"], #contact .is-bad input[type="tel"], #contact .is-bad input[type="email"], #contact .is-bad textarea, #contact .is-bad .contact-combo { border-color: var(--danger); }
#contact .is-bad .contact-combo input[type] { border: 0; }
#contact .is-bad input:focus, #contact .is-bad textarea:focus, #contact .is-bad .contact-combo:focus-within { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239, 122, 104, 0.12); }
#contact .is-bad .contact-combo input[type]:focus { box-shadow: none; }
#contact .contact-err { font-size: 13px; line-height: 1.5; color: var(--danger); }
#contact .contact-err:empty { display: none; }

/* 蜜罐：移出畫面 */
#contact .contact-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* 底部：三段進度 + 整寬白色提交 */
#contact .contact-foot { display: grid; gap: 18px; }
#contact .contact-progress { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#contact .contact-progress li { font-size: 13px; letter-spacing: 0.04em; color: var(--ink-3); transition: color .4s var(--ease); }
#contact .contact-progress li > span:last-child { display: block; margin-top: 10px; }
#contact .contact-bar { display: block; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
#contact .contact-bar i { display: block; height: 100%; width: 100%; background: var(--ink-2); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .7s var(--ease), background-color .4s var(--ease); }
#contact .contact-progress li.is-full .contact-bar i { --p: 1; }
#contact .contact-progress li.is-full { color: var(--ink-2); }
#contact .contact-progress li.is-going { color: var(--ink-1); }
#contact .contact-progress li.is-going .contact-bar i { --p: 1; transform-origin: left; animation: contact-fillgo .9s var(--ease) both; background: var(--ink-1); }
@keyframes contact-fillgo { from { transform: scaleX(0); } to { transform: scaleX(1); } }
#contact .contact-progress--done li .contact-bar i { background: var(--ink-3); }
#contact .contact-progress--done li.is-now { color: var(--ink-1); }
#contact .contact-progress--done li.is-now .contact-bar i { background: var(--ink-1); }

#contact .contact-submit { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 54px;
  border: 0; border-radius: 10px; background: var(--ink-1); color: var(--bg); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  transition: background-color .2s var(--ease), transform .12s var(--ease); }
#contact .contact-submit:hover { background: #fff; }
#contact .contact-submit:active { transform: translateY(1px); }
#contact .contact-submit:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
#contact .contact-submit-ar { display: inline-block; transition: transform .6s var(--ease); }
#contact .contact-submit:hover .contact-submit-ar { transform: translateX(4px); }
#contact .contact-submit:disabled { cursor: progress; }
#contact .contact-submit.is-sending, #contact .contact-submit.is-sending:hover { background: #d9d7d0; }
#contact .contact-submit.is-sending .contact-submit-ar { opacity: 0; }
#contact .contact-submit-line { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; overflow: hidden; background: rgba(14, 16, 18, 0.1); opacity: 0; transition: opacity .15s linear; }
#contact .contact-submit-line::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 30%; background: var(--bg); transform: translateX(-100%); }
#contact .contact-submit.is-sending .contact-submit-line { opacity: 1; }
#contact .contact-submit.is-sending .contact-submit-line::after { animation: contact-line 1.2s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
@keyframes contact-line { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

#contact .contact-status:empty { display: none; }
#contact .contact-status { padding: 12px 16px; border-radius: 10px; font-size: 14px; line-height: 1.7; color: var(--ink-1);
  border: 1px solid rgba(239, 122, 104, 0.35); background: rgba(239, 122, 104, 0.07); }

/* 成功：對勾一筆畫出、編號、深圳時間 */
#contact .contact-done { display: grid; justify-items: start; padding: 4px 0; outline: none; }
#contact .contact-done[hidden] { display: none; }
#contact .contact-done .contact-progress { width: 100%; }
#contact .contact-tick { width: 64px; height: 64px; margin-top: 56px; display: block; fill: none; }
#contact .contact-tick-ring { stroke: rgba(255, 255, 255, 0.14); stroke-width: 1; }
#contact .contact-tick-mark { stroke: var(--ink-1); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
#contact .contact-done.is-drawn .contact-tick-mark { stroke-dashoffset: 0; transition: stroke-dashoffset .7s cubic-bezier(0.65, 0, 0.35, 1) .25s; }
#contact .contact-done-h { margin-top: 28px; font-size: clamp(26px, 2.2vw, 32px); font-weight: 660; line-height: 1.25; letter-spacing: -0.02em; color: var(--ink-1); }
#contact .contact-done-meta { margin: 28px 0 0; width: 100%; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--contact-edge); border-bottom: 1px solid var(--contact-edge); }
#contact .contact-done-meta div { padding: 18px 0; }
#contact .contact-done-meta div + div { padding-left: 24px; border-left: 1px solid var(--contact-edge); }
#contact .contact-done-meta dt { font-size: 13px; letter-spacing: 0.04em; color: var(--ink-3); }
#contact .contact-done-meta dd { margin: 6px 0 0; font-size: 20px; font-weight: 600; letter-spacing: 0.04em; color: var(--ink-1); font-variant-numeric: tabular-nums; }
#contact .contact-done-note { margin-top: 24px; max-width: 28em; font-size: 16px; line-height: 1.7; color: var(--ink-2); }
#contact .contact-again { margin-top: 36px; height: 46px; padding: 0 20px; border-radius: 10px; border: 1px solid var(--contact-in-edge); background: transparent;
  color: var(--ink-1); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; transition: border-color .2s var(--ease), background-color .2s var(--ease); }
#contact .contact-again:hover { border-color: var(--contact-in-hover); background: rgba(255, 255, 255, 0.03); }
#contact .contact-again:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

@media (max-width: 1100px) {
  #contact .contact-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  #contact .contact-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "panel" "side"; grid-template-rows: auto; }
  #contact .contact-panel { margin-top: 40px; }
  #contact .contact-next, #contact .contact-ways { margin-top: 56px; }
}
@media (max-width: 560px) {
  #contact { --contact-h: 50px; }
  #contact .contact-title { font-size: 36px; }
  #contact .contact-lead { font-size: 16px; margin-top: 18px; }
  #contact .contact-now { margin-top: 20px; }
  #contact .contact-panel { padding: 24px 18px; border-radius: 16px; }
  #contact .contact-row { grid-template-columns: 1fr; gap: 24px; }
  #contact .contact-more-sub { display: none; }
  #contact .contact-ways div { grid-template-columns: 1fr; gap: 2px; padding: 12px 0; }
  #contact .contact-select select { padding: 0 32px 0 14px; }
  #contact .contact-select::after { right: 12px; }
  #contact .contact-tick { margin-top: 40px; }
  #contact .contact-done-meta div + div { padding-left: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  /* 所有過渡瞬切；傳送線靜止顯示；對勾直接畫好；時鐘點不呼吸 */
  #contact *, #contact *::before, #contact *::after { transition: none !important; animation: none !important; }
  #contact .contact-submit.is-sending .contact-submit-line::after { transform: none; width: 100%; opacity: .5; }
  #contact .contact-done.is-drawn .contact-tick-mark { stroke-dashoffset: 0; }
}
