
/* =========================================================
   HowTo 教程内容模块
   文件：howto.css

   设计目标：
   1. 参考网站现有蓝色品牌风格，但保持独立设计。
   2. 通过深色文字、浅色背景和白色卡片建立清晰层次。
   3. 适配桌面、平板、手机和小屏设备。
   4. 兼容 WordPress Shortcode 常见 HTML 输出。
   5. 所有样式限定在 .section-howto 内，避免污染全站。
   6. 兼顾键盘访问、屏幕阅读器和减少动态效果。

   注意：
   本文件不负责定义 Shortcode 的 HTML 结构。
   如果 Shortcode 使用了特殊 class，需要根据实际输出补充适配。
========================================================= */


/* =========================================================
   01. 模块基础变量
   使用独立变量，不依赖 design-system.css。
========================================================= */

.section-howto {
    --howto-primary: #287fce;
    --howto-primary-hover: #1769b3;
    --howto-primary-light: #edf6ff;

    --howto-text: #172b43;
    --howto-text-secondary: #475569;
    --howto-text-muted: #64748b;

    --howto-bg: #f4f8fc;
    --howto-card: #ffffff;
    --howto-card-soft: #f8fbff;

    --howto-border: #dce6f0;
    --howto-border-strong: #c6d6e6;

    --howto-success: #16794b;
    --howto-success-bg: #eaf7f0;

    --howto-warning: #9a5b08;
    --howto-warning-bg: #fff7e8;

    --howto-danger: #b42318;
    --howto-danger-bg: #fff1f0;

    --howto-radius-sm: 8px;
    --howto-radius-md: 12px;
    --howto-radius-lg: 18px;

    --howto-shadow:
        0 3px 12px rgba(23, 43, 67, 0.045);

    --howto-shadow-hover:
        0 10px 28px rgba(23, 43, 67, 0.09);

    --howto-transition:
        0.22s ease;

    position: relative;
    isolation: isolate;

    width: 100%;
    max-width: 1280px;

    margin-left: auto;
    margin-right: auto;

    padding: 36px 24px 48px !important;
	margin-top: 40px !important;

    color: var(--howto-text);
    background: var(--howto-bg);

    border: 1px solid #e6eef6;
    border-radius: var(--howto-radius-lg);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        "PingFang SC",
        "Microsoft YaHei",
        sans-serif;

    font-size: 16px;
    line-height: 1.8;

    overflow-wrap: break-word;
    word-wrap: break-word;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}


/* =========================================================
   02. 统一盒模型
   限定在教程模块内部，不影响全站。
========================================================= */

.section-howto,
.section-howto *,
.section-howto *::before,
.section-howto *::after {
    box-sizing: border-box;
}


/* =========================================================
   03. Shortcode 内容基础排版
========================================================= */

.section-howto > * {
    max-width: 100%;
}

.section-howto p {
    margin: 0 0 18px;

    color: var(--howto-text-secondary);

    font-size: 16px;
    line-height: 1.85;
}

.section-howto p:last-child {
    margin-bottom: 0;
}

.section-howto strong,
.section-howto b {
    color: var(--howto-text);
    font-weight: 700;
}

.section-howto em {
    color: var(--howto-text-secondary);
}

.section-howto small {
    color: var(--howto-text-muted);
    font-size: 13px;
    line-height: 1.7;
}

.section-howto hr {
    height: 1px;

    margin: 28px 0;

    border: 0;
    background: var(--howto-border);
}


/* =========================================================
   04. 标题系统
   建立清楚的 H2 / H3 / H4 层级。
========================================================= */

.section-howto h1,
.section-howto h2,
.section-howto h3,
.section-howto h4,
.section-howto h5,
.section-howto h6 {
    color: var(--howto-text);

    font-weight: 750;
    line-height: 1.4;

    letter-spacing: -0.025em;

    overflow-wrap: anywhere;
}

.section-howto h1 {
    margin: 0 0 26px;

    font-size: clamp(28px, 4vw, 38px);
    font-weight: 800;
}

.section-howto h2 {
    position: relative;

    margin: 42px 0 20px;
    padding: 0 0 14px 16px;

    font-size: clamp(22px, 2.5vw, 28px);

    border-bottom: 1px solid var(--howto-border);
}

.section-howto h2::before {
    content: "";

    position: absolute;

    top: 5px;
    bottom: 19px;
    left: 0;

    width: 4px;

    border-radius: 4px;

    background: var(--howto-primary);
}

.section-howto h2:first-child {
    margin-top: 0;
}

.section-howto h3 {
    margin: 30px 0 14px;

    font-size: clamp(18px, 2vw, 21px);
}

.section-howto h4 {
    margin: 24px 0 12px;

    font-size: 17px;
}

.section-howto h5,
.section-howto h6 {
    margin: 18px 0 10px;

    font-size: 15px;
}


/* =========================================================
   05. 链接样式
   使用明显但不过度突出的蓝色。
========================================================= */

.section-howto a {
    color: var(--howto-primary);

    font-weight: 600;

    text-decoration: none;

    text-decoration-thickness: 1px;
    text-underline-offset: 3px;

    transition:
        color var(--howto-transition),
        text-decoration-color var(--howto-transition);
}

.section-howto a:hover {
    color: var(--howto-primary-hover);

    text-decoration: underline;
}

.section-howto a:focus-visible {
    outline: 3px solid rgba(40, 127, 206, 0.35);
    outline-offset: 3px;

    border-radius: 3px;
}


/* =========================================================
   06. 无序列表与有序列表
   优化教程步骤和注意事项的阅读体验。
========================================================= */

.section-howto ul,
.section-howto ol {
    margin: 0 0 22px;
    padding-left: 26px;

    color: var(--howto-text-secondary);
}

.section-howto ul {
    list-style-type: disc;
}

.section-howto ol {
    list-style-type: decimal;
}

.section-howto li {
    margin-bottom: 10px;

    padding-left: 4px;

    font-size: 15px;
    line-height: 1.8;
}

.section-howto li::marker {
    color: var(--howto-primary);
    font-weight: 700;
}

.section-howto li > ul,
.section-howto li > ol {
    margin-top: 10px;
    margin-bottom: 10px;
}

.section-howto li:last-child {
    margin-bottom: 0;
}


/* =========================================================
   07. 通用内容卡片
   适配 Shortcode 中常见的 div / article / section。

   注意：
   不对所有 div 强制设置卡片样式，
   避免破坏 Shortcode 自身的布局结构。
========================================================= */

.section-howto .howto-card,
.section-howto .howto-box,
.section-howto .howto-item,
.section-howto article.howto-item {
    margin: 0 0 20px;
    padding: 24px;

    background: var(--howto-card);

    border: 1px solid var(--howto-border);
    border-radius: var(--howto-radius-md);

    box-shadow: var(--howto-shadow);

    transition:
        border-color var(--howto-transition),
        box-shadow var(--howto-transition),
        transform var(--howto-transition);
}

.section-howto .howto-card:hover,
.section-howto .howto-box:hover,
.section-howto .howto-item:hover {
    border-color: var(--howto-border-strong);

    box-shadow: var(--howto-shadow-hover);
}

.section-howto .howto-card > :first-child,
.section-howto .howto-box > :first-child,
.section-howto .howto-item > :first-child {
    margin-top: 0;
}

.section-howto .howto-card > :last-child,
.section-howto .howto-box > :last-child,
.section-howto .howto-item > :last-child {
    margin-bottom: 0;
}


/* =========================================================
   08. 教程步骤
   适用于具有以下 class 的 Shortcode 输出：

   .howto-steps
   .howto-step
   .howto-step-number
   .howto-step-content
========================================================= */

.section-howto .howto-steps {
    display: grid;
    grid-template-columns: 1fr;

    gap: 18px;

    margin: 24px 0;
}

.section-howto .howto-step {
    position: relative;

    display: flex;
    align-items: flex-start;

    gap: 18px;

    padding: 22px;

    background: var(--howto-card);

    border: 1px solid var(--howto-border);
    border-radius: var(--howto-radius-md);

    box-shadow: var(--howto-shadow);
}

.section-howto .howto-step-number {
    flex: 0 0 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    color: #ffffff;
    background: var(--howto-primary);

    border-radius: 50%;

    font-size: 15px;
    font-weight: 800;
    line-height: 1;
}

.section-howto .howto-step-content {
    flex: 1;
    min-width: 0;
}

.section-howto .howto-step h3,
.section-howto .howto-step h4 {
    margin-top: 0;
}

.section-howto .howto-step p:last-child {
    margin-bottom: 0;
}


/* =========================================================
   09. 提示信息
   信息、成功、警告、风险提示。

   推荐 Shortcode 使用：
   .howto-notice
   .howto-notice-info
   .howto-notice-success
   .howto-notice-warning
   .howto-notice-danger
========================================================= */

.section-howto .howto-notice {
    margin: 22px 0;
    padding: 18px 20px;

    border: 1px solid var(--howto-border);
    border-left: 4px solid var(--howto-primary);

    border-radius: var(--howto-radius-sm);

    background: var(--howto-primary-light);
}

.section-howto .howto-notice p:last-child {
    margin-bottom: 0;
}

.section-howto .howto-notice-info {
    background: var(--howto-primary-light);
    border-left-color: var(--howto-primary);
}

.section-howto .howto-notice-success {
    color: var(--howto-success);
    background: var(--howto-success-bg);
    border-color: #c8e8d6;
    border-left-color: var(--howto-success);
}

.section-howto .howto-notice-warning {
    color: var(--howto-warning);
    background: var(--howto-warning-bg);
    border-color: #f2dfb7;
    border-left-color: #d99022;
}

.section-howto .howto-notice-danger {
    color: var(--howto-danger);
    background: var(--howto-danger-bg);
    border-color: #f2d0cc;
    border-left-color: var(--howto-danger);
}


/* =========================================================
   10. 图片与媒体
   防止图片超出容器。
========================================================= */

.section-howto img {
    display: block;

    max-width: 100%;
    height: auto;

    margin: 22px auto;

    border-radius: var(--howto-radius-md);
}

.section-howto figure {
    margin: 26px 0;
}

.section-howto figure img {
    margin: 0 auto;
}

.section-howto figcaption {
    margin-top: 10px;

    color: var(--howto-text-muted);

    font-size: 13px;
    line-height: 1.65;

    text-align: center;
}

.section-howto iframe,
.section-howto video {
    display: block;

    max-width: 100%;

    border: 0;
    border-radius: var(--howto-radius-md);
}

.section-howto iframe {
    width: 100%;
}


/* =========================================================
   11. 表格
   使用独立滚动容器，避免手机页面整体横向溢出。

   推荐 HTML：
   <div class="howto-table-wrap">
       <table>...</table>
   </div>

   即使 Shortcode 没有外层容器，
   表格自身仍然尽量保持自适应。
========================================================= */

.section-howto .howto-table-wrap {
    width: 100%;

    margin: 24px 0;

    overflow-x: auto;
    overscroll-behavior-x: contain;

    border: 1px solid var(--howto-border);
    border-radius: var(--howto-radius-md);

    background: #ffffff;

    -webkit-overflow-scrolling: touch;
}

.section-howto table {
    width: 100%;

    border-collapse: collapse;
    border-spacing: 0;

    background: #ffffff;

    font-size: 14px;
    line-height: 1.7;
}

.section-howto th,
.section-howto td {
    padding: 14px 16px;

    border-bottom: 1px solid var(--howto-border);

    text-align: left;
    vertical-align: top;
}

.section-howto th {
    color: #173b60;

    background: #edf5fc;

    font-weight: 750;
    white-space: nowrap;
}

.section-howto td {
    color: var(--howto-text-secondary);
}

.section-howto tr:last-child td {
    border-bottom: 0;
}

.section-howto tbody tr:nth-child(even) {
    background: #f8fbfe;
}

.section-howto tbody tr:hover {
    background: #f0f7fd;
}


/* =========================================================
   12. 按钮
   仅对明确使用 howto-button class 的元素生效，
   避免影响其他 Shortcode 中的按钮。
========================================================= */

.section-howto .howto-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 44px;

    padding: 11px 22px;

    color: #ffffff;
    background: var(--howto-primary);

    border: 1px solid var(--howto-primary);
    border-radius: 9px;

    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;

    text-align: center;
    text-decoration: none;

    cursor: pointer;

    transition:
        background var(--howto-transition),
        border-color var(--howto-transition),
        box-shadow var(--howto-transition),
        transform var(--howto-transition);
}

.section-howto .howto-button:hover {
    color: #ffffff;
    background: var(--howto-primary-hover);

    border-color: var(--howto-primary-hover);

    text-decoration: none;

    box-shadow: 0 5px 14px rgba(40, 127, 206, 0.2);

    transform: translateY(-1px);
}

.section-howto .howto-button:focus-visible {
    outline: 3px solid rgba(40, 127, 206, 0.35);
    outline-offset: 3px;
}

.section-howto .howto-button-secondary {
    color: var(--howto-primary);
    background: #ffffff;

    border-color: var(--howto-border-strong);
}

.section-howto .howto-button-secondary:hover {
    color: var(--howto-primary-hover);
    background: var(--howto-primary-light);

    border-color: var(--howto-primary);
}


/* =========================================================
   13. FAQ 折叠内容
   兼容原生 details / summary。
========================================================= */

.section-howto details {
    margin: 12px 0;

    padding: 16px 18px;

    background: #ffffff;

    border: 1px solid var(--howto-border);
    border-radius: var(--howto-radius-md);

    transition:
        border-color var(--howto-transition),
        box-shadow var(--howto-transition);
}

.section-howto details[open] {
    border-color: var(--howto-primary);

    box-shadow: var(--howto-shadow);
}

.section-howto summary {
    position: relative;

    color: var(--howto-text);

    font-size: 15px;
    font-weight: 700;
    line-height: 1.7;

    cursor: pointer;

    list-style-position: outside;
}

.section-howto summary::marker {
    color: var(--howto-primary);
}

.section-howto summary:focus-visible {
    outline: 3px solid rgba(40, 127, 206, 0.3);
    outline-offset: 4px;
    border-radius: 3px;
}

.section-howto details > *:not(summary) {
    margin-top: 16px;
}


/* =========================================================
   14. 引用块
========================================================= */

.section-howto blockquote {
    margin: 22px 0;

    padding: 18px 22px;

    color: var(--howto-text-secondary);

    background: #f0f6fc;

    border-left: 4px solid var(--howto-primary);
    border-radius: 0 var(--howto-radius-sm) var(--howto-radius-sm) 0;
}

.section-howto blockquote p:last-child {
    margin-bottom: 0;
}


/* =========================================================
   15. 代码块
   适配教程中需要展示代码或命令的情况。
========================================================= */

.section-howto pre {
    max-width: 100%;

    margin: 22px 0;
    padding: 18px;

    overflow-x: auto;

    color: #e2e8f0;
    background: #172b43;

    border-radius: var(--howto-radius-md);

    font-size: 13px;
    line-height: 1.75;

    white-space: pre;
    tab-size: 4;

    -webkit-overflow-scrolling: touch;
}

.section-howto code {
    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        monospace;

    font-size: 0.9em;
}

.section-howto :not(pre) > code {
    padding: 3px 6px;

    color: #175c99;
    background: #eaf3fc;

    border-radius: 5px;
}


/* =========================================================
   16. 分组网格
   适用于 Shortcode 自定义的双列或多列卡片。

   推荐：
   .howto-grid
   .howto-grid-item
========================================================= */

.section-howto .howto-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px;

    margin: 24px 0;
}

.section-howto .howto-grid-item {
    min-width: 0;

    padding: 22px;

    background: #ffffff;

    border: 1px solid var(--howto-border);
    border-radius: var(--howto-radius-md);

    box-shadow: var(--howto-shadow);
}

.section-howto .howto-grid-item > :first-child {
    margin-top: 0;
}

.section-howto .howto-grid-item > :last-child {
    margin-bottom: 0;
}


/* =========================================================
   17. 标签与状态标识
   推荐使用：
   .howto-badge
   .howto-badge-blue
   .howto-badge-green
   .howto-badge-orange
========================================================= */

.section-howto .howto-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 25px;

    padding: 3px 10px;

    color: #475569;
    background: #eef2f7;

    border-radius: 999px;

    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}

.section-howto .howto-badge-blue {
    color: #175c99;
    background: #e8f3ff;
}

.section-howto .howto-badge-green {
    color: #176b43;
    background: #e7f6ed;
}

.section-howto .howto-badge-orange {
    color: #925600;
    background: #fff2d9;
}


/* =========================================================
   18. WordPress 常见图片对齐类
========================================================= */

.section-howto .alignleft {
    float: left;

    max-width: 45%;

    margin: 8px 22px 18px 0;
}

.section-howto .alignright {
    float: right;

    max-width: 45%;

    margin: 8px 0 18px 22px;
}

.section-howto .aligncenter {
    display: block;

    margin-left: auto;
    margin-right: auto;
}

.section-howto::after {
    content: "";

    display: table;
    clear: both;
}


/* =========================================================
   19. 平板布局
   769px - 1024px

   降低模块内边距，保持阅读空间。
========================================================= */

@media (min-width: 769px) and (max-width: 1024px) {

    .section-howto {
        padding: 30px 22px 40px;
    }

    .section-howto h2 {
        margin-top: 36px;
    }

    .section-howto .howto-card,
    .section-howto .howto-box,
    .section-howto .howto-item {
        padding: 20px;
    }

}


/* =========================================================
   20. 手机布局
   481px - 768px
========================================================= */

@media (max-width: 768px) {

    .section-howto {
        width: 100%;

        padding: 26px 18px 34px;

        border-radius: 14px;

        font-size: 15px;
        line-height: 1.8;
    }

    .section-howto p {
        font-size: 15px;
        line-height: 1.85;
    }

    .section-howto h1 {
        font-size: 27px;
    }

    .section-howto h2 {
        margin-top: 34px;
        margin-bottom: 17px;

        font-size: 22px;
    }

    .section-howto h3 {
        margin-top: 25px;

        font-size: 19px;
    }

    .section-howto .howto-card,
    .section-howto .howto-box,
    .section-howto .howto-item {
        padding: 19px;
    }

    .section-howto .howto-step {
        gap: 14px;

        padding: 18px;
    }

    .section-howto .howto-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .section-howto .howto-grid-item {
        padding: 18px;
    }

    .section-howto .alignleft,
    .section-howto .alignright {
        float: none;

        display: block;

        max-width: 100%;

        margin: 18px auto;
    }

    .section-howto .howto-button {
        min-height: 46px;
    }

}


/* =========================================================
   21. 小屏手机
   480px 及以下
========================================================= */

@media (max-width: 480px) {

    .section-howto {
        padding: 22px 14px 28px;

        border-radius: 12px;

        font-size: 15px;
    }

    .section-howto h1 {
        font-size: 24px;
        line-height: 1.4;
    }

    .section-howto h2 {
        padding-left: 13px;

        font-size: 20px;
    }

    .section-howto h2::before {
        width: 3px;
    }

    .section-howto h3 {
        font-size: 18px;
    }

    .section-howto h4 {
        font-size: 16px;
    }

    .section-howto p {
        font-size: 15px;
    }

    .section-howto ul,
    .section-howto ol {
        padding-left: 22px;
    }

    .section-howto li {
        font-size: 14px;
    }

    .section-howto .howto-card,
    .section-howto .howto-box,
    .section-howto .howto-item {
        padding: 16px;
    }

    .section-howto .howto-step {
        display: block;

        padding: 17px;
    }

    .section-howto .howto-step-number {
        margin-bottom: 13px;
    }

    .section-howto .howto-notice {
        padding: 15px;
    }

    .section-howto th,
    .section-howto td {
        padding: 11px 12px;

        font-size: 13px;
    }

    .section-howto details {
        padding: 14px;
    }

    .section-howto summary {
        font-size: 14px;
    }

    .section-howto .howto-button {
        width: 100%;
    }

}


/* =========================================================
   22. 超小屏幕与极窄视口
   避免代码、表格和长链接撑破页面。
========================================================= */

@media (max-width: 360px) {

    .section-howto {
        padding-left: 11px;
        padding-right: 11px;
    }

    .section-howto h1 {
        font-size: 22px;
    }

    .section-howto h2 {
        font-size: 19px;
    }

    .section-howto .howto-card,
    .section-howto .howto-box,
    .section-howto .howto-item {
        padding: 14px;
    }

    .section-howto pre {
        padding: 13px;

        font-size: 12px;
    }

}


/* =========================================================
   23. 键盘焦点与无障碍增强
   让键盘用户可以清楚识别当前操作位置。
========================================================= */

.section-howto :focus-visible {
    outline: 3px solid rgba(40, 127, 206, 0.4);
    outline-offset: 3px;
}

.section-howto button,
.section-howto a,
.section-howto summary {
    -webkit-tap-highlight-color: rgba(40, 127, 206, 0.12);
}


/* =========================================================
   24. 减少动态效果
   尊重操作系统的减少动态效果设置。
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .section-howto *,
    .section-howto *::before,
    .section-howto *::after {
        scroll-behavior: auto !important;

        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;
    }

}


/* =========================================================
   25. 高对比度模式
   适配 Windows 高对比度和强制颜色模式。
========================================================= */

@media (forced-colors: active) {

    .section-howto {
        border: 1px solid CanvasText;
    }

    .section-howto .howto-card,
    .section-howto .howto-box,
    .section-howto .howto-item,
    .section-howto details {
        border: 1px solid CanvasText;
    }

    .section-howto a,
    .section-howto .howto-button {
        border: 1px solid LinkText;
    }

    .section-howto .howto-step-number {
        border: 1px solid CanvasText;
    }

}
