/* ============================================================
   承創官網 · 務實工程師 × 個人品牌調性
   深底 + 冷灰藍 + 一抹電光青綠（terminal accent）
   ============================================================ */

:root {
  --bg:        #0c0e12;
  --bg-soft:   #12151b;
  --bg-card:   #161a22;
  --line:      #232833;
  --line-soft: #1c212b;
  --ink:       #e8ecf2;
  --ink-dim:   #9aa4b2;
  --ink-faint: #6b7482;
  --accent:    #3dd7a0;   /* 電光青綠 */
  --accent-dim:#1f8a67;
  --accent-glow: rgba(61, 215, 160, .14);
  --radius: 14px;
  --wrap: 1080px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Noto Sans TC', system-ui, -apple-system, 'PingFang TC', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

a { color: inherit; text-decoration: none; transition: color .18s ease, opacity .18s ease; }
strong, b { color: #fff; font-weight: 700; }
em { font-style: normal; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; letter-spacing: .01em;
  padding: 13px 24px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .16s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn-lg { padding: 16px 32px; font-size: 16px; }
.btn-primary {
  background: var(--accent); color: #05130d;
  box-shadow: 0 6px 24px -8px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 34px -10px rgba(61,215,160,.4); }
.btn-ghost {
  background: transparent; color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--accent-dim); color: #fff; transform: translateY(-2px); }

/* ---------- NAV ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12,14,18,.78);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.logo { display: flex; align-items: center; gap: 11px; }
.logo-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #05130d; font-weight: 900; font-size: 19px;
  box-shadow: 0 4px 16px -6px var(--accent-glow);
}
.logo-mark.small { width: 30px; height: 30px; font-size: 16px; }
/* 品牌 logo：原檔為黑色線條，深底上以 invert 反白 */
.logo-img { height: 26px; width: auto; filter: invert(1) brightness(1.05); display: block; }
.footer-mark { height: 30px; width: auto; filter: invert(1) brightness(1.05); opacity: .9; }
.logo-text { font-weight: 900; font-size: 15px; letter-spacing: .02em; padding-left: 12px; margin-left: 12px; border-left: 1px solid var(--line); }
.logo-text em { color: var(--ink-faint); font-weight: 500; font-size: 12px; display: block; letter-spacing: .12em; margin-top: -3px; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { font-size: 15px; color: var(--ink-dim); font-weight: 500; }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  color: var(--accent) !important; font-weight: 700 !important;
  border: 1px solid var(--accent-dim); padding: 8px 16px; border-radius: 8px;
}
.nav-cta:hover { background: var(--accent-glow); }

/* ---------- HERO ---------- */
.hero { position: relative; padding: 92px 0 72px; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(60% 50% at 20% 0%, var(--accent-glow), transparent 70%),
    radial-gradient(50% 40% at 90% 20%, rgba(61,215,160,.06), transparent 70%);
  pointer-events: none;
}
/* 3D 神經網路背景 canvas：鋪滿 hero，墊在內容與漸層之下 */
.hero-neural {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; display: block; pointer-events: none;
}
.hero::before { z-index: 1; }        /* 漸層光暈壓在 canvas 上，柔化粒子 */
.hero-inner { position: relative; z-index: 2; }  /* 文字內容最上層 */
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  letter-spacing: .05em; margin-bottom: 26px;
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-soft);
}
.hero-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.hero-title {
  font-size: clamp(34px, 6vw, 60px); font-weight: 900; line-height: 1.14;
  letter-spacing: -.01em; margin-bottom: 24px;
}
.hero-sub {
  font-size: clamp(17px, 2.2vw, 21px); color: var(--ink-dim);
  max-width: 620px; margin-bottom: 36px;
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 56px; }

/* terminal card */
.hero-terminal {
  max-width: 680px; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg-soft); box-shadow: 0 30px 80px -30px rgba(0,0,0,.7);
}
.term-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft); background: #0e1116;
}
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: #2a2f3a; }
.term-bar span:nth-child(1) { background: #ff5f57; }
.term-bar span:nth-child(2) { background: #febc2e; }
.term-bar span:nth-child(3) { background: #28c840; }
.term-bar em { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }
.term-body { padding: 20px 22px; font-family: var(--mono); font-size: 13.5px; line-height: 1.9; overflow-x: auto; }
.c-dim { color: var(--ink-faint); } .c-cmd { color: var(--accent); font-weight: 600; }
.c-str { color: #7fb2ff; } .c-ok { color: var(--accent); } .c-cmt { color: var(--ink-faint); font-style: italic; }

/* ---------- generic section ---------- */
.section { padding: 84px 0; border-top: 1px solid var(--line-soft); }
.section-eyebrow { font-family: var(--mono); font-size: 13px; color: var(--accent); letter-spacing: .16em; margin-bottom: 12px; }
.section-title { font-size: clamp(26px, 4vw, 38px); font-weight: 900; letter-spacing: -.01em; margin-bottom: 44px; }

/* ---------- PROBLEM ---------- */
.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.pcard {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 30px 26px;
  transition: transform .2s ease, border-color .2s ease;
}
.pcard:hover { transform: translateY(-4px); border-color: var(--accent-dim); }
.pcard-num { font-family: var(--mono); font-size: 14px; color: var(--accent); margin-bottom: 16px; opacity: .8; }
.pcard h3 { font-size: 19px; margin-bottom: 10px; line-height: 1.4; }
.pcard p { color: var(--ink-dim); font-size: 15px; }
.problem-turn { text-align: center; font-size: clamp(20px, 3vw, 26px); font-weight: 700; margin-top: 48px; color: var(--ink); }
.problem-turn strong { color: var(--accent); }

/* ---------- SERVICES ---------- */
.cards-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.scard {
  position: relative; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px 30px; transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.scard:hover { transform: translateY(-4px); border-color: var(--accent-dim); box-shadow: 0 24px 60px -30px var(--accent-glow); }
.scard-tag {
  display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  color: var(--accent); border: 1px solid var(--accent-dim); border-radius: 999px;
  padding: 3px 11px; margin-bottom: 18px;
}
.scard h3 { font-size: 24px; margin-bottom: 12px; }
.scard-lead { color: var(--ink-dim); font-size: 16px; margin-bottom: 22px; }
.scard-list { list-style: none; display: grid; gap: 14px; margin-bottom: 22px; }
.scard-list li { position: relative; padding-left: 22px; color: var(--ink-dim); font-size: 15px; }
.scard-list li::before { content: '▹'; position: absolute; left: 0; color: var(--accent); }
.scard-foot { font-size: 13.5px; color: var(--ink-faint); border-top: 1px solid var(--line-soft); padding-top: 18px; margin-bottom: 20px; }
.scard-foot em { color: var(--ink-dim); }
.scard-cta { font-weight: 700; color: var(--accent); font-size: 15px; }
.scard-cta:hover { opacity: .75; }

/* ---------- WHY ---------- */
.why-inner { display: grid; grid-template-columns: 280px 1fr; gap: 56px; align-items: start; }
.why-photo { position: sticky; top: 100px; text-align: center; }
.why-avatar {
  width: 200px; height: 200px; margin: 0 auto 18px; border-radius: 24px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #1b2a24, #0e1613);
  border: 1px solid var(--accent-dim);
  font-family: var(--mono); font-size: 56px; font-weight: 700; color: var(--accent);
  box-shadow: 0 24px 60px -24px var(--accent-glow);
}
.why-sign { font-family: var(--mono); color: var(--ink-faint); font-size: 14px; letter-spacing: .1em; }
.why-lead { font-size: clamp(18px, 2.4vw, 22px); color: var(--ink); margin-bottom: 30px; line-height: 1.6; }
.why-proof { list-style: none; display: grid; gap: 16px; margin-bottom: 32px; }
.why-proof li { font-size: 16px; color: var(--ink-dim); display: flex; gap: 12px; align-items: baseline; }
.why-proof .chk { color: var(--accent); font-weight: 700; }
.why-slogan {
  font-size: clamp(20px, 3vw, 26px); font-weight: 700; color: #fff;
  border-left: 3px solid var(--accent); padding: 6px 0 6px 22px;
}
.why-slogan em { color: var(--accent); }

/* ---------- PROOF ---------- */
.ecard {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 30px 28px;
  transition: transform .2s ease, border-color .2s ease;
}
.ecard:hover { transform: translateY(-4px); border-color: var(--accent-dim); }
.ecard-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--accent); margin-bottom: 14px; }
.ecard h3 { font-size: 20px; line-height: 1.4; margin-bottom: 12px; }
.ecard p { color: var(--ink-dim); font-size: 15px; }
.proof-note { margin-top: 30px; font-size: 14px; color: var(--ink-faint); }

/* ---------- PROCESS ---------- */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: s; }
.steps li { position: relative; background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 28px 22px; }
.step-n {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
  background: var(--accent-glow); border: 1px solid var(--accent-dim);
  color: var(--accent); font-family: var(--mono); font-weight: 600; font-size: 18px; margin-bottom: 18px;
}
.steps h3 { font-size: 17px; margin-bottom: 8px; }
.steps p { color: var(--ink-dim); font-size: 14.5px; }

/* ---------- CONTACT ---------- */
.contact { text-align: center; border-top: 1px solid var(--line); }
.contact-inner {
  max-width: 760px; padding: 24px;
  background:
    radial-gradient(60% 100% at 50% 0%, var(--accent-glow), transparent 70%);
  border-radius: 28px;
}
.contact-title { font-size: clamp(28px, 5vw, 44px); font-weight: 900; line-height: 1.2; margin-bottom: 18px; }
.contact-sub { font-size: clamp(16px, 2.2vw, 19px); color: var(--ink-dim); margin-bottom: 34px; }
.contact-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.contact-fineprint { font-size: 14px; color: var(--ink-faint); }

/* ---------- FOOTER ---------- */
.footer { border-top: 1px solid var(--line-soft); padding: 40px 0; background: var(--bg-soft); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 13px; }
.footer-brand strong { display: block; font-size: 15px; }
.footer-brand span { color: var(--ink-faint); font-size: 13px; }
.footer-meta { text-align: right; display: grid; gap: 4px; }
.footer-meta span { color: var(--ink-faint); font-size: 13px; }
.footer-slogan { color: var(--ink-dim) !important; }

.mobile-br { display: none; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  .nav-links { gap: 16px; }
  .nav-links a:not(.nav-cta) { display: none; }
  .cards-3, .cards-2, .steps { grid-template-columns: 1fr; }
  .why-inner { grid-template-columns: 1fr; gap: 32px; }
  .why-photo { position: static; }
  .why-avatar { width: 150px; height: 150px; font-size: 44px; }
  .mobile-br { display: inline; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-meta { text-align: left; }
}
@media (max-width: 560px) {
  .hero { padding: 60px 0 48px; }
  .section { padding: 60px 0; }
  .hero-cta .btn, .contact-actions .btn { flex: 1 1 auto; }
}

/* ============================================================
   能力文字雲 + 能力清單（proof 區）
   ============================================================ */
.cloud {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 10px 14px; margin: 0 auto 44px; max-width: 860px; text-align: center;
}
.cloud .tag {
  display: inline-block; border-radius: 999px; padding: 7px 16px;
  border: 1px solid var(--line); background: var(--bg-card); color: var(--ink-dim);
  font-weight: 500; line-height: 1.2; transition: color .18s ease, border-color .18s ease, transform .18s ease;
  cursor: default;
}
.cloud .tag:hover { color: #fff; border-color: var(--accent-dim); transform: translateY(-2px); }
.cloud .tag-xl { font-size: 22px; font-weight: 700; color: var(--ink); }
.cloud .tag-lg { font-size: 18px; font-weight: 600; color: var(--ink); }
.cloud .tag-md { font-size: 15px; }
.cloud .tag-sm { font-size: 13px; color: var(--ink-faint); }
/* 部分標籤染上品牌色，讓文字雲有節奏 */
.cloud .tag-xl:nth-of-type(odd) { border-color: var(--accent-dim); color: var(--accent); }

.cap-list { list-style: none; display: grid; gap: 12px; max-width: 760px; margin: 0 auto 52px; }
.cap-list li { position: relative; padding-left: 22px; color: var(--ink-dim); font-size: 15.5px; }
.cap-list li::before { content: '▹'; position: absolute; left: 0; color: var(--accent); }

.proof-subhead { font-size: 18px; color: var(--ink-faint); font-weight: 600; margin-bottom: 22px; letter-spacing: .02em; }

/* ============================================================
   Chatbot（右下浮動泡泡 + 對話外殼）
   ============================================================ */
.chat { position: fixed; right: 22px; bottom: 22px; z-index: 100; }

.chat-fab {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 20px 13px 16px; border: none; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #05130d; font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 30px -8px rgba(61,215,160,.5);
  transition: transform .16s ease, box-shadow .2s ease;
}
.chat-fab:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -10px rgba(61,215,160,.6); }
.chat-fab-icon { width: 22px; height: 22px; }
.chat-fab-label { white-space: nowrap; }

.chat-panel {
  position: absolute; right: 0; bottom: 64px; width: 340px; max-width: calc(100vw - 32px);
  height: 460px; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 80px -24px rgba(0,0,0,.75);
  animation: chatIn .22s ease;
}
/* hidden 屬性優先於 display:flex，確保預設關閉 */
.chat-panel[hidden] { display: none; }
@keyframes chatIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft); background: #0e1116;
}
.chat-head-brand { display: flex; align-items: center; gap: 11px; }
.chat-head-brand strong { display: block; font-size: 15px; }
.chat-status { font-size: 12px; color: var(--accent); }
.chat-dot { width: 9px; height: 9px; border-radius: 50%; background: #febc2e; box-shadow: 0 0 8px #febc2e; }
.chat-dot.online { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.chat-close { background: none; border: none; color: var(--ink-faint); font-size: 16px; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.chat-close:hover { color: var(--ink); background: var(--bg-card); }

.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; }
.msg-bubble { max-width: 84%; padding: 10px 13px; border-radius: 13px; font-size: 14px; line-height: 1.55; }
.msg-bot .msg-bubble    { background: var(--bg-card); color: var(--ink); border: 1px solid var(--line-soft); border-bottom-left-radius: 4px; }
.msg-user               { justify-content: flex-end; }
.msg-user .msg-bubble   { background: var(--accent); color: #05130d; border-bottom-right-radius: 4px; }
.msg-system             { justify-content: center; }
.msg-system .msg-bubble { background: transparent; color: var(--ink-faint); font-size: 12.5px; border: 1px dashed var(--line); }

.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line-soft); background: #0e1116; }
.chat-input input {
  flex: 1; background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; color: var(--ink); font-size: 14px; outline: none; font-family: inherit;
}
.chat-input input::placeholder { color: var(--ink-faint); }
.chat-input input:disabled { opacity: .6; cursor: not-allowed; }
.chat-input input:focus:not(:disabled) { border-color: var(--accent-dim); }
.chat-input button {
  width: 42px; border: none; border-radius: 10px; background: var(--accent); color: #05130d;
  font-size: 18px; font-weight: 700; cursor: pointer; transition: opacity .18s ease;
}
.chat-input button:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 560px) {
  .chat { right: 14px; bottom: 14px; }
  .chat-fab-label { display: none; }
  .chat-fab { padding: 14px; }
  .chat-panel { bottom: 62px; height: 66vh; }
}
