/* ============================================================
   css/home.css — 主页专属视觉层（Apple 极简）
   ------------------------------------------------------------
   改动意图：
   1. 只服务 index.html。全部规则挂在 body.home 下，与 style.css
      共存但不外溢，Palette / LUT / TP 等复用 style.css
      的子页面视觉不受影响。
   2. Hero 保持原样。本文件没有任何选择器命中
      #hero / .hero-bg-image / .hero-content / .hero-title，
      因此首屏视频与大标题完全沿用原有实现。
   3. 版式规则：统一区块头部（.sec-head）+ 大留白 + 黑白灰三色，
      移除卡片投影、emoji 图标、渐变等装饰，仅靠字阶、间距与
      细分隔线建立层次。
   ============================================================ */

/* ---------- 1. 全局节奏：区块留白与内容宽度 ---------- */

.home main .section {
    /* 原为固定 120px，改为随视口收缩的呼吸区，桌面端更有空气感 */
    padding: clamp(96px, 11vw, 160px) 0;
}

/* 交替底色：仅用 Apple 灰 (#f5f5f7) 做区块分区，不引入第三种颜色 */
.home main .section.is-alt {
    background: #f5f5f7;
}

.home main .container {
    max-width: 1080px;
    padding-left: clamp(20px, 5vw, 40px);
    padding-right: clamp(20px, 5vw, 40px);
}

/* 覆盖 style.css 中全局的链接悬停降透明度，避免文字发灰 */
.home a:hover {
    opacity: 1;
}

/* ---------- 2. 统一区块头部 ---------- */

.home .sec-head {
    max-width: 760px;
    margin: 0 auto clamp(44px, 5vw, 64px);
    text-align: center;
}

.home .sec-eyebrow {
    margin: 0 0 18px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    color: #86868b;
}

.home .sec-title {
    margin: 0;
    font-size: clamp(2rem, 4.2vw, 3.25rem);
    font-weight: 600;
    line-height: 1.07;
    letter-spacing: -0.028em;
    color: #1d1d1f;
}

.home .sec-lead {
    margin: 20px auto 0;
    max-width: 34em;
    font-size: clamp(1rem, 1.3vw, 1.1875rem);
    line-height: 1.55;
    color: #6e6e73;
}

/* ---------- 3. 实用工具：两列清单，用细线代替卡片 ---------- */

.home .tool-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* 列间距交给单元格内边距处理，让横向细线在两列之间保持连续 */
    column-gap: 0;
    border-top: 1px solid #d2d2d7;
}

.home .tool-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 24px;
    padding: 28px 0;
    border-bottom: 1px solid #d2d2d7;
    color: inherit;
    text-decoration: none;
}

.home .tool-row:nth-child(odd) {
    padding-right: clamp(24px, 4vw, 48px);
}

.home .tool-row:nth-child(even) {
    padding-left: clamp(24px, 4vw, 48px);
}

/* 条目数为奇数时，最后一项独占整行：
   否则右半行会空着，且底部细线断在中间，看起来像少了一块。
   描述限制行宽，避免全宽后一行拉到 1000px 读不下去。 */
.home .tool-row:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    padding-right: 0;
}

.home .tool-row:last-child:nth-child(odd) .tool-desc {
    max-width: 40em;
}

.home .tool-name {
    display: block;
    font-size: 1.3125rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: #1d1d1f;
}

.home .tool-desc {
    display: block;
    margin-top: 8px;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: #6e6e73;
}

.home .tool-arrow {
    font-size: 1.25rem;
    line-height: 1.1;
    color: #86868b;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}

.home .tool-row:hover .tool-arrow {
    transform: translateX(5px);
    color: #1d1d1f;
}

/* ---------- 4. 关于：整段陈述式排版 ---------- */

/* 「关于」的头部只有眉标，收紧与陈述之间的间距 */
.home .about .sec-head {
    margin-bottom: 28px;
}

.home .about-wrap {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.home .about-statement {
    margin: 0;
    font-size: clamp(1.75rem, 3.8vw, 2.875rem);
    font-weight: 500;
    line-height: 1.18;
    letter-spacing: -0.025em;
    color: #1d1d1f;
}

.home .about-note {
    margin: 24px 0 0;
    font-size: clamp(1rem, 1.3vw, 1.125rem);
    line-height: 1.6;
    color: #6e6e73;
}

/* 标签降级为纯文字元信息，用竖线分隔，不再描边成胶囊 */
.home .about-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 44px 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    color: #86868b;
}

.home .about-meta li {
    padding: 0 18px;
    border-left: 1px solid #d2d2d7;
}

.home .about-meta li:first-child {
    padding-left: 0;
    border-left: 0;
}

.home .about-meta li:last-child {
    padding-right: 0;
}

/* ---------- 5. 商店：三栏产品清单 + 胶囊按钮 ---------- */

/* 与 .tool-list 同一套语汇：细线分区，不用卡片与投影 */
.home .store-items {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid #d2d2d7;
    border-bottom: 1px solid #d2d2d7;
}

.home .store-item {
    padding: 32px clamp(20px, 3vw, 34px) 36px;
    border-left: 1px solid #d2d2d7;
}

/* 首尾两栏贴齐容器边缘，保持与其他区块左对齐 */
.home .store-item:first-child {
    padding-left: 0;
    border-left: 0;
}

.home .store-item:last-child {
    padding-right: 0;
}

.home .store-item-name {
    display: block;
    font-size: 1.125rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: #1d1d1f;
}

.home .store-item-desc {
    display: block;
    margin-top: 10px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #6e6e73;
}

.home .store-actions {
    margin-top: clamp(36px, 4.4vw, 52px);
    text-align: center;
}

.home .store-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 34px;
    border: 1px solid #1d1d1f;
    border-radius: 999px;
    background: transparent;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: #1d1d1f;
    transition: background 0.28s ease, color 0.28s ease, transform 0.18s ease;
}

.home .store-btn:hover {
    background: #1d1d1f;
    color: #ffffff;
}

/* 按下即时反馈：轻微收缩，比 hover 更快 */
.home .store-btn:active {
    transform: scale(0.975);
}

.home .store-btn-arrow {
    font-size: 1.125rem;
    line-height: 1;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.home .store-btn:hover .store-btn-arrow {
    transform: translateX(4px);
}

.home .store-note {
    margin: 16px 0 0;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    color: #86868b;
}

/* ---------- 6. 作品集：三列视频卡片 ---------- */

/* 桌面固定三列两行；列宽用 minmax(0,1fr) 让长标题不会把某一列撑宽 */
.home .video-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(30px, 3.4vw, 46px) clamp(18px, 2.2vw, 30px);
    margin: 0;
    padding: 0;
    list-style: none;
}

.home .video-grid[hidden] {
    display: none;
}

.home .video-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.home .video-link {
    display: flex;
    flex-direction: column;
    gap: 14px;
    color: inherit;
    text-decoration: none;
}

.home .video-card {
    color: inherit;
    text-decoration: none;
}

.home .video-thumb {
    position: relative;
    display: block;
    /* 用固定比例锁定封面高度，六张卡片才能在不同标题长度下依然对齐 */
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 14px;
    background: #e8e8ed;
}

.home .video-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.home .video-link:hover .video-thumb img {
    transform: scale(1.035);
}

/* 时长角标：压在封面右下，半透明黑底保证任何封面上都可读 */
.home .video-duration {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.66);
    font-size: 0.75rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    line-height: 1.3;
    color: #ffffff;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.home .video-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* 固定两行高度：标题一行或两行都占同样位置，六张卡片基线一致 */
    min-height: 2.9em;
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: -0.011em;
    color: #1d1d1f;
}

/* 悬停时标题不再变灰，改用封面的轻微推近作为反馈，与站内其他区块一致 */
.home .video-link:hover .video-title {
    color: #000000;
}

/* ---------- 6b. 骨架屏：数据回来前占住位置，避免高度跳动 ---------- */

.home .video-card.is-skeleton .video-thumb,
.home .sk-line {
    background: #e8e8ed;
}

.home .sk-line {
    display: block;
    height: 0.85em;
    border-radius: 5px;
}

.home .sk-line.is-short {
    width: 52%;
}

.home .video-card.is-skeleton .video-thumb,
.home .video-card.is-skeleton .sk-line {
    animation: sk-pulse 1.5s ease-in-out infinite;
}

@keyframes sk-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.42; }
}

/* ---------- 6c. 空态与抓取失败：一句提示 + 通往 B 站的出口 ---------- */

.home .video-empty {
    padding: clamp(40px, 5vw, 64px) 0 clamp(8px, 1vw, 16px);
    text-align: center;
}

.home .video-empty[hidden] {
    display: none;
}

.home .video-empty-text {
    margin: 0;
    font-size: clamp(1rem, 1.3vw, 1.125rem);
    line-height: 1.6;
    color: #6e6e73;
}

.home .video-empty-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding: 12px 28px;
    border: 1px solid #1d1d1f;
    border-radius: 999px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1d1d1f;
    transition: background 0.28s ease, color 0.28s ease, transform 0.18s ease;
}

.home .video-empty-link:hover {
    background: #1d1d1f;
    color: #ffffff;
}

.home .video-empty-link:active {
    transform: scale(0.975);
}

.home .video-empty-arrow {
    font-size: 1.0625rem;
    line-height: 1;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.home .video-empty-link:hover .video-empty-arrow {
    transform: translateX(4px);
}

/* ---------- 7. 历程：年份与描述的两栏对齐 ---------- */

.home .tl-list {
    max-width: 880px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
    border-top: 1px solid #d2d2d7;
}

.home .tl-row {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    align-items: baseline;
    gap: 32px;
    padding: 30px 0;
    border-bottom: 1px solid #d2d2d7;
}

.home .tl-year {
    font-size: clamp(1.25rem, 1.8vw, 1.625rem);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: #1d1d1f;
}

.home .tl-desc {
    margin: 0;
    font-size: 1.0625rem;
    line-height: 1.6;
    color: #6e6e73;
}

/* ---------- 8. 联系 ---------- */

.home .contact-block {
    text-align: center;
}

.home .contact-mail {
    display: inline-block;
    padding-bottom: 6px;
    border-bottom: 1px solid transparent;
    font-size: clamp(1.5rem, 3.4vw, 2.5rem);
    font-weight: 500;
    letter-spacing: -0.025em;
    color: #1d1d1f;
    transition: border-color 0.2s ease;
}

.home .contact-mail:hover {
    border-bottom-color: #1d1d1f;
}

/* ---------- 8b. 彩蛋：伪装成纯文本的输入框 + 微信式尖角气泡 ---------- */

/* 包裹层只提供定位上下文，视觉上不存在 */
.home .mail-field {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

/* 抹掉原生控件外观：无边框、无底色、无圆角，只剩文字本身。
   宽度由 js/easter-egg.js 按实际文字宽度写入，保证与纯文本逐像素一致。 */
.home .mail-input {
    display: inline-block;
    width: auto;
    min-width: 4ch;
    max-width: 100%;
    margin: 0;
    padding: 0 0 6px;
    border: 0;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    font: inherit;
    font-size: clamp(1.5rem, 3.4vw, 2.5rem);
    font-weight: 500;
    letter-spacing: -0.025em;
    line-height: 1.4;
    color: #1d1d1f;
    text-align: center;
    cursor: text;
    caret-color: #1d1d1f;
    -webkit-appearance: none;
    appearance: none;
    /* 支持 field-sizing 的浏览器先按内容自适应，避免脚本执行前闪一下默认宽度 */
    field-sizing: content;
    transition: border-color 0.2s ease;
}

.home .mail-input:focus {
    /* 去掉原生焦点框，改用与悬停一致的下划线作为焦点指示 */
    outline: none;
    border-bottom-color: #1d1d1f;
}

/* 气泡：白色材质 + 一圈细描边 + 向上的尖角，落点永远指向输入框中心 */
.home .mail-bubble {
    position: absolute;
    top: calc(100% + 16px);
    left: 0;
    z-index: 20;
    max-width: min(280px, calc(100vw - 24px));
    padding: 10px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 14px;
    background: #ffffff;
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.4;
    color: #1d1d1f;
    white-space: nowrap;
    /* 永不拦截点击，彩蛋不干扰页面任何其他交互 */
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.92);
    /* 从尖角处放大，气泡像是从输入框里长出来的 */
    transform-origin: var(--tail-x, 50%) 0;
    /* drop-shadow 会跟随尖角轮廓投影，box-shadow 做不到；只向下投，避免四周出现灰环 */
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.1));
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.home .mail-bubble.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    /* 入场带一点回弹（1.32 略过冲），出场不带 */
    transition: opacity 0.18s ease, transform 0.3s cubic-bezier(0.34, 1.32, 0.64, 1), visibility 0s;
}

/* 重复回车时的小回弹：表示「又按了一次」，不重播整个入场 */
.home .mail-bubble.is-nudge {
    animation: mail-bubble-nudge 0.32s cubic-bezier(0.34, 1.3, 0.64, 1);
}

@keyframes mail-bubble-nudge {
    0% { transform: translateY(0) scale(1); }
    45% { transform: translateY(0) scale(1.05); }
    100% { transform: translateY(0) scale(1); }
}

/* 尖角：旋转 45° 的方块，只留朝上的两条边，与气泡同色同描边；
   下半部分压在气泡顶边上，正好把那条边「咬」开，不会出现双线 */
.home .mail-bubble::before {
    content: "";
    position: absolute;
    top: -6px;
    left: var(--tail-x, 50%);
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-top: 1px solid #d2d2d7;
    border-left: 1px solid #d2d2d7;
    border-radius: 3px 0 0 0;
    background: #ffffff;
    transform: rotate(45deg);
}

.home .contact-block .social-links {
    justify-content: center;
    gap: 32px;
    /* 原为 44px：留出这段空白，彩蛋气泡弹出时不压住下方图标 */
    margin-top: clamp(56px, 5vw, 72px);
}

/* 图标只承担识别功能，去掉描边下划线，默认降低存在感 */
.home .contact-block .social-link,
.home .contact-block .social-label {
    border-bottom: none;
    padding-bottom: 0;
}

.home .contact-block .social-img {
    opacity: 0.72;
}

.home .contact-block .social-link:hover .social-img,
.home .contact-block .social-label:hover .social-img {
    opacity: 1;
}

.home .qr-popup {
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* ---------- 9. 响应式 ---------- */

/* 平板：三列会让每张卡片窄到 220px 以下，封面与两行标题都会挤，降到两列 */
@media (max-width: 900px) {
    .home .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .home main .section {
        padding: 88px 0;
    }

    .home .sec-head {
        margin-bottom: 40px;
    }

    .home .tool-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .home .tool-row {
        padding: 24px 0;
    }

    /* 单列时取消两列布局留下的内边距 */
    .home .tool-row:nth-child(odd),
    .home .tool-row:nth-child(even) {
        padding-left: 0;
        padding-right: 0;
    }

    .home .about-meta {
        margin-top: 36px;
    }

    /* 商店：单列堆叠，分隔线由每栏底边承担，末栏交给列表自身下边框 */
    .home .store-items {
        grid-template-columns: minmax(0, 1fr);
    }

    .home .store-item {
        padding: 24px 0;
        border-left: 0;
        border-bottom: 1px solid #d2d2d7;
    }

    .home .store-item:last-child {
        border-bottom: 0;
    }

    .home .store-actions {
        margin-top: 36px;
    }

    .home .store-btn {
        width: 100%;
        padding: 15px 24px;
    }

    /* 作品集：两列时把行间距收紧一点，六张卡片不至于拉得过长 */
    .home .video-grid {
        gap: 32px 16px;
    }

    .home .video-title {
        font-size: 0.9375rem;
    }

    .home .tl-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding: 24px 0;
    }

    .home .contact-block .social-links {
        gap: 24px;
        margin-top: 36px;
    }

    /* 窄屏：气泡离输入框近一点，避免贴到视口底部之外 */
    .home .mail-bubble {
        top: calc(100% + 14px);
        padding: 9px 14px;
    }
}

/* 手机：单列，封面放到接近通栏，标题恢复常规字号 */
@media (max-width: 600px) {
    .home .video-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 26px;
    }

    .home .video-title {
        font-size: 1rem;
        min-height: 0;
    }

    .home .video-empty-link {
        width: 100%;
        padding: 14px 24px;
    }
}

/* ---------- 10. 无障碍：尊重系统减弱动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
    .home .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .home .carousel-track {
        animation: none;
    }

    /* 减弱动态：骨架只保留静态灰块，封面不放大 */
    .home .video-card.is-skeleton .video-thumb,
    .home .video-card.is-skeleton .sk-line {
        animation: none;
    }

    .home .video-thumb img,
    .home .video-empty-link,
    .home .video-empty-arrow {
        transition: none;
    }

    .home .tool-arrow {
        transition: none;
    }

    .home .store-btn,
    .home .store-btn-arrow {
        transition: none;
    }

    /* 减弱动态：气泡只做淡入淡出，去掉位移、缩放与回弹 */
    .home .mail-bubble,
    .home .mail-bubble.is-visible {
        transform: none;
        transition: opacity 0.18s ease, visibility 0s linear 0.18s;
    }

    .home .mail-bubble.is-nudge {
        animation: none;
    }
}

/* ============================================================
   11. 多语言排版适配（仅首页，按 <html lang> 生效）
   ------------------------------------------------------------
   · CustomFont 只含拉丁字形，CJK 由系统字体接管；日文、韩文
     单独给出字体栈，避免日文汉字按中文字形（如「直」「骨」）渲染。
   · 中日韩文字不适合负字距与 1.07 行高，单独放宽。
   · 韩文按词断行，避免音节被拆到两行。
   ============================================================ */
html:lang(ja) {
    --font-family: 'CustomFont', -apple-system, BlinkMacSystemFont, 'Hiragino Sans',
        'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans JP', sans-serif;
}

html:lang(ko) {
    --font-family: 'CustomFont', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
        'Malgun Gothic', 'Noto Sans KR', sans-serif;
}

.home:lang(ja) .sec-title,
.home:lang(ko) .sec-title {
    line-height: 1.2;
    letter-spacing: 0.005em;
}

.home:lang(ja) .sec-eyebrow,
.home:lang(ko) .sec-eyebrow {
    letter-spacing: 0.1em;
}

.home:lang(ja) .about-statement,
.home:lang(ko) .about-statement {
    line-height: 1.35;
    letter-spacing: 0;
}

.home:lang(ko) {
    word-break: keep-all;
}

