/*
Theme Name: GlobalAgriHub · 环球农业网
Theme URI: https://www.globalagrihub.com/
Author: chaoneo
Description: 环球农业网 B2B 主题 —— 农产品出口产业线 + 海外采购询盘（RFQ）+ 供应商黄页 + 出海全案服务。中英双语（默认中文，英文走 /en/ 前缀），Tailwind CSS 构建，内置线索库、会员额度、装柜与到岸成本计算器。
Version: 1.0.0
Requires at least: 6.2
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: agrihub
Tags: b2b, bilingual, custom-post-types, tailwind
*/

/* ==========================================================================
   本文件只放 Tailwind 难以表达的交互与结构样式；
   设计令牌、组件类、排版全部在 assets/css/src.css（编译到 tailwind.css）。
   ========================================================================== */

/* 语言切换 / 双端入口分段控件 */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}
.seg a {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}
.seg a:hover { color: #fff; }
.seg a[aria-current="true"] {
  background: #e5a233;
  color: #0c2118;
}

/* 主导航下拉面板 */
/* 主导航下拉面板
   面板不再跟着「当前栏目文字」居中——820/960px 宽的大面板挂在靠近左侧的
   栏目下时会被推出屏幕左边缘（「产品出海」就是这样）。这里把 li 取消定位，
   让面板以 sticky <header>（宽度 = 视口）为包含块，left:50% 即整页居中。
   触发器本身仍要定位，下面的 ::after 悬停缓冲才不会乱跑。 */
.nav-item {
  position: static;
}
.nav-item > a,
.nav-item > button {
  position: relative;
}
.nav-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  opacity: 0;
  visibility: hidden;
  /* 关闭不加过渡：面板都落在同一块区域，淡出的旧面板会和刚打开的新面板
     重叠成一团。打开时才做淡入（见下面的展开态规则）。 */
  transition: none;
  pointer-events: none;
  z-index: 60;
}
.nav-item:hover > .nav-panel,
.nav-item:focus-within > .nav-panel,
.nav-item.is-open > .nav-panel {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: auto;
}
/* 下拉触发器与面板之间留出悬停缓冲，避免鼠标穿越断裂。
   面板现在挂在页头下方（离文字更远），缓冲加到 26px 才能接住。 */
.nav-item > a::after,
.nav-item > button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 26px;
}

/* 英文导航比中文长两倍，1280–1439 之间要收一点字号和内距，
   否则 8 个栏目 + 「Post an RFQ」按钮会把右侧挤出屏幕。 */
@media (min-width: 1024px) and (max-width: 1439px) {
  .lang-en .nav-item > a {
    font-size: 12px;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
    letter-spacing: -0.01em;
  }
}

/* 移动端抽屉 */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
}
.mobile-nav.is-open { display: block; }
.mobile-nav__scrim {
  position: absolute;
  inset: 0;
  background: rgba(12, 33, 24, 0.55);
  backdrop-filter: blur(2px);
}
.mobile-nav__sheet {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(88vw, 400px);
  background: #fff;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform 0.24s ease;
}
.mobile-nav.is-open .mobile-nav__sheet { transform: translateX(0); }
body.nav-lock { overflow: hidden; }

/* 首屏装饰图层 */
.hero-grid {
  background-image:
    radial-gradient(circle at 82% 12%, rgba(229, 162, 51, 0.18), transparent 46%),
    radial-gradient(circle at 12% 88%, rgba(58, 138, 92, 0.28), transparent 52%),
    linear-gradient(155deg, #0c2118 0%, #14372a 52%, #1a3b2b 100%);
}
.hero-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 78%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 78%);
  pointer-events: none;
}

/* 今日求购滚动播报 */
.ticker {
  max-height: 300px;
  overflow: hidden;
  position: relative;
}
.ticker__track {
  animation: ticker-scroll 32s linear infinite;
}
.ticker:hover .ticker__track { animation-play-state: paused; }
@keyframes ticker-scroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; }
  html { scroll-behavior: auto; }
}

/* 卡片进度条（配额 / 认证完成度） */
.meter {
  height: 6px;
  border-radius: 999px;
  background: #eef0f0;
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3a8a5c, #8cc3a0);
}

/* 表格横向滚动容器 */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.scroll-x::-webkit-scrollbar { height: 8px; }
.scroll-x::-webkit-scrollbar-thumb {
  background: #c2c8c8;
  border-radius: 999px;
}

/* 工具页结果高亮 */
.result-tile {
  background: linear-gradient(160deg, #f0f7f2 0%, #ffffff 70%);
}

/* 打印（报价单） */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

/* ==========================================================================
   文章页：标签 / 上下文 / 分享 / 侧栏会员卡
   ==========================================================================
   这些是结构型组件（多元素组合、伪元素、粘性滚动），放在这里而不是
   Tailwind 工具类里，改样式不用重编译 tailwind.css。
   ========================================================================== */

/* 标签胶囊 */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid #e2e6e4;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 12px;
  font-weight: 600;
  color: #4a554f;
  background: #fff;
  transition: border-color .15s, color .15s, background-color .15s;
}
.tag-chip:hover {
  border-color: #b6d6c2;
  color: #1e4732;
  background: #f3f9f5;
}

/* 上一篇 / 下一篇 */
.post-context {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid #eef1ef;
}
@media (min-width: 640px) {
  .post-context { grid-template-columns: 1fr 1fr; }
}
.post-context-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  border: 1px solid #e6eae7;
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
a.post-context-item:hover {
  border-color: #b6d6c2;
  box-shadow: 0 6px 18px -12px rgba(12, 33, 24, .45);
}
.post-context-item.is-next { text-align: right; }
.post-context-item.is-empty {
  border-style: dashed;
  border-color: #eef1ef;
  background: transparent;
}
.post-context-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #3a8a5c;
}
.post-context-item.is-next .post-context-label { justify-content: flex-end; }
.post-context-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.55;
  color: #1a2420;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-context-item.is-empty .post-context-title {
  color: #a8b1ac;
  font-weight: 500;
}

/* 分享条 */
.share-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #eef1ef;
}
.share-bar-title {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-right: 0.25rem;
  font-size: 12px;
  font-weight: 700;
  color: #6b776f;
}
.share-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e2e6e4;
  border-radius: 999px;
  padding: 0.28rem 0.72rem;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  color: #4a554f;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, color .15s, background-color .15s;
}
.share-chip:hover {
  border-color: #1e4732;
  color: #1e4732;
  background: #f3f9f5;
}
.share-chip.is-done {
  border-color: #3a8a5c;
  color: #fff;
  background: #1e4732;
}

/* 侧栏会员推荐卡（漂浮） */
.member-promo {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  padding: 1.15rem 1.15rem 1rem;
  color: #fff;
  background: radial-gradient(120% 120% at 0% 0%, #2a6f49 0%, #163629 55%, #0c2118 100%);
  box-shadow: 0 18px 40px -24px rgba(12, 33, 24, .7);
}
.member-promo::after {
  content: "";
  position: absolute;
  right: -38px;
  top: -38px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(214, 178, 96, .16);
  pointer-events: none;
}
.member-promo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #f2d79a;
  background: rgba(255, 255, 255, .1);
}
.member-promo-title {
  margin-top: 0.7rem;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}
.member-promo-desc {
  margin-top: 0.4rem;
  font-size: 11.5px;
  line-height: 1.65;
  color: rgba(255, 255, 255, .62);
}
.member-promo-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.member-promo-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  font-size: 11.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, .82);
}
.member-promo-list svg { flex: none; margin-top: 2px; color: #8cc3a0; }
.member-promo-cta {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 0.7rem;
  padding: 0.55rem 0.9rem;
  font-size: 12.5px;
  font-weight: 700;
  color: #163629;
  background: linear-gradient(180deg, #f0d79b 0%, #d6b260 100%);
  transition: filter .15s;
}
.member-promo-cta:hover { filter: brightness(1.05); }
.member-promo-sub {
  display: block;
  margin-top: 0.5rem;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, .5);
}
.member-promo-sub:hover { color: #fff; }

/* 侧栏整体跟随滚动：内容不进视口就内部滚动，避免遮挡下方卡片 */
.aside-sticky {
  position: static;
}
@media (min-width: 1024px) {
  .aside-sticky {
    position: sticky;
    top: 6rem;
    max-height: calc(100vh - 7.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding-right: 2px;
  }
  .aside-sticky::-webkit-scrollbar { width: 4px; }
  .aside-sticky::-webkit-scrollbar-thumb {
    background: #d6dbd8;
    border-radius: 999px;
  }
}

/* 双端入口（移动端菜单）：标出当前所在的一端 */
.btn-outline[aria-current="true"] {
  border-color: #23593c;
  background: #f0f7f2;
  color: #1e4732;
}
