/* ADMaps shop window.
   No framework, no webfont, no build step. */

:root {
  --bg: #0d0f13;
  --panel: #14171d;
  --panel-2: #191d24;
  --line: #232831;
  --line-2: #2e3441;
  --ink: #e8eaee;
  --dim: #8a93a2;
  --dim-2: #626b7a;
  --accent: #d9a441;
  /* The hairline under a sidebar heading. One place, so both stay in step. */
  --rule: rgba(217, 164, 65, .28);
  --accent-ink: #191203;
  --patreon: #ff5900;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button { font: inherit; }

/* ------------------------------------------------------------ header */

.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 15, 19, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

/* The same width, padding and columns as main.catalog. The header bar itself
   still spans the window; only its contents line up with the page below, so the
   search field begins exactly where the cards do. Change one, change both. */
.topin {
  max-width: 1560px; margin: 0 auto;
  padding: 0 22px; height: 58px;
  display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 30px;
  align-items: center;
}
/* NOT .toprow — the release page already owns that name for its two-column
   body, and being loaded second it handed this row a grid it was never meant
   to have, which flung the sign-in button out of the bar. */
.toptools { display: flex; align-items: center; gap: 18px; min-width: 0; }

.brand {
  display: inline-flex; align-items: baseline;
  text-decoration: none; font-weight: 700; font-size: 17px;
  /* Drawn in capitals, but the text stays "ADMaps" in the page itself, so it
     copies and reads out as the name rather than as shouting. */
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent);
}
.brand small {
  text-transform: none;
  font-weight: 400; font-size: 11.5px; color: #fff; letter-spacing: .04em;
}

.search { flex: 1; max-width: 460px; position: relative; }
.search input {
  width: 100%; padding: 8px 32px 8px 34px;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 7px;
  outline: none; font-size: 14px;
}
.search input::placeholder { color: var(--dim-2); }
.search input:focus { border-color: #3d4756; background: #1b2028; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--dim-2); }
/* all:unset MUST come first — it resets every property declared above it in the
   same rule. It used to sit after position:absolute, which quietly turned this
   into a static element: invisible while the field was empty, and shoving the
   header apart the moment anything was typed. */
.search .clear {
  all: unset;
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  cursor: pointer; color: var(--dim-2); padding: 4px 6px; line-height: 1; border-radius: 4px;
}
.search .clear:hover { color: var(--ink); }
.search .clear[hidden] { display: none; }

.spacer { flex: 1; }

.patreon {
  all: unset; cursor: pointer; flex: none;
  display: flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 7px;
  background: var(--patreon); color: #fff; font-size: 13.5px; font-weight: 600;
  transition: filter 140ms;
}
.patreon:hover { filter: brightness(1.1); }
.patreon.in { background: transparent; border: 1px solid var(--line-2); color: var(--dim); font-weight: 500; }

/* ------------------------------------------------------------ layout */

/* Scoped to the catalog. A bare "main" selector here also caught the release
   page, which has its own layout, and quietly threw its blocks into these
   columns. */
main.catalog {
  max-width: 1560px; margin: 0 auto; padding: 24px 22px 80px;
  display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 30px; align-items: start;
}

@media (max-width: 900px) {
  main.catalog { grid-template-columns: 1fr; gap: 18px; }
  /* No sidebar to line up with any more — let the wordmark take what it needs. */
  .topin { grid-template-columns: auto minmax(0, 1fr); gap: 18px; }
}

/* ------------------------------------------------------------ filters */

/* 82px = the 58px header plus a little air. The admin panel pushes this down
   from admin.js, because its tab bar is sticky too and used to cover the label. */
:root { --side-top: 82px; }
.side { position: sticky; top: var(--side-top); }
@media (max-width: 900px) { .side { position: static; } }

.side h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--accent); margin: 0 0 10px; font-weight: 600;
}
/* The rule belongs to the row, not to the heading: the heading is only as wide
   as its own text, and the line has to run the full width of the column. */
.side .head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: 7px; margin-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.side .head h2 { margin-bottom: 0; }
.side .clearall {
  all: unset; cursor: pointer; font-size: 11.5px; color: var(--accent);
}
.side .clearall[hidden] { display: none; }

.facets { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.facets li { display: contents; }
.facet {
  all: unset; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 20px;
  border: 1px solid var(--line-2); background: var(--panel);
  font-size: 12.5px; color: #b6bdc9;
  transition: border-color 140ms, color 140ms, background 140ms;
}
.facet:hover { border-color: #3d4756; color: var(--ink); }
.facet b { font-weight: 500; color: var(--dim-2); font-size: 11px; }
.facet[aria-pressed="true"] {
  background: rgba(217, 164, 65, .14); border-color: var(--accent); color: var(--accent);
}
.facet[aria-pressed="true"] b { color: rgba(217, 164, 65, .7); }
.facet[disabled] { opacity: .3; cursor: default; }

.showall {
  all: unset; cursor: pointer; margin-top: 10px;
  font-size: 12px; color: var(--dim); border-bottom: 1px dotted var(--line-2);
}
.showall:hover { color: var(--ink); }

/* ------------------------------------------------------------ results bar */

.bar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px; color: var(--dim); font-size: 13px;
}
.bar strong { color: var(--ink); font-weight: 600; }
.bar select {
  margin-left: auto; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 8px; font-size: 13px; outline: none;
}

/* ------------------------------------------------------------ grid */

.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(316px, 1fr));
}

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color 160ms;
}
/* No lift on hover. The previews are already moving; shifting the card under
   the cursor on top of that reads as twitchy. Only the edge responds. */
.card:hover { border-color: var(--line-2); }

/* ---- preview widget ---- */
.stage {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  /* Average colour of the current version, from the catalog. Painted at once
     so the card is a plausible tint rather than a black hole while the strip
     downloads, and it stays after the strip is released off screen. */
  background: var(--tint, #05070a);
  transition: background-color 650ms ease-in-out;
}
.layer {
  position: absolute; inset: 0;
  background-image: var(--sprite);
  background-repeat: no-repeat;
  background-size: 100% auto;
  /* One vertical strip. Percentage offsets divide by (frames - 1), so the
     frame boundaries land exactly regardless of card width or pixel ratio. */
  background-position: 0 var(--pos, 0%);
  opacity: 0;
  transition: opacity 650ms ease-in-out;
}
.layer[data-on] { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .layer { transition: none; } }

.stage .shade {
  position: absolute; inset: auto 0 0 0; height: 46%;
  background: linear-gradient(to top, rgba(5, 7, 10, .78), transparent);
  pointer-events: none;
}
.dots { position: absolute; right: 9px; bottom: 8px; display: flex; gap: 4px; z-index: 2; }
.dot { all: unset; cursor: pointer; padding: 5px 2px; }
.dot i { display: block; width: 16px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.3); transition: background 200ms; }
.dot[aria-current="true"] i { background: var(--accent); }
.vlabel {
  position: absolute; left: 11px; bottom: 9px; z-index: 2;
  font-size: 11px; letter-spacing: .03em; color: rgba(255,255,255,.78);
}
.badge {
  position: absolute; right: 9px; top: 9px; z-index: 2;
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  padding: 3px 7px; border-radius: 20px;
  background: rgba(5, 7, 10, .66); color: #cfd5df; backdrop-filter: blur(4px);
}
.badge.demo { background: rgba(217, 164, 65, .9); color: var(--accent-ink); }

/* ---- body ---- */
.body { padding: 13px 15px 15px; display: flex; flex-direction: column; flex: 1; }
.card h3 { margin: 0 0 4px; font-size: 15.5px; font-weight: 600; letter-spacing: .005em; }
.meta { margin: 0 0 11px; font-size: 12.5px; color: var(--dim); }
.meta span + span::before { content: "·"; margin: 0 6px; color: var(--dim-2); }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 14px; padding: 0; }
.tags button {
  all: unset; cursor: pointer;
  font-size: 11px; color: #a9b1be; background: var(--panel-2);
  border: 1px solid var(--line); padding: 2px 8px; border-radius: 20px;
  transition: color 140ms, border-color 140ms;
}
.tags button:hover { color: var(--ink); border-color: var(--line-2); }
.tags button[data-on] { color: var(--accent); border-color: rgba(217,164,65,.5); }

.buttons { display: flex; gap: 8px; margin-top: auto; }
.dl {
  all: unset; cursor: pointer; flex: 1; text-align: center;
  padding: 8px 4px; border-radius: 7px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 600;
  transition: filter 140ms;
}
.dl:hover { filter: brightness(1.1); }
.dl em { display: block; font-style: normal; font-weight: 400; font-size: 10.5px; opacity: .68; }
.dl[data-locked] {
  background: transparent; border: 1px solid var(--line-2); color: var(--dim-2);
  cursor: not-allowed;
}
.dl[data-locked]:hover { filter: none; border-color: #3d4756; color: var(--dim); }

/* ------------------------------------------------------------ empty */

.empty { padding: 70px 20px; text-align: center; color: var(--dim); }
.empty p { margin: 0 0 14px; }
.empty button { all: unset; cursor: pointer; color: var(--accent); border-bottom: 1px solid rgba(217,164,65,.4); }

/* ------------------------------------------------------------ note */

.note {
  max-width: 1560px; margin: 0 auto; padding: 0 22px 30px;
  color: var(--dim-2); font-size: 12.5px;
}
.note b { color: var(--dim); font-weight: 600; }

/* ------------------------------------------------------------ auth menu */

.authwrap { position: relative; flex: none; }

.quota { font-size: 11.5px; color: var(--dim-2); flex: none; }
@media (max-width: 720px) { .quota { display: none; } }

.tiers {
  position: absolute; right: 0; top: calc(100% + 9px); z-index: 60;
  width: 232px; padding: 9px;
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 9px; box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
}
.tiers[hidden] { display: none; }
.tiers p {
  margin: 2px 4px 8px; font-size: 10.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--dim-2);
}
.tiers button {
  all: unset; cursor: pointer; display: block; width: 100%;
  padding: 7px 9px; border-radius: 6px; font-size: 13.5px; font-weight: 500;
  transition: background 130ms;
}
.tiers button:hover { background: #232935; }
.tiers button em {
  display: block; font-style: normal; font-weight: 400;
  font-size: 11.5px; color: var(--dim-2); margin-top: 1px;
}

/* ------------------------------------------------------------ toast */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 90; max-width: min(560px, calc(100vw - 40px));
  padding: 10px 16px; border-radius: 8px; font-size: 13.5px;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .5);
}
.toast[hidden] { display: none; }
.toast.ok  { border-color: rgba(217, 164, 65, .55); }
.toast.bad { border-color: rgba(220, 90, 70, .6); }

.dl:disabled { opacity: .6; cursor: progress; }

/* ------------------------------------------------------------ load more */

.more {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 30px 0 10px; color: var(--dim-2); font-size: 12.5px;
}
.more[hidden] { display: none; }
.more button {
  all: unset; cursor: pointer;
  padding: 7px 18px; border-radius: 7px;
  border: 1px solid var(--line-2); color: var(--dim); font-size: 13px;
  transition: color 140ms, border-color 140ms;
}
.more button:hover { color: var(--ink); border-color: #3d4756; }

/* The preview is a link to the release page; the version markers inside it
   are not, and stop the click themselves. */
a.stage { display: block; text-decoration: none; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { color: var(--accent); }

/* ------------------------------------------------------------ my projects */

/* Selector carries the tag on purpose: ".side h2" above is more specific than a
   bare class and was quietly winning the colour and the margin. */
.side h2.projects-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--accent); font-weight: 600;
  /* Well clear of the last tag, then a hairline that runs the width of the
     column — enough to read as a second section without a heavy divider. */
  margin: 34px 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
}
.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.projects a {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 9px; margin: 0 -9px; border-radius: 6px;
  text-decoration: none; color: #b6bdc9; font-size: 13px;
  transition: background 140ms, color 140ms;
}
.projects a::before {
  content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%;
  background: var(--patreon); opacity: .8;
}
.projects a:hover { background: var(--panel); color: var(--ink); }
.projects a::after {
  content: "↗"; margin-left: auto; font-size: 11px; color: var(--dim-2);
}

/* ------------------------------------------------------------ free window */

.freetag {
  position: absolute; left: 9px; top: 9px; z-index: 3;
  display: flex; align-items: center; gap: 7px;
  padding: 4px 9px; border-radius: 20px;
  background: #2f8f4e; color: #f2fff6;
  font-size: 10.5px; letter-spacing: .05em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.freetag b { font-weight: 700; }
.freetag span { opacity: .82; font-variant-numeric: tabular-nums; }
.freetag.soon { background: #3b4657; color: #cfd8e4; }

/* A download opened by a promotional window rather than by a tier. */
.dl[data-free] { background: #2f8f4e; color: #f2fff6; }
