/* ==========================================================
   CIALLOSOFT.COM — 公共样式（变量 / 字体 / 顶栏 / 光标 / 弹窗 / 页脚）
   ========================================================== */

@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: 0, 0, 0;
    --fg-rgb: 255, 255, 255;
    --blue-rgb: 0, 102, 255;
    --signal-rgb: 212, 255, 58;

    --bg: rgb(var(--bg-rgb));
    --fg: rgb(var(--fg-rgb));
    --fg-2: rgba(var(--fg-rgb), 0.62);
    --fg-3: rgba(var(--fg-rgb), 0.38);
    --line: rgba(var(--fg-rgb), 0.14);
    --blue: rgb(var(--blue-rgb));
    --signal: rgb(var(--signal-rgb));
    --glass: rgba(var(--bg-rgb), 0.42);
    --glass-hi: rgba(var(--fg-rgb), 0.07);

    --f-sans: "Space Grotesk", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-jelly: cubic-bezier(0.34, 1.8, 0.5, 1);
    --nav-h: 80px;
    --pad: clamp(20px, 5vw, 72px);

    color-scheme: dark;
}
/* 实验室白 */
[data-theme="light"] {
    --bg-rgb: 255, 255, 255;
    --fg-rgb: 0, 0, 0;
    --signal-rgb: 140, 255, 0;  /* 浅色主题：酸性绿 #8CFF00 */
    --glass: rgba(var(--bg-rgb), 0.5);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--f-sans);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.5s ease, color 0.5s ease;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img, svg, canvas { display: block; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
::selection { background: var(--blue); color: #fff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
.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; }

/* 层级：WebGL 0 / 触须 1 / 内容 2 / 顶栏 1000 / 光标 9999 */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
main { position: relative; z-index: 2; }
/* 无 WebGL：CSS 渐变兜底 */
.no-webgl #bg { display: none; }
.no-webgl body {
    background:
        radial-gradient(60vmax 40vmax at 20% 10%, rgba(var(--blue-rgb), 0.22), transparent 60%),
        radial-gradient(50vmax 40vmax at 90% 80%, rgba(var(--blue-rgb), 0.12), transparent 60%),
        var(--bg);
    background-attachment: fixed;
}

.kicker {
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.24em;
    color: var(--fg-3);
    text-transform: uppercase;
}

/* 液体玻璃：模糊 + 饱和 + 顶部高光；Chromium 再叠一层 SVG 折射 */
.glass {
    background: var(--glass);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    box-shadow: inset 0 1px 0 var(--glass-hi), inset 0 0 40px rgba(var(--fg-rgb), 0.03), 0 20px 60px rgba(0, 0, 0, 0.25);
}
.lg-svg .glass { backdrop-filter: url(#lg-refract) blur(22px) saturate(180%); }

/* 主题切换：从按钮位置圆形扩散 */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: vt-grow 0.7s var(--ease-out); }
@keyframes vt-grow {
    from { clip-path: circle(0 at var(--vt-x, 100%) var(--vt-y, 0)); }
    to { clip-path: circle(150vmax at var(--vt-x, 100%) var(--vt-y, 0)); }
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    height: 48px;
    padding: 0 26px;
    border-radius: 999px;
    background: var(--blue);
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: transform 0.5s var(--ease-jelly), background-color 0.3s;
}
.btn:hover { transform: scale(1.06); }
.btn:active { transform: scale(0.94); transition-duration: 0.12s; }
.btn .arr { display: inline-block; transition: transform 0.4s var(--ease-jelly); }
.btn:hover .arr { transform: translateX(4px); }
.btn-ghost { background: rgba(var(--fg-rgb), 0.08); color: var(--fg); }
.btn-ghost:hover { background: rgba(var(--fg-rgb), 0.14); }

/* 悬停台词（点缀式，只挂在少量按钮上） */
[data-tease] { position: relative; }
[data-tease]::after {
    content: attr(data-tease);
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--fg);
    color: var(--bg);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -4px) scale(0.9);
    transition: opacity 0.2s, transform 0.4s var(--ease-jelly);
}
[data-tease]:hover::after { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ==========================================================
   Logo
   ========================================================== */
.logo { height: 100%; width: auto; overflow: visible; color: var(--fg); }
.logo .lt-l { display: none; }
[data-theme="light"] .logo .lt-d { display: none; }
[data-theme="light"] .logo .lt-l { display: inline; }
.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, .idle .logo .face-hand { animation: salute 0.6s ease-in-out 2; }
.idle .logo .face-eye { animation: blink 0.5s 2; }
@keyframes blink { 0%, 90%, 100% { transform: scaleY(1); } 93% { transform: scaleY(0.1); } }
@keyframes salute { 50% { transform: rotate(-12deg); } }

/* 入场：字母像细胞依次弹出 → O 环画出 → 翻面 → 表情出现 */
.logo.anim .letter { transform-box: fill-box; transform-origin: 50% 100%; animation: pop 0.8s var(--ease-jelly) both; }
.logo.anim .l1 { animation-delay: 0.1s; }
.logo.anim .l2 { animation-delay: 0.2s; }
.logo.anim .l3 { animation-delay: 0.3s; }
.logo.anim .l4 { animation-delay: 0.4s; }
.logo.anim .l5 { animation-delay: 0.5s; }
.logo.anim .o-ring { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: draw 0.9s 0.6s cubic-bezier(0.7, 0, 0.15, 1) forwards; }
.logo.anim .o-ring-full { visibility: hidden; animation: ring-done 0s 1.5s forwards; }
.logo.anim .ink { animation: fade 0.4s 1.35s both; }
.logo.anim .face { animation: fade 0.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; } }

/* ==========================================================
   顶栏（结构同 ciallo.cx：logo | nav-links | nav-extras）
   ========================================================== */
.top-nav {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1000;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--pad);
    transition: background-color 0.4s, backdrop-filter 0.4s, box-shadow 0.4s;
}
.top-nav:hover, .top-nav.scrolled, .top-nav.menu-open {
    background: var(--glass);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    box-shadow: inset 0 -1px 0 var(--line);
}
.lg-svg .top-nav:hover, .lg-svg .top-nav.scrolled { backdrop-filter: url(#lg-refract) blur(22px) saturate(180%); }

.logo-link { display: block; height: 26px; flex: 0 0 auto; }

.nav-links { display: flex; gap: 44px; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-links a {
    position: relative;
    padding: 8px 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--fg-2);
    transition: color 0.3s;
}
.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 2px;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: var(--blue);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.55s var(--ease-jelly);
}
.nav-links a:hover, .nav-links a.active { color: var(--fg); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }

.nav-extras { display: flex; align-items: center; gap: 14px; }
.theme-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    transition: background-color 0.3s, transform 0.5s var(--ease-jelly);
}
.theme-toggle:hover { background: rgba(var(--fg-rgb), 0.08); transform: rotate(20deg) scale(1.08); }
.theme-toggle svg { width: 20px; height: 20px; grid-area: 1 / 1; transition: opacity 0.3s, transform 0.5s var(--ease-out); }
.icon-sun { opacity: 0; transform: scale(0.5) rotate(-90deg); }
[data-theme="light"] .icon-sun { opacity: 1; transform: none; }
[data-theme="light"] .icon-moon { opacity: 0; transform: scale(0.5) rotate(90deg); }

.login-btn {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 22px;
    border-radius: 999px;
    background: var(--fg);
    color: var(--bg);
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.5s var(--ease-jelly), background-color 0.3s, color 0.3s;
}
.login-btn:hover { background: var(--blue); color: #fff; transform: scale(1.06); }
button.login-btn { border: 0; font-family: inherit; }
.user-menu { position: relative; }
.user-btn { gap: 8px; padding: 0 16px 0 5px; max-width: 200px; }
.user-ava { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 13px; font-weight: 800; }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pop { position: absolute; top: calc(100% + 10px); right: 0; min-width: 200px; padding: 14px; border-radius: 18px; }
.user-pop[hidden] { display: none; }
.user-meta { display: grid; gap: 2px; padding: 2px 4px 12px; box-shadow: inset 0 -1px 0 var(--line); }
.user-meta span { font-family: var(--f-mono); font-size: 12px; color: var(--fg-3); }
.user-out { width: 100%; margin-top: 8px; padding: 8px 4px; border: 0; background: none; color: var(--fg-2); font: inherit; text-align: left; transition: color 0.3s; }
.user-out:hover { color: var(--blue); }
.login-btn[data-tease]::after { left: auto; right: 0; transform: translate(0, -4px) scale(0.9); transform-origin: top right; }
.login-btn[data-tease]:hover::after { transform: none; }

.nav-toggle { display: none; width: 40px; height: 40px; flex-direction: column; justify-content: center; align-items: center; gap: 5px; }
.nav-toggle span { width: 20px; height: 2px; border-radius: 2px; background: var(--fg); transition: transform 0.4s var(--ease-jelly), opacity 0.2s; }
.menu-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================
   光标（点 + 粘液环 + 图片）与触须
   ========================================================== */
#cursor-dot, #cursor-ring, #cursor-img { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999; opacity: 0; transition: opacity 0.3s; will-change: transform; }
.cursor-in #cursor-dot, .cursor-in #cursor-ring, .cursor-in #cursor-img { opacity: 1; }
#cursor-dot { width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: var(--fg); }
#cursor-ring {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: transparent;
    box-shadow: inset 0 0 0 1px rgba(var(--fg-rgb), 0.35);
    transition: opacity 0.3s, background-color 0.3s, box-shadow 0.3s;
}
.hovering #cursor-ring { background: rgba(var(--blue-rgb), 0.14); box-shadow: inset 0 0 0 1px rgba(var(--blue-rgb), 0.6); }
/* 按下时才变成玻璃透镜（放大镜） */
.cursor-lens.cursor-down #cursor-ring {
    background: rgba(255, 255, 255, 0.04);
    -webkit-backdrop-filter: saturate(190%) contrast(1.15) brightness(1.12);
    backdrop-filter: saturate(190%) contrast(1.15) brightness(1.12);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.45),
        inset 0 8px 14px -8px rgba(255, 255, 255, 0.7),
        inset 0 -10px 18px -10px rgba(var(--blue-rgb), 0.6),
        0 10px 30px -10px rgba(0, 0, 0, 0.5);
}
.lg-svg.cursor-lens.cursor-down #cursor-ring { backdrop-filter: url(#lg-refract) saturate(190%) contrast(1.15) brightness(1.12); }
#cursor-img { width: 24px; height: 24px; background: url("/assets/img/cursor.png") 0 0 / contain no-repeat; }
.hovering #cursor-img { background-image: url("/assets/img/cursor_active.png"); }
.has-cursor, .has-cursor * { cursor: none !important; }
.has-cursor input, .has-cursor textarea { cursor: text !important; }

#tentacles { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

.touch-ripple {
    position: fixed;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: rgba(var(--blue-rgb), 0.35);
    pointer-events: none;
    z-index: 9999;
    animation: ripple 0.6s var(--ease-out) forwards;
}
@keyframes ripple { to { transform: scale(7); opacity: 0; } }

.idle-bubble {
    position: fixed;
    z-index: 9998;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.6);
    transform-origin: top left;
    transition: opacity 0.25s, transform 0.5s var(--ease-jelly);
}
.idle-bubble.show { opacity: 1; transform: scale(1); }

/* ==========================================================
   联系我们弹窗
   ========================================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.35s;
}
.modal.active { opacity: 1; }
.modal[hidden] { display: none; }
.modal-panel {
    position: relative;
    width: min(560px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 40px;
    border-radius: 28px;
    clip-path: circle(0 at 50% 50%);
    transition: clip-path 0.6s var(--ease-out);
}
.modal.active .modal-panel { clip-path: circle(150% at 50% 50%); }
.modal-title { font-size: 32px; font-weight: 800; margin: 6px 0 24px; }
.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    font-size: 26px;
    line-height: 1;
    transition: background-color 0.3s, transform 0.5s var(--ease-jelly);
}
.modal-close:hover { background: rgba(var(--fg-rgb), 0.1); transform: rotate(90deg); }

.ct-list { display: grid; gap: 4px; }
.ct-item {
    display: grid;
    grid-template-columns: 96px 1fr auto;
    grid-template-rows: auto auto;
    align-items: baseline;
    column-gap: 16px;
    width: 100%;
    padding: 14px 18px;
    border-radius: 16px;
    text-align: left;
    transition: color 0.3s;
}
.ct-item:hover { color: var(--blue); }
.ct-item:hover .ct-value { color: var(--blue); }
.ct-en { grid-row: 1 / 3; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.16em; color: var(--fg-3); }
.ct-label { font-weight: 600; }
.ct-value { grid-column: 2; font-size: 14px; color: var(--fg-2); word-break: break-all; transition: color 0.3s; }
.ct-arrow { grid-column: 3; grid-row: 1 / 3; align-self: center; color: var(--fg-3); transition: color 0.3s; }
.ct-item:hover .ct-arrow { color: var(--blue); }

.toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    z-index: 3000;
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 20px) scale(0.9);
    transition: opacity 0.3s, transform 0.5s var(--ease-jelly);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ==========================================================
   页脚
   ========================================================== */
.site-footer { position: relative; z-index: 2; padding: 0 var(--pad) 32px; }
.ft-liquid {
    overflow: hidden;
    padding: 4vw 0 2vw;
    text-align: center;
    user-select: none;
}
.ft-liquid span {
    display: inline-block;
    font-size: clamp(80px, 22vw, 360px);
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: -0.04em;
    color: var(--blue);
    filter: url(#liquid);
}
.ft-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr 1fr;
    gap: 40px;
    padding: 48px 0;
    border-top: 1px solid var(--line);
}
.ft-lead { margin-top: 14px; font-size: 18px; font-weight: 600; line-height: 1.6; }
.ft-contacts .ct-item { padding: 10px 14px; }
.ft-sites { display: grid; gap: 4px; align-content: start; }
.ft-sites a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; color: var(--fg-2); transition: color 0.3s; }
.ft-sites a:hover { color: var(--blue); }
.ft-host { font-family: var(--f-mono); font-size: 12px; color: var(--fg-3); }
.ft-bottom {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    font-family: var(--f-mono);
    font-size: 12px;
    color: var(--fg-3);
}

/* ==========================================================
   响应式 / 无障碍
   ========================================================== */
@media (max-width: 1000px) {
    .ft-grid { grid-template-columns: 1fr 1fr; }
    .ft-intro { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
    :root { --nav-h: 60px; }
    .logo-link { height: 20px; }
    .nav-toggle { display: flex; }
    .nav-links {
        position: fixed;
        top: var(--nav-h);
        left: 0;
        right: 0;
        transform: none;
        flex-direction: column;
        gap: 0;
        padding: 12px var(--pad) 28px;
        background: var(--glass);
        -webkit-backdrop-filter: blur(22px) saturate(180%);
        backdrop-filter: blur(22px) saturate(180%);
        clip-path: inset(0 0 100% 0);
        transition: clip-path 0.5s var(--ease-out);
    }
    .nav-links.active { clip-path: inset(0 0 0 0); }
    .nav-links a { padding: 16px 0; font-size: 20px; border-bottom: 1px solid var(--line); }
    .nav-links a::after { display: none; }
    .login-btn { height: 34px; padding: 0 16px; }
    .login-btn[data-tease]::after { display: none; }
    .user-name { display: none; }
    .user-btn { padding: 0 3px; }
    .ft-grid { grid-template-columns: 1fr; }
    .modal-panel { padding: 32px 20px; }
    .ct-item { grid-template-columns: 76px 1fr auto; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition-property: color, background-color, opacity !important; }
    .modal-panel { clip-path: none; }
    .logo.anim .o-ring-full { visibility: visible; }
}
