/* QStore - internal app store
   Vanilla CSS, no build step, no external requests. Works on any static host.
   Fonts are self-hosted in assets/fonts, so nothing is fetched at runtime. */

/* Variable weight axis in a single file each: one request per family instead of
   one per weight, and every weight between 100-900 is available. */
@font-face {
  font-family: "Inter var";
  src: url("assets/fonts/Inter-var.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono var";
  src: url("assets/fonts/JetBrainsMono-var.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* One fixed dark palette - the store does not follow system appearance.
   Fallback values mirroring config.json; theme.css overrides them at build
   time and these keep the page readable if it is served without it. */
:root {
  color-scheme: dark;

  --bg: #0F0F11;
  --panel: #17171A;
  --panel-2: #1F1F23;
  --ink: #F3F3F5;
  --ink-2: #9C9CA4;
  --ink-3: #86868C;
  --line: #2B2B31;
  --accent: #FA3F3F;
  --accent-fill: #E8171B;
  --accent-ink: #FFFFFF;
  --accent-bright: #F81D21;
  --accent-deep: #CC0D14;
  --accent-tint: #FF8A8A;
  --accent-soft: #241113;
  --shadow-rgb: 0, 0, 0;

  --shadow: 0 1px 2px rgba(var(--shadow-rgb), .45),
            0 8px 24px rgba(var(--shadow-rgb), .35);
  --shadow-lift: 0 2px 4px rgba(var(--shadow-rgb), .55),
                 0 16px 40px rgba(var(--shadow-rgb), .5);

  --radius: 16px;
  --sans: "Inter var", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: "JetBrains Mono var", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* One motion vocabulary, so everything shares a rhythm. Exit is shorter than
     enter - a dialog that lingers on the way out feels unresponsive. */
  --ease-out: cubic-bezier(.16, .84, .34, 1);
  --dur-enter: .26s;
  --dur-exit: .16s;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* Column flex so the footer can be pushed to the bottom of the viewport
     instead of floating mid-page whenever the grid is short. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  letter-spacing: -.006em;
  /* Faint red bloom off the top edge so a near-empty grid does not read as a
     blank page. Fixed, so it does not travel with scroll. */
  background-image: radial-gradient(
    110% 55% at 50% -12%,
    rgba(248, 29, 33, .10), transparent 68%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

h1, h2, h3, h4 { letter-spacing: -.022em; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .92em; }

/* Keyboard focus. Only :focus-visible, so a mouse click does not leave a ring
   behind, but tabbing always shows where you are. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.card:focus-visible { outline-offset: 3px; }

/* Numbers that sit in columns (versions, sizes) must not jitter between rows. */
.card-meta, .fact dd, .history-item time { font-variant-numeric: tabular-nums; }

/* width:100% is load-bearing now that body is a flex column: an auto margin on
   the cross axis makes a flex item shrink-wrap to its content instead of
   filling the row, which collapsed the whole content column. */
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ------------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(20px);
  position: sticky; top: 0; z-index: 20;
}

.masthead-inner {
  display: flex; align-items: center; gap: 24px;
  min-height: 68px; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 13px; margin-right: auto; }

.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: block;
  /* The mark is transparent PNG, so the bag interior shows the page through it
     exactly as the original artwork intended. */
  filter: drop-shadow(0 2px 10px rgba(248, 29, 33, .28));
}

.brand-text h1 { margin: 0; font-size: 17.5px; font-weight: 650; }
.brand-text p { margin: 1px 0 0; font-size: 12.5px; color: var(--ink-3); }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 12px;
  height: 36px; width: 250px;
  transition: border-color .15s, background .15s;
}
.search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  background: var(--panel);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.search input:focus-visible { outline: none; }
.search svg { width: 15px; height: 15px; color: var(--ink-3); flex: none; }
.search input {
  border: 0; background: none; outline: none;
  color: var(--ink); font: inherit; font-size: 14px; width: 100%;
}

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

.filters {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 68px; z-index: 15;
}
.filters .wrap {
  display: flex; gap: 7px; padding-top: 11px; padding-bottom: 11px;
  overflow-x: auto; scrollbar-width: none;
}
.filters .wrap::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: .13s;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  font-weight: 600;
}

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

/* Grows to absorb the leftover height, which is what holds the footer down.
   Replaces an arbitrary min-height that left the footer stranded mid-page. */
#main { padding-top: 30px; padding-bottom: 56px; flex: 1 0 auto; }

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

.card {
  position: relative;
  display: flex; gap: 14px; align-items: flex-start;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .18s var(--ease-out), box-shadow .18s, border-color .18s;
  font: inherit; color: inherit;
  /* Staggered fade-in, delay set per card by store.js. */
  animation: card-in .34s var(--ease-out) both;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  padding: 1px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), transparent 45%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow: var(--shadow-lift),
              0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent),
              0 12px 40px -8px rgba(248, 29, 33, .22);
}
/* Press feedback that does not move neighbouring content. */
.card:active { transform: translateY(-1px) scale(.994); }

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.icon {
  width: 54px; height: 54px; flex: none;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 21px; font-weight: 650; letter-spacing: -.03em;
  color: #fff;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18),
              inset 0 0 0 1px rgba(0, 0, 0, .28),
              0 2px 8px rgba(0, 0, 0, .3);
}
.icon img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-body { min-width: 0; flex: 1; }
.card-name {
  margin: 1px 0 2px; font-size: 15px; font-weight: 600; letter-spacing: -.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-tagline {
  margin: 0; font-size: 13px; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  margin: 9px 0 0; font-size: 11.5px; color: var(--ink-3);
  display: flex; gap: 7px; align-items: center; flex-wrap: wrap;
}
.tag {
  background: var(--panel-2); border-radius: 5px;
  padding: 1.5px 6px; font-weight: 500;
  /* Its own colour: --ink-3 on --panel-2 lands at 4.09:1, under AA. */
  color: var(--ink-2);
}

.empty { color: var(--ink-3); text-align: center; padding: 60px 0; }

/* --------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--line);
  padding-top: 30px; padding-bottom: 56px;
  font-size: 13px; color: var(--ink-3);
  text-align: center;
}
.site-footer p { margin: 0; letter-spacing: -.002em; }

/* --------------------------------------------------------------- dialog */

.detail {
  border: 1px solid var(--line);
  padding: 0;
  width: min(620px, calc(100vw - 32px));
  max-height: min(86vh, 780px);
  border-radius: 20px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
  overflow: auto;
  position: relative;
  overscroll-behavior: contain;
}

/* Scale + fade from slightly below, which reads as "this came from the page"
   rather than appearing out of nowhere. */
.detail::after {
  content: ""; position: absolute; inset: 0 0 auto; height: 1px;
  background: linear-gradient(90deg, transparent,
    color-mix(in srgb, var(--accent) 55%, transparent), transparent);
}
.detail[open] { animation: dialog-in var(--dur-enter) var(--ease-out); }
.detail[open]::backdrop { animation: backdrop-in var(--dur-enter) ease-out; }

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

.detail::backdrop {
  background: rgba(8, 8, 7, .62);
  backdrop-filter: blur(4px);
}

.detail-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--panel-2); color: var(--ink-2);
  cursor: pointer;
}
.detail-close:hover { background: var(--line); color: var(--ink); }
.detail-close svg { width: 14px; height: 14px; }

.detail-head { display: flex; gap: 17px; padding: 28px 28px 20px; align-items: flex-start; }
.detail-head .icon { width: 68px; height: 68px; border-radius: 16px; font-size: 27px; }
.detail-head h2 { margin: 2px 0 4px; font-size: 22px; font-weight: 650; }
.detail-head .sub { margin: 0; color: var(--ink-2); font-size: 13.5px; }

.detail-section { padding: 0 28px 22px; }
.detail-section h3 {
  margin: 0 0 10px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .105em; text-transform: uppercase; color: var(--ink-3);
}

.prose { padding: 30px 28px 28px; }
.prose h2 { margin: 0 0 14px; font-size: 20px; font-weight: 650; }
.prose p { margin: 0 0 13px; color: var(--ink-2); font-size: 14px; line-height: 1.62; }
.prose p.muted { color: var(--ink-3); font-size: 13px; }
.prose code, .detail-section code {
  background: var(--panel-2); border-radius: 4px; padding: 1.5px 5px;
}

.install {
  display: flex; align-items: stretch; gap: 0;
  background: linear-gradient(180deg, var(--panel-2),
    color-mix(in srgb, var(--panel-2) 80%, var(--bg)));
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}
.install code {
  flex: 1; min-width: 0;
  padding: 12px 14px;
  font-size: 12.5px; background: none;
  overflow-x: auto; white-space: nowrap;
  letter-spacing: -.01em;
}
.install button {
  flex: none; border: 0; border-left: 1px solid var(--line);
  background: transparent; color: var(--accent);
  padding: 0 16px; font: inherit; font-size: 12px; font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer; transition: background .14s, color .14s;
}
.install button:hover { background: var(--line); }

.hint { margin: 8px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.55; }

.row { display: flex; gap: 9px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); border-radius: 9px;
  padding: 8px 15px; font: inherit; font-size: 13.5px; font-weight: 550;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, border-color .15s, transform .12s var(--ease-out);
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn-primary {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent-fill) 88%, #fff),
    var(--accent-fill));
  border-color: color-mix(in srgb, var(--accent-deep) 60%, var(--accent-fill));
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22),
              0 2px 10px -2px rgba(232, 23, 27, .45);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent-fill) 82%, var(--accent-bright));
  border-color: color-mix(in srgb, var(--accent-fill) 82%, var(--accent-bright));
}
.btn:active { transform: scale(.97); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.fact dt {
  font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .105em; font-weight: 600;
}
.fact dd { margin: 3px 0 0; font-size: 13.5px; }

.history { border-top: 1px solid var(--line); }
.history-item { padding: 13px 0; border-bottom: 1px solid var(--line); }
.history-item:last-child { border-bottom: 0; }
.history-item h4 { margin: 0 0 3px; font-size: 13.5px; font-weight: 600; }
.history-item time { font-size: 11.5px; color: var(--ink-3); }
.history-item .notes { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.history-item .notes p:first-child { margin-top: 0; }

/* Numbered walkthrough in the publish dialog. */

.step-head {
  display: flex; align-items: center; gap: 9px;
  margin: 24px 0 10px; font-size: 14.5px; font-weight: 600;
  letter-spacing: -.005em; color: var(--ink);
}
.step-num {
  width: 21px; height: 21px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-fill); color: var(--accent-ink);
  font-size: 11.5px; font-weight: 700;
}
.prose h3 { margin: 26px 0 10px; font-size: 14.5px; font-weight: 600; }

pre.cmd {
  margin: 0 0 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 13px;
  overflow-x: auto;
}
pre.cmd code {
  background: none; padding: 0;
  font-size: 12.5px; line-height: 1.6;
  white-space: pre; color: var(--ink);
}

/* Two mutually exclusive paths, so nobody reads instructions meant for the
   other one. */

.tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px;
  margin: 20px 0 24px;
}
.tab {
  display: flex; flex-direction: column; gap: 2px;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  font: inherit; color: var(--ink-2);
  cursor: pointer;
  transition: border-color .14s, background .14s, color .14s;
}
.tab strong { font-size: 13.5px; font-weight: 600; }
.tab span { font-size: 11.5px; color: var(--ink-3); }
.tab:hover { border-color: var(--ink-3); color: var(--ink); }
.tab[aria-selected="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  color: var(--ink);
}
.tab[aria-selected="true"] span { color: var(--accent); }

.done-note {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}
.linklike {
  border: 0; background: none; padding: 0;
  font: inherit; color: var(--accent); font-weight: 550;
  cursor: pointer; text-decoration: underline;
}

/* Numbered "what happens next" list - plain prose, not commands. */
.plain-steps {
  margin: 0 0 14px; padding-left: 20px;
  color: var(--ink-2); font-size: 14px; line-height: 1.62;
}
.plain-steps li { margin-bottom: 7px; }
.plain-steps li::marker { color: var(--accent); font-weight: 600; }

.callout {
  margin: 18px 0 14px;
  padding: 13px 15px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 11px;
  font-size: 13.5px; line-height: 1.6; color: var(--ink-2);
}
.callout strong { color: var(--ink); }
.callout code { background: rgba(0, 0, 0, .28); }
/* The tip sits directly under the command, so it stays visually quieter than
   the rule callout further down. */
.callout-tip {
  background: var(--panel-2);
  border-color: var(--line);
}
.callout-tip .muted { color: var(--ink-3); font-size: 12.5px; }

@media (max-width: 520px) {
  .tabs { grid-template-columns: 1fr; }
}

/* The one command that matters, given room to breathe. */
pre.cmd-hero {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent-bright) 42%, var(--line));
  padding: 15px 17px;
  margin-bottom: 16px;
}
pre.cmd-hero code { font-size: 13.5px; font-weight: 500; }

/* Motion is a nicety; readability is not. When the OS asks for less motion,
   drop every transition and animation but keep all styling intact. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .card:hover { transform: none; }
  .card:active { transform: none; }
}

@media (max-width: 560px) {
  .masthead-inner { padding-bottom: 12px; }
  .search { width: 100%; order: 3; }
  .filters { top: 0; position: static; }
  .detail-head { padding: 26px 20px 18px; }
  .detail-section, .prose { padding-left: 20px; padding-right: 20px; }
}

/* One-click install, with the Terminal route folded away underneath. */
.btn-install { font-size: 14px; padding: 10px 20px; }
.btn-install svg { width: 15px; height: 15px; }

details.alt { margin-top: 16px; }
details.alt summary {
  cursor: pointer; font-size: 12.5px; color: var(--ink-2);
  padding: 5px 0; list-style: none; width: fit-content;
}
details.alt summary::-webkit-details-marker { display: none; }
details.alt summary::before {
  content: "▸ "; color: var(--ink-3);
}
details.alt[open] summary::before { content: "▾ "; }
details.alt summary:hover { color: var(--ink); }
details.alt > .install { margin-top: 8px; }
