/* ============================================================
   COLOR NAMER (page-templates/color-namer.php)
   --c is the color being named, --on the text color that reads on it
   (both set by color-namer.js). The stage fills the screen and turns --c.
   ============================================================ */

.swn { --rim: color-mix(in srgb, var(--on) 22%, transparent); --spring: cubic-bezier(0.34, 1.56, 0.64, 1); }

.swn-stage {
	position: relative;
	display: flex; flex-direction: column;
	min-height: calc(100svh - 72px);
	padding: clamp(14px, 3vw, 24px) var(--gutter, 16px) clamp(40px, 8vw, 80px);
	background: var(--c);
	color: var(--on);
	transition: background-color 500ms ease, color 300ms ease;
}
/* The breadcrumb lines up with the site's content width, not the screen edge. */
.swn-top { width: 100%; max-width: calc(var(--max, 1320px) - 2 * var(--gutter, 16px)); margin: 0 auto; }
.swn-back { color: inherit; font-size: 0.85rem; font-weight: 700; text-decoration: none; opacity: 0.8; }
.swn-back:hover { color: inherit; opacity: 1; }

.swn-center { width: 100%; max-width: 820px; margin: auto; padding-top: clamp(24px, 6vh, 64px); text-align: center; }
.swn-title { margin: 0; color: inherit; font: 900 clamp(2.4rem, 7vw, 4.2rem)/1 var(--sans); letter-spacing: -0.04em; }
.swn-lede { margin: 14px auto 0; font-size: 1.1rem; line-height: 1.55; opacity: 0.85; }

/* ---------- Search ---------- */

.swn-search {
	display: flex; gap: 6px;
	margin: clamp(22px, 4vw, 34px) auto 0;
	padding: 6px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--on) 10%, transparent);
	box-shadow: inset 0 0 0 1.5px var(--rim), 0 12px 40px rgba(0, 0, 0, 0.18);
}
.swn-search:focus-within { box-shadow: inset 0 0 0 2px var(--on), 0 12px 40px rgba(0, 0, 0, 0.18); }
.swn-search input {
	flex: 1; min-width: 0;
	padding: 0 18px;
	border: 0; outline: 0; background: transparent;
	color: inherit; font: 600 1.1rem var(--mono);
}
/* No box of its own: the pill's ring (above) shows focus. Beats .swh :focus-visible (home-companion.css). */
.swn .swn-search input:focus,
.swn .swn-search input:focus-visible { outline: none; border: 0; box-shadow: none; background: transparent; }
.swn-search input::placeholder { color: inherit; opacity: 0.55; }
.swn-search input::-webkit-search-cancel-button { display: none; }
.swn-search button {
	flex: none; min-height: 48px; padding: 0 22px;
	border: 0; border-radius: 999px;
	background: var(--on); color: var(--c);
	font: 800 1rem var(--sans); cursor: pointer;
	transition: transform 200ms var(--spring);
}
.swn-search button:hover { transform: translateY(-1px); }
.swn-hint { min-height: 1.4em; margin: 10px 0 0; font-size: 0.92rem; font-weight: 600; }
.swn-hint:empty { min-height: 0; margin: 0; }

/* ---------- Result ---------- */

.swn-result { margin-top: clamp(30px, 5vw, 48px); animation: swn-in 420ms var(--spring); }
@keyframes swn-in { from { opacity: 0; transform: translateY(10px); } }
.swn-kicker { margin: 0; }
/* Closest match: an outlined label. Exact match: solid, with a check. */
.swn-badge {
	display: inline-flex; align-items: center; gap: 7px;
	min-height: 30px; padding: 0 14px;
	border-radius: 999px;
	font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
	box-shadow: inset 0 0 0 1.5px var(--rim);
}
.swn-badge--exact { background: var(--on); color: var(--c); box-shadow: none; }
.swn-badge--exact i {
	width: 16px; height: 16px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1a11 11 0 1 0 0 22 11 11 0 0 0 0-22Zm-1.4 15.6-4.3-4.3 1.6-1.6 2.7 2.7 6-6 1.6 1.6-7.6 7.6Z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1a11 11 0 1 0 0 22 11 11 0 0 0 0-22Zm-1.4 15.6-4.3-4.3 1.6-1.6 2.7 2.7 6-6 1.6 1.6-7.6 7.6Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.swn-name { margin: 12px 0 0; color: inherit; font: 900 clamp(3rem, 11vw, 6.5rem)/0.95 var(--sans); letter-spacing: -0.045em; overflow-wrap: anywhere; }
.swn-match { margin: 12px 0 0; font: 600 0.95rem var(--mono); opacity: 0.8; }

/* Closest match only: your color next to the named one. */
.swn-compare { display: flex; max-width: 420px; margin: 20px auto 0; overflow: hidden; border-radius: 16px; box-shadow: 0 0 0 1.5px var(--rim), 0 14px 34px -16px rgba(0, 0, 0, 0.5); }
.swn-compare[hidden] { display: none; }
.swn-compare span { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 30px 14px 12px; background: var(--s); color: var(--so); text-align: left; }
.swn-compare small { overflow: hidden; max-width: 100%; font-size: 0.75rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; opacity: 0.85; }
.swn-compare b { font: 600 0.88rem var(--mono); }

/* Codes: the same cards as the color page's Color codes (color-page.css .swc-code). */
.swn-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 30px; text-align: left; }
.swn-code {
	position: relative;
	display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
	min-width: 0; padding: 14px 40px 14px 16px;
	border: 0; border-radius: 14px;
	background: var(--card); color: #fff; text-align: left; cursor: copy;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 10px 24px -14px rgba(0, 0, 0, 0.6);
	transition: background-color 150ms ease, transform 200ms var(--spring);
}
.swn-code:hover { background: var(--card-2); transform: translateY(-1px); }
.swn-code span { color: var(--text-3); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.swn-code b { max-width: 100%; font: 600 1rem var(--mono); word-break: break-all; }
.swn-code > i {
	position: absolute; right: 14px; top: 50%;
	width: 16px; height: 16px; margin-top: -8px;
	background: var(--text-3);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='12' height='12' rx='2'/%3E%3Cpath d='M5 15V5a2 2 0 0 1 2-2h10'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='12' height='12' rx='2'/%3E%3Cpath d='M5 15V5a2 2 0 0 1 2-2h10'/%3E%3C/svg%3E") center / contain no-repeat;
}
.swn-code:hover > i { background: #fff; }

.swn-go {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 48px; margin-top: 22px; padding: 0 24px;
	border-radius: 999px;
	background: var(--on); color: var(--c);
	font: 800 1rem var(--sans); text-decoration: none;
	transition: transform 200ms var(--spring);
}
.swn-go:hover { color: var(--c); transform: translateY(-1px); }

/* Also close: real swatches, a row of small cards with the color, name and hex. */
.swn-alts { margin-top: 30px; }
.swn-alts p { margin: 0 0 10px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.75; }
.swn-alts div { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.swn-alts button {
	display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center;
	padding: 8px 12px 8px 8px;
	border: 0; border-radius: 12px;
	background: var(--card); color: #fff; text-align: left; cursor: pointer;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
	transition: background-color 150ms ease, transform 200ms var(--spring);
}
.swn-alts button:hover { background: var(--card-2); transform: translateY(-1px); }
.swn-alts i { grid-row: 1 / 3; width: 34px; height: 34px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); }
.swn-alts b { overflow: hidden; font-size: 0.88rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.swn-alts small { color: var(--text-3); font: 600 0.75rem var(--mono); }

/* Try: quiet text links under the search, not buttons. */
.swn-try { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 14px; margin: 16px 0 0; font-size: 0.85rem; }
.swn-try > span { font-weight: 700; opacity: 0.7; }
.swn-try button {
	padding: 0; border: 0; background: none; color: inherit;
	font: 600 0.85rem var(--mono); cursor: pointer;
	text-decoration: underline; text-decoration-color: var(--rim); text-underline-offset: 4px;
	opacity: 0.85;
}
.swn-try button:hover { text-decoration-color: currentColor; opacity: 1; }

/* ---------- About (below the splash) ---------- */

.swn-about { padding-top: clamp(40px, 6vw, 72px); padding-bottom: clamp(40px, 6vw, 72px); }
.swn-about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 18px; }
.swn-about-grid > div { padding: 20px; border-radius: var(--radius, 10px); background: var(--card, #16161d); }
.swn-about h3 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 800; }
.swn-about p { margin: 0; color: var(--text-2, #a9acb8); line-height: 1.6; }
.swn-about .swn-more { margin-top: 20px; }

.swn .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 560px) {
	.swn-codes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
	.swn-search { flex-direction: column; border-radius: 22px; }
	.swn-search input { min-height: 48px; text-align: center; }
	.swn-search button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.swn-stage, .swn-result { transition: none; animation: none; }
}
