/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--sky);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Topbar ===== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(14, 19, 32, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.topbar-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.icon-btn {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 8px;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.icon-btn svg {
  width: 20px; height: 20px;
}

/* ===== Filters ===== */
.filters {
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0;
  background: rgba(14, 19, 32, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  z-index: 99;
  border-bottom: 1px solid var(--hairline);
  -webkit-overflow-scrolling: touch;
}

.filters::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 0.875rem;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.filter-chip:hover {
  color: var(--text);
  border-color: var(--gold-dim);
}

.filter-chip.active {
  color: var(--sky);
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 500;
}

/* ===== Main Layout ===== */
.main {
  padding-top: calc(var(--topbar-h) + 60px);
  padding-bottom: 80px;
  max-width: var(--content-max);
  margin: 0 auto;
  position: relative;
}

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding-left: 32px;
}

/* The hand-drawn curved line */
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: var(--timeline-w);
  background: linear-gradient(
    to bottom,
    var(--gold-dim) 0%,
    var(--gold) 50%,
    var(--sun-halo) 85%,
    var(--sun) 100%
  );
  opacity: 0.4;
  border-radius: 2px;
}

/* Subtle wave effect via mask (optional enhancement) */
.timeline-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
}

/* ===== Year Section ===== */
.year-section {
  margin-bottom: 48px;
  position: relative;
}

.year-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
  position: relative;
}

.year-number {
  font-family: "Playfair Display", "Cormorant Garamond", Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.year-node {
  position: absolute;
  left: -32px;
  top: 50%;
  transform: translateY(-50%);
  width: var(--node-active);
  height: var(--node-active);
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--gold);
}

/* ===== Entry Card ===== */
.entry {
  position: relative;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
  transition: all var(--dur-fast) var(--ease-out);
}

.entry:hover {
  background: var(--surface-hi);
  border-color: var(--gold-dim);
}

.entry.expanded {
  border-color: var(--gold);
}

/* Timeline node for entry */
.entry::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 24px;
  width: var(--node-size);
  height: var(--node-size);
  background: var(--surface);
  border: 2px solid var(--gold-dim);
  border-radius: 50%;
  transition: all var(--dur-fast) var(--ease-out);
}

.entry:hover::before {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

/* Entry header (always visible) */
.entry-header {
  padding: 16px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.entry-cover {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-hi);
}

.entry-info {
  flex: 1;
  min-width: 0;
}

.entry-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.4;
}

.entry-subtitle {
  font-size: 0.875rem;
  color: var(--gold);
  margin-bottom: 4px;
}

.entry-date {
  font-size: 0.8125rem;
  color: var(--text-dim);
}

.entry-type {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  font-weight: 500;
}

.entry-type.album {
  background: rgba(201, 169, 97, 0.15);
  color: var(--gold);
}

.entry-type.live {
  background: rgba(255, 74, 68, 0.15);
  color: var(--mars);
}

.entry-type.single {
  background: rgba(142, 150, 168, 0.15);
  color: var(--text-dim);
}

/* Entry body (expandable) */
.entry-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s var(--ease-out);
}

.entry.expanded .entry-body {
  max-height: 500px;
}

.entry-body-inner {
  padding: 0 16px 16px;
  border-top: 1px solid var(--hairline);
  margin-top: -8px;
  padding-top: 16px;
}

/* Links */
.entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.entry-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.8125rem;
  color: var(--text-dim);
  background: var(--surface-hi);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  text-decoration: none;
  transition: all var(--dur-fast) var(--ease-out);
}

.entry-link:hover {
  color: var(--text);
  border-color: var(--gold-dim);
}

.entry-link svg {
  width: 14px;
  height: 14px;
}

/* Note */
.entry-note {
  position: relative;
  padding-left: 16px;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.7;
}

.entry-note::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--mars);
  border-radius: 1px;
}

/* ===== Sunrise Card (Special) ===== */
.entry.sunrise {
  background: linear-gradient(
    135deg,
    var(--sunrise-warm) 0%,
    var(--sunrise-deep) 50%,
    var(--sunrise-gold) 100%
  );
  border: none;
  position: relative;
  overflow: hidden;
}

.entry.sunrise::before {
  background: var(--sun);
  border-color: var(--sun);
  box-shadow: 0 0 16px var(--sun), 0 0 32px var(--sun-halo);
  width: var(--node-active);
  height: var(--node-active);
  left: -30px;
}

/* Background image layer for sunrise card */
.entry.sunrise .sunrise-bg {
  position: absolute;
  inset: 0;
  background-image: var(--sunrise-bg, none);
  background-size: cover;
  background-position: center;
  opacity: 0.3;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* Confetti overlay */
.entry.sunrise .confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.6;
}

.entry.sunrise .entry-header {
  position: relative;
  z-index: 1;
}

.entry.sunrise .entry-title,
.entry.sunrise .entry-subtitle,
.entry.sunrise .entry-date {
  color: var(--silhouette);
}

.entry.sunrise .entry-title {
  text-shadow: 0 1px 2px rgba(255, 217, 142, 0.3);
}

.entry.sunrise .entry-type {
  background: rgba(26, 15, 10, 0.2);
  color: var(--silhouette);
}

.entry.sunrise .entry-body {
  position: relative;
  z-index: 1;
}

.entry.sunrise .entry-note {
  color: var(--silhouette);
}

.entry.sunrise .entry-note::before {
  background: var(--silhouette);
}

.entry.sunrise .entry-link {
  background: rgba(26, 15, 10, 0.15);
  border-color: rgba(26, 15, 10, 0.3);
  color: var(--silhouette);
}

.entry.sunrise .entry-link:hover {
  background: rgba(26, 15, 10, 0.25);
  border-color: var(--silhouette);
}

/* Sun icon for sunrise card */
.sun-icon {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 32px;
  height: 32px;
  color: var(--sun);
  filter: drop-shadow(0 0 8px var(--sun-halo));
  z-index: 2;
}

/* ===== Promise Line (日出见 connection) ===== */
.promise-line {
  position: absolute;
  left: -24px;
  width: 2px;
  background: repeating-linear-gradient(
    to bottom,
    var(--gold-dim) 0px,
    var(--gold-dim) 4px,
    transparent 4px,
    transparent 8px
  );
  opacity: 0.5;
}

/* ===== About Page ===== */
.about-content {
  padding: 24px 16px;
  max-width: 600px;
  margin: 0 auto;
}

.about-content h1 {
  font-size: 1.5rem;
  margin-bottom: 24px;
  color: var(--gold);
}

.about-content p {
  margin-bottom: 16px;
  color: var(--text-dim);
  line-height: 1.8;
}

.about-signature {
  margin-top: 32px;
  font-size: 0.9375rem;
  color: var(--text-faint);
  font-style: italic;
}

/* ===== Deep Link Highlight ===== */
.entry:target {
  animation: highlight-pulse 2s var(--ease-out);
}

@keyframes highlight-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(201, 169, 97, 0); }
  50% { box-shadow: 0 0 24px rgba(201, 169, 97, 0.4); }
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
  .topbar { padding: 0 24px; }
  .filters { padding: 12px 24px; justify-content: center; }
  .main { padding-top: calc(var(--topbar-h) + 70px); }
  .year-number { font-size: 2.5rem; }
  .entry-header { padding: 20px; }
  .entry-cover { width: 72px; height: 72px; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
