/**
 * COAs page — gallery UX referenced from certified-pep.com/coas/, Sophia-styled.
 */

body.sophia-coa-pro-page .wp-block-post-title,
body.sophia-coa-pro-page .entry-title {
	display: none !important;
}

body.sophia-coa-pro-page {
	background-color: var(--wp--preset--color--body-background, #fdf6f2) !important;
	position: relative;
}

body.sophia-coa-pro-page .wp-site-blocks,
body.sophia-coa-pro-page .wp-site-blocks main {
	background: transparent !important;
}

body.sophia-coa-pro-page .wp-site-blocks main {
	margin-top: 0;
	padding-top: 0 !important;
	padding-bottom: var(--wp--custom--spacing--main-block-gap, clamp(56px, 5.5vw, 91px));
}

body.sophia-coa-pro-page .wp-block-post-content,
body.sophia-coa-pro-page .entry-content.wp-block-post-content {
	max-width: none !important;
	padding-inline: 0 !important;
	width: 100%;
}

body.sophia-coa-pro-page .wp-block-post-content > #cp-coa,
body.sophia-coa-pro-page .entry-content.wp-block-post-content > #cp-coa {
	box-sizing: border-box;
	margin-inline: calc(50% - 50vw);
	max-width: 100vw;
	width: 100vw;
}

#cp-coa {
	--bg: transparent;
	--panel: #ffffff;
	--ink: #1a1a1a;
	--muted: #686868;
	--line: #eddfd4;
	--accent: var(--wp--preset--color--tan-brown, #954e26);
	--accent-deep: var(--wp--preset--color--chocolate-dim, #bd6230);
	--soft: var(--wp--preset--color--secondary, #fbede5);
	--chip: var(--wp--preset--color--body-background-deep, #f7daca);
	--thumb-bg: #f7efe8;
	--shadow: 0 12px 28px rgba(85, 80, 80, 0.12);
	font-family: var(--wp--preset--font-family--switzer, Switzer, system-ui, sans-serif);
	color: var(--ink);
	background: var(--bg);
	padding: 28px clamp(16px, 4vw, 48px);
	overflow-x: hidden;
}

#cp-coa .wrap {
	max-width: var(--wp--style--global--wide-size, 1320px);
	margin: 0 auto;
	width: 100%;
}

#cp-coa h2,
#cp-coa h3 {
	color: var(--accent);
	margin: 0;
	font-family: var(--wp--preset--font-family--merriweather, Merriweather, serif);
	font-weight: 700;
	letter-spacing: 0.01em;
}

#cp-coa h2 {
	margin-bottom: 6px;
	font-size: clamp(28px, 3.5vw, 40px);
}

#cp-coa .under {
	width: 96px;
	height: 4px;
	border-radius: 3px;
	background: linear-gradient(90deg, var(--accent), var(--accent-deep));
	margin: 8px 0 18px;
}

#cp-coa .controls {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin: 0 0 14px;
}

#cp-coa .search {
	flex: 1 1 280px;
	display: flex;
	gap: 8px;
	min-width: 0;
}

#cp-coa input[type="search"] {
	flex: 1;
	padding: 12px 14px;
	border-radius: 12px;
	border: 1px solid var(--line);
	background: #fff;
	color: var(--ink);
	outline: 0;
	min-width: 0;
	font-size: 15px;
}

#cp-coa input[type="search"]::placeholder {
	color: var(--muted);
	opacity: 0.9;
}

#cp-coa .seg {
	display: inline-flex;
	background: var(--soft);
	padding: 4px;
	border-radius: 999px;
	border: 1px solid var(--line);
}

#cp-coa .seg button {
	border: 0;
	background: transparent;
	color: var(--ink);
	font-weight: 800;
	padding: 8px 12px;
	border-radius: 999px;
	cursor: pointer;
}

#cp-coa .seg button[aria-pressed="true"] {
	background: var(--accent);
	color: #fff;
}

#cp-coa .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 14px;
	border-radius: 999px;
	font-weight: 900;
	border: 1px solid var(--line);
	background: var(--chip);
	color: var(--ink);
	cursor: pointer;
	gap: 8px;
}

#cp-coa .btn.is-on {
	background: var(--accent-deep);
	border-color: transparent;
	color: #fff;
}

#cp-coa .grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
}

@media (max-width: 1100px) {
	#cp-coa .grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 720px) {
	#cp-coa .grid {
		grid-template-columns: 1fr;
	}
}

#cp-coa .card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 12px;
	box-shadow: var(--shadow);
	padding: 10px;
	display: grid;
	gap: 10px;
	overflow: hidden;
	min-width: 0;
	align-content: start;
}

#cp-coa .title {
	color: var(--ink);
	font-weight: 900;
	line-height: 1.2;
	font-size: 15px;
	word-break: break-word;
}

#cp-coa .pair {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	width: 100%;
	min-width: 0;
}

#cp-coa .pair > * {
	min-width: 0;
}

#cp-coa .thumb {
	display: block;
	background: var(--thumb-bg);
	border: 1px solid var(--line);
	border-radius: 10px;
	overflow: hidden;
	position: relative;
	cursor: pointer;
	box-sizing: border-box;
	min-width: 0;
}

#cp-coa .thumb img {
	display: block;
	width: 100%;
	height: 200px;
	object-fit: contain;
	background: var(--thumb-bg);
	filter: contrast(1.02);
}

@media (max-width: 400px) {
	#cp-coa .thumb img {
		height: 180px;
	}
}

#cp-coa .label {
	position: absolute;
	left: 6px;
	top: 6px;
	padding: 4px 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 900;
	background: rgba(149, 78, 38, 0.88);
	border: 1px solid rgba(255, 255, 255, 0.25);
	color: #fff;
	backdrop-filter: blur(2px);
}

#cp-coa .empty {
	color: var(--muted);
	padding: 8px;
	font-weight: 600;
}

#cp-coa .section {
	margin-top: 18px;
}

#cp-coa .section h3 {
	margin: 0 0 8px;
	font-size: 20px;
}

#cp-coa .section .under {
	margin: 6px 0 12px;
	width: 72px;
}

#cp-coa .modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.76);
	backdrop-filter: blur(2px);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 1000001;
}

#cp-coa .modal.open {
	display: flex;
}

#cp-coa .box {
	width: min(1100px, 96vw);
	height: min(90vh, 980px);
	background: #0b0b0b;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 16px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

#cp-coa .bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 12px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.14);
	background: #0f0f0f;
	color: #fff;
	gap: 10px;
}

#cp-coa .bar b {
	font-size: 14px;
}

#cp-coa .bar .r {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

#cp-coa .bar a,
#cp-coa .bar button {
	padding: 8px 10px;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.14);
	background: #141414;
	color: #fff;
	text-decoration: none;
	font-size: 12px;
	cursor: pointer;
}

#cp-coa .close {
	font-weight: 900;
}

#cp-coa .frame {
	flex: 1;
	overflow: auto;
	background: #0a0a0a;
	display: grid;
	place-items: center;
}

#cp-coa .frame img {
	max-width: 100%;
	height: auto;
	display: block;
}

#cp-coa .toast {
	position: fixed;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	background: #111;
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.14);
	padding: 10px 14px;
	border-radius: 10px;
	opacity: 0;
	transition: 0.22s;
	z-index: 1000002;
}

#cp-coa .toast.show {
	opacity: 1;
}
