/* ===================================================
   Open2Hub — Apple Design Language
   参考苹果官网设计体系：极简、大气、克制
   =================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
a { text-decoration: none; color: inherit; }

/* ---------- Design Tokens ---------- */
:root {
    /* 主色 - 苹果官网蓝 */
    --accent:        #0071e3;
    --accent-hover:  #0077ed;
    --accent-lt:     #e8f1fb;

    /* 文字层级 - 取自苹果官网 */
    --t1: #1d1d1f;   /* 主标题 */
    --t2: #424245;   /* 正文 */
    --t3: #6e6e73;   /* 次要说明 */
    --t4: #86868b;   /* 辅助 / placeholder */
    --t5: #aeaeb2;   /* 极淡标注 */

    /* 背景 */
    --bg:       #fbfbfd;  /* 苹果官网背景色 */
    --bg-card:  #ffffff;
    --bg-alt:   #f5f5f7;

    /* 边框 */
    --line:   rgba(0,0,0,0.08);
    --line-md: rgba(0,0,0,0.12);

    /* 圆角 */
    --r-sm:  8px;
    --r-md:  12px;
    --r-lg:  18px;
    --r-xl:  22px;

    /* 阴影 */
    --s1: 0 1px 3px rgba(0,0,0,0.04);
    --s2: 0 2px 8px rgba(0,0,0,0.05),  0 1px 2px rgba(0,0,0,0.04);
    --s3: 0 4px 16px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
    --s4: 0 8px 32px rgba(0,0,0,0.09), 0 2px 8px rgba(0,0,0,0.05);
}

/* ---------- Base ---------- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
                 "PingFang SC", "Hiragino Sans GB",
                 "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--t1);
    line-height: 1.47059;   /* 苹果官网 body line-height */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* ---------- 背景装饰 ---------- */
.ios-bg {
    position: fixed; inset: 0;
    z-index: 0; pointer-events: none; overflow: hidden;
}
.ios-bg::before {
    content: '';
    position: absolute;
    width: 900px; height: 900px;
    top: -360px; right: -220px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(0,113,227,0.055) 0%,
        rgba(0,113,227,0.02) 40%,
        transparent 70%);
}
.ios-bg::after {
    content: '';
    position: absolute;
    width: 700px; height: 700px;
    bottom: -180px; left: -180px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(52,199,89,0.04) 0%,
        transparent 65%);
}

/* =============================================
   HEADER
   ============================================= */
.header {
    position: sticky; top: 0; z-index: 200;
    height: 48px;
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 max(22px, env(safe-area-inset-left));
    background: rgba(251,251,253,0.85);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    border-bottom: 1px solid var(--line);
}

.logo {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.022em;
    color: var(--t1);
}
.logo a { color: inherit; }

/* Header 小搜索（仅子页面） */
.search-box {
    display: flex; align-items: center; gap: 6px;
    height: 30px;
    padding: 0 10px;
    width: 260px;
    background: rgba(0,0,0,0.055);
    border-radius: 20px;
    border: 1px solid transparent;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.search-box:focus-within {
    background: var(--bg-card);
    border-color: rgba(0,113,227,0.35);
    box-shadow: 0 0 0 3px rgba(0,113,227,0.12);
}
.search-box input {
    flex: 1; border: none; outline: none;
    background: none;
    font-size: 13px; color: var(--t1);
    font-family: inherit;
    min-width: 0;
}
.search-box input::placeholder { color: var(--t4); }
.search-icon { color: var(--t4); font-size: 13px; flex-shrink: 0; }

.time-display {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--t4);
    white-space: nowrap;
    letter-spacing: 0.01em;
}

/* =============================================
   MAIN WRAPPER
   ============================================= */
.main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px 96px;
    position: relative; z-index: 1;
}

/* =============================================
   HERO
   ============================================= */
.hero {
    text-align: center;
    padding: 64px 20px 44px;
}

.hero h1 {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.08;
    color: var(--t1);
    margin-bottom: 12px;
}

.hero-sub {
    font-size: 18px;
    line-height: 1.5;
    color: var(--t3);
    max-width: 500px;
    margin: 0 auto;
    font-weight: 400;
    letter-spacing: -0.008em;
}

/* Hero 大搜索框 */
.hero-search {
    max-width: 580px;
    margin: 28px auto 0;
    position: relative;
}
.hero-search-inner {
    display: flex; align-items: center; gap: 10px;
    height: 54px;
    padding: 0 18px;
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--line-md);
    box-shadow: var(--s3);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.hero-search-inner:focus-within {
    border-color: rgba(0,113,227,0.45);
    box-shadow: 0 0 0 4px rgba(0,113,227,0.11), var(--s3);
}
.hero-search-icon {
    font-size: 17px;
    color: var(--t4);
    flex-shrink: 0;
    line-height: 1;
}
.hero-search-inner input {
    flex: 1; min-width: 0;
    border: none; outline: none; background: none;
    font-size: 16px;
    color: var(--t1);
    font-family: inherit;
    letter-spacing: -0.01em;
}
.hero-search-inner input::placeholder {
    color: var(--t4);
    font-weight: 400;
}
.hero-search-kbd {
    font-size: 11px;
    color: var(--t5);
    background: var(--bg-alt);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 2px 7px;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
    letter-spacing: 0.02em;
}

/* Hero 统计数字 */
.hero-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin-top: 32px;
}
.hero-stat {
    text-align: center;
    padding: 0 36px;
}
.hero-stat + .hero-stat {
    border-left: 1px solid var(--line-md);
}
.hero-stat-num {
    font-size: 26px;
    font-weight: 700;
    color: var(--t1);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.hero-stat-label {
    font-size: 11.5px;
    color: var(--t4);
    margin-top: 4px;
    letter-spacing: 0.01em;
}

/* =============================================
   FILTER TABS  —  苹果官网胶囊标签
   ============================================= */
.filter-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 24px 0 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.008em;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    background: rgba(0,0,0,0.04);
    color: var(--t3);
    font-family: inherit;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.filter-tab:hover {
    background: rgba(0,0,0,0.07);
    color: var(--t1);
}
.filter-tab:active { transform: scale(0.95); transition-duration: 0.08s; }
.filter-tab.active {
    background: var(--t1);
    color: #fff;
    border-color: transparent;
}
.filter-tab .filter-count {
    font-size: 11px;
    opacity: 0.55;
    font-weight: 400;
}

/* =============================================
   CATEGORY SECTION
   ============================================= */
.category-section { margin-bottom: 44px; }

.category-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.category-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--t1);
    letter-spacing: -0.018em;
}
.category-count {
    font-size: 12px;
    color: var(--t5);
    font-variant-numeric: tabular-nums;
}

/* =============================================
   SITES GRID  +  SITE CARD
   ============================================= */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 8px;
}

.site-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    background: var(--bg-card);
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    box-shadow: var(--s1);
    cursor: pointer;
    transition:
        transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.22s ease,
        border-color 0.15s ease;
    position: relative;
    overflow: hidden;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.site-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--s4);
    border-color: var(--line-md);
}
.site-card:active {
    transform: scale(0.97) translateY(0);
    transition-duration: 0.08s;
    box-shadow: var(--s1);
}

.site-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.site-card:hover .site-icon { transform: scale(1.07); }

.site-card-info { flex: 1; min-width: 0; }

.site-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--t1);
    letter-spacing: -0.015em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.site-desc {
    font-size: 11.5px;
    color: var(--t4);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.site-tags {
    display: flex; flex-wrap: wrap;
    gap: 3px; margin-top: 5px;
}
.site-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--accent-lt);
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* =============================================
   SITE DETAIL PAGE
   ============================================= */
.site-detail-hero { padding: 20px 0 10px; }

.site-detail-card {
    background: var(--bg-card);
    border-radius: var(--r-xl);
    padding: 36px 40px;
    border: 1px solid var(--line);
    box-shadow: var(--s2);
    position: relative;
    overflow: hidden;
}
/* 顶部彩色线条 */
.site-detail-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg,
        var(--site-color, var(--accent)) 0%,
        rgba(255,255,255,0) 100%);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    opacity: 0.6;
}
/* 右上角光晕 */
.site-detail-card::after {
    content: '';
    position: absolute;
    top: -30%; right: -8%;
    width: 360px; height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle,
        var(--site-color-alpha, rgba(0,113,227,0.04)) 0%,
        transparent 70%);
    pointer-events: none;
}

.site-detail-top {
    display: flex; align-items: flex-start; gap: 24px;
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
    position: relative; z-index: 1;
}
.site-detail-icon {
    width: 64px; height: 64px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.site-detail-meta { flex: 1; padding-top: 4px; }
.site-detail-meta h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--t1);
    margin-bottom: 8px;
    line-height: 1.1;
}
.site-detail-meta .site-url {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px;
    color: var(--accent);
    opacity: 0.8;
    word-break: break-all;
    transition: opacity 0.15s;
}
.site-detail-meta .site-url:hover { opacity: 1; }
.site-url-visit {
    display: inline-flex; align-items: center;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 1;
    letter-spacing: 0.01em;
}

.site-detail-body { position: relative; z-index: 1; }

.site-detail-body .desc-section { margin-bottom: 24px; }
.site-detail-body .desc-section h2 {
    font-size: 13px;
    font-weight: 600;
    color: var(--t5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}
.site-detail-body .desc-section p {
    font-size: 15px;
    color: var(--t2);
    line-height: 1.75;
}

.site-detail-tags {
    display: flex; flex-wrap: wrap; gap: 7px;
    margin-bottom: 24px;
    text-align: center;
}
.detail-tag {
    font-size: 12px;
    padding: 5px 14px;
    border-radius: 20px;
    background: var(--bg-alt);
    color: var(--t2);
    font-weight: 500;
    border: 1px solid var(--line);
    transition: background 0.15s, border-color 0.15s;
}
.detail-tag:hover {
    background: var(--accent-lt);
    border-color: rgba(0,113,227,0.2);
    color: var(--accent);
}

.site-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 28px;
}
.info-item {
    background: var(--bg-alt);
    border-radius: var(--r-md);
    padding: 14px 16px;
    border: 1px solid transparent;
    min-width: 150px;
    width: fit-content;
}
.info-item-label {
    font-size: 13px;
    color: var(--t5);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 5px;
    font-weight: 600;
}
.info-item-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--t1);
    letter-spacing: -0.01em;
}

/* Related */
.related-section { margin-top: 40px; }
.related-section h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--t1);
    letter-spacing: -0.018em;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

/* =============================================
   BREADCRUMB  /  BACK BUTTON
   ============================================= */
.breadcrumb {
    display: flex; align-items: center; gap: 6px;
    padding: 20px 0 10px;
    font-size: 12px;
    color: var(--t4);
}
.breadcrumb a { color: var(--accent); transition: opacity 0.15s; }
.breadcrumb a:hover { opacity: 0.7; }
.breadcrumb .separator { color: var(--t5); }

.back-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 12px 5px 8px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--bg-card);
    color: var(--t3);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    margin-bottom: 20px;
    margin-top: 40px;
    font-family: inherit;
    box-shadow: var(--s1);
    letter-spacing: -0.008em;
    line-height: 1;  
}
.back-btn:hover {
    background: var(--bg-alt);
    border-color: var(--line-md);
    color: var(--t1);
}
.back-btn:active { transform: scale(0.96); transition-duration: 0.08s; }

/* =============================================
   FOOTER
   ============================================= */
.footer {
    text-align: center;
    padding: 32px 20px;
    border-top: 1px solid var(--line);
    margin-top: 0;
    position: relative; z-index: 1;
    color: var(--t5);
    font-size: 12px;
    line-height: 2;
    letter-spacing: 0.01em;
}
.footer a { color: var(--t4); transition: color 0.15s; }
.footer a:hover { color: var(--accent); }

/* =============================================
   NO RESULTS
   ============================================= */
.no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--t4);
    font-size: 15px;
    display: none;
    letter-spacing: -0.01em;
}

/* =============================================
   BACK TO TOP
   ============================================= */
.back-to-top {
    position: fixed;
    right: 24px; bottom: 32px;
    z-index: 300;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--line-md);
    box-shadow: var(--s3);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: var(--t3);
    opacity: 0;
    transform: translateY(14px) scale(0.9);
    transition: opacity 0.26s ease, transform 0.26s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s ease;
    pointer-events: none;
}
.back-to-top.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.back-to-top:hover {
    box-shadow: var(--s4);
    color: var(--t1);
}
.back-to-top:active { transform: scale(0.91); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .header { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
    .search-box { width: 100%; order: 3; border-radius: var(--r-md); }
    .time-display { display: none; }

    .main { padding: 0 16px 72px; }

    .hero { padding: 44px 16px 32px; }
    .hero h1 { font-size: 34px; }
    .hero-sub { font-size: 16px; max-width: 100%; }
    .hero-search { max-width: 100%; margin-top: 22px; }
    .hero-search-inner { height: 50px; border-radius: var(--r-md); }
    .hero-search-inner input { font-size: 15px; }
    .hero-search-kbd { display: none; }
    .hero-stats { gap: 0; margin-top: 28px; }
    .hero-stat { padding: 0 24px; }
    .hero-stat-num { font-size: 22px; }

    .filter-tabs { padding: 16px 0 18px; gap: 5px; }
    .filter-tab { padding: 6px 13px; font-size: 12px; }

    .category-section { margin-bottom: 32px; }
    .sites-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 7px; }
    .site-card { padding: 11px 12px; }

    .site-detail-card { padding: 24px 18px; border-radius: 18px; }
    .site-detail-top { flex-direction: column; gap: 16px; }
    .site-detail-icon { width: 56px; height: 56px; font-size: 24px; border-radius: 14px; }
    .site-detail-meta h1 { font-size: 24px; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 28px; }
    .hero-stats { gap: 24px; }
    .hero-stat-num { font-size: 22px; }
    .sites-grid { grid-template-columns: repeat(2, 1fr); gap: 7px; }
    .site-info-grid { grid-template-columns: 1fr 1fr; }
}
