/*
Theme Name: Product Catalog
Theme URI: https://example.com
Author: Your Studio
Description: A lightweight, mobile-first WordPress theme for showcasing a product catalog. Built as a digital catalog (no cart, no checkout) — customers browse, filter and contact the owner via Instagram/Facebook.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: pct
*/

/* =========================================================
   0. TOKENS
   ========================================================= */
:root {
	--color-bg:        #F8F4EC;
	--color-bg-alt:    #EFE8D9;
	--color-surface:   #FFFFFF;
	--color-ink:       #211E1A;
	--color-ink-soft:  #5B564C;
	--color-line:      #E1D8C4;
	--color-accent:    #9C6B3E;
	--color-accent-dk: #7C5530;
	--color-out:       #A6453B;
	--color-out-bg:    #F5E4E1;
	--color-ok:        #4C6B3F;

	--font-display: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif;
	--font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

	--radius-sm: 3px;
	--radius-md: 6px;
	--container: 1240px;
	--gap: 20px;
}

/* =========================================================
   1. RESET / BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
	margin: 0;
	background: var(--color-bg);
	color: var(--color-ink);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select, button { font-family: inherit; font-size: 16px; }

h1, h2, h3, h4 {
	font-family: var(--font-display);
	font-weight: 400;
	line-height: 1.15;
	margin: 0 0 .4em;
	letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }

:focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
}

.container {
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 20px;
}
.eyebrow {
	display: block;
	font-size: 11px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--color-accent-dk);
	font-weight: 600;
	margin-bottom: 10px;
}
.screen-reader-text {
	position: absolute; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px,1px,1px,1px); white-space: nowrap;
}
.skip-link {
	position: absolute; left: -999px; top: 0; background: var(--color-ink); color: #fff;
	padding: 10px 16px; z-index: 999;
}
.skip-link:focus { left: 10px; top: 10px; }

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 26px;
	border-radius: var(--radius-sm);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .02em;
	border: 1px solid transparent;
	min-height: 48px;
	transition: transform .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn--dark { background: var(--color-ink); color: #fff; }
.btn--dark:hover { background: #000; }
.btn--outline { background: transparent; border-color: var(--color-ink); color: var(--color-ink); }
.btn--outline:hover { background: var(--color-ink); color: #fff; }
.btn--instagram { background: #fff; border: 1px solid var(--color-line); color: var(--color-ink); flex: 1 1 auto; }
.btn--facebook { background: #fff; border: 1px solid var(--color-line); color: var(--color-ink); flex: 1 1 auto; }
.btn--instagram:hover, .btn--facebook:hover { border-color: var(--color-ink); }

/* Badges */
.badge {
	position: absolute;
	top: 10px; left: 10px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	padding: 5px 10px;
	border-radius: var(--radius-sm);
}
.badge--out { background: var(--color-out); color: #fff; }
.badge--featured { background: var(--color-ink); color: #fff; }

/* =========================================================
   1b. ANNOUNCEMENT BAR
   ========================================================= */
.announcement-bar {
	display: block;
	text-align: center;
	background: var(--color-ink);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .02em;
	padding: 10px 16px;
}
a.announcement-bar {
	cursor: pointer;
}
a.announcement-bar:hover {
	background: #000;
	text-decoration: underline;
}

/* =========================================================
   2. HEADER / NAV
   ========================================================= */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--color-bg);
	border-bottom: 1px solid var(--color-line);
}
.site-header__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 0;
}
.site-branding {
	font-family: var(--font-display);
	font-size: 1.4rem;
	letter-spacing: .04em;
}
.site-branding img { max-height: 44px; width: auto; }

.menu-toggle {
	background: none;
	border: none;
	padding: 8px;
	display: inline-flex;
	flex-direction: column;
	gap: 5px;
}
.menu-toggle span { width: 22px; height: 2px; background: var(--color-ink); display: block; }

.header-actions { display: flex; align-items: center; gap: 14px; }
.header-actions a.icon-link { padding: 6px; display: inline-flex; }

.primary-nav {
	position: fixed;
	inset: 0 0 0 auto;
	width: min(320px, 84vw);
	background: var(--color-surface);
	transform: translateX(100%);
	transition: transform .25s ease;
	z-index: 60;
	padding: 24px;
	overflow-y: auto;
	box-shadow: -8px 0 30px rgba(0,0,0,.15);
}
.primary-nav.is-open { transform: translateX(0); }
.primary-nav__close { background: none; border: none; font-size: 26px; line-height: 1; padding: 6px; margin-bottom: 10px; }
.primary-nav ul { display: flex; flex-direction: column; }
.primary-nav a { display: block; padding: 14px 4px; border-bottom: 1px solid var(--color-line); font-size: 1.05rem; }
.nav-overlay {
	position: fixed; inset: 0; background: rgba(0,0,0,.35);
	opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 55;
}
.nav-overlay.is-open { opacity: 1; pointer-events: auto; }

/* The filter panel lives inside .toolbar, which has z-index:40 and therefore its
   own stacking context — the panel's z-index can't escape it. The shared overlay
   z-index of 55 would sit above the whole toolbar and swallow every tap meant for
   the chips, so the filter overlay specifically sits below the toolbar instead. */
#pct-filter-overlay { z-index: 30; }

/* While the panel is open the toolbar must outrank the sticky site header
   (z-index 50), or the header covers the top of the panel. */
body.pct-filters-open .toolbar { z-index: 80; }

/* Sub-menus (Women > Tops, Men > Footwear, ...). On mobile they sit indented in
   the slide-in panel; on desktop they become hover/focus dropdowns. */
.primary-nav .sub-menu { padding-left: 14px; }
.primary-nav .sub-menu a { font-size: .95rem; color: var(--color-ink-soft); }

@media (min-width: 900px) {
	.menu-toggle { display: none; }
	.primary-nav {
		position: static; transform: none; width: auto; box-shadow: none; padding: 0; background: transparent;
		/* Must be reset: the mobile panel sets overflow-y:auto, which on desktop
		   clipped the absolutely-positioned dropdowns and added scrollbars. */
		overflow: visible;
	}
	.primary-nav ul { flex-direction: row; gap: 28px; flex-wrap: wrap; }
	.primary-nav a { border-bottom: none; padding: 6px 0; font-size: .95rem; font-family: var(--font-body); }
	.primary-nav__close { display: none; }
	.nav-overlay { display: none; }

	.primary-nav li { position: relative; }
	.primary-nav .sub-menu {
		position: absolute;
		top: 100%;
		left: 0;
		flex-direction: column;
		flex-wrap: nowrap;
		gap: 0;
		min-width: 190px;
		padding: 8px 0;
		background: var(--color-surface);
		border: 1px solid var(--color-line);
		border-radius: var(--radius-md);
		box-shadow: 0 10px 28px rgba(0,0,0,.09);
		opacity: 0;
		visibility: hidden;
		transform: translateY(4px);
		transition: opacity .15s ease, transform .15s ease, visibility .15s;
		z-index: 60;
	}
	.primary-nav li:hover > .sub-menu,
	.primary-nav li:focus-within > .sub-menu {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}
	.primary-nav .sub-menu a {
		display: block;
		padding: 8px 16px;
		white-space: nowrap;
		color: var(--color-ink);
	}
	.primary-nav .sub-menu a:hover { background: var(--color-bg); }
}

/* =========================================================
   3. HERO (front page)
   ========================================================= */
.hero {
	display: grid;
	gap: 0;
}
.hero__content {
	padding: 48px 20px 32px;
}
.hero__content p.sub { color: var(--color-ink-soft); max-width: 40ch; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.hero__media { aspect-ratio: 4/5; overflow: hidden; background: var(--color-bg-alt); }
.hero__media img { width: 100%; height: 100%; object-fit: cover; }

@media (min-width: 900px) {
	.hero { grid-template-columns: 1fr 1fr; align-items: center; }
	.hero__content { padding: 0 60px; }
	.hero__media { aspect-ratio: auto; height: 640px; }
}

/* =========================================================
   4. CATEGORY CHIPS (front page)
   ========================================================= */
.cat-scroller {
	display: flex;
	gap: 22px;
	overflow-x: auto;
	padding: 22px 20px;
	scrollbar-width: none;
}
.cat-scroller::-webkit-scrollbar { display: none; }
.cat-chip { flex: 0 0 auto; text-align: center; width: 84px; }
.cat-chip__img {
	width: 72px; height: 72px; border-radius: 50%; overflow: hidden;
	background: var(--color-bg-alt); margin: 0 auto 8px;
}
.cat-chip__img img { width: 100%; height: 100%; object-fit: cover; }
.cat-chip__label { font-size: 12px; font-weight: 600; }

.section-heading {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin: 8px 0 18px;
}
.section-heading a { font-size: 13px; font-weight: 600; border-bottom: 1px solid currentColor; white-space: nowrap; }

.tile-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}
.tile {
	position: relative;
	aspect-ratio: 3/4;
	overflow: hidden;
	border-radius: var(--radius-md);
	background: var(--color-bg-alt);
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.tile:hover img { transform: scale(1.04); }
.tile__label {
	position: absolute; left: 0; right: 0; bottom: 0;
	padding: 16px;
	background: linear-gradient(0deg, rgba(0,0,0,.55), transparent 70%);
	color: #fff;
}
.tile__label span { font-weight: 600; }

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

/* =========================================================
   5. PRODUCT GRID + CARD (catalog / archive / search)
   ========================================================= */
.catalog-header {
	padding: 28px 0 12px;
	border-bottom: 1px solid var(--color-line);
}
.catalog-header h1 { margin-bottom: 6px; }
.catalog-count { color: var(--color-ink-soft); font-size: 14px; }

.toolbar {
	position: sticky;
	top: 65px;
	z-index: 40;
	background: var(--color-bg);
	border-bottom: 1px solid var(--color-line);
	padding: 12px 0;
	margin-bottom: 20px;
}
/* Hide-on-scroll is desktop-only on purpose. Below 900px the filter sheet is a
   position:fixed bottom sheet nested inside .toolbar, and any transform here would
   make the toolbar its containing block, breaking the sheet's placement. */
@media (min-width: 900px) {
	.toolbar { transition: transform .28s ease; }
	.toolbar.is-hidden { transform: translateY(-100%); }
}
@media (prefers-reduced-motion: reduce) {
	.toolbar { transition: none; }
}
.toolbar__row { display: flex; align-items: center; gap: 10px; }
.search-field {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	background: var(--color-surface);
	border: 1px solid var(--color-line);
	border-radius: var(--radius-sm);
	padding: 0 12px;
	height: 46px;
}
.search-field input {
	border: 0; background: transparent; width: 100%; height: 100%; outline: none;
}
.toolbar__btn {
	height: 46px;
	padding: 0 16px;
	border: 1px solid var(--color-line);
	background: var(--color-surface);
	border-radius: var(--radius-sm);
	font-size: 13px;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}
.toolbar__btn.is-active { border-color: var(--color-ink); }

.filter-count {
	background: var(--color-ink); color: #fff; border-radius: 50%;
	width: 18px; height: 18px; font-size: 11px; display: inline-flex; align-items: center; justify-content: center;
}

/* Filter sheet: bottom sheet on mobile, inline panel on desktop */
.filter-sheet {
	position: fixed; inset: auto 0 0 0; z-index: 70;
	background: var(--color-surface);
	border-radius: 16px 16px 0 0;
	max-height: 82vh; overflow-y: auto;
	transform: translateY(100%);
	transition: transform .28s ease;
	padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
	box-shadow: 0 -8px 30px rgba(0,0,0,.18);
}
.filter-sheet.is-open { transform: translateY(0); }
.filter-sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.filter-sheet__head button { background: none; border: none; font-size: 22px; }
.filter-group { margin-bottom: 22px; }
.filter-group h4 { font-family: var(--font-body); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--color-ink-soft); margin-bottom: 10px; }
.chip-options { display: flex; flex-wrap: wrap; gap: 8px; }
/* Second tier: appears once a top-level category is chosen. */
.chip-options--sub {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px dashed var(--color-line);
}
.chip-option--sub { font-size: 12px; padding: 7px 14px; }
.chip-options--sub[hidden] { display: none; }
.chip-option {
	border: 1px solid var(--color-line);
	background: var(--color-surface);
	border-radius: 20px;
	padding: 9px 16px;
	font-size: 13px;
	min-height: 40px;
}
.chip-option.is-selected { background: var(--color-ink); color: #fff; border-color: var(--color-ink); }
.filter-sheet__footer { display: flex; gap: 10px; position: sticky; bottom: 0; background: var(--color-surface); padding-top: 10px; }
.filter-sheet__footer .btn { flex: 1; }

@media (min-width: 900px) {
	.toolbar { top: 73px; }
	/* Filters live behind the Filters button on desktop too, so the product grid
	   starts near the top of the screen instead of below a wall of chips. */
	.toolbar__row { position: relative; flex-wrap: nowrap; }
	.filter-sheet {
		position: absolute;
		top: calc(100% + 12px);
		left: 0;
		right: 0;
		bottom: auto;
		transform: none;
		display: none;
		max-height: none;
		padding: 22px 24px;
		background: var(--color-surface);
		border: 1px solid var(--color-line);
		border-radius: var(--radius-md);
		box-shadow: 0 14px 34px rgba(0,0,0,.10);
		z-index: 70;
	}
	.filter-sheet.is-open { display: block; }
	.filter-sheet__head { display: flex; }
	.filter-sheet__footer { display: flex; }
}

.product-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px 14px;
	padding-bottom: 40px;
}
@media (min-width: 600px) {
	.product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1000px) {
	.product-grid { grid-template-columns: repeat(4, 1fr); gap: 26px 22px; }
}

.product-card { display: block; }
.product-card__media {
	position: relative;
	display: block;
	aspect-ratio: 4/5;
	overflow: hidden;
	background: var(--color-bg-alt);
	border-radius: var(--radius-md);
	margin-bottom: 10px;
}
.product-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.product-card:hover .product-card__media img { transform: scale(1.045); }
.product-card__placeholder { width: 100%; height: 100%; }
.product-card.is-out-of-stock .product-card__media img { opacity: .55; }

.product-card__eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--color-ink-soft); margin: 0 0 3px; }
.product-card__title { font-size: .98rem; font-family: var(--font-body); font-weight: 600; margin: 0 0 4px; }
.product-card__title a:hover { text-decoration: underline; }
.product-card__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.product-card__price { font-weight: 700; }
.product-card__sizes { font-size: 12px; color: var(--color-ink-soft); }

.no-products { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--color-ink-soft); }

/* Infinite scroll: this container is now the load-more sentinel and status line
   (it used to hold numbered pagination buttons). Keep it tall enough to be a
   reliable IntersectionObserver target even when empty. */
.pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 60px;
	padding: 10px 0 50px;
}
.load-more {
	min-width: 220px;
}
.catalog-status {
	margin: 0;
	font-size: 13px;
	color: var(--color-ink-soft);
	letter-spacing: .02em;
}

/* =========================================================
   6. SINGLE PRODUCT
   ========================================================= */
.product-single {
	display: grid;
	gap: 28px;
	padding: 24px 0 60px;
}
@media (min-width: 900px) {
	.product-single { grid-template-columns: 1.1fr 1fr; gap: 60px; align-items: start; }
}

.gallery__main {
	position: relative;
	aspect-ratio: 4/5;
	border-radius: var(--radius-md);
	overflow: hidden;
	background: var(--color-bg-alt);
	scroll-snap-type: x mandatory;
	display: flex;
	overflow-x: auto;
	scrollbar-width: none;
}
.gallery__main::-webkit-scrollbar { display: none; }
.gallery__slide { flex: 0 0 100%; scroll-snap-align: start; }
.gallery__slide img { width: 100%; height: 100%; object-fit: cover; }

.gallery__dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.gallery__dots button { width: 7px; height: 7px; border-radius: 50%; border: none; background: var(--color-line); padding: 0; }
.gallery__dots button.is-active { background: var(--color-ink); width: 18px; border-radius: 4px; }

.gallery__thumbs { display: none; gap: 10px; margin-top: 14px; }
.gallery__thumbs button { width: 74px; height: 92px; border-radius: var(--radius-sm); overflow: hidden; border: 2px solid transparent; padding: 0; background: var(--color-bg-alt); }
.gallery__thumbs button.is-active { border-color: var(--color-ink); }
.gallery__thumbs img { width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 900px) {
	.gallery__thumbs { display: flex; flex-wrap: wrap; }
	.gallery__dots { display: none; }
}

.product-info__eyebrow { color: var(--color-ink-soft); font-size: 13px; margin-bottom: 6px; }
.product-info h1 { margin-bottom: 8px; }
.product-info__price { font-size: 1.4rem; font-weight: 700; margin-bottom: 14px; }
.status-pill {
	display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
	text-transform: uppercase; letter-spacing: .04em; padding: 6px 12px; border-radius: 20px; margin-bottom: 18px;
}
.status-pill.available { background: #E9F0E4; color: var(--color-ok); }
.status-pill.out { background: var(--color-out-bg); color: var(--color-out); }

.size-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 24px; }
.size-list span {
	border: 1px solid var(--color-line);
	background: var(--color-surface);
	border-radius: 10px;
	padding: 10px 16px;
	min-width: 72px;
	box-shadow: 0 1px 2px rgba(0,0,0,.04);
	display: inline-flex; flex-direction: row; align-items: baseline; justify-content: center; gap: 6px;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.size-list span:not(.is-out):hover {
	border-color: var(--color-ink);
	box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.size-list__label { font-size: 14px; font-weight: 700; letter-spacing: .01em; }
.size-list__stock { font-size: 12px; font-weight: 600; color: var(--color-ok); }
.size-list span.is-low .size-list__stock { color: var(--color-accent-dk); }
.size-list span.is-out {
	background: var(--color-bg-alt);
	border-color: var(--color-bg-alt);
	box-shadow: none;
	opacity: .65;
}
.size-list span.is-out .size-list__label { text-decoration: line-through; }
.size-list span.is-out .size-list__stock { color: var(--color-out); }

.product-description { border-top: 1px solid var(--color-line); padding-top: 18px; margin-top: 6px; color: var(--color-ink-soft); }

.contact-buttons { display: flex; flex-direction: column; gap: 10px; margin: 22px 0; }
@media (min-width: 480px) { .contact-buttons { flex-direction: row; } }

.related-heading { margin-top: 50px; }

/* =========================================================
   7. FOOTER
   ========================================================= */
.site-footer {
	background: var(--color-ink);
	color: #EDE7DA;
	margin-top: 60px;
	padding: 50px 0 24px;
}
.site-footer a:hover { text-decoration: underline; }
.footer-grid {
	display: grid;
	gap: 32px;
	grid-template-columns: 1fr;
}
@media (min-width: 700px) {
	.footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
}
.footer-brand { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 10px; }
.footer-tag { color: #B9B1A0; font-size: 14px; max-width: 32ch; }
.footer-widget-title, .footer-col h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: #B9B1A0; margin-bottom: 14px; }
.footer-col ul li { margin-bottom: 10px; font-size: 14px; }
.footer-social { display: flex; gap: 14px; margin-top: 16px; }
.footer-bottom {
	border-top: 1px solid rgba(255,255,255,.12);
	margin-top: 40px; padding-top: 20px;
	font-size: 12px; color: #8F887A;
	display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}

/* =========================================================
   8. MISC PAGES (search / 404)
   ========================================================= */
.page-hero { padding: 40px 0 20px; }
.not-found { padding: 80px 20px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
