/* =========================================================
   诗词下载页 — 国风移动优先样式
   ========================================================= */

:root {
  /* 色彩 */
  --color-paper: #f3ebe0;
  --color-paper-deep: #e8dcc8;
  --color-ink: #1a1a1a;
  --color-ink-soft: #3d3a36;
  --color-ink-muted: #6b6560;
  --color-teal: #2f6b63;
  --color-teal-soft: #4a8f85;
  --color-teal-wash: rgba(47, 107, 99, 0.12);
  --color-gold: #a67c42;
  --color-gold-deep: #8a6434;
  --color-gold-soft: rgba(166, 124, 66, 0.18);
  --color-mist: rgba(255, 252, 247, 0.55);
  --color-scroll: #d9cbb4;
  --color-danger-soft: #8a4a3a;

  /* 字体：系统中文字体优先，避免外链阻塞 */
  --font-display: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
    "Microsoft YaHei", "Segoe UI", sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-soft: 0 10px 30px rgba(40, 30, 20, 0.08);
  --max-read: 28rem;
  --header-h: 3.25rem;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --focus-ring: 0 0 0 3px rgba(47, 107, 99, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  background-color: var(--color-paper);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -10%, rgba(255, 255, 255, 0.55), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 20%, rgba(74, 143, 133, 0.08), transparent 50%),
    radial-gradient(ellipse 70% 40% at 0% 60%, rgba(166, 124, 66, 0.06), transparent 45%),
    url("../assets/illustrations/paper-texture.svg");
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--color-teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--color-teal-soft);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--color-ink);
  color: var(--color-paper);
  text-decoration: none;
  transition: top 0.2s var(--ease-out);
}

.skip-link:focus {
  top: 0.75rem;
}

/* ---------- 背景装饰层 ---------- */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.scene__mountains {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: min(42vh, 320px);
  opacity: 0.55;
}

.scene__clouds {
  position: absolute;
  inset: 8% -10% auto;
  width: 120%;
  height: 28%;
  opacity: 0.35;
  animation: cloud-drift 48s linear infinite;
}

.scene__bamboo {
  position: absolute;
  top: 12%;
  width: min(22vw, 140px);
  height: auto;
  opacity: 0.28;
  transform-origin: bottom center;
  animation: bamboo-sway 7s ease-in-out infinite;
}

.scene__bamboo--left {
  left: -2%;
}

.scene__bamboo--right {
  right: -2%;
  animation-delay: -2.5s;
  transform: scaleX(-1);
}

@keyframes cloud-drift {
  from { transform: translateX(-4%); }
  to { transform: translateX(4%); }
}

@keyframes bamboo-sway {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.8deg); }
}

.scene__bamboo--right {
  animation-name: bamboo-sway-flip;
}

@keyframes bamboo-sway-flip {
  0%, 100% { transform: scaleX(-1) rotate(-1.5deg); }
  50% { transform: scaleX(-1) rotate(1.8deg); }
}

/* ---------- 布局壳 ---------- */
.page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.shell {
  width: min(100% - 2rem, var(--max-read));
  margin-inline: auto;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(243, 235, 224, 0.92), rgba(243, 235, 224, 0.72));
  border-bottom: 1px solid rgba(61, 58, 54, 0.08);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(100% - 2rem, var(--max-read));
  margin-inline: auto;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark__icon {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 22%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(40, 30, 20, 0.12);
}

.brand-mark__name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-switch {
  position: relative;
}

.lang-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(61, 58, 54, 0.18);
  border-radius: 999px;
  background: var(--color-mist);
  color: var(--color-ink-soft);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.lang-switch__btn:hover {
  border-color: var(--color-teal);
  color: var(--color-teal);
}

.lang-switch__chevron {
  width: 0.7rem;
  height: 0.7rem;
  opacity: 0.7;
}

.lang-switch__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 9.5rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: var(--radius-md);
  background: #fffaf3;
  border: 1px solid rgba(61, 58, 54, 0.12);
  box-shadow: var(--shadow-soft);
  display: none;
}

.lang-switch__menu.is-open {
  display: block;
}

.lang-switch__option {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-ink-soft);
  font: inherit;
  font-size: 0.9rem;
  text-align: start;
  cursor: pointer;
}

.lang-switch__option:hover,
.lang-switch__option[aria-current="true"] {
  background: var(--color-teal-wash);
  color: var(--color-teal);
}

/* ---------- 主内容 ---------- */
main {
  flex: 1;
  padding-bottom: 2.5rem;
}

.hero {
  padding: 1.75rem 0 1.25rem;
  text-align: center;
}

.hero__icon-wrap {
  width: 5.5rem;
  height: 5.5rem;
  margin: 0 auto 1.1rem;
  border-radius: 24%;
  overflow: hidden;
  background: transparent;
  box-shadow:
    0 12px 28px rgba(40, 30, 20, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  display: grid;
  place-items: center;
  animation: hero-rise 0.9s var(--ease-out) both;
}

.hero__icon {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
}

.hero__title {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  animation: hero-rise 0.9s var(--ease-out) 0.08s both;
}

.hero__slogan {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 3.8vw, 1.25rem);
  color: var(--color-teal);
  letter-spacing: 0.06em;
  animation: hero-rise 0.9s var(--ease-out) 0.14s both;
}

.hero__tagline {
  margin: 0 auto;
  max-width: 22rem;
  color: var(--color-ink-muted);
  font-size: 0.95rem;
  animation: hero-rise 0.9s var(--ease-out) 0.2s both;
}

.hero__ornament {
  width: min(12rem, 60%);
  margin: 1.25rem auto 0;
  opacity: 0.55;
  animation: hero-rise 0.9s var(--ease-out) 0.26s both;
}

@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- 功能卡 ---------- */
.features {
  padding: 0.5rem 0 1.5rem;
}

.section-head {
  text-align: center;
  margin-bottom: 1.1rem;
}

.section-head__title {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.08em;
}

.section-head__hint {
  margin: 0;
  color: var(--color-ink-muted);
  font-size: 0.85rem;
}

.feature-list {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-card {
  position: relative;
  border: 1px solid rgba(61, 58, 54, 0.1);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(165deg, rgba(255, 252, 247, 0.92), rgba(243, 235, 224, 0.78));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}

.feature-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.feature-card:nth-child(1).is-visible { transition-delay: 0.05s; }
.feature-card:nth-child(2).is-visible { transition-delay: 0.12s; }
.feature-card:nth-child(3).is-visible { transition-delay: 0.19s; }

.feature-card:hover {
  box-shadow: 0 14px 34px rgba(40, 30, 20, 0.12);
}

.feature-card__toggle {
  display: grid;
  grid-template-columns: 4.25rem 1fr auto;
  gap: 0.85rem;
  align-items: center;
  width: 100%;
  padding: 1rem 1rem 1rem 0.9rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.feature-card__art {
  width: 4.25rem;
  height: 4.25rem;
  border-radius: var(--radius-md);
  background: var(--color-teal-wash);
  display: grid;
  place-items: center;
}

.feature-card__art svg {
  width: 3rem;
  height: 3rem;
}

.feature-card__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.feature-card__title {
  display: block;
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--color-ink);
}

.feature-card__benefit {
  display: block;
  margin: 0;
  color: var(--color-ink-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.feature-card__chevron {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--color-teal);
  transition: transform 0.3s var(--ease-out);
  flex-shrink: 0;
}

.feature-card.is-open .feature-card__chevron {
  transform: rotate(180deg);
}

.feature-card__detail {
  display: none;
  margin: 0;
  padding: 0 1.1rem 1.1rem 1rem;
  color: var(--color-ink-soft);
  font-size: 0.9rem;
  line-height: 1.7;
  border-top: 1px dashed rgba(61, 58, 54, 0.12);
  padding-top: 0.85rem;
}

.feature-card.is-open .feature-card__detail {
  display: block;
  animation: detail-in 0.35s var(--ease-out);
}

@keyframes detail-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feature-card--read .feature-card__art { background: rgba(47, 107, 99, 0.12); }
.feature-card--appreciate .feature-card__art { background: rgba(166, 124, 66, 0.14); }
.feature-card--quiz .feature-card__art { background: rgba(90, 110, 140, 0.14); }

/* ---------- 下载区 ---------- */
.download {
  padding: 0.25rem 0 1.5rem;
}

.download__panel {
  position: relative;
  padding: 1.35rem 1.15rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(166, 124, 66, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.95), rgba(243, 235, 224, 0.88));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.download__panel::before {
  content: "";
  position: absolute;
  inset: 0.45rem;
  border: 1px solid rgba(166, 124, 66, 0.16);
  border-radius: calc(var(--radius-lg) - 4px);
  pointer-events: none;
}

.download__title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-align: center;
}

.download__hint {
  margin: 0 0 1.15rem;
  text-align: center;
  color: var(--color-ink-muted);
  font-size: 0.85rem;
}

.platform-list {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.platform-btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), background 0.2s;
}

.platform-btn:active {
  transform: scale(0.985);
}

.platform-btn__meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.platform-btn__label {
  font-weight: 600;
  font-size: 1rem;
}

.platform-btn__sub {
  font-size: 0.8rem;
  opacity: 0.85;
}

.platform-btn__icon {
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
}

.platform-btn--ios {
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-deep));
  color: #fffaf3;
  box-shadow: 0 8px 20px rgba(138, 100, 52, 0.28);
}

.platform-btn--ios:hover {
  box-shadow: 0 10px 24px rgba(138, 100, 52, 0.36);
}

.platform-btn--harmony {
  background: linear-gradient(135deg, var(--color-teal-soft), var(--color-teal));
  color: #fffaf3;
  box-shadow: 0 8px 20px rgba(47, 107, 99, 0.28);
}

.platform-btn--harmony:hover {
  box-shadow: 0 10px 24px rgba(47, 107, 99, 0.36);
}

.platform-btn--secondary {
  background: rgba(255, 252, 247, 0.75);
  border-color: rgba(61, 58, 54, 0.14);
  color: var(--color-ink-soft);
}

.platform-btn--secondary:hover {
  border-color: rgba(47, 107, 99, 0.35);
  background: #fff;
}

.platform-btn--secondary .platform-btn__sub {
  color: var(--color-ink-muted);
}

.platform-btn.is-emphasized {
  outline: 2px solid rgba(47, 107, 99, 0.35);
  outline-offset: 2px;
}

.platform-btn--ios.is-emphasized,
.platform-btn--harmony.is-emphasized {
  outline-color: rgba(255, 250, 240, 0.55);
}

/* 设备检测：弱化非当前平台（仅移动端） */
body[data-device="ios"] .platform-btn--android,
body[data-device="ios"] .platform-btn--harmony {
  opacity: 0.78;
}

body[data-device="harmony"] .platform-btn--ios,
body[data-device="harmony"] .platform-btn--android {
  opacity: 0.78;
}

body[data-device="android"] .platform-btn--ios,
body[data-device="android"] .platform-btn--harmony {
  opacity: 0.78;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 50;
  width: min(calc(100% - 2rem), 22rem);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(26, 26, 26, 0.92);
  color: #f7f2ea;
  font-size: 0.9rem;
  line-height: 1.5;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, 120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease-out), opacity 0.35s var(--ease-out);
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.toast__row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.toast__message {
  flex: 1;
  margin: 0;
}

.toast__close {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

/* ---------- 微信引导层 ---------- */
.wechat-banner {
  display: none;
  position: sticky;
  top: var(--header-h);
  z-index: 25;
  padding: 0.55rem 1rem;
  background: rgba(138, 100, 52, 0.95);
  color: #fffaf3;
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
}

body.is-wechat .wechat-banner {
  display: block;
}

body.is-wechat .wechat-banner[hidden] {
  display: block;
}

.wechat-guide {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}

.wechat-guide.is-visible {
  display: block !important;
}

.wechat-guide__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(18, 16, 14, 0.72);
  cursor: pointer;
}

.wechat-guide__panel {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  left: 0.85rem;
  max-width: 22rem;
  margin-left: auto;
  padding: 1.15rem 1.1rem 1.2rem;
  border-radius: var(--radius-lg);
  background: #fffaf3;
  color: var(--color-ink);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.wechat-guide__arrow {
  position: absolute;
  top: -0.15rem;
  right: 0.85rem;
  width: 4.5rem;
  height: 3rem;
  color: #fffaf3;
  pointer-events: none;
}

.wechat-guide__corner {
  margin: 0 0 0.55rem;
  color: var(--color-gold-deep);
  font-size: 0.9rem;
  font-weight: 600;
}

.wechat-guide__title {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.wechat-guide__body {
  margin: 0 0 1rem;
  color: var(--color-ink-soft);
  font-size: 0.92rem;
  line-height: 1.65;
}

.wechat-guide__btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-deep));
  color: #fffaf3;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- 页脚 ---------- */
.footer {
  padding: 1.25rem 0 2rem;
  text-align: center;
  color: var(--color-ink-muted);
  font-size: 0.8rem;
}

.footer__links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0 0 0.65rem;
}

.footer__links a {
  color: var(--color-ink-muted);
}

.footer__links a:hover {
  color: var(--color-teal);
}

.footer__meta {
  margin: 0;
  line-height: 1.6;
}

.footer__beian {
  margin: 0.45rem 0 0;
  line-height: 1.5;
}

.footer__beian a {
  color: var(--color-ink-muted);
  text-decoration: none;
}

.footer__beian a:hover {
  color: var(--color-teal);
  text-decoration: underline;
}

.footer__divider {
  opacity: 0.4;
}

/* ---------- 桌面增强 ---------- */
@media (min-width: 720px) {
  :root {
    --max-read: 34rem;
  }

  .hero {
    padding-top: 2.5rem;
  }

  .feature-list {
    gap: 1rem;
  }

  .download__panel {
    padding: 1.6rem 1.4rem 1.45rem;
  }

  .scene__bamboo {
    opacity: 0.34;
    width: min(16vw, 160px);
  }
}

@media (min-width: 960px) {
  .scene__mountains {
    opacity: 0.45;
  }
}

/* 打印简化 */
@media print {
  .scene,
  .topbar,
  .toast {
    display: none !important;
  }

  body {
    background: white;
  }
}

/* ---- layout audit fixes (2026-10-19) ---- */
.skip-link{min-height:44px;display:inline-flex;align-items:center;box-sizing:border-box}
.brand-mark{min-height:44px}
.lang-switch__btn{min-height:44px;padding:0 0.95rem;box-sizing:border-box}
.lang-switch__option{min-height:44px}
.toast__row{align-items:center}
.toast__close{width:44px;height:44px;margin:-10px -10px -10px 0;background:transparent;display:inline-flex;align-items:center;justify-content:center;font-size:1.15rem}
.toast__close::before{content:"";position:absolute;width:26px;height:26px;border-radius:50%;background:rgba(255,255,255,.14);z-index:-1}
.toast__close{position:relative;isolation:isolate}
.platform-btn{min-height:56px}
.platform-btn--ios{background:linear-gradient(135deg,#8f6738,var(--color-gold-deep))}
.platform-btn--harmony{background:linear-gradient(135deg,#377569,var(--color-teal))}
.platform-btn--ios .platform-btn__sub,.platform-btn--harmony .platform-btn__sub{opacity:1}
h1,h2,h3{text-wrap:balance}
footer,.footer{text-wrap:pretty}
@media (max-width:420px){
  .brand-mark{gap:.5rem}
  .brand-mark__name{font-size:.95rem;letter-spacing:.02em;white-space:normal;line-height:1.2;overflow:visible;text-overflow:clip}
}
