:root {
  --ink: #14201c;
  --ink-soft: #4a5c55;
  --foam: #eef4f0;
  --pine: #1f4a40;
  --glow: rgba(47, 122, 98, 0.2);
  --font-brand: "Bricolage Grotesque", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --icon: clamp(4.75rem, 18vw, 6.25rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--foam);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(900px 560px at 14% -8%, var(--glow), transparent 58%),
    radial-gradient(720px 480px at 96% 6%, rgba(200, 184, 150, 0.26), transparent 52%),
    radial-gradient(580px 420px at 60% 110%, rgba(31, 74, 64, 0.1), transparent 55%),
    linear-gradient(165deg, #e7f0ea 0%, var(--foam) 45%, #e4ebe6 100%);
  animation: atmosphere-drift 18s ease-in-out infinite alternate;
}

.atmosphere::before {
  content: "";
  position: absolute;
  inset: -18%;
  background:
    radial-gradient(circle at 28% 38%, rgba(255, 255, 255, 0.38), transparent 42%),
    radial-gradient(circle at 76% 64%, rgba(47, 122, 98, 0.09), transparent 38%);
  animation: wash-shift 22s ease-in-out infinite alternate;
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(20, 32, 28, 0.055) 0.8px, transparent 0.8px);
  background-size: 16px 16px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 78%);
}

.hub {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2.5rem, 8vh, 4rem);
  min-height: 100dvh;
  width: min(28rem, 100%);
  margin: 0 auto;
  padding:
    max(2rem, env(safe-area-inset-top, 0px))
    max(1.25rem, env(safe-area-inset-right, 0px))
    max(2rem, env(safe-area-inset-bottom, 0px))
    max(1.25rem, env(safe-area-inset-left, 0px));
  text-align: center;
}

.brand {
  margin: 0;
  font-family: var(--font-brand);
  font-size: clamp(2.75rem, 12vw, 4.25rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 0.95;
  color: var(--pine);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 4vw, 1.75rem);
  width: 100%;
  justify-items: center;
}

.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  max-width: 7.5rem;
  padding: 0.15rem;
  border-radius: 1.15rem;
  outline: none;
  transition: transform 0.18s ease;
}

.app-tile__icon {
  display: block;
  width: var(--icon);
  height: var(--icon);
  border-radius: 22.5%;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(20, 32, 28, 0.12);
  transition:
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s ease;
}

.app-tile__name {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--ink-soft);
}

.app-tile:hover .app-tile__icon,
.app-tile:focus-visible .app-tile__icon {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 16px 34px rgba(20, 32, 28, 0.16);
}

.app-tile:hover .app-tile__name,
.app-tile:focus-visible .app-tile__name {
  color: var(--ink);
}

.app-tile:active {
  transform: scale(0.97);
}

.app-tile:focus-visible {
  box-shadow: 0 0 0 2px var(--foam), 0 0 0 4px var(--pine);
}

@media (prefers-reduced-motion: no-preference) {
  .brand {
    opacity: 0;
    transform: translateY(14px);
    animation: rise-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.06s forwards;
  }

  .app-tile {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
    animation: tile-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(0.16s + var(--i, 0) * 0.08s);
  }
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tile-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes atmosphere-drift {
  from {
    filter: hue-rotate(0deg) saturate(1);
  }
  to {
    filter: hue-rotate(8deg) saturate(1.05);
  }
}

@keyframes wash-shift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-2%, 1.5%, 0) scale(1.04);
  }
}

@media (max-width: 360px) {
  .app-grid {
    gap: 0.75rem;
  }

  .app-tile__name {
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .atmosphere,
  .atmosphere::before {
    animation: none;
  }

  .app-tile,
  .app-tile__icon {
    transition: none;
  }
}
