/* 微光 公播圖書館 — 全站樣式 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&family=Noto+Serif+TC:wght@600;900&display=swap');

:root {
  --ink: #1E1B18;
  --ink-2: #4A433C;
  --muted: #6B6258;
  --paper: #F5EEE2;
  --card: #FFFDF9;
  --line: #E3D9C8;
  --glow: #E8A33D;
  --glow-ink: #8A4B12;
  --ok: #2F6B4F;
  --bad: #A8321C;
  --radius: 12px;
  --serif: 'Noto Serif TC', 'Songti TC', serif;
  --sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.65; }
a { color: var(--glow-ink); }
a:hover { color: var(--ink); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.3; margin: 0 0 .5em; text-wrap: balance; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 680px; margin: 0 auto; padding: 32px 16px 64px; }
.brand { font-family: var(--serif); font-weight: 900; letter-spacing: 2px; text-decoration: none; color: var(--ink); font-size: 18px; display: inline-block; margin-bottom: 24px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border-radius: 10px; border: 1.5px solid var(--ink); background: var(--ink); color: #FFF; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { background: #3A332C; color: #FFF; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: #EDE3D3; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.notice { background: #FBE9C8; border-radius: 10px; padding: 12px 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: #FFF; padding: 8px; z-index: 99; }
:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; }

/* 頁首 */
.top { position: sticky; top: 0; z-index: 20; background: rgba(245, 238, 226, .94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.top .brand { margin: 0; display: flex; align-items: center; gap: 10px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 0 5px rgba(232, 163, 61, .22), 0 0 0 10px rgba(232, 163, 61, .1); }
.top nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.top nav a { text-decoration: none; color: var(--ink-2); padding: 8px 10px; border-radius: 8px; }
.top nav a:hover { background: #EDE3D3; color: var(--ink); }
.cart-btn { position: relative; }
.cart-count { display: inline-flex; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--glow); color: var(--ink); font-size: 13px; align-items: center; justify-content: center; }

/* 首屏 */
.hero { background: var(--ink); color: var(--paper); }
.hero .wrap { padding-top: 56px; padding-bottom: 56px; display: grid; gap: 32px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: center; }
.hero h1 { font-size: clamp(30px, 5vw, 48px); font-weight: 900; color: #FFF; }
.hero p { color: #D9CFBF; max-width: 34em; }
.hero .prices { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.price-chip { border: 1px solid #5A5047; border-radius: 12px; padding: 12px 16px; min-width: 150px; }
.price-chip b { display: block; font-family: var(--serif); font-size: 26px; color: var(--glow); }
.price-chip span { font-size: 13px; color: #D9CFBF; }
.hero .glowbox { justify-self: center; width: min(280px, 70vw); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 50%, var(--glow) 0 18%, rgba(232, 163, 61, .35) 19% 34%, rgba(232, 163, 61, .14) 35% 56%, transparent 57%); }
@media (max-width: 760px) { .hero .wrap { grid-template-columns: 1fr; } .hero .glowbox { display: none; } }

/* 篩選與目錄 */
.section { padding: 40px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 24px; }
.chip { min-height: 40px; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: #FFF; border-color: var(--ink); }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.album { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.cover { aspect-ratio: 1; position: relative; display: flex; align-items: flex-end; padding: 14px; color: #FFF; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover .cover-title { position: relative; font-family: var(--serif); font-weight: 900; font-size: 22px; line-height: 1.25; }
.play { position: absolute; right: 12px; top: 12px; width: 48px; height: 48px; border-radius: 50%; border: none; background: rgba(255, 253, 249, .95); color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.play svg { width: 20px; height: 20px; }
.album-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex-grow: 1; }
.album-id { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.album h3 { font-size: 18px; margin: 0; }
.album .meta { font-size: 13px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #F0E7D8; color: var(--ink-2); }
.album-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }
.album-actions .btn { flex: 1; }
.in-cart { background: var(--glow) !important; border-color: var(--glow) !important; color: var(--ink) !important; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* 專輯詳細 */
dialog { border: none; border-radius: 16px; padding: 0; max-width: min(640px, calc(100vw - 32px)); width: 100%; background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(30, 27, 24, .55); }
.dlg-head { display: flex; gap: 16px; padding: 20px; border-bottom: 1px solid var(--line); }
.dlg-cover { width: 120px; height: 120px; flex-shrink: 0; border-radius: 10px; overflow: hidden; position: relative; }
.dlg-cover img { width: 100%; height: 100%; object-fit: cover; }
.dlg-body { padding: 16px 20px 20px; }
.tracklist { list-style: none; padding: 0; margin: 0 0 16px; }
.tracklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.tracklist .tno { width: 24px; color: var(--muted); font-size: 13px; }
.tracklist .tt { flex: 1; }
.tracklist .td { font-size: 13px; color: var(--muted); }
.mini-play { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #FFF; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.close-x { margin-left: auto; align-self: flex-start; width: 44px; height: 44px; border: none; background: none; cursor: pointer; font-size: 22px; }

/* 購物車抽屜 */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(420px, 100vw); background: var(--card); z-index: 40; transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.drawer.open { transform: none; }
.scrim { position: fixed; inset: 0; background: rgba(30, 27, 24, .45); z-index: 30; display: none; }
.scrim.open { display: block; }
.drawer-head { display: flex; align-items: center; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 20px; }
.drawer-list { flex: 1; overflow-y: auto; padding: 8px 20px; }
.cart-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-sw { width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0; overflow: hidden; }
.cart-sw img { width: 100%; height: 100%; object-fit: cover; }
.cart-item .ci-t { flex: 1; font-size: 15px; line-height: 1.35; }
.cart-item .ci-id { font-size: 12px; color: var(--muted); }
.rm { width: 40px; height: 40px; border: none; background: none; cursor: pointer; color: var(--muted); font-size: 18px; }
.drawer-foot { padding: 16px 20px 20px; border-top: 1px solid var(--line); background: #FBF6EC; }
.hint { background: #FBE9C8; color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.hint.vip { background: #E6EFE9; }
.lines { font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.lines div { display: flex; justify-content: space-between; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; margin-bottom: 12px; }
.total b { font-family: var(--serif); font-size: 28px; }
.saved { font-size: 13px; color: var(--ok); }
.uniq { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

/* 說明區 */
.steps { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); counter-reset: s; padding: 0; list-style: none; }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; counter-increment: s; }
.steps li::before { content: counter(s); display: inline-flex; margin-right: 8px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #FFF; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 8px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; min-height: 28px; }

/* 頁尾 */
footer.site { border-top: 1px solid var(--line); padding: 32px 0 48px; font-size: 14px; color: var(--muted); }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
footer.site nav { display: flex; gap: 16px; flex-wrap: wrap; }

/* 表單 */
.form { display: grid; gap: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; }
.field .help { font-size: 13px; color: var(--muted); }
.field input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #CBBFAE; border-radius: 10px; background: #FFF; }
.field input:focus { border-color: var(--ink); }
.row2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex-shrink: 0; }
.err { color: var(--bad); font-weight: 700; }
.summary { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 24px; }
.summary ul { margin: 8px 0; padding-left: 20px; }

/* 下載頁 */
.dl-album { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 14px; }
.dl-head { display: flex; justify-content: space-between; gap: 12px; }
.dl-head h2 { font-size: 20px; }
.dl-id { font-size: 12px; color: var(--muted); }
.dl-left { font-size: 13px; color: var(--muted); white-space: nowrap; }
.dl-tracks { margin: 8px 0 0; }
details summary { cursor: pointer; margin-top: 10px; }

/* 驗證頁 */
.verify { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-align: center; }
.verify.ok { border-color: var(--ok); }
.verify-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--ok); color: #FFF; font-size: 30px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.promo { margin-top: 24px; background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 24px; }
.promo h2 { color: #FFF; }
.promo .btn { background: var(--glow); border-color: var(--glow); color: var(--ink); }

/* 授權書（A4） */
.print-bar { padding: 16px; text-align: center; }
.print-bar button { min-height: 44px; padding: 8px 20px; border-radius: 10px; border: 1.5px solid var(--ink); background: var(--ink); color: #FFF; font-weight: 700; cursor: pointer; }
.cert { width: 210mm; min-height: 297mm; margin: 0 auto 32px; background: #FFF; padding: 22mm 20mm; border: 1px solid var(--line); position: relative; }
.cert-head { text-align: center; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 20px; }
.cert-brand { font-family: var(--serif); letter-spacing: 3px; color: var(--muted); }
.cert h1 { font-size: 30px; letter-spacing: 6px; margin: 6px 0; }
.cert-no { font-size: 14px; }
.cert-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.cert-table th, .cert-table td { border: 1px solid #8C8276; padding: 10px 12px; text-align: left; vertical-align: top; }
.cert-table th { width: 32%; background: #F7F2EA; font-weight: 700; }
.cert-text { font-size: 14px; line-height: 1.9; margin: 20px 0; text-align: justify; }
.cert-foot { display: flex; justify-content: space-between; align-items: flex-end; font-size: 14px; line-height: 1.8; margin-top: 28px; position: relative; }
.seal { width: 48mm; position: absolute; left: 30mm; bottom: 4mm; mix-blend-mode: multiply; }

/* 公播標章（A6，暫定版） */
.badge { width: 105mm; height: 148mm; margin: 0 auto 32px; background: #FFF; border: 2.2mm solid var(--ink); outline: .5mm solid var(--glow); outline-offset: -4mm; padding: 9mm 8mm; display: flex; flex-direction: column; gap: 3.5mm; }
.badge-brand { font-family: var(--serif); font-weight: 900; letter-spacing: 2px; font-size: 15px; }
.badge-title { font-family: var(--serif); font-weight: 900; font-size: 34px; line-height: 1.15; }
.badge-meta { font-size: 12px; color: var(--ink-2); }
.badge-qr { width: 34mm; height: 34mm; }
.badge-qr svg { width: 100%; height: 100%; }
.badge-cta { font-size: 13px; font-weight: 700; }
.badge-foot { margin-top: auto; font-size: 11px; color: var(--muted); }

@media print {
  body { background: #FFF; }
  .print-bar { display: none; }
  .cert { border: none; margin: 0; }
  .badge { margin: 0; }
  @page { margin: 0; }
}
