/*
 * palette-library.css
 * Palette library (inc/palette-library.php): the palette page
 * (single-sw_palette.php) and the library grid (archive-sw_palette.php).
 * Builds on the tokens in home-companion.css (.swh).
 *
 * @package Swatching
 */

.spl { padding-bottom: clamp(48px, 6vw, 80px); }

.spl-kicker {
	margin: 0 0 8px;
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #a855f7;
}

/* ============================================================
   PALETTE PAGE
   ============================================================ */

.spl-hero { padding-top: clamp(20px, 3vw, 36px); }

.spl-back {
	display: inline-block;
	margin-bottom: 14px;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--text-2);
	text-decoration: none;
}

.spl-back:hover { color: var(--text); }

/* The photo, shown whole (so the color dots line up), on a blurred copy of itself */
.spl-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: clamp(10px, 2vw, 22px);
	overflow: hidden;
	border-radius: 26px;
	background: var(--card);
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), inset 0 0 0 1px var(--line);
	isolation: isolate;
}

.spl-stage::before {
	content: '';
	position: absolute;
	inset: -40px;
	z-index: -1;
	background: var(--photo) center / cover;
	filter: blur(40px) saturate(1.2) brightness(0.55);
}

.spl-photo-box { position: relative; display: inline-block; max-width: 100%; }

.spl-photo {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: min(72vh, 720px);
	border-radius: 16px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.spl-stage.is-plain { min-height: 300px; }

/* Where each color came from */
.spl-pin {
	position: absolute;
	z-index: 2;
	width: 22px;
	height: 22px;
	margin: -11px 0 0 -11px;
	border-radius: 50%;
	background: var(--c);
	box-shadow: 0 0 0 3px #fff, 0 4px 12px rgba(0, 0, 0, 0.5);
	transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spl-pin.is-lit { transform: scale(1.45); }

.spl-pin.is-lit::after {
	content: '';
	position: absolute;
	inset: -8px;
	border-radius: 50%;
	border: 2px solid #fff;
	animation: spl-ping 1.2s ease-out infinite;
}

@keyframes spl-ping { from { opacity: 1; transform: scale(0.8); } to { opacity: 0; transform: scale(1.5); } }

/* The swatch card: a white frame, colors on top, name underneath, like a printed chip */
.spl-card-frame {
	position: absolute;
	left: 50%;
	top: 50%;
	z-index: 3;
	width: clamp(150px, 32%, 300px);
	padding: clamp(8px, 1.2vw, 12px) clamp(8px, 1.2vw, 12px) 0;
	transform: translate(-50%, -50%);
	background: #fff;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.spl-frame-bands { display: flex; aspect-ratio: 1; }
.spl-frame-bands i { flex: 1; transition: flex 260ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.spl-frame-bands i.is-lit { flex: 2.2; }

.spl-frame-name {
	margin: 0;
	padding: clamp(8px, 1.2vw, 12px) 2px clamp(10px, 1.4vw, 14px);
	color: #111;
	font-size: clamp(0.85rem, 1.6vw, 1.1rem);
	font-weight: 900;
	letter-spacing: -0.01em;
	line-height: 1.1;
}

/* Title row + actions */
.spl-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px 24px;
	margin-top: clamp(20px, 3vw, 32px);
}

.spl-title {
	margin: 0;
	font-size: clamp(2rem, 5vw, 3.4rem);
	font-weight: 900;
	letter-spacing: -0.04em;
	line-height: 1.02;
	color: var(--text);
}

.spl-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }

.spl-tags a,
.spl-filter a {
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--card);
	box-shadow: inset 0 0 0 1px var(--line);
	color: var(--text-2);
	font-size: 0.85rem;
	font-weight: 700;
	text-decoration: none;
	transition: background var(--ease), color var(--ease);
}

.spl-tags a:hover,
.spl-filter a:hover { background: var(--card-2); color: var(--text); }
.spl-filter a[aria-current] { background: #fff; color: #000; box-shadow: none; }

.spl-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.spl-actions .swh-btn { padding: 10px 18px; }

/* Every color, every format */
.spl-colors {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
	gap: 12px;
}

.spl-color {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 18px;
	background: var(--card);
	box-shadow: inset 0 0 0 1px var(--line);
	transition: transform var(--ease), box-shadow var(--ease);
}

.spl-color.is-lit { transform: translateY(-4px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 16px 32px rgba(0, 0, 0, 0.45); }

.spl-color-swatch {
	display: flex;
	align-items: flex-end;
	height: 120px;
	padding: 12px 14px;
	border: 0;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
	cursor: pointer;
	text-align: left;
}

.spl-color-swatch span { font-family: var(--mono); font-size: 1.05rem; font-weight: 700; }

.spl-values { margin: 0; padding: 8px 6px 10px; }

.spl-values div {
	display: grid;
	grid-template-columns: 62px 1fr;
	align-items: center;
	padding: 2px 8px;
}

.spl-values dt {
	font-size: 0.66rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-3);
}

.spl-values dd { margin: 0; min-width: 0; }

.spl-values button {
	display: block;
	width: 100%;
	padding: 4px 6px;
	overflow: hidden;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--text);
	font-family: var(--mono);
	font-size: 0.82rem;
	text-align: left;
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: pointer;
}

.spl-values button:hover { background: var(--card-2); }

.spl-about { max-width: 760px; color: var(--text-2); font-size: 1.05rem; line-height: 1.7; }

/* In use: a tiny website card */
.spl-inuse .swh-h2 { margin-bottom: 16px; }

.spl-mock {
	overflow: hidden;
	border-radius: 20px;
	background: var(--bg);
	color: var(--ink);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.spl-mock-nav { display: flex; align-items: center; gap: 14px; padding: 16px 24px; border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); }
.spl-mock-nav b { margin-right: auto; font-weight: 900; }
.spl-mock-nav span { width: 46px; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 25%, transparent); }

.spl-mock-hero {
	display: grid;
	grid-template-columns: 1.1fr 1fr;
	align-items: center;
	gap: 24px;
	padding: clamp(24px, 4vw, 48px);
}

.spl-mock-h { margin: 0 0 10px; font-size: clamp(1.6rem, 3.6vw, 2.6rem); font-weight: 900; letter-spacing: -0.03em; line-height: 1.05; }
.spl-mock-p { margin: 0 0 18px; font-size: 1rem; opacity: 0.75; }
.spl-mock-btn { display: inline-block; padding: 10px 20px; border-radius: 999px; background: var(--a); color: var(--bg); font-weight: 800; }
.spl-mock-art { display: flex; height: clamp(140px, 22vw, 220px); overflow: hidden; border-radius: 16px; transform: rotate(-3deg); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3); }
.spl-mock-art i { flex: 1; }

/* ============================================================
   LIBRARY GRID (archive + related)
   ============================================================ */

.spl-intro .swh-intro-sub a { color: var(--text); }
.spl-filter { display: flex; flex-wrap: wrap; gap: 6px; }

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

.spl-grid-ad { grid-column: 1 / -1; }

.spl-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 18px;
	background: var(--card);
	color: var(--text);
	text-decoration: none;
	box-shadow: inset 0 0 0 1px var(--line);
	transition: transform var(--ease), background var(--ease);
}

.spl-card:hover { transform: translateY(-4px); background: var(--card-2); color: var(--text); }

.spl-card-photo { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--card-2); }
.spl-card-photo img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 500ms ease; }
.spl-card:hover .spl-card-photo img { transform: scale(1.04); }

.spl-card-strip { display: flex; height: 34px; }
.spl-card-strip i { flex: 1; transition: flex 260ms ease; }
.spl-card-strip i:hover { flex: 1.8; }

.spl-card-body { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 14px; }
.spl-card-name { font-weight: 800; }
.spl-card-hex { font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.spl-pages { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.spl-pages .page-numbers {
	min-width: 40px;
	padding: 9px 14px;
	border-radius: 999px;
	background: var(--card);
	color: var(--text-2);
	font-weight: 700;
	text-align: center;
	text-decoration: none;
}

.spl-pages .page-numbers.current { background: #fff; color: #000; }
.spl-none { color: var(--text-2); }
.spl-none a { color: var(--text); }

@media (max-width: 760px) {
	.spl-mock-hero { grid-template-columns: 1fr; }
	.spl-actions { width: 100%; }
	.spl-actions .swh-btn { flex: 1 1 40%; }
	.spl-card-frame { width: clamp(108px, 34%, 200px); }

	/* Colors: swatch beside its values */
	.spl-colors { grid-template-columns: 1fr; }
	.spl-color { flex-direction: row; }
	.spl-color-swatch { flex: 0 0 104px; height: auto; min-height: 150px; padding: 10px; }
	.spl-color-swatch span { font-size: 0.85rem; }
	.spl-values { flex: 1; min-width: 0; padding: 8px 4px; }
	.spl-values div { grid-template-columns: 56px 1fr; padding: 1px 6px; }
	.spl-pin { width: 16px; height: 16px; margin: -8px 0 0 -8px; }
}
