/* ===== Progressive Loading & Placeholder System ===== */

/* Background: always visible, no transitions */
.bg-layer {
  position: fixed; inset: 0; z-index: -2;
  background-color: #0a0e14;
  background-size: cover;
  background-position: center;
  opacity: 1;
}
.bg-layer.bg-revealed {
  opacity: 1;
}
.bg-layer.bg-gradient {
  opacity: 1;
  transition: none;
}
.theme-light .bg-layer {
  background-color: #f0f2f5;
}
  animation: none;
}

/* --- Overlay transitions smoothly --- */

/* --- Content Staggered Fade-In --- */
/* Each section fades in with a slight delay cascade */
.container > * {
  opacity: 0;
  transform: translateY(8px);
  animation: content-appear 0.5s ease forwards;
}
.container > *:nth-child(1) { animation-delay: 0.05s; }
.container > *:nth-child(2) { animation-delay: 0.1s; }
.container > *:nth-child(3) { animation-delay: 0.18s; }
.container > *:nth-child(4) { animation-delay: 0.25s; }
.container > *:nth-child(5) { animation-delay: 0.32s; }
.container > *:nth-child(6) { animation-delay: 0.4s; }
.container > *:nth-child(7) { animation-delay: 0.48s; }
.container > *:nth-child(8) { animation-delay: 0.55s; }
.container > *:nth-child(9) { animation-delay: 0.6s; }

@keyframes content-appear {
  to { opacity: 1; transform: translateY(0); }
}

/* --- Skeleton / Shimmer Placeholders --- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    var(--bg-hover) 50%,
    var(--border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}
.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }
.skeleton-card {
  height: 80px;
  margin-bottom: 12px;
}

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

/* --- Bookmark Card Hover Transition --- */
.bookmark-card {
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s, opacity 0.3s;
}

/* --- News Card Load Transition --- */
.news-card {
  transition: border-color 0.2s, background 0.2s, opacity 0.4s;
}

/* --- Quick Link Icon Pulse on Load --- */
.quick-link-icon {
  animation: icon-pulse 0.6s ease 0.3s;
}
@keyframes icon-pulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 12px var(--accent-glow); }
}

/* --- Search Bar Glow on Ready --- */
.search-bar {
  animation: search-ready 0.8s ease 0.2s;
}
@keyframes search-ready {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 3px var(--accent-glow); }
}

/* --- Wallpaper Placeholder Colors --- */
/* Each wallpaper has a matching placeholder that shows instantly */
.bg-placeholder-deep    { background-color: #0a0e14; }
.bg-placeholder-blue    { background-color: #0f1923; }
.bg-placeholder-carbon  { background-color: #111820; }
.bg-placeholder-emerald { background-color: #0a1a14; }
.bg-placeholder-purple  { background-color: #0e0a1a; }
.bg-placeholder-warm    { background-color: #1a1410; }
.bg-placeholder-cool    { background-color: #0a1420; }
.bg-placeholder-night   { background-color: #0a0a18; }

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .bg-layer { animation: none; clip-path: none; opacity: 1; }
  .container > * { animation: none; opacity: 1; transform: none; }
  .skeleton { animation: none; }
  .quick-link-icon { animation: none; }
  .search-bar { animation: none; }
}

/* ===== Random Wallpaper Button ===== */
.wp-random-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--glass-border, rgba(30,45,61,0.5));
  background: var(--glass-bg, rgba(17,24,32,0.55));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  z-index: 30;
  opacity: 0.5;
  transition: opacity 0.3s, transform 0.3s, border-color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.wp-random-btn:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}
.wp-random-btn.spinning {
  animation: wp-spin 0.6s ease;
}
@keyframes wp-spin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(0.9); }
  100% { transform: rotate(360deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .wp-random-btn.spinning { animation: none; }
}

/* macOS overrides removed - no longer needed */

/* ===== Random Wallpaper Button ===== */
.wp-random-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(30,40,55,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  z-index: 30;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.wp-random-btn.visible { opacity: 0.5; }
.wp-random-btn:hover { opacity: 1; border-color: var(--accent); color: var(--accent); }
.wp-random-btn.spinning { animation: wp-spin 0.6s ease; }
@keyframes wp-spin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(0.9); }
  100% { transform: rotate(360deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .wp-random-btn.spinning { animation: none; }
}
