﻿/* /assets/styles/main.css */

/* ---- 颜色 & 主题 ---- */
:root {
    color-scheme: light dark;

    --bg: #f5f5f7;
    --bg-elevated: #ffffff;
    --bg-soft: #f0f0f5;
    --fg: #111827;
    --muted: #6b7280;
    --border-subtle: rgba(15, 23, 42, 0.08);
    --accent: #0a84ff;
    --accent-soft: #d0e3ff;
    --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.08);

    --radius-large: 18px;
    --radius-medium: 12px;

    --font-body: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
                 "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #050509;
        --bg-elevated: #111118;
        --bg-soft: #181821;
        --fg: #f9fafb;
        --muted: #9ca3af;
        --border-subtle: rgba(148, 163, 184, 0.35);
        --accent-soft: rgba(37, 99, 235, 0.25);
        --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.65);
    }
}

/* ---- 重置 & 全局 ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* 统一容器 */
.yz-main {
    flex: 1;
}

.yz-main-inner,
.yz-header-inner,
.yz-footer-inner {
    max-width: 980px;
    margin: 0 auto;
    padding-inline: 20px;
}

/* ---- 顶部导航 ---- */
.yz-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(20px);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    border-bottom: 0.5px solid var(--border-subtle);
}

.yz-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: 10px;
    gap: 12px;
}

/* logo */
.yz-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.yz-logo-mark {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: 0.5px solid var(--border-subtle);
    background: color-mix(in srgb, var(--accent-soft) 65%, var(--bg-elevated) 35%);
}

.yz-logo-text-main {
    font-size: 15px;
    font-weight: 600;
}

.yz-logo-text-sub {
    font-size: 11px;
    color: var(--muted);
}

/* 顶部右侧区域 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 顶部用户名 chip */
.user-pill {
    padding: 4px 12px;
    border-radius: 999px;
    border: 0.5px solid var(--border-subtle);
    background: var(--bg-elevated);
    font-size: 13px;
    text-decoration: none;
}

/* 顶部浅灰标签 / 退出按钮 */
.user-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 0.5px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
}

/* 备用导航 */
.yz-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.yz-nav a {
    padding: 4px 10px;
    border-radius: 999px;
    border: 0.5px solid transparent;
    text-decoration: none;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.yz-nav a:hover {
    background: var(--bg-soft);
    border-color: var(--border-subtle);
}

.yz-nav .primary-link {
    background: var(--accent);
    color: #ffffff;
    border-color: transparent;
}

/* 小屏导航按钮（备用） */
.nav-toggle {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 0.5px solid var(--border-subtle);
    background: var(--bg-elevated);
    font-size: 0;
    position: relative;
}

.nav-toggle span,
.nav-toggle::before,
.nav-toggle::after {
    position: absolute;
    left: 9px;
    right: 9px;
    height: 2px;
    border-radius: 999px;
    background: var(--fg);
    content: "";
    transition: transform 0.18s ease, opacity 0.18s ease, top 0.18s ease,
                bottom 0.18s ease;
}

.nav-toggle span {
    top: 50%;
    transform: translateY(-50%);
}

.nav-toggle::before {
    top: 10px;
}

.nav-toggle::after {
    bottom: 10px;
}

.nav-toggle.open span {
    opacity: 0;
}

.nav-toggle.open::before {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.nav-toggle.open::after {
    bottom: auto;
    top: 50%;
    transform: translateY(-50%) rotate(-45deg);
}

/* ---- hero 区 ---- */
.yz-main-inner {
    padding-top: 28px;
    padding-bottom: 40px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    align-items: center;
    margin-bottom: 32px;
}

/* 单列 hero 居中 */
.hero--single > div {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.hero-title {
    font-size: clamp(26px, 3vw, 32px);
    font-weight: 650;
    letter-spacing: -0.02em;
    margin: 10px 0 4px;
}

.hero-subtitle {
    font-size: 14px;
    color: var(--muted);
    max-width: 28rem;
    margin-inline: auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--bg-soft);
    border: 0.5px solid var(--border-subtle);
    font-size: 11px;
    color: var(--muted);
}

.hero-actions {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 999px;
    border: 0.5px solid transparent;
    background: var(--accent);
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.16s ease, box-shadow 0.16s ease;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}

.btn:hover {
    background: color-mix(in srgb, var(--accent) 88%, #ffffff 12%);
}

.btn-ghost {
    background: transparent;
    color: var(--fg);
    border-color: var(--border-subtle);
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--bg-soft);
}

.btn-small {
    padding: 5px 12px;
    font-size: 12px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

/* 顶部“登录 / 注册”按钮略宽一点 */
.header-auth-btn {
    padding-inline: 14px;
}

/* ---- 区块 & 标题 ---- */
.section {
    margin-top: 8px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.section-header--center {
    justify-content: center;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
}

.section-subtitle {
    font-size: 12px;
    color: var(--muted);
}

/* ---- 首页：分类块 ---- */
.category-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.category-card {
    border-radius: var(--radius-large);
    background: var(--bg-elevated);
    border: 0.5px solid var(--border-subtle);
    box-shadow: var(--shadow-soft);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-title {
    font-size: 14px;
    font-weight: 600;
}

.category-subtitle {
    font-size: 13px;
    color: var(--muted);
}

.category-footer {
    display: flex;
    justify-content: flex-end;
}

/* detail 列表（账户中心） */
.detail-list {
    margin: 6px 0 0;
    padding: 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    padding-block: 4px;
}

.detail-row + .detail-row {
    border-top: 0.5px solid var(--border-subtle);
}

.detail-row dt,
.detail-row dd {
    margin: 0;
}

.detail-row dt {
    color: var(--muted);
}

.detail-yid-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.detail-value {
    white-space: nowrap;
}

/* 行内“修改”按钮 */
.link-button {
    border: none;
    background: transparent;
    padding: 0;
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
}

.link-button:hover {
    text-decoration: underline;
}

/* ---- 表单通用 ---- */
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 7px 9px;
    border-radius: 10px;
    border: 0.5px solid var(--border-subtle);
    background: var(--bg-soft);
    color: var(--fg);
    font-size: 13px;
    outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-soft) 70%, transparent);
}

/* ---- 页脚 ---- */
.yz-footer {
    border-top: 0.5px solid var(--border-subtle);
    background: var(--bg);
    margin-top: auto;
}

.yz-footer-inner {
    padding-block: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    align-items: center;
}

/* 页脚上半：链接行（居中） */
.footer-main {
    display: flex;
    justify-content: center;
    width: 100%;
}

.footer-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.footer-links a {
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* 页脚下半：ICP 左、版权右 */
.footer-bottom {
    width: 100%;
    max-width: 980px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-icp {
    text-align: left;
    text-decoration: none;
}

/* ---- yID 弹窗 ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 80;
}

.modal-backdrop.open {
    display: flex;
}

.modal-card {
    width: 100%;
    max-width: 360px;
    background: var(--bg-elevated);
    border-radius: var(--radius-large);
    border: 0.5px solid var(--border-subtle);
    box-shadow: var(--shadow-soft);
    padding: 16px 16px 14px;
}

.modal-header h2 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
}

.modal-body {
    font-size: 13px;
}

.modal-description {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--muted);
}

.modal-label {
    display: block;
    font-size: 12px;
    margin-bottom: 10px;
}

.modal-label input[type="text"] {
    margin-top: 4px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

/* ---- yID / 全站 toast ---- */
.yz-toast-container {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(420px, 100% - 24px);
}

.yz-toast {
    background: var(--bg-elevated);
    border-radius: 999px;
    border: 0.5px solid var(--border-subtle);
    box-shadow: var(--shadow-soft);
    padding: 8px 10px 8px 14px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(-6px);
    animation: yz-toast-in 0.25s ease-out forwards;
}

.yz-toast-text {
    flex: 1;
}

.yz-toast-close {
    border: none;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    color: var(--muted);
}

.yz-toast-success {
    border-color: rgba(34, 197, 94, 0.35);
}

.yz-toast-error {
    border-color: rgba(239, 68, 68, 0.5);
}

.yz-toast.closing {
    animation: yz-toast-out 0.18s ease-in forwards;
}

/* ---- 响应式 ---- */
@media (max-width: 840px) {
    .category-card {
        padding: 12px 13px;
    }
}

@media (max-width: 640px) {
    .yz-main-inner,
    .yz-header-inner,
    .yz-footer-inner {
        padding-inline: 14px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .footer-icp {
        text-align: center;
    }
}

/* 极窄屏（手表） */
@media (max-width: 360px) {
    .yz-main-inner,
    .yz-header-inner,
    .yz-footer-inner {
        padding-inline: 10px;
    }

    .hero-title {
        font-size: 22px;
    }
}

/* 轻量出现动画 */
[data-animate="fade-up"] {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

[data-animate="fade-up"].visible {
    opacity: 1;
    transform: translateY(0);
}

/* toast 动画 */
@keyframes yz-toast-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes yz-toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-6px);
    }
}
