/* ==========================================================================
   /free-themes — hub, theme pages and the licence page.
   Layers on top of assets/style.css, which holds the site's design tokens
   (--accent purple, --accent-2 cyan, dark surfaces, Bricolage + Inter).
   ========================================================================== */

.th-main {
	width: min(1240px, calc(100% - 2 * clamp(16px, 5vw, 48px)));
	margin-inline: auto;
	padding: clamp(20px, 4vw, 40px) 0 clamp(50px, 8vw, 100px);
}

/* --------------------------------------------------------------------------
   Hub header
   -------------------------------------------------------------------------- */

.th-hub-head {
	max-width: 760px;
	padding: clamp(16px, 3vw, 34px) 0 clamp(26px, 4vw, 44px);
}

.th-hub-head h1 {
	margin: 10px 0 16px;
	font-size: clamp(2rem, 1.3rem + 3vw, 3.4rem);
	line-height: 1.04;
	letter-spacing: -0.03em;
}

.th-hub-head .lead {
	max-width: 62ch;
	color: var(--muted);
	font-size: clamp(1.02rem, 0.98rem + 0.3vw, 1.18rem);
}

.th-hub-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 26px 0 0;
}

.hub-trust {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 28px;
	margin-top: 26px;
	color: var(--muted);
	font-size: 0.9rem;
}

.hub-trust strong {
	color: var(--accent-2);
}

/* --------------------------------------------------------------------------
   Category filter
   -------------------------------------------------------------------------- */

.th-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: clamp(20px, 3vw, 32px);
	padding-bottom: 4px;
}

.th-filters .tab {
	padding: 9px 16px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: transparent;
	color: var(--muted);
	cursor: pointer;
	font: inherit;
	font-size: 0.88rem;
	font-weight: 600;
	white-space: nowrap;
}

.th-filters .tab:hover,
.th-filters .tab:focus-visible {
	border-color: var(--accent);
	color: var(--txt);
}

.th-filters .tab.on {
	border-color: transparent;
	background: var(--accent);
	color: #fff;
}

@media (max-width: 700px) {
	/* One scrolling row beats four wrapped rows above the grid on a phone. */
	.th-filters {
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.th-filters::-webkit-scrollbar {
		display: none;
	}
}

/* --------------------------------------------------------------------------
   Theme cards
   -------------------------------------------------------------------------- */

.th-grid {
	display: grid;
	gap: clamp(18px, 2.4vw, 28px);
	grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}

@media (max-width: 420px) {
	.th-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

.th-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: 16px;
	background: var(--panel);
	transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.th-card:hover,
.th-card:focus-within {
	transform: translateY(-3px);
	border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
	box-shadow: 0 24px 50px -34px rgb(0 0 0 / 80%);
}

.th-shot {
	display: block;
	overflow: hidden;
	border-bottom: 1px solid var(--border);
	background: #0c0d14;
	line-height: 0;
}

.th-shot img {
	width: 100%;
	height: auto;
	/* The screenshots are 4:3; locking the ratio stops the grid jumping as
	   lazy-loaded images arrive. */
	aspect-ratio: 4 / 3;
	object-fit: cover;
	object-position: top center;
}

.th-card-body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	padding: 20px 20px 18px;
}

.th-card-top {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 12px;
	align-items: baseline;
	justify-content: space-between;
}

.th-card-body h2,
.th-card-body h3 {
	margin: 0;
	font-size: 1.24rem;
	letter-spacing: -0.02em;
}

.th-card-body h2 a,
.th-card-body h3 a {
	color: inherit;
	text-decoration: none;
}

.th-card-body h2 a:hover,
.th-card-body h3 a:hover,
.th-card-body h2 a:focus-visible,
.th-card-body h3 a:focus-visible {
	color: var(--accent-2);
}

.th-cat {
	color: var(--muted);
	font-size: 0.76rem;
	font-weight: 600;
	white-space: nowrap;
}

.th-tagline {
	margin: 8px 0 0;
	color: var(--muted);
	font-size: 0.94rem;
	line-height: 1.5;
}

.th-swatches {
	display: flex;
	gap: 6px;
	margin: 14px 0 0;
}

.th-swatches span {
	width: 22px;
	height: 22px;
	border-radius: 6px;
	/* Every theme's "text" swatch is near-black and would otherwise disappear
	   into this dark card — the ring is what makes it countable. */
	box-shadow: inset 0 0 0 1px rgb(255 255 255 / 22%);
}

.th-card-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: auto;
	padding-top: 16px;
}

.th-meta {
	margin: 12px 0 0;
	color: var(--muted);
	font-size: 0.78rem;
}

/* --------------------------------------------------------------------------
   Single theme page
   -------------------------------------------------------------------------- */

.crumbs {
	margin-bottom: 18px;
	color: var(--muted);
	font-size: 0.86rem;
}

.crumbs a {
	color: var(--muted);
}

.crumbs a:hover {
	color: var(--accent-2);
}

.th-hero {
	display: grid;
	gap: clamp(26px, 4vw, 48px);
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
	align-items: center;
	padding-bottom: clamp(32px, 5vw, 56px);
	border-bottom: 1px solid var(--border);
}

@media (max-width: 900px) {
	.th-hero {
		grid-template-columns: minmax(0, 1fr);
	}
}

.th-hero-copy h1 {
	margin: 12px 0 12px;
	font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.4rem);
	line-height: 1.02;
	letter-spacing: -0.035em;
}

.th-hero-copy .lead {
	max-width: 46ch;
	color: var(--muted);
	font-size: 1.1rem;
}

.th-hero-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 24px 0 0;
}

.btn-sub {
	display: block;
	margin-top: 2px;
	font-size: 0.74rem;
	font-weight: 500;
	opacity: 0.72;
}

.th-hero-actions .btn-lg {
	flex-direction: column;
	line-height: 1.2;
}

.th-specs {
	display: grid;
	gap: 0;
	margin: 28px 0 0;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	border-top: 1px solid var(--border);
}

.th-specs > div {
	padding: 12px 0;
	border-bottom: 1px solid var(--border);
}

.th-specs dt {
	color: var(--muted);
	font-size: 0.76rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.th-specs dd {
	margin: 4px 0 0;
	font-size: 0.98rem;
	font-weight: 600;
}

.th-hero-shot {
	margin: 0;
}

.th-hero-shot img {
	width: 100%;
	height: auto;
	border: 1px solid var(--border);
	border-radius: 14px;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	object-position: top center;
}

.th-hero-shot figcaption {
	margin-top: 10px;
	color: var(--muted);
	font-size: 0.82rem;
}

/* --------------------------------------------------------------------------
   Body columns
   -------------------------------------------------------------------------- */

.th-body {
	display: grid;
	gap: clamp(26px, 4vw, 52px);
	grid-template-columns: minmax(0, 1fr) 320px;
	align-items: start;
	padding: clamp(32px, 5vw, 56px) 0;
}

@media (max-width: 900px) {
	.th-body {
		grid-template-columns: minmax(0, 1fr);
	}
}

.th-section + .th-section {
	margin-top: clamp(28px, 4vw, 44px);
}

.th-section h2 {
	margin: 0 0 14px;
	font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.7rem);
	letter-spacing: -0.02em;
}

.th-section p {
	max-width: 68ch;
	color: var(--muted);
	line-height: 1.65;
}

.th-features {
	margin: 0;
	padding: 0;
	list-style: none;
}

.th-features li {
	position: relative;
	padding: 9px 0 9px 30px;
	border-bottom: 1px solid var(--border);
	color: var(--muted);
	line-height: 1.55;
}

.th-features li:last-child {
	border-bottom: 0;
}

.th-features li::before {
	content: "✓";
	position: absolute;
	left: 2px;
	color: var(--accent-2);
	font-weight: 800;
}

.th-steps {
	margin: 0;
	padding-left: 22px;
	color: var(--muted);
}

.th-steps li {
	margin-bottom: 12px;
	line-height: 1.6;
}

.th-steps strong {
	color: var(--txt);
}

.th-note {
	margin-top: 16px;
	padding: 14px 16px;
	border-left: 3px solid var(--accent);
	border-radius: 0 8px 8px 0;
	background: color-mix(in srgb, var(--accent) 8%, transparent);
	font-size: 0.92rem;
}

code {
	padding: 2px 6px;
	border-radius: 5px;
	background: color-mix(in srgb, #fff 8%, transparent);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.88em;
}

/* Accordions, shared by the hub FAQ and the per-theme FAQ. */
.th-faq details {
	border-bottom: 1px solid var(--border);
}

.th-faq summary,
.th-single .th-faq summary {
	position: relative;
	padding: 15px 34px 15px 0;
	cursor: pointer;
	font-weight: 600;
	list-style: none;
}

.th-faq summary::-webkit-details-marker {
	display: none;
}

.th-faq summary::after {
	content: "+";
	position: absolute;
	top: 50%;
	right: 4px;
	transform: translateY(-50%);
	color: var(--accent-2);
	font-size: 1.3rem;
	font-weight: 400;
}

.th-faq details[open] summary::after {
	content: "−";
}

.th-faq details p {
	margin: 0 0 16px;
	max-width: 68ch;
	color: var(--muted);
	line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Sidebar cards
   -------------------------------------------------------------------------- */

.th-body-side {
	display: grid;
	gap: 16px;
	position: sticky;
	top: 20px;
}

@media (max-width: 900px) {
	.th-body-side {
		position: static;
	}
}

.th-side-card {
	padding: 20px;
	border: 1px solid var(--border);
	border-radius: 14px;
	background: var(--panel);
}

.th-side-card h2 {
	margin: 0 0 10px;
	font-size: 0.82rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.th-side-card p {
	margin: 0 0 12px;
	color: var(--muted);
	font-size: 0.9rem;
	line-height: 1.55;
}

.th-palette,
.th-filelist {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.88rem;
}

.th-palette li {
	display: flex;
	gap: 10px;
	align-items: center;
	padding: 7px 0;
	color: var(--muted);
}

.th-palette li span {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	border-radius: 6px;
}

.th-palette code {
	margin-left: auto;
	font-size: 0.78rem;
}

.th-filelist li {
	padding: 7px 0;
	border-bottom: 1px solid var(--border);
	color: var(--muted);
}

.th-filelist li:last-child {
	border-bottom: 0;
}

.th-checksum {
	margin: 14px 0 0 !important;
	font-size: 0.72rem !important;
	word-break: break-all;
}

.th-side-cta {
	border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
	background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

/* --------------------------------------------------------------------------
   The shared promise block
   -------------------------------------------------------------------------- */

.th-promise {
	margin-top: clamp(36px, 6vw, 70px);
	padding: clamp(28px, 4vw, 46px);
	border: 1px solid var(--border);
	border-radius: 18px;
	background: var(--panel);
}

.th-promise h2 {
	margin: 0 0 clamp(20px, 3vw, 30px);
	font-size: clamp(1.3rem, 1.1rem + 1vw, 1.8rem);
	letter-spacing: -0.02em;
}

.promise-grid {
	display: grid;
	gap: clamp(20px, 3vw, 32px);
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.promise-grid h3 {
	margin: 0 0 8px;
	font-size: 1.02rem;
	letter-spacing: -0.01em;
}

.promise-grid p {
	margin: 0;
	color: var(--muted);
	font-size: 0.93rem;
	line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Plugins-coming-next block
   -------------------------------------------------------------------------- */

.th-next {
	display: grid;
	gap: clamp(24px, 4vw, 44px);
	grid-template-columns: minmax(0, 1fr) 260px;
	align-items: center;
	margin-top: clamp(30px, 5vw, 56px);
	padding: clamp(28px, 4vw, 44px);
	border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
	border-radius: 18px;
}

@media (max-width: 760px) {
	.th-next {
		grid-template-columns: minmax(0, 1fr);
	}
}

.th-next h2 {
	margin: 8px 0 12px;
	font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem);
	letter-spacing: -0.025em;
}

.th-next p {
	max-width: 60ch;
	margin: 0 0 12px;
	color: var(--muted);
	line-height: 1.62;
}

.th-next-note {
	font-size: 0.9rem;
}

.th-next-card {
	display: grid;
	gap: 6px;
	padding: 26px 20px;
	border-radius: 14px;
	background: color-mix(in srgb, var(--accent) 14%, var(--panel));
	text-align: center;
}

.th-next-card span {
	font-size: 2.2rem;
}

.th-next-card strong {
	font-size: 1rem;
}

.th-next-card em {
	color: var(--accent-2);
	font-size: 0.82rem;
	font-style: normal;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Hub FAQ, related, prose page
   -------------------------------------------------------------------------- */

.th-faq > h2,
.th-related > h2 {
	margin: clamp(36px, 6vw, 66px) 0 16px;
	font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem);
	letter-spacing: -0.02em;
}

.th-related .th-grid {
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.th-allink {
	margin-top: 26px;
	text-align: center;
}

.hub-empty {
	padding: 40px 0;
	color: var(--muted);
	text-align: center;
}

.th-prose .th-section p {
	font-size: 1.02rem;
}

.th-prose .th-section {
	max-width: 74ch;
}

/* --------------------------------------------------------------------------
   Phone
   -------------------------------------------------------------------------- */

@media (max-width: 700px) {
	/* The screenshot is the reason to click, so it moves above the words. */
	.th-hero {
		display: flex;
		flex-direction: column;
	}

	.th-hero-shot {
		order: -1;
	}

	.th-hero-actions .btn,
	.th-card-actions .btn {
		flex: 1 1 auto;
		justify-content: center;
	}

	.th-specs {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 0 20px;
	}
}

/* --------------------------------------------------------------------------
   Platform badge

   Added when Shopify themes joined the library. The badge carries the platform
   name as text, not colour alone — "which platform is this?" is the first
   question on the page and it must survive a greyscale screenshot.
   -------------------------------------------------------------------------- */

.th-plat {
	display: inline-flex;
	gap: 5px;
	align-items: center;
	align-self: flex-start;
	margin-top: 10px;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	white-space: nowrap;
}

.th-plat--wordpress {
	background: color-mix(in srgb, #3858e9 22%, transparent);
	color: #a9bcff;
}

.th-plat--shopify {
	background: color-mix(in srgb, #5a8f3d 26%, transparent);
	color: #b7e39a;
}

/* On a theme page the badge sits beside the category, not under it. */
.th-hero-copy .th-plat {
	margin-top: 0;
	margin-left: 8px;
}

.th-filters--platform {
	margin-bottom: 12px;
}

.th-filters--platform .tab {
	font-size: 0.84rem;
}
