/* UI Theme Library — marketplace chrome. Linear / Vercel / Apple-level restraint. */
:root {
  --site-bg: #fafafa;
  --site-bg-2: #ffffff;
  --site-ink: #171717;
  --site-muted: #737373;
  --site-line: #ececec;
  --site-accent: #171717;
  --site-accent-ink: #ffffff;
  --site-soft: #f3f3f3;
  --site-radius: 14px;
  --site-font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --site-display: "Inter", "SF Pro Display", -apple-system, system-ui, sans-serif;
  --site-shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px rgba(0,0,0,.05);
  --site-motion: 1;
  --site-dur: calc(0.22s * var(--site-motion));
}
html[data-theme="dark"] {
  --site-bg: #0a0a0a;
  --site-bg-2: #141414;
  --site-ink: #f5f5f5;
  --site-muted: #a3a3a3;
  --site-line: #262626;
  --site-accent: #f5f5f5;
  --site-accent-ink: #0a0a0a;
  --site-soft: #1a1a1a;
  --site-shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px rgba(0,0,0,.35);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: clip; }
html { font-size: 16px; }
body {
  font-family: var(--site-font);
  color: var(--site-ink);
  background: var(--site-bg);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img, video, iframe { max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

.skip { position: absolute; left: 12px; top: -44px; z-index: 80; background: var(--site-ink); color: var(--site-bg); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 12px; }

.wrap { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
@media (max-width: 600px) { .wrap { width: calc(100% - 28px); } }

.lib-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0;
  background: color-mix(in srgb, var(--site-bg) 86%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--site-line);
  max-width: 100%;
}
.lib-header .wrap { display: flex; align-items: center; gap: 12px; width: min(1120px, calc(100% - 40px)); }
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; font-weight: 700; letter-spacing: -.03em; font-size: 15px; flex: 0 0 auto;
}
.brand i {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--site-ink); color: var(--site-bg); font-style: normal; font-weight: 800; font-size: 11px;
}
.lib-nav { display: flex; align-items: center; gap: 2px; margin-left: 8px; min-width: 0; }
.lib-nav a {
  text-decoration: none; font-weight: 600; font-size: 13px; color: var(--site-muted);
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
}
.lib-nav a:hover, .lib-nav a.is-on { color: var(--site-ink); background: var(--site-soft); }
.lib-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.lib-iconbtn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--site-line);
  background: var(--site-bg-2); font-size: 14px; font-weight: 700;
}
.lib-menu { display: none; }
.lib-drawer {
  display: none; position: fixed; inset: 0; z-index: 70;
}
.lib-drawer.is-open { display: block; }
.lib-drawer .scrim { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.lib-drawer .panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 86vw);
  background: var(--site-bg-2); border-left: 1px solid var(--site-line);
  padding: 20px; overflow: auto;
  display: grid; align-content: start; gap: 8px;
}
.lib-drawer a { text-decoration: none; font-weight: 650; padding: 10px 8px; border-radius: 8px; color: var(--site-ink); }
.lib-drawer a:hover, .lib-drawer a.is-on { background: var(--site-soft); }

.hero { padding: 72px 0 36px; max-width: 740px; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--site-muted); margin: 0 0 14px; }
.hero h1, .page-h h1 {
  font-family: var(--site-display); font-weight: 700;
  font-size: clamp(36px, 6vw, 64px); line-height: 1.02; letter-spacing: -.045em; margin: 0 0 16px;
}
.hero p, .lede { margin: 0; font-size: 18px; color: var(--site-muted); max-width: 38em; }

.sec { padding: 28px 0 64px; }
.sec-h { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.sec-h h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.sec-h p { margin: 0; color: var(--site-muted); font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; min-width: 0;
  text-decoration: none; background: var(--site-bg-2);
  border: 1px solid var(--site-line); border-radius: calc(var(--site-radius) + 4px);
  box-shadow: var(--site-shadow); overflow: hidden;
  transition: transform var(--site-dur) ease, border-color var(--site-dur);
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--site-ink) 16%, var(--site-line)); }
.theme-preview, .tpl-thumb, .preview-video, video {
  aspect-ratio: 16 / 10; width: 100%; object-fit: cover; display: block; background: var(--site-soft);
}
.meta { padding: 16px 16px 18px; display: grid; gap: 6px; min-width: 0; }
.kicker { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--site-muted); }
.meta h3 { margin: 0; font-size: 18px; letter-spacing: -.03em; overflow-wrap: anywhere; }
.meta p { margin: 0; color: var(--site-muted); font-size: 13px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 12px; border-radius: 9px;
  font-size: 13px; font-weight: 650; text-decoration: none;
  border: 1px solid var(--site-line); background: var(--site-bg); color: var(--site-ink);
}
.btn-solid { background: var(--site-accent); color: var(--site-accent-ink); border-color: transparent; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.filters button, .filters a {
  height: 32px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--site-line); background: var(--site-bg-2);
  font-size: 12px; font-weight: 650; text-decoration: none;
}
.filters button.is-on, .filters a.is-on { background: var(--site-ink); color: var(--site-bg); border-color: transparent; }

.page-h { padding: 40px 0 12px; }
.detail { display: grid; gap: 28px; padding-bottom: 80px; min-width: 0; }
.preview-video { width: 100%; border-radius: var(--site-radius); border: 1px solid var(--site-line); background: #0a0a0a; }
.device-bar { display: flex; gap: 8px; margin: 0 0 10px; }
.frame-shell {
  border: 1px solid var(--site-line); border-radius: var(--site-radius);
  background: var(--site-soft); overflow: hidden; min-width: 0;
}
.frame-shell .inner {
  margin: 0 auto; width: 100%; max-width: 100%;
  aspect-ratio: 16 / 10; transition: max-width var(--site-dur);
  min-width: 0;
}
.frame-shell.is-tablet .inner { max-width: 768px; aspect-ratio: 3 / 4; }
.frame-shell.is-mobile .inner { max-width: 390px; aspect-ratio: 390 / 700; }
.feat { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; }
.feat ul { margin: 0; padding-left: 18px; color: var(--site-muted); }
.lib-foot {
  border-top: 1px solid var(--site-line); padding: 28px 0 48px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--site-muted); font-size: 13px;
}

/* Site customizer — same pattern as kit */
#site-customizer.kit-cust { background: var(--site-bg-2); color: var(--site-ink); border-color: var(--site-line); }
#site-customizer label { color: var(--site-muted); }

@media (max-width: 860px) {
  .grid, .feat { grid-template-columns: 1fr; }
  .lib-nav { display: none; }
  .lib-menu { display: inline-flex; }
  .hero { padding: 44px 0 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .frame-shell .inner { transition: none; }
}

/* Theme card preview skins */
.theme-preview { position: relative; overflow: hidden; }
.theme-preview span { position: absolute; inset: auto 50% 28% auto; transform: translateX(50%);
  padding: 8px 16px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pv-manga-pop { background: #f7f5ff; background-image: radial-gradient(#d9d6ee 1px, transparent 1px); background-size: 10px 10px; }
.pv-manga-pop span { background: #6b74e8; color: #fff; box-shadow: 3px 3px 0 #c5c9f5; border: 2px solid #1c1c28; }
.pv-ios-liquid-glass { background: linear-gradient(135deg, #c9def8, #e8d9f8 50%, #f3e6d8); }
.pv-ios-liquid-glass span { background: rgba(255,255,255,.5); backdrop-filter: blur(12px); border: .5px solid rgba(255,255,255,.7); color: #1c1c1e; }
.pv-bento-saas { background: #f6f7fb; }
.pv-bento-saas span { background: #4f46e5; color: #fff; border-radius: 10px; }
.pv-dark-aurora { background: radial-gradient(400px 180px at 20% 0%, #22d3ee66, transparent), radial-gradient(400px 180px at 90% 80%, #a78bfa88, transparent), #070914; }
.pv-dark-aurora span { background: linear-gradient(90deg,#22d3ee,#a78bfa); color: #04232a; }
.pv-neo-brutal { background: #fff7d6; }
.pv-neo-brutal span { background: #ff5a1f; color: #111; border: 3px solid #111; border-radius: 0; box-shadow: 4px 4px 0 #111; }
.pv-clay-soft { background: #eee9fb; }
.pv-clay-soft span { background: #7c5cff; color: #fff; border-radius: 999px; box-shadow: 6px 6px 12px #d0cbe6; }
.pv-neon-cyber { background: #05060a; }
.pv-neon-cyber span { background: #00f0ff; color: #021016; box-shadow: 0 0 16px #00f0ff; border-radius: 4px; text-transform: uppercase; }
.pv-swiss-editorial { background: #f5f4f0; }
.pv-swiss-editorial span { background: #e10600; color: #fff; border-radius: 0; letter-spacing: .08em; text-transform: uppercase; font-size: 11px; }

.tpl-thumb { position: relative; }
.tpl-thumb i { position: absolute; left: 12px; top: 12px; font-style: normal; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; padding: 4px 8px; border-radius: 99px; background: rgba(0,0,0,.55); color: #fff; }
