/* 網站共用：色票、字型、Header、Footer、兩側小字、回到頂端、游標光暈
   規格見 website/home-brief.md。首頁專用的樣式在 home.css */

:root {
  --bg: #EEF0F3;
  --ink: #111316;
  --mute: #5F6873;
  --line: #D3D9E0;
  --hot: #FF4A1C;
  --en: "Urbanist", "Noto Sans TC", sans-serif;
  --mono: "IBM Plex Mono", "Noto Sans TC", monospace;
  --zh: "Noto Sans TC", sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
  /* 細紙紋 */
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --shadow: 0 1px 2px rgba(30,42,58,.12), 0 18px 34px -26px rgba(30,42,58,.45);
  --shadow-2: 0 1px 2px rgba(30,42,58,.16), 0 8px 16px -10px rgba(30,42,58,.35);
  /* 內容寬 1120；兩側留白最少 32px（手機 16px） */
  --gutter: 32px;
  --edge: max(var(--gutter), calc(50% - 560px));
}
* { box-sizing: border-box; margin: 0; }
/* 橫向超出只在 html 藏起來；body 不要再設 overflow 不然 body 會變成另一個捲動區塊 手機點錨點會不動或亂跳 */
html { scroll-behavior: smooth; scroll-padding-top: 110px; overflow-x: clip; }
body { position: relative; background: var(--bg); color: var(--ink); font-family: var(--zh); font-size: 16px; line-height: 1.8; letter-spacing: .08em; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { padding: 0; }
.wrap { position: relative; width: min(1120px, 100% - var(--gutter) * 2); margin: 0 auto; }
.ico { width: 1em; height: 1em; flex: none; }
main, .ft { position: relative; z-index: 1; }
/* 不換行：句尾的詞包起來 整個一起換行 避免孤字 */
.nw { white-space: nowrap; }
a:focus, button:focus { outline: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 16px rgba(255,74,28,.3); }

/* ── 游標光暈：平滑、小、淡（觸控裝置不顯示） ── */
.glow { position: fixed; left: 0; top: 0; width: 380px; height: 380px; margin: -190px 0 0 -190px; translate: var(--gx, 74vw) var(--gy, 300px); transition: translate .7s var(--ease); pointer-events: none; z-index: 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(255,74,28,.26), rgba(255,140,60,.1) 50%, transparent 76%); filter: blur(18px); }
@media (hover: none) { .glow { display: none; } }

/* ── 紙膠帶、迴紋針 ── */
.tape { position: absolute; width: 96px; height: 26px; background: rgba(196,207,219,.6); box-shadow: 0 1px 2px rgba(30,42,58,.1); }
.tape.w { background: rgba(250,251,252,.7); }
.pclip { position: absolute; z-index: 4; width: 40px; filter: drop-shadow(0 2px 2px rgba(30,42,58,.25)); }

/* ── Header：滿版圓角長條 細黑框 淡淡的毛玻璃 ── */
.hd { position: fixed; top: 14px; left: 16px; right: 16px; z-index: 50; height: 72px; padding: 0 22px 0 30px; display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "name nav icons"; align-items: center; border: 1.5px solid var(--ink); border-radius: 22px; background: rgba(248,249,251,.74); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); }
.hd-name { grid-area: name; font-family: var(--en); font-weight: 700; font-size: 21px; letter-spacing: .01em; }
.hd-nav { grid-area: nav; display: flex; gap: 44px; }
.hd-nav a { position: relative; display: flex; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 500; transition: color .3s; }
.hd-nav b { font-family: var(--mono); font-weight: 500; font-size: 13.5px; letter-spacing: .06em; }
.hd-nav a::after { content: ""; position: absolute; left: 50%; top: 50%; width: 60px; height: 26px; translate: -50% -50%; border-radius: 50%; background: var(--hot); filter: blur(14px); opacity: 0; transition: opacity .35s; z-index: -1; }
.hd-nav a:hover::after { opacity: .22; }
/* 點了或捲到那一段：字變橘紅 */
.hd-nav a.on { color: var(--hot); }
.hd-icons { grid-area: icons; justify-self: end; display: flex; gap: 10px; }
.hd-icons a { position: relative; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #B9C4D0; color: #fff; font-size: 19px; transition: background .3s, box-shadow .3s; }
.hd-icons a:hover { background: #8C9DB0; box-shadow: 0 0 18px rgba(255,74,28,.25); }
[data-tip]::after { content: attr(data-tip); position: absolute; top: calc(100% + 12px); right: 0; translate: 0 -4px; padding: 6px 12px; white-space: nowrap; background: #FBFCFD; color: var(--ink); font-family: var(--zh); font-size: 13px; font-weight: 500; letter-spacing: 0; border-radius: 6px; box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity .25s, translate .25s var(--ease); }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; translate: 0 0; }
@media (hover: none) { [data-tip]::after { display: none; } }

/* ── 兩側直排小字 ── */
.side { position: fixed; top: 50%; z-index: 40; font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--mute); writing-mode: vertical-rl; translate: 0 -50%; white-space: nowrap; }
.side.l { left: 12px; rotate: 180deg; }
.side.r { right: 12px; }

/* ── 區塊標題列 ── */
.sec { display: flex; justify-content: space-between; font-family: var(--en); font-size: 14px; font-weight: 600; letter-spacing: .04em; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 72px; }
.sec b { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.sec b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.sec span { color: var(--mute); font-weight: 500; }

/* ── 資料夾頭：像 Mac 資料夾 左邊垂直 右邊斜下來（作品卡、Footer 共用） ── */
.mac-tab { position: relative; border-radius: 12px 0 0 0; background: var(--noise) 0 0/220px, var(--fc); }
.mac-tab::after { content: ""; position: absolute; top: 0; bottom: -1px; right: -40px; width: 52px; background: inherit; border-top-right-radius: 12px; transform: skewX(30deg); transform-origin: 0 100%; z-index: -1; }

/* ── Footer：Mac 資料夾的上半部（後片＋分頁、一張白紙、前片） ── */
.ft { margin-top: 180px; }
.mf { position: relative; padding-top: 84px; --back: #B3BFCC; --front: #CBD4DE; }
.mf-tab { position: absolute; z-index: 1; top: 0; left: var(--edge); display: flex; align-items: center; gap: 10px; height: 46px; padding: 2px 12px 0 24px; --fc: var(--back); font-family: var(--en); font-weight: 800; font-size: 15px; letter-spacing: .08em; }
.mf-tab span { font-family: var(--zh); font-weight: 700; font-size: 14px; letter-spacing: .08em; }
.mf-back { position: absolute; left: 0; right: 0; top: 45px; bottom: 0; background: var(--noise) 0 0/220px, var(--back); border-top-right-radius: 14px; }
.mf-paper { position: absolute; left: 28px; right: 28px; top: 62px; bottom: 0; background: var(--noise) 0 0/220px, #FBFCFD; border-radius: 6px 6px 0 0; box-shadow: 0 -1px 2px rgba(30,42,58,.12); }
.mf-front { position: relative; padding: 30px 0 22px; background: var(--noise) 0 0/220px, var(--front); border-radius: 12px 12px 0 0; box-shadow: 0 -1px 2px rgba(30,42,58,.14), 0 -6px 12px -10px rgba(30,42,58,.3); }
.ft-links { display: flex; justify-content: flex-end; gap: 44px; }
.ft-links a { display: flex; align-items: center; gap: 10px; font-family: var(--en); font-weight: 800; font-size: 16px; letter-spacing: .08em; transition: color .3s; }
.ft-links .ico { font-size: 19px; }
.ft-links a:hover { color: var(--hot); }
.ft-small { margin-top: 26px; padding-top: 14px; border-top: 1px solid rgba(17,19,22,.14); display: flex; justify-content: space-between; gap: 6px 24px; font-size: 13px; color: #3F4954; }
.ft-small .mono { font-family: var(--mono); font-size: 12px; }

/* ── 其他專案：三個內頁結尾 Footer 上面 推薦另外兩個專案（文字跟首頁作品卡同一份） ── */
.oth { position: relative; z-index: 1; padding: 110px 0 120px; font-family: var(--zh); font-size: 16px; line-height: 1.6; letter-spacing: .06em; color: var(--ink); }
.oth + .ft { margin-top: 0; }
.oth .sec { margin-bottom: 40px; }
.oth-list { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.oth-card { display: grid; grid-template-columns: 160px 1fr auto; align-items: center; gap: 22px; padding: 16px 22px 16px 16px; border-radius: 16px; background: var(--noise) 0 0/220px, #F8F9FB; box-shadow: var(--shadow-2); transition: translate .45s var(--ease), box-shadow .45s; }
.oth-card:hover { translate: 0 -4px; box-shadow: var(--shadow); }
.oth-img { display: block; height: 112px; border-radius: 10px; overflow: hidden; background: #DDE3E9; }
.oth-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.oth-img img.tl { object-position: 0 0; }
/* 字距、行高寫死：好彼、BGA 頁有自己的設定 不寫死三頁會不一樣 */
.oth-txt { display: grid; gap: 3px; min-width: 0; letter-spacing: .05em; line-height: 1.6; }
.oth-txt small { font-family: var(--en); font-size: 12px; font-weight: 800; letter-spacing: .08em; color: var(--mute); }
.oth-txt b { font-size: 19px; font-weight: 700; line-height: 1.4; }
.oth-txt span { font-size: 13.5px; color: #3F4954; }
.oth-go { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; transition: rotate .4s var(--ease), background .35s; }
.oth-go svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.oth-card:hover .oth-go { rotate: 45deg; background: var(--hot); }
@media (max-width: 1099px) { .oth-list { grid-template-columns: 1fr; gap: 16px; } }
@media (max-width: 767px) {
  .oth { padding: 72px 0 84px; }
  .oth .sec { margin-bottom: 28px; }
  .oth-card { grid-template-columns: 96px 1fr auto; gap: 14px; padding: 12px 14px 12px 12px; border-radius: 14px; }
  .oth-img { height: 72px; border-radius: 8px; }
  .oth-txt small { font-size: 11px; }
  .oth-txt b { font-size: 16px; }
  .oth-txt span { font-size: 12.5px; }
  .oth-go { width: 36px; height: 36px; }
  .oth-go svg { width: 17px; height: 17px; }
}

/* ── 懸浮的回到頂端：液態玻璃圓鈕 捲過開場才出現 ── */
.totop { position: fixed; right: 26px; bottom: 26px; z-index: 45; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; color: var(--ink); background: radial-gradient(120% 120% at 30% 20%, rgba(255,255,255,.8), rgba(255,255,255,.2) 45%, rgba(220,228,236,.3) 70%, rgba(255,255,255,.55)); backdrop-filter: blur(10px) saturate(1.6); -webkit-backdrop-filter: blur(10px) saturate(1.6); box-shadow: inset 0 1.5px 1px rgba(255,255,255,.95), inset 0 -2px 4px rgba(120,136,154,.35), inset 0 0 0 1px rgba(255,255,255,.55), 0 1px 2px rgba(30,42,58,.25); opacity: 0; translate: 0 12px; pointer-events: none; transition: opacity .35s, translate .35s var(--ease), box-shadow .35s; }
.totop.on { opacity: 1; translate: 0 0; pointer-events: auto; }
.totop:hover { box-shadow: inset 0 1.5px 1px rgba(255,255,255,.95), inset 0 -2px 4px rgba(120,136,154,.35), inset 0 0 0 1px rgba(255,255,255,.55), 0 1px 2px rgba(30,42,58,.25), 0 0 22px 2px rgba(255,74,28,.28); }

/* ── 寬度變窄 ── */
@media (max-width: 1239px) { .side { display: none; } }

@media (max-width: 767px) {
  :root { --gutter: 16px; }
  html { scroll-padding-top: 120px; }
  body { font-size: 15px; letter-spacing: .05em; }
  /* Header 不收：上排名字＋icon 下排導覽 */
  .hd { top: 10px; left: 10px; right: 10px; height: auto; padding: 10px 12px 8px 18px; grid-template-columns: 1fr auto; grid-template-areas: "name icons" "nav nav"; row-gap: 6px; border-radius: 18px; }
  .hd-name { font-size: 19px; }
  .hd-icons { gap: 8px; }
  .hd-icons a { width: 36px; height: 36px; font-size: 17px; }
  .hd-nav { justify-content: space-between; gap: 0; padding: 6px 2px 0; border-top: 1px solid rgba(17,19,22,.12); }
  /* 手機導覽只留英文 */
  .hd-nav a { font-size: 0; }
  .hd-nav b { font-size: 13px; letter-spacing: .06em; }
  .sec { margin-bottom: 48px; font-size: 13px; }
  .ft { margin-top: 120px; }
  .mf { padding-top: 78px; }
  .mf-tab { height: 42px; font-size: 14px; padding-left: 18px; }
  .mf-back { top: 41px; }
  .mf-paper { left: 12px; right: 12px; top: 58px; }
  /* 底部留空間給懸浮的回到頂端按鈕 */
  .mf-front { padding: 24px 0 78px; }
  /* 信箱地址比較長：字縮一點 真的放不下才換行 */
  .ft-links { justify-content: flex-start; flex-wrap: wrap; gap: 12px 24px; }
  .ft-links a { font-size: 14px; letter-spacing: .04em; gap: 8px; }
  .ft-small { flex-direction: column; margin-top: 22px; font-size: 12.5px; }
  .totop { right: 16px; bottom: 16px; width: 46px; height: 46px; font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }
