/* Xyngram OS 支援頁：沿用 styles.css 的深色 token、topbar 與 footer。 */
html {
    scroll-behavior: smooth;
}

.support {
    position: relative;
    z-index: 1;
    flex: 1;
    width: 100%;
    max-width: 76rem;
    margin: 0 auto;
    padding: 0 clamp(1.25rem, 4vw, 2.5rem) 3rem;
}

/* ── Hero ───────────────────────────────────────────────── */
.support-hero {
    padding: 2rem 0 1.25rem;
    text-align: center;
}

.support-logo {
    display: block;
    width: min(440px, 82vw);
    height: auto;
    margin: 0 auto 1.5rem;
    filter: drop-shadow(0 10px 40px rgba(74, 158, 255, 0.16));
}

.support h1 {
    max-width: 48rem;
    margin: 0 auto;
    font-size: clamp(2.05rem, 5vw, 3.15rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.support-lead {
    max-width: 42rem;
    margin: 0.9rem auto 0;
    color: var(--muted);
    font-size: clamp(0.98rem, 2vw, 1.08rem);
    line-height: 1.7;
}

.support-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    margin-top: 1.6rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.68rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--fg);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition:
        border-color 0.16s ease,
        background 0.16s ease,
        transform 0.16s ease;
}

.btn:hover {
    border-color: rgba(74, 158, 255, 0.55);
    background: rgba(74, 158, 255, 0.1);
    transform: translateY(-1px);
}

.btn--primary {
    border-color: transparent;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #06121f;
}

.btn--primary:hover {
    background: linear-gradient(180deg, #63adff 0%, #2f6be8 100%);
}

.btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.support-note {
    max-width: 44rem;
    margin: 0.95rem auto 0;
    color: var(--faint);
    font-size: 0.8rem;
    line-height: 1.6;
}

/* ── 版面：桌面側邊目錄 + 內容 ─────────────────────────────── */
.support-layout {
    display: grid;
    grid-template-columns: 13.5rem minmax(0, 1fr);
    align-items: start;
    gap: 1.75rem;
    margin-top: 2.25rem;
}

.support-toc {
    position: sticky;
    top: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.025);
}

.support-toc__title {
    margin: 0 0 0.55rem;
    color: var(--faint);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.support-toc ul {
    display: grid;
    gap: 0.12rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.support-toc a {
    display: block;
    padding: 0.32rem 0.55rem;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    color: var(--muted);
    font-size: 0.86rem;
    text-decoration: none;
    transition:
        color 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease;
}

.support-toc a:hover {
    border-left-color: var(--accent);
    background: rgba(74, 158, 255, 0.08);
    color: var(--fg);
}

.support-body {
    display: grid;
    gap: 1.25rem;
    min-width: 0;
}

/* ── 章節卡片 ───────────────────────────────────────────── */
.card {
    padding: clamp(1.15rem, 2.6vw, 1.8rem);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.045),
        rgba(255, 255, 255, 0.012)
    );
    scroll-margin-top: 1.25rem;
}

.card h2 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 0.7rem;
    font-size: clamp(1.25rem, 2.6vw, 1.5rem);
    line-height: 1.25;
}

.card h2::before {
    content: "";
    flex: none;
    width: 4px;
    height: 1.1em;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--accent), #7a5cff);
}

.card h3 {
    margin: 0 0 0.3rem;
    font-size: 0.96rem;
    font-weight: 600;
    line-height: 1.45;
}

.card p {
    margin: 0 0 0.9rem;
    line-height: 1.75;
}

.card p:last-child {
    margin-bottom: 0;
}

.card .lead {
    margin-bottom: 1.05rem;
    color: var(--muted);
}

/* ── 快速開始 ───────────────────────────────────────────── */
.steps {
    display: grid;
    gap: 1rem;
    margin-top: 1.1rem;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.step__num {
    display: grid;
    flex: none;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-top: 0.08rem;
    border: 1px solid rgba(74, 158, 255, 0.4);
    border-radius: 50%;
    background: rgba(74, 158, 255, 0.12);
    color: #cfe4ff;
    font-size: 0.82rem;
    font-weight: 700;
}

.step p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ── 畫面預覽 ───────────────────────────────────────────── */
.gallery {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1.1rem;
}

.gallery figure {
    grid-column: span 2;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
}

.gallery__link {
    display: block;
    color: inherit;
    cursor: zoom-in;
}

.gallery__link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* 5 張圖：第一列 3 張、第二列 2 張，維持滿版且不留下空格。 */
.gallery figure:nth-child(4),
.gallery figure:nth-child(5) {
    grid-column: span 3;
}

.gallery img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.gallery figure:hover img {
    transform: scale(1.02);
}

.gallery figcaption {
    padding: 0.65rem 0.8rem;
    border-top: 1px solid var(--border);
    color: var(--fg);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.55;
}

/* ── 圖片放大檢視 ───────────────────────────────────────── */
body.lightbox-open {
    overflow: hidden;
}

.lightbox {
    position: relative;
    max-width: 96vw;
    max-height: 92vh;
    margin: auto;
    padding: 0;
    overflow: visible;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #05070c;
    color: var(--fg);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.lightbox::backdrop {
    background: rgba(3, 6, 12, 0.82);
    backdrop-filter: blur(4px);
}

.lightbox__image {
    display: block;
    width: auto;
    height: auto;
    max-width: 96vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 11px;
}

.lightbox__close {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(5, 7, 12, 0.72);
    color: var(--fg);
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.lightbox__close:hover {
    border-color: rgba(74, 158, 255, 0.5);
    background: rgba(74, 158, 255, 0.18);
}

.lightbox__close svg {
    width: 18px;
    height: 18px;
}

.lightbox__close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── 檔案系統裝置 ────────────────────────────────────────── */
.dev-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.3rem;
}

.dev {
    padding: 0.95rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.16);
}

.dev h3 {
    margin-bottom: 0.4rem;
    color: #dce7f8;
    font-size: 0.88rem;
    line-height: 1.45;
}

.dev p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.65;
}

/* ── 提示框 ─────────────────────────────────────────────── */
.callout {
    margin: 1.1rem 0 0;
    padding: 0.8rem 0.95rem;
    border-left: 3px solid var(--accent);
    border-radius: 0 10px 10px 0;
    background: rgba(74, 158, 255, 0.08);
    color: #cfe0f7;
    font-size: 0.87rem;
    line-height: 1.65;
}

.callout--warn {
    border-left-color: #f0b64a;
    background: rgba(240, 182, 74, 0.08);
    color: #f6e3c2;
}

/* ── 清單 ───────────────────────────────────────────────── */
.clean {
    display: grid;
    gap: 0.5rem;
    margin: 0.2rem 0 0;
    padding: 0;
    list-style: none;
}

.clean li {
    position: relative;
    padding-left: 1.05rem;
    color: #cdd8e8;
    font-size: 0.9rem;
    line-height: 1.65;
}

.clean li::before {
    content: "";
    position: absolute;
    top: 0.62em;
    left: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

/* ── 工作環境 ───────────────────────────────────────────── */
.workspace-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 0.9rem;
}

.workspace {
    padding: 1rem;
    border: 1px solid var(--border);
    border-top-width: 3px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
}

.workspace--local {
    border-top-color: #58c98a;
}

.workspace--remote {
    border-top-color: #7a8cff;
}

.workspace h3 {
    margin-bottom: 0.55rem;
    font-size: 0.98rem;
}

.workspace .clean li {
    font-size: 0.86rem;
}

/* ── 疑難排解（details / summary） ───────────────────────── */
.trouble {
    margin-top: 0.8rem;
    border-top: 1px solid var(--border);
}

.trouble details {
    border-bottom: 1px solid var(--border);
}

.trouble summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

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

.trouble summary::after {
    content: "+";
    flex: none;
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 400;
    transition: transform 0.18s ease;
}

.trouble details[open] summary::after {
    content: "−";
}

.trouble summary:hover {
    color: var(--accent);
}

.trouble details p {
    margin: 0.1rem 1.5rem 0.9rem 0;
    color: var(--muted);
    font-size: 0.87rem;
    line-height: 1.7;
}

/* ── 聯絡 ───────────────────────────────────────────────── */
.contact-mail {
    margin: 1rem 0;
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.contact-mail a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(74, 158, 255, 0.45);
}

.contact-mail a:hover {
    border-bottom-color: var(--accent);
}

/* ── 頁尾與跳至內容 ─────────────────────────────────────── */
.footer a {
    color: var(--muted);
    text-decoration: none;
}

.footer a:hover {
    color: var(--fg);
    text-decoration: underline;
}

.footer__sep {
    margin: 0 0.45rem;
    color: var(--faint);
}

.skip {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 100;
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    background: var(--accent);
    color: #06121f;
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-200%);
    transition: transform 0.15s ease;
}

.skip:focus {
    transform: none;
}

.btn:focus-visible,
.support-toc a:focus-visible,
.footer a:focus-visible,
.trouble summary:focus-visible,
.contact-mail a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── 響應式 ─────────────────────────────────────────────── */
@media (max-width: 1000px) {
    .support-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .support-toc {
        position: static;
    }

    .support-toc ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .support-toc a {
        padding: 0.3rem 0.7rem;
        border: 1px solid var(--border);
        border-radius: 999px;
        font-size: 0.8rem;
    }

    .support-toc a:hover {
        border-color: rgba(74, 158, 255, 0.55);
    }
}

@media (max-width: 900px) {
    .gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery figure,
    .gallery figure:nth-child(4),
    .gallery figure:nth-child(5) {
        grid-column: auto;
    }

    .gallery figure:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .dev-grid,
    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .support-hero {
        padding-top: 1.25rem;
    }

    .support-cta {
        flex-direction: column;
        align-items: stretch;
    }

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

    .gallery figure:last-child {
        grid-column: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .btn,
    .support-toc a,
    .gallery img,
    .lightbox__close,
    .trouble summary::after {
        transition: none;
    }

    .btn:hover,
    .gallery figure:hover img {
        transform: none;
    }
}
