/* Layout: app shell. Phone = sticky top logo bar + fixed bottom tab bar; wide = tabs move into the top bar.
   Palette comes from the job site: fibre-cement grey, galvanised steel, red-oxide structural steel, the group's gold. */
:root {
  --bg: #eceeed;
  --surface: #ffffff;
  --surface-2: #dfe3e2;
  --ink: #16212b;
  --ink-2: #4c5a66;
  --line: #c9cfd0;
  --gold: #a87a12;
  --oxide: #a3412c;
  --green: #23704f;
  --bar: #16212b;
  --bar-ink: #eceeed;
  --logo-bg: #f4efe6;
  --on-accent: #ffffff;
  --steel: #8d9aa3;
  --brick: #f1f1ec;
  --glue: #b9a37a;
  --board: #b4bbbd;
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --num: "DIN Alternate", "Bahnschrift", "Roboto Condensed", "Arial Narrow", var(--font);
  --tabbar-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10171d;
    --surface: #1a242d;
    --surface-2: #243039;
    --ink: #e8ecec;
    --ink-2: #a3b0b8;
    --line: #34424d;
    --gold: #d9aa3c;
    --oxide: #e0785f;
    --green: #5fbf93;
    --bar: #0b1116;
    --bar-ink: #e8ecec;
    --on-accent: #10171d;
    --steel: #6f7d87;
    --brick: #cfd3cf;
    --glue: #a48d62;
    --board: #8b9498;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.7 var(--font);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}
img, video { max-width: 100%; display: block; }
img { height: auto; }
[hidden] { display: none !important; }
h1, h2, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2 { text-wrap: balance; line-height: 1.3; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  background: var(--bar);
}
.brand img { height: 30px; width: auto; background: var(--logo-bg); padding: 4px 10px; border-radius: 3px; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--bar);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabbar-h);
  color: var(--bar-ink); opacity: .62;
  font-size: 11px; text-decoration: none; white-space: nowrap;
  border-top: 3px solid transparent;
}
.tabs svg { width: 22px; height: 22px; fill: currentColor; }
.tabs a[aria-current="page"] { opacity: 1; border-top-color: var(--gold); }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px 40px; display: flex; flex-direction: column; gap: 44px; }
.block { display: flex; flex-direction: column; gap: 14px; }
.block > h2 { font-size: 1.35rem; }
.sub { color: var(--ink-2); font-size: .95rem; max-width: 38em; }
.note { color: var(--ink-2); font-size: .85rem; border-left: 3px solid var(--line); padding-left: 12px; max-width: 44em; }
.eyebrow { font-size: .8rem; letter-spacing: .14em; color: var(--gold); font-weight: 600; }
.eyebrow.green { color: var(--green); }
.lede { color: var(--ink-2); max-width: 34em; }
.view-head { padding-top: 28px; display: flex; flex-direction: column; gap: 10px; }
.view-head h1 { font-size: clamp(1.7rem, 6vw, 2.5rem); }
video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  background: var(--ink); color: var(--bg);
  border: 2px solid var(--ink); border-radius: 3px;
  font: 600 1rem var(--font); text-decoration: none; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--ink); }
.btn:disabled { opacity: .35; cursor: default; }
.next { display: flex; flex-wrap: wrap; gap: 12px; }
.next .btn { flex: 1 1 200px; }

/* ---------- home ---------- */
.hero { position: relative; background: var(--bar); margin-bottom: 24px; }
.hero img { width: 100%; height: clamp(220px, 46vw, 460px); object-fit: cover; object-position: 40% 30%; }
.hero-text { padding: 22px 16px 28px; max-width: 960px; margin: 0 auto; color: var(--bar-ink); display: flex; flex-direction: column; gap: 10px; }
.hero-text h1 { font-size: clamp(2.1rem, 9vw, 3.6rem); line-height: 1.2; letter-spacing: .02em; }
.hero-text .lede { color: var(--bar-ink); opacity: .82; }
.hero-text .eyebrow { color: #d9aa3c; }

.figures { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 2px solid var(--ink); }
.figures li { padding: 16px 12px 18px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.figures li:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
.figures b, .perf b { font: 700 3rem/1.05 var(--num); color: var(--oxide); font-variant-numeric: tabular-nums; }
.figures b i, .perf b i { font: 600 1rem var(--font); margin-left: 3px; }
.figures .eco b { color: var(--green); }
.figures strong { font-size: 1.05rem; margin-top: 4px; }
.figures span { color: var(--ink-2); font-size: .85rem; line-height: 1.5; }

.problems { display: grid; gap: 0; border-top: 1px solid var(--line); }
.problems li { display: grid; grid-template-columns: 7.5em 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.problems strong { color: var(--oxide); }
.problems span { color: var(--ink-2); font-size: .95rem; min-width: 0; }
.answer { font-weight: 600; max-width: 34em; }

.proof { background: var(--surface); margin: 0 -16px; padding: 0 0 20px; gap: 16px; }
.proof-photo img { width: 100%; height: clamp(150px, 32vw, 300px); object-fit: cover; }
.proof-text { padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.proof-text h2 { font-size: 1.4rem; }
.proof-text .num { font: 700 2.4rem/1 var(--num); color: var(--oxide); }
.proof-text p:last-child { color: var(--ink-2); max-width: 34em; }
.proof video { width: calc(100% - 32px); margin: 0 16px; }

/* ---------- method ---------- */
.stepper { background: var(--surface); margin: 0 -16px; display: flex; flex-direction: column; }
.step-stage { position: relative; background: #000; }
.step-stage img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.step-where { position: absolute; left: 12px; top: 12px; background: var(--bar); color: var(--bar-ink); font-size: .8rem; font-weight: 600; padding: 2px 10px; letter-spacing: .1em; }
.step-dots { display: flex; gap: 4px; padding: 12px 16px 0; }
.step-dots button { flex: 1; height: 26px; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; }
.step-dots button::after { content: ""; position: absolute; left: 0; right: 0; top: 11px; height: 4px; background: var(--line); }
.step-dots button.done::after { background: var(--ink-2); }
.step-dots button[aria-current="step"]::after { background: var(--oxide); height: 6px; top: 10px; }
.step-body { padding: 8px 16px 0; display: flex; flex-direction: column; gap: 6px; min-height: 10.5em; }
.step-count { font: 600 .9rem var(--num); color: var(--oxide); letter-spacing: .08em; }
.step-body h2 { font-size: 1.3rem; }
.step-body p:last-child { color: var(--ink-2); max-width: 36em; }
.step-nav { display: flex; gap: 12px; padding: 12px 16px 18px; }
.step-nav .btn { flex: 1; }

.anatomy { display: grid; gap: 18px; align-items: center; }
.anatomy svg { width: 100%; max-width: 380px; height: auto; margin: 0 auto; }
.l-board { fill: var(--board); }
.l-glue { fill: var(--glue); }
.l-brick { fill: var(--brick); }
.l-steel { fill: var(--steel); }
.l-joint { fill: none; stroke: var(--board); stroke-width: 1.5; }
.l-dim { fill: none; stroke: var(--ink-2); stroke-width: 1; }
.l-dimtext { font: 600 12px var(--num); fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-width: 6px; }
.l-label { font: 11px var(--font); fill: var(--ink-2); }
.layers { display: grid; gap: 12px; }
.layers li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; }
.layers .sw { width: 22px; height: 22px; margin-top: 4px; border: 1px solid var(--ink-2); background: currentColor; }
.sw.l-steel { background: var(--steel); } .sw.l-brick { background: var(--brick); }
.sw.l-glue { background: var(--glue); } .sw.l-board { background: var(--board); }
.layers div { display: flex; flex-direction: column; min-width: 0; }
.layers span { color: var(--ink-2); font-size: .92rem; }

.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.gallery figure { cursor: zoom-in; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
figcaption { font-size: .85rem; color: var(--ink-2); padding-top: 4px; line-height: 1.5; }
.onsite { display: grid; gap: 14px; }
.onsite img { width: 100%; }
.onsite .tall img { aspect-ratio: 4 / 5; object-fit: cover; }

/* ---------- compare ---------- */
.bars { display: grid; gap: 14px; }
.bar-row { display: grid; gap: 4px; }
.bar-row header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bar-row header b { font: 700 1.05rem var(--num); color: var(--oxide); white-space: nowrap; }
.bar-track { position: relative; height: 22px; background: var(--surface-2); background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--line) 6px 7px); }
.bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--ink); transition: width .5s ease; }
.bar-key { display: flex; gap: 16px; font-size: .8rem; color: var(--ink-2); }
.bar-key i { display: inline-block; width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; }
.bar-key .k-new { background: var(--ink); }
.bar-key .k-rc { background: var(--surface-2); background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--line) 3px 4px); }

.calc { background: var(--surface); margin: 0 -16px; padding: 22px 16px; }
.calc-form { display: grid; gap: 8px; max-width: 520px; }
.calc-form label { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; margin-top: 6px; }
.calc-form output { font: 700 1.2rem var(--num); color: var(--oxide); }
.calc-form input[type="range"] { width: 100%; accent-color: var(--oxide); height: 32px; }
.calc-form input[type="number"] { font: 600 1.1rem var(--num); padding: 10px 12px; border: 2px solid var(--line); border-radius: 3px; background: var(--bg); color: var(--ink); width: 100%; }
.calc-out { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.calc-out div { border-top: 3px solid var(--oxide); padding-top: 8px; display: flex; flex-direction: column; }
.calc-out span { font-size: .85rem; color: var(--ink-2); }
.calc-out b { font: 700 1.9rem/1.2 var(--num); font-variant-numeric: tabular-nums; }
.calc-out em { font-style: normal; color: var(--green); font-weight: 600; font-size: .92rem; }

.table-scroll { overflow-x: auto; }
.cmp { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 330px; }
.cmp th, .cmp td { text-align: left; vertical-align: top; padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.cmp thead th { font-size: .8rem; color: var(--ink-2); border-bottom: 2px solid var(--ink); font-weight: 600; }
.cmp tbody th { white-space: nowrap; font-weight: 600; }
.cmp td:nth-child(2) { font-weight: 600; }
.cmp td:nth-child(3) { color: var(--ink-2); }
.quake td, .quake th { font-variant-numeric: tabular-nums; }

.perf { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; border-top: 2px solid var(--ink); }
.perf li { display: flex; flex-direction: column; padding: 14px 10px 16px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.perf li:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
.perf b { font-size: 2.3rem; color: var(--ink); }
.perf strong { color: var(--oxide); }
.perf span { color: var(--ink-2); font-size: .85rem; line-height: 1.5; }

/* ---------- green ---------- */
.split-bar { display: flex; height: 56px; font-size: .78rem; font-weight: 600; line-height: 1.2; }
.split-bar span { display: flex; align-items: center; padding: 0 8px; min-width: 0; overflow: hidden; }
.s-use { background: var(--green); color: var(--on-accent); }
.s-emb { background: var(--oxide); color: var(--on-accent); }
.s-rest { background: var(--surface-2); color: var(--ink-2); }
.green-list { display: grid; gap: 0; border-top: 2px solid var(--green); }
.green-list li { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.green-list strong { color: var(--green); font-size: 1.05rem; }
.green-list span { color: var(--ink-2); max-width: 40em; }
.timeline { display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 3.4em 1fr; gap: 14px; padding-bottom: 16px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 3.4em; margin-left: 6px; top: 8px; bottom: -8px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline time { font: 700 1.1rem var(--num); color: var(--green); }
.timeline div { display: flex; flex-direction: column; padding-left: 16px; position: relative; min-width: 0; }
.timeline div::before { content: ""; position: absolute; left: -13px; top: 8px; width: 12px; height: 12px; background: var(--green); border-radius: 50%; }
.timeline span { color: var(--ink-2); font-size: .92rem; }

/* ---------- about ---------- */
.patents { display: grid; gap: 22px; }
.patents article { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: start; }
.patents .zoom { padding: 0; border: 1px solid var(--line); background: var(--surface); cursor: zoom-in; }
.patents h2 { font-size: 1.15rem; }
.patents article div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.patent-no { font: 700 .95rem var(--num); color: var(--gold); letter-spacing: .04em; }
.patent-term { font-size: .85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { border: 1.5px solid var(--ink); padding: 4px 12px; font-size: .92rem; font-weight: 600; }
.faq { border-top: 2px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 14px 28px 14px 0; font-weight: 600; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font: 400 1.5rem var(--num); color: var(--oxide); }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 0 16px; color: var(--ink-2); max-width: 40em; }
.team { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 16px; }
.team li { display: flex; flex-direction: column; border-left: 3px solid var(--gold); padding-left: 10px; }
.team span { font-size: .85rem; color: var(--ink-2); }
.contact { background: var(--bar); color: var(--bar-ink); margin: 0 -16px; padding: 26px 16px; }
.contact dl { display: grid; gap: 10px; }
.contact dl div { display: grid; grid-template-columns: 3.5em 1fr; gap: 12px; }
.contact dt { opacity: .6; font-size: .9rem; }
.contact dd { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.contact a { color: #d9aa3c; }
.contact .site-link { background: #d9aa3c; border-color: #d9aa3c; color: #16212b; align-self: flex-start; margin-top: 6px; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 16, .94); display: flex; align-items: center; justify-content: center; padding: 56px 12px 20px; }
.lightbox img { max-height: 100%; max-width: 100%; object-fit: contain; }
.lightbox button { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px; min-height: 40px; padding: 0 16px; background: transparent; color: #fff; border: 1.5px solid #fff; border-radius: 3px; font: 600 .95rem var(--font); cursor: pointer; }

/* ---------- wide screens ---------- */
@media (min-width: 860px) {
  body { padding-bottom: 0; font-size: 17px; }
  .topbar { padding-inline: max(24px, calc((100vw - 960px) / 2)); }
  .tabs { position: static; display: flex; gap: 4px; background: none; padding: 0; }
  .tabs a { flex-direction: row; gap: 6px; height: 44px; padding: 0 12px; font-size: .9rem; border-top: 0; border-bottom: 3px solid transparent; }
  .tabs a[aria-current="page"] { border-bottom-color: var(--gold); }
  .tabs svg { width: 18px; height: 18px; }
  .hero { display: grid; grid-template-columns: 1fr 1.25fr; align-items: stretch; }
  .hero img { order: 2; height: 100%; min-height: 440px; }
  .hero-text { justify-content: center; padding: 40px 32px 40px max(24px, calc((100vw - 960px) / 2)); margin: 0; }
  .hero-text h1 { font-size: 3.4rem; }
  .figures, .perf { grid-template-columns: repeat(4, 1fr); }
  .perf { grid-template-columns: repeat(3, 1fr); }
  .figures li, .perf li { padding-left: 14px; border-left: 1px solid var(--line); }
  .figures li:first-child, .perf li:nth-child(3n+1) { padding-left: 0; border-left: 0; }
  .proof, .stepper, .calc, .contact { margin: 0; }
  .proof { display: grid; grid-template-columns: 1fr 1fr; padding: 0; align-items: center; }
  .proof-photo { grid-column: 1 / -1; }
  .proof-text { padding: 8px 24px 24px; }
  .proof video { width: auto; margin: 8px 24px 24px 0; }
  .stepper { display: grid; grid-template-columns: 1.5fr 1fr; grid-template-rows: auto 1fr auto; }
  .step-stage { grid-row: 1 / -1; }
  .step-stage img { height: 100%; }
  .anatomy { grid-template-columns: 380px 1fr; gap: 32px; }
  .gallery { grid-template-columns: repeat(4, 1fr); }
  .onsite { grid-template-columns: 2fr 1fr; align-items: start; }
  .patents { grid-template-columns: 1fr 1fr; }
  .calc, .contact { padding: 28px; }
  .next .btn { flex: 0 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
}
