/* ==========================================================================
   Category preset layer (loaded only on a themed destination).
   Values come from inc/presets.php as --jc-p-* custom properties.
   Header, wordmark, cards, prices, stock and purchase controls stay shared.

   Derived tokens (a preset may override them in jc_preset_css later):
   --jc-p-control  borders of controls on the backdrop (select, chips, ghost
                   buttons); fg at 60% clears 3:1 non-text contrast on both
                   the dark and the light backdrop.
   --jc-p-focus    focus ring on the backdrop; cards and header keep the
                   shared Focus Blue because the accent can vanish on white.
   --jc-p-art-max  widest the banner art is drawn (its authored width), so
                   ultra-wide screens never upscale and crop it.
   ========================================================================== */

body.jc-preset {
	--jc-p-control: color-mix(in srgb, var(--jc-p-fg) 60%, transparent);
	--jc-p-focus: var(--jc-p-accent);
	--jc-p-art-max: 1920px;
}

/* Backdrop: banner → breadcrumbs → grid → pagination, edge to edge.
   The margin texture is masked by a band of backdrop colour over the content
   column, so it stays in the gutters and fades out before the controls. */
body.jc-preset .site-content {
	background-color: var(--jc-p-bg);
	background-image:
		linear-gradient(90deg,
			transparent calc(50% - 700px),
			var(--jc-p-bg) calc(50% - 600px),
			var(--jc-p-bg) calc(50% + 600px),
			transparent calc(50% + 700px)),
		var(--jc-p-texture);
	background-repeat: no-repeat, repeat-y;
	background-position: center top;
	background-size: 100% 100%, 100% auto;
	color: var(--jc-p-fg);
}
body.jc-preset .site-main { margin-bottom: 0; padding-bottom: 56px; }
.jc-preset .site-content ::selection { background: var(--jc-p-accent); color: var(--jc-p-on-accent); }

/* Banner with art */
.jc-preset .jc-banner--art {
	background: var(--jc-p-bg);
	border-bottom: 0;
	min-height: clamp(180px, 18vw, 320px);
	display: flex;
	align-items: stretch;
}
.jc-preset .jc-banner--art::before {               /* accent bar on the leading edge */
	content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
	background: var(--jc-p-accent); z-index: 2;
}
/* Art box hugs the trailing edge and never grows past the art's own width:
   on 2560px screens the drawing stays at 1:1 instead of being scaled up and
   cropped top and bottom; the scrim below hides the box's leading edge. */
.jc-banner__art { position: absolute; top: 0; bottom: 0; right: 0; width: min(100%, var(--jc-p-art-max, 1920px)); }
/* Wider than the art: centre it like the content column, so the showcase stands on the same
   part of the drawing as at 1440–1920 (art x ≈ 1300–1700), and fade its right edge into the backdrop. */
@media (min-width: 1921px) {
	.jc-banner__art {
		right: calc((100% - var(--jc-p-art-max, 1920px)) / 2);
		-webkit-mask-image: linear-gradient(90deg, #000 90%, transparent);
		mask-image: linear-gradient(90deg, #000 90%, transparent);
	}
}
.jc-banner__art img {
	width: 100%; height: 100%;
	object-fit: cover;
	object-position: var(--jc-p-focal, 70% 50%);
	display: block;
}
.jc-preset .jc-banner--art .jc-banner__art::after {   /* keeps the title legible over any crop */
	content: ""; position: absolute; inset: 0;
	background: linear-gradient(90deg, var(--jc-p-bg) 0%, color-mix(in srgb, var(--jc-p-bg) 85%, transparent) 30%, transparent 62%);
}
.jc-preset .jc-banner__inner { width: 100%; min-height: inherit; }
.jc-preset .jc-banner__title {
	font-family: var(--jc-p-font);
	color: var(--jc-p-fg);
	font-size: clamp(2.2rem, 1.4rem + 3.2vw, 4.4rem);   /* DESIGN.md display step */
	max-width: 12ch;
	text-wrap: balance;
}
.jc-preset .jc-banner__meta { color: var(--jc-p-muted); }
.jc-preset .jc-banner__lead { color: var(--jc-p-fg); max-width: 34em; }   /* Karte (TCG) hub */

/* Scene banner (0.7, inc/scene.php + views/scene.css): the art is drawn whole in a box with its
   own aspect ratio, as tall as the banner and anchored to the trailing edge, and the products
   stand in it on the places drawn for them. Narrower screens lose the art's leading edge (the
   title zone) under the scrim; wider than the art, it is centred like the content column. */
.jc-preset .jc-banner--scene { min-height: clamp(300px, 26vw, 420px); }
/* The hub's sign is shorter: its job is the game list and the products under it (0.7.2). */
.jc-preset--tcg.term-karte-tcg .jc-banner--scene { min-height: clamp(260px, 20vw, 320px); }
.jc-banner--scene .jc-banner__art { left: 0; right: 0; width: auto; -webkit-mask-image: none; mask-image: none; }
.jc-banner--scene .jc-banner__art::after { z-index: 1; }
@media (min-width: 1921px) {
	.jc-banner--scene .jc-scene { right: calc((100% - var(--jc-sw) * 1px) / 2); }
	.jc-banner--scene .jc-scene > picture {
		-webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
		mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
	}
}
/* The text column sits over the scene; clicks fall through it to the products. */
.jc-banner--scene .jc-banner__inner { z-index: 3; pointer-events: none; }
.jc-banner--scene .jc-banner__text { pointer-events: auto; max-width: min(48%, 620px); }
/* Tablets: the scene's leftmost place would meet the title */
@media (max-width: 1099px) {
	.jc-banner--scene .jc-piece--wide { display: none; }
	.jc-banner--scene .jc-banner__text { max-width: 44%; }
}

/* Breadcrumbs, headings and counts on the backdrop */
body.jc-preset .storefront-breadcrumb { background-color: var(--jc-p-bg); }
.jc-preset .woocommerce-breadcrumb { color: var(--jc-p-fg); }
.jc-preset .woocommerce-breadcrumb a,
.jc-preset .woocommerce-breadcrumb .breadcrumb-separator { color: var(--jc-p-muted); }
.jc-preset .woocommerce-breadcrumb a:hover { color: var(--jc-p-fg); }
.jc-preset .storefront-sorting .woocommerce-result-count { color: var(--jc-p-muted); }
.jc-preset .jc-hub__heading { color: var(--jc-p-fg); }

/* Accent: selected chip, divider under the controls, current page */
.jc-preset .jc-chips a { background: transparent; color: var(--jc-p-fg); border-color: var(--jc-p-control); }
.jc-preset .jc-chips a:hover { border-color: var(--jc-p-fg); }
.jc-preset .jc-chips a[aria-current="page"] { background: var(--jc-p-accent); border-color: var(--jc-p-accent); color: var(--jc-p-on-accent); }
.jc-preset .storefront-sorting { border-bottom-color: var(--jc-p-accent); }
.jc-preset .woocommerce-ordering select { background-color: var(--jc-p-surface); color: var(--jc-p-fg); border-color: var(--jc-p-control); }
.jc-preset .woocommerce-ordering select:hover { border-color: var(--jc-p-fg); }
.jc-scheme--dark .woocommerce-ordering select { color-scheme: dark; }   /* native arrow + option list match the backdrop */
.jc-preset .woocommerce-pagination .page-numbers li .page-numbers { color: var(--jc-p-fg); }
.jc-preset .woocommerce-pagination .page-numbers li a.page-numbers:hover { background: color-mix(in srgb, var(--jc-p-fg) 12%, transparent); }
.jc-preset .woocommerce-pagination .page-numbers li .page-numbers.current { background: var(--jc-p-accent); color: var(--jc-p-on-accent); }

/* Focus ring in the preset colour only where the backdrop is behind it */
.jc-preset :is(.jc-banner, .storefront-breadcrumb, .storefront-sorting, .jc-chips, .woocommerce-pagination, .jc-empty, .jc-hub) :is(a, button, select):focus-visible {
	outline-color: var(--jc-p-focus);
}

/* Cards stay neutral (shared design) – just a crisper edge on dark */
.jc-scheme--dark ul.products li.product { border-color: transparent; }

/* Empty listing on the backdrop */
.jc-preset .jc-empty { background: var(--jc-p-surface); border-color: color-mix(in srgb, var(--jc-p-fg) 30%, transparent); color: var(--jc-p-fg); }
.jc-preset .jc-empty__title { color: var(--jc-p-fg); }
.jc-preset .jc-empty__text { color: var(--jc-p-muted); }
/* empty-state actions in the aisle's colours (0.7.2 polish: an ink button on a dark aisle had no visible edge) */
.jc-preset .jc-empty__actions .button { background: var(--jc-p-accent); border-color: var(--jc-p-accent); color: var(--jc-p-on-accent); }
.jc-preset .jc-empty__actions .button:hover { background: var(--jc-p-accent); color: var(--jc-p-on-accent); filter: brightness(1.08); }
.jc-preset .jc-empty__actions .jc-button-ghost { background: transparent !important; border-color: var(--jc-p-fg) !important; color: var(--jc-p-fg) !important; }
/* catalog.css sets the ghost button with !important, so the preset must too */
.jc-preset .jc-button-ghost { color: var(--jc-p-fg) !important; border-color: var(--jc-p-control) !important; background: transparent !important; }
.jc-preset .jc-button-ghost:hover { border-color: var(--jc-p-fg) !important; background: color-mix(in srgb, var(--jc-p-fg) 10%, transparent) !important; }

/* Pilot presets: only the banner title differs; everything else comes from the variables.
   Yu-Gi-Oh!: engraved capitals in the art's warm gold (13:1 on the backdrop).
   Pokémon: Fredoka's rounded 700 needs no tightening; keep it a touch smaller so
   "Pokémon TCG" stays on one line from 768px up. */
.jc-preset--yugioh .jc-banner__title { color: #f3d98e; letter-spacing: .01em; font-weight: 700; max-width: 16ch; }
.jc-preset--pokemon .jc-banner__title { font-weight: 700; font-size: clamp(2.2rem, 1.3rem + 3vw, 4.2rem); }
/* Manga "Rail Diagram": Overpass 800, the transit-sign voice of the line badges and stops. */
.jc-preset--manga .jc-banner__title { font-weight: 800; letter-spacing: -.02em; max-width: min(14ch, 40vw); }
.jc-preset--manga .jc-banner--art::before { display: none; }   /* no side bar: the lines are the accent */
@media (min-width: 768px) and (max-width: 1199px) {
	/* Tablets: tall banners scale the art up, so clear the title column with a solid scrim. */
	.jc-preset--manga .jc-banner--art .jc-banner__art::after {
		background: linear-gradient(90deg, var(--jc-p-bg) 0%, var(--jc-p-bg) 46%, transparent 64%);
	}
}
@media (max-width: 767px) {
	/* The phone title runs the full width; keep the network to the trailing edge behind a solid scrim. */
	.jc-preset--manga .jc-banner__title { max-width: none; }
	.jc-preset--manga .jc-banner--art .jc-banner__art::after {
		background: linear-gradient(90deg, var(--jc-p-bg) 0%, var(--jc-p-bg) 72%, color-mix(in srgb, var(--jc-p-bg) 70%, transparent) 86%, transparent 100%);
	}
	/* 0.7.1: the network stays in the trailing third, clear of the title (critique: lines touched "Ž") */
	.jc-preset--manga .jc-banner__art { left: auto; width: 46%; }
	.jc-preset--manga .jc-banner__title { max-width: 62%; }
}
/* Naruto: Kaushan Script has one weight (400; 800 would be faked); room for the descenders. */
/* Magic: engraved small caps in the art's pale copper (11.9:1); 16ch keeps the menu page's
   "Magic The Gathering TCG" to two lines at 1440. Palworld: Outfit 800, slightly tightened. */
.jc-preset--magic .jc-banner__title { color: #f2c49b; font-weight: 700; letter-spacing: .01em; max-width: 16ch; }
.jc-preset--palworld .jc-banner__title { font-weight: 800; letter-spacing: -.01em; }
/* Gaming: Russo One has one weight (400); the archive title "Konzole (PS5, Nintendo, Xbox…)" fits two lines at 1440. */
.jc-preset--gaming .jc-banner__title { font-weight: 400; letter-spacing: .005em; max-width: 17ch; font-size: clamp(2rem, 1.2rem + 2.6vw, 3.8rem); line-height: 1.08; }
.jc-preset--naruto .jc-banner__title { font-weight: 400; line-height: 1.12; padding-bottom: .06em; }

/* Phones: shorter banner, mostly solid backdrop */
@media (max-width: 767px) {
	.jc-preset .jc-banner--art { min-height: 168px; }
	.jc-preset .jc-banner--art .jc-banner__art::after {
		background: linear-gradient(90deg, var(--jc-p-bg) 0%, color-mix(in srgb, var(--jc-p-bg) 70%, transparent) 45%, transparent 80%);
	}
	body.jc-preset .site-content { background-image: none; }
	/* Scene: the phone art and its one place, beside the title */
	.jc-preset .jc-banner--scene { min-height: max(184px, 46vw); }
	/* The hub's desktop rule above is more specific; on phones it kept 260px and pushed the first products
	   under the bottom bar (loop pass 1: first card at y=732 of 844). Same phone height as every game. */
	.jc-preset--tcg.term-karte-tcg .jc-banner--scene { min-height: max(184px, 46vw); }
	.jc-banner--scene .jc-scene { aspect-ratio: var(--jc-msw) / var(--jc-msh); }
	.jc-banner--scene .jc-piece { left: var(--mx); bottom: var(--my); width: var(--mw); height: var(--mh); --_po: var(--mpo); --_pf: var(--mpf); --_tilt: var(--mtilt); --_dh: var(--mdh); }
	.jc-banner--scene .jc-piece--desktop { display: none; }
	.jc-banner--scene .jc-banner__text { max-width: 60%; }
	.jc-banner--scene .jc-banner__title { font-size: clamp(1.7rem, 1.1rem + 3vw, 2.4rem); }
}

/* Product page in a themed aisle (0.7.23, owner: the jump from the aisle to an all-white product page
   was rough on the eyes). 0.7.30, owner's second look ("napise na desni tudi v okvir … temnejse odzadje do
   roba okvirjev", frame in yellow): no white sheet any more. The aisle's backdrop runs up to two frames,
   the photo and the buying column, each a white panel edged in the aisle's accent; the description is a
   plain white panel; related products stand on the backdrop like cards on the listing. Inside the panels
   the shared design rules (ink text, ink buttons). No art band: a cropped slice of the scene was what the
   owner disliked on the compact banners. */
.jc-product-aisle .site-main { padding-top: 4px; }
.jc-product-aisle.single-product div.product { margin-top: 8px; }
.jc-product-aisle div.product > .summary,
.jc-product-aisle div.product .woocommerce-tabs,
.jc-product-aisle div.product ::selection { color: var(--jc-ink); }
.jc-product-aisle div.product ::selection { background: var(--jc-ink); color: var(--jc-paper); }

/* The two frames: accent edge, white inside */
.jc-product-aisle div.product .woocommerce-product-gallery__image {
	background: #fafafa;
	box-shadow: inset 0 0 0 2px var(--jc-p-accent);
	border-radius: 12px;
}
.jc-product-aisle div.product > .summary {
	background: var(--jc-paper);
	border: 2px solid var(--jc-p-accent);
	border-radius: 12px;
	padding: clamp(20px, 2.6vw, 40px);
	box-sizing: border-box;
	align-self: stretch;
}
.jc-product-aisle div.product .flex-control-thumbs li img { background: var(--jc-paper); }

/* Description: a plain white panel on the backdrop */
.jc-product-aisle div.product .woocommerce-tabs {
	background: var(--jc-paper);
	border: 0;
	border-radius: 12px;
	padding: clamp(20px, 3vw, 44px);
	margin-top: clamp(20px, 3vw, 32px);
}
/* Related products: on the backdrop, heading in the aisle's colours, cards as on the listing */
.jc-product-aisle div.product .related,
.jc-product-aisle div.product .up-sells { border-top: 0; padding-top: 0; margin-top: clamp(32px, 4.5vw, 56px); }
body.jc-product-aisle div.product section.related.products > h2,
body.jc-product-aisle div.product section.up-sells.products > h2 { color: var(--jc-p-fg); }
.jc-product-aisle .storefront-breadcrumb :is(a):focus-visible,
.jc-product-aisle div.product .related :is(a, button):focus-visible { outline-color: var(--jc-p-focus); }

/* Basket and checkout in the aisle the shopper came from (0.7.31, user: the product page's principles
   "all the way till paying"): the aisle's backdrop up to the order's frames, each white with the accent
   edge, ink inside. Presentation only; fields, payment methods and totals untouched (cart.css has the
   quiet base these build on). */
.jc-checkout-aisle .hentry .entry-title { color: var(--jc-p-fg); }
body.jc-checkout-aisle :is(.wc-block-cart__main, .wc-block-cart__sidebar, .wc-block-checkout__main, .wc-block-checkout__sidebar),
body.jc-checkout-aisle .wp-block-woocommerce-empty-cart-block {
	background: var(--jc-paper);
	color: var(--jc-ink);
	border: 2px solid var(--jc-p-accent);
	border-radius: 12px;
}
body.jc-checkout-aisle .wp-block-woocommerce-empty-cart-block { padding: clamp(20px, 3vw, 40px); }
body.jc-checkout-aisle .wc-block-components-sidebar-layout ::selection { background: var(--jc-ink); color: var(--jc-paper); }
body.jc-checkout-aisle .hentry .entry-content > :not(.wp-block-woocommerce-cart):not(.wp-block-woocommerce-checkout) { color: var(--jc-p-fg); }
body.jc-checkout-aisle .post-edit-link { color: var(--jc-p-muted); }
@media (max-width: 699px) {
	/* phones: the frames run edge to edge, so only their top and bottom edges show the accent */
	body.jc-checkout-aisle :is(.wc-block-cart__main, .wc-block-cart__sidebar, .wc-block-checkout__main, .wc-block-checkout__sidebar) {
		border-left: 0; border-right: 0; border-radius: 0;
	}
}
