/* news-demo.css — 新聞列表 demo 版型（對齊 demo5 視覺） */

.news-demo-page {
  --nd-ink: #1a2233;
  --nd-muted: #5a6478;
  --nd-mint: #2ec49a;
  --nd-violet: #7b5cff;
  --nd-border: rgba(26, 34, 51, 0.1);
  --nd-radius: 18px;
  --nd-shadow: 0 12px 40px rgba(26, 34, 51, 0.1);
}

/* ── 版型切換列 ── */
.news-demo-switcher {
  position: sticky;
  top: 0;
  z-index: 120;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--nd-border);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(26, 34, 51, 0.06);
}

.news-demo-switcher .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 0.65rem 15px;
}

.news-demo-switcher__label {
  font-size: 12px;
  font-weight: 800;
  color: var(--nd-violet);
  white-space: nowrap;
}

.news-demo-switcher__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1 1 auto;
}

.news-demo-switcher__link {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--nd-ink) !important;
  text-decoration: none !important;
  border: 1px solid var(--nd-border);
  background: #fff;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.news-demo-switcher__link:hover {
  border-color: rgba(123, 92, 255, 0.35);
  color: var(--nd-violet) !important;
}

.news-demo-switcher__link.is-active {
  background: linear-gradient(135deg, #7b5cff, #5e8fff);
  border-color: transparent;
  color: #fff !important;
}

.news-demo-switcher__current {
  font-size: 11px;
  font-weight: 700;
  color: var(--nd-muted);
  white-space: nowrap;
}

/* ── Hero ── */
.news-demo-hero {
  position: relative;
  padding: 2.5rem 0 2rem;
  overflow: hidden;
  background: linear-gradient(145deg, #121a28 0%, #1a2233 55%, #243552 100%);
  color: #fff;
}

.news-demo-hero__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 85% 20%, rgba(123, 92, 255, 0.22), transparent 55%),
    radial-gradient(ellipse 50% 60% at 10% 80%, rgba(46, 196, 154, 0.15), transparent 50%);
  pointer-events: none;
}

.news-demo-hero__inner {
  position: relative;
  z-index: 1;
}

.news-demo-hero__eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  margin: 0 0 0.5rem;
}

.news-demo-hero__title {
  font-size: clamp(1.85rem, 4vw, 2.6rem);
  font-weight: 900;
  margin: 0 0 0.65rem;
  line-height: 1.2;
}

.news-demo-hero__lead {
  max-width: 40em;
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.78);
}

/* ── 共用區塊 ── */
.news-demo-section {
  padding: 2.5rem 0 3.5rem;
}

.news-demo-section__head {
  margin-bottom: 1.75rem;
}

.news-demo-section__head .demo4-section__title {
  color: var(--nd-ink);
}

.news-demo-section--cards {
  background: linear-gradient(180deg, #f4f7fb 0%, #fff 100%);
}

.news-demo-section--timeline {
  background: #fff;
}

.news-demo-section--patch {
  background: #f8fafc;
}

.news-demo-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--nd-muted);
  font-weight: 600;
}

/* ── 版型 1：Patch board 全頁延伸 ── */
.news-demo-patch-board {
  margin-top: 0.5rem;
}

.news-demo-patch-board__count {
  margin-top: 1.25rem;
  font-size: 11px;
  opacity: 0.75;
}

.news-demo-page--v1 .news-demo-patch-item:hover {
  background: rgba(46, 196, 154, 0.04);
}

/* ── 版型 2：卡片網格 ── */
.news-demo-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.news-demo-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 2px solid var(--nd-border);
  border-radius: var(--nd-radius);
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(26, 34, 51, 0.06);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.news-demo-card:hover {
  transform: translateY(-6px);
  border-color: rgba(46, 196, 154, 0.45);
  box-shadow: var(--nd-shadow);
}

.news-demo-card__thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #1a2233;
}

.news-demo-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.news-demo-card:hover .news-demo-card__thumb img {
  transform: scale(1.04);
}

.news-demo-card__pin {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(26, 34, 51, 0.82);
  color: var(--nd-mint);
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  font-weight: 700;
}

.news-demo-card__body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.news-demo-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.news-demo-card__meta time {
  font-size: 12px;
  font-weight: 700;
  color: var(--nd-muted);
}

.news-demo-card__tag {
  font-size: 10px;
  font-weight: 800;
  color: #fff !important;
  padding: 2px 8px;
  border-radius: 4px;
}

.news-demo-card__title {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.4;
  margin: 0 0 0.45rem;
}

.news-demo-card__title a {
  color: var(--nd-ink) !important;
  text-decoration: none !important;
}

.news-demo-card__title a:hover {
  color: var(--nd-violet) !important;
}

.news-demo-card__excerpt {
  font-size: 13px;
  line-height: 1.55;
  color: var(--nd-muted);
  margin: 0 0 0.75rem;
  flex: 1 1 auto;
}

.news-demo-card__cta {
  font-size: 13px;
  font-weight: 800;
  color: var(--nd-mint) !important;
  text-decoration: none !important;
}

.news-demo-card__cta:hover {
  color: var(--nd-violet) !important;
}

/* ── 版型 3：精選 + 時間軸 ── */
.news-demo-featured {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  padding: 1.25rem;
  border-radius: calc(var(--nd-radius) + 4px);
  background: linear-gradient(135deg, #f0f4ff 0%, #fff 50%, #f3fbf8 100%);
  border: 2px solid var(--nd-border);
  box-shadow: var(--nd-shadow);
}

.news-demo-featured__visual {
  position: relative;
  display: block;
  border-radius: var(--nd-radius);
  overflow: hidden;
  min-height: 240px;
  background: #1a2233;
}

.news-demo-featured__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 240px;
}

.news-demo-featured__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7b5cff, #5e8fff);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.news-demo-featured__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.news-demo-featured__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.news-demo-featured__meta time {
  font-size: 13px;
  font-weight: 700;
  color: var(--nd-muted);
}

.news-demo-featured__tag {
  font-size: 10px;
  font-weight: 800;
  color: #fff !important;
  padding: 3px 10px;
  border-radius: 4px;
}

.news-demo-featured__title {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 900;
  line-height: 1.35;
  margin: 0 0 0.75rem;
}

.news-demo-featured__title a {
  color: var(--nd-ink) !important;
  text-decoration: none !important;
}

.news-demo-featured__excerpt {
  font-size: 14px;
  line-height: 1.65;
  color: var(--nd-muted);
  margin: 0 0 1.1rem;
}

.news-demo-timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.25rem;
  border-left: 2px solid rgba(123, 92, 255, 0.2);
}

.news-demo-timeline__item {
  position: relative;
  padding: 0 0 1.35rem 1.25rem;
}

.news-demo-timeline__item:last-child {
  padding-bottom: 0;
}

.news-demo-timeline__node {
  position: absolute;
  left: -1.38rem;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--nd-violet);
  box-shadow: 0 0 0 4px rgba(123, 92, 255, 0.12);
}

.news-demo-timeline__card {
  padding: 1rem 1.15rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--nd-border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.news-demo-timeline__item:hover .news-demo-timeline__card {
  border-color: rgba(46, 196, 154, 0.4);
  box-shadow: 0 8px 24px rgba(26, 34, 51, 0.06);
}

.news-demo-timeline__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.news-demo-timeline__meta time {
  font-size: 12px;
  font-weight: 700;
  color: var(--nd-muted);
}

.news-demo-timeline__tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid;
  background: #fff;
}

.news-demo-timeline__title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
  line-height: 1.4;
}

.news-demo-timeline__title a {
  color: var(--nd-ink) !important;
  text-decoration: none !important;
}

.news-demo-timeline__title a:hover {
  color: var(--nd-violet) !important;
}

.news-demo-timeline__excerpt {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--nd-muted);
}

/* ── 分頁 ── */
.news-demo-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.news-demo-pagination__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--nd-ink) !important;
  text-decoration: none !important;
  border: 1px solid var(--nd-border);
  background: #fff;
}

.news-demo-pagination__btn:hover:not(.is-disabled) {
  border-color: var(--nd-violet);
  color: var(--nd-violet) !important;
}

.news-demo-pagination__btn.is-disabled {
  opacity: 0.45;
  cursor: default;
}

.news-demo-pagination__info {
  font-size: 13px;
  font-weight: 700;
  color: var(--nd-muted);
}

@media (max-width: 991px) {
  .news-demo-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .news-demo-featured {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575px) {
  .news-demo-switcher .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .news-demo-card-grid {
    grid-template-columns: 1fr;
  }
}

/* ── 版型 4：經典 news.php 橫幅（高度減半，約 120px） ── */
.news-demo-classic-banner {
  position: relative;
  width: 100%;
  height: 150px;
  margin: 0 0 0.5rem;
  background-color: #f3f3f3;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  overflow: hidden;
}

.news-demo-classic-banner__title {
  background-color: #ea983e;
  width: min(500px, 88%);
  padding: 12px 20px;
  color: #fff !important;
  position: absolute;
  left: 15px;
  bottom: 0;
  margin: 0;
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.04em;
  z-index: 2;
}

.news-demo-section--v4 {
  padding-top: 1.75rem;
}

/* ── 版型 4：TITC LOGO 色系（金 + 青） ── */
.news-demo-page--v4 {
  --titc-gold: #e8b339;
  --titc-gold-deep: #c98e12;
  --titc-cyan: #87cdeb;
  --titc-cyan-deep: #3daee8;
  --nd-violet: var(--titc-cyan-deep);
  --nd-mint: var(--titc-cyan);
}

.news-demo-page--v4 .demo4-section__label {
  color: var(--titc-cyan-deep) !important;
}

.news-demo-page--v4 .news-demo-featured__badge {
  background: linear-gradient(135deg, var(--titc-gold), var(--titc-gold-deep));
}

.news-demo-page--v4 .news-demo-featured__cta.demo4-btn--primary,
.news-demo-page--v4 .demo4-btn--primary {
  background: linear-gradient(135deg, var(--titc-gold) 0%, var(--titc-cyan-deep) 100%);
  border: none;
  width: auto;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.25rem;
}

.news-demo-page--v4 .news-demo-timeline {
  border-left-color: rgba(61, 174, 232, 0.28);
}

.news-demo-page--v4 .news-demo-timeline__node {
  border-color: var(--titc-cyan-deep);
  box-shadow: 0 0 0 4px rgba(135, 205, 235, 0.22);
}

/* ── 翻頁日曆日期（滾輪翻頁） ── */
.news-flip-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex-shrink: 0;
  min-width: 0;
}

.news-flip-date__day {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.news-flip-date__ym {
  margin-top: 0.45rem;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--titc-gold-deep);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.news-flip-date.is-ym-visible .news-flip-date__ym {
  opacity: 1;
  transform: translateY(0);
}

.news-flip-date__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.news-flip-date--lg .news-flip-digit {
  --flip-h: 58px;
  --flip-w: 46px;
  --flip-fs: 42px;
}

.news-flip-date--lg .news-flip-date__ym {
  font-size: 16px;
}

.news-flip-date--md .news-flip-digit {
  --flip-h: 48px;
  --flip-w: 38px;
  --flip-fs: 34px;
}

.news-flip-date--md .news-flip-date__ym {
  font-size: 13px;
}

.news-flip-digit {
  position: relative;
  display: inline-block;
  width: var(--flip-w, 46px);
  height: var(--flip-h, 58px);
  font-size: var(--flip-fs, 42px);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffefb 0%, #fff4e0 100%);
  border: 1px solid rgba(201, 142, 18, 0.35);
  box-shadow: 0 3px 10px rgba(201, 142, 18, 0.12);
  overflow: hidden;
  box-sizing: border-box;
  flex-shrink: 0;
}

.news-flip-digit::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(26, 34, 51, 0.14);
  z-index: 2;
  pointer-events: none;
}

.news-flip-digit__window {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.news-flip-digit__strip {
  list-style: none;
  margin: 0;
  padding: 0;
  transform: translate3d(0, 0, 0);
  transition: transform 0.95s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.news-flip-digit__strip li {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--flip-h, 58px);
  min-height: var(--flip-h, 58px);
  font-weight: 800;
  line-height: 1;
  color: var(--titc-gold-deep);
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.news-flip-digit__num {
  display: block;
  line-height: 1;
  transform: translateY(-0.04em);
}

@media (prefers-reduced-motion: reduce) {
  .news-flip-digit__strip {
    transition: none;
  }
}

/* 頭條圖：時間軸縮圖 108×72 的 4 倍面積 → 216×144（同 3:2 橫向） */
.news-demo-featured--v4 {
  grid-template-columns: 108px 216px 1fr;
  align-items: start;
  background: linear-gradient(135deg, rgba(135, 205, 235, 0.08) 0%, #fff 45%, rgba(232, 179, 57, 0.06) 100%);
}

.news-demo-featured--v4 .news-demo-featured__visual {
  width: 216px;
  height: 144px;
  min-height: 0;
  flex-shrink: 0;
  aspect-ratio: 3 / 2;
}

.news-demo-featured--v4 .news-demo-featured__visual img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: center;
}

/* 內文首圖 placeholder */
.news-demo-thumb-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: linear-gradient(145deg, #eef2f8 0%, #dfe7f3 100%);
  color: #7b8798;
  text-align: center;
}

.news-demo-thumb-placeholder i {
  font-size: 2rem;
  opacity: 0.85;
}

.news-demo-thumb-placeholder span {
  font-size: 11px;
  font-weight: 700;
}

.news-demo-featured--v4 .news-demo-thumb-placeholder--featured {
  min-height: 0;
  height: 100%;
}

.news-demo-thumb-placeholder--timeline i {
  font-size: 1.35rem;
}

/* 時間軸附縮圖 + 翻頁日期 */
.news-demo-timeline--v4 .news-demo-timeline__card {
  display: grid;
  grid-template-columns: 88px 108px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.news-demo-timeline--v4 .news-demo-timeline__node {
  top: 1.35rem;
}

.news-demo-timeline--v4 .news-demo-timeline__title {
  font-size: calc(1.05rem * 1.3);
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.news-demo-timeline--v4 .news-demo-timeline__excerpt {
  font-size: 13px;
}

.news-demo-timeline--v4 .news-demo-timeline__card {
  min-width: 0;
}

.news-demo-timeline--v4 .news-demo-timeline__body {
  min-width: 0;
  overflow: hidden;
}

.news-demo-timeline--v4 .news-demo-timeline__title,
.news-demo-timeline--v4 .news-demo-timeline__title a,
.news-demo-timeline--v4 .news-demo-timeline__excerpt {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.news-demo-timeline__thumb {
  display: block;
  width: 108px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: #eef2f8;
  flex-shrink: 0;
}

.news-demo-timeline__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-demo-timeline__thumb .news-demo-thumb-placeholder--timeline {
  min-height: 72px;
}

@media (max-width: 991px) {
  .news-demo-featured--v4 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .news-flip-date--lg .news-flip-digit {
    --flip-h: 54px;
    --flip-w: 44px;
    --flip-fs: 38px;
  }

  .news-demo-featured--v4 .news-flip-date {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.75rem;
    align-items: center;
  }

  .news-demo-featured--v4 .news-flip-date__ym {
    margin-top: 0;
  }

  .news-demo-featured--v4 .news-demo-featured__visual {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
  }
}

/* 窄版：時間軸第 2 則起 → 日曆在上、縮圖在下，文字在右 */
@media (max-width: 767px) {
  .news-demo-timeline--v4 .news-demo-timeline__card {
    grid-template-columns: 86px minmax(0, 1fr);
    grid-template-rows: auto auto;
    font-size: 15px;
    column-gap: 1em;
    row-gap: 0.35rem;
    padding: 0.75rem 0.65rem;
    align-items: start;
  }

  .news-demo-timeline--v4 .news-demo-timeline__card > .news-flip-date {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
  }

  .news-demo-timeline--v4 .news-demo-timeline__thumb {
    grid-column: 1;
    grid-row: 2;
    width: 86px;
    height: 58px;
    justify-self: center;
  }

  .news-demo-timeline--v4 .news-demo-timeline__thumb .news-demo-thumb-placeholder--timeline {
    min-height: 58px;
  }

  .news-demo-timeline--v4 .news-demo-timeline__body {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .news-demo-timeline--v4 .news-demo-timeline__node {
    top: 1.6rem;
  }

  .news-demo-timeline--v4 .news-demo-timeline__item {
    padding-left: 0.85rem;
  }

  .news-demo-timeline--v4 {
    padding-left: 0.85rem;
  }
}

@media (max-width: 575px) {
  .news-demo-classic-banner {
    height: 120px;
  }

  .news-demo-classic-banner__title {
    padding: 10px 14px;
    left: 10px;
  }

  .news-demo-timeline--v4 .news-demo-timeline__card {
    grid-template-columns: 76px minmax(0, 1fr);
    font-size: 14px;
    column-gap: 1em;
  }

  .news-demo-timeline--v4 .news-demo-timeline__thumb {
    width: 76px;
    height: 52px;
  }

  .news-demo-timeline--v4 .news-demo-timeline__thumb .news-demo-thumb-placeholder--timeline {
    min-height: 52px;
  }

  .news-flip-date--lg .news-flip-digit {
    --flip-h: 50px;
    --flip-w: 40px;
    --flip-fs: 36px;
  }

  .news-flip-date--md .news-flip-digit {
    --flip-h: 42px;
    --flip-w: 34px;
    --flip-fs: 28px;
  }

  .news-demo-timeline__thumb {
    width: 84px;
    height: 60px;
  }

  .news-demo-timeline__thumb .news-demo-thumb-placeholder--timeline {
    min-height: 60px;
  }
}
