/* Download apps (downloads.html): a header, then one card per app with a picture of Kayts on that
   platform, its icon, a description and its platforms. Requires base.css and chat.css (colours,
   .brand, .btn-pill). */

.dl-page { height: auto; min-height: 100dvh; }

.dl-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dl-main {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px 72px;
  /* The hero glow is wider than a phone screen (140vw); cut it at the sides so the page doesn't
     scroll sideways. clip, not hidden: it keeps the glow above the hero and sticky elements working. */
  overflow-x: clip;
}

/* Hero: the animated mark on a slowly drifting aurora glow. */
.dl-hero { position: relative; margin-bottom: 44px; text-align: center; }
.dl-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -60px;
  left: 50%;
  width: min(900px, 140vw);
  height: 420px;
  background:
    radial-gradient(closest-side at 35% 45%, var(--aurora-1), transparent),
    radial-gradient(closest-side at 62% 40%, var(--aurora-2), transparent),
    radial-gradient(closest-side at 50% 70%, var(--aurora-3), transparent);
  filter: blur(20px);
  transform: translateX(-50%);
  animation: dl-drift 16s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes dl-drift {
  from { transform: translateX(-53%) scale(1); }
  to { transform: translateX(-47%) scale(1.08); }
}
.dl-hero-mark { display: block; width: 96px; height: 96px; margin: 0 auto 22px; }
.dl-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.dl-lead {
  max-width: 600px;
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: 1.05rem;
}

.dl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

/* Cards rise in one after another, and lift with a glow on hover. */
.dl-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--sidebar-bg);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  animation: dl-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}
.dl-card:nth-child(2) { animation-delay: 0.08s; }
.dl-card:nth-child(3) { animation-delay: 0.16s; }
.dl-card:nth-child(4) { animation-delay: 0.24s; }
.dl-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: 0 22px 50px -24px color-mix(in srgb, var(--accent) 55%, transparent);
}
@keyframes dl-rise {
  from { opacity: 0; transform: translateY(18px); }
}

/* The picture: Kayts on that platform (1280 × 600, the same 32:15 as the box). The pictures are
   dark in both themes, like screenshots. Two of them cross-fade (js/downloads.js); the shown one
   drifts in slowly, and comes a little closer on hover. */
.dl-visual {
  position: relative;
  aspect-ratio: 32 / 15;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: #0f0d16;
}
.dl-shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.7s ease, transform 6s ease-out;
}
.dl-shot.is-active { opacity: 1; transform: scale(1); }
.dl-card:hover .dl-shot.is-active { transform: scale(1.03); transition: opacity 0.7s ease, transform 0.6s ease; }

/* macOS / Windows, iPhone / Android: a small switch on the picture, top left, where every picture
   has only background (the Dock and the taskbar are at the bottom). */
.dl-switch {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(15, 13, 22, 0.62);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.dl-switch button {
  padding: 4px 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.dl-switch button:hover { color: #ffffff; }
.dl-switch button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.18); color: #ffffff; }
.dl-switch button:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 1px; }

.dl-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 20px 22px 22px;
}

/* Name row like an app store listing: the app's icon for that platform, then the name and badge. */
.dl-head { display: flex; align-items: center; gap: 14px; }
.dl-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  transition: transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}
/* The iOS file is square: iOS rounds it on the phone, here CSS does. */
.dl-icon.is-ios { border-radius: 22.5%; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
.dl-card:hover .dl-icon { transform: translateY(-2px) rotate(-4deg) scale(1.06); }
.dl-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.dl-head h2 { margin: 0; font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }
.dl-body p { flex: 1; margin: 0; color: var(--muted); font-size: 0.93rem; }

.dl-badge {
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.dl-platforms { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.dl-platform { gap: 6px; min-height: 34px; padding: 0 14px; font-size: 0.85rem; }
.dl-platform svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Reduced motion in the system (base.css covers the setting in Settings). */
@media (prefers-reduced-motion: reduce) {
  .dl-hero::before, .dl-card, .dl-icon, .dl-shot { animation: none !important; transition: none !important; }
  .dl-shot, .dl-card:hover .dl-shot.is-active { transform: none; }
}

@media (max-width: 720px) {
  .dl-main { padding: 28px 16px 56px; }
  .dl-top { padding: 10px 16px; }
  .dl-grid { grid-template-columns: minmax(0, 1fr); }
  .dl-hero-mark { width: 72px; height: 72px; margin-bottom: 18px; }
}
