/* ==========================================================
   CIALLO SO — 前台样式
   设计系统同 CIALLO.WIKI / CIALLOSOFT：Ciallo Blue / Signal Lime / 0 与 999 两极圆角 / 发丝线
   ========================================================== */

@font-face { font-family: "Space Grotesk"; src: url("/assets/fonts/space-grotesk.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
    --bg-rgb: 255, 255, 255;
    --fg-rgb: 0, 0, 0;
    --blue-rgb: 0, 102, 255;
    --signal-rgb: 140, 255, 0;
    --bg: rgb(var(--bg-rgb));
    --fg: rgb(var(--fg-rgb));
    --fg-2: rgba(var(--fg-rgb), .66);
    --fg-3: rgba(var(--fg-rgb), .42);
    --line: rgba(var(--fg-rgb), .1);
    --fill: rgba(var(--fg-rgb), .04);
    --blue: rgb(var(--blue-rgb));
    --signal: rgb(var(--signal-rgb));
    --glass: rgba(var(--bg-rgb), .78);
    --mark: rgba(var(--signal-rgb), .55);
    --f-sans: "Space Grotesk", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
    --ease: cubic-bezier(.16, 1, .3, 1);
    --jelly: cubic-bezier(.34, 1.8, .5, 1);
    --col: 720px;
    color-scheme: light;
}
[data-theme="dark"] {
    --bg-rgb: 0, 0, 0;
    --fg-rgb: 255, 255, 255;
    --signal-rgb: 212, 255, 58;
    --line: rgba(var(--fg-rgb), .14);
    --fill: rgba(var(--fg-rgb), .05);
    --glass: rgba(0, 0, 0, .72);
    --mark: var(--signal);
    color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
    min-height: 100vh; display: flex; flex-direction: column;
    background: var(--bg); color: var(--fg);
    background-image: radial-gradient(rgba(var(--fg-rgb), .06) 1px, transparent 1.2px);
    background-size: 26px 26px; background-attachment: fixed;
    font-family: var(--f-sans); font-size: 16px; line-height: 1.7;
    -webkit-font-smoothing: antialiased; overflow-x: hidden;
    transition: background-color .4s, color .4s;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.col { width: 100%; max-width: var(--col); margin: 0 auto; padding: 0 16px; }

/* ---------- Logo（常驻眨眼，悬停敬礼挥手） ---------- */
.logo { display: block; height: 100%; width: auto; overflow: visible; color: var(--fg); }
.logo .lt-d { display: none; }
[data-theme="dark"] .logo .lt-d { display: inline; }
[data-theme="dark"] .logo .lt-l { display: none; }
.logo .face-eye { transform-box: fill-box; transform-origin: center; animation: blink 4.2s 2.2s infinite; }
.logo .face-hand { transform-box: fill-box; transform-origin: 100% 100%; }
.logo:hover .face-hand, a:hover .logo .face-hand { animation: salute .6s ease-in-out 2; }
@keyframes blink { 0%, 90%, 100% { transform: scaleY(1); } 93% { transform: scaleY(.1); } }
@keyframes salute { 50% { transform: rotate(-12deg); } }
.logo.anim .letter { transform-box: fill-box; transform-origin: 50% 100%; animation: pop .8s var(--jelly) both; }
.logo.anim .l1 { animation-delay: .1s; } .logo.anim .l2 { animation-delay: .2s; } .logo.anim .l3 { animation-delay: .3s; }
.logo.anim .l4 { animation-delay: .4s; } .logo.anim .l5 { animation-delay: .5s; }
.logo.anim .o-ring { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: draw .9s .6s cubic-bezier(.7, 0, .15, 1) forwards; }
.logo.anim .o-ring-full { visibility: hidden; animation: ring-done 0s 1.5s forwards; }
.logo.anim .ink { animation: fade .4s 1.35s both; }
.logo.anim .face { animation: fade .4s 1.55s both; }
@keyframes pop { 0% { transform: scale(0); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ring-done { to { visibility: visible; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* 首页大 Logo：液态玻璃（同 CIALLOSOFT 官网）。hl-glass 按字形遮罩出折射玻璃，hl-mark 叠边缘高光 */
.hero-logo { position: relative; display: block; width: min(700px, 86vw); aspect-ratio: 2324 / 532; margin-bottom: 40px; }
.hl-mark, .hl-glass { position: absolute; inset: 0; }
.hl-mark .logo { width: 100%; height: auto; filter: url(#glass-logo); }
[data-theme="light"] .hl-mark .logo { filter: url(#glass-logo) drop-shadow(0 14px 22px rgba(0, 40, 120, .28)); }
.hl-glass {
    --m: url("/assets/brand/ciallo-letters-on-dark.png") 0 0 / 76.592% 100% no-repeat, url("/assets/brand/o-mask.svg") 100% 0 / 22.806% 99.62% no-repeat;
    -webkit-mask: var(--m); mask: var(--m);
    background: rgba(var(--fg-rgb), .06);
    -webkit-backdrop-filter: blur(3px) saturate(220%) brightness(1.4);
    backdrop-filter: blur(3px) saturate(220%) brightness(1.4);
    animation: fade .6s 1.3s both;
}

/* ---------- 顶栏 ---------- */
.nav {
    position: sticky; top: 0; z-index: 10; height: 64px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 clamp(16px, 4vw, 40px);
    border-bottom: 1px solid transparent; transition: background .3s, border-color .3s;
}
.nav.solid { background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); border-color: var(--line); }
.nav-logo { height: 24px; display: block; transition: opacity .3s; }
.nav-logo.hide { opacity: 0; pointer-events: none; }
.nav-right { display: flex; align-items: center; gap: 20px; font-size: 14px; color: var(--fg-2); }
.nav-right a:hover { color: var(--fg); }
.icon-btn {
    width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line);
    background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--fg-2); padding: 0;
    transition: border-color .2s, color .2s, transform .4s var(--jelly);
}
.icon-btn:hover { border-color: var(--fg); color: var(--fg); }
.icon-btn:active { transform: scale(.88); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .moon { display: none; }
[data-theme="dark"] .icon-btn .sun { display: none; }
[data-theme="dark"] .icon-btn .moon { display: block; }

/* ---------- 搜索框 ---------- */
.search {
    display: flex; align-items: center; width: 100%; height: 54px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--bg);
    padding: 0 6px 0 22px; transition: border-color .25s, box-shadow .25s;
}
.search:hover { border-color: rgba(var(--fg-rgb), .22); }
.search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(var(--blue-rgb), .12); }
.search > svg { width: 18px; height: 18px; color: var(--fg-3); flex: none; margin-right: 12px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 17px; }
.search button {
    height: 42px; padding: 0 22px; border: 0; border-radius: 999px; cursor: pointer;
    background: var(--blue); color: #fff; font-weight: 600; transition: transform .4s var(--jelly);
}
.search button:hover { transform: scale(1.05); }
.search button:active { transform: scale(.94); }

/* ---------- 首页 ---------- */
.hero {
    min-height: calc(100vh - 64px); display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 0 16px 10vh; position: relative;
}
.hero .search { max-width: 720px; height: 62px; padding-left: 26px; }
.hero .search input { font-size: 18px; }
.hero .search button { height: 48px; padding: 0 28px; font-size: 16px; }
.peek {
    position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 13px; color: var(--fg-3); transition: color .2s;
}
.peek:hover { color: var(--fg); }
.peek svg { width: 18px; height: 18px; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }

.feed { max-width: 1120px; padding-bottom: 20px; }
.feed-head {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 28px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 20px;
}
.feed-head h2 { font-size: 20px; letter-spacing: -.01em; }
.feed-head span { font: 12px var(--f-mono); color: var(--fg-3); }
.news { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.news li { animation: rise .5s var(--ease) both; }
.news a {
    height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 18px;
    border: 1px solid var(--line); background: var(--bg);
    transition: border-color .25s, transform .4s var(--ease), box-shadow .4s var(--ease);
}
.news a:hover { border-color: var(--blue); transform: translateY(-3px); box-shadow: 0 12px 28px rgba(var(--blue-rgb), .10); }
.news .src { display: flex; align-items: center; gap: 8px; font: 12px var(--f-mono); color: var(--fg-3); min-width: 0; }
.news .src span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news .src img { width: 20px; height: 20px; flex: none; border-radius: 999px; border: 1px solid var(--line); background: var(--fill); object-fit: cover; }
.news .t { font-size: 16px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; transition: color .2s; }
.news .d { font-size: 13.5px; color: var(--fg-2); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.news .when { margin-top: auto; font: 12px var(--f-mono); color: var(--fg-3); }
.news .when::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 999px; background: var(--signal); margin-right: 7px; vertical-align: 1px; }
.news a:hover .t { color: var(--blue); }
.loading { padding: 26px 0 40px; text-align: center; font: 12px var(--f-mono); color: var(--fg-3); }

/* ---------- 结果页 ---------- */
.results-top { padding-top: 22px; }
.tabs { display: flex; justify-content: center; gap: 30px; margin-top: 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.tabs a { padding: 10px 2px; color: var(--fg-2); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .2s; }
.tabs a:hover { color: var(--fg); }
.tabs a.on { color: var(--fg); border-color: var(--blue); }
.tabs small { font: 11px var(--f-mono); color: var(--fg-3); margin-left: 5px; }
.meta-line { font: 12px var(--f-mono); color: var(--fg-3); margin: 14px 0 4px; }
.empty { padding: 60px 0; text-align: center; color: var(--fg-2); }
.empty a { color: var(--blue); }

.result { padding: 18px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; animation: rise .5s var(--ease) both; }
.result:nth-child(2) { animation-delay: 30ms; } .result:nth-child(3) { animation-delay: 60ms; } .result:nth-child(4) { animation-delay: 90ms; } .result:nth-child(n+5) { animation-delay: 120ms; }
.result .ico { width: 28px; height: 28px; border-radius: 999px; border: 1px solid var(--line); background: var(--fill); object-fit: cover; }
.result .host { font: 12px var(--f-mono); color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .kind { color: var(--blue); margin-left: 6px; }
.result h3 { margin: 2px 0 4px; font-size: 19px; font-weight: 600; letter-spacing: -.01em; line-height: 1.4; overflow-wrap: anywhere; }
.result h3 a { background: linear-gradient(var(--blue), var(--blue)) 0 100% / 0 1px no-repeat; transition: background-size .4s var(--ease), color .2s; }
.result h3 a:hover { color: var(--blue); background-size: 100% 1px; }
.result p { color: var(--fg-2); font-size: 14.5px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* 自家站点卡片（Wiki / Video）：宽屏时浮在结果列右侧（不影响搜索框和结果位置），窄屏时放在结果上方 */
.results-top { position: relative; }
.side { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.side-card { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 14px; padding: 12px; border: 1px solid var(--line); background: var(--bg); transition: border-color .25s, box-shadow .4s var(--ease); }
.side-card:hover { border-color: var(--blue); box-shadow: 0 10px 24px rgba(var(--blue-rgb), .10); }
.side-card .cover { width: 84px; height: 112px; object-fit: cover; background: var(--fill); display: block; }
.wiki-cover { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--blue) !important; color: #fff; }
.wiki-cover img { width: 40px; height: 40px; }
.wiki-cover b { font: 600 11px var(--f-mono); letter-spacing: .2em; }
.side-body { min-width: 0; display: flex; flex-direction: column; }
.side-k { font: 10.5px var(--f-mono); letter-spacing: .14em; color: var(--blue); }
.side-card h4 { margin: 3px 0 1px; font-size: 15.5px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-meta { font: 11.5px var(--f-mono); color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-card p { margin-top: 5px; font-size: 12.5px; line-height: 1.55; color: var(--fg-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.side-go { margin-top: auto; font-size: 12.5px; color: var(--blue); }
@media (min-width: 1360px) {
    .side { position: absolute; left: calc(100% + 24px); width: 300px; margin-top: 0; padding-top: 18px; }
}
mark { background: none; color: inherit; font-weight: 700; box-shadow: inset 0 -.38em 0 var(--mark); }
.result h3 a:hover mark { color: var(--blue); }

.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 32px 0 60px; font: 13px var(--f-mono); }
.pager a, .pager span { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--line); padding: 0 12px; }
.pager span { border-color: transparent; color: var(--fg-3); }
.pager a.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pager a:hover:not(.on) { border-color: var(--blue); color: var(--blue); }

/* ---------- 详情 / 提交 / 说明 等内容页 ---------- */
.page { padding: 40px 16px 60px; }
.panel { border: 1px solid var(--line); background: var(--bg); padding: clamp(22px, 4vw, 40px); }
.panel h1 { font-size: 26px; line-height: 1.35; letter-spacing: -.015em; margin-bottom: 8px; overflow-wrap: anywhere; }
.panel h2 { font-size: 22px; margin-bottom: 10px; }
.panel h3 { font-size: 17px; margin: 30px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.panel p, .panel li { color: var(--fg-2); }
.panel p + p { margin-top: 10px; }
.panel ul { padding-left: 20px; }
.panel li { margin: 6px 0; }
.panel a:not(.btn) { color: var(--blue); }
.panel code { font: 13px var(--f-mono); background: var(--fill); padding: 2px 6px; }
.panel pre { font: 13px var(--f-mono); background: var(--fill); padding: 14px 16px; overflow-x: auto; border: 1px solid var(--line); }
.panel strong { color: var(--fg); }
.detail-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.detail-head img { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--fill); object-fit: cover; flex: none; }
.detail-head .host { font: 13px var(--f-mono); color: var(--fg-3); overflow-wrap: anywhere; }
.detail-desc { font-size: 15.5px; white-space: pre-line; overflow-wrap: anywhere; }
.detail-kw { margin-top: 14px; font-size: 13.5px; }
.note { font-size: 13px; color: var(--fg-3) !important; margin-bottom: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 22px;
    border-radius: 999px; border: 1px solid var(--line); font-size: 14px; cursor: pointer; background: transparent;
    transition: border-color .2s, color .2s, transform .4s var(--jelly);
}
.btn:hover { border-color: var(--fg); }
.btn:active { transform: scale(.94); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn.primary:hover { transform: scale(1.04); }
.form input[type=text], .form input[type=url] {
    width: 100%; height: 50px; padding: 0 20px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--bg); outline: 0; font-size: 15px; transition: border-color .25s, box-shadow .25s;
}
.form input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(var(--blue-rgb), .12); }
.form .btn { margin-top: 14px; }
.message { margin: 16px 0; padding: 10px 14px; border-left: 3px solid var(--blue); background: var(--fill); font-size: 14px; }

/* ---------- 关于页 ---------- */
.about { display: flex; flex-direction: column; gap: 18px; max-width: 860px; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; }
.toc a { font-size: 13px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--fg-2); }
.toc a:hover { border-color: var(--blue); color: var(--blue); }
.about .panel { scroll-margin-top: 80px; }
.kicker { font: 11px var(--f-mono); letter-spacing: .16em; color: var(--blue); margin-bottom: 6px; }
.panel h3 small { font: 400 12px var(--f-mono); color: var(--fg-3); margin-left: 8px; }
.params { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.params td { padding: 8px 10px; border-top: 1px solid var(--line); color: var(--fg-2); vertical-align: top; }
.params td:first-child { width: 80px; }
.pitch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.pitch > div { border: 1px solid var(--line); padding: 16px 18px; }
.pitch b { font-size: 17px; display: block; margin-bottom: 4px; }
.pitch b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: var(--signal); margin-right: 8px; vertical-align: 2px; }
.pitch p { font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.stats div { border: 1px solid var(--line); padding: 14px 16px; }
.stats b { display: block; font: 500 26px var(--f-mono); letter-spacing: -.02em; color: var(--fg); }
.stats span { font-size: 12px; color: var(--fg-3); }
.mono { font-family: var(--f-mono); }
.bars { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.bar { display: grid; grid-template-columns: 120px 1fr 64px; align-items: center; gap: 12px; font-size: 13px; }
.bar .lbl { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { height: 10px; background: var(--fill); }
.bar .track i { display: block; height: 100%; background: var(--blue); animation: grow 1s var(--ease) both; transform-origin: left; }
.bar .val { text-align: right; color: var(--fg-3); }
@keyframes grow { from { transform: scaleX(0); } }
.spark { width: 100%; height: 120px; display: block; margin-top: 6px; }
.spark rect { fill: var(--blue); opacity: .85; }
.spark rect:hover { fill: var(--signal); opacity: 1; }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--fg-3); margin-top: 4px; }
.years { display: flex; align-items: flex-end; gap: 3px; height: 120px; margin-top: 6px; }
.yr { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.yr i { display: block; width: 100%; background: var(--blue); opacity: .85; }
.yr:hover i { background: var(--signal); opacity: 1; }
.yr span { font-size: 10px; color: var(--fg-3); height: 14px; margin-top: 4px; }
@media (max-width: 600px) { .pitch, .stats { grid-template-columns: 1fr; } .bar { grid-template-columns: 90px 1fr 56px; } }

.speed { display: flex; align-items: center; gap: 22px; margin: 22px 0 6px; padding: 18px 22px; border: 1px solid var(--line); }
.speed-num { font-size: 54px; font-weight: 600; line-height: 1; color: var(--blue); letter-spacing: -.04em; }
.speed-num small { font-size: 18px; margin-left: 4px; color: var(--fg-3); }
.speed b { font-size: 17px; }
.free { border-left: 3px solid var(--signal); }

/* ---------- 页脚 ---------- */
.foot { padding: 26px 16px 30px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; color: var(--fg-3); }
.foot a:hover { color: var(--fg); }
.foot .links { margin-bottom: 6px; }
.foot .links a + a::before { content: "·"; margin: 0 8px; color: var(--fg-3); }
.foot .friends { margin-top: 6px; font-size: 12px; }
.foot .friends a { margin: 0 6px; }
.foot .legal { margin-top: 6px; font-size: 12px; }

@media (max-width: 900px) { .news { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
    .nav-right a { display: none; }
    .news { grid-template-columns: 1fr; }
    .search { height: 50px; padding-left: 16px; }
    .search button { height: 38px; padding: 0 16px; }
    .result h3 { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
