/* Glossary (inc/glossary.php): term links + tooltips in guides, the
   "Terms in this guide" sidebar box, and the glossary pages. */

/* ---------- Term links in guides ----------
   A dotted underline: readable as "there's more here" without shouting.
   Beats the article link styles (.kb-article a …) without !important. */
.kb-article a.sw-gl,
.swgl-body a.sw-gl,
a.sw-gl {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	text-decoration: underline dotted;
	text-decoration-color: rgba(255, 255, 255, 0.45);
	text-decoration-thickness: 1.5px;
	text-underline-offset: 0.22em;
	cursor: help;
	transition: text-decoration-color 150ms ease, color 150ms ease;
}

.kb-article a.sw-gl::before,
.kb-article a.sw-gl::after,
a.sw-gl::before,
a.sw-gl::after { content: none; display: none; }

a.sw-gl:hover,
a.sw-gl:focus-visible,
a.sw-gl[aria-describedby] { color: #fff; text-decoration-color: #2387ff; text-decoration-style: solid; }

/* ---------- The tooltip ---------- */
.sw-gl-tip {
	position: absolute;
	z-index: 100000;
	width: min(320px, calc(100vw - 24px));
	padding: 14px 16px 12px;
	border-radius: 14px;
	background: #1f1f28;
	color: #c9ccd6;
	font: 400 0.92rem/1.5 'Figtree', system-ui, sans-serif;
	text-align: left;
	box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
	opacity: 0;
	transform: translateY(4px);
	pointer-events: none;
	transition: opacity 140ms ease, transform 180ms ease;
}

.sw-gl-tip.is-on { opacity: 1; transform: none; pointer-events: auto; }
.sw-gl-tip.is-above { transform: translateY(-4px); }
.sw-gl-tip.is-above.is-on { transform: none; }

.sw-gl-tip b { display: block; margin-bottom: 4px; color: #fff; font-size: 1rem; font-weight: 800; }
.sw-gl-tip p { margin: 0; }

.sw-gl-tip a {
	display: inline-block;
	margin-top: 8px;
	padding: 0;
	background: none;
	color: #7db8ff;
	font-size: 0.85rem;
	font-weight: 800;
	text-decoration: none;
}

.sw-gl-tip a:hover { color: #fff; text-decoration: underline; }
.sw-gl-tip a::before, .sw-gl-tip a::after { content: none; display: none; }

/* The little arrow */
.sw-gl-tip::after {
	content: '';
	position: absolute;
	left: var(--arrow, 24px);
	top: -6px;
	width: 12px;
	height: 12px;
	background: #1f1f28;
	box-shadow: -1px -1px 0 rgba(255, 255, 255, 0.1);
	transform: translateX(-50%) rotate(45deg);
}

.sw-gl-tip.is-above::after { top: auto; bottom: -6px; box-shadow: 1px 1px 0 rgba(255, 255, 255, 0.1); }

/* ---------- "Terms in this guide" (article sidebar) ---------- */
.sw-gl-box { margin-top: 18px; padding: 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.sw-gl-box ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; padding: 0; list-style: none; }
.sw-gl-box li { margin: 0; }
.sw-gl-box a.sw-gl { display: inline-block; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); font-size: 0.82rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.sw-gl-box a.sw-gl:hover { background: rgba(255, 255, 255, 0.14); }
.sw-gl-box-all { color: #a9acb8; font-size: 0.85rem; font-weight: 700; text-decoration: none; }
.sw-gl-box-all:hover { color: #fff; }

/* ---------- Glossary pages ---------- */
.swgl-crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; color: var(--text-3); font-size: 0.85rem; font-weight: 700; }
.swgl-crumbs a { color: var(--text-2); text-decoration: none; }
.swgl-crumbs a:hover { color: var(--text); text-decoration: underline; }

.swgl-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 16px; }
.swgl-sec-head .swh-h2, .swgl-sec-head .swh-sec-sub { margin: 0; }

/* Hero: a soft wash of every topic color behind the title */
.swgl-hero {
	position: relative;
	padding: clamp(32px, 6vw, 72px) 0 clamp(28px, 4vw, 44px);
	overflow: hidden;
	isolation: isolate;
}

.swgl-hero::before {
	content: '';
	position: absolute;
	inset: -30% -10% 10%;
	z-index: -1;
	background:
		radial-gradient(38% 60% at 12% 30%, rgba(35, 135, 255, 0.22), transparent 70%),
		radial-gradient(30% 50% at 48% 10%, rgba(166, 107, 255, 0.2), transparent 70%),
		radial-gradient(34% 55% at 82% 28%, rgba(255, 79, 154, 0.18), transparent 70%),
		radial-gradient(30% 45% at 95% 80%, rgba(255, 138, 43, 0.14), transparent 70%);
	filter: blur(10px);
}

.swgl-hero-title {
	margin: 0 0 14px;
	color: var(--text);
	font-size: clamp(2.4rem, 6vw, 4.6rem);
	font-weight: 900;
	letter-spacing: -0.045em;
	line-height: 1;
}

.swgl-hero-title span {
	background: linear-gradient(90deg, #2387ff, #a66bff 35%, #ff4f9a 65%, #ff8a2b);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.swgl-hero-sub { max-width: 40em; margin: 0 0 24px; color: var(--text-2); font-size: clamp(1rem, 1.4vw, 1.15rem); line-height: 1.6; }
.swgl-hero-sub a { color: var(--text); }

.swgl-find {
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: 620px;
	padding: 6px 6px 6px 18px;
	border-radius: 999px;
	background: var(--card);
	color: var(--text-3);
	box-shadow: inset 0 0 0 1px var(--line), 0 14px 40px rgba(0, 0, 0, 0.35);
}

.swgl-find:focus-within { box-shadow: inset 0 0 0 2px var(--blue), 0 14px 40px rgba(0, 0, 0, 0.35); }
.swgl-find input { flex: 1; min-width: 0; padding: 11px 0; border: 0; background: none; color: var(--text); font: 600 1.05rem var(--sans); outline: none; }
.swgl-find input::-webkit-search-cancel-button { filter: invert(1); opacity: 0.5; }

.swgl-random {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	padding: 10px 14px;
	border-radius: 999px;
	background: var(--card-2);
	color: var(--text);
	font-size: 0.85rem;
	font-weight: 800;
	text-decoration: none;
	transition: background-color var(--ease);
}

.swgl-random:hover { background: var(--card-3); color: var(--text); }

.swgl-topics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.swgl-topic {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 14px;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.05);
	color: var(--text-2);
	font: 700 0.88rem var(--sans);
	cursor: pointer;
	box-shadow: inset 0 0 0 1px var(--line);
	transition: background-color var(--ease), color var(--ease), box-shadow var(--ease);
}

.swgl-topic i { width: 9px; height: 9px; border-radius: 50%; background: var(--tc); box-shadow: 0 0 10px var(--tc); }
.swgl-topic span { color: var(--text-3); font-weight: 600; }
.swgl-topic:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); }
.swgl-topic[aria-pressed="true"] { background: #fff; color: #000; box-shadow: none; }
.swgl-topic[aria-pressed="true"] span { color: rgba(0, 0, 0, 0.55); }
.swgl-topic[aria-pressed="true"] i { box-shadow: none; }

/* A–Z: letter rail beside the list */
.swgl-az { padding-top: clamp(32px, 5vw, 56px); }
.swgl-az-layout { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: clamp(16px, 3vw, 36px); align-items: start; }

.swgl-rail {
	position: sticky;
	top: 24px;
	display: flex;
	flex-direction: column;
	gap: 1px;
	padding: 8px 4px;
	border-radius: 999px;
	background: var(--card);
	box-shadow: inset 0 0 0 1px var(--line);
}

.admin-bar .swgl-rail { top: 56px; }

.swgl-rail a,
.swgl-rail span { display: grid; place-items: center; height: 22px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; text-decoration: none; }
.swgl-rail a { color: var(--text-2); transition: background-color var(--ease), color var(--ease); }
.swgl-rail a:hover { background: var(--card-3); color: var(--text); }
.swgl-rail a.is-on { background: #fff; color: #000; }
.swgl-rail a.is-off { color: var(--text-3); opacity: 0.35; pointer-events: none; }
.swgl-rail span { color: var(--text-3); opacity: 0.3; }

.swgl-list { min-width: 0; padding-bottom: 24px; }
.swgl-ad { padding: 22px 0; border-top: 1px solid var(--line); text-align: center; }

/* Each letter: a big letter, then its terms */
.swgl-letter {
	display: grid;
	grid-template-columns: clamp(56px, 7vw, 92px) minmax(0, 1fr);
	gap: clamp(10px, 2vw, 24px);
	padding: 22px 0;
	border-top: 1px solid var(--line);
	scroll-margin-top: 16px;
}

.swgl-letter:first-child { border-top: 0; padding-top: 4px; }
.swgl-letter[hidden] { display: none; }

.swgl-letter-h {
	position: sticky;
	top: 20px;
	align-self: start;
	margin: 0;
	color: var(--text);
	font-size: clamp(3rem, 6vw, 4.6rem);
	font-weight: 900;
	letter-spacing: -0.04em;
	line-height: 0.85;
}

.swgl-terms { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 10px; }

.swgl-term {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px 15px 18px;
	overflow: hidden;
	border-radius: 16px;
	background: var(--card);
	color: var(--text-2);
	text-decoration: none;
	box-shadow: inset 0 0 0 1px var(--line);
	transition: background-color var(--ease), transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow var(--ease);
}

/* The topic color: a thin bar on the left that glows on hover */
.swgl-term::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--tc); }
.swgl-term:hover { background: var(--card-2); color: var(--text-2); transform: translateY(-3px); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc) 45%, transparent), 0 12px 30px rgba(0, 0, 0, 0.3); }
.swgl-term[hidden] { display: none; }
.swgl-term-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.swgl-term-top b { color: var(--text); font-size: 1.05rem; font-weight: 800; }
.swgl-term-top em { color: var(--tc); font-size: 0.7rem; font-style: normal; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.swgl-term-def { font-size: 0.9rem; line-height: 1.5; }
.swgl-none { margin: 24px 0; }
.swgl-none a { color: var(--text); }

/* One term */
.swgl-article { max-width: 860px; padding-top: clamp(28px, 5vw, 56px); }
.swgl-kicker { margin: 0 0 8px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.swgl-kicker a { display: inline-flex; align-items: center; gap: 8px; color: var(--tc, var(--blue)); text-decoration: none; }
.swgl-kicker a::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.swgl-kicker a:hover { text-decoration: underline; }
.swgl-title { margin: 0 0 14px; color: var(--text); font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 900; letter-spacing: -0.045em; line-height: 1; }
.swgl-lede { margin: 0 0 10px; padding-left: 16px; border-left: 3px solid var(--tc, var(--blue)); color: var(--text); font-size: clamp(1.1rem, 1.8vw, 1.3rem); line-height: 1.55; }
.swgl-aka { margin: 0; color: var(--text-3); font-size: 0.92rem; font-weight: 600; }
.swgl-head { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.swgl-body { color: var(--text-2); font-size: 1.05rem; line-height: 1.75; }
.swgl-body p { margin: 0 0 1em; }
.swgl-body a:not(.sw-gl):not(.sw-hex-link) { color: var(--text); }

.swgl-guides { margin-top: 36px; }
.swgl-guides .swk-grid { margin: 14px 0 0; padding: 0; list-style: none; }

.swgl-pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 40px 0 8px; }
.swgl-pager a { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 14px; background: var(--card); color: var(--text-3); font-size: 0.8rem; font-weight: 700; text-decoration: none; box-shadow: inset 0 0 0 1px var(--line); }
.swgl-pager a:hover { background: var(--card-2); }
.swgl-pager b { color: var(--text); font-size: 1rem; }
.swgl-pager-prev { grid-column: 1; }
.swgl-pager-all { grid-column: 2; align-self: stretch; justify-content: center; color: var(--text) !important; }
.swgl-pager-next { grid-column: 3; text-align: right; }

/* Phones: the letters become one scrollable row above the list (not pinned) */
@media (max-width: 700px) {
	.swgl-az-layout { grid-template-columns: minmax(0, 1fr); }
	.swgl-rail {
		position: static;
		flex-direction: row;
		gap: 2px;
		margin: 0 calc(-1 * var(--gutter));
		padding: 6px var(--gutter);
		overflow-x: auto;
		border-radius: 0;
		background: none;
		box-shadow: none;
		scrollbar-width: none;
	}
	.swgl-rail::-webkit-scrollbar { display: none; }
	.swgl-rail a, .swgl-rail span { flex: 0 0 34px; height: 34px; font-size: 0.9rem; }
	.swgl-rail a { background: var(--card); }
	.swgl-letter { grid-template-columns: minmax(0, 1fr); gap: 8px; }
	.swgl-letter-h { position: static; font-size: 2.6rem; }
	.swgl-random span { display: none; }
	.swgl-pager { grid-template-columns: 1fr 1fr; }
	.swgl-pager-all { grid-column: 1 / -1; grid-row: 2; text-align: center; }
	.swgl-pager-next { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
	.sw-gl-tip, .swgl-term { transition: none; }
	html { scroll-behavior: auto !important; }
}

/* ---------- Word of the day (Learn hub panel, homepage) ---------- */
.swgl-wotd {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 22px 24px;
	overflow: hidden;
	border-radius: 20px;
	background: #16161d;
	color: #a9acb8;
	text-decoration: none;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
	isolation: isolate;
	transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 180ms ease;
}

/* A glow of the term's topic color in the corner */
.swgl-wotd::before {
	content: '';
	position: absolute;
	right: -30%;
	top: -50%;
	z-index: -1;
	width: 80%;
	aspect-ratio: 1;
	border-radius: 50%;
	background: radial-gradient(closest-side, color-mix(in srgb, var(--tc) 35%, transparent), transparent);
}

.swgl-wotd:hover { color: #a9acb8; transform: translateY(-3px); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc) 50%, transparent), 0 16px 36px rgba(0, 0, 0, 0.35); }
.swgl-wotd-kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--tc); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.swgl-wotd-kicker::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.swgl-wotd-term { color: #fff; font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 900; letter-spacing: -0.035em; line-height: 1.05; }
.swgl-wotd-def { max-width: 34em; font-size: 1rem; line-height: 1.55; }
.swgl-wotd-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; }
.swgl-wotd-topic { padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: #c9ccd6; font-size: 0.78rem; font-weight: 700; }
.swgl-wotd-go { color: #fff; font-size: 0.9rem; font-weight: 800; }

/* Learn hub: the card beside find / topics / A–Z */
.swgl-panel-in { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(16px, 3vw, 36px); align-items: stretch; }
.swgl-wotd--hub { min-height: 280px; padding: 28px 30px; }
.swgl-panel-side { display: flex; flex-direction: column; justify-content: center; gap: 12px; min-width: 0; }
.swgl-panel-side .swh-h2, .swgl-panel-side .swh-sec-sub { margin: 0; }
.swgl-panel-kicker { margin: 0; color: var(--blue); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.swgl-find--sm { max-width: none; padding: 2px 6px 2px 16px; box-shadow: inset 0 0 0 1px var(--line); }
.swgl-find--sm input { padding: 11px 0; font-size: 1rem; }
.swgl-panel-topics { display: flex; flex-wrap: wrap; gap: 6px; }
.swgl-panel-topics .swgl-topic { padding: 6px 12px; font-size: 0.82rem; text-decoration: none; }
.swgl-panel-az { display: flex; flex-wrap: wrap; gap: 2px; }
.swgl-panel-az a, .swgl-panel-az span { display: grid; place-items: center; min-width: 26px; height: 26px; border-radius: 7px; font-size: 0.8rem; font-weight: 800; text-decoration: none; }
.swgl-panel-az a { color: var(--text-2); }
.swgl-panel-az a:hover { background: var(--card-2); color: var(--text); }
.swgl-panel-az span { color: var(--text-3); opacity: 0.35; }

/* Homepage Learn section: "New to color?" beside the word of the day */
.swh-learn-lead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.swh-learn-lead .swh-starter { margin-bottom: 0; }
.swgl-wotd--home { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 16px 20px; border-radius: 12px; }
.swgl-wotd--home .swgl-wotd-term { font-size: 1.3rem; letter-spacing: -0.02em; }
.swgl-wotd--home .swgl-wotd-def { flex-basis: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 0.92rem; }
.swgl-wotd--home .swgl-wotd-foot { display: none; }
.swgl-wotd--home::before { width: 50%; right: -10%; top: -80%; }

@media (max-width: 860px) {
	.swgl-panel-in, .swh-learn-lead { grid-template-columns: minmax(0, 1fr); }
	.swgl-wotd--hub { min-height: 0; }
}
