:root {
    color-scheme: light;
    --c-body-bk: #f1f3f6;
    --c-page-bk: #fdfdfd;
    --c-body-fg: #191e2a;
    --c-muted-fg: #555c6c;
    --c-divider-ln: #dce1ea;
    --c-focus-ln: #2b53c6;
    --font-display: "New York", "Iowan Old Style", "Palatino Linotype", Georgia, "Songti SC", serif;
    --font-label: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "PingFang SC", monospace;
    --ease-out: cubic-bezier(.2, .7, .2, 1);
    background: var(--c-body-bk);
    color: var(--c-body-fg);
    font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
figure, p, h1, ul { margin: 0; }
ul { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--c-focus-ln); outline-offset: 4px; }

.Page {
    max-width: 1440px;
    margin: 18px auto;
    width: calc(100% - 36px);
    border-radius: 20px;
    background: var(--c-page-bk);
    box-shadow:
        0 8px 28px -16px #263e6524,
        0 28px 96px -22px #38599626;

    @supports (width: round(down, 1px, 1px)) {
        margin-inline-start: max(18px, round(down, calc((100% - 1440px) / 2), 1px));
    }
}

.Header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 73px;
    padding: 10px clamp(22px, 4.4vw, 66px);
    border-bottom: 1px solid var(--c-divider-ln);

    .brand {
        display: flex;
        align-items: center;
        gap: 10px;
        font-family: var(--font-display);
        font-size: 22px;
        letter-spacing: -.045em;
        white-space: nowrap;
    }

    .brand img { border-radius: 9px; }

    nav {
        display: flex;
        align-items: center;
        gap: clamp(16px, 2.4vw, 36px);
        color: var(--c-muted-fg);
        font: 13px/1.4 var(--font-label);
        white-space: nowrap;
    }

    nav a { padding-block: 10px; }
    nav a:hover { color: var(--c-body-fg); }
}

.Hero {
    position: relative;
    isolation: isolate;
    z-index: 1;
    display: grid;
    justify-items: center;
    text-align: center;
    padding: 56px 24px 50px;
    border-bottom: 1px solid var(--c-divider-ln);
    background:
        radial-gradient(ellipse at 50% 100%, #e4edfe, transparent 72%),
        linear-gradient(#fffdf9, #f7f9ff);

    /* 微弱的横纹把主标题和金属按钮衬在同一块底板上。 */
    &::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background: repeating-linear-gradient(0deg, #536ea009 0 1px, transparent 1px 4px);
        mask-image: radial-gradient(ellipse at center bottom, black, transparent 78%);
        pointer-events: none;
    }

    .hero-icon {
        margin: 0 auto 14px;
        border-radius: 17px;
        box-shadow: 0 5px 16px #33487430;
    }

    h1 {
        font: 600 clamp(2.5rem, 1.3rem + 5.7vw, 6.25rem)/110px var(--font-display);
        letter-spacing: -.075em;
        text-wrap: balance;
        text-shadow: 0 2px 0 #fff;
    }

    .intro {
        color: var(--c-muted-fg);
        font-size: clamp(15px, 1.4vw, 18px);
        line-height: 28px;
        margin-top: 10px;
    }
}

.Downloads {
    width: min(100%, 552px);
    margin-top: 32px;

    .download-list {
        display: flex;
        justify-content: center;
        gap: 8px;

        > li { flex: 1 1 0; min-width: 0; }
    }

    .download-card {
        display: flex;
        min-height: 52px;
        align-items: center;
        text-align: start;
        gap: 11px;
        padding: 9px 12px;
        border: 1px solid #c9d3e4;
        border-radius: 10px;
        color: #1c2740;
        font-size: 14px;
        font-weight: 650;
        background-color: #f9fbff;
        transition: background-color .2s, border-color .2s, box-shadow .2s;

        &:not(.mac-picker):hover { background-color: #edf3ff; border-color: #8ea6d4; }
        &:not(.mac-picker):active { background-color: #e0e9fb; }
    }

    .is-device-match .download-card {
        border-color: #214bb3;
        background-color: #2b55c3;
        color: #fff;
        box-shadow: inset 0 1px 0 #ffffff38, 0 4px 12px #2b55c344;

        --c-segment-hover: #ffffff1f;
        --c-segment-line: #ffffff4d;
        --c-segment-focus: #fff;

        &:not(.mac-picker):hover { background-color: #244bb2; }
        &:not(.mac-picker):active { background-color: #1c3f9a; }
        .platform-architecture { color: #e6edff; }
    }

    .mac-picker[hidden], .MacFallback[hidden] { display: none; }

    .mac-picker {
        align-items: stretch;
        gap: 0;
        padding: 0;
    }

    .mac-install {
        display: flex;
        flex: 1;
        align-items: center;
        gap: 9px;
        padding-inline: 12px;
        border-radius: 9px 0 0 9px;
        white-space: nowrap;

        &:hover[href] { background-color: var(--c-segment-hover, #d9e5fa); }
        &[aria-disabled="true"] { opacity: .68; }
    }

    .chip-picker {
        position: relative;
        display: flex;
        flex: none;

        &::before, &::after {
            position: absolute;
            pointer-events: none;
            content: "";
        }

        &::before {
            left: 0;
            inset-block: 10px;
            border-left: 1px solid var(--c-segment-line, #c9d3e4);
        }

        &::after {
            right: 13px;
            top: calc(50% - 5px);
            width: 6px;
            height: 6px;
            border: solid currentColor;
            border-width: 0 1.5px 1.5px 0;
            rotate: 45deg;
        }
    }

    /* 只调整关闭时的外观，展开和键盘交互由系统选择器处理。 */
    .chip-select {
        appearance: none;
        width: 108px;
        padding: 0 25px 0 10px;
        border: 0;
        border-radius: 0 9px 9px 0;
        color: inherit;
        background: transparent;
        font-family: inherit;
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;

        &:hover { background-color: var(--c-segment-hover, #d9e5fa); }
        option { color: var(--c-body-fg); background-color: #fff; }
    }

    .mac-install:focus-visible {
        outline-color: var(--c-segment-focus, var(--c-focus-ln));
        outline-offset: -4px;
    }

    /* 只在芯片名称下标记焦点，让分段按钮保持统一轮廓。 */
    .chip-select:focus-visible {
        --c-chip-indicator: var(--c-segment-focus, var(--c-focus-ln));
        outline-color: transparent;
        outline-offset: -4px;
        background-image: linear-gradient(var(--c-chip-indicator), var(--c-chip-indicator));
        background-repeat: no-repeat;
        background-position: 10px calc(50% + 11px);
        background-size: 24px 2px;

        @media (forced-colors: active) { outline-color: Highlight; }
    }

    .MacFallback {
        summary { cursor: pointer; }
        ul { padding: 5px 12px; text-align: start; }
        a { display: block; padding-block: 6px; text-decoration: underline; }
    }

    .platform-icon { flex: none; width: 19px; }
    .platform-architecture {
        margin-inline-start: auto;
        color: var(--c-muted-fg);
        font: 12px/1.15 var(--font-label);
    }

    .download-arrow { flex: none; width: 16px; }

    .release-row {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px 10px;
        margin-top: 14px;
    }

    .release {
        color: var(--c-muted-fg);
        font: 12px/18px var(--font-label);
    }

    .release span { margin-inline: 3px; opacity: .65; }

    .release-option {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .separator {
        color: var(--c-muted-fg);
        font: 12px/18px var(--font-label);
        opacity: .65;
    }
}

.Showcase {
    --stage-width: 1280px;
    --showcase-width: calc(var(--stage-width) + 2px);
    container-type: inline-size;
    width: min(var(--showcase-width), calc(100% - 40px));
    margin: 44px auto;

    /* 居中时也保持整数 CSS 像素，避免奇数宽度下错开半个像素。 */
    @supports (width: round(down, 1px, 1px)) {
        margin-inline-start: max(20px, round(down, calc((100% - var(--showcase-width)) / 2), 1px));
    }

    .preview-viewport {
        overflow-x: auto;
        border: 1px solid #d1ddef;
        border-radius: 12px;
        background: #ecf3ff;
    }

    .stage {
        position: relative;
        isolation: isolate;
        display: grid;
        place-items: start;
        inline-size: var(--stage-width);
        direction: ltr;
    }

    .art-box {
        position: absolute;
        z-index: -1;
        inset: 0;
        overflow: hidden;
    }

    .art-box::before {
        content: "";
        position: absolute;
        inset: 0;
        background: url("./hero-glass-light.webp") center / cover no-repeat;
    }

    img {
        grid-area: 1 / 1;
        max-width: none;
        height: auto;
    }

    .client-window {
        justify-self: end;
        margin-block-start: 68px;
    }

    figcaption {
        display: none;
        margin-top: 8px;
        text-align: end;
        color: var(--c-muted-fg);
        font-size: 12px;
        line-height: 18px;
    }
}

.Footer {
    padding: 19px clamp(22px, 4.4vw, 66px);
    border-top: 1px solid var(--c-divider-ln);
    color: var(--c-muted-fg);
    font: 12px/1.5 var(--font-label);

    small { font-size: inherit; }
}

.BackupDownloads {
    font-size: 12px;
    line-height: 18px;

    summary {
        width: fit-content;
        cursor: pointer;
        color: #254b9c;
        padding-block: 3px;
    }

    summary:hover, a:hover { color: #143675; }

    .backup-list {
        position: absolute;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        inset-inline: 0;
        top: calc(100% + 8px);
        gap: 6px;
        padding: 6px;
        border: 1px solid var(--c-divider-ln);
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 8px 25px #253b6526;
        text-align: start;
    }

    &:not([open]) .backup-list { display: none; }

    li {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 5px 10px;
        padding: 9px;
        border-radius: 5px;
        background: #f3f6fc;
    }

    a { color: #254b9c; text-decoration: underline; text-underline-offset: 3px; }
    code { color: var(--c-body-fg); }
}

/* 动画合成结束即停下，减少动态效果时直接显示完整页面。 */
@media (prefers-reduced-motion: no-preference) {
    .Hero .hero-content { animation: reveal .68s var(--ease-out) both; }
    .Showcase .art-box::before { animation: settle 1.75s var(--ease-out) both; }
    .Downloads .download-arrow { transition: transform .22s var(--ease-out); }
    .Downloads .download-card:hover .download-arrow { transform: translateY(2px); }

    /* 仅移动背景，截图保持像素位置。 */
    @supports (animation-timeline: view()) and (animation-range: entry 0% entry 85%) {
        .Showcase .art-box::before {
            animation-delay: 0s;
            animation-duration: auto;
            animation-timeline: view();
            animation-range: entry 0% entry 85%;
        }
    }
}

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

@keyframes settle {
    from { transform: scale(1.09) translateX(1%); }
    to { transform: none; }
}

@container (width < 1282px) {
    .Showcase figcaption { display: block; }
}

/* 窄屏优先露出前景的客户端，仍可横移到后方的编辑器。 */
@container (width < 850px) {
    .Showcase .preview-viewport { direction: rtl; }
}

@media (max-width: 1100px) {
    .Hero { padding-block: 48px 42px; }
    .Hero h1 { line-height: 90px; }
    .Showcase { margin-block: 28px; }
}

@media (max-width: 760px) {
    .Hero h1 { line-height: 72px; }
}

@media (max-width: 600px) {
    .Page { width: calc(100% - 20px); margin: 10px auto; border-radius: 14px; }
    .Header { padding-inline: 13px; min-height: 59px; }
    .Header .brand { font-size: 18px; gap: 6px; }
    .Header .brand img { width: 29px; height: 29px; }
    .Header nav { gap: 12px; font-size: 11px; }
    .Hero { padding: 30px 16px 25px; }
    .Hero .hero-icon { width: 56px; height: 56px; margin-bottom: 7px; border-radius: 13px; }
    .Hero h1 { line-height: 60px; }
    .Hero .intro { margin-top: 14px; line-height: 24px; }
    .Downloads { margin-top: 24px; width: min(100%, 340px); }
    .Downloads .download-list { flex-direction: column; }
    .Downloads .download-list > li { flex: auto; }
    .BackupDownloads .backup-list { grid-template-columns: 1fr; }
    .Downloads .download-card { min-height: 48px; }
    .Showcase { width: calc(100% - 24px); margin: 18px auto; }
    .Footer { padding-inline: 13px; }
}

