/* ============================================================
   SVG Studio — store pages (Task 46-2-d, additive stylesheet)
   Loaded via layout pageCss on /pricing, /checkout, /libraries.
   Design tokens + theme come from app.css (dark / light).
   ============================================================ */

/* ============ shared public-page shell (same as favicon.css) ============ */

.pub-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
}

.pub-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 50;
}
.pub-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .2px;
}
.pub-brand svg { width: 22px; height: 22px; color: var(--accent); }
.pub-brand em { color: var(--accent); font-style: normal; }

.pub-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.pub-nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  transition: background .15s, color .15s;
}
.pub-nav-link:hover { color: var(--text); background: var(--accent-soft); }
.pub-nav-link.active { color: var(--accent); background: var(--accent-soft); }

.pub-theme {
  margin-left: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pub-theme:hover { color: var(--text); border-color: var(--accent); }
.pub-theme svg { width: 17px; height: 17px; }
[data-theme="dark"] .pub-theme .ico-sun { display: block; }
[data-theme="dark"] .pub-theme .ico-moon { display: none; }
[data-theme="light"] .pub-theme .ico-sun { display: none; }
[data-theme="light"] .pub-theme .ico-moon { display: block; }

.pub-main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 22px 60px;
}

.pub-hero { max-width: 820px; margin-bottom: 26px; }
.pub-hero h1 { font-size: 30px; margin: 0 0 10px; letter-spacing: -.4px; }
.pub-hero p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.pub-hero strong { color: var(--text); }

.pub-footer {
  border-top: 1px solid var(--border);
  background: var(--panel);
  margin-top: auto;
}
.pub-footer p {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 22px;
  color: var(--muted);
  font-size: 13px;
}
.pub-footer a { color: var(--accent); text-decoration: none; }
.pub-footer a:hover { text-decoration: underline; }

.pub-seo { margin-top: 46px; max-width: 860px; }
.pub-cross {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}
.pub-cross p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.pub-cross a { color: var(--accent); text-decoration: none; font-weight: 600; }
.pub-cross a:hover { text-decoration: underline; }

.browse-count { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

/* ============ shared store primitives ============ */

.st-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--canvas-shadow);
}

.st-muted { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.st-note { color: var(--faint); font-size: 11.5px; margin: 12px 0 0; line-height: 1.55; }
.st-note a { color: var(--accent); text-decoration: none; font-weight: 600; }
.st-note a:hover { text-decoration: underline; }

.st-crumb { margin-bottom: 14px; font-size: 13px; }
.st-crumb a { color: var(--muted); text-decoration: none; font-weight: 600; }
.st-crumb a:hover { color: var(--accent); }

.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #06281c;
  font-weight: 700;
  font-size: 13.5px;
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, filter .15s, border-color .15s, color .15s;
}
.st-btn:hover { background: var(--accent-2); filter: brightness(1.05); }
.st-btn[disabled] { opacity: .55; cursor: wait; }
.st-btn-lg { font-size: 15px; padding: 13px 22px; }
.st-btn.ghost {
  background: transparent;
  border-color: var(--border-2);
  color: var(--text);
  font-weight: 600;
}
.st-btn.ghost:hover { border-color: var(--accent); color: var(--accent-2); background: transparent; filter: none; }

.st-mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--panel-3);
  border: 1px solid var(--border-2);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 7px;
  padding: 6px 11px;
  cursor: pointer;
  text-decoration: none;
}
.st-mini:hover { border-color: var(--accent); color: var(--accent-2); }

.st-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: .3px;
  white-space: nowrap;
}
.st-pill.free { background: var(--accent-soft); color: var(--accent-2); }
.st-pill.paid { background: rgba(245, 165, 36, .16); color: var(--amber); }
.st-pill.neutral { background: var(--panel-3); color: var(--muted); }

.st-fi {
  display: inline-block;
  width: 18px;
  color: var(--accent);
  font-weight: 700;
}

/* state cards */
.st-state h2 { margin: 0 0 8px; font-size: 17px; color: var(--text); }
.st-state p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.st-state-info { border-color: var(--border-2); }
.st-state-warn { border-color: rgba(245, 165, 36, .5); }
.st-state-ok { border-color: rgba(16, 185, 129, .5); }
.st-state-error { border-color: rgba(239, 68, 68, .5); }

.st-load {
  width: 22px;
  height: 22px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: st-spin .8s linear infinite;
  margin-bottom: 12px;
}
@keyframes st-spin { to { transform: rotate(360deg); } }

/* ============ pricing ============ */

.st-pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  max-width: 920px;
  align-items: stretch;
}

.st-plan {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  box-shadow: var(--canvas-shadow);
}
.st-plan.premium { border-color: var(--accent); }

.st-plan-badge {
  position: absolute;
  top: -11px;
  right: 20px;
  background: var(--accent);
  color: #06281c;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 11px;
}

.st-plan-name { margin: 0 0 2px; font-size: 19px; font-weight: 800; color: var(--text); }
.st-plan-tag { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }

.st-bill-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  width: max-content;
  margin-bottom: 16px;
}
.st-bill-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 7px;
  padding: 7px 16px;
  cursor: pointer;
}
.st-bill-btn:hover { color: var(--text); }
.st-bill-btn.active { background: var(--accent-soft); color: var(--accent-2); }

.st-price { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.st-cur { color: var(--muted); font-size: 17px; font-weight: 600; }
.st-amount { font-size: 42px; font-weight: 800; letter-spacing: -1px; color: var(--text); line-height: 1; }
.st-per { color: var(--muted); font-size: 13px; font-weight: 600; }
.st-badge-2free {
  background: rgba(245, 165, 36, .16);
  color: var(--amber);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .4px;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 10px;
  align-self: center;
}
.st-price-note { margin: 6px 0 0; font-size: 11.5px; color: var(--faint); min-height: 15px; }

.st-feats {
  list-style: none;
  margin: 20px 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.st-feat { display: flex; align-items: baseline; gap: 9px; font-size: 13.5px; color: var(--text); line-height: 1.5; }
.st-feat em { font-style: normal; color: var(--faint); font-size: 12px; }
.st-feat.off { color: var(--muted); }
.st-feat.off .st-fi { color: var(--danger); }

.st-plan-cta { width: 100%; }
.st-plan .st-note { text-align: center; }

/* ============ marketplace ============ */

.st-band {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 26px;
  box-shadow: var(--canvas-shadow);
}
.st-band-copy { flex: 1 1 380px; min-width: 0; }
.st-band-copy h2 { margin: 0 0 6px; font-size: 18px; color: var(--text); }
.st-band-copy p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.st-band-cta { display: flex; gap: 10px; flex-wrap: wrap; }

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

.st-lcard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.st-lcard:hover { border-color: var(--accent); transform: translateY(-2px); }

.st-lcard-head { display: flex; align-items: center; gap: 10px; }
.st-lcard-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-lcard-head .st-pill { margin-left: auto; }

.st-desc {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}

.st-lcard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  font-size: 11.5px;
  color: var(--faint);
}
.st-owner { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-count { color: var(--accent); font-weight: 700; white-space: nowrap; }

.st-loadmore { display: flex; justify-content: center; margin-top: 26px; }

/* ============ library detail ============ */

.st-detail-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.st-lib-title { margin: 0 0 2px; font-size: 21px; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.st-sum-owner { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
.st-lib-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.st-side-desc { margin: 0 0 6px; color: var(--muted); font-size: 13px; line-height: 1.7; }

.st-side-buy { margin-top: 4px; }
.st-side-free { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.st-side-free strong { color: var(--accent-2); }
.st-side-note { margin-top: 4px; border: 1px solid; border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6; }
.st-state-info.st-side-note { border-color: var(--border-2); background: var(--panel-2); }
.st-state-ok.st-side-note { border-color: rgba(16, 185, 129, .5); background: var(--accent-soft); }
.st-side-note a { color: var(--accent-2); font-weight: 700; }

.st-icons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.st-icon-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.st-icon-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 84px;
  border-radius: 9px;
  background: var(--panel-2);
  overflow: hidden;
}
.st-icon-thumb svg { width: 44px; height: 44px; max-width: 70%; max-height: 70%; color: var(--text); }
.st-icon-thumb .st-blur { filter: blur(7px); user-select: none; pointer-events: none; }
.st-lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
  background: rgba(11, 14, 19, .18);
}
.st-lock svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); }

.st-icon-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-icon-actions { display: flex; gap: 6px; }
.st-icon-actions .st-mini { flex: 1; justify-content: center; }

/* ============ checkout ============ */

.st-checkout .pub-hero { margin-bottom: 20px; }

.st-co-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  max-width: 1020px;
}

.st-side-title { margin: 0 0 14px; font-size: 15px; font-weight: 700; color: var(--text); }
.st-sum-name { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }

.st-co-price { display: flex; align-items: baseline; gap: 4px; margin: 10px 0 14px; }
.st-amount-lg { font-size: 32px; font-weight: 800; letter-spacing: -.8px; color: var(--text); line-height: 1; }
.st-co-price .st-per { color: var(--muted); font-size: 12.5px; font-weight: 600; }

.st-recap {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.st-recap li { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.st-recap .st-fi { flex: none; }

.st-pay-card h2 { margin-bottom: 6px; }

.st-whop-wrap {
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--panel-2);
  min-height: 480px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}
.st-whop-wrap > div { flex: 1; min-height: 460px; }

#stPayResult { margin-top: 18px; }
#stPayResult .st-state h2 { margin-bottom: 10px; }
#stPayResult .st-success-ico { color: var(--accent); font-size: 30px; line-height: 1; margin-bottom: 8px; }

/* ============ responsive ============ */

@media (max-width: 920px) {
  .st-pricing-grid { grid-template-columns: 1fr; max-width: 520px; margin: 0 auto; }
  .st-detail-grid { grid-template-columns: 1fr; }
  .st-co-grid { grid-template-columns: 1fr; }
  .pub-header { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .pub-nav { margin-left: 0; }
  .pub-main { padding: 20px 14px 48px; }
}
