/* ==========================================================================
   Color My Prompts — Core stylesheet
   Ported 1:1 from the Lovable design tokens.
   ========================================================================== */

:root {
  --radius: 1.25rem;
  --background: #eef1fb;
  --foreground: #0f172a;
  --surface: #ffffff;
  --surface-soft: #f5f7fb;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --primary: #2563eb;
  --primary-foreground: #ffffff;
  --secondary: #a855f7;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --accent: #eef2ff;
  --border: #e5e7eb;
  --ring: #2563eb;
  --hero-bg: #e6ecfb;
  --gradient-primary: linear-gradient(90deg, #4f7cf6, #a855f7, #ec4899);
  --gradient-blue: linear-gradient(135deg, #4f7cf6, #2563eb);
  --gradient-orange: linear-gradient(135deg, #fb923c, #f97316);
  --gradient-green: linear-gradient(135deg, #22c55e, #16a34a);
  --grid-color: rgba(148, 163, 200, 0.35);
  --shadow-card: 0 6px 24px -12px rgba(15, 23, 42, 0.14);
  --frame-bg: radial-gradient(circle at 50% 55%, #fbbf77 0%, #f59e5c 40%, #fdba74 70%, #fed7aa 100%);
  --font-sans: "Nunito", "DM Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-sans); letter-spacing: -0.02em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* ---------- helpers ---------- */
.cmp-wrap { width: 100%; max-width: 1152px; margin-inline: auto; padding-inline: 16px; }
.cmp-page { min-height: 100vh; padding-top: 16px; padding-bottom: 32px; }
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.btn-gradient-blue { background: var(--gradient-blue); color: #fff; }
.btn-gradient-orange { background: var(--gradient-orange); color: #fff; }
.btn-gradient-green { background: var(--gradient-green); color: #fff; }
.card-soft { background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.panel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-card);
}
.gradient-border-top { position: relative; }
.gradient-border-top::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--gradient-primary);
  border-top-left-radius: inherit; border-top-right-radius: inherit;
}
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px,1px,1px,1px); white-space: nowrap;
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   Header / top bar
   ========================================================================== */
.cmp-header {
  position: sticky; top: 12px; z-index: 50;
  width: 100%; max-width: 1024px; margin-inline: auto;
  padding-inline: 12px;
}
.glass-bar {
  display: flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 8px 12px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 8px 30px -12px rgba(15, 23, 42, 0.12);
}
.cmp-logo { display: flex; align-items: center; gap: 8px; padding-left: 4px; min-width: 0; flex: 0 1 auto; overflow: hidden; }
.cmp-logo-mark {
  display: grid; place-items: center; height: 36px; width: 36px;
  border-radius: 12px; background: var(--card); box-shadow: 0 0 0 1px var(--border) inset;
  font-size: 20px; font-weight: 900; line-height: 1;
}
.cmp-logo-text { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.cmp-logo img { max-height: 36px; width: auto; }

.cmp-nav { display: none; align-items: center; gap: 2px; margin-left: 10px; min-width: 0; }
.cmp-nav a {
  display: inline-flex; align-items: center; padding: 8px 12px;
  border-radius: 999px; font-size: 13.5px; font-weight: 700;
  color: var(--muted-foreground); transition: background .2s, color .2s;
  white-space: nowrap;
}
.cmp-nav a:hover, .cmp-nav .current-menu-item > a { background: var(--accent); color: var(--foreground); }
.cmp-nav ul { display: flex; align-items: center; gap: 2px; }
.cmp-nav .sub-menu { display: none; }

.cmp-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.cmp-burger { flex: 0 0 auto; order: -1; }
.cmp-icon-btn {
  display: grid; place-items: center; height: 40px; width: 40px; border-radius: 999px;
  background: var(--muted); color: var(--foreground);
  transition: transform .2s, background .2s;
}
.cmp-icon-btn:hover { background: var(--accent); transform: scale(1.05); }
.cmp-icon-btn svg { height: 17px; width: 17px; }
.cmp-icon-btn.is-premium { color: #f59e0b; }
.cmp-burger { display: grid; }
[data-icon="sun"] { display: none; }
html.dark [data-icon="moon"] { display: none; }
html.dark [data-icon="sun"] { display: block; }

@media (min-width: 1024px) {
  .cmp-header { max-width: 1152px; }
  .cmp-nav { display: flex; }
  .cmp-burger { display: none; }
}

/* ---------- mobile drawer ---------- */
.cmp-drawer-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s;
}
.cmp-drawer-backdrop.is-open { opacity: 1; visibility: visible; }
.cmp-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 95;
  width: min(86vw, 330px);
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-top-right-radius: 26px; border-bottom-right-radius: 26px;
  box-shadow: 24px 0 60px -30px rgba(15, 23, 42, 0.45);
  transform: translateX(-104%);
  transition: transform .34s cubic-bezier(.22,1,.36,1);
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
}
.cmp-drawer.is-open { transform: translateX(0); }
.cmp-drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 12px; border-bottom: 1px solid var(--border);
}
.cmp-drawer-head .cmp-logo-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-drawer-head .cmp-icon-btn { margin-left: auto; height: 42px; width: 42px; flex: 0 0 auto; }
.cmp-drawer-nav { padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.cmp-drawer-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 14px;
  font-size: 15px; font-weight: 800; color: var(--foreground);
  transition: background .18s, transform .18s;
}
.cmp-drawer-nav a:active { transform: scale(.98); }
.cmp-drawer-nav a:hover, .cmp-drawer-nav .current-menu-item > a { background: var(--accent); color: var(--primary); }
.cmp-drawer-nav .sub-menu { padding-left: 12px; }
.cmp-drawer-label {
  padding: 14px 14px 6px; font-size: 10.5px; font-weight: 900;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted-foreground);
}
.cmp-drawer-foot {
  margin-top: auto; padding: 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.cmp-drawer-foot .cmp-pill {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; border-radius: 999px; background: var(--muted);
  font-size: 13px; font-weight: 800;
}

/* ==========================================================================
   Search overlay
   ========================================================================== */
.cmp-search-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: none; justify-content: center; align-items: flex-start;
  padding: 96px 16px 16px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}
.cmp-search-overlay.is-open { display: flex; animation: fadeIn .18s ease-out; }
.cmp-search-box {
  width: 100%; max-width: 576px; overflow: hidden;
  border-radius: 18px; background: var(--card);
  box-shadow: 0 30px 70px -30px rgba(15, 23, 42, .6);
  animation: scaleIn .18s ease-out;
}
.cmp-search-top {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.cmp-search-top input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14px;
}
.cmp-search-top kbd {
  border: 1px solid var(--border); background: var(--muted); border-radius: 6px;
  padding: 2px 6px; font-size: 10px; font-weight: 800; color: var(--muted-foreground);
}
.cmp-search-results { max-height: 384px; overflow-y: auto; padding: 8px; }
.cmp-search-results a {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  border-radius: 12px; transition: background .15s;
}
.cmp-search-results a:hover { background: var(--accent); }
.cmp-search-results img { height: 40px; width: 40px; border-radius: 8px; object-fit: cover; }
.cmp-search-empty { padding: 32px 16px; text-align: center; font-size: 14px; color: var(--muted-foreground); }
.cmp-search-title { font-size: 14px; font-weight: 800; }
.cmp-search-cat { font-size: 12px; color: var(--muted-foreground); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero-bg {
  background-color: var(--hero-bg);
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: -1px -1px;
}
.cmp-hero { margin-top: 24px; padding: 56px 16px; text-align: center; }
.cmp-hero h1 {
  margin-inline: auto; max-width: 56rem;
  font-size: 2rem; font-weight: 900; line-height: 1.08;
}
.cmp-hero .cmp-hero-sub {
  margin-top: 8px; font-size: 2rem; font-weight: 900; line-height: 1.08;
}
.cmp-hero p.cmp-hero-lead {
  margin: 20px auto 0; max-width: 36rem; font-size: 15px;
  line-height: 1.65; color: var(--muted-foreground);
}
.cmp-hero-form {
  margin: 28px auto 0; display: flex; align-items: center; gap: 8px;
  width: 100%; max-width: 42rem;
  border-radius: 999px; background: var(--card); padding: 6px 6px 6px 20px;
  box-shadow: 0 10px 40px -16px rgba(15, 23, 42, .35), 0 0 0 1px var(--border);
}
.cmp-hero-form input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  padding: 12px 0; font-size: 15px;
}
.cmp-hero-form button {
  display: grid; place-items: center; flex: 0 0 auto; height: 44px; width: 44px;
  border-radius: 999px; background: var(--primary); color: var(--primary-foreground);
  box-shadow: 0 6px 18px -8px rgba(37, 99, 235, .8);
  transition: filter .2s, transform .2s;
}
.cmp-hero-form button:hover { filter: brightness(1.1); transform: scale(1.05); }
.cmp-hero-tags {
  margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: center; gap: 2px 4px; font-size: 14px;
}
.cmp-hero-tags .lbl { margin-right: 8px; color: var(--muted-foreground); }
.cmp-hero-tags a { font-weight: 800; transition: color .2s; }
.cmp-hero-tags a:hover { color: var(--primary); }
.cmp-hero-tags .sep { margin-inline: 8px; color: color-mix(in srgb, var(--muted-foreground) 50%, transparent); }

/* ---------- tabs ---------- */
.cmp-tabs {
  margin: 40px auto 0; display: flex; max-width: 28rem;
  align-items: center; justify-content: space-around; gap: 4px; overflow-x: auto;
}
.cmp-tabs a {
  display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 10px 16px; font-size: 14px; font-weight: 800;
  color: var(--muted-foreground); transition: background .2s, color .2s;
}
.cmp-tabs a.is-active {
  background: var(--card); color: var(--foreground);
  box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 0 0 1px var(--border);
}
.cmp-tabs svg { height: 16px; width: 16px; }

/* ==========================================================================
   Prompt cards grid
   ========================================================================== */
.cmp-grid {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (min-width: 640px) { .cmp-grid { gap: 24px; } }
@media (min-width: 768px) { .cmp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .cmp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cmp-grid.is-related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1024px) { .cmp-grid.is-related { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.cmp-card {
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
  border-radius: 24px; background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: transform .3s ease, box-shadow .3s ease;
}
.cmp-card:hover { transform: translateY(-6px); box-shadow: 0 24px 48px -24px rgba(15, 23, 42, .35); }
.cmp-card-media { position: relative; aspect-ratio: 3 / 4; overflow: hidden; }
.cmp-card-media img {
  position: absolute; inset: 0; height: 100%; width: 100%;
  object-fit: cover; object-position: center;
  transition: transform .6s cubic-bezier(.22,1,.36,1);
}
.cmp-card:hover .cmp-card-media img { transform: scale(1.07); }
.cmp-card-shade {
  pointer-events: none; position: absolute; inset: auto 0 0 0; height: 50%;
  background: linear-gradient(to top, rgba(0,0,0,.7), rgba(0,0,0,.2) 55%, transparent);
  opacity: .9; transition: opacity .3s;
}
.cmp-card:hover .cmp-card-shade { opacity: 1; }
.cmp-badge {
  position: absolute; left: 12px; top: 12px; max-width: 70%;
  border-radius: 999px; background: rgba(15, 23, 42, .85); color: #fff;
  padding: 4px 12px; font-size: 10px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
  backdrop-filter: blur(4px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cmp-like {
  position: absolute; right: 12px; top: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border-radius: 999px; background: rgba(255,255,255,.95); color: #334155;
  padding: 6px 8px; font-size: 10px; font-weight: 800;
  box-shadow: 0 1px 3px rgba(15,23,42,.15);
  transition: transform .2s;
}
.cmp-like:hover { transform: scale(1.1); }
.cmp-like svg { height: 14px; width: 14px; }
.cmp-like.is-liked svg { fill: #f43f5e; color: #f43f5e; }
.cmp-card-body { display: flex; flex: 1; flex-direction: column; padding: 16px; }
.cmp-card-body h3 {
  font-size: 15px; font-weight: 800; line-height: 1.35;
  transition: color .2s;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.cmp-card:hover .cmp-card-body h3 { color: var(--primary); }
.cmp-card-excerpt {
  margin-top: 6px; font-size: 12.5px; line-height: 1.6; color: var(--muted-foreground);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cmp-card-author {
  margin-top: auto; padding-top: 12px; font-size: 11px; font-weight: 700;
  color: color-mix(in srgb, var(--muted-foreground) 80%, transparent);
}

/* ---------- load more ---------- */
.cmp-loadmore-wrap { margin-top: 40px; display: flex; justify-content: center; }
.cmp-btn-pill {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 10px 24px; font-size: 14px; font-weight: 800; color: #fff;
  box-shadow: 0 8px 22px -12px rgba(37,99,235,.9);
  transition: filter .2s, transform .2s;
}
.cmp-btn-pill:hover { filter: brightness(1.1); transform: scale(1.03); }
.cmp-btn-pill:active { transform: scale(.96); }
.cmp-btn-pill[disabled] { opacity: .7; cursor: not-allowed; }
.cmp-end-note { font-size: 14px; font-weight: 700; color: var(--muted-foreground); }
.cmp-empty { grid-column: 1 / -1; padding: 80px 0; text-align: center; color: var(--muted-foreground); }

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */
.cmp-breadcrumbs {
  display: flex; align-items: center; gap: 4px; max-width: 100%; overflow: hidden;
  border-radius: 999px; background: var(--card); padding: 4px;
  box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 0 0 1px var(--border);
}
.cmp-breadcrumbs a, .cmp-breadcrumbs .current {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; flex: 0 0 auto;
  border-radius: 999px; padding: 0 12px; font-size: 12px; font-weight: 700;
  color: var(--muted-foreground); transition: background .2s, color .2s;
}
.cmp-breadcrumbs a:hover { background: var(--accent); color: var(--foreground); }
.cmp-breadcrumbs .sep { flex: 0 0 auto; color: color-mix(in srgb, var(--muted-foreground) 40%, transparent); }
.cmp-breadcrumbs .sep svg { height: 12px; width: 12px; }
.cmp-breadcrumbs .current {
  background: var(--gradient-blue); color: #fff; font-weight: 800;
  min-width: 0; flex: 1 1 auto;
}
.cmp-breadcrumbs .current span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-breadcrumbs .is-cat { max-width: 35%; }
.cmp-breadcrumbs .is-cat span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-breadcrumbs .hide-sm { display: none; }
@media (min-width: 640px) {
  .cmp-breadcrumbs { display: inline-flex; width: auto; }
  .cmp-breadcrumbs .hide-sm { display: inline-flex; }
  .cmp-breadcrumbs .sep.hide-sm { display: inline-flex; }
  .cmp-breadcrumbs .current { flex: 0 0 auto; }
}

/* ==========================================================================
   Single / detail
   ========================================================================== */
.cmp-detail { margin-top: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@media (min-width: 1024px) {
  .cmp-detail { grid-template-columns: minmax(0, 1fr) 460px; align-items: start; }
}
.cmp-detail-media { min-width: 0; align-self: start; padding: 12px; }
@media (min-width: 640px) { .cmp-detail-media { padding: 16px; } }
.cmp-detail-side { display: flex; min-width: 0; flex-direction: column; gap: 16px; }
@media (min-width: 640px) { .cmp-detail-side { gap: 20px; } }

.cmp-kicker {
  display: inline-block; border-radius: 999px; background: #0f172a; color: #fff;
  padding: 4px 12px; font-size: 10px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
}
.cmp-detail-title {
  margin-top: 12px; font-size: 24px; font-weight: 900; line-height: 1.15; word-break: break-word;
}
@media (min-width: 640px) { .cmp-detail-title { font-size: 30px; } }
.cmp-detail-meta { margin-top: 6px; font-size: 14px; color: var(--muted-foreground); }
.cmp-detail-meta strong { color: var(--primary); font-weight: 800; }

/* prompt block */
.cmp-block { padding: 16px; }
@media (min-width: 640px) { .cmp-block { padding: 20px; } }
.cmp-block-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cmp-block-head .left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cmp-block-icon {
  display: grid; place-items: center; height: 32px; width: 32px; flex: 0 0 auto;
  border-radius: 10px; background: color-mix(in srgb, var(--secondary) 15%, transparent); color: var(--secondary);
}
.cmp-block-name {
  font-size: 12px; font-weight: 900; letter-spacing: .1em;
  text-transform: uppercase; color: var(--secondary);
}
.cmp-block-desc { font-size: 11px; color: var(--muted-foreground); }
.cmp-block-icon svg { height: 18px; width: 18px; }
.cmp-block-text {
  margin-top: 16px; white-space: pre-line; word-break: break-word; overflow-wrap: anywhere;
  border-radius: 16px; border: 1px solid var(--border); background: var(--surface-soft);
  padding: 16px; font-size: 15px; line-height: 1.75;
  color: color-mix(in srgb, var(--foreground) 90%, transparent);
  /* long prompts scroll INSIDE the box so Copy/Like stay visible */
  max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.cmp-block-text::-webkit-scrollbar { width: 8px; }
.cmp-block-text::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted-foreground) 35%, transparent);
  border-radius: 999px;
}
.cmp-block-actions { position: relative; }
.cmp-block-actions { margin-top: 16px; display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 10px; }
.cmp-copy-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 800; color: #fff;
  background: var(--gradient-orange);
  transition: filter .2s, background .25s;
}
.cmp-copy-btn:hover { filter: brightness(1.1); }
.cmp-copy-btn.is-copied { background: var(--gradient-green); }
.cmp-copy-btn svg { height: 16px; width: 16px; }
.cmp-like-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 800; color: #fff;
  background: var(--gradient-blue); transition: filter .2s;
}
.cmp-like-btn:hover { filter: brightness(1.1); }
.cmp-like-btn svg { height: 16px; width: 16px; }
.cmp-like-btn.is-liked svg { fill: currentColor; }
.cmp-save-btn {
  display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--card);
  padding: 6px 12px; font-size: 12px; font-weight: 800;
  transition: background .2s;
}
.cmp-save-btn:hover { background: var(--accent); }
.cmp-save-btn svg { height: 14px; width: 14px; }
.cmp-save-btn.is-saved svg { fill: currentColor; }

/* gallery */
.image-frame { background: var(--frame-bg); }
.cmp-gallery { display: flex; flex-direction: column; gap: 12px; }
.cmp-gallery-stage { position: relative; overflow: hidden; border-radius: 18px; }
.cmp-gallery-stage img {
  display: block; height: auto; width: 100%; max-height: 420px; object-fit: contain;
  transition: opacity .2s;
  user-select: none; -webkit-user-drag: none;
}
@media (min-width: 640px) { .cmp-gallery-stage img { max-height: 560px; } }
.cmp-gallery-stage img.is-fading { opacity: 0; }
.cmp-gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; height: 36px; width: 36px;
  border-radius: 999px; background: color-mix(in srgb, var(--card) 90%, transparent);
  color: var(--foreground); box-shadow: 0 6px 18px -8px rgba(15,23,42,.5);
  transition: transform .2s;
}
.cmp-gallery-nav:hover { transform: translateY(-50%) scale(1.1); }
.cmp-gallery-nav.prev { left: 8px; }
.cmp-gallery-nav.next { right: 8px; }
.cmp-gallery-count {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  border-radius: 999px; background: rgba(15,23,42,.5); color: #fff;
  padding: 4px 10px; font-size: 10px; font-weight: 800; backdrop-filter: blur(4px);
}
.cmp-gallery-spark { position: absolute; right: 12px; bottom: 12px; color: rgba(255,255,255,.8); pointer-events: none; }
.image-frame { transition: background .4s ease; }
.cmp-gallery-toolbar { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 8px; }
.cmp-gallery-toolbar button {
  display: grid; place-items: center; height: 34px; width: 34px;
  border-radius: 999px; background: rgba(15,23,42,.55); color: #fff;
  backdrop-filter: blur(4px); box-shadow: 0 6px 18px -8px rgba(15,23,42,.5);
  transition: transform .2s, background .2s;
}
.cmp-gallery-toolbar button:hover { background: rgba(15,23,42,.8); transform: scale(1.08); }
.cmp-gallery-toolbar svg { height: 16px; width: 16px; }
.cmp-lightbox {
  position: fixed; inset: 0; z-index: 999999; display: none; place-items: center;
  background: rgba(2,6,23,.9); padding: 24px;
}
.cmp-lightbox.is-open { display: grid; }
.cmp-lightbox img { max-height: 90vh; max-width: 90vw; object-fit: contain; border-radius: 8px; }
.cmp-lightbox-close {
  position: absolute; top: 18px; right: 18px; display: grid; place-items: center;
  height: 40px; width: 40px; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff;
  transition: background .2s;
}
.cmp-lightbox-close:hover { background: rgba(255,255,255,.22); }
.cmp-gallery-thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.cmp-gallery-thumbs button {
  position: relative; height: 64px; width: 64px; flex: 0 0 auto; overflow: hidden;
  border-radius: 10px; border: 2px solid transparent; opacity: .7; transition: opacity .2s, border-color .2s;
}
.cmp-gallery-thumbs button:hover { opacity: 1; }
.cmp-gallery-thumbs button.is-active { opacity: 1; border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.cmp-gallery-thumbs img { height: 100%; width: 100%; object-fit: cover; }

/* share */
.cmp-share { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px; }
.cmp-share-label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; }
.cmp-share-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-share-list button, .cmp-share-list a {
  display: grid; place-items: center; height: 32px; width: 32px; border-radius: 999px;
  color: #fff; transition: transform .2s;
}
.cmp-share-list button:hover, .cmp-share-list a:hover { transform: scale(1.1); }
.cmp-share-list svg { height: 14px; width: 14px; }
.s-fb { background: #1877F2; } .s-x { background: #0f172a; } .s-wa { background: #25D366; }
.s-tg { background: #229ED9; } .s-copy { background: var(--muted); color: var(--muted-foreground) !important; }
.s-copy.is-copied { background: var(--gradient-green); color: #fff !important; }

/* rating */
.cmp-rating { padding: 20px; }
.cmp-rating-head { display: flex; align-items: center; gap: 8px; }
.cmp-rating-head .ico {
  display: grid; place-items: center; height: 28px; width: 28px;
  border-radius: 10px; background: rgba(251,191,36,.15); color: #fbbf24;
}
.cmp-rating-head h3 { font-size: 14px; font-weight: 800; }
.cmp-rating-body { margin-top: 16px; display: grid; grid-template-columns: auto 1fr; gap: 24px; }
.cmp-rating-avg { text-align: center; }
.cmp-rating-avg .num { font-size: 36px; font-weight: 900; line-height: 1; }
.cmp-rating-avg .stars { margin-top: 6px; display: flex; justify-content: center; gap: 2px; }
.cmp-rating-avg .stars svg { height: 12px; width: 12px; color: color-mix(in srgb, var(--muted-foreground) 40%, transparent); }
.cmp-rating-avg .stars svg.on { color: #fbbf24; fill: #fbbf24; }
.cmp-rating-avg .cnt { margin-top: 6px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); }
.cmp-rating-bars { display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.cmp-rating-bars .row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted-foreground); }
.cmp-rating-bars .track { height: 6px; flex: 1; overflow: hidden; border-radius: 999px; background: var(--muted); }
.cmp-rating-bars .fill { height: 100%; background: #fbbf24; transition: width .4s ease; }
.cmp-rating-foot {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.cmp-rating-foot span { font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); }
.cmp-stars-input { display: flex; gap: 4px; }
.cmp-stars-input button svg { height: 22px; width: 22px; color: color-mix(in srgb, var(--muted-foreground) 45%, transparent); transition: transform .2s, color .2s; }
.cmp-stars-input button.on svg { color: #fbbf24; fill: #fbbf24; }
.cmp-stars-input button:hover svg { transform: scale(1.15); }

/* meta panels */
.cmp-meta-panel { padding: 20px; }
.cmp-meta-panel h3 { font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-foreground); }
.cmp-chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--muted);
  padding: 6px 12px; font-size: 12px; font-weight: 800;
}
.cmp-chip .dot { height: 8px; width: 8px; border-radius: 999px; background: #f97316; }
.cmp-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-tags a {
  border-radius: 999px; background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary); padding: 4px 12px; font-size: 12px; font-weight: 800;
  transition: background .2s;
}
.cmp-tags a:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }

/* description */
.cmp-description { margin-top: 24px; padding: 24px 28px; font-size: 16px; line-height: 1.8; }
.cmp-description p { margin-bottom: 16px; }
.cmp-description p:last-child { margin-bottom: 0; }
.cmp-description h2, .cmp-description h3 { margin: 22px 0 10px; font-weight: 900; }
.cmp-description ul, .cmp-description ol { margin: 0 0 16px 20px; list-style: disc; }
.cmp-description img { border-radius: 16px; }

.cmp-section-title { text-align: center; font-size: 24px; font-weight: 900; }
@media (min-width: 640px) { .cmp-section-title { font-size: 36px; } }
.cmp-related { margin-top: 64px; }

/* ==========================================================================
   Browse by style
   ========================================================================== */
.cmp-browse { margin: 80px auto 0; width: 100%; max-width: 1152px; padding-inline: 16px; }
.cmp-browse-head { text-align: center; }
.cmp-browse-head h2 { font-size: 30px; font-weight: 900; }
@media (min-width: 640px) { .cmp-browse-head h2 { font-size: 36px; } }
.cmp-browse-head .mark { position: relative; display: inline-block; }
.cmp-browse-head .mark::after {
  content: ""; position: absolute; inset: auto 0 4px 0; height: 12px; z-index: -1;
  background: rgba(253, 230, 138, .7);
}
.cmp-browse-head p { margin-top: 8px; font-size: 14px; color: var(--muted-foreground); }
.cmp-browse-grid {
  margin-top: 40px; display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;
}
.cmp-style-card { flex: 0 1 calc(50% - 8px); }
@media (min-width: 640px) { .cmp-style-card { flex-basis: calc(33.333% - 11px); } }
@media (min-width: 768px) { .cmp-style-card { flex-basis: calc(25% - 12px); } }
@media (min-width: 1024px) { .cmp-style-card { flex-basis: calc(20% - 13px); } }
.cmp-style-card {
  display: flex; align-items: center; gap: 12px; text-align: left;
  border-radius: 18px; border: 1px solid var(--border); background: var(--card);
  padding: 14px; box-shadow: 0 2px 10px -6px rgba(15,23,42,.08);
  transition: transform .3s, box-shadow .3s, border-color .3s;
}
.cmp-style-card:hover {
  transform: translateY(-4px); border-color: color-mix(in srgb, var(--primary) 30%, transparent);
  box-shadow: 0 18px 34px -22px rgba(15,23,42,.4);
}
.cmp-style-letter {
  display: grid; place-items: center; height: 44px; width: 44px; flex: 0 0 auto;
  border-radius: 14px; background: var(--gradient-blue); color: #fff;
  font-size: 18px; font-weight: 900; transition: transform .3s;
}
.cmp-style-card:hover .cmp-style-letter { transform: scale(1.1); }
.cmp-style-meta { min-width: 0; }
.cmp-style-meta .nm { display: block; font-size: 13px; font-weight: 800; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-style-card:hover .cmp-style-meta .nm { color: var(--primary); }
.cmp-style-meta .ct { display: block; margin-top: 2px; font-size: 11px; color: var(--muted-foreground); }
.cmp-browse-cta { margin-top: 32px; display: flex; justify-content: center; }

/* ==========================================================================
   Archive / page headers
   ========================================================================== */
.cmp-page-head { margin-top: 32px; text-align: center; }
.cmp-page-head h1 { font-size: 32px; font-weight: 900; }
@media (min-width: 640px) { .cmp-page-head h1 { font-size: 44px; } }
.cmp-page-head p { margin-top: 10px; font-size: 15px; color: var(--muted-foreground); }
.cmp-content-card { margin: 32px auto 0; max-width: 800px; padding: 32px; font-size: 16px; line-height: 1.85; }
@media (min-width: 640px) { .cmp-content-card { padding: 40px; } }
.cmp-content-card h2 { margin: 24px 0 12px; font-size: 24px; font-weight: 900; }
.cmp-content-card h3 { margin: 20px 0 10px; font-size: 19px; font-weight: 900; }
.cmp-content-card p { margin-bottom: 16px; }
.cmp-content-card ul, .cmp-content-card ol { margin: 0 0 16px 22px; list-style: disc; }
.cmp-content-card a { color: var(--primary); font-weight: 700; }

.cmp-pagination { margin-top: 40px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.cmp-pagination .page-numbers {
  display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--border);
  font-size: 14px; font-weight: 800; transition: background .2s;
}
.cmp-pagination .page-numbers:hover { background: var(--accent); }
.cmp-pagination .page-numbers.current { background: var(--gradient-blue); color: #fff; border-color: transparent; }

/* ==========================================================================
   Footer
   ========================================================================== */
.cmp-footer { margin: 64px auto 0; width: 100%; max-width: 1152px; padding: 0 16px 40px; }
.cmp-footer-inner {
  position: relative; overflow: hidden; border-radius: 24px;
  border: 1px solid var(--border); background: var(--card); padding: 32px;
}
@media (min-width: 640px) { .cmp-footer-inner { padding: 40px; } }
.cmp-footer-grid { display: grid; gap: 40px; }
@media (min-width: 768px) { .cmp-footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cmp-footer-brand { grid-column: span 1; }
@media (min-width: 768px) { .cmp-footer-brand { grid-column: span 2; } }
.cmp-footer-brand .row { display: flex; align-items: center; gap: 8px; }
.cmp-footer-brand .nm { font-size: 20px; font-weight: 800; }
.cmp-footer-brand p { margin-top: 16px; max-width: 28rem; font-size: 14px; color: var(--muted-foreground); }
.cmp-social { margin-top: 20px; display: flex; gap: 8px; }
.cmp-social a {
  display: grid; place-items: center; height: 36px; width: 36px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted-foreground); transition: color .2s, background .2s;
}
.cmp-social a:hover { color: var(--foreground); background: var(--accent); }
.cmp-footer-links h4 {
  font-size: 12px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted-foreground);
}
.cmp-footer-links ul { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.cmp-footer-links a { font-size: 14px; color: var(--muted-foreground); transition: color .2s; }
.cmp-footer-links a:hover { color: var(--foreground); }
.cmp-footer-bottom {
  margin-top: 40px; border-top: 1px solid var(--border); padding-top: 24px;
  text-align: center; font-size: 12px; color: var(--muted-foreground);
}
.cmp-footer-bottom strong { color: var(--foreground); }

/* ==========================================================================
   Toast
   ========================================================================== */
.cmp-toast-host {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; padding-inline: 16px; width: 100%; max-width: 420px;
}
.cmp-toast {
  display: inline-flex; align-items: center; gap: 10px;
  border-radius: 14px; background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 18px 40px -20px rgba(15,23,42,.5);
  padding: 12px 18px; font-size: 14px; font-weight: 700;
  animation: toastIn .28s cubic-bezier(.22,1,.36,1);
}
.cmp-toast .ok { color: #16a34a; display: grid; place-items: center; }
.cmp-toast.is-out { animation: toastOut .25s ease forwards; }

/* 404 */
.cmp-404 { padding: 96px 0; text-align: center; }
.cmp-404 .code { font-size: 88px; font-weight: 900; line-height: 1; }
.cmp-404 p { margin: 12px 0 24px; color: var(--muted-foreground); }

/* ==========================================================================
   Libraries index + taxonomy header (left aligned, centered container)
   ========================================================================== */
.cmp-page-head.is-left { text-align: left; margin-top: 20px; }
.cmp-page-head.is-left p { max-width: 46rem; }
.cmp-page-head.is-left + .cmp-browse-grid,
.cmp-page-head.is-left + .cmp-grid { margin-top: 32px; }
main.cmp-wrap > .cmp-breadcrumbs { margin-top: 24px; }
main.cmp-wrap > .cmp-browse-grid {
  margin-top: 32px; display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;
}
