/* ── 前台：簡約作品牆，一路往下捲 ── */
:root {
  --bg: #f4f1ec; --bg-2: #e9e4dd; --fg: #1a1817; --muted: #77706a; --line: rgba(26, 24, 23, .12);
  --accent: #b3261e; --overlay: rgba(244, 241, 236, .96);
  --serif: 'Cormorant Garamond', 'Noto Serif TC', serif;
  --serif-tc: 'Noto Serif TC', 'Cormorant Garamond', serif;
  --sans: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --gutter: clamp(12px, 3.2vw, 48px); --gap: clamp(6px, 1vw, 14px); --ease: cubic-bezier(.2, .7, .2, 1);
}
:root[data-theme="dark"] {
  --bg: #0e0d0c; --bg-2: #1b1917; --fg: #f2ede7; --muted: #aba39b; --line: rgba(242, 237, 231, .16);
  --overlay: rgba(10, 9, 8, .96);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--fg); font: 300 15px/1.75 var(--sans); letter-spacing: .02em; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
main { flex: 1; width: 100%; }
.protect img, .protect video { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }

/* ── 頂欄 ── */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter); padding-top: max(14px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.brand { font: 500 22px/1 var(--serif); letter-spacing: .06em; white-space: nowrap; }
.brand em { font-style: normal; color: var(--accent); }
.top-nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 28px); }
.top-nav a.txt { font-size: 13px; letter-spacing: .16em; color: var(--muted); padding: 6px 0; position: relative; transition: color .2s; }
.top-nav a.txt span { font: italic 400 14px var(--serif); letter-spacing: .04em; margin-left: 3px; opacity: .8; }
.top-nav a.txt:hover, .top-nav a.txt.on { color: var(--fg); }
.top-nav a.txt.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--accent); }
@media (max-width: 560px) { .top-nav a.txt span { display: none; } }

/* ── 簡介 ── */
.intro { padding: clamp(40px, 8vw, 96px) var(--gutter) clamp(28px, 4vw, 48px); max-width: 860px; animation: rise .8s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.intro h1 { font: 400 clamp(44px, 8vw, 104px)/.95 var(--serif); letter-spacing: .01em; }
.intro h1 .tc { display: block; font: 400 clamp(16px, 2.2vw, 22px)/1.6 var(--serif-tc); letter-spacing: .32em; margin-top: 14px; color: var(--muted); }
.intro .tagline { font: 400 clamp(17px, 2vw, 21px)/1.5 var(--serif-tc); color: var(--accent); margin-top: 22px; letter-spacing: .2em; }
.intro .bio { margin-top: 12px; color: var(--muted); white-space: pre-line; font-size: 14px; max-width: 520px; }
.intro .loc { margin-top: 10px; font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.links a { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; position: relative; border: 1px solid var(--line); transition: transform .3s var(--ease), border-color .2s; }
.links a:hover { transform: translateY(-2px); border-color: var(--fg); }
.links svg { width: 19px; height: 19px; }
.links img { width: 22px; height: 22px; border-radius: 5px; object-fit: contain; }
.links a::after { content: attr(data-label); position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(-4px); white-space: nowrap; font-size: 12px; padding: 4px 10px; border-radius: 6px; background: var(--fg); color: var(--bg); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 5; }
@media (hover: hover) { .links a:hover::after { opacity: 1; transform: translateX(-50%); } }
.email { display: inline-block; margin-top: 16px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.email:hover { color: var(--fg); }

/* ── 瀑布流（依原比例，左右錯開） ── */
.wall { display: flex; gap: var(--gap); align-items: flex-start; padding: 0 var(--gutter); }
.wall .col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.tile { position: relative; display: block; width: 100%; background: var(--bg-2); overflow: hidden; cursor: zoom-in; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .7s var(--ease), transform 1.1s var(--ease); }
.tile img.loaded, .tile video { opacity: 1; }
@media (hover: hover) { .tile:hover img { transform: scale(1.025); } }
.tile .play { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; pointer-events: none; }
.tile .play::before { content: ''; width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(255,255,255,.8); background: rgba(0,0,0,.22) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 7l8 5-8 5z' fill='white'/%3E%3C/svg%3E") center/24px no-repeat; backdrop-filter: blur(4px); }
.tile .ext { position: absolute; right: 10px; bottom: 9px; font-size: 11px; letter-spacing: .14em; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.6); z-index: 1; }
.tile.noposter { aspect-ratio: 4 / 5; }
.sentinel { height: 1px; }
.end { text-align: center; padding: 56px 0 0; font: italic 400 16px var(--serif); color: var(--muted); }
.empty { padding: 90px 20px; color: var(--muted); text-align: center; font: italic 400 19px var(--serif); }
.section-title { padding: clamp(40px, 7vw, 80px) var(--gutter) clamp(20px, 3vw, 32px); font: 400 clamp(26px, 4vw, 40px)/1.2 var(--serif-tc); letter-spacing: .14em; }
.section-title small { display: block; font: italic 400 .5em var(--serif); color: var(--muted); letter-spacing: .06em; margin-top: 4px; }

/* ── 頁尾 ── */
.footer { margin-top: 72px; padding: 28px var(--gutter); padding-bottom: max(28px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); letter-spacing: .12em; }
.footer em { font: italic 400 15px var(--serif); letter-spacing: .04em; }

/* ── 燈箱（固定在畫面上，不受捲動影響） ── */
.lightbox { position: fixed; inset: 0; z-index: 100; background: var(--overlay); display: grid; place-items: center; animation: fade .25s var(--ease); touch-action: pan-y; overscroll-behavior: contain; }
.lightbox[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.lb-stage { width: 100vw; height: 100dvh; display: grid; place-items: center; padding: 56px clamp(8px, 6vw, 96px) 56px; overflow: hidden; }
.lb-stage img { max-width: 100%; max-height: calc(100dvh - 112px); width: auto; height: auto; object-fit: contain; transition: opacity .2s; }
.lb-stage img.swap { opacity: 0; }
.lb-close, .lb-prev, .lb-next { position: fixed; z-index: 2; color: var(--fg); opacity: .7; transition: opacity .2s; }
.lb-close:hover, .lb-prev:hover, .lb-next:hover { opacity: 1; }
.lb-close { top: max(10px, env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; font-size: 20px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); width: 56px; height: 96px; font: 300 48px/1 var(--serif); }
.lb-prev { left: 4px; } .lb-next { right: 4px; }
@media (hover: none) { .lb-prev, .lb-next { display: none; } }
.lb-count { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; font-size: 12px; letter-spacing: .2em; color: var(--muted); font-variant-numeric: tabular-nums; }
.vb-stage { width: min(92vw, calc((100dvh - 120px) * 16 / 9)); aspect-ratio: 16 / 9; background: #000; position: relative; }
.vb-stage.tall { width: min(92vw, calc((100dvh - 120px) * 9 / 16)); aspect-ratio: 9 / 16; }
.vb-stage iframe, .vb-stage video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }

/* ── 18+ ── */
.agegate { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--bg); padding: 24px; }
.agegate[hidden] { display: none; }
.agegate-box { max-width: 440px; text-align: center; }
.eyebrow { font: italic 400 18px var(--serif); color: var(--accent); letter-spacing: .08em; }
.agegate h2 { font: 400 22px/1.5 var(--serif-tc); letter-spacing: .12em; margin: 10px 0; }
.agegate p:not(.eyebrow) { color: var(--muted); font-size: 14px; }
.agegate-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 46px; padding: 0 22px; border: 1px solid var(--line); font-size: 13px; letter-spacing: .14em; transition: border-color .2s, opacity .2s; }
.btn:hover { border-color: var(--fg); }
.btn-solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-solid:hover { opacity: .88; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── v4：可自訂文字樣式 ── */
.intro { max-width: none; }
.intro .el { font-size: var(--sm); margin: 0; }
.intro .el.bio { white-space: pre-line; }
.intro h1.el { font-size: var(--sm); }
.brand { font-size: var(--sm, 20px); }
@media (min-width: 700px) { .intro .el, .intro h1.el, .brand { font-size: var(--s); } }
.intro .email { color: inherit; border-bottom: 1px solid var(--line); }
.links { display: flex; flex-wrap: wrap; }
.links a { width: auto; height: auto; border: 0; border-radius: 0; display: inline-flex; align-items: center; gap: 8px; color: inherit; }
.links .ic { width: var(--lsm); height: var(--lsm); border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; transition: transform .3s var(--ease), border-color .2s; flex: none; }
@media (min-width: 700px) { .links .ic { width: var(--ls); height: var(--ls); } }
.links .ic svg { width: 44%; height: 44%; }
.links .ic img { width: 52%; height: 52%; border-radius: 5px; object-fit: contain; }
.links a:hover .ic { transform: translateY(-2px); border-color: var(--fg); }
.links.style-icon-text a { padding-right: 16px; border: 1px solid var(--line); border-radius: 999px; transition: border-color .2s; }
.links.style-icon-text a:hover { border-color: var(--fg); }
.links.style-icon-text .ic { border: 0; }
.links.style-text a { border-bottom: 1px solid var(--line); padding: 2px 0; }
.links.style-text a:hover { border-color: currentColor; }
.links:not(.style-icon) a::after { display: none; }

/* 照片 / 影片切換：置中、醒目、捲動時固定在頂欄下方 */
.switch {
  position: sticky; top: 52px; z-index: 20; display: flex; justify-content: center; gap: clamp(28px, 8vw, 96px);
  margin-bottom: clamp(16px, 2vw, 24px); padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.switch a { position: relative; display: flex; align-items: baseline; gap: 8px; padding: 16px 4px 14px; font: 400 18px/1 var(--serif-tc); letter-spacing: .24em; color: var(--muted); opacity: .6; transition: opacity .25s, color .25s; }
.switch a small { font: italic 400 15px var(--serif); letter-spacing: .04em; }
.switch a:hover { opacity: 1; }
.switch a.on { color: var(--fg); opacity: 1; }
.switch a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--fg); transform: scaleX(0); transition: transform .35s var(--ease); }
.switch a.on::after { transform: scaleX(1); }
@media (max-width: 560px) { .switch a { font-size: 16px; padding: 14px 2px 12px; } .switch a small { display: none; } .switch { top: 50px; } }

.intro .el.bio { max-width: none; }
/* 後台預覽：滑過可點選的文字時加上框線 */
.is-preview .intro [data-k], .is-preview #brand { cursor: pointer; outline: 1px dashed transparent; outline-offset: 4px; transition: outline-color .15s; }
.is-preview .intro [data-k]:hover, .is-preview #brand:hover { outline-color: rgba(120, 160, 255, .8); }

/* ── 封面 ── */
.cover { position: relative; overflow: hidden; min-height: var(--hM); display: flex; align-items: flex-end; }
.cover-img { position: absolute; inset: 0; overflow: hidden; }
.cover-img img { width: 100%; height: 100%; object-fit: cover; object-position: var(--xM) var(--yM); transform: scale(var(--zM)); transform-origin: var(--xM) var(--yM); animation: coverIn 1.4s var(--ease) both; }
@keyframes coverIn { from { opacity: 0; } }
@media (min-width: 700px) {
  .cover { min-height: var(--h); }
  .cover-img img { object-position: var(--x) var(--y); transform: scale(var(--z)); transform-origin: var(--x) var(--y); }
}
.cover-shade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--bg) calc(var(--dim) * 32%), transparent) 0%,
    color-mix(in srgb, var(--bg) calc(var(--dim) * 18%), transparent) 28%,
    color-mix(in srgb, var(--bg) calc(var(--dim) * 68%), transparent) 62%,
    color-mix(in srgb, var(--bg) calc(var(--dim) * 92%), transparent) 86%,
    var(--bg) 100%); }
.cover.behind { --muted: color-mix(in srgb, var(--fg) 84%, transparent); }
.cover.behind .intro { position: relative; z-index: 1; width: 100%; padding-top: clamp(120px, 28vh, 260px);
  background: linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--bg) calc(var(--dim) * 58%), transparent) 38%, color-mix(in srgb, var(--bg) calc(var(--dim) * 88%), transparent) 85%, var(--bg) 100%); }
.cover.behind .intro .el { text-shadow: 0 2px 14px color-mix(in srgb, var(--bg) 92%, transparent), 0 1px 3px color-mix(in srgb, var(--bg) 80%, transparent); }
.cover.behind .links .ic { background: color-mix(in srgb, var(--bg) 56%, transparent); border-color: color-mix(in srgb, var(--fg) 30%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.cover.behind .links.style-icon-text a { background: color-mix(in srgb, var(--bg) 56%, transparent); border-color: color-mix(in srgb, var(--fg) 30%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.cover.behind .links.style-icon-text .ic { background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.cover.above { margin-bottom: 0; }
.cover.above + .intro { padding-top: clamp(32px, 6vw, 72px); }
.is-preview .cover-img { cursor: pointer; }
.is-preview [contenteditable] { outline: 2px solid rgba(120, 160, 255, .95) !important; outline-offset: 6px; cursor: text; caret-color: currentColor; }
