/* ============================================================
   产品溯源电子名片 · 前台样式
   设计基线：墨绿主色 + 米白底，移动优先，640 / 1024 两个断点
   动效遵循 fx- 层约定：每页亮点动效 ≤2 个，prefers-reduced-motion 全退化
   ============================================================ */

:root {
  --brand: #0F6E56;
  --brand-deep: #0A4F3E;
  --brand-soft: #E7F2EE;
  --brand-ink: #085041;
  --gold: #B08442;
  --ink: #1E2421;
  --ink-2: #55605B;
  --ink-3: #8B948F;
  --line: #E5E2D9;
  --line-2: #D8D4C8;
  --bg: #FAF8F3;
  --card: #FFFFFF;
  --danger: #B42318;
  --radius: 16px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 500; }

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 64px;
}

.shell--center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ---------- 布局：PC 左固定卡 + 右时间线，移动单列 ---------- */

.layout { display: grid; gap: 18px; }

@media (min-width: 1024px) {
  .shell { padding: 32px 24px 80px; }
  .layout {
    grid-template-columns: 372px minmax(0, 1fr);
    gap: 36px;
    align-items: start;
  }
  .col-side { position: sticky; top: 28px; }
  .layout--plain { grid-template-columns: minmax(0, 1fr); max-width: 760px; margin: 0 auto; }
}

.col-main { min-width: 0; }

/* ---------- 产品卡 ---------- */

.product {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.product-cover { margin: 0; overflow: hidden; background: #F1EFE8; }

.product-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.product-main { padding: 18px 18px 20px; }

.product-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.product-head h1 {
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: .2px;
}

.product-lede {
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.8;
}

.block-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: .6px;
  margin: 22px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.block-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.count-note { font-size: 12px; font-weight: 400; color: var(--ink-3); }

/* 规格 */
.spec-list { margin: 0; }

.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}

.spec-row:last-child { border-bottom: 0; }

.spec-row dt { color: var(--ink-3); flex: none; max-width: 45%; }
.spec-row dd { margin: 0; text-align: right; color: var(--ink); word-break: break-word; }

.spec-note {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.7;
}

/* 正文 */
.rich p {
  margin: 0 0 10px;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--ink-2);
}

.rich p:last-child { margin-bottom: 0; }

/* ---------- 标签 / 徽标 ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.chip--new { background: #FFF4E5; color: #B25E09; }
.chip--done { background: #E7F7EE; color: #067647; }
.chip--mute { background: #F3F4F6; color: #6B7280; }
.chip--brand { background: var(--brand-soft); color: var(--brand-ink); }

/* ---------- 时间线 ---------- */

.tl-head { margin-bottom: 14px; }

.tl-head h2 { font-size: 17px; }

.tl-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); }

.tl {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.tl::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: var(--line-2);
}

.tl-group {
  position: relative;
  padding-left: 30px;
  padding-bottom: 24px;
}

.tl-group:last-child { padding-bottom: 0; }

.tl-marker {
  position: absolute;
  left: 0;
  top: 5px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--line-2);
}

.tl-group.is-open .tl-marker { border-color: var(--brand); background: var(--brand); }
.tl-group:first-child .tl-marker { border-color: var(--brand); }

.tl-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  flex-wrap: wrap;
}

.tl-group-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--brand);
  letter-spacing: .3px;
}

.tl-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}

.tl-toggle:hover { border-color: var(--brand); color: var(--brand); }
.tl-toggle svg { transition: transform .25s ease; }
.tl-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.tl-items { margin-top: 10px; }

.tl-group.is-closed .tl-items { display: none; }

.tl-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin-top: 10px;
}

.tl-item:first-child { margin-top: 0; }

.tl-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tl-title { font-size: 15.5px; line-height: 1.5; margin: 6px 0 4px; }

.tl-summary { margin: 0 0 6px; font-size: 13.5px; color: var(--ink-2); }

/* ---------- 媒体 ---------- */

.media-grid {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.media-grid--n1 { grid-template-columns: minmax(0, 1fr); }
.media-grid--n3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.media {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: #F1EFE8;
  position: relative;
}

.media--img img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.media--iframe,
.media--video { grid-column: 1 / -1; }

.media--iframe {
  aspect-ratio: 16 / 9;
  background: #000;
}

.media--iframe iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.media--video video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.media--link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  grid-column: 1 / -1;
}

.media-cover {
  flex: none;
  width: 92px;
  height: 62px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-color: #EDEAE1;
}

.media-cover--blank {
  background-image: linear-gradient(135deg, #EFEDE4 0%, #E4E0D5 100%);
}

.media-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.platform {
  font-size: 11.5px;
  color: var(--brand);
  font-weight: 500;
}

.media-title {
  font-size: 13.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-hint { font-size: 11.5px; color: var(--ink-3); }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
  position: relative;
  overflow: hidden;
}

.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-deep); }

.btn--ghost {
  background: transparent;
  border-color: var(--line-2);
  color: var(--ink);
}

.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- 供应方信息 ---------- */

.providers {
  margin-top: 28px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.provider-main { display: flex; align-items: center; gap: 12px; min-width: 0; }

.provider-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: #F6F4EE;
  flex: none;
}

.provider-name { margin: 0; font-size: 14.5px; font-weight: 500; }
.provider-line { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }

.provider-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 企业主页 ---------- */

.shell--company { max-width: 860px; }

.ent {
  text-align: center;
  padding: 20px 4px 28px;
  border-bottom: 1px solid var(--line);
}

.ent-logo {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.ent-name { font-size: 24px; line-height: 1.4; letter-spacing: .3px; }

.ent-lede {
  margin: 10px auto 0;
  max-width: 520px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.85;
}

.ent-meta {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 8px 20px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-2);
}

.ent-meta li { display: flex; gap: 6px; }
.ent-meta span { color: var(--ink-3); }
.ent-meta a { color: var(--brand); font-variant-numeric: tabular-nums; }

.ent-section { margin-top: 26px; }

.prod-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 760px) {
  .prod-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.prod {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  height: 100%;
  transition: border-color .2s ease, transform .2s ease;
}

.prod:hover { border-color: var(--brand); }
.prod:active { transform: scale(.99); }

.prod-thumb { display: block; background: #F1EFE8; }

.prod-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.prod-thumb--blank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  font-size: 30px;
  color: var(--brand);
  background: var(--brand-soft);
}

.prod-body { display: block; padding: 10px 12px 12px; }

.prod-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--ink);
}

.prod-desc {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.6;
}

.prod-go {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--brand);
}

.license-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.license img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.ent-foot { margin-top: 34px; text-align: center; }

.foot-note { margin: 14px 0 0; font-size: 12px; color: var(--ink-3); }

/* ---------- 空状态 ---------- */

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
  background: var(--card);
  border: 1px dashed var(--line-2);
  border-radius: 14px;
}

.empty-page { max-width: 420px; }

.empty-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--brand-soft);
  border: 1px solid #CFE4DC;
}

.empty-page h1 { font-size: 19px; margin-bottom: 8px; }
.empty-page p { margin: 0 0 20px; color: var(--ink-2); font-size: 14px; }

/* ---------- 图片放大 ---------- */

.lb {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 24, 22, .92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lb img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }

.lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- 动效层（fx-）：失败或被禁用时功能必须完整可用 ---------- */

@keyframes fx-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fx-ripple {
  from { opacity: .35; transform: scale(0); }
  to   { opacity: 0; transform: scale(2.6); }
}

@media (prefers-reduced-motion: no-preference) {
  html.fx-ready .fx-reveal { opacity: 0; }
  html.fx-ready .fx-reveal.is-in { animation: fx-up .4s ease-out both; }
  .fx-ripple {
    position: absolute;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    background: currentColor;
    pointer-events: none;
    animation: fx-ripple .5s ease-out forwards;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
