/*
Theme Name: Anytore Mobile
Description: Mobile-first product catalog theme for anytore.com. No cart/checkout — customers browse here and buy through the linked marketplace/social channels.
Version: 1.2.0
Requires PHP: 7.4
Text Domain: anytore-mobile
*/

/* ---------- design tokens ---------- */

:root {
	--color-bg: #f1f2f4;
	--color-surface: #ffffff;
	--color-text: #1f2328;
	--color-text-muted: #6b7280;
	--color-primary: #4b5563;
	--color-primary-dark: #2f3640;
	--color-border: #dcdfe4;
	--radius-sm: 8px;
	--radius-md: 14px;
	--radius-lg: 22px;
	--shadow-sm: 0 1px 3px rgba(31, 35, 40, 0.07);
	--shadow-md: 0 8px 24px rgba(31, 35, 40, 0.12);
	--font-heading: "Prompt", -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
}

/* ---------- base (mobile) ---------- */

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: var(--font-heading);
	background: var(--color-bg);
	color: var(--color-text);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--color-primary);
	text-decoration: none;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

h1, h2, h3 {
	font-family: var(--font-heading);
	font-weight: 600;
	line-height: 1.3;
}

/* ---------- buttons ---------- */

.btn {
	display: inline-block;
	padding: 12px 26px;
	border-radius: 999px;
	font-weight: 600;
	font-size: 0.95rem;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn--primary {
	background: var(--color-primary);
	color: #fff;
	box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
	background: var(--color-primary-dark);
	transform: translateY(-1px);
	box-shadow: var(--shadow-md);
	color: #fff;
}

.btn--outline {
	background: transparent;
	color: var(--color-primary);
	border: 1.5px solid var(--color-primary);
}

.btn--outline:hover {
	background: var(--color-primary);
	color: #fff;
}

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

.site-header {
	background: rgba(241, 242, 244, 0.92);
	backdrop-filter: saturate(150%) blur(6px);
	border-bottom: 1px solid var(--color-border);
	padding: 14px 20px;
	position: sticky;
	top: 0;
	z-index: 10;
}

.site-title {
	margin: 0;
	font-size: 1.3rem;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.site-title a {
	color: var(--color-text);
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.site-logo {
	width: 64px;
	height: 64px;
	border-radius: 12px;
	object-fit: cover;
}

.channel-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 10px;
}

.channel-icon {
	--brand-color: #999;
	width: 52px;
	height: 52px;
	border-radius: 8px;
	background: var(--brand-color);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--shadow-sm);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.channel-icon:hover {
	transform: translateY(-2px) scale(1.06);
	box-shadow: var(--shadow-md);
}

.channel-icon svg {
	width: 26px;
	height: 26px;
	fill: #fff;
	display: block;
}

.channel-icon__monogram {
	color: #fff;
	font-weight: 700;
	font-size: 1.3rem;
	line-height: 1;
	font-family: var(--font-heading);
}

.channel-bar--large .channel-icon {
	width: 68px;
	height: 68px;
}

.channel-bar--large .channel-icon svg {
	width: 34px;
	height: 34px;
}

.channel-bar--large .channel-icon__monogram {
	font-size: 1.7rem;
}

.channel-bar--rect {
	gap: 12px;
}

.channel-bar--rect .channel-icon {
	width: auto;
	min-width: 150px;
	height: 64px;
	padding: 0 20px;
	gap: 10px;
	border-radius: 10px;
}

.channel-bar--rect .channel-icon svg {
	width: 30px;
	height: 30px;
}

.channel-bar--rect .channel-icon__monogram {
	display: none;
}

.channel-icon__label {
	color: #fff;
	font-weight: 700;
	font-size: 1.05rem;
	line-height: 1;
}

main {
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 16px 40px;
}

.page-heading {
	padding: 24px 0 4px;
}

.page-heading h1 {
	font-size: 1.4rem;
	margin: 0;
}

/* ---------- footer ---------- */

.site-footer {
	text-align: center;
	padding: 32px 16px;
	color: var(--color-text-muted);
	font-size: 0.85rem;
	border-top: 1px solid var(--color-border);
	margin-top: 24px;
}

/* ---------- hero ---------- */

.hero {
	margin: 0 -16px 8px;
	padding: 56px 24px;
	text-align: center;
	background: linear-gradient(160deg, #e3e5e9, #eef0f2);
	background-size: cover;
	background-position: center;
	border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.hero__overlay {
	max-width: 480px;
	margin: 0 auto;
}

.hero__title {
	font-size: 1.8rem;
	margin: 0 0 8px;
}

.hero__subtitle {
	color: var(--color-text-muted);
	margin: 0 0 22px;
}

/* ---------- section layout ---------- */

.section {
	padding: 36px 0 8px;
}

.section__title {
	font-size: 1.2rem;
	margin: 0 0 18px;
	position: relative;
	padding-left: 14px;
}

.section__title::before {
	content: "";
	position: absolute;
	left: 0;
	top: 4px;
	bottom: 4px;
	width: 4px;
	border-radius: 4px;
	background: var(--color-primary);
}

.section__cta {
	text-align: center;
	margin-top: 24px;
}

.cta-band {
	text-align: center;
	background: var(--color-surface);
	border-radius: var(--radius-lg);
	padding: 32px 20px;
}

.cta-band .section__title {
	padding-left: 0;
}

.cta-band .section__title::before {
	display: none;
}

.cta-band .channel-bar {
	justify-content: center;
}

/* ---------- category showcase ---------- */

.category-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}

.category-tile {
	position: relative;
	aspect-ratio: 4 / 3;
	border-radius: var(--radius-md);
	background-color: var(--color-border);
	background-size: cover;
	background-position: center;
	overflow: hidden;
	display: flex;
	align-items: flex-end;
	box-shadow: var(--shadow-sm);
	transition: transform 0.2s ease;
}

.category-tile:hover {
	transform: translateY(-2px);
}

.category-tile::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
}

.category-tile__label {
	position: relative;
	z-index: 1;
	color: #fff;
	font-weight: 600;
	padding: 12px;
	font-size: 0.9rem;
}

/* ---------- product grid (archive + homepage) ---------- */

.product-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 14px;
}

.product-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	overflow: hidden;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-md);
}

.product-card__image {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	background: var(--color-border);
	overflow: hidden;
}

.product-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

.product-card:hover .product-card__image img {
	transform: scale(1.06);
}

.product-card__body {
	padding: 12px 14px 16px;
}

.product-card__category {
	display: inline-block;
	font-size: 0.7rem;
	color: var(--color-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 4px;
}

.product-card__title {
	font-size: 0.98rem;
	font-weight: 600;
	margin: 0 0 6px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.product-card__title a {
	color: var(--color-text);
}

.product-card__price {
	font-weight: 700;
	color: var(--color-primary);
	margin: 0;
}

/* ---------- single product ---------- */

.product-gallery {
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
	margin-bottom: 20px;
}

.product-gallery img {
	border-radius: var(--radius-md);
}

.product-title {
	font-size: 1.4rem;
	margin: 0 0 6px;
}

.product-category {
	display: inline-block;
	font-size: 0.8rem;
	color: var(--color-text-muted);
	margin-bottom: 4px;
}

.product-price {
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--color-primary);
	margin: 4px 0 18px;
}

.order-panel {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: 16px;
	margin-bottom: 24px;
}

.order-panel__label {
	margin: 0 0 10px;
	font-weight: 600;
}

.product-description {
	white-space: pre-wrap;
	margin-bottom: 24px;
}

.variant-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
	background: var(--color-surface);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: var(--shadow-sm);
}

.variant-table th,
.variant-table td {
	text-align: left;
	padding: 10px 12px;
	border-bottom: 1px solid var(--color-border);
}

.variant-table th {
	color: var(--color-text-muted);
	font-weight: 600;
	background: var(--color-bg);
}

/* ---------- search ---------- */

.site-search {
	display: flex;
	gap: 8px;
	margin-top: 10px;
}

.site-search__input {
	flex: 1;
	min-width: 0;
	padding: 10px 14px;
	font: inherit;
	color: var(--color-text);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
}

.site-search__submit {
	padding: 10px 18px;
	font: inherit;
	font-weight: 600;
	color: #fff;
	background: linear-gradient(180deg, #4b5563 0%, #2f3640 100%);
	border: 1px solid #2f3640;
	border-radius: var(--radius-md);
	cursor: pointer;
}

.search-empty {
	padding: 24px 16px;
	text-align: center;
}

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

/* ---------- primary nav ----------
   Mobile (<600px): one "เมนู" toggle opens a dropdown panel (no sideways scroll).
   Tablet/desktop (>=600px): two always-visible rows of buttons. */

.nav-toggle {
	display: none;
	width: 100%;
	margin-top: 10px;
	padding: 10px 18px;
	align-items: center;
	justify-content: space-between;
	font: inherit;
	font-size: 1.15rem;
	font-weight: 600;
	color: #fff;
	background: linear-gradient(180deg, #4b5563 0%, #2f3640 100%);
	border: 1px solid #2f3640;
	border-bottom: 3px solid #14181d;
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-sm);
	cursor: pointer;
}

.nav-toggle__chevron {
	width: 10px;
	height: 10px;
	border-right: 3px solid currentColor;
	border-bottom: 3px solid currentColor;
	transform: rotate(45deg) translate(-2px, -2px);
	transition: transform 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__chevron {
	transform: rotate(-135deg) translate(-2px, -2px);
}

.primary-nav {
	margin-top: 10px;
}

.primary-nav__label {
	margin: 12px 2px 6px;
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--color-text-muted);
}

.primary-nav__label:first-child {
	margin-top: 0;
}

.primary-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.primary-menu a {
	display: block;
	padding: 10px 14px;
	font-size: 1.1rem;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	color: var(--color-primary-dark);
	background: linear-gradient(180deg, #ffffff 0%, #e9ebee 100%);
	border: 1px solid var(--color-border);
	border-bottom: 3px solid #c3c8cf;
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-sm);
	transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.primary-menu a:hover,
.primary-menu a:focus-visible {
	background: linear-gradient(180deg, #5b6573 0%, var(--color-primary) 100%);
	border-color: var(--color-primary-dark);
	border-bottom-color: var(--color-primary-dark);
	color: #fff;
	box-shadow: var(--shadow-md);
	transform: translateY(-1px);
}

.primary-menu a:active {
	transform: translateY(2px);
	border-bottom-width: 1px;
	margin-bottom: 2px;
	box-shadow: none;
}

/* Pages group: dark charcoal buttons, distinct from the light products group */
.primary-menu--pages a {
	color: #fff;
	background: linear-gradient(180deg, #4b5563 0%, #2f3640 100%);
	border-color: #2f3640;
	border-bottom-color: #14181d;
}

.primary-menu--pages a:hover,
.primary-menu--pages a:focus-visible {
	background: linear-gradient(180deg, #7b8594 0%, #5b6573 100%);
	border-color: #3d4651;
	border-bottom-color: #2f3640;
	color: #fff;
}

@media (max-width: 599px) {
	/* With JS: nav collapsed behind the toggle. Without JS: stays open. */
	.js .nav-toggle {
		display: flex;
	}

	.js .primary-nav {
		display: none;
		max-height: calc(100vh - 150px);
		overflow-y: auto;
		margin-top: 8px;
		padding: 12px;
		background: var(--color-surface);
		border: 1px solid var(--color-border);
		border-radius: var(--radius-md);
		box-shadow: var(--shadow-md);
	}

	.js .primary-nav.is-open {
		display: block;
	}

	.primary-menu {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 8px;
	}

	/* "สินค้าทั้งหมด" spans the full width */
	.primary-menu--products li:first-child {
		grid-column: 1 / -1;
	}
}

@media (min-width: 600px) {
	.primary-nav__label {
		display: none;
	}

	.primary-menu {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
	}

	.primary-menu + .primary-menu {
		margin-top: 8px;
	}

	.primary-menu a {
		padding: 10px 18px;
		font-size: 1.2rem;
		white-space: nowrap;
	}

	.primary-menu--pages li {
		flex: 1 0 auto;
	}

	/* Pages row sits beside the logo; everything else stacks below it. */
	.site-header {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr);
		column-gap: 28px;
		align-items: center;
	}

	.primary-nav {
		display: contents;
	}

	.site-title {
		grid-column: 1;
		grid-row: 1;
	}

	.primary-menu--pages {
		grid-column: 2;
		grid-row: 1;
	}

	.site-search,
	.primary-menu--products,
	.site-header > .channel-bar {
		grid-column: 1 / -1;
	}

	.primary-menu--products {
		margin-top: 10px;
	}
}

/* ---------- breadcrumbs ---------- */

.breadcrumbs {
	font-size: 0.8rem;
	color: var(--color-text-muted);
	margin: 16px 0 4px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

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

.breadcrumbs a:hover {
	color: var(--color-primary);
}

/* ---------- share row ---------- */

.share-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 20px;
}

.share-row__label {
	font-size: 0.85rem;
	color: var(--color-text-muted);
}

.channel-icon--sm {
	width: 40px;
	height: 40px;
}

.channel-icon--sm svg {
	width: 20px;
	height: 20px;
}

/* ---------- badges ---------- */

.product-card__image {
	position: relative;
}

.badge {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 1;
	font-size: 0.7rem;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 999px;
	color: #fff;
}

.badge--new {
	background: var(--color-primary);
}

.badge--out {
	background: #57534e;
}

/* ---------- static pages / blog ---------- */

.page-heading__description {
	color: var(--color-text-muted);
	margin: 4px 0 0;
}

.blog-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}

.blog-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	overflow: hidden;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-md);
}

.blog-card__image {
	aspect-ratio: 16 / 9;
	background: var(--color-border);
	display: block;
	overflow: hidden;
}

.blog-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.blog-card__body {
	padding: 14px 16px 18px;
}

.blog-card__title {
	font-size: 1rem;
	margin: 0 0 6px;
}

.blog-card__title a {
	color: var(--color-text);
}

.blog-card__excerpt {
	color: var(--color-text-muted);
	font-size: 0.9rem;
	margin: 0 0 8px;
}

.blog-card__date {
	font-size: 0.8rem;
	color: var(--color-text-muted);
	margin: 0;
}

.blog-post__image {
	margin-bottom: 20px;
}

.blog-post__image img {
	border-radius: var(--radius-md);
}

/* ---------- pagination ---------- */

.pagination,
.nav-links {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px;
	margin: 32px 0;
}

.nav-links .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	color: var(--color-text);
}

.nav-links .page-numbers.current {
	background: var(--color-primary);
	color: #fff;
	border-color: var(--color-primary);
}

.nav-links .page-numbers:hover {
	border-color: var(--color-primary);
	color: var(--color-primary);
}

.nav-links .page-numbers.current:hover {
	color: #fff;
}

/* ---------- lightbox ---------- */

.product-gallery img {
	cursor: zoom-in;
}

.lightbox-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.85);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
	z-index: 100;
	padding: 24px;
}

.lightbox-overlay.is-open {
	opacity: 1;
	pointer-events: auto;
}

.lightbox-image {
	max-width: 100%;
	max-height: 90vh;
	border-radius: var(--radius-md);
}

.lightbox-close {
	position: absolute;
	top: 20px;
	right: 20px;
	background: none;
	border: none;
	color: #fff;
	font-size: 2rem;
	line-height: 1;
	cursor: pointer;
}

/* ---------- tablet ---------- */

@media (min-width: 600px) {
	.product-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.category-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.product-gallery {
		grid-template-columns: repeat(2, 1fr);
	}

	.blog-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.hero {
		padding: 80px 24px;
	}

	.hero__title {
		font-size: 2.4rem;
	}
}

/* ---------- desktop ---------- */

@media (min-width: 1024px) {
	.product-grid {
		grid-template-columns: repeat(4, 1fr);
	}

	.category-grid {
		grid-template-columns: repeat(6, 1fr);
	}

	.product-gallery {
		grid-template-columns: repeat(3, 1fr);
	}

	.blog-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}
