/* =========================================================
   HurryDeer Browser — Changelog Page Styles
   Timeline-style changelog, responsive, dark-mode ready.
   ========================================================= */

/* ---------- Page Hero ---------- */
.changelog-hero {
  position: relative;
  padding: calc(var(--nav-height) + 4rem) 0 3rem;
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--accent-violet) 100%);
  color: #fff;
  overflow: hidden;
}
.changelog-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 20%, rgba(255,255,255,.12) 0%, transparent 60%);
  pointer-events: none;
}
.changelog-hero .container {
  position: relative;
  z-index: 1;
  text-align: center;
}
.changelog-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  margin-top: .75rem;
}
.changelog-hero .lead {
  margin-top: .75rem;
  font-size: 1.0625rem;
  opacity: .88;
  max-width: 540px;
  margin-inline: auto;
}
.changelog-hero .badge {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  padding: .375rem .875rem;
  border-radius: var(--radius-full);
}

/* ---------- Timeline Container ---------- */
.changelog-body {
  padding: 3.5rem 0 5rem;
}
.changelog-loading {
  color: var(--text-secondary);
  font-size: .9375rem;
}
.changelog-timeline {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding-left: 2rem;
}
/* vertical line */
.changelog-timeline::before {
  content: '';
  position: absolute;
  left: .625rem;
  top: .5rem;
  bottom: .5rem;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
}

/* ---------- Version Entry ---------- */
.changelog-entry {
  position: relative;
  padding-bottom: 2.5rem;
}
/* dot on the line */
.changelog-entry::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: .45rem;
  width: 12px;
  height: 12px;
  margin-left: calc(.625rem - 5px);
  background: var(--brand-600);
  border: 2px solid var(--bg);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--brand-100);
}
/* enlarged dot marks the newest version (direct child = latest entry only) */
.changelog-timeline > .changelog-entry:first-child::before {
  width: 14px;
  height: 14px;
  margin-left: calc(.625rem - 6px);
  box-shadow: 0 0 0 4px var(--brand-200);
}

/* ---------- Entry Header ---------- */
.changelog-entry-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .625rem;
  margin-bottom: 1rem;
}
.changelog-version {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}
.changelog-date {
  font-size: .8125rem;
  color: var(--text-muted);
}
.changelog-latest-badge {
  display: inline-block;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .25rem .625rem;
  border-radius: var(--radius-full);
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-200);
}
[data-theme="dark"] .changelog-latest-badge {
  background: rgba(37, 99, 235, .15);
  color: var(--brand-500);
  border-color: rgba(37, 99, 235, .3);
}

/* ---------- Change Categories ---------- */
.changelog-items {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}
.changelog-category {
  display: flex;
  flex-direction: column;
  gap: .875rem;
}
.changelog-category-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
/* 大类下的功能属性分组：标签在上，编号条目在下 */
.changelog-type-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
}
.changelog-type-items {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.changelog-sub-item {
  display: flex;
  align-items: baseline;
  gap: .5rem;
}
.changelog-sub-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  font-size: .75rem;
  font-weight: 700;
  color: var(--brand-600);
  background: var(--brand-50);
  border-radius: 50%;
  line-height: 1;
}
[data-theme="dark"] .changelog-sub-num {
  color: var(--brand-500);
  background: rgba(37,99,235,.12);
}
.changelog-item-tag {
  align-self: flex-start;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .6875rem;
  font-weight: 600;
  padding: .15rem .45rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.changelog-item-text {
  font-size: .9375rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Tag colors */
.tag-new {
  background: #ecfdf5;
  color: #059669;
}
.tag-improve {
  background: #eff6ff;
  color: #2563eb;
}
.tag-fix {
  background: #fef2f2;
  color: #dc2626;
}
.tag-perf {
  background: #faf5ff;
  color: #7c3aed;
}
[data-theme="dark"] .tag-new { background: rgba(5,150,105,.12); color: #34d399; }
[data-theme="dark"] .tag-improve { background: rgba(37,99,235,.12); color: #60a5fa; }
[data-theme="dark"] .tag-fix { background: rgba(220,38,38,.12); color: #f87171; }
[data-theme="dark"] .tag-perf { background: rgba(124,58,237,.12); color: #a78bfa; }

/* ---------- Expand / Collapse History Toggle ---------- */
.changelog-history[hidden] { display: none; }
.changelog-history {
  /* older entries wrapper; visibility driven by [hidden] attribute */
}
.changelog-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  margin-top: .25rem;
  padding: .5rem 0;
  background: transparent;
  border: none;
  color: var(--brand-600);
  font-size: .9375rem;
  font-weight: 600;
  transition: color var(--transition-fast);
}
.changelog-toggle:hover { color: var(--brand-700); }
[data-theme="dark"] .changelog-toggle { color: var(--brand-500); }
.changelog-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition);
}
.changelog-toggle svg.up { transform: rotate(180deg); }
/* hollow dot anchoring the timeline line at the toggle */
.changelog-toggle::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  margin-left: calc(.625rem - 5px);
  background: var(--bg);
  border: 2px solid var(--brand-500);
  border-radius: 50%;
}

/* ---------- Empty State ---------- */
.changelog-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .changelog-hero {
    padding: calc(var(--nav-height) + 2.5rem) 0 2rem;
  }
  .changelog-body {
    padding: 2rem 0 3.5rem;
  }
  .changelog-timeline {
    padding-left: 1.5rem;
  }
  .changelog-timeline::before {
    left: .5rem;
  }
  .changelog-entry::before {
    left: -1.5rem;
    margin-left: calc(.5rem - 5px);
  }
  .changelog-timeline > .changelog-entry:first-child::before {
    margin-left: calc(.5rem - 6px);
  }
  .changelog-toggle::before {
    left: -1.5rem;
    margin-left: calc(.5rem - 5px);
  }
  .changelog-category-title {
    font-size: 1rem;
  }
  .changelog-sub-item {
    gap: .375rem;
  }
}