/* Forkable — shared theme.
 *
 * Light, dense, catalog-first. Real marketplaces put products in front of you
 * immediately and use restraint everywhere else: one accent, real shadows, tight
 * type. The previous dark/neon palette read as a side project rather than a place
 * you'd hand a card to.
 *
 * Used by index.html and app.html so the two can't drift apart.
 */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-sunk: #eceff3;

  --border: #e3e6eb;
  --border-strong: #cdd3dc;

  --ink: #14171c;
  --ink-2: #454c58;
  --ink-3: #6b7482;
  --ink-4: #98a1ae;

  /* One accent. Amber survives from the old palette, but as an accent on white
     rather than a glow on black. */
  --accent: #b45309;
  --accent-bg: #fffbeb;
  --accent-line: #fcd9a5;

  --verified: #067647;
  --verified-bg: #ecfdf3;
  --verified-line: #abefc6;

  --danger: #b42318;
  --danger-bg: #fef3f2;
  --danger-line: #fecdc9;

  --link: #1749b8;

  --shadow-xs: 0 1px 2px rgba(20, 23, 28, .05);
  --shadow-sm: 0 1px 2px rgba(20, 23, 28, .06), 0 1px 3px rgba(20, 23, 28, .04);
  --shadow-md: 0 2px 4px rgba(20, 23, 28, .05), 0 8px 20px rgba(20, 23, 28, .08);
  --shadow-lg: 0 8px 16px rgba(20, 23, 28, .08), 0 24px 48px rgba(20, 23, 28, .12);

  --r-sm: 6px;
  --r: 9px;
  --r-lg: 13px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --header-h: 60px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.22; letter-spacing: -.021em; font-weight: 650; }
h1 { font-size: 30px; letter-spacing: -.028em; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 3px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 620px) { .wrap { padding: 0 16px; } }

.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }
.spacer { margin-left: auto; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-in { display: flex; align-items: center; gap: 20px; height: var(--header-h); }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 680; font-size: 16.5px; letter-spacing: -.03em; flex: 0 0 auto; }
.brand .mark {
  width: 25px; height: 25px; border-radius: 7px; flex: 0 0 auto;
  background: linear-gradient(140deg, #2b3038, #14171c);
  color: #fff; display: grid; place-items: center;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
}

/* Search living in the header is the strongest "this is a marketplace" signal. */
.header-search { position: relative; flex: 1 1 auto; max-width: 460px; }
.header-search input {
  width: 100%; height: 36px; padding: 0 34px 0 34px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: 14px; color: var(--ink); font-family: var(--sans);
}
.header-search input::placeholder { color: var(--ink-4); }
.header-search input:focus { outline: none; background: #fff; border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.header-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-4); font-size: 13px; pointer-events: none; }
.header-search .kbd-hint { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }
@media (max-width: 860px) { .header-search { display: none; } }

.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav a {
  padding: 7px 11px; border-radius: var(--r-sm); font-size: 14px; color: var(--ink-2); font-weight: 500;
}
.header-nav a:hover { background: var(--bg-soft); color: var(--ink); }
.header-nav a.on { color: var(--ink); background: var(--bg-sunk); }

/* General utility, not just for nav links — the account name uses it too. */
@media (max-width: 760px) { .hide-sm { display: none !important; } }

/* Below the search breakpoint the header can't fit on one line, so let it wrap
   into two rows instead of silently pushing the whole page sideways. */
@media (max-width: 700px) {
  .header-in { flex-wrap: wrap; height: auto; min-height: var(--header-h); padding: 9px 0; gap: 10px; }
  .brand { margin-right: auto; }
  .header-nav { gap: 2px; }
  .header-nav a { padding: 6px 9px; font-size: 13.5px; }
  #nav-links { order: 3; width: 100%; border-top: 1px solid var(--border); padding-top: 7px; }
}
@media (max-width: 380px) { .brand .brand-text { display: none; } }

/* Phones: keep the catalog, drop the squeeze. Desktop rules above this
   breakpoint are unchanged. */
@media (max-width: 760px) {
  .header-in {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-h);
    padding: 10px 0 12px;
    gap: 8px 10px;
  }
  .brand { margin-right: auto; }
  .header-nav {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }
  .header-nav .btn { margin-left: 0 !important; }
  .header-nav a { min-height: 40px; display: inline-flex; align-items: center; }

  .grid { grid-template-columns: 1fr; gap: 14px; }

  /* iOS zooms any input under 16px on focus — that looks like the page broke. */
  input, textarea, select { font-size: 16px; }

  .row { flex-wrap: wrap; }
  .row > input, .row > .grow { min-width: 0; flex: 1 1 180px; }
  .row > .btn { flex: 1 1 100%; height: 44px; }

  .site-footer { padding: 22px 0; margin-top: 36px; }
  .footer-in { flex-direction: column; align-items: flex-start; gap: 10px; }
  .footer-in .spacer { display: none; }
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: var(--r-sm);
  font-family: var(--sans); font-size: 14px; font-weight: 550; line-height: 1;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background .13s, border-color .13s, box-shadow .13s, transform .06s;
}
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--ink); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: #262b33; }

.btn-accent { background: var(--accent); color: #fff; box-shadow: var(--shadow-xs); }
.btn-accent:hover:not(:disabled) { background: #a04a08; }

.btn-secondary { background: #fff; color: var(--ink); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-soft); }

.btn-quiet { background: transparent; color: var(--ink-2); border-color: var(--border); }
.btn-quiet:hover:not(:disabled) { background: var(--bg-soft); color: var(--ink); }

.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }

kbd {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  background: #fff; border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px;
}

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; line-height: 1;
  padding: 4px 8px; border-radius: 5px;
  background: var(--bg-soft); color: var(--ink-2); border: 1px solid var(--border);
}
.badge-live { background: var(--verified-bg); color: var(--verified); border-color: var(--verified-line); }
.badge-accent { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-line); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.tag {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  color: var(--ink-3); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px;
}
a.tag:hover { color: var(--ink); border-color: var(--border-strong); background: #fff; }

/* ---------------------------------------------------------------- product cards */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
}

.card {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; box-shadow: var(--shadow-xs);
  transition: box-shadow .16s, border-color .16s, transform .16s;
}
a.card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-2px); }

/* A product tile needs a picture. We don't have screenshots, so each listing gets a
   stable generated cover keyed off its id — it reads as a thumbnail instead of a
   wall of text, and never 404s. */
.cover {
  position: relative; aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, hsl(var(--h, 30) 58% 95%), hsl(calc(var(--h, 30) + 38) 52% 89%));
  border-bottom: 1px solid var(--border);
  display: grid; place-items: center; overflow: hidden;
}
.cover::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(hsl(var(--h,30) 30% 40% / .07) 1px, transparent 1px),
                    linear-gradient(90deg, hsl(var(--h,30) 30% 40% / .07) 1px, transparent 1px);
  background-size: 22px 22px;
}
.cover .monogram {
  position: relative; z-index: 1;
  font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: -.04em;
  color: hsl(var(--h, 30) 42% 32%);
}
.cover .cover-badge { position: absolute; z-index: 2; left: 10px; top: 10px; }
.cover .cover-cat {
  position: absolute; z-index: 2; right: 10px; bottom: 10px;
  font-size: 11px; font-weight: 500; color: hsl(var(--h, 30) 35% 34%);
  background: rgba(255, 255, 255, .82); border-radius: 4px; padding: 3px 7px;
}

.card-body { padding: 14px 15px 0; flex: 1; }
.card-body h3 { font-size: 15px; margin-bottom: 5px; }
.card-body .card-desc {
  font-size: 13.5px; color: var(--ink-3); margin-bottom: 11px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-top: 1px solid var(--border); margin-top: 12px;
}
.price { font-size: 15.5px; font-weight: 650; letter-spacing: -.02em; }
.seller-inline { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }

.avatar {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(140deg, #3a414c, #14171c); color: #fff;
  display: grid; place-items: center; font-size: 10px; font-weight: 650; font-family: var(--sans);
}
.avatar-lg { width: 52px; height: 52px; border-radius: 11px; font-size: 21px; }

/* ---------------------------------------------------------------- stars */
.stars { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; color: var(--ink-3); }
.stars .s { color: #d8dce2; letter-spacing: -1.5px; font-size: 13px; }
.stars .s b { color: #e8a33d; font-weight: 400; }
.stars .val { font-weight: 600; color: var(--ink-2); }
.stars.none { color: var(--ink-4); font-size: 12px; }

/* ---------------------------------------------------------------- forms */
label {
  display: block; font-size: 13px; font-weight: 550; color: var(--ink-2); margin-bottom: 6px;
}
input, textarea, select {
  width: 100%; font-family: var(--sans); font-size: 14.5px; color: var(--ink);
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 9px 12px;
}
select { height: 38px; padding: 0 10px; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: #8a94a3; box-shadow: 0 0 0 3px rgba(23, 73, 184, .1);
}
input::placeholder, textarea::placeholder { color: var(--ink-4); }
textarea { min-height: 92px; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 13px; }
.field { margin-bottom: 16px; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }
.row { display: flex; gap: 8px; align-items: flex-start; }
.row > input, .row > .grow { flex: 1; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .two { grid-template-columns: 1fr; } }

.msg { font-size: 13.5px; margin-top: 10px; min-height: 18px; color: var(--ink-3); }
.msg.ok { color: var(--verified); }
.msg.err { color: var(--danger); }

/* ---------------------------------------------------------------- panels */
.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-xs); }
.panel-pad { padding: 22px; }

.notice { border: 1px solid var(--border); background: var(--bg-soft); border-radius: var(--r); padding: 15px 17px; font-size: 14px; color: var(--ink-2); }
.notice > b { display: block; color: var(--ink); margin-bottom: 3px; font-weight: 600; }
.notice.warn { background: var(--accent-bg); border-color: var(--accent-line); color: #7a4708; }
.notice.warn b { color: var(--accent); }
.notice.ok { background: var(--verified-bg); border-color: var(--verified-line); color: #05603a; }
.notice.ok b { color: var(--verified); }

.empty {
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
  padding: 46px 24px; text-align: center; background: var(--bg-soft);
}
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--ink-3); margin-bottom: 16px; font-size: 14px; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  border-top: 1px solid var(--border); background: var(--bg-soft);
  padding: 30px 0; margin-top: 64px; font-size: 13px; color: var(--ink-3);
}
.footer-in { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }

/* Footer legal links. Required on every page that takes money or collects an
   email — Stripe asks for them before live mode, and a marketplace with no
   visible terms reads as untrustworthy to exactly the audience we want. */
.legal-links { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.legal-links a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; }
.legal-links a:hover { border-bottom-color: currentColor; }
