/* ============================================================================
   notwing thread: page styles. Engine (scrollcraft.css) is untouched; this file
   themes its six colour roles and two faces and styles the page's own markup.
   Light palette: brand/notwing.yaml, block `landing_light`.
   ========================================================================== */

:root {
  --sc-canvas:     #eaeef2;
  --sc-surface:    #ffffff;
  --sc-ink:        #0a0f1e;
  --sc-ink-soft:   #566171;
  --sc-accent:     #00cc73;
  --sc-accent-ink: #0a0f1e;

  --sc-font-display: "Space Grotesk", "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  --sc-font-text:    "Noto Sans TC", "PingFang TC", system-ui, sans-serif;

  --sc-shadow-color: 215 35% 30%;
  --sc-e1: 0 1px 2px hsl(var(--sc-shadow-color) / 0.10), 0 2px 6px -1px hsl(var(--sc-shadow-color) / 0.08);
  --sc-e2: 0 2px 4px hsl(var(--sc-shadow-color) / 0.10), 0 10px 22px -6px hsl(var(--sc-shadow-color) / 0.16);
  --sc-edge: inset 0 1px 0 #fff;

  /* Second stop of the one accent: the same green, dark enough to be text. */
  --acc-t:  #007a45;
  --ink-3:  #5f6b7a;
  --line:   #dde3ea;
  --tint:   color-mix(in oklab, #007a45 7%, #ffffff);
  --warn:   #a35f00;
  --ok:     #087a55;
  --bear:   #d92d3f;
  --rail-w: 340px;
  --bar-h:  72px;
}

html { scroll-padding-top: calc(var(--bar-h) + 16px); }
body { font-size: 1.0625rem; line-height: 1.85; }
body.lock { overflow: hidden; }
:focus-visible { outline: 2px solid var(--acc-t); outline-offset: 3px; }
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 100; background: var(--sc-ink); color: #fff; padding: .6rem 1.1rem; border-radius: 999px; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------------------------------------------------------------- shell -- */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100dvh; }
.pane { position: relative; min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }
.wrap { flex: 1; padding: 28px clamp(16px, 4vw, 48px) 56px; }
.thread { max-width: 44rem; margin-inline: auto; }

.av { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: #fff; border: 1px solid var(--line); font: 700 1rem/1 var(--sc-font-text); color: var(--acc-t); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.g { background: var(--tint); border-color: transparent; }

/* ---------------------------------------------------------- chat list ---- */
.rail { position: sticky; top: 0; height: 100dvh; z-index: 40; display: flex; flex-direction: column; background: var(--sc-surface); border-right: 1px solid var(--line); }
.rail-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 12px; }
.mark { font: 700 1.35rem/1 var(--sc-font-display); letter-spacing: -0.02em; text-decoration: none; }
.mark span { color: var(--acc-t); }
.rail-close { display: none; }
.rows { flex: 1; overflow-y: auto; padding: 6px 0; }
.row { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; align-items: center; padding: 11px 20px; color: inherit; text-decoration: none; transition: background-color 140ms var(--sc-ease-out); }
.row .av { width: 46px; height: 46px; }
.row strong { display: block; font-size: 1rem; font-weight: 700; line-height: 1.35; }
.row small { display: block; font-size: .8125rem; line-height: 1.45; color: var(--sc-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row[aria-current="location"] { background: var(--tint); }
.row[aria-current="location"] strong::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 8px; border-radius: 50%; background: var(--acc-t); vertical-align: middle; }
@media (hover: hover) and (pointer: fine) { .row:hover { background: #f3f6f8; } .row[aria-current="location"]:hover { background: var(--tint); } }
.rail-foot { display: flex; justify-content: space-between; gap: 12px; padding: 14px 24px 20px; border-top: 1px solid var(--line); font-size: .9rem; }
.rail-foot a { color: var(--sc-ink-soft); text-underline-offset: .22em; }

/* -------------------------------------------------------------- header --- */
.bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: var(--bar-h); padding: 0 clamp(16px, 3vw, 32px); background: var(--sc-surface); border-bottom: 1px solid var(--line); }
.bar .av { width: 46px; height: 46px; }
.who { flex: 1; min-width: 0; line-height: 1.4; }
.who strong { display: block; font-size: 1.05rem; }
.who span { display: block; font-size: .8125rem; color: var(--sc-ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu { display: none; place-items: center; width: 44px; height: 44px; margin-left: -8px; border: 0; background: transparent; border-radius: 50%; cursor: pointer; color: var(--sc-ink); }

/* ------------------------------------------------------------- buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: .8rem 1.6rem; border: 1.5px solid transparent; border-radius: 999px; background: var(--sc-accent); color: var(--sc-accent-ink); font: 700 1rem/1.2 var(--sc-font-text); white-space: nowrap; text-decoration: none; cursor: pointer; transition: transform 140ms var(--sc-ease-out), background-color 140ms var(--sc-ease-out); }
.btn.sm { min-height: 44px; padding: .6rem 1.15rem; font-size: .95rem; }
.btn.ghost { background: transparent; border-color: var(--acc-t); color: var(--acc-t); }
.btn:active, .chip:active, .send:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: #00b866; }
  .btn.ghost:hover { background: var(--tint); }
}

/* ------------------------------------------------------------ messages --- */
.sec { margin-top: clamp(3.5rem, 8vw, 6rem); }
.sec.first { margin-top: 0; }
.note { width: fit-content; max-width: 100%; margin: 0 auto 1.4rem; padding: .35rem 1rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .7); font-size: .8125rem; line-height: 1.6; color: var(--ink-3); text-align: center; }

.grp { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; align-items: end; }
.grp.gap { margin-top: 1.4rem; }
.grp > .av { position: sticky; bottom: calc(var(--dock-h, 104px) + 14px); align-self: end; margin-bottom: 2px; }
.msgs { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
/* Only the bubbles rise, not the column that holds them. */
[data-sc-in].msgs { opacity: 1; transform: none; transition: none; }

.b { max-width: min(100%, 33rem); padding: .8rem 1.15rem; background: var(--sc-surface); border: 1px solid var(--line); border-radius: 20px 20px 20px 6px; box-shadow: var(--sc-e1), var(--sc-edge); font-size: 1.0625rem; line-height: 1.85; text-wrap: pretty; }
.b p { text-wrap: pretty; }
.b strong { font-weight: 700; color: var(--acc-t); }
.b.me { background: var(--sc-accent); color: var(--sc-accent-ink); border-color: transparent; border-radius: 20px 20px 6px 20px; font-weight: 500; }
.b.title { max-width: min(100%, 24rem); padding: 1.05rem 1.5rem; font-family: var(--sc-font-display); font-weight: 700; font-size: clamp(1.85rem, 1rem + 3.6vw, 2.6rem); line-height: 1.25; letter-spacing: -0.02em; }
.b.title.sm { font-size: clamp(1.4rem, 1rem + 1.6vw, 1.8rem); padding: .85rem 1.3rem; }
.b.title h1, .b.title h2 { font: inherit; letter-spacing: inherit; text-wrap: balance; }
.b.title em { font-style: normal; color: var(--acc-t); }
.b.wide { width: min(100%, 36rem); max-width: none; padding: 0; overflow: hidden; }
.b.card { width: min(100%, 26rem); }

.line.me { display: flex; justify-content: flex-end; margin: 12px 0 8px; }
.line.me .b { max-width: min(88%, 26rem); }

/* quick replies */
.qr { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0 52px; }
.chip { display: inline-flex; align-items: center; padding: .55rem 1.1rem; border: 1.5px solid var(--acc-t); border-radius: 999px; background: var(--sc-surface); color: var(--acc-t); font: 600 .95rem/1.4 var(--sc-font-text); text-decoration: none; cursor: pointer; transition: transform 140ms var(--sc-ease-out), background-color 140ms var(--sc-ease-out), color 140ms var(--sc-ease-out); }
.chip.soft { border-color: var(--line); color: var(--sc-ink-soft); font-weight: 500; }
.chip[aria-expanded="true"] { border-color: transparent; background: var(--tint); color: var(--ink-3); cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .chip:hover:not([aria-expanded="true"]) { background: var(--acc-t); border-color: var(--acc-t); color: #fff; }
}

/* pain replies */
.js .pair { display: none; }
.js .pair.show { display: block; }
.pair .grp { margin-top: 4px; }

/* profile card + figures */
.who2 { display: flex; align-items: center; gap: 12px; padding-bottom: .7rem; margin-bottom: .6rem; border-bottom: 1px solid var(--line); }
.who2 img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: #fff; border: 1px solid var(--line); }
.who2 strong { display: block; color: var(--sc-ink); font-size: 1.05rem; }
.who2 span { font-size: .875rem; color: var(--sc-ink-soft); }
.tick li { position: relative; padding-left: 1.5rem; font-size: .975rem; line-height: 1.75; }
.tick li::before { content: "✓"; position: absolute; left: 0; color: var(--acc-t); font-weight: 700; }
.stats { min-width: min(72vw, 19rem); }
.stats > div { display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; padding: .5rem 0; }
.stats > div + div { border-top: 1px solid var(--line); }
.stats dt { font-size: .9375rem; color: var(--sc-ink-soft); }
.stats dd { font: 700 1.5rem/1.2 var(--sc-font-display); letter-spacing: -0.02em; }

.photo { width: min(100%, 17rem); padding: 6px; }
.photo img { width: 100%; height: auto; border-radius: 15px; aspect-ratio: 1200 / 1799; object-fit: cover; }

/* timeline */
.tl { padding: 1rem 1.2rem; }
.tl li { position: relative; padding: 0 0 1rem 1.6rem; }
.tl li:last-child { padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; left: 0; top: .6rem; width: 9px; height: 9px; border-radius: 50%; background: var(--acc-t); }
.tl li::after { content: ""; position: absolute; left: 4px; top: 1.3rem; bottom: -.1rem; width: 1px; background: var(--line); }
.tl li:last-child::after { display: none; }
.tl strong { display: block; color: var(--sc-ink); }
.tl span { display: block; font-size: .975rem; line-height: 1.75; color: var(--sc-ink-soft); }

/* services */
.svc > li { padding: 1.15rem 1.3rem; }
.svc > li + li { border-top: 1px solid var(--line); }
.svc .lead { background: var(--tint); }
.svc .k { font-size: .8125rem; font-weight: 700; color: var(--acc-t); line-height: 1.5; }
.svc h3 { font: 700 1.2rem/1.4 var(--sc-font-display); letter-spacing: -0.01em; margin: .1rem 0 .3rem; }
.svc p:not(.k) { font-size: .975rem; line-height: 1.8; color: var(--sc-ink-soft); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: .7rem; }
.tags li { padding: .1rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: .8125rem; line-height: 1.7; color: var(--sc-ink-soft); }

/* steps + plain-bubble headings */
.steps { padding: .4rem 1.3rem; }
.steps li { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .9rem; padding: .9rem 0; }
.steps li + li { border-top: 1px solid var(--line); }
.steps .n { display: grid; place-items: center; width: 2rem; height: 2rem; margin-top: .15rem; border-radius: 50%; background: var(--sc-ink); color: #fff; font: 700 .95rem/1 var(--sc-font-display); }
.b h3, .steps h3 { font-size: 1.05rem; font-weight: 700; line-height: 1.6; }
.b h3 + p, .steps p { font-size: .975rem; line-height: 1.8; color: var(--sc-ink-soft); }

/* comparison */
.cmp { width: 100%; border-collapse: collapse; font-size: .975rem; }
.cmp th, .cmp td { padding: .7rem 1.1rem; text-align: left; vertical-align: top; line-height: 1.6; }
.cmp thead th { font-size: .875rem; font-weight: 700; border-bottom: 1px solid var(--line); }
.cmp thead th:first-child, .cmp td:first-child { color: var(--ink-3); }
.cmp thead th:last-child { color: var(--acc-t); }
.cmp td:last-child { font-weight: 500; }
.cmp tbody tr + tr td { border-top: 1px solid var(--line); }

/* testimonials */
.quote { width: min(100%, 33rem); }
.quote blockquote p { font-size: 1rem; line-height: 1.85; }
.quote figcaption { margin-top: .6rem; font-size: .875rem; line-height: 1.6; color: var(--sc-ink-soft); }
.quote figcaption strong { margin-right: .5rem; color: var(--sc-ink); }

/* --------------------------------------------------------------- quiz ---- */
.qlist { margin-top: 1.2rem; padding: 0 0 0 1.4rem; list-style: decimal; }
.qlist > li { margin-top: .9rem; }
.qlist ul { padding-left: 1rem; list-style: disc; color: var(--sc-ink-soft); }
.js .qlist { display: none; }
.nojs { margin-top: 1rem; }
.flow { margin-top: 14px; }
.flow .grp { margin-top: 10px; }
.qn { display: block; margin-bottom: .1rem; font-size: .8125rem; font-weight: 700; color: var(--acc-t); }
.res { width: min(100%, 34rem); max-width: none; padding: 1.25rem 1.4rem 1.4rem; }
.res .lab { font-size: .8125rem; font-weight: 700; color: var(--acc-t); }
.res .score { margin-top: .3rem; font: 700 3.4rem/1.1 var(--sc-font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.res .score small { margin-left: .4rem; font: 500 1.05rem var(--sc-font-display); letter-spacing: 0; color: var(--sc-ink-soft); }
.res .tier { margin-top: .1rem; font-size: 1.35rem; font-weight: 700; line-height: 1.4; }
.res[data-tier="bear"] .tier { color: var(--bear); }
.res[data-tier="warn"] .tier { color: var(--warn); }
.res[data-tier="ok"]   .tier { color: var(--ok); }
.gauge { position: relative; display: flex; height: 8px; margin-top: 1.1rem; border-radius: 999px; }
.gauge span { display: block; height: 100%; }
.gauge span:nth-child(1) { flex: 40; background: #f0a9b0; border-radius: 999px 0 0 999px; }
.gauge span:nth-child(2) { flex: 30; background: #f0c477; }
.gauge span:nth-child(3) { flex: 30; background: #6cc9a4; border-radius: 0 999px 999px 0; }
.mkr { position: absolute; left: 0; top: -5px; width: 3px; height: 18px; border-radius: 2px; background: var(--sc-ink); transition: transform 700ms var(--sc-ease-out); }
.gl { display: flex; justify-content: space-between; margin-top: .5rem; font-size: .75rem; line-height: 1.4; color: var(--ink-3); }
.res .desc { margin-top: 1rem; font-size: .975rem; line-height: 1.85; color: var(--sc-ink-soft); }
.fit { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-top: 1.1rem; }
.fit h4 { margin: 0 0 .4rem; font-size: .875rem; font-weight: 700; }
.fit .y h4 { color: var(--ok); }
.fit .n h4 { color: var(--bear); }
.fit li { display: flex; gap: .5rem; font-size: .875rem; line-height: 1.65; padding: .12rem 0; }
.fit .n li { color: var(--sc-ink-soft); }
.fit li span { flex: none; font-weight: 700; }
.fit .y li span { color: var(--ok); }
.fit .n li span { color: var(--bear); }
.res .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.2rem; }
.retry { border: 0; background: none; padding: .4rem 0; font: 500 .9rem/1.4 var(--sc-font-text); color: var(--sc-ink-soft); text-decoration: underline; text-underline-offset: .22em; cursor: pointer; }
.retry:active { transform: translateY(1px); }

/* ---------------------------------------------------------------- FAQ ---- */
.faq { margin-top: 12px; padding-left: 52px; }
.faq details { margin-top: 10px; }
.faq summary { display: flex; justify-content: flex-end; list-style: none; cursor: pointer; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .b { display: inline-flex; align-items: center; gap: .7rem; max-width: min(100%, 27rem); padding: .55rem 1.1rem; background: var(--sc-surface); color: var(--acc-t); border: 1.5px solid var(--acc-t); border-radius: 999px; box-shadow: none; font-size: .975rem; font-weight: 600; line-height: 1.5; transition: background-color 140ms var(--sc-ease-out); }
.faq details[open] summary .b { background: var(--sc-accent); color: var(--sc-accent-ink); border-color: transparent; border-radius: 20px 20px 6px 20px; box-shadow: var(--sc-e1); }
@media (hover: hover) and (pointer: fine) { .faq details:not([open]) summary:hover .b { background: var(--tint); } }
.faq summary:active .b { transform: scale(0.98); }
.faq summary .b::after { content: "+"; flex: none; width: 1.1rem; text-align: center; font: 700 1.2rem/1 var(--sc-font-display); }
.faq details[open] summary .b::after { content: "−"; }
.faq .ans { margin-top: 8px; }
.faq .ans .b { max-width: min(100%, 33rem); }

/* -------------------------------------------------------------- close ---- */
.acts .btn { margin: 1rem 0 1rem 1.15rem; }
.b.acts { display: flex; flex-wrap: wrap; gap: 0 .6rem; padding: 0 1.15rem 0 0; }
.b.acts .btn:first-child { margin-left: 1.15rem; }
.b.acts .btn + .btn { margin-left: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0 0 52px; }
.chips li { font-size: .875rem; line-height: 1.7; color: var(--sc-ink-soft); }
.chips li::before { content: "✓"; margin-right: .4rem; color: var(--acc-t); font-weight: 700; }

.foot { margin-top: clamp(3.5rem, 8vw, 6rem); padding-top: 1.8rem; border-top: 1px solid var(--line); font-size: .9rem; line-height: 1.8; color: var(--sc-ink-soft); }
.foot .brand { margin-bottom: 1.4rem; color: var(--sc-ink); }
.foot .cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; margin-bottom: 1.4rem; }
.foot h2 { margin-bottom: .3rem; font-size: .875rem; font-weight: 700; color: var(--sc-ink); }
.foot nav a { display: block; padding: .1rem 0; color: inherit; text-underline-offset: .22em; }
.foot .fine { font-size: .8125rem; line-height: 1.75; color: var(--ink-3); }
.foot .fine + .fine { margin-top: .5rem; }

/* English titles are longer than the Chinese ones: a wider bubble and a step down in size keeps the opening headline to two lines. */
html[lang="en"] .b.title { max-width: min(100%, 33rem); font-size: clamp(1.5rem, 0.9rem + 2vw, 1.95rem); }
html[lang="en"] .b.title.sm { font-size: clamp(1.3rem, 0.9rem + 1.2vw, 1.6rem); }

/* --------------------------------------------------------- message box --- */
.dock { position: sticky; bottom: 0; z-index: 30; padding: 12px clamp(16px, 3vw, 32px) max(8px, env(safe-area-inset-bottom)); background: var(--sc-surface); border-top: 1px solid var(--line); }
.composer { display: flex; align-items: flex-end; gap: 8px; max-width: 44rem; margin-inline: auto; padding: 5px 6px 5px 22px; background: var(--sc-canvas); border: 1px solid var(--line); border-radius: 27px; }
.composer:focus-within { outline: 2px solid var(--acc-t); outline-offset: 2px; }
.composer textarea { display: block; flex: 1; min-width: 0; height: 44px; max-height: 7.6rem; margin: 0; padding: .65rem 0; border: 0; background: transparent; resize: none; overflow-y: auto; font: 400 1.0625rem/1.4 var(--sc-font-text); color: var(--sc-ink); outline: 0; }
.composer textarea::placeholder { color: var(--ink-3); opacity: 1; }
.send { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--sc-accent); color: var(--sc-accent-ink); cursor: pointer; transition: transform 140ms var(--sc-ease-out), background-color 140ms var(--sc-ease-out); }
@media (hover: hover) and (pointer: fine) { .send:hover { background: #00b866; } }
.hint { max-width: 44rem; margin: 6px auto 0; font-size: .78rem; line-height: 1.5; text-align: center; color: var(--ink-3); }

@media (prefers-reduced-motion: no-preference) {
  .pop { animation: pop 260ms var(--sc-ease-out) both; }
  .send.nudge { animation: nudge 520ms var(--sc-ease-out) 2; }
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes nudge { 0%, 100% { transform: none; } 45% { transform: scale(1.12); } }

/* ------------------------------------------------------------- phone ---- */
@media (max-width: 899px) {
  .app { display: block; }
  .menu { display: grid; }
  .bar { gap: 10px; padding-inline: 12px 14px; }
  .who span { display: none; }
  .wrap { padding: 20px 14px 40px; }
  .rail { position: fixed; inset: 0; height: 100dvh; transform: translateX(-100%); visibility: hidden; transition: transform 280ms var(--sc-ease-drawer), visibility 0s linear 280ms; }
  .rail.open { transform: none; visibility: visible; transition: transform 280ms var(--sc-ease-drawer); }
  .rail-close { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -10px; border: 0; background: transparent; border-radius: 50%; color: var(--sc-ink); cursor: pointer; }
  .b { font-size: 1rem; }
  .b.title { font-size: clamp(1.75rem, 8.2vw, 2.1rem); padding: .95rem 1.25rem; }
  html[lang="en"] .b.title { font-size: clamp(1.35rem, 5.9vw, 1.6rem); }
  html[lang="en"] .b.title.sm { font-size: clamp(1.25rem, 5.6vw, 1.5rem); }
  .qr, .chips, .faq { margin-left: 0; padding-left: 0; }
  .faq { margin-left: 0; }
  .grp { grid-template-columns: 34px minmax(0, 1fr); column-gap: 8px; }
  .grp .av { width: 34px; height: 34px; }
  .fit { grid-template-columns: 1fr; gap: .8rem; }
  .foot .cols { grid-template-columns: 1fr 1fr; }
  .res .score { font-size: 3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .rail, .rail.open, .mkr { transition-duration: 1ms; }
}
