/*
Theme Name: KitchenScaleCo
Theme URI: http://localhost/kitchenscale
Description: Custom theme for KitchenScaleCo. Main styles live in assets/css/main.css; this file holds the theme header and styling for editor-written (dynamic) content.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: kitchenscale
*/

/* Uploaded logo: keep the image's own proportions inside the template's logo box */
img.client-brand-uploaded {
	aspect-ratio: auto;
	width: auto;
	height: auto;
	max-width: 180px;
	max-height: 72px;
	object-fit: contain;
}
.client-footer img.client-brand-uploaded {
	max-width: 240px;
	max-height: 96px;
}
@media (max-width: 640px) {
	.client-header img.client-brand-uploaded {
		max-width: 130px;
		max-height: 56px;
	}
}

/* WooCommerce's own stylesheet sets "height: auto" on every image of its pages, which leaves a gap
   under photos that must fill their frame. Put the full-height rule back for the theme's photo frames. */
body .product-card-image img,
body [data-ksc-zoom] img,
body .client-product-photo img {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

/* Shop: loading state, empty state, no-JS button */
.shop-page [data-ksc-shop-results] {
	transition: opacity 0.15s;
}
.shop-page [data-ksc-shop-results].ksc-loading {
	opacity: 0.45;
	pointer-events: none;
}
.ksc-shop-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 4rem 1.5rem;
	text-align: center;
}
.ksc-empty-link {
	margin-top: 1.5rem;
	font-weight: 600;
	color: var(--color-primary);
	text-decoration: underline;
	text-underline-offset: 4px;
}
.ksc-apply {
	padding: 0.6rem 1.2rem;
	border-radius: 999px;
	background: var(--color-primary);
	color: #fff;
	font-weight: 600;
}
.shop-page .ksc-pagination {
	justify-content: center;
	margin-top: 2.5rem;
}

/* Add-to-cart toast */
.ksc-toast {
	pointer-events: auto;
	display: flex;
	align-items: center;
	gap: 0.85rem;
	max-width: min(92vw, 420px);
	padding: 0.75rem 1rem;
	background: var(--color-ink);
	color: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
	font-size: 0.9rem;
	line-height: 1.4;
	animation: ksc-toast-in 0.25s ease-out;
}
.ksc-toast a {
	flex-shrink: 0;
	color: var(--color-secondary);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.ksc-toast-error {
	background: #a02828;
}
@keyframes ksc-toast-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

/* Account pages: WooCommerce notices inside the card */
.ksc-account-notices {
	margin-top: 1.25rem;
}
.ksc-account-notices:empty {
	display: none;
}
.ksc-account-notices .woocommerce-error,
.ksc-account-notices .woocommerce-message,
.ksc-account-notices .woocommerce-info {
	margin: 0 0 1rem;
	padding: 0.8rem 1rem;
	list-style: none;
	border: 1px solid;
	border-radius: 12px;
	font-size: 0.9rem;
	line-height: 1.5;
}
.ksc-account-notices .woocommerce-error::before,
.ksc-account-notices .woocommerce-message::before,
.ksc-account-notices .woocommerce-info::before {
	display: none;
}
.ksc-account-notices .woocommerce-error {
	background: #fbeaea;
	color: #a02828;
	border-color: #f0c4c4;
}
.ksc-account-notices .woocommerce-message,
.ksc-account-notices .woocommerce-info {
	background: #fff4ea;
	color: var(--color-primary);
	border-color: var(--color-secondary);
}
.ksc-account-notices .woocommerce-error li,
.ksc-account-notices .woocommerce-message li {
	margin: 0;
}

/* Reviews section form */
.ksc-testimonial-wrap {
	margin-top: 1rem;
	text-align: center;
}
.ksc-testimonial-form {
	max-width: 560px;
	margin: 1.25rem auto 0;
	padding: 1.5rem;
	text-align: left;
	background: var(--color-surface);
	border: 1px solid var(--color-line);
	border-radius: 16px;
}
.ksc-testimonial-row {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin-bottom: 1rem;
}
.ksc-testimonial-row label {
	font-size: 0.85rem;
	font-weight: 600;
}
.ksc-testimonial-row input,
.ksc-testimonial-row select,
.ksc-testimonial-row textarea {
	padding: 0.65rem 0.85rem;
	border: 1px solid var(--color-line);
	border-radius: 10px;
	background: #fff;
	font: inherit;
}
.ksc-testimonial-row textarea {
	resize: vertical;
}
.ksc-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.ksc-testimonial-notice {
	max-width: 560px;
	margin: 1rem auto 0;
	padding: 0.7rem 1rem;
	border-radius: 10px;
	font-size: 0.9rem;
}
.ksc-testimonial-notice-ok {
	background: #e8f4ec;
	color: #1d6b3b;
}
.ksc-testimonial-notice-error {
	background: #fbeaea;
	color: #a02828;
}

/* Featured product block */
.client-product-gallery.ksc-single-image {
	grid-template-columns: 1fr;
}
.client-product-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
[data-ksc-swatch] svg {
	display: none;
}
[data-ksc-option][aria-pressed="true"] [data-ksc-swatch] svg {
	display: block;
}
.ksc-lightbox {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	background: rgba(25, 23, 20, 0.88);
	cursor: zoom-out;
}
.ksc-lightbox img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 12px;
}
.ksc-lightbox-close {
	position: absolute;
	top: 1rem;
	right: 1.25rem;
	font-size: 2.5rem;
	line-height: 1;
	color: #fff;
	cursor: pointer;
}

/* Category cards (homepage "One Scale" section + Categories page) */
.client-use-cards article > a {
	display: block;
}
.client-use-cards h3 a:hover {
	color: var(--color-primary);
}
.ksc-category-grid {
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	margin-top: 1.5rem;
}
@media (max-width: 640px) {
	.ksc-category-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.ksc-category-grid article:last-child {
		grid-column: auto;
		display: block;
	}
}

/* Dynamic content (pages, posts, archives, search, 404) */
.ksc-content {
	padding-block: 3rem 4rem;
	max-width: 860px;
}
.ksc-content.ksc-wide {
	max-width: 1320px;
}
.ksc-content h1.ksc-title {
	font-size: clamp(2rem, 4vw, 3rem);
	line-height: 1.15;
	font-weight: 700;
	margin-bottom: 1rem;
}
.ksc-content .ksc-meta {
	color: var(--color-muted);
	font-size: 0.9rem;
	margin-bottom: 1.5rem;
}
.ksc-content .entry-content > * + * {
	margin-top: 1.1rem;
}
.ksc-content .entry-content h2 {
	font-size: 1.75rem;
	line-height: 1.25;
	font-weight: 700;
	margin-top: 2rem;
}
.ksc-content .entry-content h3 {
	font-size: 1.35rem;
	line-height: 1.3;
	font-weight: 600;
	margin-top: 1.5rem;
}
.ksc-content .entry-content p,
.ksc-content .entry-content li {
	line-height: 1.7;
}
.ksc-content .entry-content ul {
	list-style: disc;
	padding-left: 1.5rem;
}
.ksc-content .entry-content ol {
	list-style: decimal;
	padding-left: 1.5rem;
}
.ksc-content .entry-content a {
	color: var(--color-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}
.ksc-content .entry-content img {
	border-radius: var(--radius-xl);
}
.ksc-content .entry-content blockquote {
	border-left: 3px solid var(--color-primary);
	padding-left: 1rem;
	color: var(--color-muted);
}
.ksc-post-card {
	padding-block: 1.5rem;
	border-bottom: 1px solid var(--color-line);
}
.ksc-post-card h2 {
	font-size: 1.5rem;
	font-weight: 700;
}
.ksc-post-card h2 a:hover {
	color: var(--color-primary);
}
.ksc-post-card p {
	margin-top: 0.5rem;
	line-height: 1.7;
}
.ksc-pagination {
	display: flex;
	gap: 0.5rem;
	margin-top: 2rem;
}
.ksc-pagination .page-numbers {
	padding: 0.4rem 0.9rem;
	border: 1px solid var(--color-line);
	border-radius: 999px;
}
.ksc-pagination .page-numbers.current {
	background: var(--color-primary);
	border-color: var(--color-primary);
	color: #fff;
}
.ksc-content .search-form {
	display: flex;
	gap: 0.5rem;
	margin-top: 1rem;
}
.ksc-content .search-form input[type="search"] {
	flex: 1;
	height: 3rem;
	padding-inline: 1rem;
	border: 1px solid var(--color-line);
	border-radius: 999px;
	background: var(--color-surface);
}
.ksc-content .search-form input[type="submit"] {
	height: 3rem;
	padding-inline: 1.5rem;
	border-radius: 999px;
	background: var(--color-primary);
	color: #fff;
}

/* WooCommerce focuses its notice after a form is sent; don't draw the browser's heavy black outline around it */
.woocommerce-error:focus,
.woocommerce-message:focus,
.woocommerce-info:focus,
.woocommerce-notices-wrapper [role="alert"]:focus {
	outline: none;
}

/* Header: logged-in user name and dropdown */
.ksc-user { position: relative; display: flex; align-items: center; }
.ksc-user-link { display: inline-flex; align-items: center; gap: 0.45rem; }
.ksc-user-name { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; font-weight: 500; }
.ksc-user-menu { position: absolute; right: 0; top: 100%; z-index: 60; min-width: 12rem; padding: 0.5rem; background: #fff; border: 1px solid #e8ded4; border-radius: 14px; box-shadow: 0 12px 30px rgba(52, 32, 22, 0.12); opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity 0.15s, transform 0.15s, visibility 0.15s; }
.ksc-user:hover .ksc-user-menu, .ksc-user:focus-within .ksc-user-menu { opacity: 1; visibility: visible; transform: none; }
.ksc-user-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.ksc-user-menu a { display: block; width: auto !important; height: auto !important; padding: 0.55rem 0.75rem; border-radius: 8px; font-size: 0.9rem; color: #191714; }
.ksc-user-menu a:hover { background: #f5eddc; color: #94671f; }
.ksc-user-who { display: block; padding: 0.4rem 0.75rem 0.5rem; margin-bottom: 0.25rem; border-bottom: 1px solid #e8ded4; font-size: 0.78rem; color: #756a62; overflow-wrap: anywhere; }
@media (max-width: 767px) { .ksc-user-name { display: none; } .ksc-user-menu { right: -3.5rem; } }
