/**
 * Pic Prompt — mobile-first, lightweight frontend
 * Core Web Vitals: system fonts, no heavy animation libs, CLS-safe image aspect-ratio
 */

:root {
  --pp-bg: #f8fafc;
  --pp-card: #ffffff;
  --pp-text: #0f172a;
  --pp-muted: #64748b;
  --pp-border: #e2e8f0;
  --pp-primary: #6366f1;
  --pp-primary-hover: #4f46e5;
  --pp-success: #059669;
  --pp-radius: 12px;
  --pp-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --pp-font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

.pp-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
  font-family: var(--pp-font);
  color: var(--pp-text);
  background: var(--pp-bg);
  box-sizing: border-box;
}

.pp-wrap *,
.pp-wrap *::before,
.pp-wrap *::after {
  box-sizing: border-box;
}

/* Breadcrumb — minimal */
.pp-breadcrumb {
  font-size: 0.8125rem;
  color: var(--pp-muted);
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.pp-breadcrumb a {
  color: var(--pp-muted);
  text-decoration: none;
}
.pp-breadcrumb a:hover {
  color: var(--pp-primary);
}

/* Single layout */
.pp-single {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .pp-single {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.75rem;
    align-items: start;
  }
}

.pp-card {
  background: var(--pp-card);
  border: 1px solid var(--pp-border);
  border-radius: var(--pp-radius);
  box-shadow: var(--pp-shadow);
  padding: 1rem;
}

/* Image — reserve space to reduce CLS */
.pp-image-wrap {
  position: relative;
  border-radius: calc(var(--pp-radius) - 2px);
  overflow: hidden;
  background: #e2e8f0;
  aspect-ratio: 4 / 5;
}
.pp-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pp-model-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--pp-text);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--pp-border);
  text-decoration: none;
}

.pp-title {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

.pp-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.pp-chip {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pp-muted);
  background: #f1f5f9;
  border: 1px solid var(--pp-border);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  text-decoration: none;
}
a.pp-chip:hover {
  border-color: var(--pp-primary);
  color: var(--pp-primary);
}

/* Prompt box + Copy button (MANDATORY, highly visible) */
.pp-prompt-box {
  margin-top: 0.5rem;
  border: 1px solid var(--pp-border);
  border-radius: var(--pp-radius);
  background: #f8fafc;
  overflow: hidden;
}

.pp-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--pp-border);
  background: #fff;
}

.pp-prompt-label {
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--pp-muted);
}

/* High-visibility CTA */
.pp-copy-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  background: var(--pp-primary);
  color: #fff;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  min-height: 44px; /* touch target */
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.28);
  transition: background 0.15s ease, transform 0.15s ease;
}
.pp-copy-btn:hover,
.pp-copy-btn:focus-visible {
  background: var(--pp-primary-hover);
  outline: none;
}
.pp-copy-btn:active {
  transform: scale(0.98);
}
.pp-copy-btn.is-copied {
  background: var(--pp-success);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.28);
}

.pp-prompt-text {
  margin: 0;
  padding: 1rem;
  font-size: 0.9375rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: #334155;
  font-weight: 500;
  max-height: 320px;
  overflow: auto;
}

/* Full-width secondary copy on mobile */
.pp-copy-btn--block {
  display: none;
  width: 100%;
  margin-top: 0.75rem;
  justify-content: center;
}
@media (max-width: 767px) {
  .pp-copy-btn--header {
    display: none;
  }
  .pp-copy-btn--block {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* About (optional, still minimal) */
.pp-about {
  margin-top: 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #475569;
}
.pp-about h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  color: var(--pp-text);
}

/* Face tool (optional) — still no collection/shared UI */
.pp-face {
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px dashed #c7d2fe;
  border-radius: var(--pp-radius);
  background: #eef2ff;
}
.pp-face h2 {
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
}
.pp-face-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pp-face-actions .pp-copy-btn {
  font-size: 0.8125rem;
  padding: 0.55rem 0.9rem;
  min-height: 40px;
}
.pp-btn-ghost {
  appearance: none;
  background: #fff;
  border: 1px solid var(--pp-border);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  color: var(--pp-text);
  min-height: 40px;
}
.pp-face-hidden {
  display: none;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #334155;
  white-space: pre-wrap;
}

/* Archive grid */
.pp-archive-title {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 800;
  margin: 0 0 1rem;
}
.pp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
@media (min-width: 640px) {
  .pp-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}
@media (min-width: 1024px) {
  .pp-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.pp-grid-card {
  background: var(--pp-card);
  border: 1px solid var(--pp-border);
  border-radius: var(--pp-radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease;
}
.pp-grid-card:hover {
  box-shadow: var(--pp-shadow);
}
.pp-grid-thumb {
  aspect-ratio: 1 / 1;
  background: #e2e8f0;
  overflow: hidden;
}
.pp-grid-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pp-grid-body {
  padding: 0.65rem 0.75rem 0.85rem;
}
.pp-grid-body h2 {
  font-size: 0.875rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pp-pagination {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pp-pagination a,
.pp-pagination span {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--pp-border);
  background: #fff;
  text-decoration: none;
  color: var(--pp-text);
  font-size: 0.875rem;
  font-weight: 600;
}
.pp-pagination .current {
  background: var(--pp-primary);
  border-color: var(--pp-primary);
  color: #fff;
}

/* Visually hidden helper */
.pp-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
