/* =====================================================================
   alvisdigital 內頁共用樣式（原型）
   設計 token、頂部列、☰ 選單、轉場、按鈕、章節、行動區、頁尾
   ===================================================================== */
:root {
  --ink: #0a0a0a; --paper: #ffffff; --mute: #6b6b6b; --line: #e6e6e6; --soft: #f4f4f2; --lime: #d8f36a;
  --font: "Inter Tight", "Noto Sans TC", system-ui, sans-serif;
  --zh: "Noto Sans TC", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --section: clamp(72px, 10vw, 150px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); }
body { font-size: 17px; line-height: 1.8; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
.wrap { padding-left: var(--gutter); padding-right: var(--gutter); max-width: 1440px; margin: 0 auto; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 999px; }
.skip:focus { left: 8px; }
.eyebrow { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; margin: 0; }
html, body { overflow-x: clip; }                         /* 保險：任何情況下頁面都不會出現左右拖曳 */

/* ===== 斷行規則 =====
   標題：讓瀏覽器平均分配每一行，避免最後一行只剩一個字
   內文：避免段落最後一行只剩一兩個字
   .ln：只能在 .ln 與 .ln 之間換行（用在需要指定斷點的大標） */
h1, h2, h3, .zh, .menu-cards b, .menu-list span, .sub, .intro { text-wrap: balance; }
p, li, figcaption, td, th { text-wrap: pretty; }
.ln { display: inline-block; }

/* ===== 頂部列 ===== */
.topbar { position: fixed; inset: 0 0 auto 0; z-index: 800; display: flex; justify-content: space-between; align-items: center;
          padding: 22px var(--gutter); color: var(--ink); pointer-events: none; transition: transform .35s cubic-bezier(.7,0,.2,1), background .3s, padding .3s; }
.topbar a, .topbar button { pointer-events: auto; }
.topbar.hide { transform: translateY(-110%); }
.topbar.solid { background: rgba(255,255,255,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 1px 0 var(--line); padding-top: 14px; padding-bottom: 14px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.logo-mark { display: block; width: 44px; height: auto; aspect-ratio: 303 / 243; fill: currentColor; }
.menu-btn { background: none; border: 0; color: inherit; font: 500 26px/1 var(--font); cursor: pointer; padding: 6px; }

/* ===== 按鈕 ===== */
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 13px 20px; border-radius: 999px; font: 500 15px/1 var(--font);
       text-decoration: none; cursor: pointer; border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
       box-shadow: 0 0 0 1px var(--lime); transition: background .25s, color .25s, border-color .25s; }
.btn:hover, .btn:focus-visible { background: var(--lime); color: var(--ink); outline: none; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; }
.btn.ghost:hover, .btn.ghost:focus-visible { background: var(--ink); color: var(--paper); }
.btn .arr { transition: transform .25s; }
.btn:hover .arr { transform: translateX(3px); }
.text-link { font-weight: 500; text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; padding-bottom: 2px; transition: background-size .3s; }
.text-link:hover { background-size: 0 1px; background-position: 100% 100%; }

/* ===== 內頁標題區 ===== */
.page-head { padding: clamp(120px, 16vw, 200px) 0 clamp(40px, 6vw, 72px); }
.back { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; text-decoration: none; margin-bottom: 28px; }
.back::before { content: "←"; transition: transform .25s; }
.back:hover::before { transform: translateX(-4px); }
.page-head h1 { margin: 0; font: 900 clamp(44px, 8vw, 120px)/1.05 var(--zh); letter-spacing: -.02em; }
.page-head .intro { margin: 24px 0 0; max-width: 34em; font-size: clamp(17px, 1.4vw, 20px); }
.page-head .rule { height: 2px; background: var(--ink); margin-top: clamp(32px, 5vw, 56px); transform-origin: left; animation: draw 1s cubic-bezier(.7,0,.2,1) .2s both; }
@keyframes draw { from { transform: scaleX(0); } }

/* ===== 章節 ===== */
section.block { padding-top: var(--section); }
section.band { position: relative; margin-top: var(--section); padding-top: var(--section); padding-bottom: var(--section); background: var(--soft);
               box-shadow: 0 0 0 100vmax var(--soft); clip-path: inset(0 -100vmax); }
.sec-head { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: end; padding-bottom: 28px; border-bottom: 2px solid var(--ink); }
.sec-head h2 { margin: 8px 0 0; font: 900 clamp(28px, 3.6vw, 52px)/1.2 var(--zh); letter-spacing: -.01em; }
.sec-head p { margin: 0; max-width: 34em; }
@media (max-width: 760px) { .sec-head { grid-template-columns: 1fr; } }

/* ===== 有方向的反轉 ===== */
[data-dir] { position: relative; overflow: hidden; }
[data-dir] > :not(.dir-fill) { position: relative; z-index: 1; }
.dir-fill { position: absolute; inset: 0; background: var(--ink); z-index: 0; pointer-events: none;
            transform: translate(var(--fx, -101%), var(--fy, 0)); transition: transform .38s cubic-bezier(.7,0,.2,1); }
.dir-fill.lime { background: var(--lime); }
.is-on > .dir-fill { transform: translate(0, 0); }

/* ===== 行動區（每頁底部） ===== */
.cta { margin-top: var(--section); background: var(--ink); color: var(--paper); border-radius: 28px; padding: clamp(40px, 8vw, 110px); display: grid; gap: 32px; }
.cta h2 { margin: 0; font: 900 clamp(40px, 7vw, 104px)/1.05 var(--zh); letter-spacing: -.02em; }
.cta .row { display: flex; gap: 14px; flex-wrap: wrap; }
.cta .btn { background: var(--lime); color: var(--ink); border-color: var(--lime); box-shadow: none; }
.cta .btn:hover { background: var(--paper); border-color: var(--paper); }
.cta .btn.ghost { background: transparent; color: var(--paper); border-color: var(--paper); }
.cta .btn.ghost:hover { background: var(--paper); color: var(--ink); }
.cta.cta-full { border-radius: 0; padding-top: clamp(88px, 11vw, 170px); padding-bottom: clamp(88px, 11vw, 170px); overflow: hidden; }
/* 萊姆綠滿版色帶（寬度與左右對齊由 site.js 計算）＋滑鼠流動 */
.fluid-sec { position: relative; isolation: isolate; }
.fluid-sec > canvas.fr { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; display: block; }
.fluid-sec > canvas.ov { z-index: 1; }
.cta.cta-lime { background: var(--lime); color: var(--ink); }
.cta.cta-lime .btn { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cta.cta-lime .btn:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.cta.cta-lime .btn.ghost { background: var(--lime); color: var(--ink); border-color: var(--ink); }
.cta.cta-lime .btn.ghost:hover { background: var(--ink); color: var(--lime); border-color: var(--ink); }
@media (max-width: 600px) {
  .cta { padding: 32px 24px; border-radius: 22px; gap: 24px; }
  .cta.cta-full { border-radius: 0; padding-top: 64px; padding-bottom: 64px; }
  .cta h2 { font-size: 34px; line-height: 1.2; }
  .cta h2 .ln { display: block; }                        /* 手機固定兩行：「從你的」／「需求開始」 */
}

/* ===== 頁尾 ===== */
footer.site { padding-top: 56px; padding-bottom: 40px; display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 14px; }
footer.site nav a { text-decoration: none; }
footer.site nav a:hover { text-decoration: underline; }
footer.site .foot-logo .logo-mark { width: 72px; }

/* ===== ☰ 選單 ===== */
.menu { position: fixed; inset: 0; z-index: 850; background: var(--ink); color: var(--paper); display: none; overflow: auto; overflow-x: hidden;
        padding: 22px var(--gutter) 28px; flex-direction: column; }
.menu.open { display: flex; }
.menu > :not(.menu-mark) { position: relative; z-index: 1; }
.menu-top { display: flex; justify-content: space-between; align-items: center; }
.menu-top .close { background: none; border: 0; color: inherit; font: 500 28px/1 var(--font); cursor: pointer; }
.menu-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(32px, 5vw, 80px); margin-top: 40px; }
.menu-left { position: relative; }
.menu-caption { font: italic 700 clamp(28px, 3vw, 44px)/1.1 var(--font); letter-spacing: -.02em; margin: 0 0 24px; transition: opacity .3s; }
.menu .stag { opacity: 0; transform: translateY(26px); transition: opacity .45s ease, transform .6s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--i, 0) * 55ms + 80ms); }
.menu.in .stag { opacity: 1; transform: none; }
.menu-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; transition: opacity .3s; }
.menu-cards a { border: 1px solid #ffffff40; border-radius: 16px; padding: 16px 18px; min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; transition: color .25s, border-color .25s; }
.menu-cards small { font-size: 11px; letter-spacing: .12em; }
.menu-cards .mnum { font: 800 48px/1 var(--font); letter-spacing: -.04em; -webkit-text-stroke: 1.2px var(--paper); color: transparent; transition: -webkit-text-stroke-color .25s; }
.menu-cards .mnum.faq { font-style: italic; }
.menu-cards b { font: 700 18px/1.3 var(--zh); }
.menu-cards a.is-on { color: var(--ink); border-color: var(--lime); }
.menu-cards a.is-on .mnum { -webkit-text-stroke-color: var(--ink); }
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-list a { position: relative; overflow: hidden; display: grid; grid-template-columns: 56px 1fr auto; align-items: center; padding: 12px 14px 12px 4px;
               border-bottom: 1px solid #ffffff26; text-decoration: none; font: 900 clamp(28px, 3.6vw, 52px)/1.2 var(--zh); transition: color .25s; }
.menu-list a::before { content: ""; position: absolute; inset: 0; background: var(--lime); transform: scaleX(0); transform-origin: left; transition: transform .45s cubic-bezier(.7,0,.2,1); }
.menu-list a > * { position: relative; }
.menu-list a small { font: 500 14px/1 var(--font); color: #9a9a9a; padding-left: 10px; transition: color .25s; }
.menu-list a .arr { font: 500 clamp(24px, 2.6vw, 40px)/1 var(--font); opacity: 0; transform: translateX(-24px); transition: opacity .3s, transform .45s cubic-bezier(.2,.7,.2,1); }
.menu-list a:hover, .menu-list a:focus-visible, .menu-list a[aria-current] { color: var(--ink); outline: none; }
.menu-list a:hover::before, .menu-list a:focus-visible::before, .menu-list a[aria-current]::before { transform: scaleX(1); }
.menu-list a:hover small, .menu-list a:focus-visible small, .menu-list a[aria-current] small { color: var(--ink); }
.menu-list a:hover .arr, .menu-list a:focus-visible .arr { opacity: 1; transform: none; }
.menu-preview { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; pointer-events: none;
                opacity: 0; transform: translateY(12px); transition: opacity .3s, transform .4s cubic-bezier(.2,.7,.2,1); }
.menu-preview .pv-num { font: 800 clamp(120px, 16vw, 260px)/.85 var(--font); letter-spacing: -.05em; -webkit-text-stroke: 2px var(--lime); color: transparent; }
.menu-preview .pv-name { font: 900 clamp(28px, 3vw, 48px)/1.2 var(--zh); color: var(--lime); }
.menu-left.previewing .menu-preview { opacity: 1; transform: none; }
.menu-left.previewing .menu-cards, .menu-left.previewing .menu-caption { opacity: .08; }
.menu-mark { position: absolute; right: -3vw; bottom: -6vh; width: min(44vw, 620px); aspect-ratio: 303 / 243; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .8s ease .2s; }
.menu.in .menu-mark { opacity: .9; }
.menu-foot { margin-top: auto; padding-top: 40px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; font-size: 12px; letter-spacing: .14em; color: #bdbdbd; max-width: 50%; }
.menu-foot .sig { font: italic 700 clamp(20px, 2vw, 28px)/1 var(--font); letter-spacing: -.02em; color: var(--paper); }
@media (max-width: 860px) {
  .menu-grid { grid-template-columns: 1fr; }
  .menu-preview { display: none; }
  .menu-mark { width: 78vw; right: -10vw; bottom: -4vh; }
  .menu-cards a { min-height: 118px; padding: 14px; }
  .menu-cards .mnum { font-size: 30px; }
  .menu-cards b { font-size: 15px; }
  .menu-cards small { font-size: 10px; letter-spacing: .08em; }
  .menu-list a { font-size: 26px; grid-template-columns: 44px 1fr auto; }
}

/* ===== 萊姆綠流體轉場 ===== */
.wipe { position: fixed; inset: -80px; z-index: 900; pointer-events: none; filter: url(#wipe-wobble); }
.wipe-in { position: absolute; inset: 0; background: var(--lime); clip-path: circle(0px at 50% 50%); }
.wipe-label { position: fixed; inset: 0; z-index: 901; display: grid; place-items: center; pointer-events: none; color: var(--ink);
              font: 800 clamp(40px, 9vw, 120px)/1 var(--font); letter-spacing: -.04em; opacity: 0; transition: opacity .15s; }
html.arriving .wipe-in { clip-path: circle(150vmax at 50% 50%); }   /* 從別頁換過來：先蓋滿，再退開 */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 950; background: var(--ink); color: var(--paper);
         padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== 粒子游標 ===== */
@media (hover: hover) and (pointer: fine) {
  html.has-cursor, html.has-cursor a, html.has-cursor button, html.has-cursor summary { cursor: none; }
  html.has-cursor [data-quiet], html.has-cursor [data-quiet] * { cursor: auto; }
  html.has-cursor [data-quiet] a, html.has-cursor [data-quiet] button, html.has-cursor [data-quiet] summary { cursor: pointer; }
}
@media (prefers-reduced-motion: reduce) {
  .wipe, .cursor-canvas { display: none !important; }
  .menu .stag { opacity: 1; transform: none; transition: none; }
  .page-head .rule { animation: none; }
}
