/*
 * jj/coffee-showcase (#satis tiles + product detail). PORT of the
 * prototype's `.shop`/`.tiles`/`.tile`/`.detail`/`.attrs`/`.buy`/`.sheetx`/
 * `.backdrop` rules (assets-source/handoff/jj_handoff/src/template.html
 * lines 128-191, CLAUDE.md "PROTOTYPE v23 IS THE REFERENCE"). Values and
 * selectors are unchanged; the cart drawer rules (`.drawer`, `.dhead`,
 * `.citem`, `.dfoot`, `.cform`, `.pay`, `.done`) are NOT ported: LAUNCH PLAN
 * stage 1 has no cart, and stage 2 deliberately reuses WooCommerce's own
 * cart/checkout pages instead of the prototype's mock drawer (see the
 * `// Stage 2:` comment in render.php).
 *
 * Deviations from the prototype, all client-directed (port step 4a):
 *  - no `.price`/`.chips`/`.qty` in Stage 1: replaced by `.order-cta` +
 *    `.order-links` ("Sipariş için bize ulaşın" + phone/WhatsApp/Instagram).
 *  - closed-panel shadow bug fix (client): `.detail` has no box-shadow and
 *    is `visibility:hidden` while closed, only shown once `.open`, so
 *    nothing leaks at the mobile screen edge.
 */
.shop { background: var( --jj-paper, #F3EAD8 ); color: var( --jj-dark, #1C110B ); padding: clamp( 96px, 14vh, 150px ) clamp( 20px, 5vw, 80px ) clamp( 64px, 10vh, 120px ); }
.shop-head h1,
.shop-head h2 { font-family: var( --jj-display ); font-weight: 800; text-transform: uppercase; font-size: clamp( 48px, 7vw, 112px ); line-height: 1; margin: 0 0 .2em; letter-spacing: .01em; }
.shop-head p { margin: 0; max-width: 46ch; font-size: clamp( 15px, 1.2vw, 18px ); line-height: 1.5; opacity: .85; }
.tiles { display: grid; grid-template-columns: repeat( 3, 1fr ); gap: clamp( 12px, 3vw, 48px ); margin: clamp( 28px, 6vh, 64px ) 0 0; align-items: end; }
.tile { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 14px; transition: transform .6s cubic-bezier( .2, .7, .2, 1 ), opacity .4s; text-align: center; }
.tile img { width: min( 100%, 280px ); height: auto; filter: drop-shadow( 0 26px 22px rgba( 28, 17, 11, .18 ) ); transition: transform .6s cubic-bezier( .2, .7, .2, 1 ); }
.tile .t-name { font-family: var( --jj-display ); font-weight: 800; text-transform: uppercase; font-size: clamp( 18px, 1.7vw, 26px ); line-height: 1.05; }
.tile .t-kind { font: 600 11.5px/1 var( --jj-text ); letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.tile:hover img, .tile:focus-visible img { transform: translateY( -8px ); }
.tile:focus-visible { outline: 2px solid var( --jj-dark, #1C110B ); outline-offset: 8px; border-radius: 8px; }
.tiles.has-sel .tile { opacity: .45; transform: scale( .86 ); }
.tiles.has-sel .tile.sel { opacity: 1; transform: scale( 1.08 ); }

.detail {
	display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp( 24px, 5vw, 72px ); margin-top: clamp( 28px, 5vh, 56px );
	max-height: 0; opacity: 0; overflow: hidden; transition: max-height .7s cubic-bezier( .2, .7, .2, 1 ), opacity .5s;
	box-shadow: none; visibility: hidden; /* closed-panel shadow bug fix */
}
.detail.open { max-height: 900px; opacity: 1; visibility: visible; }
.detail h1,
.detail h3 { font-family: var( --jj-display ); font-weight: 800; text-transform: uppercase; font-size: clamp( 30px, 3.4vw, 52px ); line-height: 1; margin: 0 0 .15em; }
.detail .kind { font: 600 12px/1 var( --jj-text ); letter-spacing: .14em; text-transform: uppercase; opacity: .7; margin: 0 0 18px; }
.detail .notes { font-size: 17px; line-height: 1.5; margin: 0 0 22px; }
.detail .desc p { font-size: 17px; line-height: 1.5; margin: 0 0 10px; }
.detail .sig { font-family: var( --jj-display ); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; font-size: 15px; margin: 0 0 22px; }
.attrs { display: grid; grid-template-columns: repeat( 4, 1fr ); border-top: 1.5px solid var( --jj-dark, #1C110B ); border-bottom: 1.5px solid var( --jj-dark, #1C110B ); }
.attrs div { padding: 14px 10px 14px 0; }
.attrs div + div { border-left: 1px solid rgba( 28, 17, 11, .25 ); padding-left: 12px; }
.attrs dt { font: 600 10.5px/1.2 var( --jj-text ); letter-spacing: .12em; text-transform: uppercase; opacity: .65; margin-bottom: 6px; }
.attrs dd { margin: 0; font: 600 16px/1.2 var( --jj-text ); white-space: nowrap; }
.dots { letter-spacing: 2px; }
.buy { display: flex; flex-direction: column; gap: 18px; }
.buy .order-cta { font-family: var( --jj-display ); font-weight: 800; text-transform: uppercase; font-size: clamp( 20px, 1.8vw, 28px ); margin: 0; }
.buy .order-links { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.buy .order-links a { font: 600 13px/1 var( --jj-text ); text-decoration: underline; text-underline-offset: 4px; color: inherit; }
.buy .price { font-family: var( --jj-display ); font-weight: 800; font-size: clamp( 28px, 2.6vw, 40px ); text-transform: uppercase; }
.buy .toast { font-size: 14px; margin: 0; }
.buy .toast a { color: inherit; }
/* Stage 2: WooCommerce's own [add_to_cart] form, minimally dressed to match the prototype's button. */
.buy form.cart { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.buy form.cart .button { height: 48px; padding: 0 28px; border: 0; border-radius: 999px; background: var( --jj-dark, #1C110B ); color: var( --jj-cream, #F2E6CF ); font: 600 13px/1 var( --jj-text ); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; display: inline-flex; align-items: center; cursor: pointer; transition: background .25s, color .25s; }
.buy form.cart .button:hover, .buy form.cart .button:focus-visible { background: var( --jj-yellow, #D3912F ); color: var( --jj-dark, #1C110B ); }
.buy form.cart .qty { width: 64px; height: 48px; border: 1.5px solid var( --jj-dark, #1C110B ); border-radius: 999px; text-align: center; background: transparent; color: inherit; }

.jj-wholesale { margin: clamp( 28px, 5vh, 48px ) 0 0; font-size: 14px; }
/* in a coffee's detail: right under its buttons (rehber, 11 Oct 2026) */
.detail .buy .jj-wholesale { margin: 4px 0 0; }
.jj-wholesale a { color: inherit; text-decoration: underline; text-underline-offset: 4px; }
/* Satış and Kahveler: "Toptan fiyat için bize ulaşın" at the page's end is a button like the site's
   others (rehber, 10 Oct 2026); on the product page and in a coffee's detail it stays the small
   underlined link under "Sepete ekle" and "Sipariş için bize ulaşın" (11 Oct 2026) */
.jj-shop:not( .jj-shop--single ) > .jj-wholesale a {
	display: inline-flex; align-items: center; height: 48px; padding: 0 26px; border-radius: 999px;
	background: var( --jj-dark, #1C110B ); color: var( --jj-cream, #F2E6CF ); text-decoration: none;
	font: 600 13px/1 var( --jj-text ); letter-spacing: .14em; text-transform: uppercase; transition: background .25s, color .25s;
}
.jj-shop:not( .jj-shop--single ) > .jj-wholesale a:hover,
.jj-shop:not( .jj-shop--single ) > .jj-wholesale a:focus-visible { background: var( --jj-yellow, #D3912F ); color: var( --jj-dark, #1C110B ); }
/* a coffee's detail open: the page-end button hides, the detail has its own small link (rehber, 11 Oct 2026; view.js) */
.jj-shop.jj-detail-acik > .jj-wholesale { display: none; }
/* the listing pages end with an ordinary gap before the footer (rehber, 10 Oct 2026) */
.jj-shop:not( .jj-shop--single ) { padding-bottom: clamp( 40px, 6vh, 56px ); }

@media (max-width: 767px) {
	.shop { padding: 96px 16px 56px; }
	.jj-shop:not( .jj-shop--single ) { padding-bottom: 32px; }
	.shop-head h1,
	.shop-head h2 { font-size: 44px; }
	.shop-head p { font-size: 14.5px; }
	.tiles { grid-template-columns: repeat( 3, 1fr ); gap: 8px; margin-top: 22px; }
	.tile { gap: 8px; }
	.tile img { width: 100%; filter: drop-shadow( 0 12px 10px rgba( 28, 17, 11, .16 ) ); }
	.tile .t-name { font-size: 14px; }
	.tile .t-kind { font-size: 9px; letter-spacing: .08em; }
	.tiles.has-sel .tile { opacity: 1; transform: none; }
	.detail {
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 88vh; overflow-y: auto;
		background: var( --jj-paper, #F3EAD8 ); border-radius: 18px 18px 0 0;
		padding: 18px 18px calc( env( safe-area-inset-bottom, 0px ) + 22px ); margin: 0; display: block;
		opacity: 1; transform: translateY( 105% ); transition: transform .5s cubic-bezier( .2, .7, .2, 1 );
	}
	.jj-shop--single .detail { position: static; transform: none; max-height: none; box-shadow: none; visibility: visible; border-radius: 0; padding: 0; }
	.detail.open { max-height: 88vh; transform: none; box-shadow: 0 -20px 60px rgba( 28, 17, 11, .25 ); }
	/* the product page's detail is the page, not a sheet: no height cap, no box of its own to scroll, no
	   shadow (11 Oct 2026: .detail.open won over the rule above and made a 88vh scroll box in the page) */
	.jj-shop--single .detail.open { max-height: none; overflow: visible; box-shadow: none; }
	.detail .dtop { display: grid; grid-template-columns: 34% 1fr; gap: 14px; align-items: center; margin-bottom: 14px; }
	.detail .dtop .pack img { width: 100%; height: auto; display: block; }
	.detail h1,
	.detail h3 { font-size: 26px; }
	.detail .notes { font-size: 15px; margin-bottom: 14px; }
	.detail .desc p { font-size: 15px; }
	.detail .sig { margin-bottom: 14px; }
	.detail .buy { margin-top: 16px; gap: 12px; }
	.attrs { grid-template-columns: repeat( 2, 1fr ); }
	.attrs div:nth-child(3) { border-left: 0; padding-left: 0; }
	.sheetx { position: absolute; right: 14px; top: 12px; }
}
@media (min-width: 768px) { .detail .dtop .pack img, .sheetx { display: none; } }
.sheetx { background: none; border: 1.5px solid var( --jj-dark, #1C110B ); border-radius: 999px; font: 600 12px/1 var( --jj-text ); letter-spacing: .12em; text-transform: uppercase; padding: 9px 14px; cursor: pointer; color: var( --jj-dark, #1C110B ); }
.backdrop { position: fixed; inset: 0; z-index: 39; background: transparent; visibility: hidden; pointer-events: none; transition: background-color .4s, visibility 0s .4s; }
/* closed, the backdrop is see-through and hidden: iPhone Safari takes its top bar colour from fixed
   elements at the top edge, and the dark one (opacity 0) left the bar grey, from the first load on
   (rehber, 10 Oct 2026); open, it darkens the page and the bar, as before */
.backdrop.on { background: rgba( 28, 17, 11, .45 ); visibility: visible; pointer-events: auto; transition: background-color .4s; }

/* single product page: the detail IS the page, no tiles/backdrop/close button. */
.jj-shop--single { padding-top: clamp( 140px, 18vh, 190px ); }
.jj-shop--single .detail { display: grid; grid-template-columns: 1.1fr 1fr; margin-top: 0; }
@media (max-width: 767px) { .jj-shop--single .detail { display: block; } }

/* Landscape iPhone (viewport-fit=cover): the paper runs edge to edge, the
   content keeps clear of the notch. */
.shop > :not( .detail ),
.jj-shop--single .detail {
	padding-left: max( 0px, var( --jj-sl, 0px ) - clamp( 20px, 5vw, 80px ) );
	padding-right: max( 0px, var( --jj-sr, 0px ) - clamp( 20px, 5vw, 80px ) );
}

/* Short landscape (phone on its side, client 28 Sep 2026): the packs are
   sized by the screen height so a whole card fits on screen. */
@media (max-height: 500px) and (orientation: landscape) {
	.shop { padding-top: 84px; }
	.tiles { margin-top: 18px; }
	.tile { gap: 8px; }
	.tile img { width: auto; max-width: 100%; height: min( 56vh, 230px ); }
	.jj-shop--single { padding-top: 84px; }
	/* narrow landscape (under 768px, the phone sheet): small pack, sheet below the header */
	.detail .dtop { grid-template-columns: auto 1fr; }
	.detail .dtop .pack img { width: auto; height: calc( min( 34vh, 140px ) * var( --jj-oran, 1 ) ); }
	.detail.open { max-height: calc( 100% - 64px ); }
	.detail { max-height: calc( 100% - 64px ); }
}

/* "Sipariş için bize ulaşın" as a WhatsApp button (rehber, 28 Sep 2026). */
.buy a.order-cta--wa {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	height: 48px;
	padding: 0 26px;
	border-radius: 999px;
	background: var( --jj-dark, #1C110B );
	color: var( --jj-cream, #F2E6CF );
	text-decoration: none;
	font: 600 13px/1 var( --jj-text );
	letter-spacing: .14em;
	transition: background .25s, color .25s;
}
.buy a.order-cta--wa:hover,
.buy a.order-cta--wa:focus-visible { background: var( --jj-yellow, #D3912F ); color: var( --jj-dark, #1C110B ); }

/* Sales on, or a logged-in administrator's sales preview (client, 5 Oct
   2026): WooCommerce's "Sepete Ekle" is the first button, in the site's pill;
   "Sipariş için bize ulaşın" (WhatsApp) the second, outlined. Visitors in the
   catalog never get .buy--sales. */
.buy.buy--sales .price { margin-bottom: -4px; }
.buy.buy--sales .price bdi { white-space: nowrap; }
.buy.buy--sales .add_to_cart_inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin: 0; padding: 0 !important; border: 0 !important; }
.buy.buy--sales .add_to_cart_inline a.button {
	display: inline-flex; align-items: center; height: 52px; padding: 0 34px; margin: 0;
	border: 0; border-radius: 999px; background: var( --jj-dark, #1C110B ); color: var( --jj-cream, #F2E6CF );
	font: 600 13px/1 var( --jj-text ); letter-spacing: .14em; text-transform: uppercase; text-decoration: none;
	transition: background .25s, color .25s, opacity .25s;
}
.buy.buy--sales .add_to_cart_inline a.button:focus-visible { background: var( --jj-yellow, #D3912F ); color: var( --jj-dark, #1C110B ); }
@media ( hover: hover ) { .buy.buy--sales .add_to_cart_inline a.button:hover { background: var( --jj-yellow, #D3912F ); color: var( --jj-dark, #1C110B ); } }
.buy.buy--sales .add_to_cart_inline a.button.loading { opacity: .55; pointer-events: none; }
.buy.buy--sales .add_to_cart_inline a.button::after { content: none !important; display: none !important; }
/* Our "Sepete ekle" (9 Oct 2026: it adds the chosen size) in the same pill as WooCommerce's was. */
.buy.buy--sales .add_to_cart_inline button.button {
	display: inline-flex; align-items: center; height: 52px; padding: 0 34px; margin: 0;
	border: 0; border-radius: 999px; background: var( --jj-dark, #1C110B ); color: var( --jj-cream, #F2E6CF );
	font: 600 13px/1 var( --jj-text ); letter-spacing: .14em; text-transform: uppercase; cursor: pointer;
	transition: background .25s, color .25s, opacity .25s;
}
.buy.buy--sales .add_to_cart_inline button.button:focus-visible { background: var( --jj-yellow, #D3912F ); color: var( --jj-dark, #1C110B ); outline: none; }
@media ( hover: hover ) { .buy.buy--sales .add_to_cart_inline button.button:hover { background: var( --jj-yellow, #D3912F ); color: var( --jj-dark, #1C110B ); } }
.buy.buy--sales .add_to_cart_inline button.button.loading { opacity: .55; pointer-events: none; }
.buy.buy--sales .jj-sepete-msg { flex-basis: 100%; font: 500 13px/1.4 var( --jj-text ); color: #9b2a14; }

/* Sizes (client, 9 Oct 2026): two unlabelled buttons under the pack, the chosen one filled. The 250 g
   picture is cut at the top; where the picture is sized by its height, --jj-oran (view.js) keeps it at
   its true size (rehber, 10 Oct 2026) */
.pack .gramaj { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.pack .gramaj [role="radio"] {
	min-width: 64px; height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
	border: 1.5px solid var( --jj-dark, #1C110B ); background: transparent; color: var( --jj-dark, #1C110B );
	font: 600 13px/1 var( --jj-text ); letter-spacing: .06em; white-space: nowrap;
	transition: background .2s, color .2s;
}
.pack .gramaj [role="radio"][aria-checked="true"] { background: var( --jj-dark, #1C110B ); color: var( --jj-cream, #F2E6CF ); }
.pack .gramaj [role="radio"]:focus-visible { outline: 2px solid var( --jj-yellow, #D3912F ); outline-offset: 2px; }
@media ( hover: hover ) { .pack .gramaj [role="radio"][aria-checked="false"]:hover { background: rgba( 28, 17, 11, .08 ); } }
@media (min-width: 768px) {
	/* the cards' panel on computers: no picture of its own (the chosen card shows it), the buttons at the top */
	.jj-shop:not( .jj-shop--single ) .detail .dtop .pack { order: 2; }
	.jj-shop:not( .jj-shop--single ) .detail .dtop .pack .gramaj { justify-content: flex-start; margin: 0 0 18px; }
}
@media (max-width: 767px) {
	.pack .gramaj { gap: 6px; }
	.pack .gramaj [role="radio"] { min-width: 0; flex: 1; height: 36px; padding: 0 8px; font-size: 12px; }
}

/* WooCommerce's own "Sepetim" link, added next to the button once the coffee is in the cart. */
.buy.buy--sales .add_to_cart_inline a.added_to_cart { font: 600 13px/1 var( --jj-text ); letter-spacing: .06em; color: inherit; text-decoration: underline; text-underline-offset: 4px; padding: 0; }
.buy a.order-cta--wa.order-cta--alt { height: 46px; background: transparent; color: var( --jj-dark, #1C110B ); box-shadow: inset 0 0 0 1.5px var( --jj-dark, #1C110B ); }
.buy a.order-cta--wa.order-cta--alt:hover,
.buy a.order-cta--wa.order-cta--alt:focus-visible { background: var( --jj-dark, #1C110B ); color: var( --jj-cream, #F2E6CF ); }

/* WooCommerce notices on the product page ("... sepetinize eklendi", only after a no-JS add).
   The block always prints an empty wrapper (.woocommerce-notices-wrapper), so it takes no room
   at all unless a notice is really there (1.4.27: a padding on the empty block pushed the
   product down by 120px on every product page). */
.single-product .wc-block-store-notices { margin: 0; padding: 0; }
.single-product .wc-block-store-notices:has( .wc-block-components-notice-banner, .woocommerce-message, .woocommerce-error, .woocommerce-info ) { max-width: 1240px; margin: 0 auto; padding: 120px clamp( 20px, 5vw, 80px ) 0; }

/* Single product page (client, 5 Oct 2026, 1.4.27): WooCommerce's breadcrumb
   sat under the fixed header (behind the logo) and the product came only
   after the section's own 140px+ top padding, so a phone showed an empty
   upper part. Now the breadcrumb starts below the header, in the shop's
   gutter, and the product follows right after it. Nothing on this page may
   push it sideways (overflow clipped). */
.single-product main { overflow-x: clip; }
.single-product main > .wc-block-breadcrumbs {
	max-width: none; margin: 0; /* no background: a text block, so the safe-area insets may pad it (landscape rule) */
	padding: calc( env( safe-area-inset-top, 0px ) + 96px ) clamp( 20px, 5vw, 80px ) 0;
	padding-left: max( clamp( 20px, 5vw, 80px ), var( --jj-sl, 0px ) );
	padding-right: max( clamp( 20px, 5vw, 80px ), var( --jj-sr, 0px ) );
	font: 500 13px/1.45 var( --jj-text ); color: rgba( 28, 17, 11, .7 );
}
.single-product main > .wc-block-breadcrumbs a { color: inherit; text-underline-offset: 3px; }
.jj-shop--single { padding-top: clamp( 20px, 3vh, 36px ); }
@media (max-width: 767px) {
	.single-product main > .wc-block-breadcrumbs { padding: calc( env( safe-area-inset-top, 0px ) + 80px ) 16px 0; font-size: 12px; }
	.jj-shop--single { padding-top: 16px; }
}
@media (max-height: 500px) and (orientation: landscape) {
	.single-product main > .wc-block-breadcrumbs { padding-top: 72px; }
	.jj-shop--single { padding-top: 12px; }
}

/* Product page on wider screens (client, 5 Oct 2026, 1.4.28): the pack was
   hidden there (from 768px the cards show the packs, the product page has no
   cards), so the right column stayed empty. The detail's parts now sit in the
   left column and the pack in the right one, held in view while the text
   scrolls. Short landscape phones keep their own layout. */
@media (min-width: 768px) and (min-height: 501px) {
	/* the text rows take their own height; the last, flexible row takes what the pack needs beyond them */
	.jj-shop--single .detail { grid-template-columns: minmax( 0, 1.1fr ) minmax( 0, 1fr ); grid-template-rows: repeat( 10, auto ) 1fr; row-gap: 0; column-gap: clamp( 32px, 6vw, 110px ); align-items: start; }
	/* no clipping box here: .detail's overflow hidden made it the sticky pack's scroll container, so the
	   pack never stayed in view and a shorter one (250 g) sat 110px down (10 Oct 2026) */
	.jj-shop--single .detail { overflow: visible; }
	.jj-shop--single .detail > div,
	.jj-shop--single .detail .dtop { display: contents; }
	.jj-shop--single .detail > div > *,
	.jj-shop--single .detail .dtop > div { grid-column: 1; }
	.jj-shop--single .detail .dtop .pack {
		grid-column: 2; grid-row: 1 / -1; justify-self: center; align-self: start;
		display: flex; flex-direction: column; align-items: center; gap: 18px; max-width: 100%;
		position: sticky; top: 110px;
	}
	.jj-shop--single .detail .dtop .pack img {
		display: block; width: auto; max-width: 100%; height: calc( min( 64vh, 600px ) * var( --jj-oran, 1 ) ); object-fit: contain;
	}
}
