/* The Downloads page (/downloads/): categories on the left, their downloads on the right. Builds on site.css. */

:root {
  --dl-panel: rgba(9, 13, 32, 0.86);
  --dl-soft: rgba(143, 180, 255, 0.08);
  --dl-accent: var(--glow-downloads);
  --dl-top-h: 84px;
}

/* ---------- Top bar: home | title | blank ---------- */

.dl-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: var(--dl-top-h);
  padding: max(12px, env(safe-area-inset-top)) 24px 12px;
  background: rgba(6, 9, 24, 0.84);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.dl-home {
  justify-self: start;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.dl-home:hover { background: var(--card-hover); }
.dl-top h1 { font-size: clamp(22px, 3vw, 30px); letter-spacing: -0.01em; text-align: center; }
.dl-top-note { justify-self: end; font-size: 13px; color: var(--muted); }

/* ---------- Layout: categories on the left, content on the right ---------- */

.dl-layout {
  position: relative;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 28px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.dl-nav {
  position: sticky;
  top: calc(var(--dl-top-h) + 20px);
  align-self: start;
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--dl-panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.dl-nav h2 {
  margin: 0 8px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.dl-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.dl-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.dl-nav a:hover { background: var(--dl-soft); }
.dl-nav a[aria-current="page"] {
  background: color-mix(in srgb, var(--dl-accent) 16%, transparent);
  color: var(--dl-accent);
}
.dl-count {
  min-width: 22px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  text-align: center;
  color: var(--muted);
}

/* ---------- A category and its downloads ---------- */

.dl-category { display: flex; flex-direction: column; gap: 20px; }
.dl-category[hidden] { display: none; }
.dl-category + .dl-category { margin-top: 40px; }
.js .dl-category + .dl-category { margin-top: 0; }
.dl-category-head h2 { margin: 0; font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -0.01em; }
.dl-category-head p { margin: 8px 0 0; font-size: 16px; line-height: 1.55; color: var(--muted); }

.dl-item {
  position: relative;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  scroll-margin-top: calc(var(--dl-top-h) + 20px);
}
.dl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.dl-head h3 { margin: 0; font-size: 28px; letter-spacing: -0.01em; }
.dl-tag { font-size: 13px; color: var(--muted); }
.dl-item h4 { margin: 28px 0 10px; font-size: 18px; color: var(--dl-accent); }
.dl-item p, .dl-item li { font-size: 16px; line-height: 1.6; color: var(--muted); }
.dl-item p { margin: 10px 0 0; }
.dl-item strong, .dl-item b { color: var(--ink); }
.dl-item ol, .dl-item ul { margin: 0; padding-left: 22px; }
.dl-item li + li { margin-top: 6px; }
.dl-item a { color: var(--accent); }
.dl-item code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(143, 180, 255, 0.12);
  color: var(--ink);
  font-size: 0.92em;
  overflow-wrap: anywhere;
}
.dl-item a.dl-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--dl-accent);
  color: #06101f;
  font-weight: 700;
  text-decoration: none;
}
.dl-button:hover { filter: brightness(1.1); }
.dl-button svg { width: 18px; height: 18px; flex: none; }
.dl-item .dl-meta { margin-top: 10px; font-size: 13px; }
.dl-hash { display: block; margin-top: 6px; font-size: 12px !important; }
.dl-credit {
  margin-top: 28px;
  padding: 16px 18px;
  border-left: 3px solid var(--dl-accent);
  border-radius: 0 12px 12px 0;
  background: rgba(255, 255, 255, 0.04);
}
.dl-item .dl-credit p:first-child { margin-top: 0; }

/* ---------- Screenshots with numbered pins matching the steps ---------- */

.dl-shot { margin: 4px 0 18px; }
.dl-shot-frame {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}
.dl-shot img { display: block; width: 100%; height: auto; }
.dl-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: clamp(20px, 3.4vw, 32px);
  height: clamp(20px, 3.4vw, 32px);
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: #7a5cff;
  color: #fff;
  font-size: clamp(11px, 1.6vw, 16px);
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}
.dl-shot figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); text-align: center; }

.dl-steps { counter-reset: dl-step; list-style: none; padding-left: 0 !important; }
.dl-steps > li { position: relative; padding-left: 38px; }
.dl-steps > li + li { margin-top: 10px !important; }
.dl-steps > li::before {
  counter-increment: dl-step;
  content: counter(dl-step);
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--dl-accent) 22%, transparent);
  color: var(--dl-accent);
  font-size: 13px;
  font-weight: 800;
}
.dl-shot + .dl-steps > li::before { background: #7a5cff; color: #fff; }

.dl-footer { padding: 0 24px 32px; text-align: center; font-size: 13px; color: rgba(226, 231, 255, 0.45); }
.dl-footer p { margin: 0; }

/* ---------- Narrow screens: categories above the content ---------- */

@media (max-width: 900px) {
  :root { --dl-top-h: 0px; }
  .dl-top {
    position: static;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
    padding: max(16px, env(safe-area-inset-top)) 16px 14px;
  }
  .dl-top h1 { order: 1; }
  .dl-home { order: 2; justify-self: center; }
  .dl-top-note { display: none; }
  .dl-layout { grid-template-columns: 1fr; gap: 16px; padding: 16px 16px 40px; }
  .dl-nav { position: static; padding: 12px; }
  .dl-item { padding: 22px 18px; border-radius: 16px; }
  .dl-head h3 { font-size: 24px; }
}

.dl-item .dl-new {
  margin-top: 18px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--dl-accent) 40%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--dl-accent) 8%, transparent);
  font-size: 15px;
}

.dl-item .dl-warn {
  margin-top: 18px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 155, 122, 0.55);
  border-radius: 12px;
  background: rgba(255, 155, 122, 0.10);
  font-size: 15px;
}
.dl-item .dl-warn b { color: #ffb39a; }
