/* ==========================================================================
   Cancabridge — image frames
   Usage: canbri_framed( 'key', 'alt', 'blob|arch|offset|polaroid|ring|cut|wave', [ 'accent' => 'blue|green|orange' ] )
   ========================================================================== */

.frame {
	--accent: var(--green-500);
	--accent-soft: var(--green-100);
	position: relative;
	margin: 0;
	isolation: isolate;
}
.accent--blue   { --accent: var(--blue-500);   --accent-soft: var(--sky-100); }
.accent--green  { --accent: var(--green-500);  --accent-soft: var(--green-100); }
.accent--orange { --accent: var(--orange-500); --accent-soft: var(--orange-100); }

.frame__media {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: var(--ratio, 4 / 3);
	background: var(--accent-soft);
	z-index: 1;
}
.frame__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 1.2s var(--ease), filter .6s var(--ease);
}
.frame:hover .frame__media img { transform: scale(1.05); }

.frame figcaption {
	margin-top: .9rem;
	font-size: .92rem;
	color: var(--muted);
}

/* Dot-grid accent used by several frames */
.frame--blob::after,
.frame--offset::after,
.frame--arch::after {
	content: "";
	position: absolute;
	width: 110px;
	height: 110px;
	background-image: radial-gradient(var(--accent) 2px, transparent 2.5px);
	background-size: 14px 14px;
	opacity: .55;
	z-index: 0;
	pointer-events: none;
}

/* 1. Organic blob that slowly breathes, with a gradient shadow-blob behind */
.frame--blob .frame__media {
	border-radius: 58% 42% 46% 54% / 46% 52% 48% 54%;
	animation: blob-morph 16s ease-in-out infinite alternate;
	box-shadow: 0 30px 60px -30px rgba(10, 42, 94, .45);
}
.frame--blob::before {
	content: "";
	position: absolute;
	inset: 6% -5% -6% 6%;
	border-radius: 42% 58% 60% 40% / 50% 40% 60% 50%;
	background: linear-gradient(135deg, var(--accent), var(--blue-700));
	opacity: .9;
	z-index: 0;
	animation: blob-morph 20s ease-in-out infinite alternate-reverse;
}
.frame--blob::after { top: -24px; left: -24px; }

@keyframes blob-morph {
	0%   { border-radius: 58% 42% 46% 54% / 46% 52% 48% 54%; }
	50%  { border-radius: 44% 56% 62% 38% / 56% 40% 60% 44%; }
	100% { border-radius: 52% 48% 38% 62% / 40% 60% 42% 58%; }
}

/* 2. Arch window with an offset outline and a little "sun" */
.frame--arch { --ratio: 4 / 5; }
.frame--arch .frame__media { border-radius: 999px 999px 26px 26px; }
.frame--arch::before {
	content: "";
	position: absolute;
	inset: 0;
	transform: translate(16px, 16px);
	border: 2px solid var(--accent);
	border-radius: 999px 999px 26px 26px;
	z-index: 0;
	transition: transform .6s var(--ease);
}
.frame--arch:hover::before { transform: translate(8px, 8px); }
.frame--arch::after {
	right: -36px;
	bottom: 18%;
	width: 90px;
	height: 90px;
}
.frame--arch .frame__media::after {
	content: "";
	position: absolute;
	top: 14%;
	right: 12%;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--orange-500);
	box-shadow: 0 0 0 8px rgba(242, 162, 27, .25);
}

/* 3. Offset colour block with one sharp corner */
.frame--offset .frame__media {
	border-radius: 28px 28px 28px 6px;
	box-shadow: 0 24px 50px -28px rgba(10, 42, 94, .5);
}
.frame--offset::before {
	content: "";
	position: absolute;
	inset: 0;
	transform: translate(22px, 22px);
	border-radius: 28px 28px 28px 6px;
	background: var(--accent);
	z-index: 0;
	transition: transform .6s var(--ease);
}
.frame--offset:hover::before { transform: translate(12px, 12px); }
.frame--offset::after { top: -28px; right: -20px; }

/* 4. Taped polaroid with a handwritten-style caption */
.frame--polaroid {
	background: #fff;
	padding: 12px 12px 0;
	border-radius: 6px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, .06), 0 22px 40px -22px rgba(10, 42, 94, .45);
	transform: rotate(var(--tilt, -2deg));
	transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.frame--polaroid:hover {
	transform: rotate(0) translateY(-6px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, .06), 0 34px 60px -26px rgba(10, 42, 94, .55);
	z-index: 2;
}
.frame--polaroid .frame__media { border-radius: 3px; --ratio: 1 / 1; }
.frame--polaroid::before {
	content: "";
	position: absolute;
	top: -12px;
	left: 50%;
	width: 96px;
	height: 26px;
	transform: translateX(-50%) rotate(-3deg);
	background: color-mix(in srgb, var(--accent) 45%, transparent);
	backdrop-filter: blur(1px);
	z-index: 3;
	border-radius: 2px;
}
.frame--polaroid figcaption {
	margin: 0;
	padding: .8rem .3rem 1rem;
	font-family: var(--font-display);
	font-style: italic;
	color: var(--ink);
	font-size: 1rem;
	line-height: 1.35;
}
.frame--polaroid figcaption small {
	display: block;
	font-family: var(--font-body);
	font-style: normal;
	color: var(--muted);
	font-size: .82rem;
	margin-top: .2rem;
}

/* 5. Circle with a slowly rotating brand-colour ring (echoes the logo globe) */
.frame--ring { --ratio: 1 / 1; padding: 14px; }
.frame--ring .frame__media { border-radius: 50%; border: 6px solid #fff; }
.frame--ring::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: conic-gradient(from 210deg, var(--blue-500), var(--blue-700) 30%, transparent 30% 38%, var(--green-500) 38% 70%, transparent 70% 76%, var(--orange-500) 76% 92%, transparent 92%);
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
	mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
	animation: ring-spin 28s linear infinite;
	z-index: 0;
}
@keyframes ring-spin { to { transform: rotate(360deg); } }

/* 6. Chamfered corners with a colour bar */
.frame--cut .frame__media {
	clip-path: polygon(28px 0, 100% 0, 100% calc(100% - 28px), calc(100% - 28px) 100%, 0 100%, 0 28px);
}
.frame--cut::before {
	content: "";
	position: absolute;
	left: 28px;
	right: 28px;
	bottom: -8px;
	height: 8px;
	border-radius: 0 0 8px 8px;
	background: linear-gradient(90deg, var(--blue-500), var(--green-500), var(--orange-500));
}

/* 7. Soft wavy bottom edge (card headers) */
.frame--wave .frame__media {
	--ratio: 16 / 10;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 250' preserveAspectRatio='none'%3E%3Cpath d='M0 0h400v222c-50 22-100 26-150 10S150 206 100 214 25 240 0 236z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 250' preserveAspectRatio='none'%3E%3Cpath d='M0 0h400v222c-50 22-100 26-150 10S150 206 100 214 25 240 0 236z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

/* Collage helper: big blob + floating ring + badge */
.collage { position: relative; padding: 2rem 2rem 3rem 0; }
.collage .frame--ring {
	position: absolute;
	width: 38%;
	left: -8%;
	bottom: -4%;
	z-index: 3;
}
.collage__badge {
	position: absolute;
	right: 0;
	top: 8%;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: .8rem;
	padding: .85rem 1.1rem;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 20px 40px -18px rgba(10, 42, 94, .45);
	animation: float 6s ease-in-out infinite;
}
.collage__badge strong { display: block; font-size: 1.25rem; color: var(--blue-700); line-height: 1.1; }
.collage__badge span { font-size: .8rem; color: var(--muted); }
.collage__badge .icon-bubble { flex: none; }
@keyframes float { 50% { transform: translateY(-10px); } }

@media (max-width: 720px) {
	.frame--offset::before { transform: translate(12px, 12px); }
	.frame--arch::before { transform: translate(10px, 10px); }
	.collage { padding: 1rem 1rem 2rem 1.5rem; }
	.collage .frame--ring { left: -4%; width: 40%; }
}

@media (prefers-reduced-motion: reduce) {
	.frame--blob .frame__media,
	.frame--blob::before,
	.frame--ring::before,
	.collage__badge { animation: none; }
}
