/* Beat 1 — Hero */
.hero {
  position: relative;
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  overflow: clip;
  padding: 72px 0 88px;
  /* 讓 body 格線貫穿標題與 01 Services,桌面/手機同一層 */
  background-color: transparent !important;
}

.hero-grid {
  display: none;
}

.hero-annos {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform;
}

.anno {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-60);
  text-transform: uppercase;
}

.crosshair {
  position: absolute;
  width: 14px;
  height: 14px;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: var(--ink);
}

.crosshair::before {
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  transform: translateX(-50%);
}

.crosshair::after {
  top: 50%;
  left: 0;
  height: 1px;
  width: 100%;
  transform: translateY(-50%);
}

.dim-anno {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 0;
}

.dim-anno i {
  position: relative;
  display: block;
  width: 72px;
  height: 1px;
  background: var(--accent);
}

.dim-anno i::before,
.dim-anno i::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
}

.hero-origin {
  position: absolute;
  left: max(24px, calc((100% - 1180px) / 2));
  bottom: 24px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-60);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: min(920px, 100%);
}

.hero-title {
  margin: 0;
  font-size: clamp(2.05rem, 5.4vw, 4.35rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.18;
  max-width: 6.6em;
}

html[lang="en"] .hero-title {
  max-width: 10.5em;
}

.hero-title .line:empty {
  display: none;
}

.hero-title .line {
  display: block;
}

.headline-dim {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 22px;
  transform-origin: left center;
}

.headline-dim .dim-rule {
  display: block;
  height: 1px;
  flex: 1;
  max-width: 280px;
  background: var(--accent);
  transform-origin: left center;
}

.headline-dim .dim-cap {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-60);
}

.hero-sub {
  margin: 0 0 28px;
  max-width: 36em;
  color: var(--ink-60);
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 28px;
}

html.js:not(.is-booted) .hero-title .line,
html.js:not(.is-booted) .headline-dim,
html.js:not(.is-booted) .hero-sub,
html.js:not(.is-booted) .hero-cta,
html.js:not(.is-booted) .hero-annos {
  opacity: 0;
}

/* Beat 2 — Services */
.services {
  padding: 96px 0 80px;
  position: relative;
}

.services-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px 20px;
  align-items: start;
}

.svc {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--ink);
  padding: 28px 24px 24px;
  overflow: visible;
}

.svc-lg { min-height: 280px; }
.svc-sm { min-height: 200px; }

.svc:nth-child(2) { margin-top: 48px; }
.svc:nth-child(3) { margin-top: -12px; }
.svc:nth-child(4) { margin-top: 48px; }
.svc:nth-child(5) { margin-top: -12px; }

.svc-idx {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-60);
  margin-bottom: 28px;
}

.svc h3 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.svc-en {
  display: block;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-60);
  margin-bottom: 14px;
  text-transform: uppercase;
}

.svc p {
  margin: 0 0 20px;
  color: var(--ink-60);
  font-size: 14px;
}

.svc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.svc-tags li {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  border: 1px solid var(--line-mid);
  padding: 4px 8px;
}

/* Beat 3 — Signature */
.signature {
  padding: 40px 0 0;
}

.sig-scroll {
  height: 400vh;
  position: relative;
}

.sig-sticky {
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  display: flex;
  flex-direction: column;
  padding: 28px 0 24px;
  overflow: hidden;
  background: var(--paper);
}

.sig-sticky .wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sig-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--ink);
  background: var(--surface);
  overflow: hidden;
}

.sig-canvas {
  position: absolute;
  inset: 0;
}

.stage {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.stage.is-on {
  opacity: 1;
}

.stage-sketch {
  color: var(--pencil);
  padding: 12px;
}

.sketch-svg {
  width: 100%;
  height: 100%;
}

.draw-path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wire-board {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 160px 1fr;
}

.wire-side,
.wire-main,
.wire-box {
  border: 1px solid var(--ink);
}

.wire-side {
  margin: 16px 0 16px 16px;
}

.wire-main {
  margin: 16px;
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
}

.wire-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.wire-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.wire-box {
  height: 48px;
  position: relative;
}

.wire-body {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 8px;
}

.wire-note {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--ink-60);
}

.wire-dim {
  position: absolute;
  background: var(--accent);
  height: 1px;
}

.stage-build {
  padding: 12px;
}

.stage-build .ops-mock {
  height: 100%;
  min-height: 0;
}

.sig-rail {
  position: absolute;
  left: 14px;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sig-rail div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--ink-60);
  text-align: left;
  /* 實底標籤牌:軌道文字永不與底下動畫層內容疊字 */
  background: var(--paper);
  border: 1px solid var(--line-mid);
  padding: 6px 8px;
}

.sig-rail div.is-active {
  color: var(--accent);
  border-color: var(--accent);
}

.sig-caption {
  margin: 16px 0 0;
  min-height: 1.6em;
  font-size: 15px;
  color: var(--ink-60);
}

.sig-thumbs {
  display: none;
  gap: 8px;
  margin-top: 16px;
}

.sig-thumbs figure {
  flex: 1;
  margin: 0;
  border: 1px solid var(--ink);
  padding: 8px;
  background: var(--surface);
}

.sig-thumbs figcaption {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  margin-top: 6px;
}

.reduce-motion .sig-scroll {
  height: auto;
}

.reduce-motion .sig-sticky {
  position: relative;
  top: 0;
  height: auto;
}

.reduce-motion .stage-sketch,
.reduce-motion .stage-wire {
  display: none;
}

.reduce-motion .stage-build {
  position: relative;
  inset: auto;
  opacity: 1;
}

.reduce-motion .sig-stage {
  min-height: 320px;
}

.reduce-motion .sig-thumbs {
  display: flex;
}

.reduce-motion .sig-rail div:last-child {
  color: var(--accent);
}

/* Beat 4 — Work */
.work {
  position: relative;
  padding: 100px 0 90px;
  overflow: clip;
}

.work-ghost {
  position: absolute;
  left: -4%;
  top: 28%;
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 16vw, 11rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1px var(--ink);
  opacity: 0.14;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1;
}

.work-ghost-en { visibility: hidden; }
html[lang="en"] .work-ghost-zh { visibility: hidden; }
html[lang="en"] .work-ghost-en { visibility: visible; }

.work-card {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 32px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--ink);
  padding: 20px;
}

.work-card + .work-card {
  margin-top: 14px;
}

.work-preview {
  height: 320px;
  overflow: hidden;
  border: 1px solid var(--ink);
  pointer-events: none;
}

.work-preview .ops-mock {
  width: 170%;
  transform: scale(0.59);
  transform-origin: top left;
  min-height: 540px;
}

.work-copy .svc-idx {
  margin-bottom: 14px;
}

.work-copy h3 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  letter-spacing: -0.03em;
}

.work-copy p {
  margin: 0 0 20px;
  color: var(--ink-60);
}

/* Beat 5 — Process */
.process {
  padding: 40px 0 0;
  overflow-x: clip;
}

.process-scroll {
  height: 240vh;
}

.process-sticky {
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  background: var(--paper);
  padding: 32px 0;
}

.process-viewport {
  overflow: hidden;
}

.process-track {
  display: flex;
  gap: 28px;
  width: max-content;
  will-change: transform;
}

.process-step {
  width: min(320px, 72vw);
  border: 1px solid var(--ink);
  background: var(--surface);
  padding: 28px 24px;
  position: relative;
}

.process-num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 36px;
}

.process-step h3 {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

.process-en {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-60);
  display: block;
  margin-bottom: 16px;
}

.process-step p {
  margin: 0;
  color: var(--ink-60);
  font-size: 14px;
}

.process-rule {
  position: relative;
  height: 24px;
  margin-top: 28px;
}

.process-rule::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 1px;
  background: var(--ink);
}

.process-ticks span {
  position: absolute;
  top: 6px;
  width: 1px;
  height: 12px;
  background: var(--ink);
}

.process-marker {
  position: absolute;
  top: 8px;
  width: 12px;
  height: 8px;
  background: var(--accent);
  transform: translateX(-50%);
  left: 0;
}

.reduce-motion .process-scroll,
.reduce-motion .sig-scroll {
  height: auto;
}

.reduce-motion .process-sticky {
  position: relative;
  top: auto;
  height: auto;
}

.reduce-motion .process-viewport {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.reduce-motion .process-step {
  scroll-snap-align: start;
}

/* Beat 6 — Why */
.why {
  position: relative;
  padding: 100px 0 110px;
  overflow: clip;
}

.why-ghost {
  position: absolute;
  right: -6%;
  top: 18%;
  font-family: var(--font-display);
  font-size: clamp(8rem, 28vw, 22rem);
  font-weight: 700;
  color: transparent;
  -webkit-text-stroke: 1px var(--ink);
  opacity: 0.08;
  line-height: 0.8;
  pointer-events: none;
}

.why-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  align-items: baseline;
  padding: 28px 0;
  border-top: 1px solid var(--line-mid);
  max-width: 920px;
}

.why-row:last-child {
  border-bottom: 1px solid var(--line-mid);
}

.why-row:nth-child(even) {
  margin-left: auto;
  grid-template-columns: 1fr 120px;
}

.why-row:nth-child(even) .why-num {
  order: 2;
  text-align: right;
}

.why-num {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--accent);
  letter-spacing: 0.04em;
}

.why-copy {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  letter-spacing: -0.03em;
  line-height: 1.3;
  font-weight: 700;
}

.why-sub {
  margin: 8px 0 0;
  color: var(--ink-60);
  font-size: 15px;
  font-weight: 400;
  font-family: var(--font-body);
}

/* Beat 7 — Contact */
.contact {
  position: relative;
  background-color: var(--dark);
  background-image:
    linear-gradient(var(--line-inv) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-inv) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  color: var(--on-dark);
  padding: 96px 0 0;
}

.contact-wipe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
  transform-origin: left center;
}

.cta-title {
  margin: 0 0 12px;
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
  font-weight: 700;
}

.cta-sub {
  margin: 0 0 40px;
  color: var(--paper-60);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  max-width: 720px;
}

.form-grid .field-span {
  grid-column: 1 / -1;
}

.contact-inner {
  padding-bottom: 1px; /* 包住提交掣 desktop margin,避免塌邊 */
}

.contact .btn-solid {
  margin-top: 20px;
  margin-bottom: 64px;
  background: var(--on-dark);
  color: var(--in-on-dark);
  border-color: var(--on-dark);
}

.contact .btn-solid:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.contact .btn-solid:disabled,
.contact-form.is-sending .btn-solid:hover {
  background: var(--on-dark);
  border-color: var(--on-dark);
  color: var(--in-on-dark);
  cursor: wait;
  opacity: 0.78;
}

@media (max-width: 767px) {
  .hero {
    min-height: calc(100svh - var(--nav-h));
    padding: 48px 0 64px;
  }

  .hero-copy { max-width: none; }

  .contact {
    background-position: 16px 0;
  }

  .services {
    padding: calc(var(--grid-size) * 3) 0 calc(var(--grid-size) * 3);
  }

  .sec-heading {
    margin-bottom: var(--grid-size);
  }

  .services-grid,
  .work-card,
  .wire-board,
  .form-grid {
    grid-template-columns: 1fr;
  }

  /* 線框左右同距,主區兩欄等寬 */
  .stage-wire {
    padding: 16px;
  }

  .wire-board {
    gap: 12px;
  }

  .wire-side,
  .wire-main {
    margin: 0;
  }

  .wire-body {
    grid-template-columns: 1fr 1fr;
  }

  .svc:nth-child(2),
  .svc:nth-child(3),
  .svc:nth-child(4),
  .svc:nth-child(5) {
    margin-top: 0;
  }

  .svc-lg,
  .svc-sm {
    min-height: 0;
  }

  .sig-scroll { height: 180vh; }

  .sig-stage {
    display: flex;
    flex-direction: column;
  }

  /* 標籤聚在動畫上方,不再疊在舞台上 */
  .sig-rail {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    transform: none;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: stretch;
    gap: 6px;
    margin: 10px 10px 0;
    font-size: 9px;
  }

  .sig-rail div {
    flex: 0 0 auto;
    padding: 4px 8px;
  }

  .sig-canvas {
    position: relative;
    inset: auto;
    flex: 1;
    min-height: 0;
    margin: 16px 10px 10px;
  }

  .work-preview { height: 220px; }

  .work-card + .work-card {
    margin-top: 16px;
  }

  .contact-inner {
    padding-bottom: 56px;
  }

  .contact .btn-solid {
    margin-bottom: 0;
  }

  .contact .site-footer {
    padding-top: 40px;
    padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  }

  .process-scroll { height: auto; }

  .process-sticky {
    position: relative;
    top: auto;
    height: auto;
    overflow: visible;
  }

  .process-track {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    gap: 12px;
  }

  .process-step { width: 100%; }

  .why-row,
  .why-row:nth-child(even) {
    grid-template-columns: 64px 1fr;
    margin-left: 0;
  }

  .why-row:nth-child(even) .why-num {
    order: 0;
    text-align: left;
  }

  .why-ghost { display: none; }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .process-viewport {
    overflow: visible;
    scroll-snap-type: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .sig-scroll,
  .process-scroll {
    height: auto;
  }

  .sig-sticky,
  .process-sticky {
    position: relative;
    top: auto;
    height: auto;
  }

  .stage-sketch,
  .stage-wire {
    display: none;
  }

  .stage-build {
    position: relative;
    inset: auto;
    opacity: 1;
  }

  .sig-thumbs {
    display: flex;
  }

  .process-viewport {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .process-step {
    scroll-snap-align: start;
  }
}

.work-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  text-decoration: none;
}

.work-preview .ops-tasks {
  gap: 10px;
}

.thumb-q,
.thumb-a {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.thumb-q {
  color: var(--ink-60);
  border-left: 2px solid var(--ink-60);
  padding-left: 10px;
}

.thumb-a {
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}

.thumb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.thumb-cams,
.thumb-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.thumb-compare {
  min-height: 0;
  height: 100%;
}

.thumb-compare .thumb-cam {
  min-height: 220px;
  height: 100%;
}

.thumb-obj {
  display: block;
  position: absolute;
  left: 22%;
  top: 40%;
  width: 38%;
  height: 34%;
  background: var(--ink-60);
  opacity: 0.35;
}

.thumb-cam {
  position: relative;
  min-height: 110px;
  border: 1px solid var(--ink);
  background:
    repeating-linear-gradient(0deg, var(--line) 0 1px, transparent 1px 7px),
    var(--surface);
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.thumb-cam b,
.thumb-cam span {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-60);
}

.thumb-cam i {
  display: none;
  position: absolute;
  left: 18%;
  top: 34%;
  width: 48%;
  height: 42%;
  border: 1px solid var(--accent);
}

.thumb-cam.is-alert {
  border-color: var(--accent);
}

.thumb-cam.is-alert b {
  color: var(--accent);
}

.thumb-cam.is-alert i {
  display: block;
}

.thumb-devs {
  display: grid;
  gap: 8px;
}

.thumb-dev {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 8px;
  align-items: baseline;
  border: 1px solid var(--ink);
  padding: 8px 10px;
  background: var(--paper);
}

.thumb-dev b,
.thumb-dev output {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.thumb-dev span {
  font-size: 12px;
  color: var(--ink-60);
}

.thumb-dev.is-alert {
  border-color: var(--accent);
  grid-template-columns: 88px 1fr auto auto;
}
