/* ==========================================================================
   工具坞 TOOLDOCK — 前台工具集合页样式(与 assets/theme.css 配套)
   源自设计稿 tools-hub.html:云朵背景 + 鼠标视差、卡片网格、详情弹窗
   ========================================================================== */

html[data-theme="light"] { --bg: #ffffff; }
/* 滚动条槽常驻:卡片由 JS 渲染,滚动条从无到有会让居中内容左右抖动(看似偏左)。 */
html { overflow-y: scroll; scrollbar-gutter: stable; }
/* 整页纵向 flex:工具列表区弹性撑高,把页脚推到视口底部。 */
body { position: relative; overflow-x: hidden; min-height: 100vh; display: flex; flex-direction: column; }
main.container { flex: 1 0 auto; }

/* ---------- 云朵背景 + 鼠标视差 ---------- */
/* 背景层用 fixed 铺满视口。注:若用 absolute + top/bottom:-220px,在 body(flex 列)下会
   把 hero 内容整体上移 ~220px,导致页脚下方留白、不贴底;fixed 脱离布局流。 */
.bg-fx { position: fixed; inset: -220px; overflow: hidden; z-index: 0; pointer-events: none; --cloud: #d4d9e1; }
html[data-theme="dark"] .bg-fx { --cloud: #2a2e36; }
.cloud { position: absolute; color: var(--cloud); will-change: transform; transition: transform .12s linear; }
.cloud-inner { display: block; }
.cloud svg { display: block; filter: blur(6px); }
@keyframes cloudDrift { 0% { transform: translateX(0); } 50% { transform: translateX(30px); } 100% { transform: translateX(0); } }

.container, main { position: relative; z-index: 1; }

/* ---------- 边角常驻控件(取代顶栏) ---------- */
.corner-btn { position: fixed; top: 18px; left: 24px; z-index: 60; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 15px; border-radius: var(--r); background: color-mix(in oklch, var(--surface) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border: 1px solid var(--border); color: var(--fg); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm); transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.corner-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.corner-tt { position: fixed; top: 18px; right: 24px; z-index: 60; }
.hero-search { max-width: 520px; margin: 26px auto 0; }
.hero-search .fa-magnifying-glass { left: 17px; font-size: 14px; }
.hero-search .input { height: 50px; padding-left: 44px; font-size: 15.5px; border-radius: var(--r); box-shadow: var(--shadow-sm); }

/* ---------- Hero ---------- */
.hero { padding: 70px 0 8px; text-align: center; }
.hero h1 { max-width: 22ch; margin: 0 auto; font-size: clamp(34px, 5vw, 56px); font-weight: 800; letter-spacing: -.035em; line-height: 1.08; text-wrap: balance; }
.hero p { margin: 20px auto 0; max-width: 40rem; color: var(--muted); font-size: 17px; line-height: 1.75; text-wrap: pretty; }

.chips-wrap { display: flex; justify-content: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 20px 0 6px; }

.sec-tools { margin-top: 44px; }

/* ---------- 栅格 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 22px; }

/* ---------- 卡片 ---------- */
.tool-card {
  position: relative; text-align: left; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 16px; border: 1px solid var(--border); background: var(--surface);
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.05);
  cursor: pointer; min-height: 176px;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
  animation: rise .4s var(--ease-out) backwards;
}
.tool-card:hover { transform: translateY(-5px); box-shadow: 0 2px 4px rgba(16,24,40,.05), 0 16px 40px rgba(16,24,40,.12); border-color: var(--border-strong); }
.site-link { flex: none; width: 30px; height: 30px; border-radius: var(--r-xs); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; transition: color .2s var(--ease), background .2s var(--ease); }
.site-link:hover { color: var(--fg); background: var(--surface-2); }
.tc-head { display: flex; gap: 16px; align-items: center; padding: 22px 22px 0; }
.logo-tile {
  width: 60px; height: 60px; flex: none; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border); overflow: hidden;
  box-shadow: 0 1px 1px rgba(16,24,40,.10), 0 2px 4px rgba(16,24,40,.12);
  transition: transform .5s var(--ease-out);
}
.logo-tile img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.logo-tile .mark { font-family: var(--font-display); font-weight: 800; font-size: 21px; letter-spacing: -.03em; color: var(--fg); }
.tool-card:hover .logo-tile { transform: scale(1.06); }
.tc-name { min-width: 0; flex: 1; font-size: 18px; font-weight: 700; color: var(--fg); line-height: 1.25; letter-spacing: -.01em; transition: color .25s var(--ease); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-desc { font-size: 14px; color: var(--muted); line-height: 1.6; padding: 0 22px; margin: 16px 0 22px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.empty { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--muted); display: none; }
.empty i { font-size: 30px; margin-bottom: 12px; color: var(--muted-2); }

.load-more-wrap { display: flex; justify-content: center; margin-top: 30px; }
.load-more-wrap:empty { display: none; }

.site-foot { flex: none; border-top: 1px solid var(--border); padding: 30px 0; margin-top: 64px; color: var(--muted); font-size: 13px; }
.site-foot .container { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.site-foot .note { font-size: 12px; }

/* ---------- 弹窗 ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 24px; background: color-mix(in oklch, #0b1220 52%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-overlay.open { display: flex; animation: fade-in .18s var(--ease); }
.modal { position: relative; width: 100%; max-width: 620px; max-height: 90vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-xl); animation: modal-in .26s var(--ease-out); }
.modal-close { position: absolute; top: 15px; right: 15px; z-index: 3; background: transparent; border-color: transparent; }
.modal-close:hover { background: transparent; border-color: transparent; color: var(--fg); }
.modal-inner { padding: 28px; }
.modal-head { display: flex; gap: 16px; align-items: center; padding-right: 40px; }
.modal-head > div { flex: 1; min-width: 0; }
.modal-head .logo-tile { width: 64px; height: 64px; border-radius: 11px; }
.modal-head .logo-tile .mark { font-size: 23px; }
.modal-head h2 { font-size: 23px; margin: 0; min-width: 0; }
/* 名称行:名称居左、平台标识居右 */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 7px; }
/* 竖色条元信息 */
.m-meta { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.mbar { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--fg-2); }
.mbar::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--fg); }
.mbar.mono { font-family: var(--font-mono); font-weight: 500; color: var(--muted); }
.modal-plat { display: flex; gap: 10px; color: var(--muted); font-size: 15px; flex: none; }
.modal-desc { margin: 18px 0; color: var(--fg-2); font-size: 15px; line-height: 1.65; }
.link-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.link-row .btn { border: 1px solid var(--border); }
.link-row .link-copy { margin-left: auto; }

.channel-section { border-top: 1px solid var(--border); padding-top: 20px; }
.sec-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
.channel-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 18px; }
.channel-tabs button { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 16px; border-radius: var(--r-sm); color: var(--muted); font-size: 14px; font-weight: 600; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.channel-tabs button:hover { color: var(--fg); }
.channel-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-fg); }

.repo-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); font-size: 14px; color: var(--fg); margin-bottom: 16px; }
.repo-row .rtag { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.repo-row .rtag::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--fg); }
.selector { margin-bottom: 15px; }
.selector-label { font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 9px; }

.asset-list { display: flex; flex-direction: column; gap: 8px; }
.asset-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.asset-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.asset-row[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.asset-row .radio { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex: none; display: inline-flex; align-items: center; justify-content: center; }
.asset-row[aria-checked="true"] .radio { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.asset-row .radio i { opacity: 0; font-size: 9px; }
.asset-row[aria-checked="true"] .radio i { opacity: 1; }
.asset-os { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--fg); font-size: 14px; }
.asset-os i { color: var(--muted); }
.asset-arch { font-size: 12px; font-weight: 600; color: var(--fg-2); display: inline-flex; align-items: center; gap: 7px; }
.asset-arch::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--fg); }
.asset-size { margin-left: auto; font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

.asset-preview { margin-top: 16px; padding: 15px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
.asset-file { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.asset-file .fname { font-family: var(--font-mono); color: var(--fg); word-break: break-all; }
.asset-file .asize { margin-left: auto; flex: none; font-size: 12px; color: var(--muted); font-family: var(--font-mono); white-space: nowrap; }
.hash-block { margin-top: 12px; }
.hash-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.hash-value { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); }
.hash-value code { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; color: var(--fg-2); word-break: break-all; flex: 1; }
.copy-btn { flex: none; width: 30px; height: 30px; border-radius: var(--r-xs); color: var(--muted); border: 1px solid var(--border); background: var(--surface-2); transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.copy-btn:hover { color: var(--fg); background: var(--surface-3); border-color: var(--border-strong); }

.modal-foot { position: sticky; bottom: 0; margin: 24px -28px -28px; padding: 16px 28px; background: color-mix(in oklch, var(--surface) 90%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--border); display: flex; align-items: center; gap: 16px; border-radius: 0 0 var(--r-xl) var(--r-xl); }
.foot-meta { min-width: 0; flex: 1; }
.foot-meta .foot-file { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-meta .foot-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

@media (prefers-reduced-motion: reduce) { .cloud { transition: none; animation: none !important; } }
@media (max-width: 640px) {
  .nav-search { width: 140px; }
  .grid { grid-template-columns: 1fr; }
  .modal-inner { padding: 22px; }
  .modal-foot { margin: 22px -22px -22px; padding: 14px 22px; flex-direction: column; align-items: stretch; }
  .modal-foot .btn-primary { width: 100%; }
}
