/* ============================================================
   排桌入座｜全站頂欄與頁尾（/assets/chrome.css）

   HTML 由 tools/site-chrome.mjs 產生（build-site.mjs、build-scenes.mjs 蓋進每一頁）。
   行銷頁、內容頁、場景頁、工具頁都載入這支。變數在 tokens.css。
   類別一律 sh-（頂欄）、sf-（頁尾），不跟工具的 .top、.foot 撞名。
   ============================================================ */

/* ---------- 頂欄：紙白、捲動後下緣出現一條細線 ---------- */

.sh {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper); color: var(--ink);
  transition: box-shadow .2s;
}
.sh.is-scrolled { box-shadow: 0 1px 0 var(--line); }
.sh-in {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 90rem; min-height: 68px; margin: 0 auto; padding: .5rem clamp(1rem, 3vw, 2rem);
}
.sh-brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; }
.sh-brand .mark { width: 34px; height: 34px; flex: none; }
.sh-name { font-family: var(--font); font-size: 1.22rem; font-weight: 900; letter-spacing: -.01em; }
.sh-nav { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2.25rem); }
.sh-nav ul { display: flex; gap: clamp(1rem, 2.2vw, 2rem); margin: 0; padding: 0; list-style: none; }
.sh-nav ul a {
  position: relative; display: inline-block; padding: .4rem 0;
  color: var(--ink); font-weight: 700; font-size: 1rem; text-decoration: none;
}
.sh-nav ul a::after {
  content: ""; position: absolute; left: -.12em; right: -.12em; bottom: .35rem; height: .5em; z-index: -1;
  background: var(--yellow); transform: scaleX(0); transform-origin: left; transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.sh-nav ul a:hover::after, .sh-nav ul a[aria-current]::after { transform: scaleX(1); }
.sh-nav ul li { position: relative; z-index: 0; }
.sh-go {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 46px; padding: .45rem 1.3rem;
  border-radius: var(--r-pill); background: var(--ink); color: #fff;
  font-weight: 700; font-size: 1rem; text-decoration: none; transition: background .12s, transform .12s;
}
.sh-go:hover { background: #2b2b28; }
.sh-go:active { transform: translateY(1px); }
.sh-go .i, .sf-go .i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.sh-go:hover .i, .sf-go:hover .i { transform: translateX(3px); }

.sh-menu {
  display: none; position: relative; z-index: 2; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%;
  background: var(--ink); cursor: pointer;
}
.sh-menu i { position: absolute; left: 14px; right: 14px; height: 2px; background: #fff; border-radius: 2px; transition: transform .25s, top .25s; }
.sh-menu i:first-of-type { top: 18px; }
.sh-menu i:last-of-type { top: 26px; }
.sh-menu[aria-expanded="true"] { background: var(--yellow); }
.sh-menu[aria-expanded="true"] i { background: var(--ink); top: 22px; }
.sh-menu[aria-expanded="true"] i:first-of-type { transform: rotate(45deg); }
.sh-menu[aria-expanded="true"] i:last-of-type { transform: rotate(-45deg); }

/* 手機：收成按鈕，打開是全螢幕近黑底 */
@media (max-width: 52rem) {
  .sh-menu { display: block; }
  .sh-nav {
    position: fixed; inset: 0; z-index: 1; flex-direction: column; align-items: stretch; justify-content: center; gap: 2rem;
    padding: 6rem 1.5rem 2.5rem; background: var(--ink);
    opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
  }
  .sh.is-open .sh-nav { opacity: 1; visibility: visible; }
  .sh.is-open .sh-brand { color: #fff; position: relative; z-index: 2; }
  .sh.is-open .sh-brand .mark circle:last-child { fill: #fff; }
  .sh-nav ul { flex-direction: column; gap: .25rem; }
  .sh-nav ul a { color: #fff; font-size: clamp(2rem, 9vw, 2.75rem); font-weight: 900; letter-spacing: -.02em; padding: .2rem 0; }
  .sh-nav ul a::after { bottom: .55rem; }
  .sh-nav ul a[aria-current], .sh-nav ul a:hover { color: var(--ink); }
  .sh-go { justify-content: center; min-height: 56px; background: var(--yellow); color: var(--ink); font-size: 1.1rem; }
  .sh-go:hover { background: var(--yellow-hover); }
  body.sh-lock { overflow: hidden; }
}
@media (min-width: 52.01rem) { .sh-nav { position: static; opacity: 1; visibility: visible; } }

/* ---------- 頁尾：滿版螢光黃＋超大字標 ---------- */

.sf { position: relative; background: var(--yellow); color: var(--ink); }
/* 帶位員從頁尾上緣探出頭（插畫底下那條線就是頁尾的上緣） */
.sf-peek { position: absolute; right: clamp(1rem, 8vw, 8rem); top: 1px; width: clamp(150px, 17vw, 260px); height: auto; transform: translateY(-100%); pointer-events: none; }
.sf-in { max-width: 90rem; margin: 0 auto; padding: clamp(3.5rem, 8vw, 6.5rem) clamp(1rem, 3vw, 2rem) 1.5rem; }
.sf a { color: var(--ink); }
.sf-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem 2rem; padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.sf-line { font-size: clamp(1.4rem, 1rem + 1.6vw, 2.25rem); font-weight: 900; line-height: 1.3; letter-spacing: -.02em; max-width: 34rem; }
.sf-go {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 56px; padding: .6rem 1.75rem;
  border-radius: var(--r-pill); background: var(--ink); color: #fff !important;
  font-weight: 700; font-size: 1.08rem; text-decoration: none; transition: background .12s, transform .12s;
}
.sf-go:hover { background: #2b2b28; }
.sf-go:active { transform: translateY(1px); }
.sf-go:focus-visible, .sf a:focus-visible, .sf summary:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.sf-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1.5rem; }
@media (min-width: 48rem) { .sf-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sf-col h2 { margin: 0 0 .75rem; font-size: 1rem; font-weight: 900; }
.sf-col ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .35rem; }
.sf-col a { display: inline-block; padding: .15rem 0; text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 2px; text-underline-offset: 5px; font-size: 1rem; transition: text-decoration-color .15s; }
.sf-col a:hover { text-decoration-color: currentColor; }
.sf-soc { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; }
.sf-soc svg { width: 26px; height: 26px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sf-soc svg .dot { fill: currentColor; stroke: none; }
.sf-soc.is-off { cursor: default; }
.sf-soc small { display: block; font-size: .875rem; font-weight: 400; }
.sf-socs { gap: .8rem !important; }

.sf-scenes { margin-top: 2.5rem; padding-top: 1.25rem; box-shadow: inset 0 2px 0 var(--ink); }
.sf-scenes summary {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; cursor: pointer;
  font-weight: 900; font-size: 1rem; list-style: none;
}
.sf-scenes summary::-webkit-details-marker { display: none; }
.sf-scenes summary::after {
  content: ""; width: 10px; height: 10px; margin-top: -4px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor;
  transform: rotate(45deg); transition: transform .2s;
}
.sf-scenes[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.sf-scenes ul { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.sf-scenes a { display: inline-block; padding: .2rem 0; text-decoration: none; font-size: .95rem; }
.sf-scenes a:hover, .sf-scenes a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* 超大字標：「入座」反過來，近黑螢光筆、白字 */
.sf-word {
  margin: clamp(2.5rem, 6vw, 4.5rem) 0 0; font-family: var(--font); font-weight: 900;
  font-size: clamp(4.5rem, 21vw, 20rem); line-height: .9; letter-spacing: -.06em; white-space: nowrap; max-width: 100%; overflow: hidden;
}
.sf-word span { position: relative; z-index: 0; display: inline-block; line-height: 1; color: var(--paper); }
.sf-word span::before {
  content: ""; position: absolute; left: -.02em; right: .04em; top: .1em; bottom: .02em; z-index: -1;
  background: var(--ink); clip-path: polygon(1% 6%, 100% 0, 99% 94%, 0 100%); transform: rotate(-1.5deg);
}
.sf-legal { margin: clamp(1.25rem, 3vw, 2.5rem) 0 0; font-size: .875rem; font-family: var(--font-num), var(--font); font-weight: 700; }

/* 工具頁用的精簡版：紙白、不搶黃色鈕 */
.sf-compact { background: var(--paper); box-shadow: inset 0 1px 0 var(--line); }
.sf-compact .sf-in { padding-top: 2.75rem; }
.sf-compact .sf-brand { display: inline-flex; align-items: center; gap: .55rem; margin-bottom: 2rem; font-weight: 900; font-size: 1.15rem; text-decoration: none; }
.sf-compact .sf-brand .mark { width: 30px; height: 30px; }
.sf-compact .sf-scenes { box-shadow: inset 0 1px 0 var(--line); }
.sf-compact .sf-col a, .sf-compact .sf-scenes a { color: var(--ink-2); }
.sf-compact .sf-legal { color: var(--ink-3); }
body.has-dock .sf .sf-in { padding-bottom: 7rem; }

@media (prefers-reduced-motion: reduce) {
  .sh, .sh-nav, .sh-nav ul a::after, .sh-menu i, .sh-go .i, .sf-go .i, .sf-col a { transition: none !important; }
}

/* 跳到內容：平常藏著，Tab 第一下出現 */
.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: .6rem 1rem; border-radius: var(--r-pill);
  background: var(--ink); color: #fff; font-weight: 700; text-decoration: none;
}
.skip:focus { top: .75rem; }
