/*
 * home-hub.css
 * Swatching homepage hub template
 * Location: /assets/home-hub.css
 *
 * @package Swatching
 */

/* ============================================================
   KEYFRAMES
   ============================================================ */

@keyframes sw-grad-shift {
	0%   { background-position: 0% 50%; }
	50%  { background-position: 100% 50%; }
	100% { background-position: 0% 50%; }
}

@keyframes sw-band-in {
	from { transform: scaleX(0); opacity: 0; }
	to   { transform: scaleX(1); opacity: 1; }
}

@keyframes sw-fade-up {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes sw-pulse-glow {
	0%, 100% { box-shadow: 0 0 0 0 rgba(35, 135, 255, 0); }
	50%       { box-shadow: 0 0 20px 3px rgba(35, 135, 255, 0.2); }
}

@keyframes sw-cell-pulse {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.65; }
}

@keyframes sw-border-crawl {
	0%   { background-position: 0% 50%; }
	100% { background-position: 200% 50%; }
}


/* ============================================================
   CSS VARIABLES
   ============================================================ */

.sw-page {
	--sw-bg:            #050509;
	--sw-surface:       #18181e;
	--sw-surface2:      #0c0c18;
	--sw-panel-game:    #07070F;
	--sw-chip:          #0e0e12;
	--sw-border:        rgba(255, 255, 255, 0.045);
	--sw-border-mid:    rgba(148, 163, 184, 0.28);
	--sw-border-strong: #111116;

	--sw-text:       #9ca3af;
	--sw-text-label: #e5e7ff;
	--sw-text-meta:  #d4d4d4;
	--sw-text-head:  #f9fafb;
	--sw-muted:      #6b7280;
	--sw-dim:        #374151;
	--sw-dimmer:     #1f2937;

	--sw-blue:   #2387ff;
	--sw-purple: #a855f7;
	--sw-green:  #22c55e;
	--sw-amber:  #e9c46a;
	--sw-teal:   #2a9d8f;
	--sw-red:    #e63946;

	--sw-gradient: linear-gradient(90deg, var(--sw-blue), var(--sw-purple));

	--sw-radius: 2px;

	--sw-trans:      150ms ease-out;
	--sw-trans-med:  300ms ease-out;
	--sw-trans-slow: 600ms ease-out;

	background-color: var(--sw-bg);
	color: var(--sw-text);
	font-family: 'Figtree', sans-serif;
}

.sw-rule {
	border: none;
	border-top: 1px solid var(--sw-border);
	margin: 20px 0;
}


/* ============================================================
   COLOR BAND
   ============================================================ */

.sw-color-band {
	display: flex;
	height: 5px;
	transform-origin: left;
	animation: sw-band-in 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.sw-color-band > div {
	transition: flex var(--sw-trans-slow);
}


/* ============================================================
   HERO
   ============================================================ */

.sw-hero {
	display: grid;
	grid-template-columns: 1fr 320px;
	border-bottom: 1px solid var(--sw-border);
	animation: sw-fade-up 600ms ease-out 100ms both;
}

.sw-hero-text {
	padding: 52px 40px;
	border-right: 1px solid var(--sw-border);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 32px;
}

.sw-hero-eyebrow {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.68rem;
	color: var(--sw-blue);
	letter-spacing: 0.26em;
	text-transform: uppercase;
	margin-bottom: 22px;
}

.sw-hero-title {
	font-size: clamp(3rem, 5vw, 4.5rem);
	font-weight: 900;
	line-height: 0.87;
	letter-spacing: -0.055em;
	margin: 0 0 18px;
	display: flex;
	flex-direction: column;
}

.sw-t-solid  { color: #ffffff; display: block; }

.sw-t-outline {
	color: transparent;
	-webkit-text-stroke: 1px rgba(255, 255, 255, 0.13);
	display: block;
}

.sw-t-gradient {
	background: linear-gradient(90deg, var(--sw-blue), var(--sw-purple), var(--sw-blue));
	background-size: 200% auto;
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	animation: sw-grad-shift 4s linear infinite;
	display: block;
}

.sw-hero-sub {
	font-size: 0.95rem;
	color: var(--sw-muted);
	line-height: 1.8;
	max-width: 400px;
	margin-bottom: 24px;
}

.sw-hero-actions {
	display: flex;
	gap: 14px;
	align-items: center;
	flex-wrap: wrap;
}

/* Primary button — animated border crawl */
.sw-btn-primary {
	position: relative;
	display: inline-block;
	cursor: pointer;
	text-decoration: none;
}

.sw-btn-border {
	position: absolute;
	inset: -1px;
	border-radius: var(--sw-radius);
	background: linear-gradient(90deg, var(--sw-blue), var(--sw-purple), var(--sw-blue));
	background-size: 200% auto;
	animation: sw-border-crawl 3s linear infinite;
	z-index: 0;
}

.sw-btn-inner {
	position: relative;
	display: block;
	background: var(--sw-blue);
	color: white;
	font-size: 0.88rem;
	font-weight: 700;
	padding: 11px 26px;
	border-radius: var(--sw-radius);
	letter-spacing: 0.05em;
	z-index: 1;
	margin: 1px;
	transition: background var(--sw-trans);
}

.sw-btn-primary:hover .sw-btn-inner {
	background: #1a6fd4;
	color: white;
}

.sw-btn-ghost {
	display: inline-block;
	color: var(--sw-dim);
	font-size: 0.88rem;
	letter-spacing: 0.04em;
	text-decoration: none;
	transition: color var(--sw-trans);
}

.sw-btn-ghost:hover {
	color: var(--sw-text-meta);
	text-decoration: none;
}

/* Extractor preview */
.sw-extractor-preview {
	background: var(--sw-surface2);
	display: flex;
	flex-direction: column;
	padding: 20px 20px 16px;
}

.sw-extractor-label {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.65rem;
	color: var(--sw-dim);
	letter-spacing: 0.2em;
	text-transform: uppercase;
	margin-bottom: 12px;
}

.sw-extractor-graphic {
	flex: 1;
	border-radius: var(--sw-radius);
	overflow: hidden;
	margin-bottom: 12px;
	min-height: 155px;
}

.sw-extractor-graphic svg { display: block; width: 100%; height: 100%; }

.sw-extractor-swatches { display: flex; gap: 4px; }

.sw-ext-swatch {
	flex: 1;
	height: 32px;
	border-radius: var(--sw-radius);
	display: flex;
	align-items: flex-end;
	padding: 3px 5px;
}

.sw-ext-swatch span {
	font-family: 'Source Code Pro', monospace;
	font-size: 9px;
	color: rgba(255, 255, 255, 0.3);
}


/* ============================================================
   TOOLS + GRID ROW
   ============================================================ */

.sw-tools-grid-row {
	display: grid;
	grid-template-columns: 1fr 1px 1fr;
	border-bottom: 1px solid var(--sw-border);
	animation: sw-fade-up 600ms ease-out 180ms both;
}

.sw-tools-divider { background: var(--sw-border); }

.sw-tools-panel { padding: 32px 36px; }

.sw-panel-label {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.65rem;
	color: var(--sw-dim);
	letter-spacing: 0.2em;
	text-transform: uppercase;
	margin-bottom: 18px;
}

.sw-panel-label--green { color: var(--sw-green); }

/* Converter */
.sw-converter-wrap {
	display: block;
	text-decoration: none;
	margin-bottom: 10px;
}

.sw-converter-bar {
	display: flex;
	height: 48px;
	border-radius: var(--sw-radius);
	overflow: hidden;
	margin-bottom: 10px;
	transition: opacity var(--sw-trans);
}

.sw-converter-wrap:hover .sw-converter-bar { opacity: 0.82; }

.sw-conv-seg {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
}

.sw-conv-format {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.7rem;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.85);
	letter-spacing: 0.08em;
}

.sw-conv-val {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.55rem;
	color: rgba(255, 255, 255, 0.3);
	letter-spacing: 0.05em;
}

.sw-tool-row-meta {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
}

.sw-tool-name {
	font-size: 1rem;
	font-weight: 700;
	color: var(--sw-text-head);
	margin-bottom: 2px;
}

.sw-tool-desc {
	font-size: 0.82rem;
	color: var(--sw-muted);
	line-height: 1.6;
}

.sw-tool-cta {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.65rem;
	color: var(--sw-blue);
	letter-spacing: 0.1em;
}

.sw-extractor-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	text-decoration: none;
	gap: 16px;
}

.sw-extractor-row:hover .sw-tool-name { color: var(--sw-blue); }

.sw-mini-palette {
	display: flex;
	align-items: center;
	gap: 3px;
	margin-top: 8px;
}

.sw-mini-palette div {
	width: 22px;
	height: 22px;
	border-radius: 1px;
}

.sw-mini-palette span {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.6rem;
	color: var(--sw-dim);
	margin-left: 4px;
	letter-spacing: 0.08em;
}

.sw-extractor-arrow {
	width: 36px;
	height: 36px;
	border: 1px solid rgba(35, 135, 255, 0.25);
	border-radius: var(--sw-radius);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: border-color var(--sw-trans), background var(--sw-trans);
}

.sw-extractor-row:hover .sw-extractor-arrow {
	border-color: var(--sw-blue);
	background: rgba(35, 135, 255, 0.08);
}

/* Grid game panel */
.sw-grid-panel {
	padding: 32px 36px;
	background: var(--sw-panel-game);
}

.sw-grid-panel-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 16px;
}

.sw-grid-tags { display: flex; gap: 4px; }

.sw-tag {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.6rem;
	padding: 3px 9px;
	border-radius: 1px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	border: 1px solid;
}

.sw-tag--green { color: var(--sw-green); border-color: rgba(34, 197, 94, 0.25); }
.sw-tag--dim   { color: var(--sw-dim);   border-color: rgba(255, 255, 255, 0.06); }

.sw-color-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 3px;
	margin-bottom: 16px;
}

.sw-grid-cell {
	aspect-ratio: 1;
	background: #2E6B8A;
	border-radius: 1px;
}

.sw-grid-cell--odd {
	background: #347593;
	outline: 1.5px solid rgba(255, 255, 255, 0.55);
	outline-offset: -1px;
	animation: sw-cell-pulse 2.2s ease-in-out infinite;
}

/* Difficulty levels */
.sw-grid-levels {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	margin-bottom: 18px;
}

.sw-level {
	background: #0E0E1A;
	border-radius: var(--sw-radius);
	padding: 8px 10px;
	border-left: 2px solid;
}

.sw-level--green  { border-color: var(--sw-green); }
.sw-level--blue   { border-color: var(--sw-blue); }
.sw-level--purple { border-color: var(--sw-purple); }

.sw-level-label {
	display: block;
	font-family: 'Source Code Pro', monospace;
	font-size: 0.6rem;
	color: var(--sw-dim);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	margin-bottom: 3px;
}

.sw-level-val {
	display: block;
	font-size: 0.88rem;
	font-weight: 700;
	color: var(--sw-text-head);
}

.sw-grid-footer {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 16px;
}

.sw-btn-play {
	display: inline-block;
	background: var(--sw-green);
	color: black;
	font-family: 'Source Code Pro', monospace;
	font-size: 0.75rem;
	font-weight: 700;
	padding: 10px 20px;
	border-radius: var(--sw-radius);
	letter-spacing: 0.1em;
	text-decoration: none;
	white-space: nowrap;
	transition: opacity var(--sw-trans), transform var(--sw-trans);
	animation: sw-pulse-glow 3.5s ease-in-out infinite;
}

.sw-btn-play:hover {
	opacity: 0.88;
	transform: translateY(-1px);
	color: black;
	text-decoration: none;
}


/* ============================================================
   AD UNITS
   ============================================================ */

.sw-ad-leaderboard {
	display: flex;
	align-items: center;
	height: 88px;
	padding: 0 36px;
	border-bottom: 1px solid var(--sw-border);
}

.sw-ad-label {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.6rem;
	color: #111118;
	letter-spacing: 0.14em;
	padding-right: 16px;
	border-right: 1px solid var(--sw-border);
	white-space: nowrap;
}

.sw-ad-slot {
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.sw-ad-slot--leaderboard {
	flex: 1;
	height: 66px;
	margin-left: 16px;
}

.sw-ad-incontent {
	padding: 14px 18px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	justify-content: center;
	border-left: 1px solid var(--sw-border);
}

.sw-ad-slot--box { width: 100%; min-height: 180px; }


/* ============================================================
   KNOWLEDGE BASE
   ============================================================ */

.sw-kb {
	animation: sw-fade-up 600ms ease-out 260ms both;
}

.sw-kb-head {
	padding: 20px 36px;
	border-bottom: 1px solid var(--sw-border);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.sw-kb-head-left {
	display: flex;
	align-items: center;
	gap: 14px;
}

.sw-kb-accent-bar {
	width: 3px;
	height: 22px;
	background: var(--sw-gradient);
	border-radius: 2px;
	flex-shrink: 0;
}

.sw-kb-title {
	font-size: 1rem;
	font-weight: 700;
	color: var(--sw-text-label);
	margin: 0;
}

.sw-kb-subtitle-label {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.6rem;
	color: var(--sw-dimmer);
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.sw-kb-all-link {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.68rem;
	color: var(--sw-blue);
	letter-spacing: 0.14em;
	text-decoration: none;
	text-transform: uppercase;
	transition: opacity var(--sw-trans);
}

.sw-kb-all-link:hover { opacity: 0.75; text-decoration: none; }

/* Rows */
.sw-kb-row { border-bottom: 1px solid var(--sw-border); }

.sw-kb-row--featured {
	display: grid;
	grid-template-columns: 1.1fr 1px 0.9fr 1px 0.75fr;
}

.sw-kb-row--secondary {
	display: grid;
	grid-template-columns: 1fr 300px;
}

.sw-kb-secondary-articles {
	display: grid;
	grid-template-columns: 1fr 1px 1fr;
}

.sw-kb-col-divider { background: var(--sw-border); }

.sw-kb-stack { display: flex; flex-direction: column; }

.sw-kb-stack-divider {
	height: 1px;
	background: var(--sw-border);
}

/* ---- Cards ---- */
.sw-kb-card {
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	transition: border-color var(--sw-trans);
}

.sw-kb-card:hover { text-decoration: none; }

/* Hover background — opacity 0 → 1 on hover */
.sw-kb-card-hover-bg {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity 500ms ease-out;
	z-index: 0;
}

/* Dark gradient over the hover bg so text stays readable */
.sw-kb-card-hover-bg::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(5,5,9,0.85), rgba(5,5,9,0.7));
}

.sw-kb-card:hover .sw-kb-card-hover-bg { opacity: 1; }

/* Accent left border revealed on hover */
.sw-kb-card--mid,
.sw-kb-card--small,
.sw-kb-card--list {
	border-left: 2px solid transparent;
	transition: border-color var(--sw-trans-med);
}

.sw-kb-card--mid:hover,
.sw-kb-card--small:hover,
.sw-kb-card--list:hover {
	border-left-color: var(--card-accent, var(--sw-blue));
}

/* Content wrapper — sits above hover bg */
.sw-kb-card-content {
	position: relative;
	z-index: 1;
	padding: 22px 24px;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.sw-kb-card-content--full {
	justify-content: space-between;
}

/* FEATURED: full bg card */
.sw-kb-card--featured {
	min-height: 220px;
}

.sw-kb-card-bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	transform: scale(1);
	transition: transform var(--sw-trans-slow);
}

.sw-kb-card--featured:hover .sw-kb-card-bg {
	transform: scale(1.03);
}

.sw-kb-card-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		180deg,
		rgba(5,5,9,0.08) 0%,
		rgba(5,5,9,0.55) 40%,
		rgba(5,5,9,0.94) 100%
	);
	z-index: 1;
}

/* Color wash on featured hover */
.sw-kb-card--featured::after {
	content: '';
	position: absolute;
	inset: 0;
	background: var(--card-accent, var(--sw-blue));
	opacity: 0;
	mix-blend-mode: color;
	z-index: 2;
	transition: opacity 450ms ease-out;
}

.sw-kb-card--featured:hover::after { opacity: 0.22; }

.sw-kb-card--featured .sw-kb-card-content {
	position: relative;
	z-index: 3;
	justify-content: flex-end;
	flex: 1;
}

/* Card internals */
.sw-kb-card-meta {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 10px;
}

.sw-kb-cat {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.6rem;
	font-weight: 700;
	padding: 3px 9px;
	border-radius: 1px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.sw-kb-cat--blue   { background: var(--sw-blue);   color: black; }
.sw-kb-cat--purple { background: var(--sw-purple); color: black; }
.sw-kb-cat--green  { background: var(--sw-green);  color: black; }
.sw-kb-cat--amber  { background: var(--sw-amber);  color: #412402; }
.sw-kb-cat--teal   { background: var(--sw-teal);   color: white; }
.sw-kb-cat--red    { background: var(--sw-red);    color: white; }

.sw-kb-time {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.6rem;
	color: var(--sw-dim);
}

.sw-kb-card-title {
	font-size: 1rem;
	font-weight: 700;
	color: var(--sw-text-head);
	line-height: 1.3;
	letter-spacing: -0.02em;
	margin: 0 0 8px;
}

.sw-kb-card-title--lg {
	font-size: 1.1rem;
	font-weight: 800;
	letter-spacing: -0.03em;
}

.sw-kb-card-title--sm {
	font-size: 0.9rem;
	margin-bottom: 0;
}

.sw-kb-card-excerpt {
	font-size: 0.82rem;
	color: var(--sw-muted);
	line-height: 1.7;
	margin: 0;
}

.sw-kb-card-foot {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 14px;
}

/* Animated gradient line */
.sw-kb-grad-line {
	height: 2px;
	width: 32px;
	background: var(--sw-gradient);
	border-radius: 1px;
	flex-shrink: 0;
	transition: width var(--sw-trans-med);
}

.sw-kb-card:hover .sw-kb-grad-line { width: 56px; }

.sw-kb-read-link {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.65rem;
	color: var(--sw-blue);
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

/* Topic strip */
.sw-kb-topics {
	padding: 13px 36px;
	display: flex;
	gap: 6px;
	align-items: center;
	flex-wrap: wrap;
	border-top: 1px solid var(--sw-border);
}

.sw-topics-label {
	font-family: 'Source Code Pro', monospace;
	font-size: 0.62rem;
	color: var(--sw-dim);
	letter-spacing: 0.15em;
	text-transform: uppercase;
	margin-right: 8px;
	white-space: nowrap;
}

.sw-topic-pill {
	padding: 6px 14px;
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 1px;
	font-size: 0.82rem;
	color: var(--sw-muted);
	text-decoration: none;
	transition: border-color var(--sw-trans), color var(--sw-trans), background var(--sw-trans);
}

.sw-topic-pill:hover {
	color: var(--sw-text-meta);
	border-color: rgba(148, 163, 184, 0.3);
	text-decoration: none;
}

.sw-topic-pill--active {
	color: var(--sw-blue);
	border-color: rgba(35, 135, 255, 0.3);
}


/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
	.sw-color-band,
	.sw-hero,
	.sw-tools-grid-row,
	.sw-kb { animation: none; }

	.sw-t-gradient       { animation: none; }
	.sw-btn-border        { animation: none; }
	.sw-btn-play          { animation: none; }
	.sw-grid-cell--odd    { animation: none; }
	.sw-kb-card-bg        { transition: none; }
	.sw-kb-card-hover-bg  { transition: none; }
	.sw-kb-grad-line      { transition: none; }
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {
	.sw-kb-row--featured {
		grid-template-columns: 1.1fr 1px 0.9fr;
	}
	.sw-kb-stack { display: none; }
	.sw-kb-row--secondary { grid-template-columns: 1fr; }
	.sw-ad-incontent { display: none; }
}

@media (max-width: 860px) {
	.sw-hero { grid-template-columns: 1fr; }
	.sw-extractor-preview { display: none; }
	.sw-hero-text { border-right: none; padding: 40px 24px; }

	.sw-tools-grid-row { grid-template-columns: 1fr; }
	.sw-tools-divider { display: none; }
	.sw-tools-panel,
	.sw-grid-panel { padding: 24px; }

	.sw-kb-row--featured { grid-template-columns: 1fr; }
	.sw-kb-col-divider { display: none; }
	.sw-kb-secondary-articles { grid-template-columns: 1fr; }

	.sw-ad-leaderboard { display: none; }
	.sw-kb-subtitle-label { display: none; }
}

@media (max-width: 560px) {
	.sw-hero-title {
		font-size: clamp(2.6rem, 10vw, 3.5rem);
	}
	.sw-grid-levels {
		grid-template-columns: repeat(3, 1fr);
	}
	.sw-kb-head {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
	}
}