/**
 * LiverEvolution（內嵌於專題 index.html）
 * 滑桿外層半透明質感由 Tailwind utility 處理
 */

.section-placeholder.section-placeholder--liver {
  padding-top: clamp(28px, 4vw, 48px);
  padding-bottom: clamp(28px, 4vw, 48px);
}

.section-placeholder--liver .container--liver-evolution {
  max-width: 1120px;
}

#liver-evolution.liver-evolution {
  --le-bg: #eef2f6;
  --le-text: #1e293b;
  --le-muted: #64748b;
  --le-accent: #42a3e8;
  /* 與 .liver-evolution__range 拇指寬度一致，刻度才會對準停點 */
  --le-thumb-size: 22px;
  --le-thumb-half: 11px;
  box-sizing: border-box;
  padding: clamp(20px, 3vw, 32px) 0;
  margin: 0 -8px;
  background: linear-gradient(180deg, #fafaf7 0%, #f2f2ee 55%, #ecece8 100%);
  color: var(--le-text);
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

#liver-evolution.liver-evolution *,
#liver-evolution.liver-evolution *::before,
#liver-evolution.liver-evolution *::after {
  box-sizing: border-box;
}

.liver-evolution__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(12px, 2vw, 20px);
}

.liver-evolution__header {
  text-align: center;
  margin-bottom: clamp(16px, 2.5vw, 24px);
}

.liver-evolution__kicker {
  display: inline-block;
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--le-accent);
  font-weight: 600;
}

.liver-evolution__title {
  margin: 0;
  font-family: "Noto Serif TC", "Noto Sans TC", "Microsoft JhengHei", serif;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
  line-height: 1.35;
}

.liver-evolution__subtitle {
  margin: 8px auto 0;
  max-width: 40rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--le-muted);
}

.liver-evolution__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  grid-template-rows: auto auto;
  gap: clamp(16px, 2.5vw, 28px);
  align-items: center;
}

.liver-evolution__visual {
  grid-column: 1;
  grid-row: 1;
  display: block;
}

.liver-evolution__copy {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: 4px 0 0;
}

.liver-evolution__slider-block {
  grid-column: 1 / -1;
  grid-row: 2;
}

/* 滑桿區：無卡片外框／陰影，僅限制最大寬度與置中 */
.liver-evolution__slider-wrap {
  position: relative;
  width: 100%;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.evolution-slider__hint {
  display: block;
  width: fit-content;
  margin: 0 auto 13px;
  padding: 4px 15px !important;
  background-color: transparent !important;
  color: #111 !important;
  border: 1px solid #111 !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  font-weight: 600;
  text-align: center;
}

#liver-evolution .liver-evolution__stage-meta {
  display: none !important;
}

.liver-evolution__liver-wrap {
  position: relative;
  width: 100%;
  display: block;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.liver-evolution__liver-stack {
  position: relative;
  width: 100%;
  display: block;
  z-index: 1;
  border-radius: 0;
  overflow: visible;
}

.liver-evolution__liver-stack img {
  opacity: 0;
  will-change: opacity;
  pointer-events: none;
}

.liver-evolution__liver-stack img:first-child {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  display: block;
  object-fit: contain;
  object-position: 44% 50%;
}

.liver-evolution__liver-stack img:not(:first-child) {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: 44% 50%;
}

.liver-evolution__micro-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  z-index: 3;
  pointer-events: none;
}

.liver-evolution__micro-label {
  margin: 0 0 6px;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--le-muted);
  text-transform: uppercase;
}

.liver-evolution__micro-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  max-height: none;
}

.liver-evolution__stage-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.liver-evolution__stage-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  height: 2.25rem;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--le-accent);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 700;
}

.liver-evolution__stage-pill span {
  font-size: 0.8125rem;
  font-weight: 600;
  opacity: 0.9;
  margin-left: 2px;
}

.liver-evolution__stage-title {
  margin: 0 0 8px;
  font-family: "Noto Serif TC", "Noto Sans TC", serif;
  font-size: clamp(1.28rem, 2.2vw, 1.6rem);
  font-weight: 700;
  line-height: 1.35;
}

.liver-evolution__stage-desc {
  margin: 0;
  font-size: clamp(0.97rem, 1.55vw, 1.125rem);
  line-height: 1.75;
  color: #334155;
}

.liver-evolution__range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(66, 163, 232, 0.35) 0%,
    rgba(66, 163, 232, 0.35) 50%,
    rgba(255, 64, 19, 0.35) 50%,
    rgba(255, 64, 19, 0.35) 100%
  );
  outline: none;
}

.liver-evolution__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--le-thumb-size);
  height: var(--le-thumb-size);
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(66, 163, 232, 0.85);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.15);
  cursor: pointer;
  box-sizing: border-box;
}

.liver-evolution__range::-moz-range-thumb {
  width: var(--le-thumb-size);
  height: var(--le-thumb-size);
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(66, 163, 232, 0.85);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.15);
  cursor: pointer;
  box-sizing: border-box;
}

/*
 * 刻度與原生 range 停點對齊：拇指中心在
 * thumbHalf + (100% - thumbSize) * (index / 5)，index=0…5。
 * 勿用均分 flex，中心點與瀏覽器演算法不一致。
 */
.liver-evolution__ticks {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 10px;
  min-height: 3.25em;
  padding: 0;
  font-size: clamp(0.8125rem, 1.45vw, 0.96875rem);
  font-weight: 600;
  color: var(--le-muted);
}

.liver-evolution__tick {
  position: absolute;
  left: 0;
  top: 0;
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 12px;
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  border: none;
  border-radius: 8px;
  background: transparent;
}

.liver-evolution__tick:hover {
  color: var(--le-accent);
}

.liver-evolution__tick:focus {
  outline: none;
}

.liver-evolution__tick:focus-visible {
  outline: 2px solid var(--le-accent);
  outline-offset: 2px;
}

.liver-evolution__ticks .liver-evolution__tick:nth-child(1) {
  left: calc(var(--le-thumb-half) + (100% - var(--le-thumb-size)) * 0);
}

.liver-evolution__ticks .liver-evolution__tick:nth-child(2) {
  left: calc(var(--le-thumb-half) + (100% - var(--le-thumb-size)) * 0.2);
}

.liver-evolution__ticks .liver-evolution__tick:nth-child(3) {
  left: calc(var(--le-thumb-half) + (100% - var(--le-thumb-size)) * 0.4);
}

.liver-evolution__ticks .liver-evolution__tick:nth-child(4) {
  left: calc(var(--le-thumb-half) + (100% - var(--le-thumb-size)) * 0.6);
}

.liver-evolution__ticks .liver-evolution__tick:nth-child(5) {
  left: calc(var(--le-thumb-half) + (100% - var(--le-thumb-size)) * 0.8);
}

.liver-evolution__ticks .liver-evolution__tick:nth-child(6) {
  left: calc(var(--le-thumb-half) + (100% - var(--le-thumb-size)) * 1);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 768px) {
  #liver-evolution.liver-evolution {
    margin: 0;
  }

  .liver-evolution__grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 16px;
  }

  .liver-evolution__visual {
    grid-column: 1;
    grid-row: 1;
  }

  .liver-evolution__copy {
    grid-column: 1;
    grid-row: 2;
  }

  .liver-evolution__slider-block {
    grid-column: 1;
    grid-row: 3;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .liver-evolution__micro-wrap {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
  }

  .evolution-slider__hint {
    font-size: 10px !important;
    padding: 3px 12px !important;
    margin-bottom: 11px;
  }
}
