/* ══════════════════════════════════════════════════════════════════
   /posters/ section — stylesheet v4
   ════════════════════════════════════════════════════════════════ */

.ps-page { padding: 0 0 48px; box-sizing: border-box; }
.ps-page *, .ps-page *::before, .ps-page *::after { box-sizing: border-box; }

.ps-wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.ps-breadcrumb {
    display: flex; align-items: center; gap: 6px; padding: 14px 0 0;
    font-size: 13px; color: #6b7280; flex-wrap: wrap;
}
.ps-breadcrumb a { color: #4f46e5; text-decoration: none; }
.ps-breadcrumb a:hover { text-decoration: underline; }
.ps-breadcrumb__sep { opacity: .4; }

.ps-title-block {
    padding: 20px 0 8px; border-bottom: 1px solid #e5e7eb; margin-bottom: 16px;
}
.ps-title-block h1 { font-size: 24px; font-weight: 800; margin: 0 0 4px; color: #111827; letter-spacing: -.015em; }
.ps-title-block__sub { font-size: 14px; color: #6b7280; margin: 0; }

/* Category ribbon */
.ps-cat-ribbon {
    position: sticky; top: 0; z-index: 10;
    background: #fff; border-bottom: 1px solid #e5e7eb; margin-bottom: 20px;
}
.ps-cat-ribbon__inner {
    display: flex; gap: 8px; overflow-x: auto;
    padding: 12px 20px; max-width: 1180px; margin: 0 auto;
    scrollbar-width: none; -ms-overflow-style: none;
}
.ps-cat-ribbon__inner::-webkit-scrollbar { display: none; }
.ps-cat-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 100px;
    background: #f9fafb; border: 1px solid #e5e7eb;
    font-size: 13px; font-weight: 500; color: #4b5563;
    text-decoration: none; white-space: nowrap; flex-shrink: 0;
    transition: background .15s, border-color .15s, color .15s;
}
.ps-cat-pill:hover { background: #fff; border-color: #c7d2fe; color: #4338ca; }
.ps-cat-pill--active { background: #111827; color: #fff; border-color: #111827; }
.ps-cat-pill--active:hover { background: #1f2937; color: #fff; }
.ps-cat-pill__count {
    font-size: 11px; opacity: .6; background: rgba(0,0,0,.05);
    padding: 1px 6px; border-radius: 100px; font-weight: 600;
}
.ps-cat-pill--active .ps-cat-pill__count { background: rgba(255,255,255,.2); opacity: .9; }

.ps-section { margin-bottom: 32px; }
.ps-section__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.ps-section__title { font-size: 16px; font-weight: 700; margin: 0; color: #111827; line-height: 1.3; text-transform: uppercase; letter-spacing: .05em; }
.ps-section__more { font-size: 13px; color: #4f46e5; text-decoration: none; font-weight: 600; }
.ps-section__more:hover { text-decoration: underline; }

/* Poster grid — square cards (the thumb shows full 1080×1080 composite) */
.ps-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.ps-grid--featured { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

.ps-card {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
    overflow: hidden; text-decoration: none; color: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    display: flex; flex-direction: column; position: relative;
}
.ps-card:hover { border-color: #a5b4fc; transform: translateY(-2px); box-shadow: 0 8px 20px -8px rgba(15,23,42,.12); }
.ps-card__img-wrap { aspect-ratio: 4/3; width: 100%; overflow: hidden; background: #f3f4f6; position: relative; }
.ps-card__img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.ps-card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.ps-card__cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #4f46e5; }
.ps-card__title {
    font-size: 13px; font-weight: 600; color: #111827;
    line-height: 1.4; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; min-height: 36px;
}
.ps-card__frame-badge {
    position: absolute; top: 8px; right: 8px;
    background: #111827; color: #fff;
    font-size: 10px; font-weight: 700;
    padding: 3px 8px; border-radius: 100px; letter-spacing: .3px; z-index: 2;
}
.ps-card__lastdate {
    position: absolute; top: 8px; left: 8px;
    background: #dc2626; color: #fff;
    font-size: 10px; font-weight: 700;
    padding: 3px 8px; border-radius: 100px; z-index: 2;
}
.ps-chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 100px; background: #f3f4f6; color: #4b5563; font-size: 11px; font-weight: 500; }

.ps-cat-header { padding: 20px 0 16px; border-bottom: 1px solid #e5e7eb; margin-bottom: 20px; }
.ps-cat-header h1 { margin: 0 0 4px; font-size: 26px; font-weight: 800; line-height: 1.2; color: #111827; }
.ps-cat-header__sub { margin: 0; color: #6b7280; font-size: 14px; }
.ps-cat-header__meta { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.ps-subcat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.ps-subcat-tab { padding: 6px 14px; border-radius: 6px; background: #f9fafb; color: #4b5563; font-size: 13px; font-weight: 500; text-decoration: none; border: 1px solid transparent; }
.ps-subcat-tab:hover { background: #fff; border-color: #e5e7eb; }
.ps-subcat-tab--active { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }

.ps-pagination { display: flex; justify-content: center; gap: 4px; margin-top: 28px; flex-wrap: wrap; }
.ps-page-btn { min-width: 38px; height: 38px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid #e5e7eb; background: #fff; text-decoration: none; color: #4b5563; font-size: 14px; font-weight: 500; }
.ps-page-btn:hover { border-color: #a5b4fc; color: #4f46e5; }
.ps-page-btn--active { background: #111827; color: #fff; border-color: #111827; }

/* SINGLE POSTER PAGE */
.ps-article { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: flex-start; padding-top: 16px; }
@media (max-width: 900px) { .ps-article { grid-template-columns: 1fr; } }
.ps-article__main { min-width: 0; }
.ps-article__side { position: sticky; top: 20px; }

.ps-post-head { margin-bottom: 18px; }
.ps-post-head h1 { font-size: 26px; font-weight: 800; line-height: 1.3; color: #111827; margin: 0 0 10px; }
.ps-post-head__meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13px; color: #6b7280; }
.ps-post-head__cat-link { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 100px; background: #eef2ff; color: #4338ca; font-weight: 600; text-decoration: none; font-size: 12px; }
.ps-post-head__cat-link:hover { background: #e0e7ff; }

.ps-post-img-wrap { width: 100%; max-width: 520px; margin: 0 auto 18px; }
.ps-post-img {
    width: 100%; aspect-ratio: 4/3;
    border-radius: 12px; overflow: hidden;
    border: 1px solid #e5e7eb; background: #f9fafb;
    display: block; position: relative;
}
.ps-post-img img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }

.ps-post-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 520px; margin: 0 auto 24px; }
.ps-post-actions--single { grid-template-columns: 1fr; }
.ps-post-actions .btn, .ps-post-actions a.btn { width: 100%; }
.ps-btn-brand {
    background: linear-gradient(135deg, #8b5cf6, #ec4899) !important;
    border: none !important; color: #fff !important;
}
.ps-btn-brand:hover { background: linear-gradient(135deg, #7c3aed, #db2777) !important; transform: translateY(-1px); }

.ps-post-short {
    font-size: 15px; line-height: 1.65; color: #111827;
    padding: 16px 18px; background: #f9fafb;
    border-left: 3px solid #4f46e5; border-radius: 6px; margin: 20px 0;
}
.ps-h2 { font-size: 17px; font-weight: 700; margin: 26px 0 10px; color: #111827; line-height: 1.3; }
.ps-body { font-size: 15px; line-height: 1.75; color: #1f2937; white-space: pre-wrap; }
.ps-bullets { list-style: none; padding: 0; margin: 0 0 20px; }
.ps-bullets li { position: relative; padding: 10px 10px 10px 30px; font-size: 14px; line-height: 1.55; border-bottom: 1px solid #f3f4f6; }
.ps-bullets li::before { content: ''; position: absolute; left: 10px; top: 18px; width: 6px; height: 6px; border-radius: 50%; background: #4f46e5; }
.ps-bullets li:last-child { border-bottom: none; }

.ps-info-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px 18px; margin: 20px 0; }
.ps-info-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #f3f4f6; font-size: 14px; gap: 12px; }
.ps-info-row:last-child { border-bottom: none; }
.ps-info-row__label { color: #6b7280; font-weight: 500; }
.ps-info-row__value { font-weight: 600; color: #111827; text-align: right; }
.ps-info-row__value a { color: #4f46e5; text-decoration: none; }

.ps-ad { background: #f9fafb; border: 1px dashed #e5e7eb; border-radius: 8px; padding: 8px; margin: 24px 0; text-align: center; min-height: 90px; display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 11px; }
.ps-ad--label::before { content: 'Advertisement'; opacity: .6; }

.ps-related { margin-top: 32px; padding-top: 20px; border-top: 1px solid #e5e7eb; }
.ps-related__title { font-size: 14px; font-weight: 700; margin: 0 0 14px; color: #111827; text-transform: uppercase; letter-spacing: .05em; }

.ps-empty { padding: 48px 20px; text-align: center; color: #6b7280; background: #fff; border: 1px dashed #e5e7eb; border-radius: 10px; }

@media (max-width: 640px) {
    .ps-wrap { padding: 0 14px; }
    .ps-cat-ribbon__inner { padding: 10px 14px; }
    .ps-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .ps-grid--featured { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .ps-cat-header h1 { font-size: 22px; }
    .ps-post-head h1 { font-size: 22px; }
    .ps-post-actions { grid-template-columns: 1fr; }
    .ps-card__title { font-size: 12px; min-height: 32px; }
}

/* ════════════════════════════════════════════════════════════════
   COPY PROTECTION (.ps-no-copy wrapper + transparent overlay)
   ════════════════════════════════════════════════════════════════ */
.ps-no-copy {
    position: relative;
    user-select: none; -webkit-user-select: none;
    -webkit-touch-callout: none;
}
.ps-no-copy img,
.ps-no-copy canvas {
    -webkit-user-drag: none; user-drag: none;
    pointer-events: none;
}
.ps-no-copy__overlay {
    position: absolute; inset: 0; z-index: 1;
    background: transparent; cursor: default;
}

/* ════════════════════════════════════════════════════════════════
   BRAND EDITOR
   ════════════════════════════════════════════════════════════════ */
.ps-brand-layout {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 24px; align-items: flex-start;
    padding: 20px 0;
}
@media (max-width: 900px) {
    .ps-brand-layout { grid-template-columns: 1fr; }
    .ps-brand__preview { order: -1; }
}

.ps-brand__form {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    position: sticky; top: 80px;
}
@media (max-width: 900px) {
    .ps-brand__form { position: static; max-height: none; }
}
.ps-brand__form > h2 {
    margin: 0 0 14px; font-size: 16px; font-weight: 700; color: #111827;
}
.ps-brand__form > h2 small {
    font-weight: 400; color: #6b7280; font-size: 12px; display: block; margin-top: 4px;
}

/* Per-field block */
.ps-pf { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #f3f4f6; }
.ps-pf:last-child { border-bottom: none; }
.ps-pf-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; gap: 6px; }
.ps-pf-label { font-size: 12px; font-weight: 600; color: #374151; flex: 1; }
.ps-pf-req { color: #dc2626; }
.ps-pf-gear {
    background: #f9fafb; border: 1px solid #e5e7eb; color: #6b7280;
    border-radius: 5px; padding: 5px 7px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s, border-color .15s, color .15s;
    line-height: 0;
}
.ps-pf-gear:hover { color: #4338ca; border-color: #c7d2fe; background: #eef2ff; }
.ps-pf-gear--active { color: #fff; background: #4338ca; border-color: #4338ca; }
.ps-pf-input {
    width: 100%; padding: 8px 11px;
    border: 1px solid #e5e7eb; border-radius: 6px;
    font-size: 14px; background: #fff; font-family: inherit;
}
.ps-pf-input:focus { outline: none; border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.ps-pf-show { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #6b7280; margin-top: 4px; cursor: pointer; user-select: none; }
.ps-pf-show input { width: 13px; height: 13px; accent-color: #4f46e5; }

/* Settings panel — hidden by default */
.ps-pf-settings {
    margin-top: 8px; padding: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    display: none;
}
.ps-pf-settings--open { display: block; }
.ps-pf-set-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 6px; margin-bottom: 6px;
}
.ps-pf-set {
    display: flex; flex-direction: column; gap: 3px;
    font-size: 11px; color: #6b7280; font-weight: 500;
}
.ps-pf-set input[type=number],
.ps-pf-set input[type=color],
.ps-pf-num {
    padding: 5px 7px; border: 1px solid #e5e7eb; border-radius: 4px;
    font-size: 12px; background: #fff;
    width: 100%; min-width: 40px;
}
.ps-pf-set input[type=color] { padding: 2px; height: 28px; cursor: pointer; }
.ps-pf-font {
    padding: 5px 7px; border: 1px solid #e5e7eb; border-radius: 4px;
    font-size: 12px; background: #fff; width: 100%; cursor: pointer;
}
.ps-pf-num { text-align: center; }

/* X/Y nudge buttons — flex layout with input centered */
.ps-pf-set:has(.ps-pf-nudge) {
    flex-direction: row; align-items: center; gap: 3px;
}
.ps-pf-nudge {
    background: #fff; border: 1px solid #e5e7eb; color: #4b5563;
    width: 24px; height: 24px; border-radius: 4px;
    cursor: pointer; font-size: 11px; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.ps-pf-nudge:hover { background: #eef2ff; border-color: #a5b4fc; }
.ps-pf-nudge:active { background: #c7d2fe; }

.ps-pf-style-row { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.ps-pf-style {
    background: #fff; border: 1px solid #e5e7eb; color: #4b5563;
    padding: 4px 9px; border-radius: 4px; font-size: 12px; font-weight: 600;
    cursor: pointer; min-width: 28px;
}
.ps-pf-style:hover { background: #eef2ff; border-color: #a5b4fc; }
.ps-pf-style--on { background: #4338ca; color: #fff; border-color: #4338ca; }
.ps-pf-align { display: flex; gap: 2px; margin-left: 4px; }
.ps-pf-align .ps-pf-style { padding: 4px 7px; }

/* Logo area */
.ps-logo-area { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.ps-logo-preview {
    width: 56px; height: 56px;
    border-radius: 8px; border: 1px solid #e5e7eb;
    background: #f9fafb center / contain no-repeat;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #9ca3af; font-size: 18px;
}
.ps-logo-btn {
    padding: 7px 12px;
    background: #eef2ff; color: #4338ca;
    border: 1px solid #c7d2fe; border-radius: 6px;
    font-size: 13px; font-weight: 500; cursor: pointer;
}
.ps-logo-btn:hover { background: #e0e7ff; }
.ps-logo-remove {
    padding: 7px 10px;
    background: #fee2e2; color: #b91c1c;
    border: 1px solid #fecaca; border-radius: 6px;
    font-size: 13px; font-weight: 500; cursor: pointer; display: none;
}
.ps-logo-remove.shown { display: inline-block; }

/* Globals block */
.ps-pf-globals {
    margin-top: 16px; padding-top: 14px; border-top: 2px solid #e5e7eb;
}
.ps-pf-globals__title {
    font-size: 11px; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: .05em;
    margin: 0 0 10px;
}
.ps-pf-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 6px 0; font-size: 13px; color: #374151;
}
.ps-pf-row input[type=color] {
    width: 40px; height: 28px; padding: 2px; cursor: pointer;
    border: 1px solid #e5e7eb; border-radius: 4px;
}
.ps-toggle-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: #6b7280;
    margin-top: 4px; cursor: pointer; user-select: none;
}
.ps-toggle-row input[type=checkbox] { width: 14px; height: 14px; accent-color: #4f46e5; margin: 0; }

/* Preview side */
.ps-brand__preview { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.ps-brand-canvas-wrap {
    width: 100%; max-width: 540px;
    aspect-ratio: 1/1;
    background: #f9fafb; border: 1px solid #e5e7eb;
    border-radius: 12px; overflow: hidden;
    position: relative;
    box-shadow: 0 4px 16px -4px rgba(15,23,42,.08);
}
.ps-brand-canvas-wrap canvas { width: 100%; height: 100%; display: block; }
.ps-brand-canvas-loading {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.9); color: #6b7280; font-size: 13px;
}
.ps-brand-actions {
    width: 100%; max-width: 540px;
    display: flex; flex-direction: column; gap: 8px;
}
.ps-brand-actions .btn, .ps-brand-actions a.btn { width: 100%; }

.ps-brand-login-gate {
    max-width: 480px; margin: 60px auto;
    text-align: center; padding: 40px 24px;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
}
.ps-brand-login-gate h1 { font-size: 22px; font-weight: 800; margin: 0 0 10px; color: #111827; }
.ps-brand-login-gate p { color: #4b5563; font-size: 14px; line-height: 1.6; margin: 0 0 20px; }

/* Admin-side: per-field color grid (re-used in upload + edit) */
.pa-frame-colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.pa-frame-colors-grid .pa-field { margin-bottom: 0; }
.pa-frame-colors-grid input[type=color] {
    width: 100%; height: 36px; padding: 2px;
    border: 1px solid #e5e7eb; border-radius: 6px; cursor: pointer;
}
/* ════════════════════════════════════════════════════════════════
   Infinite scroll additions — append to posters.css (v5)
   ════════════════════════════════════════════════════════════════ */

/* Sentinel: invisible spacer the IntersectionObserver watches */
#ps-scroll-sentinel {
    height: 1px;
    margin-top: 8px;
}

/* ── Loader (three bouncing dots) ─────────────────────────────── */
.ps-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 28px 0 8px;
}

.ps-loader__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4f46e5;
    animation: ps-bounce 1.2s ease-in-out infinite;
    opacity: 0.7;
}
.ps-loader__dot:nth-child(1) { animation-delay: 0s;    }
.ps-loader__dot:nth-child(2) { animation-delay: 0.2s;  }
.ps-loader__dot:nth-child(3) { animation-delay: 0.4s;  }

@keyframes ps-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%            { transform: scale(1);   opacity: 1;   }
}

/* ── End-of-feed message ──────────────────────────────────────── */
.ps-end-msg {
    text-align: center;
    padding: 24px 16px 8px;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ── Card fade-in when injected ──────────────────────────────── */
/* New cards are inserted as direct children; we target ones that
   don't yet have the animation class to avoid re-animating. */
.ps-card {
    animation: ps-card-in 0.25s ease both;
}

@keyframes ps-card-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}