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

:root {
  --size: clamp(30px, calc((100vw - 96px) / 8), 56px);
  --gap: 8px;
  --text: #f8fafc;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(60% 50% at 18% 12%, #7c3aed 0%, transparent 62%),
    radial-gradient(55% 45% at 88% 18%, #0ea5e9 0%, transparent 60%),
    radial-gradient(75% 60% at 50% 115%, #f97316 0%, transparent 62%),
    linear-gradient(180deg, #0f172a, #1e1b4b);
  overflow-x: hidden;
}

.desktop {
  padding: 2rem 1rem 10rem;
  text-align: center;
}

.desktop__title {
  font-size: clamp(2.2rem, 7vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  text-shadow: 0 6px 30px rgb(0 0 0 / 0.3);
}

.desktop__hint {
  margin-top: 0.5rem;
  color: rgb(248 250 252 / 0.8);
}

.hint-touch {
  display: none;
}

/* ===== Dock ===== */
.dock {
  position: fixed;
  left: 50%;
  bottom: 14px;
  translate: -50% 0;
  padding: 8px 10px 10px;
  border-radius: 22px;
  background: rgb(255 255 255 / 0.14);
  border: 1px solid rgb(255 255 255 / 0.25);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  box-shadow:
    0 20px 50px rgb(0 0 0 / 0.35),
    inset 0 1px 0 rgb(255 255 255 / 0.3);
  animation: dock-in 0.8s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

@keyframes dock-in {
  from {
    opacity: 0;
    translate: -50% 120%;
  }
}

.dock__list {
  display: flex;
  align-items: flex-end;
  gap: var(--gap);
  height: var(--size);
  padding: 0;
  list-style: none;
}

.dock__divider {
  align-self: center;
  width: 1px;
  height: 70%;
  margin-inline: 2px;
  background: rgb(255 255 255 / 0.3);
}

/* ===== Icons ===== */
.dock__item {
  --scale: 1;
  position: relative;
  display: block;
  width: calc(var(--size) * var(--scale));
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  color: inherit;
  font: inherit;
  background: none;
  cursor: pointer;
}

.dock__icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 23%;
  background: var(--bg, linear-gradient(160deg, #94a3b8, #475569));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.45),
    inset 0 -2px 6px rgb(0 0 0 / 0.2),
    0 6px 14px rgb(0 0 0 / 0.3);
}

.dock__icon svg {
  width: 56%;
  height: 56%;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.25));
}

[data-app="files"] { --bg: linear-gradient(160deg, #7dd3fc, #2563eb); }
[data-app="browser"] { --bg: linear-gradient(160deg, #5eead4, #0d9488); }
[data-app="mail"] { --bg: linear-gradient(160deg, #93c5fd, #4f46e5); }
[data-app="music"] { --bg: linear-gradient(160deg, #fda4af, #e11d48); }
[data-app="photos"] { --bg: linear-gradient(160deg, #fde68a, #f97316); }
[data-app="code"] { --bg: linear-gradient(160deg, #bef264, #15803d); }
[data-app="settings"] { --bg: linear-gradient(160deg, #cbd5e1, #64748b); }
[data-app="trash"] { --bg: linear-gradient(160deg, #f1f5f9, #94a3b8); }
[data-app="trash"] svg { stroke: #334155; }

/* ===== Tooltips ===== */
.dock__label {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  translate: -50% 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgb(15 23 42 / 0.88);
  border: 1px solid rgb(255 255 255 / 0.15);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, translate 0.18s ease;
}

.dock__label::after {
  content: "";
  position: absolute;
  top: calc(100% - 4px);
  left: calc(50% - 4px);
  width: 8px;
  height: 8px;
  background: rgb(15 23 42);
  rotate: 45deg;
}

.dock__item:hover .dock__label,
.dock__item:focus-visible .dock__label {
  opacity: 1;
  translate: -50% 0;
}

.dock__item:focus-visible {
  outline: none;
}

.dock__item:focus-visible .dock__icon {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* ===== Indicators & bounce ===== */
.dock__item::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text);
  translate: -50% 0;
  opacity: 0;
  scale: 0;
  transition: opacity 0.3s, scale 0.3s;
}

.dock__item[aria-pressed="true"]::after {
  opacity: 0.9;
  scale: 1;
}

.dock__item.is-bouncing .dock__icon {
  animation: bounce 0.9s cubic-bezier(0.3, 0, 0.3, 1);
}

.dock__item.is-bouncing .dock__label {
  opacity: 1;
  translate: -50% 0;
}

@keyframes bounce {
  0%, 100% { translate: 0 0; }
  25% { translate: 0 -55%; }
  50% { translate: 0 0; }
  70% { translate: 0 -22%; }
  85% { translate: 0 0; }
  93% { translate: 0 -6%; }
}

/* ===== Touch, small screens & motion ===== */
@media (hover: none) {
  .hint-pointer {
    display: none;
  }

  .hint-touch {
    display: inline;
  }
}

@media (max-width: 480px) {
  :root {
    --gap: 5px;
  }

  .dock {
    bottom: 10px;
    padding: 6px 8px 9px;
    border-radius: 18px;
  }

  .dock__label {
    font-size: 12px;
  }
}

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