/* ============================================================
   Evorit IPTV Project — Pico.css 自定义样式
   主色 : 白丁香 #F8F8F9 / 深蓝 #111439 (渐变)
   辅助 : 蓝 #106EBE / 薄荷 #0FFCBE
   特性 : 语义化、极简 JS、三态主题切换（浅色/深色/跟随系统）
   ============================================================ */

/* ---- 覆盖 Pico.css 对 <nav> 的默认样式，使导航紧凑无空白 ---- */
.site-header nav {
    --pico-nav-element-spacing-vertical: 0;
    --pico-nav-element-spacing-horizontal: 0;
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
    margin: 0 !important;
    min-height: 0 !important;
}

.site-header nav ul,
.site-header nav li,
.site-header nav a {
    margin: 0 !important;
}

.site-header nav ul {
    --pico-nav-gap: 0.1rem;
    gap: 0.1rem;
}

.site-header nav ul a,
.site-header nav ul a[aria-current="page"] {
    line-height: 1;
}

/* 消除 header 与 main 之间可能的间隙 */
.site-header {
    display: block;
}

.hero {
    margin-top: 0 !important;
}

main {
    margin-top: 0;
    padding-top: 0;
}

/* ============================================================ */

:root {
    --pico-font-family: "Poppins", "PingFang SC", "Microsoft YaHei", "Segoe UI", -apple-system, sans-serif;
    --pico-border-radius: 0.75rem;

    --white-lilac: #F8F8F9;
    --deep-navy: #111439;
    --blue: #106EBE;
    --mint: #0FFCBE;
    --brand-grad: linear-gradient(135deg, #111439 0%, #106EBE 100%);
    /* 全局统一底色渐变 */
    --body-grad-light: linear-gradient(180deg, #F8F8F9 0%, #eef3fa 45%, #e7f4f7 100%);
    --body-grad-dark: linear-gradient(180deg, #111439 0%, #141a3d 45%, #0f2137 100%);
}

/* ---------- 主题变量（data-theme 为实际渲染主题） ---------- */
:root[data-theme="light"] {
    --pico-primary: #106EBE;
    --pico-primary-hover: #0b5aa3;
    --pico-primary-inverse: #ffffff;

    --bg-soft: #F8F8F9;
    --body-grad: var(--body-grad-light);
    --muted: #5b6472;
    --nav-bg: rgba(248, 248, 249, 0.92);
    --nav-border: rgba(17, 20, 57, 0.12);
    --card-shadow: 0 8px 28px rgba(17, 20, 57, 0.08);
    --icon-bg: rgba(16, 110, 190, 0.1);
    --tag-bug-bg: #fee2e2;
    --tag-bug-fg: #b91c1c;
    --tag-up-bg: #dbeafe;
    --tag-up-fg: #1d4ed8;
    --footer-bg: #111439;
}

:root[data-theme="dark"] {
    --pico-primary: #0FFCBE;
    --pico-primary-hover: #5fffd3;
    --pico-primary-inverse: #111439;

    --bg-soft: #111439;
    --body-grad: var(--body-grad-dark);
    --muted: #8fa3bf;
    --nav-bg: rgba(17, 20, 57, 0.9);
    --nav-border: rgba(15, 252, 190, 0.2);
    --card-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    --icon-bg: rgba(15, 252, 190, 0.14);
    --tag-bug-bg: #4c1d1d;
    --tag-bug-fg: #fca5a5;
    --tag-up-bg: #1e3a5f;
    --tag-up-fg: #93c5fd;
    --footer-bg: #0a0c20;
}

/* ---------- 通用 ---------- */
html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* 全局统一渐变底色，消除各板块之间的色带/间隔割裂感 */
    background: var(--body-grad) fixed;
    background-color: var(--pico-background-color);
}

main {
    flex: 1;
}

section {
    padding: 3rem 0;
    /* 消除 Pico 默认的 section 底部外边距（板块之间的间距来源） */
    margin-bottom: 0;
}

.section-title {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 2.4rem;
}

.section-title small {
    color: var(--pico-primary);
    font-weight: 600;
    letter-spacing: 0.08em;
}

.section-title h2 {
    margin-bottom: 0.4rem;
}

.section-title p {
    color: var(--muted);
    font-size: 0.95rem;
}

.text-center {
    text-align: center;
}

/* ---------- 导航栏（紧凑、吸顶、无框） ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--nav-border);
    padding: 0;
}

.site-header nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    padding: 0.35rem 1rem;
    flex-wrap: nowrap;
}

.site-header .logo {
    height: 30px;
    width: auto;
    display: block;
}

.site-header nav ul {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 0.1rem;
    flex-wrap: nowrap;
}

.site-header nav ul a {
    display: block;
    padding: 0.35rem 0.8rem;
    border-radius: 2rem;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.2s ease, background 0.2s ease;
}

.site-header nav ul a:hover {
    color: var(--pico-primary);
    background: var(--icon-bg);
}

.site-header nav ul a[aria-current="page"] {
    color: var(--pico-primary);
    font-weight: 700;
}

/* ---- 下拉菜单：纯 hover 弹出，无边框项 ---- */
.nav-has-child {
    position: relative;
}

.nav-has-child > a {
    cursor: pointer;
}

.nav-has-child > a i {
    transition: transform 0.22s ease;
}

.nav-has-child:hover > a i {
    transform: rotate(180deg);
}

.nav-has-child .submenu {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translate(-50%, 10px);
    min-width: 11rem;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    background: var(--pico-card-background-color);
    border-radius: 0.6rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    z-index: 300;
}

.nav-has-child:hover .submenu,
.nav-has-child:focus-within .submenu {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.nav-has-child .submenu a {
    display: block;
    padding: 0.4rem 0.85rem;
    border-radius: 0.4rem;
    white-space: nowrap;
    font-size: 0.9rem;
}

.nav-has-child .submenu a:hover {
    background: var(--icon-bg);
}

/* ---- 主题切换按钮（三态） ---- */
.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    border: 1px solid var(--nav-border);
    background: linear-gradient(135deg, rgba(17, 20, 57, 0.08), rgba(16, 110, 190, 0.14));
    color: var(--pico-primary);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(17, 20, 57, 0.16);
    transition: transform 0.3s ease, box-shadow 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle:hover {
    transform: rotate(20deg) scale(1.1);
    color: var(--pico-primary-hover);
    border-color: var(--pico-primary);
    box-shadow: 0 4px 16px rgba(16, 110, 190, 0.3);
}

.theme-toggle i {
    position: absolute;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

html[data-mode="light"] .theme-toggle i[data-mode="light"],
html[data-mode="dark"] .theme-toggle i[data-mode="dark"],
html[data-mode="system"] .theme-toggle i[data-mode="system"] {
    opacity: 1;
    transform: scale(1);
}

/* ---------- Hero ---------- */
.hero {
    background: var(--brand-grad);
    color: #fff;
    text-align: center;
    padding: 4.5rem 1rem 3.5rem;
    margin: 0;
}

.hero h1 {
    color: #fff;
    font-weight: 800;
    font-size: clamp(2rem, 5.5vw, 3.3rem);
    margin-bottom: 1rem;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
}

.hero .sub {
    color: var(--mint);
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 1.6rem;
}

.hero .notice {
    max-width: 720px;
    margin: 0 auto 1.8rem;
    font-size: 0.95rem;
    line-height: 1.9;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.8rem;
    padding: 1rem 1.4rem;
    color: #fdeff6;
}

.hero .notice a {
    color: var(--mint);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.hero a[role="button"] {
    background: var(--mint);
    color: #101c2a;
    border-color: var(--mint);
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(15, 252, 190, 0.35);
}

.hero a[role="button"]:hover {
    background: #5fffd3;
    border-color: #5fffd3;
}

/* ---------- 服务选择 ---------- */
/* 背景透明，融入全局渐变底色，消除色带/间隔割裂感 */
.service-select {
    background: transparent;
}

.service-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: end;
    max-width: 760px;
    margin: 0 auto;
}

.service-form select,
.service-form button {
    margin-bottom: 0;
}

.service-form button {
    white-space: nowrap;
    background: var(--brand-grad);
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 2rem;
    padding: 0.55rem 1.6rem;
    box-shadow: 0 4px 14px rgba(17, 20, 57, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.service-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 20, 57, 0.35);
    opacity: 0.92;
}

/* ---------- 特性 ---------- */
.features {
    position: relative;
    overflow: hidden;
    background: transparent;
}

/* 首页底部按钮组：TG 与 QQ 并排 */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
    align-items: center;
}

.btn-group a[role="button"] {
    margin: 0;
}

/* 背景不规则图形：缓慢流动变形 + 变色（去模板感） */
.features::before,
.features::after {
    content: "";
    position: absolute;
    z-index: 0;
    pointer-events: none;
    will-change: border-radius, transform, filter;
}

.features::before {
    width: 440px;
    height: 440px;
    top: -140px;
    right: -140px;
    background: radial-gradient(circle at 35% 30%, rgba(16, 110, 190, 0.55), rgba(15, 252, 190, 0.14) 58%, transparent 72%);
    animation: blob-a 18s ease-in-out infinite alternate;
}

.features::after {
    width: 380px;
    height: 380px;
    bottom: -120px;
    left: -130px;
    background: radial-gradient(circle at 60% 40%, rgba(15, 252, 190, 0.4), rgba(16, 110, 190, 0.18) 55%, transparent 72%);
    animation: blob-b 22s ease-in-out infinite alternate;
}

@keyframes blob-a {
    0% {
        border-radius: 58% 42% 60% 40% / 44% 62% 38% 56%;
        transform: translate(0, 0) rotate(0deg);
        filter: blur(50px) hue-rotate(0deg);
    }
    50% {
        border-radius: 42% 58% 38% 62% / 58% 40% 60% 42%;
        transform: translate(-32px, 24px) rotate(12deg);
        filter: blur(62px) hue-rotate(80deg);
    }
    100% {
        border-radius: 55% 45% 62% 38% / 40% 55% 45% 60%;
        transform: translate(16px, -18px) rotate(-10deg);
        filter: blur(48px) hue-rotate(160deg);
    }
}

@keyframes blob-b {
    0% {
        border-radius: 46% 54% 58% 42% / 55% 44% 56% 45%;
        transform: translate(0, 0) rotate(0deg);
        filter: blur(56px) hue-rotate(40deg);
    }
    50% {
        border-radius: 60% 40% 44% 56% / 42% 58% 42% 58%;
        transform: translate(28px, -20px) rotate(-14deg);
        filter: blur(66px) hue-rotate(180deg);
    }
    100% {
        border-radius: 40% 60% 55% 45% / 60% 40% 60% 40%;
        transform: translate(-20px, 24px) rotate(8deg);
        filter: blur(50px) hue-rotate(280deg);
    }
}

.features .section-title,
.features .feat-grid,
.features .text-center {
    position: relative;
    z-index: 1;
}

/* 3 列排版（9 张卡片排成 3×3） */
/* 显式指定列数与行距/列距，强制覆盖 Pico .grid 的 grid-column-gap（默认 21px） */
.feat-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    grid-template-rows: repeat(3, auto) !important;
    column-gap: 1rem !important;
    row-gap: 1rem !important;
    margin: 0 !important;
    padding: 0 !important;
}

.feat {
    text-align: center;
    background: color-mix(in srgb, var(--pico-card-background-color) 82%, transparent);
    border: 1px solid var(--nav-border);
    border-radius: 0.5rem;
    margin: 0;
    /* 恢复完整内边距，内容不贴边 */
    padding: 1.5rem 1.25rem;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.feat:hover {
    background: var(--icon-bg);
    border-color: var(--pico-primary);
}

.feat-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border-radius: 30% 70% 55% 45% / 55% 45% 30% 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--icon-bg);
    color: var(--pico-primary);
    font-size: 1.5rem;
    transform: rotate(-4deg);
}

.feat h3 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.feat p {
    font-size: 0.9rem;
}

/* ---------- 更新日志（纯文字形式） ---------- */
.changelog {
    max-width: none;
    margin: 0;
}

/* FAQ / 更新日志 标题与 FAQ 卡片标题美化 */
.faq h2,
.changelog h2,
.faq .container > h2,
.changelog .container > h2 {
    margin-top: 1.6rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--nav-border);
}

.faq summary {
    font-size: 1rem;
}

/* 内容页正文容器：居中的舒适阅读宽度 */
.changelog .container,
.faq .container,
.md-body .container {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.log-item {
    background: var(--pico-card-background-color);
    border: 1px solid var(--nav-border);
    border-radius: 0.75rem;
    box-shadow: var(--card-shadow);
    padding: 1.2rem 1.4rem;
    margin-bottom: 1rem;
}

.log-item .tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.55rem;
    border-radius: 0.3rem;
    margin-bottom: 0.6rem;
}

.log-item .tag.bug {
    background: var(--tag-bug-bg);
    color: var(--tag-bug-fg);
}

.log-item .tag.update {
    background: var(--tag-up-bg);
    color: var(--tag-up-fg);
}

.log-item h3 {
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
}

.log-item p {
    font-size: 0.93rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

.log-item .log-link {
    font-size: 0.88rem;
    margin-top: 0.4rem;
    margin-bottom: 0;
}

.log-item .log-link a {
    color: var(--pico-primary);
    font-weight: 600;
}

/* ---------- FAQ 手风琴 ---------- */
.faq {
    max-width: none;
    margin: 0;
}

.faq details {
    background: var(--pico-card-background-color);
    border: 1px solid var(--nav-border);
    border-radius: 0.75rem;
    margin-bottom: 0.8rem;
    padding: 0.2rem 1.2rem;
    box-shadow: var(--card-shadow);
}

.faq details summary {
    font-weight: 600;
    color: var(--pico-primary);
    cursor: pointer;
    padding: 0.8rem 0;
    list-style: none;
}

.faq details summary::-webkit-details-marker {
    display: none;
}

.faq details summary::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    float: right;
    color: var(--muted);
    transition: transform 0.25s ease;
}

.faq details[open] summary::after {
    transform: rotate(180deg);
}

.faq details summary:hover {
    color: var(--pico-primary-hover);
}

.faq details .faq-body {
    padding: 0 0 1rem;
}

/* ---------- 页面标题区（FAQ/协议页） ---------- */
.page-head {
    background: var(--brand-grad);
    color: #fff;
    text-align: center;
    padding: 3rem 1rem;
}

.page-head h1 {
    color: #fff;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.page-head p {
    color: rgba(255, 255, 255, 0.85);
}

/* ---------- Markdown 正文（readme / epg-guide 等文档页） ---------- */
.md-body {
    max-width: none;
    margin: 0;
    padding: 1.5rem 0;
    line-height: 1.8;
}

/* 文档页正文排版美化 */
.md-body h2 {
    margin-top: 2.4rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--nav-border);
    font-weight: 700;
}

.md-body h2:first-of-type {
    margin-top: 1.2rem;
}

.md-body p {
    margin: 0.9rem 0;
}

.md-body a {
    color: var(--pico-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.md-body a:hover {
    color: var(--pico-primary-hover);
}

.md-body ul,
.md-body ol {
    padding-left: 1.4rem;
    margin: 0.8rem 0;
}

.md-body li {
    margin: 0.35rem 0;
}

.md-body strong {
    color: var(--pico-primary);
}

/* 代码字体：Consolas / Ubuntu Mono 待选 */
:root {
    --code-font: "Consolas", "Ubuntu Mono", "Cascadia Code", "Courier New", monospace;
}

/* 内联代码 */
.md-body code,
.faq code,
.log-item code {
    font-family: var(--code-font);
    font-size: 0.88em;
    background: var(--icon-bg);
    border: 1px solid var(--nav-border);
    border-radius: 0.3rem;
    padding: 0.1rem 0.35rem;
    word-break: break-all;
}

/* 代码块 */
.md-body pre {
    font-family: var(--code-font);
    font-size: 0.9rem;
    background: var(--bg-soft);
    border: 1px solid var(--nav-border);
    border-radius: 0.6rem;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    line-height: 1.6;
    box-shadow: var(--card-shadow);
}

.md-body pre code {
    font-family: inherit;
    font-size: inherit;
    background: none;
    border: none;
    padding: 0;
    word-break: normal;
}

.md-body blockquote {
    border-left: 0.25em solid var(--pico-primary);
    background: var(--icon-bg);
    border-radius: 0 0.5rem 0.5rem 0;
    margin: 1.2rem 0;
    padding: 0.8rem 1.2rem;
    color: var(--muted);
}

.md-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.md-body th,
.md-body td {
    border: 1px solid var(--nav-border);
    padding: 0.5rem 0.8rem;
}

.md-body th {
    background: var(--icon-bg);
}

/* ---------- 页脚 ---------- */
.footer {
    background: var(--footer-bg);
    color: #94a3b8;
    padding: 3rem 0 1.5rem;
    margin-top: 1rem;
}

.footer a {
    color: #cbd5e1;
}

.footer a:hover {
    color: #fff;
}

.footer h3 {
    color: #fff;
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

.footer-grid {
    --pico-grid-columns: 2;
    gap: 2.5rem;
}

.footer-logo {
    max-height: 44px;
    width: auto;
    margin-bottom: 0.8rem;
}

.footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer ul li {
    margin-bottom: 0.4rem;
}

.footer p {
    margin-bottom: 0.4rem;
    font-size: 0.92rem;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    margin-top: 2.4rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
}

.tech-stack-title {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    margin-right: 0.4rem;
}

.tech-stack-title i {
    color: var(--mint);
}

.tech-stack a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
}

.tech-stack a:hover {
    color: var(--mint) !important;
}

/* Font Awesome 技术图标：品牌色 */
.tech-stack .tech-fa {
    font-size: 1.25rem;
    color: var(--tech-color);
    width: 22px;
    text-align: center;
    flex: 0 0 auto;
}

/* Logo：用 CSS mask 抠出图标形状，以品牌色填充（仅无 FA 图标时回退使用） */
.tech-stack .tech-logo {
    display: inline-block;
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    background-color: var(--tech-color);
    -webkit-mask-image: var(--tech-icon);
    mask-image: var(--tech-icon);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.copyright {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: #64748b;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
    section {
        padding: 2.2rem 0;
        margin-bottom: 0;
    }

    .hero {
        padding: 3.2rem 0.8rem 2.8rem;
    }

    .page-head {
        padding: 2.2rem 0.8rem;
    }

    /* 内容页容器在手机上保留左右安全边距 */
    .changelog .container,
    .faq .container,
    .md-body .container {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .service-form {
        grid-template-columns: 1fr;
    }

    /* 手机端特性卡片降为单列，避免 3 列过窄 */
    .feat-grid {
        grid-template-columns: 1fr !important;
        row-gap: 0.8rem;
    }

    .feat {
        padding: 1.2rem 1rem;
    }

    /* 按钮组在手机上单列全宽 */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group a[role="button"] {
        width: 100%;
        margin: 0;
    }

    .site-header nav {
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.5rem 0.8rem;
    }

    .site-header nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
}
