/* ==========================================================================
   CJEVOK - 站点外壳样式（共享单源）
   文件：assets/css/site-shell.css
   来源：由 pages/products.html 的 <style id="critical-layout"> 抽取生成
   内容：公告栏 / 站点头部 / 语言切换 / 站点页脚 / 响应式
   依赖：页面需先定义同名设计令牌（--c-navy、--c-accent、--r-pill、
         --container-pad、--container-max、--font-display、--shadow-hover 等）
   说明：本文件为「外壳」部分，不含首页/列表页等页面级样式。
   ========================================================================== */

/* ---------- Announcement Bar ---------- */
    .announce-bar {
      background: var(--c-navy);
      color: #fff;
      font-size: 0.8rem;
    }
    .announce-inner {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      min-height: 36px;
      padding: 0.4rem var(--container-pad);
    }
    .announce-left {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
    .announce-icon { font-size: 0.95rem; }
    .announce-right {
      display: flex;
      align-items: center;
      gap: 1rem;
    }
    .announce-help {
      color: rgba(255, 255, 255, 0.85);
      text-decoration: none;
      font-weight: 500;
    }
    .announce-help:hover { color: var(--c-accent); }
    .currency-switch { position: relative; }
    .currency-trigger {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      padding: 0.25rem 0.6rem;
      border-radius: var(--r-pill);
      border: 1px solid rgba(255, 255, 255, 0.25);
      background: transparent;
      color: #fff;
      font-family: var(--font-display);
      font-size: 0.78rem;
      font-weight: 600;
      cursor: pointer;
    }
    .currency-panel {
      position: absolute;
      top: calc(100% + 6px);
      right: 0;
      min-width: 80px;
      margin: 0;
      padding: 4px;
      list-style: none;
      background: #fff;
      border: 1px solid var(--c-border);
      border-radius: var(--r-sm);
      box-shadow: var(--shadow-hover);
      z-index: 70;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-4px);
      transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    }
    .currency-switch.open .currency-panel {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }
    .currency-option {
      padding: 0.45rem 0.7rem;
      border-radius: 6px;
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--c-text);
      cursor: pointer;
      text-align: center;
    }
    .currency-option:hover { background: var(--CJEVOK-muted); color: var(--c-navy); }
    .currency-option.active {
      background: rgba(46, 84, 150, 0.12);
      color: var(--c-blue);
      font-weight: 700;
    }

/* ---------- Header ---------- */
    .site-header {
      position: sticky;
      top: 0;
      z-index: 60;
      background: #ffffff;
      border-bottom: 1px solid var(--c-border);
    }
    .header-inner {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1.25rem;
      min-height: 72px;
    }
    .brand {
      display: inline-flex;
      align-items: center;
      gap: 0.6rem;
      flex: none;
      text-decoration: none;
      color: var(--c-navy);
    }
    .brand-mark { width: 28px; height: 28px; flex: none; }
    .brand-word {
      font-family: var(--font-display);
      font-size: 1.15rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      white-space: nowrap;
    }
    .main-nav ul {
      display: flex;
      align-items: center;
      gap: clamp(0.5rem, 1.2vw, 1.25rem);
      list-style: none;
      margin: 0;
      padding: 0;
    }
    .main-nav a {
      display: inline-block;
      padding: 0.5rem 0.25rem;
      font-family: var(--font-display);
      font-size: 0.9rem;
      font-weight: 600;
      color: var(--c-navy);
      text-decoration: none;
      border-bottom: 2px solid transparent;
      transition: border-color 0.15s ease;
      white-space: nowrap;
    }
    .main-nav a:hover { border-bottom-color: var(--c-accent); }
    .header-actions {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
    .icon-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: none;
      background: var(--CJEVOK-muted);
      color: var(--c-navy);
      cursor: pointer;
      position: relative;
      transition: background-color 0.15s ease;
    }
    .icon-btn:hover { background: #dce8f5; }
    .icon-btn svg { width: 18px; height: 18px; }
    .wishlist-btn .wishlist-dot {
      position: absolute;
      top: 4px;
      right: 4px;
      min-width: 14px;
      height: 14px;
      padding: 0 3px;
      border-radius: var(--r-pill);
      background: var(--c-danger);
      color: #fff;
      font-size: 0.6rem;
      font-weight: 700;
      line-height: 14px;
      text-align: center;
    }
    .bag-link {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 40px;
      height: 40px;
      border-radius: 50%;
      color: var(--c-navy);
      background: var(--CJEVOK-muted);
      text-decoration: none;
      transition: background-color 0.15s ease;
    }
    .bag-link:hover { background: #dce8f5; }
    .bag-link svg { width: 18px; height: 18px; }
    .bag-badge {
      position: absolute;
      top: -3px;
      right: -3px;
      min-width: 16px;
      height: 16px;
      padding: 0 4px;
      border-radius: var(--r-pill);
      background: var(--c-accent);
      color: #fff;
      font-size: 0.65rem;
      font-weight: 700;
      line-height: 16px;
      text-align: center;
    }
    .mobile-panel { display: none; }
    .menu-toggle {
      display: none;
      align-items: center;
      justify-content: center;
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: 1px solid var(--c-border);
      background: #fff;
      color: var(--c-navy);
      cursor: pointer;
    }
    .menu-toggle svg { width: 18px; height: 18px; }

/* ---------- Language switch ---------- */
    .lang-switch { position: relative; }
    .lang-trigger {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      min-height: 40px;
      padding: 0 0.9rem;
      border-radius: var(--r-pill);
      border: 1px solid var(--c-border);
      background: var(--CJEVOK-muted);
      font-family: var(--font-display);
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--c-navy);
      cursor: pointer;
    }
    .lang-trigger svg { width: 16px; height: 16px; flex: none; }
    .lang-current { white-space: nowrap; }
    .lang-panel {
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      min-width: 160px;
      margin: 0;
      padding: 6px;
      list-style: none;
      background: #fff;
      border: 1px solid var(--c-border);
      border-radius: var(--r-sm);
      box-shadow: var(--shadow-hover);
      z-index: 70;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-4px);
      transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    }
    .lang-switch.open .lang-panel {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }
    /* 2026-10-28 修复：footer 里的语言下拉原先与页头一样向下展开（top: calc(100% + 8px)），
       面板虽然 visibility:hidden / opacity:0，但仍然占据布局并溢出到文档底部之外，
       实测把页面撑高了 248px —— 用户滚到最下面就会看到 footer 下方一大块空白。
       改为向上展开：不产生任何文档溢出，动画与交互完全保留。 */
    .site-footer .lang-panel {
      top: auto;
      bottom: calc(100% + 8px);
      transform: translateY(4px);
    }
    .site-footer .lang-switch.open .lang-panel {
      transform: translateY(0);
    }
    .lang-option {
      padding: 0.55rem 0.9rem;
      border-radius: 6px;
      font-size: 0.9rem;
      color: var(--c-text);
      cursor: pointer;
    }
    .lang-option:hover { background: var(--CJEVOK-muted); color: var(--c-navy); }
    .lang-option.active {
      background: rgba(46, 84, 150, 0.12);
      color: var(--c-blue);
      font-weight: 700;
    }

/* ---------- Footer ---------- */
    .site-footer { background: var(--c-ink); color: rgba(255, 255, 255, 0.9); padding: var(--space-sec) 0 0; }
    .site-footer .brand { color: #fff; margin-bottom: 0.9rem; }
    .footer-grid {
      display: grid;
      grid-template-columns: 1.3fr 1fr 1fr;
      gap: clamp(24px, 3vw, 48px);
      padding-bottom: 2.5rem;
    }
    .footer-tagline { margin: 0 0 0.6rem; max-width: 22rem; color: rgba(255, 255, 255, 0.72); }
    .footer-by {
      margin: 0 0 1rem;
      font-family: var(--font-display);
      font-size: 0.78rem;
      font-weight: 600;
      letter-spacing: 0.16em;
      color: rgba(255, 255, 255, 0.55);
    }
    .footer-socials {
      display: flex;
      gap: 0.6rem;
      margin-top: 0.5rem;
    }
    .social-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.08);
      color: rgba(255, 255, 255, 0.8);
      transition: background-color 0.15s ease, color 0.15s ease;
    }
    .social-link:hover { background: var(--c-accent); color: #fff; }
    .social-link svg { width: 16px; height: 16px; }
    .footer-head { margin: 0 0 0.8rem; font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; letter-spacing: 0.08em; color: #fff; }
    .footer-head-cert { margin-top: 1.5rem; }
    .footer-nav ul { list-style: none; display: grid; gap: 0.55rem; margin: 0; padding: 0; }
    .footer-nav a { color: rgba(255, 255, 255, 0.75); text-decoration: none; font-size: 0.95rem; transition: color 0.15s ease; }
    .footer-nav a:hover { color: var(--c-accent); }
    .footer-inquiry { list-style: none; display: grid; gap: 0.55rem; margin: 0; padding: 0; }
    .footer-inquiry a { color: rgba(255, 255, 255, 0.75); text-decoration: none; font-size: 0.95rem; transition: color 0.15s ease; }
    .footer-inquiry a:hover { color: var(--c-accent); }
    .footer-inquiry li { color: rgba(255, 255, 255, 0.6); font-size: 0.85rem; }
    .cert-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; }
    .cert-list li {
      padding: 0.3rem 0.7rem;
      border: 1px solid rgba(255, 255, 255, 0.25);
      border-radius: var(--r-pill);
      font-family: var(--font-display);
      font-size: 0.78rem;
      font-weight: 600;
      letter-spacing: 0.04em;
      color: rgba(255, 255, 255, 0.85);
    }
    .footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.14); }
    .footer-bottom-inner {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      padding-top: 1.4rem;
      padding-bottom: 1.4rem;
    }
    .footer-rights { margin: 0; font-size: 0.85rem; color: rgba(255, 255, 255, 0.65); }
    .footer-extra { display: flex; align-items: center; gap: 0.9rem; }
    .to-top {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      position: fixed;
      left: 24px;
      bottom: 40px;
      z-index: 80;
      width: 40px;
      height: 40px;
      border: 1px solid rgba(255, 255, 255, 0.3);
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.08);
      color: #fff;
      cursor: pointer;
      opacity: 0;
      visibility: hidden;
      transform: translateY(8px);
      transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    }
    .to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
    .to-top svg { width: 18px; height: 18px; }

/* ---------- Responsive ---------- */
    @media (max-width: 1024px) {
      .main-nav { display: none; }
      .menu-toggle { display: inline-flex; }
      .mobile-panel {
        display: block;
        max-height: 0;
        overflow: hidden;
        border-top: 1px solid var(--c-border);
        background: #fff;
        transition: max-height 0.3s ease;
      }
      #site-header.nav-open .mobile-panel { max-height: 520px; }
      .mobile-panel ul { list-style: none; margin: 0; padding: 0.5rem 0 1rem; }
      .mobile-panel a {
        display: block;
        padding: 0.8rem var(--container-pad);
        font-family: var(--font-display);
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--c-text);
        text-decoration: none;
        border-left: 3px solid transparent;
      }
      .mobile-panel a:hover { color: var(--c-navy); background: var(--CJEVOK-muted); border-left-color: var(--c-accent); }
      .hero-carousel { height: 460px; }
      .hero-slide-inner { grid-template-columns: 1fr; gap: 20px; }
      .hero-slide-content { max-width: 100%; }
      .hero-slide-visual { display: none; }
      .hero-carousel-btn { width: 40px; height: 40px; }
      .hero-carousel-btn--prev { left: 12px; }
      .hero-carousel-btn--next { right: 12px; }
      .impact-layout { grid-template-columns: 1fr; }
      .product-grid-4 { grid-template-columns: repeat(2, 1fr); }
      .savings-grid { grid-template-columns: repeat(2, 1fr); }
      .cat-grid-6 { grid-template-columns: repeat(2, 1fr); }
      .coll-grid-4 { grid-template-columns: repeat(2, 1fr); }
      .impact-cases-grid { grid-template-columns: repeat(2, 1fr); }
      .vp-grid { grid-template-columns: repeat(2, 1fr); }
      .trust-grid { grid-template-columns: repeat(2, 1fr); }
    }

    @media (max-width: 767px) {
      .cat-grid-6 { grid-template-columns: 1fr; }
      .coll-grid-4 { grid-template-columns: 1fr; }
      .impact-cases-grid { grid-template-columns: 1fr; }
      .product-grid-4 { grid-template-columns: 1fr; }
      .savings-grid { grid-template-columns: 1fr; }
      .vp-grid { grid-template-columns: 1fr; }
      .trust-grid { grid-template-columns: 1fr; }
      .footer-grid { grid-template-columns: 1fr; }
      .contact-row { flex-direction: column; }
      .to-top { left: 16px; bottom: 24px; }
      .impact-stats-row { grid-template-columns: repeat(2, 1fr); }
      .announce-right { display: none; }
    }
    @media (max-width: 520px) {
      .brand-word { font-size: 1rem; }
      .header-actions { gap: 0.35rem; }
      .icon-btn { width: 36px; height: 36px; }
      .bag-link { width: 36px; height: 36px; }
      .lang-trigger { padding: 0 0.6rem; font-size: 0.78rem; }
    }
    /* 320-359px 最小屏溢出修复：进一步收缩头部按钮 */
    @media (max-width: 359px) {
      .header-actions { gap: 0.2rem; }
      .icon-btn { width: 32px; height: 32px; }
      .bag-link { width: 32px; height: 32px; }
      .lang-trigger { padding: 0 0.4rem; font-size: 0.72rem; }
      .lang-current { display: none; }
    }


    /* ================================================================
       响应式补强（依据 tools/responsive_audit.py 在 12 个视口的实测结果）
       手机 ≤767 / 平板 768-1024 / 桌面 ≥1025
       ================================================================ */

    /* 平板横屏（矮视口）：首屏 460px 会吃掉大半个屏幕 */
    @media (min-width: 768px) and (max-width: 1024px) and (max-height: 820px) {
      .hero-carousel { height: 400px; }
    }

    /* 平板：首屏视觉图与正文左右分栏在 768-1024 已由 ≤1024 断点转 1 栏，
       这里补上栅格子项的 min-width:0，避免内容把列撑宽 */
    @media (max-width: 1024px) {
      .impact-layout > * { min-width: 0; }
      .impact-main-img.impact-real-img { aspect-ratio: 16 / 10; min-height: 0; }
    }

    /* 触控设备（≤1024）：文字型链接与图标按钮热区统一补到 ≥32px。
       iPad / 平板同样用手指操作，热区过小会造成点不中。 */
    @media (max-width: 1024px) {
      .footer-grid ul li a,
      .contact-list li a,
      .breadcrumb a,
      .announce-help,
      .currency-trigger {
        display: inline-flex;
        align-items: center;
        min-height: 32px;
      }
      .brand { min-height: 32px; }
      .main-nav a { min-height: 32px; display: inline-flex; align-items: center; }
    }

    /* ---------- 手机（≤767） ---------- */
    @media (max-width: 767px) {
      /* 1) 顶部操作区原本 303px，手机上放不下 → 收起账户 / 心愿单图标，收紧间距 */
      .header-inner { gap: 0.6rem; }
      .header-actions { gap: 0.25rem; }
      .header-actions .icon-btn[aria-label="Account"],
      .header-actions .wishlist-btn { display: none; }

      /* 2) 直接写在 style 属性里的栅格（about 6 处 / products 1 处）
            手机上一律收成单列；内联优先级高于类选择器，必须 !important */
      main [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

      /* 3) 首屏视觉图 aspect-ratio:4/3 + min-height:360px 会把宽度撑到 480px，
            360px 屏上溢出 136px → 解除最小高度、改用更扁的比例 */
      .impact-main-img.impact-real-img { aspect-ratio: 16 / 10; min-height: 0; }
      .impact-sub-imgs { grid-template-columns: 1fr; }

      /* 4) 商品库筛选条：排序控件 512px 溢出 → 允许换行、容器内边距收窄 */
      .products-filter .container { padding: 0 16px !important; }
      .filter-cats { flex: 1 1 100%; }
      .filter-sort { flex: 1 1 100%; flex-wrap: wrap; row-gap: 8px; }

      /* 5) 文字型链接热区补到 ≥32px（页脚 / 联系方式 / 面包屑 / 公告栏） */
      .footer-grid ul li a,
      .contact-list li a,
      .breadcrumb a,
      .announce-help {
        display: inline-flex;
        align-items: center;
        min-height: 32px;
      }

      /* 6) 首屏轮播指示点：视觉仍是 10px 圆点，热区扩到 34px */
      .hero-carousel-dots { gap: 20px; }
      .hero-dot { position: relative; }
      .hero-dot::before {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        width: 34px;
        height: 34px;
        transform: translate(-50%, -50%);
      }
    }

    /* ---------- 小屏手机（≤560） ---------- */
    @media (max-width: 560px) {
      .header-inner { gap: 0.5rem; min-height: 64px; }
      .brand-logo-svg { height: 30px !important; }
      .icon-btn, .bag-link { width: 34px; height: 34px; }
      .menu-toggle { width: 36px; height: 36px; }
      .lang-trigger { padding: 0 0.5rem; gap: 0.25rem; }
    }

    /* ---------- 窄屏手机（≤430） ---------- */
    @media (max-width: 430px) {
      .lang-trigger .lang-current { display: none; }
      .lang-trigger svg:last-of-type { display: none; }
      .lang-trigger { padding: 0 0.45rem; }
      .header-inner { gap: 0.35rem; }
      /* 窄屏挤压修复：保证 .header-actions 不顶破视口（360/390 实测曾溢出 2px） */
      .header-actions { gap: 0.2rem; }
      .header-actions .icon-btn,
      .header-actions .bag-link { width: 32px; height: 32px; }
      .header-actions .menu-toggle { width: 32px; height: 32px; }
      .header-actions .currency-trigger { padding: 0 0.3rem; font-size: 0.7rem; gap: 0.15rem; }
      .site-header .brand img,
      .site-header .brand .brand-logo-svg { height: 28px !important; }
    }
    @media (max-width: 360px) {
      .brand-logo-svg { height: 26px !important; }
    }
    /* 320px 最小屏溢出修复：header-actions 收缩 + filter-chip 可滚动 */
    @media (max-width: 359px) {
      .header-actions { gap: 0.2rem; }
      .icon-btn { width: 32px; height: 32px; }
      .bag-link { width: 32px; height: 32px; }
    }

    /* ---------- Chinese line-height fallback ---------- */
    html[lang="zh"] { letter-spacing: 0; }
    html[lang="zh"] body { line-height: 1.7; }
    html[lang="zh"] .lang-trigger,
    html[lang="zh"] .lang-current,
    html[lang="zh"] .btn { text-transform: none; letter-spacing: 0; }
