/* ---------- Reset & tokens ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

:root {
  --bg:        #faf9f7;
  --bg-soft:   #f2f0ec;
  --card:      #ffffff;
  --ink:       #16191c;
  --ink-2:     #4a5158;
  --ink-3:     #7c848c;
  --line:      #e2ddd6;
  --accent:    #1f5f5b;
  --accent-2:  #2e8b84;
  --accent-bg: #e7f0ef;
  --warn:      #a8621c;
  --warn-bg:   #fbf1e4;
  --radius: 12px;
  --maxw: 1080px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #101315;
    --bg-soft:   #171b1e;
    --card:      #1a1f22;
    --ink:       #eef1f2;
    --ink-2:     #a9b3b8;
    --ink-3:     #79848a;
    --line:      #2a3135;
    --accent:    #6fd3c6;
    --accent-2:  #8ee0d4;
    --accent-bg: #16302e;
    --warn:      #e5aa63;
    --warn-bg:   #2c2317;
  }
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
               "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }

section { padding: 72px 0; }
section + section { border-top: 1px solid var(--line); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { line-height: 1.35; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); }
h2 { font-size: clamp(1.35rem, 2.8vw, 1.8rem); margin-bottom: 8px; }
h3 { font-size: 1.1rem; margin-bottom: 6px; }
p  { color: var(--ink-2); }
p + p { margin-top: 14px; }

.eyebrow {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
  font-family: var(--mono);
}
.lede { font-size: 1.06rem; color: var(--ink-2); }
.section-note { color: var(--ink-3); font-size: 0.92rem; margin-bottom: 32px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-in {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 18px; margin-left: auto; flex-wrap: wrap; }
.nav-links a { color: var(--ink-2); font-size: 0.92rem; }
.nav-links a:hover { color: var(--accent); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 72px; }
.hero h1 { margin: 14px 0 20px; max-width: 20ch; }
.hero .lede { max-width: 62ch; font-size: 1.12rem; }
.hero-meta {
  margin-top: 34px; display: flex; gap: 10px; flex-wrap: wrap;
}
.chip {
  font-size: 0.82rem; padding: 5px 12px; border-radius: 999px;
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  font-weight: 600;
}

/* ---------- Stat strip ---------- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-top: 44px;
}
.stat { background: var(--card); padding: 20px 18px; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.85rem; color: var(--ink-3); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
}

.case-card {
  display: block; color: inherit; position: relative;
  transition: border-color .18s ease, transform .18s ease;
}
.case-card:hover {
  text-decoration: none; border-color: var(--accent); transform: translateY(-2px);
}
.case-card .num {
  font-family: var(--mono); font-size: 0.76rem; color: var(--ink-3);
  letter-spacing: 0.1em;
}
.case-card h3 { margin: 6px 0 8px; color: var(--ink); font-size: 1.18rem; }
.case-card p { font-size: 0.94rem; }
.case-card .tags { margin-top: 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 0.74rem; padding: 3px 9px; border-radius: 5px;
  background: var(--bg-soft); color: var(--ink-3); border: 1px solid var(--line);
  font-family: var(--mono);
}
.case-card .go { margin-top: 16px; font-size: 0.88rem; color: var(--accent); font-weight: 600; }

/* ---------- Case page ---------- */
.case-head { padding: 56px 0 40px; }
.case-head h1 { margin: 12px 0 16px; }
.back { font-size: 0.88rem; color: var(--ink-3); }

.meta-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line);
}
.meta-row div span { display: block; font-size: 0.76rem; color: var(--ink-3);
  font-family: var(--mono); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; }
.meta-row div b { font-size: 0.94rem; font-weight: 600; }

.block { margin-bottom: 44px; }
.block > h2 { margin-bottom: 14px; }

ul, ol { color: var(--ink-2); padding-left: 1.3em; }
li { margin-bottom: 8px; }
li::marker { color: var(--ink-3); }
li strong { color: var(--ink); }

/* Callouts */
.note, .caution {
  border-left: 3px solid var(--accent); background: var(--accent-bg);
  padding: 16px 20px; border-radius: 0 8px 8px 0; margin: 20px 0;
}
.note p, .caution p { color: var(--ink-2); }
.note b, .caution b { color: var(--ink); }
.caution { border-left-color: var(--warn); background: var(--warn-bg); }

/* Steps */
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li {
  counter-increment: s; position: relative; padding-left: 44px; margin-bottom: 20px;
}
.steps li::before {
  content: counter(s, decimal-leading-zero);
  position: absolute; left: 0; top: 2px;
  font-family: var(--mono); font-size: 0.8rem; font-weight: 700;
  color: var(--accent); background: var(--accent-bg);
  width: 30px; height: 26px; display: grid; place-items: center; border-radius: 6px;
}
.steps li b { display: block; color: var(--ink); margin-bottom: 2px; }

/* Flow diagram */
.flow {
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.9;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin: 20px 0;
  overflow-x: auto; white-space: pre; color: var(--ink-2);
}

/* Table */
.table-wrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; min-width: 480px; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-soft); font-weight: 700; font-size: 0.82rem;
     letter-spacing: 0.04em; color: var(--ink-2); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td code { font-family: var(--mono); font-size: 0.85em; background: var(--bg-soft);
          padding: 1px 5px; border-radius: 4px; }

/* Result stats inside case */
.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(152px, 1fr)); gap: 14px; margin: 20px 0; }
.result {
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding: 18px 20px;
}
.result b { display: block; font-size: 1.3rem; color: var(--ink); line-height: 1.3; }
.result span { font-size: 0.85rem; color: var(--ink-3); }

/* Placeholder for numbers only the owner knows */
.fill {
  border-bottom: 2px dashed var(--warn); color: var(--warn);
  font-weight: 700; padding-bottom: 1px;
}

/* Pager */
.pager {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 32px 0; border-top: 1px solid var(--line); margin-top: 20px;
}
.pager a { font-size: 0.92rem; font-weight: 600; }

/* Footer */
footer { border-top: 1px solid var(--line); padding: 40px 0 56px; }
footer p { font-size: 0.88rem; color: var(--ink-3); }

/* Method timeline */
.method { list-style: none; padding: 0; counter-reset: m; }
.method li {
  counter-increment: m; padding: 16px 0 16px 52px; position: relative;
  border-bottom: 1px solid var(--line);
}
.method li:last-child { border-bottom: none; }
.method li::before {
  content: counter(m); position: absolute; left: 0; top: 16px;
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--bg); font-weight: 700; font-size: 0.85rem;
  font-family: var(--mono);
}
.method li b { display: block; color: var(--ink); }

@media (max-width: 640px) {
  section { padding: 52px 0; }
  .hero { padding: 56px 0 48px; }
  .wrap { padding: 0 18px; }
}

/* ---------- Recon Room additions ---------- */
.btns { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.btn {
  display: inline-block; padding: 11px 20px; border-radius: 9px; font-weight: 700;
  font-size: 0.95rem; border: 1.5px solid var(--accent); color: var(--accent); background: transparent;
}
.btn:hover { text-decoration: none; background: var(--accent-bg); }
.btn.primary { background: var(--accent); color: var(--bg); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }

.alert {
  display: inline-block; font-size: 0.86rem; padding: 6px 12px; border-radius: 8px;
  background: var(--warn-bg); color: var(--warn); font-weight: 600; margin-bottom: 6px;
}

.price { display: flex; flex-direction: column; }
.price .tier { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.1em; color: var(--ink-3); }
.price .amt { font-size: 1.7rem; font-weight: 700; color: var(--ink); margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.price .amt small { font-size: 0.85rem; font-weight: 600; color: var(--ink-3); }
.price .was { font-size: 0.85rem; color: var(--ink-3); text-decoration: line-through; }
.price ul { margin-top: 14px; font-size: 0.92rem; flex: 1; }
.price .btn { margin-top: 18px; text-align: center; }
.price.hl { border: 2px solid var(--accent); }

details { border-bottom: 1px solid var(--line); padding: 16px 0; }
details summary { cursor: pointer; font-weight: 700; color: var(--ink); list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "＋"; color: var(--accent); margin-right: 10px; font-family: var(--mono); }
details[open] summary::before { content: "－"; }
details p { margin-top: 10px; }

/* Calculator */
.calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 28px; }
.field { margin-bottom: 20px; }
.field label { display: block; font-weight: 700; color: var(--ink); font-size: 0.95rem; margin-bottom: 4px; }
.field .hint { font-size: 0.82rem; color: var(--ink-3); margin-bottom: 8px; }
.field input[type=number] {
  width: 100%; padding: 10px 12px; font-size: 1rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums;
}
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.field .val { font-family: var(--mono); color: var(--accent); font-weight: 700; }
.out .big { font-size: 2.2rem; font-weight: 700; color: var(--ink); line-height: 1.2; font-variant-numeric: tabular-nums; }
.out .row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.94rem; }
.out .row span { color: var(--ink-3); }
.out .row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.out .waste { background: var(--warn-bg); border-radius: 10px; padding: 16px 18px; margin-top: 18px; }
.out .waste b { color: var(--warn); font-size: 1.5rem; display: block; font-variant-numeric: tabular-nums; }
.out .waste span { color: var(--ink-2); font-size: 0.9rem; }

/* ---------- Refinement layer ---------- */
h1, h2, .price .amt, .stat b, .result b, .out .big {
  font-family: "Noto Serif TC", "Songti TC", serif; font-weight: 700; letter-spacing: 0;
}
.brand { display: inline-flex; align-items: center; gap: 9px; }
.brand svg { width: 22px; height: 22px; flex: none; }

.eyebrow { display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 18px; height: 1.5px; background: var(--accent); }

/* ledger-paper backdrop + soft glow on hero */
.hero, .case-head { position: relative; isolation: isolate; overflow: hidden; }
.hero::before, .case-head::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px; opacity: .45;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 80% 20%, #000 0%, transparent 70%);
          mask-image: radial-gradient(ellipse 70% 80% at 80% 20%, #000 0%, transparent 70%);
}
.hero::after {
  content: ""; position: absolute; z-index: -1; width: 520px; height: 520px; right: -140px; top: -160px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 65%);
}

.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 36px; } }

/* sample audit card */
.ledger {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 22px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 18px 40px -18px color-mix(in srgb, var(--accent) 35%, transparent);
  position: relative;
}
.ledger::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 14px 14px 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.ledger .lh { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.ledger .lh b { font-size: .95rem; color: var(--ink); }
.ledger .lh span { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); letter-spacing: .08em; }
.bar-seg { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.bar-seg i { display: block; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin: 10px 0 14px; font-size: .8rem; color: var(--ink-2); }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--c); }
.ledger .ln { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px dashed var(--line); font-size: .88rem; }
.ledger .ln span { color: var(--ink-3); }
.ledger .ln b { font-family: var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.ledger .ln.warn b { color: var(--warn); }
.ledger .stamp {
  margin-top: 12px; font-size: .82rem; color: var(--accent); background: var(--accent-bg);
  border-radius: 8px; padding: 8px 12px; font-weight: 600;
}
.ledger .cap { font-size: .72rem; color: var(--ink-3); margin-top: 10px; }

/* alternating section tone */
section.soft { background: var(--bg-soft); }

/* steps: connector line */
.steps li:not(:last-child)::after {
  content: ""; position: absolute; left: 15px; top: 32px; bottom: -16px; width: 1px; background: var(--line);
}

/* cards: quiet hover + icon */
.card { transition: border-color .18s ease, box-shadow .18s ease; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 10px 28px -16px rgba(0,0,0,.18); }
.ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-bg); display: grid; place-items: center; margin-bottom: 14px; }
.ico svg { width: 20px; height: 20px; stroke: var(--accent); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.stats { box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.stat b { color: var(--accent); }
.price.hl { position: relative; }
.price.hl::after {
  content: "推薦"; position: absolute; top: -11px; right: 18px; font-size: .74rem; font-weight: 700;
  background: var(--accent); color: var(--bg); padding: 2px 10px; border-radius: 999px;
}
.hero-grid h1 { max-width: none; font-size: clamp(1.8rem, 3.6vw, 2.5rem); }
.hero-grid h1 .k { display: inline-block; }
/* logo */
.brand { gap: 10px; }
.brand svg.mark { width: 30px; height: 30px; }
.brand .wm { font-family: "Noto Serif TC", Georgia, serif; font-weight: 700; font-size: 1.12rem; letter-spacing: .01em; }
.brand .tg {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .18em; color: var(--ink-3); font-weight: 500;
  padding-left: 10px; border-left: 1px solid var(--line);
}
@media (max-width: 420px) { .brand .tg { display: none; } }
