/* ============================================================
   DESKTOP ENVIRONMENT  (wallpaper, taskbar, icons)
   ============================================================ */

/* ---------- Wallpaper / Canvas BG ---------- */
#wallpaper-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Desktop Layer ---------- */
#desktop {
  position: relative;
  min-height: 100dvh;
  width: 100%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 90px;
}

/* ---------- Icon Grid ---------- */
#icon-grid {
  position: fixed;
  top: var(--space-8);
  left: var(--space-6);
  display: grid;
  grid-template-columns: 80px;
  gap: var(--space-8);
  z-index: 10;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  cursor: none;
  transition: background var(--dur-fast) var(--ease-spring);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.15);
}

.desktop-icon:active {
  transform: scale(0.94);
}

.icon-img {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--shadow-md);
  transition:
    transform var(--dur-base) var(--ease-spring),
    box-shadow var(--dur-base) var(--ease-spring);
  overflow: hidden;
}

.desktop-icon:hover .icon-img {
  transform: translateY(-4px) scale(1.06);
  box-shadow: var(--shadow-lg), 0 0 20px var(--color-accent-glow);
}

.icon-label {
  font-size: var(--text-xs);
  color: #f3f3f1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.7);
  text-align: center;
  line-height: 1.2;
  max-width: 76px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

/* Dark mode labels don't need inverse */
[data-theme="dark"] .icon-label {
  color: #e8e8f0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* ---------- Taskbar ---------- */
#taskbar {
  position: fixed;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-taskbar);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  transition: all var(--dur-base) var(--ease-spring);
}

.taskbar-sep {
  width: 1px;
  height: 28px;
  background: var(--color-border);
  margin: 0 var(--space-1);
}

.taskbar-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-text);
  transition: all var(--dur-fast) var(--ease-spring);
  position: relative;
  cursor: none;
}

.taskbar-btn:hover {
  background: var(--color-surface);
  color: var(--color-accent);
  transform: scale(1.15);
}

.taskbar-btn .tooltip {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--text-xs);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.taskbar-btn:hover .tooltip {
  opacity: 1;
}

/* ---------- Clock + Date ---------- */
#taskbar-clock {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text);
  padding: 0 var(--space-3);
  text-align: center;
  line-height: 1.3;
  font-weight: 600;
  min-width: 62px;
}

#taskbar-clock span {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-muted);
}

/* ---------- Theme Toggle Pill ---------- */
#theme-toggle {
  width: 44px;
  height: 24px;
  background: var(--color-surface-glass);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  position: relative;
  cursor: none;
  backdrop-filter: blur(8px);
  transition: background var(--dur-base);
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 3px;
}

#theme-toggle::after {
  content: '';
  width: 18px;
  height: 18px;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: transform var(--dur-base) var(--ease-spring);
  flex-shrink: 0;
}

[data-theme="dark"] #theme-toggle::after {
  transform: translateX(20px);
}

#icon-grid[hidden] {
  display: none !important;
}

#hero-center {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
  padding: var(--space-8);
}

.hero-kicker {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  animation: heroFadeUp 1200ms var(--ease-spring) both;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 5.8rem);
  color: var(--color-text);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  animation: heroFadeUp 1200ms 120ms var(--ease-spring) both, heroPulse 5s ease-in-out infinite;
}

.hero-subtitle {
  max-width: 50ch;
  margin: var(--space-4) auto 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  animation: heroFadeUp 1200ms 240ms var(--ease-spring) both;
}

.hero-title::after {
  content: '|';
  display: inline-block;
  margin-left: 0.08em;
  color: var(--color-text);
  animation: blinkCaret 900ms steps(1) infinite;
}
@keyframes heroFadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroPulse {
  0%, 100% {
    opacity: 0.92;
  }
  50% {
    opacity: 1;
  }
}

.taskbar-btn {
  overflow: visible;
}

.taskbar-btn.is-open::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.24);
}

.taskbar-btn .tooltip {
  transform: translateX(-50%) translateY(6px) scale(0.94);
  transition: opacity 160ms var(--ease-spring), transform 160ms var(--ease-spring);
}

.taskbar-btn:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.hero-title::after {
  content: '|';
  display: inline-block;
  margin-left: 0.08em;
  color: rgba(255, 255, 255, 0.88);
  animation: blinkCaret 900ms steps(1) infinite;
}

@keyframes blinkCaret {
  50% {
    opacity: 0;
  }
}

@media (max-width: 768px) {
  #icon-grid {
    display: none !important;
  }

  #taskbar {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    transform: none;
    width: auto;
    max-width: none;
    padding: 10px 12px;
    gap: 8px;
    border-radius: 22px;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    box-sizing: border-box;
  }

  #taskbar::-webkit-scrollbar {
    display: none;
  }

  .taskbar-btn {
    min-width: 46px;
    min-height: 46px;
    flex: 0 0 auto;
    font-size: 18px;
  }

  .taskbar-sep {
    display: none;
  }

  #theme-toggle,
  #taskbar-clock {
    flex: 0 0 auto;
  }

  .taskbar-btn .tooltip {
    display: none;
  }

  .taskbar-btn.is-open::after {
    bottom: -4px;
  }
}