/* Plugin CPT — estilos públicos (listado, ficha, campos y galería).
   Usa las variables del theme con respaldo, así funciona con cualquier theme. */

.cpt-archive,
.cpt-single { --cpt-accent: var(--site-accent, #f97316);
              --cpt-border: var(--site-border, #e5e7eb);
              --cpt-surface: var(--site-surface, #ffffff);
              --cpt-ink: var(--site-primary, #17181c);
              --cpt-radius: var(--site-radius, 8px); }

/* Listado --------------------------------------------------------------- */
.cpt-archive-title {
    font-size: 22px;
    margin: 0 0 18px;
    color: var(--cpt-ink);
}

.cpt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.cpt-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
}

.cpt-card-media { aspect-ratio: 16 / 9; overflow: hidden; background: #f3f4f6; }
.cpt-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cpt-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.cpt-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.cpt-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid var(--cpt-accent);
    color: var(--cpt-accent);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.cpt-date { font-size: 12.5px; color: #6b7280; }

.cpt-card-title { font-size: 18px; margin: 0; line-height: 1.3; }
.cpt-card-title a { color: var(--cpt-ink); text-decoration: none; }
.cpt-card-title a:hover { text-decoration: underline; }

.cpt-card-excerpt { margin: 0; font-size: 14.5px; line-height: 1.55; color: #4b5563; }

.cpt-facts { list-style: none; margin: 0; padding: 0; font-size: 13.5px; color: #4b5563; }
.cpt-fact { padding: 2px 0; }
.cpt-fact-label { color: #6b7280; }

.cpt-card-more { align-self: flex-start; margin-top: auto; }

.cpt-empty-text { color: #6b7280; margin: 0; }

/* Ficha ------------------------------------------------------------------ */
.cpt-single { padding: 26px 28px 30px; }

.cpt-single-header { margin-bottom: 18px; }
.cpt-single-title { font-size: 30px; margin: 8px 0 0; line-height: 1.2; color: var(--cpt-ink); }
.cpt-single-excerpt { margin: 12px 0 0; font-size: 17px; color: #4b5563; font-style: italic; border-left: 3px solid var(--cpt-accent); padding-left: 14px; }

.cpt-single-media { margin: 0 0 22px; }
.cpt-single-media img { width: 100%; height: auto; display: block; border-radius: var(--cpt-radius); }
.cpt-single-caption { font-size: 13px; color: #6b7280; margin-top: 8px; }

.cpt-single-content { margin-bottom: 22px; }

/* Campos (dl) ------------------------------------------------------------ */
.cpt-fields {
    margin: 0 0 22px;
    padding: 0;
    border-top: 1px solid var(--cpt-border);
}

.cpt-field {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--cpt-border);
}

.cpt-field-label { margin: 0; font-weight: 700; font-size: 14px; color: var(--cpt-ink); }
.cpt-field-value { margin: 0; font-size: 15px; color: #374151; word-break: break-word; }
.cpt-field-value a { color: var(--cpt-accent); }

.cpt-field-image { margin: 0; }
.cpt-field-image img { max-width: 100%; height: auto; display: block; border-radius: var(--cpt-radius); }

.cpt-field--editor .cpt-field-value { grid-column: 2 / -1; }
.cpt-field-html > :first-child { margin-top: 0; }
.cpt-field-html > :last-child { margin-bottom: 0; }

.cpt-swatch { display: inline-flex; align-items: center; gap: 8px; }
.cpt-swatch-dot { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--cpt-border); display: inline-block; }

.cpt-bool-yes { color: #16a34a; font-weight: 700; }

@media (max-width: 640px) {
    .cpt-field { grid-template-columns: 1fr; gap: 2px; }
    .cpt-field--editor .cpt-field-value { grid-column: auto; }
    .cpt-single { padding: 20px 18px 24px; }
    .cpt-single-title { font-size: 24px; }
}

/* Galería ---------------------------------------------------------------- */
.cpt-gallery-block { margin: 8px 0 22px; }
.cpt-gallery-title { font-size: 17px; margin: 0 0 12px; color: var(--cpt-ink); }

.cpt-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.cpt-gallery-item { margin: 0; }
.cpt-gallery-link { display: block; border-radius: var(--cpt-radius); overflow: hidden; background: #f3f4f6; }
.cpt-gallery-link img { width: 100%; height: 130px; object-fit: cover; display: block; transition: transform .18s ease; }
.cpt-gallery-link:hover img { transform: scale(1.04); }
.cpt-gallery-caption { font-size: 12.5px; color: #6b7280; margin-top: 6px; }

/* Visor (lightbox) ------------------------------------------------------- */
.cpt-lb {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(17, 24, 39, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}
.cpt-lb[hidden] { display: none; }
.cpt-lb-img { max-width: 92vw; max-height: 82vh; border-radius: 6px; display: block; }
.cpt-lb-caption { color: #e5e7eb; font-size: 14px; text-align: center; margin-top: 12px; max-width: 80vw; }
.cpt-lb-btn {
    position: absolute;
    background: rgba(255, 255, 255, .12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 50%;
    width: 46px;
    height: 46px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cpt-lb-btn:hover { background: rgba(255, 255, 255, .24); }
.cpt-lb-prev { left: 18px; }
.cpt-lb-next { right: 18px; }
.cpt-lb-close { top: 18px; right: 18px; }
.cpt-lb-shell { display: flex; flex-direction: column; align-items: center; }
