/**
 * Annual Report Template Styles
 * 
 * 年度榜单模板的静态样式
 * 动态样式（需要 PHP 变量的部分）保留在模板内联
 */

/* CSS 变量 */
:root {
  --color-primary: #b10505;
  --color-bg-dark: #101010;
  --color-bg-card: #1a1a1a;
  --color-text: rgba(255, 255, 255, 0.9);
  --color-text-muted: rgba(255, 255, 255, 0.8);
  --color-close-bg: #929292;

  /* 动画时长 */
  --transition-fast: 0.15s;
  --transition-normal: 0.3s;
  --transition-slow: 0.5s;
}

/* 基础样式 */
html {
  font-size: clamp(16px, 1.2vw + 0.5rem, 18px);
  line-height: 1.8;
  scroll-behavior: smooth;
}

body.annual-report-template {
  margin: 0;
  padding: 0;
  font-family: "Noto Serif SC", "Songti SC", "Source Han Serif SC", serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  background-color: var(--color-bg-dark);
}

/* 页面结构 */
.header,
.cover {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #181818;
}

.header {
  height: 60px;
}

.cover {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 60px);
  min-height: calc(100svh - 60px);
  min-height: calc(100lvh - 60px);
  min-height: calc(100dvh - 60px);
  background-size: contain;
  background-position: center;
}

.cover img {
  position: relative;
  width: 75vw;
  top: -30px;
  height: auto;
  display: block;
}

.section {
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100lvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  padding: 4rem 1.5rem;
  /* 默认深色背景，JS 会动态设置渐变 */
  background-color: var(--color-bg-dark);
}

/* Section 内容入场动画（模糊到清晰） */
.section > * {
  width: 100%;
  max-width: 360px;
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  filter: blur(4px);
  transition: opacity var(--transition-slow) ease-out,
              transform var(--transition-slow) ease-out,
              filter var(--transition-slow) ease-out;
}

.section.visible > * {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* 大段文本使用打字机效果 */
.section.intro h2,
.section.intro p,
.section .text-with-line-break,
.award-description {
  clip-path: inset(0 100% 0 0);
  filter: none;
  transform: none;
  transition: opacity var(--transition-slow) ease-out,
              clip-path 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.section.visible.intro h2,
.section.visible.intro p,
.section.visible .text-with-line-break,
.section.visible .award-description {
  clip-path: inset(0 0 0 0);
  filter: none;
  transform: none;
}

/* 错开子元素动画 */
.section.visible > *:nth-child(1) { transition-delay: 0.05s; }
.section.visible > *:nth-child(2) { transition-delay: 0.1s; }
.section.visible > *:nth-child(3) { transition-delay: 0.15s; }
.section.visible > *:nth-child(4) { transition-delay: 0.2s; }

.section img {
  width: auto;
  height: auto;
}

.section.intro {
  padding: 4rem 4rem;
}

@media (min-width: 800px) {
  .section > * {
    max-width: 400px;
  }
}

.text-with-line-break {
  white-space: pre-line;
}

.section-icon {
  margin-bottom: 1rem;
}

.section-icon[src*="quote"] {
  width: 22px;
  height: 27px;
}

.section-icon[src*="bubble"] {
  width: 27px;
  height: 27px;
}

.outro-text {
  font-size: 1.5rem;
  text-align: center;
}

/* 奖项区块 */
.award-block {
  text-align: center;
}

.award-header {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.award-title {
  display: flex;
  line-height: 1.5em;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.award-header::before,
.award-header::after {
  content: "";
  width: 26px;
  height: 43px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

.award-description {
  font-size: 1.25rem;
  margin-bottom: 2rem;
}

.winners-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 34px;
}

.winner-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0;
  padding: 0;
  opacity: 0;
  /* 恢复模糊到清晰效果 */
  transform: translateY(20px);
  transition: opacity var(--transition-normal) ease-out,
    transform var(--transition-normal) ease-out;
}

.winner-item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 错开动画 */
.winner-item:nth-child(1) {
  transition-delay: 0.1s;
}
.winner-item:nth-child(2) {
  transition-delay: 0.2s;
}
.winner-item:nth-child(3) {
  transition-delay: 0.3s;
}
.winner-item:nth-child(4) {
  transition-delay: 0.4s;
}
.winner-item:nth-child(5) {
  transition-delay: 0.5s;
}

.winner-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.winner-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.winner-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.winner-cta,
.author-award-cta,
.comment-form .form-submit input[type="submit"] {
  display: flex;
  justify-content: center;
  padding: 8px 0;
  background: var(--color-primary);
  border-radius: 100px;
  text-decoration: none;
  color: inherit;
  font-size: 0.875rem;
  transition: transform var(--transition-fast) ease-out,
    box-shadow var(--transition-fast) ease-out,
    background var(--transition-fast) ease-out;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
}

/* 按钮点击效果 */
.winner-cta:active:not(.disabled),
.author-award-cta:active:not(.disabled),
.comment-form .form-submit input[type="submit"]:active {
  transform: scale(0.96);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 按钮悬停效果（桌面端）*/
@media (hover: hover) {
  .winner-cta:hover:not(.disabled),
  .author-award-cta:hover:not(.disabled),
  .comment-form .form-submit input[type="submit"]:hover {
    background: #c50606;
    box-shadow: 0 4px 12px rgba(177, 5, 5, 0.3);
  }
}

/* 按钮涟漪效果 */
.winner-cta::before,
.author-award-cta::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.winner-cta:active::before,
.author-award-cta:active::before {
  width: 300px;
  height: 300px;
}

.author-award-cta {
  margin-top: 2rem;
  padding: 10px 0;
}

.author-award-cta.disabled,
.speech-submit.disabled {
  background: #666;
  opacity: 0.7;
  pointer-events: none;
  cursor: not-allowed;
}

.winner-title {
  display: block;
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: bold;
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--transition-fast) ease-out,
    transform var(--transition-fast) ease-out;
  position: relative;
  padding: 4px 0;
  margin: -4px 0;
}

/* 增大点击区域 */
.winner-title::before {
  content: "";
  position: absolute;
  inset: -8px;
}

@media (hover: hover) {
  .winner-title:hover {
    color: var(--color-primary);
    transform: translateX(4px);
  }
}

.winner-title:active {
  transform: scale(0.98);
}

.winner-meta {
  opacity: 0.8;
  font-size: 0.9em;
}

.winner-speech-preview {
  margin-top: 8px;
  text-align: left;
}

.winner-speech-preview .speech-text {
  margin: 0;
  opacity: 0.8;
  font-size: 0.9em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.winner-speech-preview .speech-expand {
  display: inline-block;
  margin-top: 4px;
  color: inherit;
  opacity: 0.6;
  font-size: 0.875em;
  text-decoration: underline;
  transition: opacity var(--transition-fast) ease-out,
    transform var(--transition-fast) ease-out;
  cursor: pointer;
  padding: 4px 0;
  position: relative;
}

/* 增大点击区域 */
.winner-speech-preview .speech-expand::before {
  content: "";
  position: absolute;
  inset: -8px;
}

@media (hover: hover) {
  .winner-speech-preview .speech-expand:hover {
    opacity: 1;
  }
}

.winner-speech-preview .speech-expand:active {
  transform: scale(0.96);
}

.winner-review-link {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  background: linear-gradient(
    135deg,
    #a8a8a8 0%,
    #c0c0c0 25%,
    #8a8a8a 50%,
    #b8b8b8 75%,
    #9a9a9a 100%
  );
  color: #333;
  font-size: 0.875rem;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform var(--transition-fast) ease-out,
    box-shadow var(--transition-fast) ease-out,
    filter var(--transition-fast) ease-out;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

/* 刮刮卡悬停效果 */
@media (hover: hover) {
  .winner-review-link:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }
}

.winner-review-link:active {
  transform: scale(0.95);
  filter: brightness(0.9);
}

.winner-eros {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.eros-label {
  font-size: 0.75em;
}

.eros-value {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 37px;
}

.eros-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  /* transform 由动画控制，不在这里设置 */
  width: 40px;
  height: auto;
}

.eros-number {
  position: relative;
  z-index: 1;
  font-size: 0.875rem;
  margin-top: -2px;
}

.winner-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  margin-top: 6px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  color: var(--color-text);
  padding-bottom: 2px;
  transition: transform var(--transition-normal) ease-out;
}

/* 奖牌动画（移除旋转，仅保留缩放） */
.winner-item.visible .winner-rank {
  animation: medalScale 0.4s ease-out;
}

@keyframes medalScale {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.winner-rank[data-rank="1"],
.winner-rank[data-rank="2"],
.winner-rank[data-rank="3"] {
  color: #000;
}

/* 收藏点赞 */
.annual-actions {
  color: #fff;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  background: #011616;
}

.annual-actions .simplefavorite-button.preset {
  background-color: #aab8c2;
  color: #fff;
}

.annual-actions .simplefavorite-button.preset.active {
  background-color: #e2264d;
  color: #fff;
}

.annual-actions .simplefavorite-button.preset i {
  top: 0.5em;
}

/* 评论区 */
.annual-comments {
  background: var(--color-bg-dark);
}

.annual-comments a {
  color: var(--color-text) !important;
}

.annual-comments > * {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

.comment-form-comment textarea,
.comment-form-author input {
  margin-top: 10px;
}

/* 覆盖各种状态的链接样式 */
.annual-comments a:link,
.annual-comments a:visited,
.annual-comments a:hover,
.annual-comments a:active {
  color: var(--color-text) !important;
}

.annual-comments textarea,
.annual-comments input[type="text"],
.annual-comments input[type="email"],
.annual-comments input[type="url"] {
  width: 100%;
  box-sizing: border-box;
}

.comment-list,
ol.children {
  list-style: none;
  padding: 0;
}

.comment-list li {
  margin-top: 50px;
}

.comment-list li:first-child {
  margin-top: 0;
}

.annual-comments ol.children {
  border-left: 5px solid #282828;
  padding: 20px;
  margin-top: 20px;
}

.comment-policy {
  border-top: 5px solid #333;
  border-bottom: 5px solid #333;
  margin-top: 100px;
}

.annual-comments .comment-metadata a {
  color: rgb(149 149 149 / 80%) !important;
  text-decoration: none !important;
  font-size: 0.875rem;
}

.comment-form .form-submit input[type="submit"] {
  width: 100%;
  font-family: inherit;
  border: none;
}

.wpulike {
  height: initial;
}

/* Bottom Sheet */
.bottom-sheet {
  position: fixed;
  inset: 0;
  padding: 0;
  border: none;
  background: transparent;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  color: var(--color-text);
}

.bottom-sheet::backdrop {
  background: rgba(0, 0, 0, 0.5);
  transition: opacity 0.5s ease-out;
}

.bottom-sheet.closing::backdrop {
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

.bottom-sheet-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 90%;
  max-height: 90%;
  background: var(--color-bg-card);
  border-radius: 22px 22px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  /* 统一滑入和滑出速度 */
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-sheet[open] .bottom-sheet-container {
  transform: translateY(0);
}

/* 关闭动画 */
.bottom-sheet.closing .bottom-sheet-container {
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-sheet.fit-content .bottom-sheet-container {
  height: auto;
  max-height: 90vh;
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  position: relative;
  flex-shrink: 0;
}

.bottom-sheet-close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-close-bg);
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--color-bg-card);
  line-height: 1;
  transition: transform var(--transition-fast) ease-out,
    background var(--transition-fast) ease-out;
}

@media (hover: hover) {
  .bottom-sheet-close:hover {
    background: #7a7a7a;
    transform: rotate(90deg);
  }
}

.bottom-sheet-close:active {
  transform: scale(0.9) rotate(90deg);
}

.bottom-sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.5rem 1.5rem;
}

/* 登录提示 */
.login-prompt {
  padding: 1rem 0 2rem;
}

.login-prompt h2 {
  margin: 0 0 1rem;
  text-align: center;
}

.login-prompt p {
  margin: 0 0 1.5rem;
  opacity: 0.8;
}

/* 获奖感言输入 */
.speech-form {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.speech-textarea,
.comment-form-comment textarea,
.comment-form-author input {
  flex: 1;
  width: 100%;
  padding: 1rem;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  resize: none;
  border-radius: 8px;
  box-sizing: border-box;
}

.speech-textarea::placeholder,
.comment-form-comment textarea::placeholder,
.comment-form-author input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.speech-textarea:focus,
.comment-form-comment textarea:focus,
.comment-form-author input:focus {
  outline: none;
}

.speech-submit {
  margin-top: 1rem;
  flex-shrink: 0;
}

/* 图片加载骨架屏 */
img {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

img[src] {
  animation: none;
  background: none;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* 封面视差效果 */
.cover img {
  transition: transform 0.1s ease-out;
  will-change: transform;
}

/* 色气度心形动画 - 模拟真实心脏跳动节奏 */
.eros-heart {
  /* 随机延迟启动动画，让每个心心的跳动不同步 */
  animation: heartbeat 2.4s ease-in-out infinite !important;
  animation-delay: calc(var(--random-delay, 0) * 1s) !important;
}

/* 真实心脏跳动：双跳模式（lub-dub） */
@keyframes heartbeat {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  /* 第一次跳动（lub） */
  10% {
    transform: translate(-50%, -50%) scale(1.15);
  }
  20% {
    transform: translate(-50%, -50%) scale(1);
  }
  /* 第二次跳动（dub） */
  28% {
    transform: translate(-50%, -50%) scale(1.12);
  }
  36% {
    transform: translate(-50%, -50%) scale(1);
  }
  /* 休息期 */
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

/* 奖项标题入场动画（恢复缩放效果） */
.award-header {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--transition-normal) ease-out,
    transform var(--transition-normal) ease-out;
}

.section.visible .award-header {
  opacity: 1;
  transform: scale(1);
}

/* 月桂叶动画 */
.award-header::before,
.award-header::after {
  opacity: 0;
  transition: transform var(--transition-slow) ease-out;
}

/* 左侧月桂叶：从左向右滑入 */
.section.visible .award-header::before {
  animation: leafSlideInLeft 0.6s ease-out 0.2s both;
}

/* 右侧月桂叶：从右向左滑入 */
.section.visible .award-header::after {
  animation: leafSlideInRight 0.6s ease-out 0.2s both;
}

@keyframes leafSlideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes leafSlideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 加载状态指示器 */
.loading-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.loading-indicator.visible {
  opacity: 1;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 焦点样式优化 */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
}

/* 文本选择样式 */
::selection {
  background: var(--color-primary);
  color: #fff;
}

::-moz-selection {
  background: var(--color-primary);
  color: #fff;
}

/* 滚动条样式（Webkit） */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 提升触摸滚动性能 */
.bottom-sheet-content,
.section {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* 防止文本溢出 */
.winner-title,
.winner-meta,
.speech-text {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* 减少动画对性能的影响 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}
