/* PromptHub (kz-prompthub.js): the grid reuses the Style Gallery's cards
   (imagine.css .im-sg-*), the carousel (kz-carousel.css) and Mithu's loaders;
   this is the page around them and one prompt's page. Plum and gold. */

.ph { max-width: 1280px; margin: 0 auto; padding: calc(var(--kz-nav-h, 72px) + 28px) 20px 80px; color: #f4e9e4; }

/* ── The grid's head ───────────────────────────────────────────────────── */
.ph-head { text-align: center; margin-bottom: 22px; }
.ph-head { position: relative; }
.ph-head::before { content: ''; position: absolute; inset: -40px -20px auto; height: 420px; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 60% at 50% 30%, rgba(201,143,208,.16), transparent 70%), radial-gradient(40% 50% at 70% 10%, rgba(227,184,119,.12), transparent 70%); }
.ph-kicker { display: inline-flex; align-items: center; gap: 10px; margin: 0; padding: 7px 14px; border-radius: 999px;
  border: 1px solid rgba(216,163,94,.3); background: rgba(40,24,34,.55);
  font: 700 .68rem/1 Inter, system-ui, sans-serif; letter-spacing: .2em; text-transform: uppercase; color: #e8c38a; }
.ph-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #7fe0a3; box-shadow: 0 0 0 0 rgba(127,224,163,.6);
  animation: ph-pulse 1.8s ease-out infinite; flex: 0 0 auto; }
@keyframes ph-pulse { 70% { box-shadow: 0 0 0 9px rgba(127,224,163,0); } 100% { box-shadow: 0 0 0 0 rgba(127,224,163,0); } }
.ph-title { margin: 18px 0 10px; font: 700 clamp(34px, 5.6vw, 68px)/1.05 Inter, system-ui, sans-serif; letter-spacing: -.02em; color: #fbf1ea; }
.ph-title em { font-family: 'Playfair Display', Georgia, serif; font-weight: 600; font-style: italic; letter-spacing: 0;
  background: linear-gradient(100deg, #f6dfae, #e3b877 45%, #c98fd0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ph-big { background: linear-gradient(100deg, #f6dfae, #e3b877); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ph-sub { margin: 0 auto 22px; max-width: 680px; color: rgba(244,233,228,.76); font-size: 16px; line-height: 1.65; }
.ph-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-width: 820px; margin: 0 auto 24px; }
.ph-stats > div { padding: 14px 10px; border-radius: 14px; border: 1px solid rgba(216,163,94,.18); background: rgba(24,15,21,.7); }
.ph-stats b { display: block; font: 800 clamp(22px, 2.8vw, 30px)/1.1 Inter, system-ui, sans-serif; color: #f6dfae; font-variant-numeric: tabular-nums; }
.ph-stats span { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: rgba(244,233,228,.62); }
.ph-drop { border-color: rgba(127,224,163,.35) !important; background: linear-gradient(160deg, rgba(40,70,52,.45), rgba(24,15,21,.7)) !important; }
.ph-drop b { color: #a8f0c4; }
@media (max-width: 640px) { .ph-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ph-sub { font-size: 15px; } }
@media (prefers-reduced-motion: reduce) { .ph-live { animation: none; } }
.ph-tools { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.ph-search { flex: 1 1 320px; max-width: 520px; min-width: 0; padding: 11px 18px; border-radius: 999px; border: 1px solid rgba(216,163,94,.35);
  background: rgba(30,18,26,.7); color: #f4e9e4; font: 15px Inter, system-ui, sans-serif; }
.ph-search:focus { outline: none; border-color: #e3b877; box-shadow: 0 0 0 3px rgba(227,184,119,.18); }
.ph-seg { display: inline-flex; border: 1px solid rgba(216,163,94,.35); border-radius: 999px; overflow: hidden; }
.ph-seg button { background: transparent; border: 0; color: rgba(244,233,228,.75); padding: 9px 16px; font: 600 13px Inter, sans-serif; cursor: pointer; }
.ph-seg button.is-on { background: rgba(216,163,94,.22); color: #f6dfae; }
.ph-tools--sub { margin-top: -4px; align-items: center; }
.ph-seg--sm button { padding: 7px 13px; font-size: 12.5px; }
.ph-sort { display: inline-flex; align-items: center; gap: 8px; color: rgba(244,233,228,.62); font: 600 12.5px Inter, sans-serif; }
.ph-sort select { padding: 7px 30px 7px 14px; border-radius: 999px; border: 1px solid rgba(216,163,94,.35); background: rgba(30,18,26,.7);
  color: #f4e9e4; font: 600 12.5px Inter, sans-serif; cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #e3b877 50%), linear-gradient(135deg, #e3b877 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.ph-sort select:focus { outline: none; border-color: #e3b877; box-shadow: 0 0 0 3px rgba(227,184,119,.18); }
.ph-sort select:disabled { opacity: .5; cursor: not-allowed; }
.ph-sort option { background: #1e121a; }
@media (max-width: 640px) { .ph-seg--sm { flex-wrap: wrap; justify-content: center; border-radius: 16px; } }
.ph-chips, .ph-active { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ph-active { margin-top: 10px; align-items: center; }
.ph-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; border: 1px solid rgba(216,163,94,.3);
  background: rgba(40,24,34,.6); color: #f0e2d6; font: 500 13px Inter, sans-serif; cursor: pointer; text-decoration: none; }
.ph-chip small { color: rgba(232,195,138,.7); font-size: 11px; }
.ph-chip:hover { border-color: #e3b877; }
.ph-chip.is-on { background: rgba(216,163,94,.25); border-color: #e3b877; color: #fff3dd; }
.ph-chip--more { border-style: dashed; color: #e8c38a; }
.ph-found { color: rgba(244,233,228,.65); font-size: 13px; }
.ph-note { grid-column: 1 / -1; text-align: center; color: rgba(244,233,228,.7); }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.ph-card { text-decoration: none; color: inherit; display: block; }
.ph-count { position: absolute; top: 10px; left: 10px; z-index: 3; min-width: 26px; padding: 3px 8px; border-radius: 999px;
  background: rgba(18,10,14,.66); border: 1px solid rgba(216,163,94,.45); color: #f6dfae; font: 700 11px Inter, sans-serif; text-align: center; }
.ph-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 50px 16px; text-align: center; }
.ph-empty b { display: block; font-family: 'Instrument Serif', Georgia, serif; font-size: 24px; font-weight: 400; }
.ph-empty span { color: rgba(244,233,228,.65); }
.ph-empty a { color: #e8c38a; }

/* ── One prompt ────────────────────────────────────────────────────────── */
.ph-back { display: inline-block; margin-bottom: 16px; color: #e8c38a; text-decoration: none; font: 600 14px Inter, sans-serif; }
.ph-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.ph-media { position: sticky; top: calc(var(--kz-nav-h, 72px) + 16px); }
.ph-frame { border-radius: 16px; overflow: hidden; background: #1c1116; border: 1px solid rgba(216,163,94,.18); max-height: 82vh; margin: 0 auto; }
.ph-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ph-vars { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; }
.ph-var { flex: 0 0 auto; width: 64px; height: 84px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; opacity: .72; }
.ph-var img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-var.is-on, .ph-var:hover { border-color: #e3b877; opacity: 1; }
.ph-titlerow { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.ph-name { margin: 0; font: 700 clamp(22px, 2.6vw, 30px)/1.25 Inter, system-ui, sans-serif; color: #fbf1ea; }
.ph-save { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(216,163,94,.4); background: transparent; color: #f0e2d6; font: 600 13px Inter, sans-serif; cursor: pointer; }
.ph-save.is-on { background: rgba(216,163,94,.2); color: #f6dfae; }
.ph-box { position: relative; background: rgba(14,9,12,.78); border: 1px solid rgba(216,163,94,.16); border-radius: 14px; padding: 18px 20px; margin-bottom: 14px; }
.ph-box h3 { margin: 0 0 10px; font: 700 15px Inter, sans-serif; color: #fbf1ea; }
.ph-box h3 + div, .ph-box div + h3 { margin-top: 0; }
.ph-tags h3:not(:first-child) { margin-top: 14px; }
.ph-tags div { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-text { margin: 0; white-space: pre-wrap; word-wrap: break-word; font: 14px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #efe4dc; }
.ph-text mark { background: rgba(227,184,119,.28); color: #fff3dd; border-radius: 3px; padding: 0 2px; }
.ph-prompt .ph-text { max-height: 60vh; overflow: auto; }
.ph-desc, .ph-good { margin: 0; color: rgba(244,233,228,.78); line-height: 1.7; font-size: 15px; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.ph-btn { display: inline-flex; align-items: center; padding: 9px 16px; border-radius: 10px; border: 1px solid rgba(216,163,94,.4);
  background: transparent; color: #f4e9e4; font: 600 14px Inter, sans-serif; cursor: pointer; text-decoration: none; }
.ph-btn--solid { background: #f2e9df; color: #24161e; border-color: #f2e9df; }
.ph-btn--ghost { border-color: transparent; color: rgba(244,233,228,.7); }
.ph-btn:hover { border-color: #e3b877; }

/* The lock: the opening paragraph, a fade, and the way in. */
.ph-prompt--locked .ph-lead { font: 14px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ph-fade { height: 70px; margin-top: -40px; position: relative; background: linear-gradient(180deg, rgba(14,9,12,0), rgba(14,9,12,.96)); }
.ph-lock { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 6px 4px 2px; }
.ph-lock b { font-family: 'Instrument Serif', Georgia, serif; font-size: 22px; font-weight: 400; color: #fbf1ea; }
.ph-lock > span:not(.lock-ico) { color: rgba(244,233,228,.66); font-size: 14px; }
.ph-lock .lock-ico { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(216,163,94,.6); color: #e8c38a; }
.ph-lock .ph-actions { justify-content: center; }

.ph-sugg ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ph-sugg li { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; color: rgba(244,233,228,.82); font-size: 14px; line-height: 1.6; }
.ph-sugg li b { color: #f6dfae; font-weight: 600; }
.ph-apply { flex: 0 0 auto; padding: 4px 11px; border-radius: 999px; border: 1px solid rgba(216,163,94,.4); background: transparent; color: #e8c38a; font: 600 12px Inter, sans-serif; cursor: pointer; }
.ph-apply[aria-pressed="true"] { background: rgba(216,163,94,.22); color: #fff3dd; }
.ph-apply--locked { cursor: default; border-color: transparent; }

.ph-similar { margin-top: 36px; }
.ph-similar h3 { font: 700 18px Inter, sans-serif; margin: 0 0 14px; }
.ph-sim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.ph-sim { text-decoration: none; color: rgba(244,233,228,.8); font-size: 13px; line-height: 1.4; }
.ph-sim img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; display: block; margin-bottom: 6px; border: 1px solid rgba(216,163,94,.14); }
.ph-sim:hover img { border-color: #e3b877; }

.ph-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50;
  padding: 10px 18px; border-radius: 999px; background: rgba(30,18,26,.95); border: 1px solid rgba(216,163,94,.45); color: #f6dfae; font: 600 14px Inter, sans-serif; transition: .25s; }
.ph-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 860px) {
  .ph { padding-left: 16px; padding-right: 16px; }
  .ph-cols { grid-template-columns: 1fr; gap: 20px; }
  .ph-media { position: static; }
  .ph-frame { max-height: 70vh; }
}

/* ── Compact header: the heading on one line (kz-page-head, as Gallery and
   Styles), search + Filters, the extras folded, categories in one row. ── */
.ph-head { text-align: left; margin-bottom: 10px; }
.ph-pagehead { margin: 4px 0 12px; max-width: none; }
.ph-pagehead .kz-page-line b { color: #f6dfae; font-weight: 700; font-variant-numeric: tabular-nums; }
.ph-new { display: inline-flex; align-items: center; gap: 5px; color: #a8f0c4; }
.ph-tools { justify-content: flex-start; margin-bottom: 10px; }
.ph-search { max-width: 640px; padding: 9px 16px; font-size: 14px; }
.ph-filters-btn { display: inline-flex; align-items: center; gap: 4px; padding: 0 16px; min-height: 38px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(216,163,94,.35); background: rgba(255,255,255,.04); color: #f4e9e4; font: 600 13px Inter, sans-serif; }
.ph-filters-btn b { color: #e3b877; }
.ph-filters-btn[aria-expanded="true"] { border-color: rgba(216,163,94,.7); }
.ph-tools--sub[hidden] { display: none; }
.ph-tools--sub { margin-top: 0; }
.ph-chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; padding-bottom: 2px;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent 100%);
          mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent 100%); }
.ph-chips::-webkit-scrollbar { display: none; }
.ph-chips .ph-chip { flex: none; padding: 5px 11px; font-size: 12.5px; }
.ph-chips .ph-chip--more { display: none; }
.ph-active { justify-content: flex-start; }
