/* 为什么电脑只认识 0 和 1？ */

.binary-story {
    color: var(--article-text-color);
    font-size: 14px;
    line-height: 1.6;
}

.binary-story * { box-sizing: border-box; }
.binary-story img { display: block; max-width: 100%; }
.binary-story p { margin: 0 0 12px; }
.binary-story strong { color: var(--article-heading-color); }

.binary-section {
    margin-top: 22px;
    scroll-margin-top: 110px;
}

.binary-story .binary-section > h2 {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 8px;
    color: var(--article-heading-color);
    font-size: 20px;
    line-height: 1.35;
    font-weight: 900;
}

.binary-number {
    display: inline-flex;
    flex: 0 0 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #0752ff;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}

.binary-key,
.binary-note,
.binary-warning {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
}

.binary-key { background: #eaf5ff; }
.binary-note { background: #fff8e5; }
.binary-warning {
    border: 1px solid #ffd0dc;
    background: #fff2f6;
}

.binary-key img,
.binary-warning img {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    object-fit: contain;
}

.binary-note__icon {
    display: inline-flex;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.binary-story .binary-key h3,
.binary-story .binary-note h3,
.binary-story .binary-warning h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.binary-story .binary-key h3 { color: #0752ff; }
.binary-story .binary-note h3 { color: #9a6800; }
.binary-story .binary-warning h3 { color: #d83265; }

.binary-key p,
.binary-note p,
.binary-warning p { margin: 0; }

/* 两种状态 */

.binary-first {
    display: grid;
    grid-template-columns: 1.4fr 45px 1fr;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
}

.binary-first__physical {
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 14px;
    border-radius: 15px;
    background: #eef5ff;
    text-align: center;
}

.binary-first__physical > span {
    color: #0752ff;
    font-size: 60px;
}

.binary-story .binary-first__physical h3 {
    margin: 8px 0 4px;
    color: var(--article-heading-color);
    font-size: 15px;
}

.binary-first__physical p {
    margin: 0;
    color: #617296;
    font-size: 11px;
}

.binary-first__symbols {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 8px;
}

.binary-first__symbols > div {
    display: flex;
    min-height: 145px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-radius: 15px;
    background: #f3efff;
}

.binary-first__symbols strong {
    color: #7654d6;
    font-size: 48px;
}

.binary-first__symbols span {
    margin-top: 4px;
    color: #617296;
    font-size: 10px;
}

.binary-first__arrow,
.binary-transistor__arrow {
    color: #4f82ff;
    font-size: 26px;
    font-weight: 900;
    text-align: center;
}

/* 稳定状态 */

.binary-stable {
    display: grid;
    grid-template-columns: 1fr .8fr 1fr;
    gap: 10px;
    align-items: stretch;
    margin-top: 14px;
}

.binary-stable > div {
    display: flex;
    min-height: 120px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 13px;
    border-radius: 14px;
    text-align: center;
}

.binary-stable__low { background: #eef5ff; }
.binary-stable__gap {
    border: 1px dashed #d0d7e4;
    background: #f9fafc;
}
.binary-stable__high { background: #eef9f0; }

.binary-stable span {
    color: #617296;
    font-size: 11px;
}

.binary-stable strong {
    margin-top: 5px;
    font-size: 16px;
}

/* 电压范围 */

.binary-voltage {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 10px;
    margin-top: 14px;
}

.binary-voltage > div {
    min-width: 0;
    min-height: 175px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 14px;
    border-radius: 15px;
    text-align: center;
}

.binary-voltage__low { background: #eef5ff; }
.binary-voltage__unknown { background: #fff6df; }
.binary-voltage__high { background: #eef9f0; }

.binary-voltage__level {
    display: block;
    width: 90px;
    height: 18px;
    border-radius: 999px;
}

.binary-voltage__low .binary-voltage__level { background: #5f8fe8; }
.binary-voltage__high .binary-voltage__level { background: #2aa05a; }

.binary-voltage__unknown > span {
    color: #d58d00;
    font-size: 50px;
}

.binary-story .binary-voltage h3 {
    margin: 9px 0 4px;
    color: var(--article-heading-color);
    font-size: 14px;
}

.binary-voltage p {
    margin: 0;
    color: #617296;
    font-size: 10px;
}

/* 晶体管 */

.binary-transistor {
    display: grid;
    grid-template-columns: 1fr 32px 1fr 40px 1.2fr;
    gap: 8px;
    align-items: center;
    margin-top: 14px;
}

.binary-transistor > div:not(.binary-transistor__plus):not(.binary-transistor__arrow) {
    display: flex;
    min-height: 170px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 13px;
    border-radius: 15px;
    text-align: center;
}

.binary-transistor__off { background: #eef5ff; }
.binary-transistor__on { background: #eef9f0; }
.binary-transistor__logic { background: #f3efff; }

.binary-transistor__off > span,
.binary-transistor__on > span,
.binary-transistor__logic > span {
    font-size: 56px;
}

.binary-transistor__off > span { color: #5f8fe8; }
.binary-transistor__on > span { color: #2aa05a; }
.binary-transistor__logic > span { color: #7654d6; }

.binary-transistor__plus {
    color: #7485a3;
    font-size: 26px;
    font-weight: 900;
    text-align: center;
}

.binary-story .binary-transistor h3 {
    margin: 7px 0 4px;
    color: var(--article-heading-color);
    font-size: 14px;
}

.binary-transistor p {
    margin: 0;
    color: #617296;
    font-size: 10px;
}

/* 逻辑门 */

.binary-gates {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 10px;
    margin-top: 14px;
}

.binary-gates article {
    padding: 15px 12px;
    border: 1px solid #e1ebff;
    border-radius: 14px;
    background: #f9fbff;
    text-align: center;
}

.binary-gates__name {
    display: inline-flex;
    min-width: 70px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #0752ff;
    color: #fff;
    font-weight: 900;
}

.binary-gates p {
    margin: 8px 0;
    color: #617296;
    font-size: 11px;
}

.binary-gates__example code {
    display: inline-block;
    padding: 6px 8px;
    border-radius: 8px;
    background: #eef5ff;
    color: #1d3d75;
    font-size: 11px;
}

.binary-build,
.binary-encode-flow {
    display: flex;
    gap: 7px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 13px 14px;
    border-radius: 14px;
    background: #f3efff;
}

.binary-build span,
.binary-encode-flow span {
    padding: 7px 9px;
    border-radius: 9px;
    background: #fff;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
}

.binary-build b,
.binary-encode-flow b {
    color: #7654d6;
}

.binary-key--logic { background: #eaf5ff; }

/* 编码 */

.binary-encode {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 10px;
    margin-top: 14px;
}

.binary-encode article,
.binary-why article {
    min-width: 0;
    padding: 14px 9px;
    border: 1px solid #e1ebff;
    border-radius: 14px;
    background: #f9fbff;
    text-align: center;
}

.binary-encode article > span,
.binary-why article > span {
    display: inline-flex;
    width: 64px;
    height: 64px;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    border-radius: 19px;
    background: #eaf3ff;
    color: #0752ff;
    font-size: 27px;
}

.binary-story .binary-encode h3,
.binary-story .binary-why h3 {
    margin: 0 0 4px;
    color: var(--article-heading-color);
    font-size: 13px;
}

.binary-encode p,
.binary-why p {
    margin: 0;
    color: #617296;
    font-size: 10px;
}

.binary-encode small {
    display: block;
    margin-top: 3px;
    color: #8592a9;
    font-size: 9px;
}

.binary-note--encode { background: #eef9f0; }

/* 为什么二进制 */

.binary-why {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 10px;
    margin-top: 14px;
}

/* 总结 */

.binary-summary {
    display: flex;
    gap: 12px;
    margin-top: 22px;
    padding: 18px;
    border-radius: 16px;
    background: #e9f3ff;
    scroll-margin-top: 110px;
}

.binary-summary__icon {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    object-fit: contain;
}

.binary-story .binary-summary h2 {
    margin: 0 0 7px;
    color: #0752ff;
    font-size: 19px;
}

.binary-summary ul {
    margin: 0;
    padding-left: 20px;
    line-height: 1.75;
}

.binary-summary__next {
    margin: 10px 0 0 !important;
    padding-top: 10px;
    border-top: 1px dashed #b8d3f6;
}

.binary-summary__next em {
    color: #0752ff;
    font-style: normal;
    font-weight: 800;
}

/* 翻页 */

.binary-pagination {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-top: 14px;
}

.binary-pagination a {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 49%;
    padding: 10px 13px;
    border: 1px solid #d9e7ff;
    border-radius: 12px;
    background: #ffffffb3;
    text-decoration: none;
    box-shadow: 0 3px 10px #c5dbff30;
}

.binary-pagination a:last-child { text-align: right; }

.binary-pagination strong {
    display: block;
    color: #0752ff;
    font-size: 16px;
}

.binary-pagination small {
    display: block;
    color: #576b9f;
    font-size: 12px;
}

.binary-pagination__arrow {
    display: inline-flex;
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    align-items: center;
    justify-content: center;
    border: 1px solid #d9e7ff;
    border-radius: 7px;
    color: #0752ff;
    font-size: 22px;
}

.binary-pagination a:hover { background: #edf4ff; }

.binary-pagination a:focus-visible {
    outline: 3px solid #0752ff;
    outline-offset: 3px;
}

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

@media (max-width: 640px) {
    .binary-story {
        font-size: 12px;
        line-height: 1.6;
    }

    .binary-section { margin-top: 18px; }

    .binary-story .binary-section > h2 {
        gap: 9px;
        margin-bottom: 6px;
        font-size: 16px;
    }

    .binary-number {
        flex-basis: 31px;
        height: 31px;
        font-size: 14px;
    }

    .binary-first,
    .binary-stable,
    .binary-voltage,
    .binary-transistor {
        grid-template-columns: minmax(0,1fr);
        gap: 7px;
    }

    .binary-first__arrow,
    .binary-transistor__arrow {
        transform: rotate(90deg);
        line-height: 1;
    }

    .binary-transistor__plus {
        line-height: 1;
    }

    .binary-key,
    .binary-note,
    .binary-warning {
        gap: 9px;
        padding: 11px 12px;
    }

    .binary-key img,
    .binary-warning img,
    .binary-note__icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .binary-gates {
        grid-template-columns: minmax(0,1fr);
        gap: 8px;
    }

    .binary-encode,
    .binary-why {
        grid-template-columns: repeat(2,minmax(0,1fr));
        gap: 8px;
    }

    .binary-summary {
        gap: 8px;
        padding: 14px;
    }

    .binary-summary__icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .binary-story .binary-summary h2 { font-size: 17px; }

    .binary-pagination { gap: 9px; }

    .binary-pagination a {
        flex: 1;
        min-width: 0;
        gap: 5px;
        padding: 8px 6px;
    }

    .binary-pagination strong { font-size: 13px; }

    .binary-pagination small {
        font-size: 10px;
        line-height: 1.35;
    }

    .binary-pagination__arrow {
        width: 26px;
        height: 27px;
        flex-basis: 26px;
        font-size: 18px;
    }
}
