/* ================= Download Page Styles ================= */

/* ----- Hero ----- */
.dl-hero {
    padding-top: 140px;
    padding-bottom: 80px;
    background: linear-gradient(160deg, var(--dark-bg) 0%, #0f2a1a 60%, #153322 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.dl-hero::before {
    content: '';
    position: absolute;
    top: -40%; right: -10%;
    width: 70%; height: 160%;
    background: radial-gradient(ellipse at center, rgba(167,196,160,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.dl-hero-inner {
    position: relative;
    z-index: 2;
    max-width: 760px;
}

.dl-hero-title {
    font-size: clamp(2.8rem, 4.5vw, 4.8rem);
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1.06;
    margin-bottom: 1.5rem;
    color: white;
}

.dl-hero-desc {
    font-size: 1.15rem;
    color: rgba(255,255,255,0.65);
    line-height: 1.8;
    max-width: 580px;
    margin-bottom: 2rem;
}

.dl-trust-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.dl-trust-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
}

.dl-trust-item svg {
    color: var(--accent-green);
    flex-shrink: 0;
}

/* ----- Main Download Section ----- */
.dl-main-section {
    padding: 0 0 100px;
    background: var(--bg-base);
}

/* ----- Platform Tabs ----- */
.platform-tabs {
    display: flex;
    gap: 4px;
    padding: 20px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    flex-wrap: wrap;
    position: sticky;
    top: 80px;
    background: var(--bg-base);
    z-index: 100;
    padding-bottom: 0;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-gray);
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.25s ease;
    position: relative;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

.tab-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
    opacity: 0.7;
}
.tab-btn polyline, .tab-btn line {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tab-btn:hover {
    color: var(--text-dark);
    background: rgba(0,0,0,0.03);
}

.tab-btn.active {
    color: var(--dark-bg);
    background: var(--bg-surface);
    box-shadow: 0 -1px 0 var(--dark-bg) inset;
}

.tab-btn.active svg {
    opacity: 1;
}

/* ----- Tab Panels ----- */
.tab-panel {
    display: none;
    padding: 60px 0 0;
    animation: fadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-panel.active {
    display: block;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ----- Platform Intro ----- */
.platform-intro {
    margin-bottom: 40px;
}

.platform-intro h2 {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--dark-bg);
    margin-bottom: 14px;
}

.platform-intro p {
    font-size: 1.08rem;
    color: var(--text-gray);
    line-height: 1.8;
    max-width: 760px;
}

/* ----- Clients Grid ----- */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

/* ----- Client Card ----- */
.client-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 36px;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.client-card:hover {
    box-shadow: 0 20px 50px rgba(0,0,0,0.06);
    transform: translateY(-4px);
    border-color: rgba(167,196,160,0.3);
}

.client-card.featured {
    border-color: rgba(11,28,19,0.08);
    background: linear-gradient(160deg, #ffffff 0%, #f9fbf9 100%);
}

.client-card.featured::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--dark-bg), var(--accent-green));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.client-card.deprecated {
    opacity: 0.75;
}

.client-card.deprecated:hover {
    opacity: 1;
}

/* ----- Card Header ----- */
.client-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.client-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.client-icon svg {
    width: 24px;
    height: 24px;
}

.client-icon-verge  { background: linear-gradient(135deg, #0b1c13, #1e4030); }
.client-icon-verge svg { stroke: var(--accent-green); }
.client-icon-nyan   { background: linear-gradient(135deg, #6b3fa0, #a162e8); }
.client-icon-nyan svg { stroke: white; }
.client-icon-fl     { background: linear-gradient(135deg, #1a73e8, #4e9af1); }
.client-icon-fl svg { stroke: white; }
.client-icon-cfw    { background: linear-gradient(135deg, #3d4f5c, #5c7380); }
.client-icon-cfw svg { stroke: white; }
.client-icon-clashx { background: linear-gradient(135deg, #1c1c1e, #3d3d3d); }
.client-icon-clashx svg { stroke: var(--accent-green); fill: var(--accent-green); }
.client-icon-meta   { background: linear-gradient(135deg, #e8521a, #f0813a); }
.client-icon-meta svg { stroke: white; fill: white; }
.client-icon-surf   { background: linear-gradient(135deg, #0097a7, #26c6da); }
.client-icon-surf svg { stroke: white; }
.client-icon-stash  { background: linear-gradient(135deg, #0071e3, #2997ff); }
.client-icon-stash svg { stroke: white; }
.client-icon-rocket { background: linear-gradient(135deg, #c2185b, #e91e63); }
.client-icon-rocket svg { stroke: white; }

.client-meta {
    flex: 1;
    min-width: 0;
}

.client-name {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--dark-bg);
    margin-bottom: 8px;
}

.client-platform-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ptag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 5px;
    background: var(--bg-base);
    color: var(--text-gray);
    border: 1px solid rgba(0,0,0,0.06);
    letter-spacing: 0.3px;
}

/* ----- Badges ----- */
.badge-recommend {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    background: var(--dark-bg);
    color: var(--accent-green);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-deprecated {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    background: rgba(0,0,0,0.05);
    color: var(--text-gray);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ----- Client Description ----- */
.client-desc {
    font-size: 0.98rem;
    color: var(--text-gray);
    line-height: 1.75;
}

/* ----- Client Feature Tags ----- */
.client-features {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.client-features span {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(167,196,160,0.12);
    color: #2e6b35;
    border: 1px solid rgba(167,196,160,0.25);
}

/* ----- Download Buttons ----- */
.client-downloads {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 8px;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 20px;
    background: var(--dark-bg);
    color: white;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    white-space: nowrap;
}

.btn-download:hover {
    background: var(--accent-green);
    color: var(--dark-bg);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.btn-download-alt {
    background: var(--bg-base);
    color: var(--text-dark);
    border: 1px solid rgba(0,0,0,0.08);
}

.btn-download-alt:hover {
    background: var(--accent-green);
    color: var(--dark-bg);
    border-color: transparent;
}

.btn-download-muted {
    background: rgba(0,0,0,0.04);
    color: var(--text-gray);
    border: 1px solid rgba(0,0,0,0.06);
}

.btn-download-muted:hover {
    background: var(--dark-bg);
    color: white;
    border-color: transparent;
}

.btn-appstore {
    background: #1c1c1e;
}

.btn-appstore:hover {
    background: #2c2c2e;
    color: white;
}

.btn-github {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 18px;
    background: transparent;
    color: var(--text-gray);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-github svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

.btn-github:hover {
    background: var(--dark-bg);
    color: white;
    border-color: transparent;
}

.btn-github-disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* ----- Platform Note ----- */
.platform-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 24px;
    background: rgba(167,196,160,0.08);
    border: 1px solid rgba(167,196,160,0.2);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    color: var(--text-gray);
    line-height: 1.7;
}

.platform-note svg {
    color: #2e6b35;
    flex-shrink: 0;
    margin-top: 2px;
}

.platform-note strong { color: var(--text-dark); }
.platform-note code {
    font-family: 'SF Mono', Consolas, 'Courier New', monospace;
    font-size: 0.85em;
    padding: 1px 6px;
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
}

.platform-note-warn {
    background: rgba(250,180,50,0.06);
    border-color: rgba(250,180,50,0.25);
}

.platform-note-warn svg { color: #c67c00; }

/* ----- Architecture Guide (Android) ----- */
.arch-guide {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 36px;
    padding: 24px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0,0,0,0.04);
}

.arch-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.arch-item strong {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--dark-bg);
    letter-spacing: -0.2px;
}

.arch-item span {
    font-size: 0.85rem;
    color: var(--text-gray);
    line-height: 1.6;
}

/* ----- iOS Card ----- */
.ios-card {
    position: relative;
}

/* ----- Core Section ----- */
.core-groups {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-bottom: 40px;
}

.core-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--dark-bg);
    margin-bottom: 16px;
    letter-spacing: -0.3px;
}

.core-group-title svg {
    width: 20px;
    height: 20px;
    fill: var(--text-gray);
    flex-shrink: 0;
}
.core-group-title polyline, .core-group-title line {
    fill: none;
    stroke: var(--text-gray);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.core-files {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}

.core-file-card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 16px;
    row-gap: 4px;
    padding: 18px 20px;
    background: var(--bg-surface);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.core-file-card:hover {
    border-color: rgba(11,28,19,0.2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}

.core-file-name {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--dark-bg);
    font-family: 'SF Mono', Consolas, 'Courier New', monospace;
    letter-spacing: -0.3px;
    word-break: break-all;
}

.core-file-desc {
    grid-column: 1;
    grid-row: 2;
    font-size: 0.82rem;
    color: var(--text-gray);
    line-height: 1.4;
}

.core-dl-icon {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-gray);
    white-space: nowrap;
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--bg-base);
    border: 1px solid rgba(0,0,0,0.06);
    transition: all 0.2s ease;
}

.core-file-card:hover .core-dl-icon {
    background: var(--dark-bg);
    color: white;
    border-color: transparent;
}

/* ----- Core GitHub Banner ----- */
.core-github-banner {
    background: linear-gradient(135deg, var(--dark-bg) 0%, #1a3d28 100%);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    margin-top: 20px;
}

.core-github-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap;
}

.core-github-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: white;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.core-github-desc {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.7;
    max-width: 560px;
}

.btn-github-large {
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 700;
    background: rgba(255,255,255,0.08);
    color: white;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-github-large:hover {
    background: var(--accent-green);
    color: var(--dark-bg);
    border-color: transparent;
}

/* ----- Safety Section ----- */
.safety-section {
    padding: 80px 0;
    background: var(--bg-surface);
    border-top: 1px solid rgba(0,0,0,0.04);
}

.safety-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.safety-card {
    padding: 36px 32px;
    border-radius: var(--radius-md);
    background: var(--bg-base);
    border: 1px solid rgba(0,0,0,0.04);
}

.safety-icon {
    width: 46px;
    height: 46px;
    background: var(--accent-green-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.safety-icon svg {
    width: 22px;
    height: 22px;
    stroke: var(--dark-bg);
}

.safety-card h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--dark-bg);
    margin-bottom: 14px;
    letter-spacing: -0.3px;
}

.safety-card p {
    font-size: 0.95rem;
    color: var(--text-gray);
    line-height: 1.75;
}

.safety-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--dark-bg);
    text-decoration: none;
    transition: gap 0.2s ease;
}

.safety-link:hover {
    gap: 10px;
}

/* ================= Responsive ================= */
@media (max-width: 1100px) {
    .clients-grid { grid-template-columns: 1fr; }
    .safety-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
    .arch-guide { grid-template-columns: 1fr; }
    .core-files { grid-template-columns: 1fr; }
    .core-github-inner { flex-direction: column; gap: 24px; }
    .core-github-inner .btn-github-large { width: 100%; justify-content: center; }
}

@media (max-width: 768px) {
    .dl-hero { padding-top: 110px; padding-bottom: 56px; }
    .dl-hero-title { font-size: 2.6rem; letter-spacing: -1.5px; }
    .dl-trust-row { gap: 14px; flex-direction: column; }

    .platform-tabs {
        top: 64px;
        gap: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0;
    }
    .platform-tabs::-webkit-scrollbar { display: none; }
    .tab-btn { padding: 12px 14px; font-size: 0.85rem; }
    .tab-btn svg { width: 16px; height: 16px; }

    .platform-intro h2 { font-size: 1.8rem; }
    .client-card { padding: 24px; }
    .client-downloads { gap: 8px; }
    .btn-download, .btn-github { font-size: 0.82rem; padding: 10px 14px; }

    .safety-grid { grid-template-columns: 1fr; }

    .core-file-name { font-size: 0.8rem; }
}

@media (max-width: 480px) {
    .client-card-header {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 10px 16px;
        align-items: center;
    }
    .badge-recommend, .badge-deprecated {
        grid-column: 1 / -1;
        grid-row: 1;
        justify-self: start;
    }
    .client-icon {
        grid-column: 1;
        grid-row: 2;
    }
    .client-meta {
        grid-column: 2;
        grid-row: 2;
    }
}
