/* JetPiggy 品牌網站：墨線方向。紙底、墨黑線、豬粉、披風紅、風鏡藍。 */
/* 「JetPiggy Display」是 Titan One 的子集，「JetPiggy UI」是 jf open 粉圓的子集：原字型的授權保留了名稱，子集不可以用（見 fonts/README.txt）。 */
@font-face { font-family: "JetPiggy Display"; src: url(fonts/JetPiggyDisplay.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "JetPiggy UI"; src: url(fonts/JetPiggyUI.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Nunito"; src: url(fonts/Nunito.woff2) format("woff2"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "WenKai"; src: url(fonts/WenKai-notes.woff2) format("woff2"); font-display: swap; }

:root {
  --paper: #F7F3E8;
  --paper-2: #FFFDF6;
  --ink: #161616;
  --muted: #5B564E;
  --pink: #F3A6A4;
  --pink-soft: #F9D9D8;
  --red: #E3312D;
  --red-text: #C4201B;
  --blue: #5DA6E8;
  --blue-text: #2A63A5;
  --cloud: #EEE8A6;
  --teal: #2EB8A6;
  --display: "JetPiggy Display", "JetPiggy UI", system-ui, sans-serif;
  --zh: "JetPiggy UI", "Nunito", system-ui, -apple-system, "PingFang HK", "Microsoft JhengHei", sans-serif;
  --body: "Nunito", "JetPiggy UI", system-ui, -apple-system, "PingFang HK", "Microsoft JhengHei", sans-serif;
  --hand: "WenKai", "JetPiggy UI", "PingFang HK", "Microsoft JhengHei", sans-serif;
  --wobble: 255px 18px 225px 18px / 18px 225px 18px 255px;
  --wobble-2: 18px 160px 18px 150px / 140px 18px 160px 18px;
  --gutter: clamp(20px, 4vw, 48px);
  --max: 1240px;
  --hero-top: clamp(84px, 11vh, 120px);
  --pig-w: min(55vw, 78vh, 640px);
  --pig-h: calc(var(--pig-w) * 0.544);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.7;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
/* 紙紋：蓋在所有東西上面，豬和字都像印在紙上 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: .55;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.25  0 0 0 0 0.2  0 0 0 0 0.12  0 0 0 0.16 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-text); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--red-text); }
h1, h2, h3 { font-family: var(--zh); font-weight: 400; line-height: 1.25; margin: 0; }
p { margin: 0; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.nowrap { white-space: nowrap; }

/* 導航 */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  background: var(--paper);
  box-shadow: 0 3px 0 var(--ink);
  transition: background .25s ease, box-shadow .25s ease;
}
.nav.clear { background: transparent; box-shadow: none; }
.nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.nav-brand img { width: 44px; height: 44px; }
.nav-wordmark { width: 140px; height: 30px; overflow: visible; }
.nav.clear .nav-wordmark { visibility: hidden; }
.nav-wordmark text, .hero-wordmark text {
  font-family: var(--display);
  font-size: 318px;
  fill: var(--pink);
  stroke: var(--ink);
  stroke-width: 8;
  stroke-linejoin: round;
  paint-order: stroke fill;
}
.nav-wordmark text { stroke-width: 14; }
.nav ul { display: flex; gap: clamp(16px, 2.4vw, 36px); list-style: none; margin: 0; padding: 0; font-family: var(--zh); font-size: 19px; }
.nav ul li, .nav ul a { white-space: nowrap; }
.nav ul a { color: var(--ink); text-decoration: none; border-bottom: 3px solid transparent; padding-bottom: 2px; -webkit-tap-highlight-color: transparent; }
.nav ul a[aria-current="true"] { border-bottom-color: var(--red); }
@media (hover: hover) { .nav ul a:hover { border-bottom-color: var(--red); } }
.nav .short { display: none; }

/* 首屏：舞台 */
.hero {
  position: relative;
  height: calc(var(--hero-top) + 9.5vw + max(var(--pig-h), var(--pig-w) * 0.3 + 250px));
  overflow: hidden;
}
.hero-stage { position: relative; height: 100%; }
main { position: relative; z-index: 2; background: var(--paper); }
/* 每個產品一張紙條，上下疊 */
.strip-wrap { padding: 36px var(--gutter) 0; display: grid; gap: 18px; }
.hero-wordmark {
  position: absolute;
  left: -1vw;
  top: var(--hero-top);
  width: 102vw;
  height: auto;
  overflow: visible;
  transform-origin: 0 0;
  z-index: 1;
  will-change: transform;
}
.hero-lines { position: absolute; left: 0; top: calc(var(--hero-top) + 9.5vw + var(--pig-w) * 0.33); width: calc(var(--pig-w) * 0.34); z-index: 2; }
.hero-lines path { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; fill: none; }
.hero-puff {
  position: absolute;
  left: calc(3vw - var(--pig-w) * 0.02);
  top: calc(var(--hero-top) + 9.5vw + var(--pig-w) * 0.36);
  width: calc(var(--pig-w) * 0.36);
  z-index: 2;
  transform-origin: 70% 50%;
  opacity: 0;
}
.hero-pig {
  position: absolute;
  left: 3vw;
  top: calc(var(--hero-top) + 9.5vw);
  width: var(--pig-w);
  z-index: 3;
  will-change: transform;
}
.hero-aside {
  position: absolute;
  left: calc(3vw + var(--pig-w) + 48px);
  right: var(--gutter);
  top: calc(var(--hero-top) + 9.5vw + var(--pig-w) * 0.3);
  z-index: 4;
}

/* 紅色批注：設定冊的馬克筆字 */
.note {
  position: relative;
  color: var(--red-text);
  font-family: var(--hand);
  font-size: 25px;
  line-height: 1.3;
  transform: rotate(-3deg);
  margin: 0 0 22px 8px;
  max-width: 320px;
}
.note svg { position: absolute; left: -100px; top: 0; width: 92px; }
.note path { stroke: var(--red-text); stroke-width: 3.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tagline { font-family: var(--zh); font-size: clamp(24px, 2.2vw, 32px); line-height: 1.4; max-width: 14em; }
.tagline em { font-style: normal; position: relative; white-space: nowrap; }
.tagline em::after, .u::after {
  content: "";
  position: absolute;
  left: -4px; right: -4px; bottom: -4px;
  height: .45em;
  z-index: -1;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 14' preserveAspectRatio='none'><path d='M2 9 C 60 4, 120 12, 200 7 S 340 3, 398 8' stroke='%23E3312D' stroke-width='7' fill='none' stroke-linecap='round'/></svg>") no-repeat;
  background-size: 100% 100%;
}
.hero-contact { margin-top: 18px; font-family: var(--zh); font-size: 17px; }
.hero-contact a { color: var(--ink); }

/* 墨線框 */
.frame {
  border: 3.5px solid var(--ink);
  border-radius: var(--wobble);
  background: rgba(255, 253, 246, .6);
}
.strip {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 22px 30px;
  background: var(--paper-2);
}
/* 第二張紙條的手繪圓角換個方向，不像複製出來 */
.strip + .strip { border-radius: 18px 225px 18px 255px / 255px 18px 225px 18px; }
.strip .btn { min-width: 11.5em; text-align: center; }
.strip img { width: 84px; height: 84px; border-radius: 22px; border: 3px solid var(--ink); flex: none; }
.strip .t { flex: 1; min-width: 0; }
.strip h2 { font-size: 26px; line-height: 1.2; }
.strip h2 b { font-family: var(--body); font-weight: 900; font-size: 27px; margin-right: 10px; letter-spacing: -.01em; }
.strip p { font-size: 17px; margin-top: 4px; word-break: keep-all; overflow-wrap: anywhere; text-wrap: pretty; }
.strip .sell { display: inline-block; margin-left: 10px; font-family: var(--hand); font-size: 18px; color: var(--red-text); white-space: nowrap; }
.pill {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--zh);
  font-size: 15px;
  line-height: 1.5;
  color: var(--red-text);
  border: 2.5px solid var(--red-text);
  padding: 2px 12px;
  border-radius: 120px 12px 140px 10px / 10px 120px 12px 140px;
  white-space: nowrap;
}

/* 按鈕：蓋印 */
.btn {
  display: inline-block;
  font-family: var(--zh);
  font-size: 19px;
  line-height: 1.3;
  color: #fff;
  background: var(--ink);
  text-decoration: none;
  padding: 13px 26px;
  border: 3px solid var(--ink);
  border-radius: var(--wobble-2);
  box-shadow: 4px 4px 0 var(--pink);
  white-space: nowrap;
  transition: box-shadow .15s ease, transform .15s ease;
}
.btn:hover { color: #fff; box-shadow: 6px 6px 0 var(--pink); transform: translate(-1px, -1px); }
.btn:active { box-shadow: 0 0 0 var(--pink); transform: translate(4px, 4px); transition-duration: .08s; }
.btn.ghost { color: var(--ink); background: transparent; box-shadow: 4px 4px 0 var(--pink-soft); }
.btn.ghost:hover { color: var(--ink); box-shadow: 6px 6px 0 var(--pink); }
.btn.ghost:active { box-shadow: 0 0 0 var(--pink); }
.btn:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* 區塊 */
.section { padding-top: clamp(72px, 9vw, 128px); }
.section:last-of-type { padding-bottom: clamp(72px, 9vw, 128px); }
.h2 { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; margin-bottom: clamp(28px, 3vw, 44px); }
.h2 h2 { font-size: clamp(34px, 3.4vw, 46px); position: relative; }
.h2 h2 .u { position: relative; }
.h2 small { font-family: var(--zh); font-size: 19px; color: var(--muted); }

/* 產品：每個產品一段示意。GInput 是一句打出來的話和打它的鍵盤，GSend 是一個數字碼和傳過去的檔案（send.css） */
.demo-h { display: flex; align-items: center; gap: 12px; margin-bottom: clamp(20px, 2.4vw, 32px); font-family: var(--zh); font-size: clamp(22px, 2vw, 26px); line-height: 1.2; }
.demo-h img { width: 40px; height: 40px; border-radius: 11px; border: 2.5px solid var(--ink); flex: none; }
.demo-h b { font-family: var(--body); font-weight: 900; letter-spacing: -.01em; margin-right: 2px; }
.demo + .demo-h { margin-top: clamp(64px, 7vw, 104px); }
.demo { display: grid; grid-template-columns: auto 1fr; gap: 36px 64px; align-items: center; }
/* 泡泡在上，鍵盤在下面，泡泡的尾巴指着鍵盤 */
.chat { width: clamp(330px, 32vw, 420px); display: flex; flex-direction: column; align-items: flex-start; gap: 30px; }
.chat .bubble { word-break: keep-all; text-wrap: balance; font-size: clamp(24px, 2.2vw, 32px); padding: 20px 28px; margin-bottom: 0; min-width: 0; }
/* 鍵盤示意的樣式在 kb.css；品牌頁用粉紅影子 */
.chat .kb-demo { width: 100%; --kb-shadow: var(--pink-soft); }
.bubble {
  position: relative;
  font-family: var(--zh);
  font-size: clamp(30px, 3.2vw, 46px);
  line-height: 1.3;
  padding: 26px 34px;
  border: 3.5px solid var(--ink);
  border-radius: 28px 160px 30px 150px / 150px 30px 160px 28px;
  background: var(--paper-2);
  min-height: 1.3em;
  margin-bottom: 30px;
  transform-origin: 20% 100%;
  width: fit-content;
  min-width: 8em;
  max-width: 100%;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 52px; bottom: -22px;
  width: 30px; height: 30px;
  background: var(--paper-2);
  border: 3.5px solid var(--ink);
  border-top: 0; border-left: 0;
  transform: skewX(20deg) rotate(45deg);
}
.bubble .en { color: var(--blue-text); font-family: var(--body); font-weight: 800; margin: 0 .1em; }
.bubble .caret { display: inline-block; width: 3px; height: 1em; background: var(--ink); vertical-align: -0.15em; margin-left: 2px; animation: blink 1s steps(2, start) infinite; }
.bubble .caret[hidden], .no-motion .bubble .caret { display: none; }
@keyframes blink { to { visibility: hidden; } }
.demo-side { padding-top: 10px; }
/* 中文只在標點和空格斷行，不會把「數字」「記住」拆開兩行；太長才在字中間斷 */
.demo-side p { word-break: keep-all; overflow-wrap: anywhere; text-wrap: pretty; }
.demo-note { margin: 0 0 24px 100px; max-width: 22em; transform: rotate(-2deg); line-height: 1.45; }
.demo-note svg { top: 4px; }
.demo-more { font-size: 18px; color: var(--muted); max-width: 30em; padding-left: 100px; }

/* 關於：六個表情是主角 */
.faces { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px 12px; list-style: none; padding: 0; margin: 0 0 clamp(32px, 4vw, 56px); }
.faces li { text-align: center; font-family: var(--zh); font-size: 17px; color: var(--muted); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.faces img { width: min(100%, 150px); height: auto; aspect-ratio: 1; object-fit: contain; margin: 0 auto 6px; transition: transform .45s cubic-bezier(.34, 1.56, .64, 1); }
.faces li:hover img, .faces li.tapped img { transform: rotate(-8deg) scale(1.12); }
.faces li:nth-child(even):hover img, .faces li:nth-child(even).tapped img { transform: rotate(8deg) scale(1.12); }
.about-text { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 48px; }
.about-text .mask { overflow: hidden; }
.about-text p { font-size: 19px; }

/* 聯絡 */
.contact { display: grid; grid-template-columns: 1fr 240px; gap: 32px; align-items: end; }
.stamp { padding: clamp(24px, 3vw, 40px); border-width: 4px; border-radius: 18px 255px 22px 240px / 230px 20px 250px 18px; }
.stamp p { font-family: var(--zh); font-size: 20px; margin-bottom: 10px; }
.stamp p:last-child { margin-bottom: 0; }
.stamp a { font-family: var(--body); font-weight: 800; }
.stamp .big { font-size: clamp(26px, 2.6vw, 34px); margin-bottom: 18px; }
.stamp .big a { font-size: 1em; }
.contact img { width: 220px; margin: 0 auto; }

/* 頁尾 */
.footer {
  border-top: 3px solid var(--ink);
  margin-top: clamp(40px, 6vw, 80px);
  padding: 28px 0 44px;
  font-family: var(--zh);
  font-size: 16px;
  color: var(--muted);
}
.footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px 28px; flex-wrap: wrap; }
.footer .zz { display: flex; align-items: center; gap: 10px; }
.footer .zz img { width: 56px; height: 56px; }
.footer .fine { margin-left: auto; }
.footer a { color: var(--muted); }

/* 404 */
.lost { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 100px var(--gutter) 60px; }
.lost img { width: min(520px, 80vw); margin: 0 auto 10px; }
.lost h1 { font-size: clamp(30px, 4vw, 48px); }
.lost h1 b { font-family: var(--display); font-weight: 400; color: var(--red-text); margin-right: 12px; }
.lost p { font-size: 19px; margin: 10px 0 28px; }

/* 英文頁：句子長，放寬批注和標語 */
html[lang="en"] .note { max-width: 340px; line-height: 1.4; }
html[lang="en"] .tagline { max-width: 20em; }
html[lang="en"] .strip .t p { max-width: 44em; }

/* 減少動態效果：全部直接到位 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .faces img, .btn { transition: none; }
}

/* 窄屏 */
@media (max-width: 899px) {
  :root { --hero-top: 86px; }
  body { font-size: 17px; }
  .nav { height: 64px; }
  .nav-brand img { width: 38px; height: 38px; }
  .nav-wordmark { width: 112px; height: 24px; }
  .nav ul { font-size: 16px; gap: 14px; }
  .nav .long { display: none; }
  .nav .short { display: inline; }
  .hero { height: auto; padding-bottom: 8px; }
  .hero-stage { height: auto; }
  .strip-wrap { padding-top: 24px; }
  .hero-wordmark { position: relative; left: 0; top: 0; width: 100%; margin-top: var(--hero-top); }
  .hero-lines, .hero-puff { display: none; }
  .hero-pig { position: relative; left: -4vw; top: 0; width: 96vw; margin-top: -8vw; }
  .hero-aside { position: relative; left: 0; top: 0; right: auto; padding: 0 var(--gutter); margin-top: 8px; }
  .note { font-size: 21px; margin: 0 0 14px 0; max-width: none; transform: none; }
  .note svg { display: none; }
  .tagline { font-size: 24px; }
  .strip { flex-wrap: wrap; gap: 16px 18px; padding: 18px 20px; border-radius: 120px 14px 110px 14px / 14px 110px 14px 120px; }
  .strip + .strip { border-radius: 14px 120px 14px 110px / 110px 14px 120px 14px; }
  .strip img { width: 64px; height: 64px; border-radius: 16px; }
  .strip .t { flex: 1 1 200px; }
  .strip h2 { font-size: 21px; }
  .strip h2 b { font-size: 22px; display: block; margin: 0; }
  .strip .sell { display: block; margin: 6px 0 0; white-space: normal; }
  .strip p { font-size: 16px; }
  .strip .btn { flex: 1 1 100%; text-align: center; }
  .pill { white-space: normal; }
  .pill .sep { display: none; }
  .pill .nowrap { display: block; }
  .demo { grid-template-columns: 1fr; gap: 20px; }
  .bubble { font-size: 28px; padding: 18px 22px; }
  .chat { width: 100%; max-width: 420px; gap: 28px; }
  .chat .bubble { font-size: 24px; }
  .send-demo { width: 100%; max-width: 460px; }
  .demo-h { font-size: 21px; }
  .demo-h img { width: 34px; height: 34px; border-radius: 9px; }
  .demo-note { margin: 0 0 16px; max-width: none; transform: none; }
  .demo-more { padding-left: 0; }
  .faces { grid-template-columns: repeat(3, 1fr); gap: 16px 8px; }
  .faces li { font-size: 15px; }
  .about-text, .contact { grid-template-columns: 1fr; }
  .contact img { width: 180px; }
  .btn { font-size: 18px; padding: 12px 22px; }
  .footer .fine { margin-left: 0; }
}
@media (max-width: 480px) {
  .nav ul { font-size: 15px; gap: 12px; }
  html[lang="en"] .nav-wordmark { display: none; }
  .bubble { font-size: 26px; }
}

/* 錨點跳轉時不被固定導航遮住 */
[id] { scroll-margin-top: 88px; }
