/* ONEWORK 工一科技 — tokens from MOTION.md only */
:root {
  /* Logo colours (工作區域 3.svg) */
  --teal-900: #47868D;
  --teal-700: #5B8F96;
  --teal-500: #759FA4;
  --teal-300: #8BADB1;
  --teal-100: #9EB9BD;
  /* Banner backgrounds (sampled) */
  --mist: #AFC5C8;
  --ice: #F3F9FF;
  --paper: #F2F2F2;
  --charcoal: #1A1A1A;
  --forest: #324C41;
  --ink: #3D3D3D;
  --white: #FFFFFF;

  --font-display: "Archivo", "Noto Sans TC", sans-serif;
  --font-brand: "Jost", "Noto Sans TC", sans-serif;
  --font-body: "Archivo", "Noto Sans TC", sans-serif;

  /* Type scale (MOTION.md §2) */
  --fs-big: clamp(48px, 7vw, 120px);
  --fs-mid: clamp(32px, 3.2vw, 48px);
  --fs-body: clamp(17px, 1.1vw, 18px);
  --fs-label: clamp(12px, 0.8vw, 13px);

  --gutter: clamp(16px, 4vw, 64px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1); /* expo.out */
}

html[lang="zh-Hant"] {
  --font-display: "Noto Sans TC", "Archivo", sans-serif;
  --font-body: "Noto Sans TC", "Archivo", sans-serif;
}
html.font-jost { --font-display: "Jost", "Noto Sans TC", sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  background: var(--ice);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p, h1, h2, h3 { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--teal-900); outline-offset: 3px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--white); padding: 8px 12px; }
.skip:focus { left: 8px; }

/* Shared type */
.label {
  font-family: var(--font-brand);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--teal-900);
}
.h-big {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--fs-big);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.h-mid {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-mid);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
  max-width: 18ch;
}
html[lang="zh-Hant"] .h-mid { max-width: 14em; letter-spacing: 0.02em; }
.pending {
  font-family: var(--font-brand);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  color: var(--teal-900);
  opacity: 0.8;
}

/* 3D layer */
#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Header */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 22px var(--gutter);
  transition: background-color 0.5s var(--ease-out), padding 0.5s var(--ease-out);
}
.site-header.is-scrolled {
  background: rgba(243, 249, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-block: 14px;
}
.brand img { width: clamp(118px, 9vw, 150px); }
.main-nav { display: flex; gap: clamp(20px, 3.2vw, 64px); }
.main-nav a {
  font-family: var(--font-brand);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-decoration: none;
  color: var(--ink);
  position: relative;
  padding-block: 6px;
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--teal-900);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.6s var(--ease-out);
}
.main-nav a:hover::after, .main-nav a:focus-visible::after { transform: scaleX(1); transform-origin: left; }
.lang {
  justify-self: end;
  font: 500 var(--fs-label) / 1 var(--font-brand);
  letter-spacing: 0.12em;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 9px 16px;
  min-height: 44px;
  cursor: pointer;
}
.lang span { opacity: 0.4; transition: opacity 0.3s; }
.lang-sep { margin-inline: 6px; }
html[lang="en"] .lang [data-lang="en"], html[lang="zh-Hant"] .lang [data-lang="zh"] { opacity: 1; }

/* HOME · Visual Banner */
.hero {
  position: relative;
  height: 100svh;
  min-height: 600px;
  background: var(--mist);
  overflow: hidden;
}
.hero-pattern { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hairline { position: absolute; width: 1px; background: var(--white); z-index: 0; opacity: 0.9; }
.hairline-l { left: 14.7%; bottom: 0; height: 22%; }
.hairline-r { right: 4.4%; bottom: 0; height: 54%; }

.wordmark, .hero-copy, .scroll-cue { position: absolute; z-index: 2; }
.wordmark {
  left: 14%;
  top: 50%;
  translate: 0 -50%;
  display: flex;
  gap: 0.8em;
  font-family: var(--font-brand);
  font-weight: 300;
  font-size: clamp(32px, 2.3vw, 48px);
  color: var(--teal-700);
  margin: 0;
}
.hero-copy {
  /* starts at ~59% like the Home banner, clear of the centred logo */
  left: 58.5%;
  right: 4%;
  top: 50%;
  translate: 0 -50%;
  max-width: 720px;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--fs-mid);
  line-height: 1.12;
  letter-spacing: -0.005em;
  color: var(--ink);
}
html[lang="zh-Hant"] .hero-title { letter-spacing: 0.04em; }
.line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.line-inner { display: block; }
.hero-tagline {
  margin-top: 22px;
  max-width: 34ch;
  font-size: var(--fs-body);
  color: var(--ink);
}
.scroll-cue {
  left: 50%;
  bottom: 28px;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font: 500 var(--fs-label) / 1 var(--font-brand);
  letter-spacing: 0.3em;
  color: var(--ink);
}
.scroll-cue i { width: 1px; height: 40px; background: linear-gradient(var(--ink), transparent); }

/* Opaque content panels sit above the 3D layer */
.panel {
  position: relative;
  z-index: 3;
  background: var(--ice);
  padding: clamp(96px, 12vw, 180px) var(--gutter);
}
.section-head { display: grid; gap: 20px; margin-bottom: clamp(48px, 6vw, 96px); }

/* Partners */
.partners { padding-bottom: clamp(72px, 8vw, 120px); }
.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-track {
  display: flex;
  gap: 20px;
  width: max-content;
  margin: 0;
  padding: 0;
  list-style: none;
  animation: marquee 48s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(calc(-50% - 10px)); } }
.partner {
  display: grid;
  place-items: center;
  width: clamp(150px, 14vw, 220px);
  height: 112px;
  padding: 0 12px;
}
/* grayscale by default so the wall stays in the brand palette; colour on hover */
.partner img {
  max-width: 100%;
  max-height: 64px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: grayscale(1) brightness(0.7) contrast(1.6);
  opacity: 0.8;
  mix-blend-mode: multiply;
  transition: filter 0.5s var(--ease-out), opacity 0.5s var(--ease-out);
}
.partner:hover img { filter: none; opacity: 1; }

/* Positioning · From Model to Twin (transparent: the 3D layer shows through) */
.twin { position: relative; z-index: 2; height: 400vh; }
.twin-stage {
  height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 var(--gutter);
}
.twin-copy { width: min(40vw, 560px); position: relative; z-index: 2; }
.twin-title { margin: 20px 0 clamp(32px, 4vw, 56px); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; }
.step {
  grid-area: 1 / 1;
  opacity: 0;
  transform: translateY(24px);
  /* leave fast (MOTION.md §3), enter after the old step has gone */
  transition: opacity 0.3s ease-in, transform 0.4s ease-in;
  pointer-events: none;
}
.step.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity 0.8s var(--ease-out) 0.3s, transform 1s var(--ease-out) 0.3s;
}
.step-label { font: 500 var(--fs-label) / 1 var(--font-brand); letter-spacing: 0.3em; color: var(--teal-900); }
.step-title { margin: 14px 0 12px; font: 800 clamp(22px, 1.8vw, 28px) / 1.2 var(--font-display); color: var(--ink); }
.step-body { max-width: 42ch; }
.progress { margin-top: 40px; width: 160px; height: 1px; background: rgba(61, 61, 61, 0.2); }
.progress i { display: block; height: 100%; width: 100%; background: var(--teal-900); transform: scaleX(0); transform-origin: left; }

/* Metrics */
.metrics { background: var(--ice); }
.compress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: clamp(32px, 6vw, 120px);
  align-items: end;
  padding-bottom: clamp(56px, 7vw, 104px);
  border-bottom: 1px solid rgba(61, 61, 61, 0.15);
}
.compress .h-big { color: var(--teal-900); }
.compress-caption { margin-top: 16px; max-width: 30ch; }
.compress-bars { display: grid; gap: 22px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 20px; }
.bar-label { font: 500 var(--fs-label) / 1.3 var(--font-brand); letter-spacing: 0.12em; text-transform: uppercase; }
.bar { height: 28px; background: rgba(175, 197, 200, 0.35); }
.bar-fill { display: block; height: 100%; transform-origin: left; }
.bar-fill.full { background: var(--teal-300); }
.bar-fill.engine { background: var(--teal-900); transform: scaleX(0.05); }

.stats {
  list-style: none;
  margin: 0;
  padding: clamp(48px, 6vw, 96px) 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(24px, 3vw, 48px);
}
.stat-num { font: 900 var(--fs-mid) / 1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-label { margin-top: 14px; max-width: 24ch; font-size: 15px; }
.stats .is-pending .stat-num { color: var(--teal-300); }
.stats .is-pending .stat-label { color: var(--teal-900); }

/* Services */
.services { background: var(--paper); }
.svc-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(61, 61, 61, 0.2); }
.svc { border-bottom: 1px solid rgba(61, 61, 61, 0.2); }
.svc a {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 0.9fr);
  gap: clamp(16px, 3vw, 48px);
  align-items: center;
  padding: clamp(28px, 3vw, 44px) 0;
  text-decoration: none;
}
.svc-index { font: 500 var(--fs-label) / 1 var(--font-brand); letter-spacing: 0.2em; color: var(--teal-900); }
.svc-name {
  font: 900 var(--fs-mid) / 1 var(--font-display);
  color: var(--ink);
  transition: color 0.4s var(--ease-out), transform 0.6s var(--ease-out);
}
.svc-name small {
  display: block;
  margin-top: 10px;
  font: 500 var(--fs-label) / 1.3 var(--font-brand);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-900);
}
.svc-desc { font-size: 16px; }
.svc-media {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--teal-500);
  background: rgba(175, 197, 200, 0.25);
  font: 400 var(--fs-label) / 1.3 var(--font-brand);
  letter-spacing: 0.08em;
  color: var(--teal-900);
  text-align: center;
  padding: 8px;
  clip-path: inset(0 0 0 100%);
  transition: clip-path 0.8s var(--ease-out);
}
.svc a:hover .svc-name, .svc a:focus-visible .svc-name { color: var(--teal-900); transform: translateX(8px); }
.svc a:hover .svc-media, .svc a:focus-visible .svc-media { clip-path: inset(0 0 0 0); }

/* Footer */
.site-footer {
  position: relative;
  z-index: 3;
  background: var(--mist);
  padding: clamp(72px, 9vw, 140px) var(--gutter) 32px;
  overflow: hidden;
}
.footer-mark {
  font: 300 clamp(40px, 9vw, 150px) / 1 var(--font-brand);
  letter-spacing: 0.6em; /* 7 letters × ~1.25em ≈ 79vw: fits the viewport */
  color: var(--teal-700);
  white-space: nowrap;
  margin-bottom: clamp(48px, 6vw, 96px);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 32px;
  align-items: start;
}
.footer-grid .label { margin-bottom: 12px; }
.footer-grid p { font-size: 15px; }
.copyright { margin-top: 64px; font: 400 var(--fs-label) / 1 var(--font-brand); letter-spacing: 0.08em; }


/* Responsive */
@media (max-width: 900px) {
  .site-header { grid-template-columns: auto 1fr auto; }
  .main-nav { display: none; }
  .wordmark { left: 50%; top: 18%; translate: -50% 0; font-size: 26px; gap: 0.6em; }
  .hero-copy { left: var(--gutter); right: var(--gutter); top: auto; bottom: 96px; translate: none; width: auto; }
  .hairline-l { left: 8%; }
  .twin-stage { align-items: flex-end; padding-bottom: 56px; }
  .twin-copy { width: 100%; background: rgba(243, 249, 255, 0.86); padding: 20px; }
  .compress { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .svc a { grid-template-columns: 1fr; }
  .svc-desc, .svc-media { grid-column: 1; }
  .svc-media { clip-path: none; }
  .footer-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 100px 1fr; }
}

/* Reduced motion: static, readable, nothing pinned */
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; flex-wrap: wrap; width: auto; }
  .marquee { mask-image: none; }
  .marquee-track [aria-hidden="true"] { display: none; }
}
html.is-static .twin { height: auto; }
html.is-static .twin-stage { height: auto; min-height: 100vh; padding-block: 120px; }
html.is-static .steps { gap: 40px; }
html.is-static .step { grid-area: auto; opacity: 1; transform: none; }
html.is-static .progress { display: none; }
html.is-static .marquee-track { animation: none; }

/* service screenshots in the media slots */
.svc-media:has(img) { border: 0; background: none; padding: 0; display: block; }
.svc-media img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Important notice: a small fixed button, bottom right, that opens the statement */
.notice {
  position: fixed; z-index: 60;
  right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px));
  display: grid; justify-items: end; gap: 12px; max-width: calc(100vw - 32px);
}
.notice-btn {
  min-height: 44px; padding: 0 20px; cursor: pointer;
  background: var(--charcoal); color: var(--white); border: 0; border-radius: 0;
  font: 500 13px/1 var(--font-brand); letter-spacing: 0.14em;
}
.notice-btn:hover, .notice-btn:focus-visible { background: var(--teal-900); }
.notice-panel {
  width: min(400px, calc(100vw - 32px)); max-height: calc(100svh - 110px); overflow: auto;
  padding: 26px 26px 22px; background: var(--white); color: var(--ink);
  box-shadow: 0 24px 70px rgba(26, 31, 34, 0.24);
  animation: notice-in 0.5s var(--ease-out);
}
.notice-panel[hidden] { display: none; }
.notice-title { font: 900 22px/1.2 var(--font-display); color: var(--charcoal); margin-bottom: 16px; }
.notice-panel p { font-size: 15px; line-height: 1.75; }
.notice-panel p + p { margin-top: 10px; }
.notice-panel .notice-strong { font-weight: 700; color: var(--charcoal); }
.notice-panel .notice-sign { margin-top: 18px; text-align: right; font-weight: 500; color: var(--charcoal); }
.notice-close {
  margin-top: 18px; padding: 8px 0; cursor: pointer; background: none; border: 0;
  font: 500 12px/1 var(--font-brand); letter-spacing: 0.16em; text-transform: uppercase; color: var(--teal-900);
}
@keyframes notice-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .notice-panel { animation: none; } }

/* Products & Services: real Onework FM screens, two by two, no frames */
.svc-gallery { margin-top: clamp(64px, 8vw, 112px); display: grid; gap: 28px; }
/* all four screens fit in one window: the grid's width follows the window height (2 rows of 16:9 + captions) */
.svc-shots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 3vh, 40px) clamp(16px, 2vw, 32px);
  width: min(100%, calc((100svh - 300px) * 1.78)); }
.svc-shots figure { margin: 0; display: grid; gap: 14px; }
.svc-shots img { display: block; width: 100%; height: auto; box-shadow: 0 18px 50px rgba(26, 31, 34, 0.12); transition: transform 0.8s var(--ease-out); }
.svc-shots li:hover img { transform: translateY(-6px); }
.svc-shots figcaption { font-size: 14px; line-height: 1.5; color: var(--ink); max-width: 46ch; }
@media (max-width: 900px) { .svc-shots { grid-template-columns: 1fr; width: 100%; } }
@media (prefers-reduced-motion: reduce) { .svc-shots img { transition: none; } }
