/* Layout: circuit-board night — a single dark "PCB" ground, traces from the logo run behind the hero; content sits on a 1160px grid */
:root {
  --ink: #0d0a1c;          /* board */
  --panel: #161130;        /* raised component */
  --panel-2: #1e1740;
  --line: #2e2558;         /* trace */
  --fg: #ece8fb;
  --muted: #a39cc4;
  --violet: #8a63f0;       /* logo purple, lifted for dark */
  --violet-deep: #5b3a9a;
  --amber: #f7a032;        /* logo wifi orange */
  --ice: #a9dcf5;          /* cat fur blue */
  --ok: #4ade80;
  --display: "Chakra Petch", "Noto Sans TC", system-ui, sans-serif;
  --body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --wrap: 1160px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--ink);
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: 20px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
.eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--amber); display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--amber); }
.section { padding-block: 96px; position: relative; }
.section-head { display: grid; gap: 14px; max-width: 680px; margin-bottom: 48px; }
.section-head h2 { font-family: var(--body); font-weight: 900; font-size: clamp(28px, 4vw, 42px); line-height: 1.25; }
.section-head p { color: var(--muted); font-size: 17px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { width: 52px; height: auto; }
.brand b { font-weight: 900; font-size: 18px; letter-spacing: .04em; white-space: nowrap; }
.brand small { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .12em; line-height: 1.2; }
.nav ul { list-style: none; display: flex; gap: 28px; margin: 0; padding: 0; }
.nav ul a { text-decoration: none; color: var(--muted); font-size: 15px; transition: color .2s; }
.nav ul a:hover { color: var(--fg); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  font-family: var(--body); font-weight: 700; font-size: 15px;
  padding: 12px 22px; border-radius: 8px; border: 1px solid transparent;
  transition: transform .2s, background .2s, border-color .2s;
}
.btn-primary { background: var(--amber); color: #1b1206; }
.btn-primary:hover { transform: translateY(-2px); background: #ffb24f; }
.btn-ghost { border-color: var(--line); color: var(--fg); background: transparent; }
.btn-ghost:hover { border-color: var(--violet); }
.nav .btn { padding: 9px 16px; font-size: 14px; }

/* ---------- warp hero (scroll-pinned, three stages) ---------- */
.warp { position: relative; border-bottom: 1px solid var(--line); }
.warp-stage { position: relative; overflow: hidden; }
#warpCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.warp-stage::after { /* vignette keeps copy legible over the streaks */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ink) 78%, transparent) 0%, transparent 58%),
              radial-gradient(120% 90% at 50% 50%, transparent 55%, var(--ink) 100%);
}
.warp-cat {
  position: absolute; z-index: 2; width: min(300px, 30vw); left: 70%; top: 50%;
  transform: translate(-50%, -50%) scale(var(--cat-s, 1)); opacity: var(--cat-o, 1);
  filter: drop-shadow(0 0 40px color-mix(in srgb, var(--violet) 60%, transparent)) drop-shadow(0 20px 30px rgba(0,0,0,.5));
  pointer-events: none;
}
.warp-cat img { width: 100%; display: block; animation: bob 5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px); } }
.warp-layers { position: relative; z-index: 3; display: grid; gap: 72px; padding-block: 88px 72px; }
.warp-layer { display: grid; gap: 22px; max-width: 620px; min-width: 0; }
.warp h1 { font-weight: 900; font-size: clamp(38px, 5.8vw, 70px); line-height: 1.12; letter-spacing: .01em; }
.warp h1 .hl, .big-list .hl { color: transparent; background: linear-gradient(95deg, var(--ice), var(--violet) 55%, var(--amber)); -webkit-background-clip: text; background-clip: text; }
.warp h2 { font-weight: 900; font-size: clamp(28px, 4vw, 46px); line-height: 1.2; }
.hero-lede { color: var(--muted); font-size: 18px; max-width: 34em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.hero-tags span { border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 60%, transparent); }
.big-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.big-list li { display: flex; align-items: baseline; gap: 18px; font-weight: 900; font-size: clamp(32px, 5.4vw, 64px); line-height: 1.15; }
.big-list small { font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .12em; color: var(--amber); min-width: 3.2em; }
.warp-rail { display: none; }

/* live mode: JS pins the stage and cross-fades the layers */
.warp.live { height: 380vh; }
.warp.live .warp-stage { position: sticky; top: 0; height: 100vh; height: 100svh; }
.warp.live .warp-layers { position: absolute; inset: 0; margin: 0 auto; padding-block: 0; display: block; }
.warp.live .warp-layer {
  position: absolute; left: 20px; right: 20px; top: 50%; transform: translateY(calc(-50% + var(--dy, 0px)));
  opacity: var(--o, 1); filter: blur(var(--b, 0px)); will-change: opacity, filter, transform;
}
.warp.live .warp-layer.off { visibility: hidden; }
.warp.live .warp-rail {
  display: flex; position: absolute; z-index: 4; right: 24px; top: 50%; transform: translateY(-50%);
  flex-direction: column; gap: 10px;
}
.warp-rail i { width: 3px; height: 26px; border-radius: 2px; background: var(--line); transition: background .3s, height .3s; }
.warp-rail i.on { background: var(--amber); height: 40px; }
.warp-hint {
  position: absolute; z-index: 4; left: 50%; bottom: 22px; transform: translateX(-50%);
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--muted); display: none; gap: 8px; align-items: center;
}
.warp.live .warp-hint { display: inline-flex; opacity: var(--hint, 1); }
.warp-hint::after { content: "↓"; color: var(--amber); animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }

.term {
  position: relative; width: min(480px, 100%);
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: 12px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.8; box-shadow: 0 24px 60px rgba(0,0,0,.4);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.term-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.term-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.term-bar i:nth-child(1) { background: #ff5f57; } .term-bar i:nth-child(2) { background: #febc2e; } .term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-left: 8px; }
.term pre { margin: 0; padding: 14px 16px; white-space: pre-wrap; word-break: break-word; color: var(--muted); min-height: 190px; }
.term .p { color: var(--violet); } .term .c { color: var(--fg); } .term .ok { color: var(--ok); } .term .a { color: var(--amber); }
.caret { display: inline-block; width: 7px; height: 14px; background: var(--amber); vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- logo marquee ---------- */
.stackbar { border-bottom: 1px solid var(--line); padding-block: 36px; display: grid; gap: 18px; overflow: hidden; }
.stackbar .label { text-align: center; font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.marquee { --gap: 44px; display: flex; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee .track { display: flex; gap: var(--gap); padding-right: var(--gap); flex-shrink: 0; animation: scroll 48s linear infinite; }
.marquee.rev .track { animation-direction: reverse; animation-duration: 56s; }
.marquee:hover .track { animation-play-state: paused; }
@keyframes scroll { to { transform: translateX(-100%); } }
.chip { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; font-weight: 500; font-size: 15px; transition: color .25s; }
.chip svg { width: 26px; height: 26px; fill: currentColor; flex-shrink: 0; transition: fill .25s; }
.chip:hover { color: var(--fg); }
.chip:hover svg { fill: var(--brand); }

/* ---------- services ---------- */
.services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.svc {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 32px; display: grid; gap: 16px; align-content: start; overflow: hidden;
  transition: border-color .3s, transform .3s;
}
.svc:hover { border-color: color-mix(in srgb, var(--violet) 70%, var(--line)); transform: translateY(-3px); }
.svc::before { /* pad + trace, like the logo's circuit ends */
  content: ""; position: absolute; top: 34px; right: -1px; width: 90px; height: 2px;
  background: linear-gradient(90deg, var(--line), transparent);
}
.svc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.svc-ico { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); color: var(--ice); }
.svc-ico svg { width: 26px; height: 26px; }
.svc-code { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.svc h3 { font-size: 22px; font-weight: 900; }
.svc p { color: var(--muted); }
.svc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.svc li { display: flex; gap: 10px; align-items: baseline; font-size: 15px; }
.svc li::before { content: ""; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); transform: translateY(-2px); }
.specs { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.specs span { font-family: var(--mono); font-size: 11.5px; color: var(--ice); background: color-mix(in srgb, var(--ice) 8%, transparent); padding: 3px 8px; border-radius: 4px; }

/* ---------- AI stack ---------- */
.ai { background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--violet-deep) 14%, transparent) 40%, transparent); border-block: 1px solid var(--line); }
/* 3D logo sphere */
.sphere-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 40px; align-items: center; margin-bottom: 56px; }
.sphere-row .section-head { margin-bottom: 0; }
.sphere-hint { font-family: var(--mono); font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.sphere-hint::before { content: "↻"; color: var(--amber); font-size: 15px; }
.sphere {
  position: relative; width: min(460px, 100%); aspect-ratio: 1; max-width: 100%; margin-inline: auto;
  cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.sphere:active { cursor: grabbing; }
.sphere::before { /* equator + core glow */
  content: ""; position: absolute; inset: 12%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--violet) 26%, transparent), transparent 65%);
  border: 1px dashed color-mix(in srgb, var(--violet) 40%, transparent);
}
.sphere .orb {
  position: absolute; left: 50%; top: 50%; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 9px; border-radius: 99px; white-space: nowrap; font-size: 13px; font-weight: 500;
  background: color-mix(in srgb, var(--panel-2) 88%, transparent); border: 1px solid var(--line); color: var(--fg);
  will-change: transform, opacity;
}
.sphere .orb svg { width: 18px; height: 18px; fill: var(--brand); flex-shrink: 0; }
.sphere .orb.front { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); box-shadow: 0 0 18px color-mix(in srgb, var(--brand) 25%, transparent); }

/* 3D tilt cards */
.tilt { transform-style: preserve-3d; will-change: transform; }
.tilt .svc-ico, .tilt h3 { transition: transform .25s; }
.tilt.tilting { transition: border-color .3s; }
.tilt.tilting .svc-ico { transform: translateZ(46px); }
.tilt.tilting h3 { transform: translateZ(24px); }
.tilt .glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), color-mix(in srgb, var(--ice) 14%, transparent), transparent 55%); }
.tilt.tilting .glare { opacity: 1; }
.ai-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.ai-group { border: 1px solid var(--line); border-radius: 14px; padding: 26px; background: color-mix(in srgb, var(--panel) 70%, transparent); display: grid; gap: 18px; align-content: start; }
.ai-group header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ai-group h3 { font-size: 18px; font-weight: 700; }
.ai-group header span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.ai-group p { color: var(--muted); font-size: 14.5px; }
.logos { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.logo {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid transparent; font-size: 13.5px; color: var(--fg);
  transition: border-color .25s, background .25s; min-width: 0;
}
.logo svg { width: 20px; height: 20px; flex-shrink: 0; fill: var(--brand); }
.logo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--panel-2)); }

/* ---------- process ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; position: relative; }
.steps::before { content: ""; position: absolute; top: 21px; left: 22px; right: 22px; height: 2px; background: linear-gradient(90deg, var(--violet), var(--amber)); opacity: .6; }
.step { display: grid; gap: 12px; padding-right: 18px; position: relative; min-width: 0; }
.step .node { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); border: 2px solid var(--violet); font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--fg); }
.step:last-child .node { border-color: var(--amber); }
.step h3 { font-size: 17px; font-weight: 700; }
.step p { color: var(--muted); font-size: 14px; }
.step small { font-family: var(--mono); font-size: 11px; color: var(--ice); }

/* ---------- why / numbers ---------- */
.why { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 64px; }
.why div { border-top: 2px solid var(--line); padding-top: 18px; display: grid; gap: 8px; }
.why b { font-family: var(--display); font-size: 36px; font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; line-height: 1.1; }
.why b em { font-style: normal; font-size: 18px; color: var(--amber); margin-left: 4px; }
.why span { color: var(--muted); font-size: 14.5px; }

/* ---------- contact ---------- */
.contact { display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: stretch; }
.contact-card {
  border-radius: 18px; padding: 44px; display: grid; gap: 20px; align-content: center;
  background: radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--violet) 40%, var(--panel)), var(--panel) 60%);
  border: 1px solid var(--line);
}
.contact-card h2 { font-size: clamp(26px, 3.6vw, 38px); font-weight: 900; line-height: 1.3; }
.contact-card p { color: var(--muted); }
.channels { display: grid; gap: 12px; }
.channel { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.channel .k { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--muted); width: 64px; flex-shrink: 0; text-transform: uppercase; }
.channel .v { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; user-select: all; }
.copy { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; font-family: var(--mono); font-size: 11px; padding: 5px 10px; cursor: pointer; flex-shrink: 0; }
.copy:hover { color: var(--fg); border-color: var(--violet); }

footer { border-top: 1px solid var(--line); padding-block: 36px; color: var(--muted); font-size: 13px; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
footer .mono { font-family: var(--mono); font-size: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .steps { grid-template-columns: 1fr; gap: 26px; }
  .steps::before { top: 22px; bottom: 22px; left: 21px; right: auto; width: 2px; height: auto; background: linear-gradient(180deg, var(--violet), var(--amber)); }
  .step { grid-template-columns: 44px 1fr; column-gap: 18px; row-gap: 4px; padding-right: 0; }
  .step .node { grid-row: span 3; }
  .contact { grid-template-columns: 1fr; }
  .sphere-row { grid-template-columns: 1fr; gap: 24px; }
  .warp-cat { left: 50%; top: 24%; width: min(210px, 46vw); }
  .warp-stage::after { background: linear-gradient(0deg, color-mix(in srgb, var(--ink) 88%, transparent) 20%, transparent 62%), radial-gradient(120% 90% at 50% 40%, transparent 55%, var(--ink) 100%); }
  .warp.live .warp-layer { top: auto; bottom: 40px; transform: translateY(var(--dy, 0px)); }
  .warp.live .warp-rail { right: 10px; }
  .warp.live .warp-hint { display: none; }
  .warp-layers { padding-top: 300px; }
}
@media (max-width: 760px) {
  .nav ul { display: none; }
  .services, .ai-grid { grid-template-columns: 1fr; }
  .why { grid-template-columns: 1fr; gap: 16px; }
  .section { padding-block: 64px; }
  .svc, .contact-card { padding: 24px; }
  .brand small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
