/* Tanakoora — listings (shop, category, brand), product card, WooCommerce notices and forms. Look = live site (R33). */

/* Layout: filter accordions on the side (desktop), grid beside them */
.tk-shop { display: grid; gap: 20px; }
.tk-shop__main { min-inline-size: 0; }
@media (min-width: 1000px) { .tk-shop { grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; } }

/* Title in the black bar */
.tk-archive-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; background: var(--foreground); color: var(--primary-foreground); padding: 16px 20px; margin-block-end: 16px; min-block-size: 62px; }
.tk-archive-head .tk-title { color: var(--primary-foreground); font-size: var(--text-base); margin: 0; }
.tk-archive-head__count { margin: 0; color: color-mix(in srgb, var(--primary-foreground) 75%, transparent); font-size: var(--text-sm); }

/* Brand intro printed by the tanakoora-admin plugin above the grid */
.tk-brand-intro { color: var(--foreground); font-size: var(--text-base); line-height: var(--leading-reading); margin-block-end: 16px !important; }

/* Size chips (R3/R10) */
.tk-sizes { display: flex; gap: 8px; overflow-x: auto; padding-block: 8px 12px; scrollbar-width: none; align-items: center; }
.tk-sizes::-webkit-scrollbar { display: none; }
.tk-sizes__label { display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; font-size: var(--text-sm); color: var(--muted-foreground); }
.tk-sizes__chip { flex: none; min-inline-size: var(--touch); min-block-size: var(--touch); display: grid; place-items: center; padding-inline: 12px; border-radius: var(--shape-control); border: 1px solid var(--border); background: var(--card); color: var(--foreground); font-variant-numeric: tabular-nums; }
.tk-sizes__chip:hover { border-color: var(--primary); color: var(--primary); }
.tk-sizes__chip.is-on { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.tk-sizes__chip.is-clear { font-weight: 400; }

/* Toolbar: breadcrumb + ordering (+ filter button on phones) */
.tk-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; margin-block-end: 12px; font-size: var(--text-sm); color: var(--muted-foreground); }
.tk-toolbar .tk-crumbs { margin: 0; }
.tk-toolbar .woocommerce-result-count { display: none; }
.tk-toolbar .woocommerce-ordering { margin: 0; }
.tk-toolbar select { min-inline-size: 280px; block-size: var(--touch); border: 1px solid var(--input); border-radius: var(--shape-control); background: var(--card); padding: 0 12px; color: var(--foreground); }
.tk-toolbar .woocommerce-notices-wrapper:empty { display: none; }
.tk-filterbtn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; min-block-size: var(--touch); font-size: var(--text-sm); cursor: pointer; color: var(--foreground); }
.tk-filterbtn__n { background: var(--primary); color: var(--primary-foreground); border-radius: var(--shape-pill); min-inline-size: 20px; block-size: 20px; display: inline-grid; place-items: center; font-size: var(--text-xs); }
@media (max-width: 999px) {
	.tk-toolbar .woocommerce-ordering, .tk-toolbar select { inline-size: 100%; min-inline-size: 0; }
	.tk-toolbar .woocommerce-ordering { order: 3; flex-basis: 100%; }
	.tk-toolbar .tk-filterbtn { order: 4; }
}
@media (min-width: 1000px) { .tk-filterbtn { display: none; } }

/* Filter panel: bottom sheet on phones */
.tk-sheet { border: 0; padding: 0; margin: auto 0 0; inline-size: 100%; max-inline-size: 100%; max-block-size: 88vh; border-radius: var(--shape-surface) var(--shape-surface) 0 0; background: var(--card); color: var(--foreground); }
.tk-sheet::backdrop { background: color-mix(in srgb, var(--foreground) 40%, transparent); }
.tk-sheet[open] { animation: tk-up var(--motion) var(--motion-ease); }
@keyframes tk-up { from { transform: translateY(30px); } }
@media (prefers-reduced-motion: reduce) { .tk-sheet[open] { animation: none; } }
@media (min-width: 900px) { .tk-sheet { margin: auto; inline-size: 520px; max-block-size: 80vh; border-radius: var(--shape-surface); } }
.tk-sheet__form { display: flex; flex-direction: column; max-block-size: inherit; }
.tk-sheet__head, .tk-sheet__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px; }
.tk-sheet__head { border-block-end: 1px solid var(--border); }
.tk-sheet__foot { border-block-start: 1px solid var(--border); }
.tk-sheet__foot .tk-btn { flex: 1; }
.tk-sheet__body { overflow-y: auto; padding: 0 16px 16px; }

/* Filter groups: accordions as on the live sidebar */
.tk-fset { border-block-end: 1px solid var(--border); }
.tk-fset summary { display: flex; justify-content: space-between; align-items: center; padding: 24px 0; cursor: pointer; list-style: none; color: var(--foreground); font-size: var(--text-sm); }
.tk-fset summary::-webkit-details-marker { display: none; }
.tk-fset summary .tk-icon { color: var(--muted-foreground); transition: transform var(--motion) var(--motion-ease); }
.tk-fset[open] summary .tk-icon { transform: rotate(180deg); }
.tk-fset__body { padding-block-end: 16px; }
.tk-fcats { list-style: none; margin: 0; padding: 0; }
.tk-fcats a { display: block; padding: 8px 0; color: var(--foreground); }
.tk-fcats a:hover { color: var(--primary); }
.tk-fcats small { color: var(--muted-foreground); }
.tk-fchips { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-fchip input { position: absolute; opacity: 0; pointer-events: none; }
.tk-fchip span { display: inline-grid; place-items: center; min-inline-size: var(--touch); min-block-size: var(--touch); padding: 0 12px; border-radius: var(--shape-control); border: 1px solid var(--border); background: var(--card); cursor: pointer; font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.tk-fchip input:checked + span { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.tk-fchip input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }
.tk-fchip.is-empty span { opacity: .45; text-decoration: line-through; }
.tk-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 12px; cursor: pointer; }
.tk-switch input { inline-size: 20px; block-size: 20px; accent-color: var(--primary); }

/* Desktop: the same panel sits in the sidebar, always shown, applied on change */
@media (min-width: 1000px) {
	.tk-shop__side .tk-filters { display: block; position: static; inline-size: auto; max-block-size: none; margin: 0; border-radius: 0; background: transparent; animation: none; }
	.tk-shop__side .tk-sheet__head { display: none; }
	.tk-shop__side .tk-sheet__body { overflow: visible; padding: 0; }
	.tk-shop__side .tk-fset:first-child summary { padding-block-start: 4px; }
	.tk-shop__side .tk-sheet__foot { padding: 16px 0; border: 0; }
	.tk-shop__side .tk-sheet__foot.is-idle, .tk-shop__side .tk-sheet__foot [type="submit"] { display: none; }
}

/* Grid */
ul.products { list-style: none; margin: 0; padding: 0; display: grid; gap: 24px 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 20px; } }
@media (min-width: 1400px) { .tk-home ul.products, .tk-vendor-grid ul.products { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Card (R4/W20): centred, photo, title, grey brand, red price, red button */
.tk-card { position: relative; display: flex; flex-direction: column; text-align: center; }
.tk-card__media { position: relative; display: block; aspect-ratio: 1; background: var(--card); overflow: hidden; }
.tk-card__img { inline-size: 100%; block-size: 100%; object-fit: contain; transition: opacity var(--motion) var(--motion-ease), transform var(--motion) var(--motion-ease); }
.tk-card__img--alt { position: absolute; inset: 0; opacity: 0; }
@media (hover: hover) {
	.tk-card:hover .tk-card__img--alt { opacity: 1; }
	.tk-card:hover .tk-card__img:not(.tk-card__img--alt) { opacity: 0; }
}
.tk-card__badges { position: absolute; inset-block-start: 6px; inset-inline-start: 6px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.tk-chip--off { background: var(--primary); color: var(--primary-foreground); border-radius: var(--shape-pill); }
.tk-card__body { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 8px 0; flex: 1; }
.tk-card__title { font-size: var(--text-sm); font-weight: 400; line-height: var(--leading-body); margin: 0; color: var(--foreground); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tk-card__title a:hover { color: var(--primary); }
.tk-card__brand { font-size: var(--text-xs); color: var(--muted-foreground); } /* live #a5a5a5, darkened for WCAG AA */
.tk-card__price { font-weight: 700; font-size: var(--text-sm); color: var(--price); font-variant-numeric: tabular-nums; }
.tk-card__price del { color: var(--muted-foreground); font-weight: 400; margin-inline-end: 8px; }
.tk-card__price ins { text-decoration: none; }
.tk-card__buy { margin-block-start: auto; display: inline-flex; align-items: center; justify-content: center; min-block-size: var(--touch); padding: 0 16px; background: var(--primary); color: var(--primary-foreground); font-size: var(--text-sm); font-weight: 700; box-shadow: var(--depth-control); }
.tk-card__buy:hover { color: var(--primary-foreground); filter: brightness(1.07); }
.tk-card__buy.is-sold { background: var(--muted); color: var(--muted-foreground); box-shadow: none; font-weight: 400; }
.tk-card__buy.is-sold:hover { color: var(--primary); }
.tk-card__buy[aria-busy="true"] { opacity: .6; pointer-events: none; }
.tk-card__buy.is-added { background: var(--success); }

/* Pagination */
.woocommerce-pagination ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 0; margin: 32px 0 0; }
.woocommerce-pagination a, .woocommerce-pagination span { display: grid; place-items: center; min-inline-size: var(--touch); min-block-size: var(--touch); border-radius: var(--shape-control); border: 1px solid var(--border); background: var(--card); color: var(--foreground); }
.woocommerce-pagination .current { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }

/* Brand / category long text printed below the products by the plugin */
.tk-brand-body { border-block-start: 1px solid var(--border); margin-block-start: 32px !important; padding-block-start: 8px; }
.tk-brand-body table td:nth-child(2) { direction: ltr; unicode-bidi: plaintext; }

/* Notices */
.woocommerce-message, .woocommerce-info, .woocommerce-error { list-style: none; margin: 0 0 16px; padding: 12px 16px; border-radius: var(--shape-control); background: var(--muted); border-inline-start: 4px solid var(--success); color: var(--foreground); }
.woocommerce-error { border-color: var(--primary); }
.woocommerce-message .button { min-height: 36px; padding: 0 16px; font-size: var(--text-sm); margin-inline-start: 8px; }
