/* ============================================================
   網站判頭 WebForeman — construction-foreman website brand.
   (WORKING NAME — rename = folder + strings before real domain.)

   Art direction: 貼地・硬淨・抵到笑. Flat safety-yellow #FFD100 +
   near-black ink on warm site-office paper. Hazard-stripe rules,
   dashed "site-plan" borders, spec-sheet mono. Type = Anton
   (condensed poster Latin) × Noto Sans TC 900/400 × IBM Plex Mono.
   ONE dark band (final CTA). No gradients, no emoji, no glow.

   Motion contract (accessible-motion-layer):
   - default CSS = final, fully visible state (no-JS safe)
   - ALL motion styles live under html.motion
   - foreman.js adds .motion only when prefers-reduced-motion allows
   ============================================================ */
:root {
  --yellow: #FFD100;
  --yellow-deep: #E6B800;
  --ink: #131211;
  --ink-2: #26241F;
  --paper: #F7F5F0;
  --concrete: #ECE9E2;
  --line: #D8D4C9;
  --steel: #55524B;
  --faint: #8B877C;
  --ok: #1E7A46;

  --hazard: repeating-linear-gradient(-45deg, var(--ink) 0 12px, var(--yellow) 12px 24px);
  --dash: 1.5px dashed rgba(19, 18, 17, 0.30);

  --font-display: "Anton", "Noto Sans TC", sans-serif;
  --font-cjk: "Noto Sans TC", "PingFang HK", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --container: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-cjk);
  font-size: 16.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 22px; }

::selection { background: var(--yellow); color: var(--ink); }

/* ---------- hazard rule + labels ---------- */
.fm-hazard { height: 10px; background: var(--hazard); border: 0; margin: 0; }
.fm-no {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.18em; color: var(--steel); text-transform: uppercase;
  margin: 0 0 14px;
}
.fm-no::before { content: ""; width: 26px; height: 10px; background: var(--hazard); }

/* ---------- nav ---------- */
.fm-nav {
  position: sticky; top: 0; z-index: 90;
  background: rgba(247, 245, 240, 0.92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--ink);
}
.fm-nav__inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.fm-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.fm-logo__helm { width: 30px; height: 30px; flex: none; }
.fm-logo b {
  font-family: var(--font-cjk); font-weight: 900; font-size: 18px; letter-spacing: 0.02em;
}
.fm-logo b i { font-style: normal; font-family: var(--font-display); font-weight: 400; letter-spacing: 0.04em; margin-left: 7px; font-size: 15px; color: var(--steel); }
.fm-nav__link {
  text-decoration: none; font-size: 14.5px; font-weight: 700; color: var(--steel);
  padding: 7px 4px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.fm-nav__link:hover { color: var(--ink); border-bottom-color: var(--yellow); }
.fm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--yellow); color: var(--ink); text-decoration: none;
  font-weight: 900; font-size: 15px; padding: 12px 22px;
  border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  white-space: nowrap;
}
.fm-btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.fm-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.fm-btn--ghost { background: var(--paper); }
.fm-btn--sm { padding: 9px 16px; font-size: 14px; box-shadow: 3px 3px 0 var(--ink); }
@media (prefers-reduced-motion: reduce) { .fm-btn, .fm-btn:hover, .fm-btn:active { transform: none; } }

/* scroll progress bar (hazard) — width driven by JS scaleX */
.fm-progress {
  position: absolute; left: 0; bottom: -1.5px; height: 5px; width: 100%;
  background: var(--hazard); transform-origin: 0 50%; transform: scaleX(0);
  pointer-events: none;
}
html:not(.motion) .fm-progress { display: none; }

/* ---------- hero (pinned character, swapping headlines) ---------- */
.fm-hero { position: relative; background: var(--paper); overflow: clip; }
/* blueprint grid texture */
.fm-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(19,18,17,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19,18,17,0.05) 1px, transparent 1px);
  background-size: 44px 44px;
}
html.motion .fm-hero { height: 230vh; }
.fm-hero__stage { position: relative; }
html.motion .fm-hero__stage { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; }
.fm-hero__grid {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(16px, 4vw, 56px);
  align-items: center; width: 100%; padding-top: 34px; padding-bottom: 10px;
}
.fm-hero__stack { position: relative; z-index: 2; }

.fm-panel { padding: 26px 0; }
html.motion .fm-panel { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; opacity: 0; transform: translateY(26px); will-change: opacity, transform; padding: 0; }
html.motion .fm-panel.is-live { opacity: 1; transform: none; }
html.motion .fm-hero__stack { min-height: 66vh; }

.fm-kicker {
  display: inline-block; font-family: var(--font-mono); font-weight: 700;
  font-size: 13px; letter-spacing: 0.22em; color: var(--ink);
  background: var(--yellow); padding: 4px 10px; border: 1.5px solid var(--ink);
  margin: 0 0 18px;
}
.fm-h1 {
  font-family: var(--font-cjk); font-weight: 900;
  font-size: clamp(40px, 6.6vw, 84px); line-height: 1.08; letter-spacing: 0.01em;
  margin: 0 0 20px; text-wrap: balance;
}
.fm-h1 mark { background: none; color: inherit; box-shadow: inset 0 -0.28em var(--yellow); }
.fm-h1 .en { display: block; font-family: var(--font-display); font-weight: 400; font-size: 0.5em; letter-spacing: 0.06em; color: var(--steel); margin-top: 10px; }
.fm-lead { font-size: clamp(16px, 1.7vw, 19px); color: var(--steel); max-width: 30em; margin: 0 0 26px; }
.fm-lead strong { color: var(--ink); font-weight: 900; }
.fm-hero__cta { display: flex; flex-wrap: wrap; gap: 14px; }

.fm-price-tag {
  display: inline-flex; align-items: baseline; gap: 10px;
  font-family: var(--font-mono); margin: 0 0 24px;
}
.fm-price-tag b { font-family: var(--font-display); font-weight: 400; font-size: clamp(40px, 5vw, 64px); line-height: 1; }
.fm-price-tag s { color: var(--faint); font-size: 15px; }
.fm-price-tag span { font-size: 13.5px; color: var(--steel); }

/* character column */
.fm-hero__char { position: relative; z-index: 1; display: flex; justify-content: center; align-items: flex-end; }
.fm-hero__char img {
  display: block; width: min(100%, 400px); height: auto;
  filter: drop-shadow(0 24px 34px rgba(19, 18, 17, 0.22));
  will-change: transform;
}
/* yellow ground slab behind the character */
.fm-hero__char::before {
  content: ""; position: absolute; left: 50%; bottom: -4vh; transform: translateX(-50%);
  width: min(84%, 360px); aspect-ratio: 1; border-radius: 50%;
  background: var(--yellow); z-index: -1;
  border: 2px solid var(--ink);
}
.fm-hero__hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.2em; color: var(--steel);
  display: none;
}
html.motion .fm-hero__hint { display: block; }

/* ---------- marquee (site hoarding) ---------- */
.fm-marquee { background: var(--ink); color: var(--paper); overflow: hidden; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.fm-marquee__track { display: flex; gap: 0; white-space: nowrap; width: max-content; }
.fm-marquee__seq { display: flex; align-items: center; padding: 12px 0; }
.fm-marquee__seq span { font-family: var(--font-mono); font-weight: 700; font-size: 14px; letter-spacing: 0.14em; padding: 0 26px; }
.fm-marquee__seq span::after { content: "◆"; color: var(--yellow); margin-left: 52px; font-size: 10px; }
html.motion .fm-marquee__track { animation: fm-scroll 26s linear infinite; }
@keyframes fm-scroll { to { transform: translateX(-50%); } }

/* ---------- sections ---------- */
.fm-sec { padding: clamp(64px, 9vw, 110px) 0; }
.fm-sec--concrete { background: var(--concrete); border-top: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); }
.fm-h2 {
  font-family: var(--font-cjk); font-weight: 900;
  font-size: clamp(28px, 4vw, 46px); line-height: 1.2; margin: 0 0 12px; text-wrap: balance;
}
.fm-h2 .en { font-family: var(--font-display); font-weight: 400; font-size: 0.55em; letter-spacing: 0.06em; color: var(--faint); margin-left: 14px; }
.fm-sub { color: var(--steel); font-size: 16.5px; max-width: 44em; margin: 0; }

/* reveal — default visible; hidden ONLY under html.motion pre-reveal */
html.motion [data-fr] { opacity: 0; transform: translateY(26px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1); }
html.motion [data-fr].is-in { opacity: 1; transform: none; }
html.motion [data-fr-d="1"] { transition-delay: 0.08s; }
html.motion [data-fr-d="2"] { transition-delay: 0.16s; }
html.motion [data-fr-d="3"] { transition-delay: 0.24s; }

/* ---------- services (承接工程) ---------- */
.fm-svc { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-top: 44px; }
.fm-card {
  background: var(--paper); border: 2px solid var(--ink); padding: 24px 24px 26px;
  position: relative; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 6px 6px 0 rgba(19, 18, 17, 0.14);
}
.fm-sec--concrete .fm-card { background: #FBFAF7; }
.fm-card--wide { grid-column: span 3; }
.fm-card--std { grid-column: span 2; }
html.motion .fm-card[data-tilt] { transition: transform 0.18s ease, box-shadow 0.18s ease; will-change: transform; }
.fm-card__no { font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.16em; color: var(--faint); }
.fm-card h3 { font-size: 20px; font-weight: 900; margin: 0; }
.fm-card h3 .en { font-family: var(--font-display); font-weight: 400; font-size: 13px; letter-spacing: 0.05em; color: var(--steel); margin-left: 9px; }
.fm-card p { margin: 0; font-size: 14.5px; color: var(--steel); line-height: 1.7; }
.fm-card__tag {
  position: absolute; top: -13px; right: 14px; background: var(--yellow);
  border: 1.5px solid var(--ink); font-family: var(--font-mono); font-weight: 700;
  font-size: 11.5px; letter-spacing: 0.1em; padding: 2px 9px;
}

/* ---------- process (施工流程) with site-photo column ---------- */
.fm-proc { display: grid; grid-template-columns: 1fr 0.72fr; gap: clamp(28px, 5vw, 70px); align-items: start; margin-top: 44px; }
.fm-steps { list-style: none; margin: 0; padding: 0; position: relative; }
.fm-steps::before { content: ""; position: absolute; left: 25px; top: 8px; bottom: 8px; border-left: var(--dash); }
.fm-step { position: relative; padding: 0 0 34px 76px; }
.fm-step:last-child { padding-bottom: 0; }
.fm-step__no {
  position: absolute; left: 0; top: 0; width: 52px; height: 52px;
  display: grid; place-items: center;
  background: var(--yellow); border: 2px solid var(--ink);
  font-family: var(--font-display); font-size: 22px;
}
.fm-step b { display: block; font-size: 19px; font-weight: 900; margin-bottom: 4px; }
.fm-step b .en { font-family: var(--font-mono); font-weight: 700; font-size: 12px; letter-spacing: 0.12em; color: var(--faint); margin-left: 10px; }
.fm-step p { margin: 0; font-size: 15px; color: var(--steel); }

.fm-site-photo { position: relative; border: 2px solid var(--ink); background: var(--concrete); padding: 22px 22px 16px; box-shadow: 8px 8px 0 rgba(19,18,17,0.14); }
.fm-site-photo img { display: block; width: 100%; }
.fm-site-photo figcaption { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.1em; color: var(--steel); padding-top: 12px; border-top: var(--dash); margin-top: 14px; }
.fm-site-photo::after { content: "工地實況 REC ●"; position: absolute; top: 10px; right: 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; color: #C0392B; }

/* ---------- pricing (報價單 spec sheet) ---------- */
.fm-quote-sheet {
  max-width: 720px; margin: 44px auto 0; background: #FFFEFB;
  border: 2px solid var(--ink); box-shadow: 10px 10px 0 rgba(19, 18, 17, 0.16);
}
.fm-quote-sheet__head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 26px; border-bottom: 2px solid var(--ink); background: var(--yellow);
}
.fm-quote-sheet__head b { font-weight: 900; font-size: 17px; }
.fm-quote-sheet__head span { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.12em; }
.fm-quote-rows { padding: 10px 26px; }
.fm-qrow { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; padding: 13px 0; border-bottom: var(--dash); font-size: 15.5px; }
.fm-qrow:last-child { border-bottom: 0; }
.fm-qrow .k { color: var(--steel); }
.fm-qrow .v { font-family: var(--font-mono); font-weight: 700; text-align: right; }
.fm-qrow .v s { color: var(--faint); font-weight: 400; margin-right: 8px; }
.fm-qrow--total { border-top: 2px solid var(--ink); margin-top: 4px; }
.fm-qrow--total .k { color: var(--ink); font-weight: 900; }
.fm-qrow--total .v { font-family: var(--font-display); font-size: 34px; }
.fm-quote-sheet__foot { padding: 18px 26px 24px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; border-top: 2px solid var(--ink); }
.fm-quote-sheet__foot small { font-family: var(--font-mono); font-size: 12px; color: var(--steel); letter-spacing: 0.04em; }

/* ---------- guarantees (判頭保養) ---------- */
.fm-vows { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 44px; }
.fm-vow { border-top: 4px solid var(--ink); padding-top: 16px; }
.fm-vow i { font-style: normal; font-family: var(--font-display); font-size: clamp(30px, 3.4vw, 44px); line-height: 1; display: block; margin-bottom: 8px; }
.fm-vow i small { font-size: 0.45em; font-family: var(--font-mono); letter-spacing: 0.06em; }
.fm-vow b { display: block; font-size: 16.5px; font-weight: 900; margin-bottom: 3px; }
.fm-vow p { margin: 0; font-size: 14px; color: var(--steel); line-height: 1.65; }

/* ---------- cases ---------- */
.fm-cases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 44px; }
.fm-case { position: relative; border: 2px solid var(--ink); background: #fff; text-decoration: none; overflow: hidden; box-shadow: 6px 6px 0 rgba(19,18,17,0.14); }
.fm-case:first-child { grid-column: span 2; grid-row: span 2; }
.fm-case img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; aspect-ratio: 16 / 11; }
.fm-case:first-child img { aspect-ratio: auto; min-height: 100%; }
.fm-case b {
  position: absolute; left: 0; bottom: 0; right: 0;
  background: rgba(19, 18, 17, 0.88); color: var(--paper);
  font-family: var(--font-mono); font-weight: 700; font-size: 12.5px; letter-spacing: 0.08em;
  padding: 9px 13px;
}
html.motion .fm-case img { transition: transform 0.35s ease; }
html.motion .fm-case:hover img { transform: scale(1.04); }

/* ---------- dark CTA ---------- */
.fm-cta { background: var(--ink); color: var(--paper); position: relative; overflow: clip; }
.fm-cta .fm-hazard { position: absolute; top: 0; left: 0; right: 0; }
.fm-cta__grid { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 5vw, 64px); align-items: end; padding-top: clamp(56px, 8vw, 90px); }
.fm-cta__char img { display: block; width: min(30vw, 300px); filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.5)); }
.fm-cta__body { padding-bottom: clamp(48px, 7vw, 84px); }
.fm-cta h2 { font-family: var(--font-cjk); font-weight: 900; font-size: clamp(30px, 4.4vw, 54px); line-height: 1.16; margin: 0 0 14px; color: #fff; text-wrap: balance; }
.fm-cta h2 mark { background: none; color: var(--yellow); }
.fm-cta p { color: rgba(247, 245, 240, 0.72); max-width: 36em; margin: 0 0 28px; }
.fm-cta .fm-btn { box-shadow: 4px 4px 0 var(--yellow); border-color: var(--yellow); }
.fm-cta .fm-btn--ghost { background: transparent; color: var(--paper); }

/* ---------- footer ---------- */
.fm-foot { background: var(--ink); color: var(--faint); border-top: 1px solid rgba(247, 245, 240, 0.16); }
.fm-foot__inner { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: center; justify-content: space-between; padding: 22px 0; font-size: 13px; }
.fm-foot a { color: rgba(247, 245, 240, 0.75); text-decoration: none; }
.fm-foot a:hover { color: var(--yellow); }
.fm-foot__links { display: flex; flex-wrap: wrap; gap: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .fm-nav__link { display: none; }
  .fm-hero__grid { grid-template-columns: 1fr; }
  .fm-hero__char { order: -1; }
  .fm-hero__char img { width: min(58vw, 300px); max-height: 46vh; object-fit: contain; }
  html.motion .fm-hero { height: 200vh; }
  html.motion .fm-hero__stack { min-height: 46vh; }
  .fm-svc { grid-template-columns: 1fr 1fr; }
  .fm-card--wide, .fm-card--std { grid-column: span 1; }
  .fm-proc { grid-template-columns: 1fr; }
  .fm-site-photo { max-width: 440px; }
  .fm-vows { grid-template-columns: 1fr 1fr; }
  .fm-cases { grid-template-columns: 1fr 1fr; }
  .fm-case:first-child { grid-column: span 2; grid-row: span 1; }
  .fm-cta__grid { grid-template-columns: 1fr; }
  .fm-cta__char { order: 2; display: flex; justify-content: flex-end; }
  .fm-cta__char img { width: min(46vw, 240px); }
  .fm-cta__body { padding-bottom: 0; }
}
@media (max-width: 560px) {
  .fm-svc, .fm-vows { grid-template-columns: 1fr; }
  .fm-h1 { font-size: clamp(34px, 10.5vw, 44px); }
  .fm-quote-sheet__foot { flex-direction: column; align-items: stretch; }
  .fm-quote-sheet__foot .fm-btn { width: 100%; }
}
