/* =========================================================
CUSTOM PORTFOLIO PLUGIN
Frontend + Admin Styles
========================================================= */

/* =========================================================

1. RESET / BASE
   ========================================================= */

.cpp-portfolio,
.cpp-portfolio *,
.cpp-admin,
.cpp-admin * {
box-sizing: border-box;
}

/* =========================================================
2. FRONTEND - PORTFOLIO
========================================================= */

.cpp-portfolio {
width: 100%;
max-width: 100%;
margin: 0 auto;
}

/* =========================================================
3. TOOLBAR
========================================================= */

.cpp-toolbar {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 8px;
margin-bottom: 24px;
}

.cpp-layout-button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 8px 14px;
border: 1px solid #dcdcde;
border-radius: 4px;
background: #fff;
color: #1d2327;
font-size: 14px;
line-height: 1.4;
cursor: pointer;
transition:
background-color 0.2s ease,
border-color 0.2s ease,
color 0.2s ease;
}

.cpp-layout-button:hover {
background: #f6f7f7;
border-color: #8c8f94;
}

.cpp-layout-button:focus-visible {
outline: 2px solid #2271b1;
outline-offset: 2px;
}

.cpp-layout-button.is-active {
background: #1d2327;
border-color: #1d2327;
color: #fff;
}

/* =========================================================
4. GALLERY - GRID
========================================================= */

.cpp-gallery {
width: 100%;
}

.cpp-layout-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 20px;
}

/* =========================================================
5. GALLERY - MASONRY
========================================================= */

.cpp-layout-masonry {
column-count: 3;
column-gap: 20px;
}

.cpp-layout-masonry .cpp-item {
width: 100%;
margin: 0 0 20px;
break-inside: avoid;
}

/* =========================================================
6. GALLERY ITEM
========================================================= */

.cpp-item {
position: relative;
display: block;
width: 100%;
padding: 0;
margin: 0;
border: 0;
background: transparent;
overflow: hidden;
text-align: left;
cursor: pointer;
}

.cpp-item:focus {
outline: none;
}

.cpp-item:focus-visible {
outline: 3px solid #2271b1;
outline-offset: 3px;
}

.cpp-item-image {
display: block;
width: 100%;
height: auto;
margin: 0;
object-fit: cover;
transition: transform 0.4s ease;
}

.cpp-layout-grid .cpp-item-image {
aspect-ratio: 4 / 3;
}

.cpp-item:hover .cpp-item-image,
.cpp-item:focus-visible .cpp-item-image {
transform: scale(1.03);
}

/* =========================================================
7. ITEM OVERLAY
========================================================= */

.cpp-item-overlay {
position: absolute;
right: 0;
bottom: 0;
left: 0;
display: flex;
align-items: flex-end;
min-height: 35%;
padding: 24px 20px 20px;
background: linear-gradient(
to top,
rgba(0, 0, 0, 0.72),
rgba(0, 0, 0, 0)
);
opacity: 0;
transition: opacity 0.25s ease;
pointer-events: none;
}

.cpp-item:hover .cpp-item-overlay,
.cpp-item:focus-visible .cpp-item-overlay {
opacity: 1;
}

.cpp-item-title {
display: block;
color: #fff;
font-size: 18px;
font-weight: 600;
line-height: 1.35;
}

/* =========================================================
8. MODAL
========================================================= */

.cpp-modal {
position: fixed;
inset: 0;
z-index: 999999;
display: flex;
align-items: center;
justify-content: center;
padding: 30px;
visibility: hidden;
opacity: 0;
transition:
visibility 0s linear 0.25s,
opacity 0.25s ease;
}

.cpp-modal[aria-hidden="false"] {
visibility: visible;
opacity: 1;
transition-delay: 0s;
}

.cpp-modal-backdrop {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.78);
cursor: pointer;
}

/* =========================================================
9. MODAL DIALOG
========================================================= */

.cpp-modal-dialog {
position: relative;
z-index: 1;
display: flex;
width: min(1100px, 100%);
max-height: calc(100vh - 60px);
overflow: hidden;
background: #fff;
border-radius: 8px;
box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
transform: translateY(20px);
transition: transform 0.25s ease;
}

.cpp-modal[aria-hidden="false"] .cpp-modal-dialog {
transform: translateY(0);
}

/* =========================================================
10. MODAL CLOSE
========================================================= */

.cpp-modal-close {
position: absolute;
top: 14px;
right: 14px;
z-index: 5;
display: flex;
align-items: center;
justify-content: center;
width: 42px;
height: 42px;
padding: 0;
border: 0;
border-radius: 50%;
background: rgba(0, 0, 0, 0.7);
color: #fff;
font-size: 28px;
line-height: 1;
cursor: pointer;
transition:
background-color 0.2s ease,
transform 0.2s ease;
}

.cpp-modal-close:hover {
background: rgba(0, 0, 0, 0.9);
transform: scale(1.05);
}

.cpp-modal-close:focus-visible {
outline: 3px solid #2271b1;
outline-offset: 3px;
}

/* =========================================================
11. MODAL CONTENT
========================================================= */

.cpp-modal-content {
display: grid;
grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.5fr);
width: 100%;
min-height: 500px;
}

/* =========================================================
12. MODAL INFO
========================================================= */

.cpp-modal-info {
display: flex;
flex-direction: column;
justify-content: center;
padding: 50px 45px;
overflow-y: auto;
}

.cpp-modal-title {
margin: 0 0 20px;
color: #1d2327;
font-size: clamp(24px, 3vw, 38px);
font-weight: 600;
line-height: 1.15;
}

.cpp-modal-description {
color: #50575e;
font-size: 16px;
line-height: 1.7;
}

.cpp-modal-description > :first-child {
margin-top: 0;
}

.cpp-modal-description > :last-child {
margin-bottom: 0;
}

/* =========================================================
13. MODAL ACTIONS
========================================================= */

.cpp-modal-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
margin-top: 30px;
}

.cpp-share-button,
.cpp-external-link {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 42px;
padding: 9px 16px;
border-radius: 4px;
font-size: 14px;
font-weight: 600;
line-height: 1.3;
text-decoration: none;
cursor: pointer;
transition:
background-color 0.2s ease,
border-color 0.2s ease,
color 0.2s ease;
}

.cpp-share-button {
border: 1px solid #1d2327;
background: #1d2327;
color: #fff;
}

.cpp-share-button:hover {
background: #3c434a;
border-color: #3c434a;
}

.cpp-share-button:focus-visible,
.cpp-external-link:focus-visible {
outline: 2px solid #2271b1;
outline-offset: 2px;
}

.cpp-external-link {
border: 1px solid #dcdcde;
background: #fff;
color: #1d2327;
}

.cpp-external-link:hover {
background: #f6f7f7;
border-color: #8c8f94;
}

.cpp-share-status {
min-height: 24px;
margin: 12px 0 0;
color: #50575e;
font-size: 14px;
line-height: 1.5;
}

/* =========================================================
14. MODAL MEDIA
========================================================= */

.cpp-modal-media {
display: flex;
align-items: center;
justify-content: center;
min-width: 0;
min-height: 0;
background: #f0f0f1;
overflow: hidden;
}

.cpp-modal-image {
display: block;
width: 100%;
height: 100%;
max-width: 100%;
max-height: calc(100vh - 60px);
object-fit: contain;
}

/* =========================================================
15. BODY LOCK
========================================================= */

body.cpp-modal-open {
overflow: hidden;
}

/* =========================================================
16. ADMIN - METABOX
========================================================= */

.cpp-admin {
width: 100%;
}

.cpp-admin > .description {
margin: 0 0 20px;
}

/* =========================================================
17. ADMIN LIST
========================================================= */

.cpp-admin-list {
display: flex;
flex-direction: column;
gap: 12px;
}

/* =========================================================
18. ADMIN ITEM
========================================================= */

.cpp-admin-item {
display: grid;
grid-template-columns: 36px 150px minmax(0, 1fr) auto;
gap: 16px;
align-items: stretch;
padding: 16px;
border: 1px solid #dcdcde;
border-radius: 4px;
background: #fff;
}

.cpp-admin-item.ui-sortable-helper {
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.cpp-admin-item.ui-sortable-placeholder {
visibility: visible !important;
min-height: 170px;
border: 2px dashed #8c8f94;
background: #f6f7f7;
}

/* =========================================================
19. ADMIN HANDLE
========================================================= */

.cpp-admin-handle {
display: flex;
align-items: center;
justify-content: center;
color: #8c8f94;
cursor: grab;
}

.cpp-admin-handle:hover {
color: #2271b1;
}

.cpp-admin-handle:active {
cursor: grabbing;
}

.cpp-admin-handle .dashicons {
font-size: 22px;
width: 22px;
height: 22px;
}

/* =========================================================
20. ADMIN IMAGE
========================================================= */

.cpp-admin-image {
display: flex;
flex-direction: column;
gap: 10px;
min-width: 0;
}

.cpp-image-preview {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
min-height: 110px;
overflow: hidden;
border: 1px solid #dcdcde;
border-radius: 3px;
background: #f6f7f7;
}

.cpp-image-preview img {
display: block;
width: 100%;
height: 110px;
object-fit: cover;
}

.cpp-no-image {
padding: 15px;
color: #646970;
font-size: 12px;
text-align: center;
}

/* =========================================================
21. ADMIN FIELDS
========================================================= */

.cpp-admin-fields {
min-width: 0;
}

.cpp-admin-fields p {
margin-top: 0;
}

.cpp-admin-fields p:last-child {
margin-bottom: 0;
}

.cpp-admin-fields label {
display: block;
}

.cpp-admin-fields strong {
display: block;
margin-bottom: 6px;
}

/* =========================================================
22. ADMIN ACTIONS
========================================================= */

.cpp-admin-actions {
display: flex;
align-items: flex-start;
justify-content: flex-end;
min-width: 60px;
}

.cpp-remove-item {
color: #b32d2e !important;
text-decoration: none;
}

.cpp-remove-item:hover {
color: #8a2424 !important;
}

/* =========================================================
23. ADMIN DRAGGING
========================================================= */

.cpp-admin-list.is-sorting .cpp-admin-item {
cursor: default;
}

/* =========================================================
24. RESPONSIVE - TABLET
========================================================= */

@media (max-width: 900px) {

.cpp-layout-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cpp-layout-masonry {
	column-count: 2;
}

.cpp-modal {
	padding: 20px;
}

.cpp-modal-content {
	grid-template-columns: 1fr;
}

.cpp-modal-dialog {
	max-height: calc(100vh - 40px);
	overflow-y: auto;
}

.cpp-modal-media {
	order: -1;
	min-height: 300px;
	max-height: 55vh;
}

.cpp-modal-image {
	max-height: 55vh;
}

.cpp-modal-info {
	padding: 35px 30px;
}

.cpp-admin-item {
	grid-template-columns: 36px 130px minmax(0, 1fr);
}

.cpp-admin-actions {
	grid-column: 2 / -1;
	justify-content: flex-start;
}


}

/* =========================================================
25. RESPONSIVE - MOBILE
========================================================= */

@media (max-width: 600px) {


.cpp-toolbar {
	justify-content: flex-start;
}

.cpp-layout-grid {
	grid-template-columns: 1fr;
	gap: 14px;
}

.cpp-layout-masonry {
	column-count: 1;
}

.cpp-layout-masonry .cpp-item {
	margin-bottom: 14px;
}

.cpp-item-overlay {
	opacity: 1;
	padding: 30px 15px 15px;
}

.cpp-item-title {
	font-size: 16px;
}

.cpp-modal {
	padding: 0;
}

.cpp-modal-dialog {
	width: 100%;
	max-height: 100vh;
	border-radius: 0;
}

.cpp-modal-content {
	min-height: 100vh;
}

.cpp-modal-media {
	min-height: 45vh;
	max-height: 50vh;
}

.cpp-modal-image {
	max-height: 50vh;
}

.cpp-modal-info {
	padding: 30px 20px;
}

.cpp-modal-title {
	font-size: 26px;
}

.cpp-modal-close {
	top: 10px;
	right: 10px;
	width: 38px;
	height: 38px;
}

.cpp-admin-item {
	grid-template-columns: 32px 1fr;
	gap: 12px;
}

.cpp-admin-image {
	grid-column: 2;
}

.cpp-admin-fields {
	grid-column: 2;
}

.cpp-admin-actions {
	grid-column: 2;
}

.cpp-admin-handle {
	grid-row: 1 / span 3;
}


}

/* =========================================================
26. REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {


.cpp-item-image,
.cpp-item-overlay,
.cpp-modal,
.cpp-modal-dialog,
.cpp-layout-button,
.cpp-modal-close,
.cpp-share-button,
.cpp-external-link {
	transition: none;
}

.cpp-item:hover .cpp-item-image,
.cpp-item:focus-visible .cpp-item-image {
	transform: none;
}


}
