/* ═══════════════════════════════════════════════
   TNC NEWS — ANIMATIONS.CSS
   台灣網路觀察新聞網 Animation Styles
═══════════════════════════════════════════════ */

/* ── Intro Overlay ── */
#intro-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1), visibility 1s ease;
  overflow: hidden;
}

/* 背景靜態光暈（中心輻射，無動畫） */
#intro-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 55% 45% at 50% 50%,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.01) 40%,
    transparent 70%);
  pointer-events: none;
}

#intro-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-content {
  text-align: center;
  color: #fff;
  position: relative;
  z-index: 1;
}

/* 頂部細線 */
.intro-content::before {
  content: '';
  display: block;
  width: 1px;
  height: 0;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.3), transparent);
  margin: 0 auto 28px;
  transition: height 0.8s ease;
}

.intro-content.animate-line::before {
  height: 48px;
}

/* Logo wrap with side bars */
.intro-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 20px;
  overflow: hidden;
}

.intro-bar {
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  transition: width 0.9s cubic-bezier(0.77, 0, 0.175, 1);
}

.intro-bar--left { transform-origin: right; }
.intro-bar--right { transform-origin: left; }

.intro-bar.animate {
  width: 80px;
}

.intro-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transition: opacity 0.7s ease 0.4s, transform 0.7s cubic-bezier(0.23,1,0.32,1) 0.4s;
}

.intro-brand.animate {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.intro-tnc {
  font-family: 'Inter', sans-serif;
  font-size: clamp(52px, 10vw, 90px);
  font-weight: 900;
  letter-spacing: 14px;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 60px rgba(255,255,255,0.08);
}

.intro-news {
  font-family: 'Inter', sans-serif;
  font-size: clamp(12px, 2.5vw, 17px);
  font-weight: 200;
  letter-spacing: 16px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  margin-top: 6px;
}

/* 底部裝飾線 */
.intro-rule {
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  margin: 18px auto 0;
  transition: width 0.8s ease 0.9s;
}

.intro-rule.animate {
  width: 200px;
}

/* Subtitle */
.intro-sub {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 13px;
  font-weight: 300;
  color: rgba(255,255,255,0.35);
  line-height: 2;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s ease 0.9s, transform 0.7s ease 0.9s;
  letter-spacing: 2px;
  margin-top: 8px;
}

.intro-sub.animate {
  opacity: 1;
  transform: translateY(0);
}

.intro-sub span {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.2);
  display: block;
}

/* Loader dots */
.intro-loader {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 40px;
  opacity: 0;
  transition: opacity 0.4s ease 1.3s;
}

.intro-loader.animate {
  opacity: 1;
}

.intro-loader span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  animation: loaderPulse 1.4s ease-in-out infinite;
}

.intro-loader span:nth-child(2) { animation-delay: 0.25s; }
.intro-loader span:nth-child(3) { animation-delay: 0.5s; }

@keyframes loaderPulse {
  0%, 80%, 100% { opacity: 0.15; transform: scale(0.7); }
  40% { opacity: 0.9; transform: scale(1.2); }
}

/* ── Site Wrapper Entry ── */
#site-wrapper {
  opacity: 1;
  transition: opacity 0.6s ease;
}

#site-wrapper.hidden {
  opacity: 0;
}

#site-wrapper.visible {
  opacity: 1;
}

/* ── Scroll reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ── Header slide down ── */
@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.site-header {
  animation: slideDown 0.6s cubic-bezier(0.23, 1, 0.32, 1) both;
  animation-play-state: paused;
}

.site-header.play {
  animation-play-state: running;
}

/* ── Breaking bar slide in ── */
@keyframes slideRight {
  from { transform: translateX(-40px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

.breaking-bar {
  animation: slideRight 0.7s ease 0.2s both;
  animation-play-state: paused;
}

.breaking-bar.play {
  animation-play-state: running;
}

/* ── News ticker ── */
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-track {
  display: inline-flex;
  white-space: nowrap;
  animation: tickerScroll 20s linear infinite;
}

.ticker-track span {
  padding-right: 60px;
}

/* ── Card hover lift ── */
.news-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
}

/* ── Nav underline ── */
.main-nav a::after {
  content: '';
  display: block;
  height: 2px;
  background: #fff;
  width: 0;
  transition: width 0.3s ease;
  margin-top: 2px;
}

.main-nav a:hover::after,
.main-nav a.active::after {
  width: 100%;
}

/* ── Back to top pulse ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.back-to-top.show {
  animation: fadeInUp 0.4s ease forwards;
}

/* ── Search bar slide ── */
.search-bar {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.23, 1, 0.32, 1),
              opacity 0.4s ease;
  opacity: 0;
}

.search-bar.open {
  max-height: 80px;
  opacity: 1;
}

/* ── Hamburger to X ── */
.hamburger span {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}


/* ══════════════════════════════════════════════════════════
   MODERN EFFECTS — 現代質感效果層
   TNC NEWS v2 — Natural Dark Enhancement
══════════════════════════════════════════════════════════ */

/* ── 1. Grain noise 全域噪點底紋（極細微，增加質感） ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 220px 220px;
}

/* ── 2. 卡片 hover 邊框微光 + 陰影提升 ── */
.news-card:hover {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.3);
  border-color: #2c2c2c;
}

/* ── 3. 卡片圖片 placeholder hover 微亮 ── */
.news-card:hover .card-img--placeholder {
  background: #141414;
}
.card-img--placeholder {
  transition: background 0.35s ease;
}
.news-card:hover .placeholder-icon {
  color: #383838;
}
.placeholder-icon {
  transition: color 0.35s ease;
}

/* ── 4. 卡片圖片區頂角高光遮罩（增加立體感） ── */
.card-img--placeholder {
  position: relative;
}
.card-img--placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.018) 0%,
    transparent 50%
  );
  pointer-events: none;
  z-index: 1;
}

/* ── 5. Breaking bar LIVE 閃爍紅點 ── */
.breaking-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #e03535;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  animation: livePulse 2s ease-in-out infinite;
}

.live-dot::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(224, 53, 53, 0.25);
  animation: liveRing 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

@keyframes liveRing {
  0%, 100% { transform: scale(1);   opacity: 0.4; }
  50%       { transform: scale(1.6); opacity: 0; }
}

/* ── 6. 分類標題 accent bar 微光 ── */
.cat-accent {
  box-shadow:
    0 0 6px rgba(255, 255, 255, 0.18),
    0 0 14px rgba(255, 255, 255, 0.06);
}

/* ── 7. 導覽列 active 底線微光 ── */
.main-nav a.active::after,
.main-nav a:hover::after {
  box-shadow: 0 1px 5px rgba(255, 255, 255, 0.25);
}

/* ── 8. Widget header 細微漸層 ── */
.widget-header {
  background: linear-gradient(90deg, #111111 0%, #131313 100%);
  position: relative;
}
.widget-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 18px;
  right: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
}

/* ── 9. Sidebar wn-img hover 微亮 ── */
.wn-item:hover .wn-img {
  background: #161616;
  border-color: #2a2a2a;
  color: #555;
}
.wn-img {
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* ── 10. Hot rank 前三名質感 ── */
.hot-item:nth-child(1) .hot-rank {
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
  letter-spacing: 0;
}

/* ── 11. 自訂捲動條（細、深色） ── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: #090909;
}
::-webkit-scrollbar-thumb {
  background: #232323;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #333;
}

/* ── 12. Header scroll blur 類別（JS 加掛） ── */
.site-header--scrolled {
  background: rgba(8, 8, 8, 0.88) !important;
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
}

/* ── 13. Footer top 邊框漸層 ── */
.site-footer {
  border-top: 1px solid transparent;
  background-clip: padding-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ── 14. Back to top hover 微光 ── */
.back-to-top:hover {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 4px 24px rgba(0, 0, 0, 0.6);
}

/* ── 15. Card tag hero 邊框質感 ── */
.news-card--hero .card-tag {
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

/* ── 16. Breaking bar 底部陰影感 ── */
.breaking-bar {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

/* ── 17. Header topline hover shimmer ── */
.site-header:hover .header-topline {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 30%,
    rgba(255, 255, 255, 0.12) 70%,
    transparent 100%
  );
  transition: background 0.4s ease;
}
