/* Prompt gallery. Builds on ../css/main.css tokens. */
.pg-eyebrow { font-family: var(--font-display); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pink); margin: 0 0 14px; }
.pg-label { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 12px; }
.pg-count { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px; background: var(--plum); color: var(--text); font-size: 0.85rem; }
.pg-link-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.pg-link-btn:hover { color: var(--text); }
.pg-link-btn svg, .pg-icon-btn svg, .pg-search > svg, .pg-cat svg, .pg-meta svg, .btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pg-link-btn svg { width: 16px; height: 16px; }
.pg-icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.pg-icon-btn[hidden] { display: none; }
.pg-icon-btn:hover { background: rgba(7, 92, 123, 0.35); }
.pg-icon-btn svg { width: 18px; height: 18px; }
.pg-save[aria-pressed="true"] { background: var(--pink); border-color: var(--pink); color: var(--bg); }
.pg-save[aria-pressed="true"] svg { fill: currentColor; }
button.btn-ghost { background: transparent; }
button.btn-ghost:hover { background: rgba(7, 92, 123, 0.35); }
.pg-keyword { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85rem; color: var(--pink); }

/* ---------- Hero ---------- */
.pg-hero {
  padding: clamp(48px, 8vw, 96px) 0 clamp(40px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(55% 80% at 85% 40%, rgba(80, 27, 45, 0.9), transparent 70%),
    linear-gradient(180deg, var(--surface), var(--bg) 92%);
}
.pg-hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: end; }
.pg-hero h1 { max-width: 15ch; }
.pg-facts { margin: 0; display: grid; gap: 0; border-left: 1px solid var(--line); }
.pg-facts div { padding: 14px 0 14px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 14px; }
.pg-facts div:last-child { border-bottom: 0; }
.pg-facts dt { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 4vw, 3rem); line-height: 1; min-width: 3ch; }
.pg-facts dd { margin: 0; color: var(--text-dim); }
@media (max-width: 860px) {
  .pg-hero-grid { grid-template-columns: 1fr; }
  .pg-facts { grid-template-columns: repeat(3, 1fr); border-left: 0; border-top: 1px solid var(--line); }
  .pg-facts div { flex-direction: column; gap: 4px; padding: 16px 0 0; border-bottom: 0; }
}

/* ---------- Library ---------- */
.pg-library-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.pg-library-head h2 { margin: 0; }
.pg-saved[aria-pressed="true"] { background: var(--plum); border-color: var(--pink); }
.pg-layout { display: grid; grid-template-columns: 250px 1fr; gap: clamp(24px, 4vw, 48px); align-items: start; }
.pg-sidebar, .pg-content { min-width: 0; }
.pg-sidebar { position: sticky; top: calc(var(--nav-h) + 24px); }
.pg-cats { display: flex; flex-direction: column; gap: 2px; }
.pg-cat { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-dim); font: inherit; font-size: 0.95rem; font-weight: 600; text-align: left; cursor: pointer; }
.pg-cat svg { width: 18px; height: 18px; flex: none; }
.pg-cat span:first-of-type { flex: 1; line-height: 1.3; }
.pg-cat .n { font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.pg-cat:hover { color: var(--text); background: rgba(7, 92, 123, 0.25); }
.pg-cat[aria-pressed="true"] { color: var(--text); background: var(--surface); }
.pg-cat[aria-pressed="true"] .n { color: var(--pink); }
@media (max-width: 860px) {
  .pg-layout { grid-template-columns: 1fr; }
  .pg-sidebar { position: static; margin: 0 calc(var(--gutter) * -1); }
  .pg-sidebar .pg-label { padding: 0 var(--gutter); }
  .pg-cats { flex-direction: row; overflow-x: auto; gap: 8px; padding: 0 var(--gutter) 6px; scrollbar-width: none; }
  .pg-cat { width: auto; flex: none; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; }
  .pg-cat[aria-pressed="true"] { border-color: var(--pink); }
}

.pg-toolbar { display: flex; gap: 12px; margin-bottom: 28px; }
.pg-search { position: relative; flex: 1; display: flex; align-items: center; min-height: 52px; border: 1px solid var(--line); border-radius: 999px; background: rgba(0, 46, 62, 0.4); padding: 0 8px 0 18px; gap: 10px; }
.pg-search:focus-within { border-color: var(--pink); }
.pg-search > svg { width: 20px; height: 20px; color: var(--text-dim); flex: none; }
.pg-search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--text); font: inherit; font-size: 1rem; padding: 12px 0; }
.pg-search input:focus { outline: none; }
.pg-search input::placeholder { color: var(--text-dim); }
.pg-search input::-webkit-search-cancel-button { display: none; }
.pg-search .pg-icon-btn { width: 34px; height: 34px; border: 0; }
.pg-search kbd { font: inherit; font-size: 0.8rem; color: var(--text-dim); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; margin-right: 8px; }
.pg-select { min-height: 52px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--text); font: inherit; font-weight: 600; padding: 0 18px; cursor: pointer; }
@media (max-width: 560px) {
  .pg-toolbar { flex-direction: column; }
  .pg-search kbd { display: none; }
}

.pg-results-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 20px; }
.pg-results-head h3 { font-size: 1.35rem; margin: 0 0 4px; }
.pg-results-head p { margin: 0; }
.pg-results-head [role="status"] { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Cards ---------- */
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.pg-card { --tone: var(--surface); position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(0, 46, 62, 0.22); overflow: hidden; transition: border-color .15s ease, transform .15s ease; }
.pg-card[data-tone="plum"] { --tone: var(--plum); }
.pg-card[data-tone="teal"] { --tone: var(--teal); }
.pg-card:hover { border-color: var(--pink); }
@media (prefers-reduced-motion: no-preference) { .pg-card:hover { transform: translateY(-2px); } }
.pg-visual { position: relative; height: 112px; padding: 16px 18px; background: linear-gradient(135deg, var(--tone), var(--bg) 130%); display: flex; align-items: flex-end; justify-content: space-between; }
.pg-visual .pg-num { font-size: 2.6rem; }
.pg-visual > svg { position: absolute; top: 16px; left: 18px; width: 22px; height: 22px; fill: none; stroke: var(--text); stroke-width: 1.6; opacity: .75; }
.pg-visual .pg-save { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(2, 11, 18, .45); }
.pg-visual .pg-save[aria-pressed="true"] { background: var(--pink); }
.pg-num { font-family: var(--font-display); font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.pg-body { display: flex; flex-direction: column; flex: 1; padding: 18px; }
.pg-body .pg-cat-name { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 8px; }
.pg-body h3 { font-size: 1.05rem; margin: 0 0 6px; }
.pg-open { background: none; border: 0; padding: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.pg-open::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.pg-open:focus-visible { outline: none; }
.pg-card:has(.pg-open:focus-visible) { outline: 2px solid var(--pink); outline-offset: 3px; }
.pg-body p { color: var(--text-dim); font-size: 0.95rem; line-height: 1.5; margin: 10px 0 16px; flex: 1; }
.pg-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.pg-meta span { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; font-weight: 600; color: var(--text); background: rgba(7, 92, 123, 0.3); border-radius: 999px; padding: 3px 10px; }
.pg-meta span.ref { background: rgba(80, 27, 45, 0.85); }
.pg-meta svg { width: 14px; height: 14px; }
.pg-actions { position: relative; z-index: 2; display: flex; gap: 8px; }
.pg-actions .btn { min-height: 40px; padding: 8px 16px; font-size: 0.9rem; flex: 1; }
.pg-actions .btn svg { width: 16px; height: 16px; }

.pg-empty { text-align: center; padding: 64px 16px; border: 1px dashed var(--line); border-radius: var(--r-md); }
.pg-more { text-align: center; margin-top: 36px; }
.pg-more p { margin: 0 0 12px; font-size: 0.95rem; }
.pg-more[hidden] { display: none; }

/* ---------- Steps ---------- */
.pg-steps-section { border-top: 1px solid var(--line); background: linear-gradient(180deg, var(--bg), rgba(0, 46, 62, .35)); }
.pg-steps { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 4vw, 48px); }
.pg-steps li { border-top: 2px solid var(--pink); padding-top: 20px; }
.pg-steps b { display: block; font-family: var(--font-display); font-size: 0.9rem; color: var(--pink); margin-bottom: 14px; }
@media (max-width: 760px) { .pg-steps { grid-template-columns: 1fr; } }

/* ---------- Dialogs ---------- */
.pg-dialog { width: min(640px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: clamp(20px, 3vw, 32px); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg); color: var(--text); box-shadow: 0 40px 80px rgba(0, 0, 0, .6); }
.pg-dialog-wide { width: min(1000px, calc(100% - 32px)); }
.pg-dialog::backdrop { background: rgba(2, 11, 18, .75); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pg-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.pg-dialog-head .pg-eyebrow { margin: 0; }
.pg-dialog-title { display: flex; align-items: flex-start; gap: 18px; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.pg-dialog-title .pg-num { font-size: clamp(2.2rem, 5vw, 3.2rem); color: var(--pink); }
.pg-dialog-title > div { flex: 1; min-width: 0; }
.pg-dialog-title h2 { font-size: clamp(1.3rem, 2.6vw, 1.8rem); margin: 0 0 6px; }
.pg-editor { display: grid; grid-template-columns: 280px 1fr; gap: 28px; }
.pg-context > p { color: var(--text-dim); }
.pg-settings { margin: 0 0 20px; border-top: 1px solid var(--line); }
.pg-settings div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.pg-settings dt { color: var(--text-dim); }
.pg-settings dd { margin: 0; font-weight: 700; text-align: right; }
.pg-note { padding: 14px 16px; border-radius: var(--r-sm); background: rgba(0, 46, 62, .55); margin-bottom: 12px; font-size: 0.95rem; }
.pg-note p { margin: 4px 0 0; color: var(--text-dim); }
.pg-note-ref { background: rgba(80, 27, 45, .8); }
.pg-note-ref strong { color: #FF7FA1; }
.pg-note-ref p { color: var(--text); }
.pg-edit-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 700; }
.pg-edit textarea { width: 100%; min-height: 260px; resize: vertical; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: rgba(0, 46, 62, .35); color: var(--text); font: inherit; font-size: 1rem; line-height: 1.6; }
.pg-edit textarea:focus { outline: none; border-color: var(--pink); }
.pg-hint { font-size: 0.85rem; margin: 6px 0 16px; }
.pg-footnote { font-size: 0.85rem; margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .pg-editor { grid-template-columns: 1fr; }
  .pg-edit { order: -1; }
  .pg-edit textarea { min-height: 200px; }
}
.pg-guide { padding-left: 1.2em; margin: 20px 0; }
.pg-guide li { margin-bottom: 12px; color: var(--text-dim); }
.pg-guide strong { color: var(--text); }
.pg-dialog details { border-top: 1px solid var(--line); padding: 12px 0; }
.pg-dialog summary { cursor: pointer; font-weight: 700; }
.pg-dialog details p { margin: 10px 0 0; }
.pg-download { margin-top: 16px; }

.site-footer .pg-link-btn { color: var(--text-dim); }

.pg-toast { position: fixed; left: 50%; bottom: 24px; z-index: 3000; transform: translate(-50%, 20px); max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.pg-toast.visible { opacity: 1; transform: translate(-50%, 0); }
.pg-toast.warning { background: var(--pink); }

.skip:hover { color: var(--bg); }
