/*
 * Day cards: the Product Collection list from motorg_web_day_cards()
 * (handoff "Day card"). Used on the front page, the Ratapäivät category and the empty
 * cart. List grid: woocommerce/product-collection.css; places left:
 * woocommerce/product-stock-indicator.css. Sold out: WooCommerce's `outofstock`
 * product class on the list item. A card with a link is clickable as a whole
 * (`org-card-link`: theme.css, "Clickable cards").
 */

/* ---------- Card ---------- */
.org-daycard {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--space-3);
	height: 100%;
	margin: 0;
	padding: var(--space-4);
	background: var(--surface-card);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-m);
}
.org-daycard > *,
.org-daycard__info > *,
.org-daycard__meta > * { margin: 0; }
.org-daycard__info { flex: 1; min-width: 0; }

.org-daycard__title {
	margin: 0;
	font: var(--fw-bold) var(--fs-h3)/1.1 var(--font-display);
	font-style: normal;
	text-transform: uppercase;
	color: var(--text-strong);
}

.org-daycard__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-1) 14px;
	margin-block-start: var(--space-2);
}

/* "100 €": every group of a day costs the same, so no "alk." prefix */
.org-daycard__price,
.org-daycard__price .wc-block-components-product-price,
.org-daycard__price .woocommerce-Price-amount {
	font: var(--fw-semibold) var(--fs-body-m)/1.3 var(--font-mono);
	color: var(--text-body);
}

/* ---------- CTA: primary "Valitse" + chevron (L full width on mobile, M on desktop) ----------
   A button through wp-element-button (inc/day-cards.php): theme.json sets its look and size. */
.org-daycard__cta {
	width: 100%;
	margin: 0;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}
.org-daycard__cta::after {
	content: "";
	flex: none;
	width: 20px;
	height: 20px;
	margin-block: calc((1em - 20px) / 2);
	background: currentColor;
	-webkit-mask: var(--org-icon-chevron-right) center / contain no-repeat;
	mask: var(--org-icon-chevron-right) center / contain no-repeat;
}

/* ---------- Sold out: sunken card, muted title, disabled secondary "Täynnä" ---------- */
.outofstock .org-daycard { background: var(--surface-sunken); }
.outofstock .org-daycard__title { color: var(--text-muted); }
.outofstock .org-daycard__price { display: none; }
.org-daycard__cta.is-sold-out {
	background: transparent;
	border-color: var(--surface-inverse);
	color: var(--text-strong);
	cursor: not-allowed;
}
.org-daycard__cta.is-sold-out::after { content: none; }

/* ---------- Online sale ended: the walk-in note instead of a button (not clickable) ---------- */
.org-daycard__closed {
	font-size: var(--fs-body-s);
	line-height: 1.4;
	color: var(--text-muted);
}

/* ---------- Sale not open yet / members only: secondary link to the day ("Myynti alkaa 15.10. klo 12.00") ---------- */
.org-daycard__cta:is(.is-upcoming, .is-restricted) {
	background: transparent;
	border-color: var(--surface-inverse);
	color: var(--text-strong);
}
a.org-daycard__cta:is(.is-upcoming, .is-restricted):hover,
a.org-daycard__cta:is(.is-upcoming, .is-restricted):focus-visible { background: var(--surface-sunken); color: var(--text-strong); }
a.org-daycard__cta:is(.is-upcoming, .is-restricted):active { background: var(--border-subtle); }

/* ---------- Desktop: one row, button on the right ---------- */
@media (min-width: 782px) {
	.org-daycard {
		flex-direction: row;
		align-items: center;
		gap: var(--space-5);
		padding: 18px var(--space-5);
	}
	/* Size M (the size-m style's values; the Read More block has no button styles) */
	.org-daycard__cta {
		flex: none;
		width: auto;
		padding: var(--wp--custom--button--m--padding-y) var(--wp--custom--button--m--padding-x);
		font-size: var(--wp--custom--button--m--font-size);
	}
	.org-daycard__cta::after { width: 18px; height: 18px; margin-block: calc((1em - 18px) / 2); }
	.org-daycard__closed { flex: none; max-width: 17em; text-align: end; }
}

/* ---------- Block style "Kortit" (org-daycards--cards, inc/day-cards.php) ----------
   The design system's Card in a grid (1 column on phones, 2 from 782px, 3 from 1024px; :not(.columns-1) and the doubled
   class outweigh product-collection.css, which loads later):
   the weekday and date as the eyebrow, the circuit as the title, places left and price,
   the button at the bottom. Clickable cards lift on hover (theme.css). */
.org-daycards.org-daycards--cards ul.wp-block-woocommerce-product-template { gap: var(--space-4); }
.org-daycards--cards .org-daycard__title--row {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
}
.org-daycards--cards .org-daycard__title--row .org-daycard__date {
	font: var(--fw-bold) var(--fs-label)/1.3 var(--font-mono);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-link);
}
.org-daycards--cards .outofstock .org-daycard__date { color: var(--text-muted); }
.org-daycards--cards .org-daycard__meta { margin-block-start: var(--space-3); }

@media (min-width: 782px) {
	.org-daycards.org-daycards--cards ul.wp-block-woocommerce-product-template { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.org-daycards--cards .org-daycard {
		flex-direction: column;
		align-items: stretch;
		gap: var(--space-4);
		padding: var(--space-5);
	}
	.org-daycards--cards .org-daycard__cta { width: 100%; }
	.org-daycards--cards .org-daycard__closed { max-width: none; text-align: start; }
}
@media (min-width: 1024px) {
	.org-daycards.org-daycards--cards ul.wp-block-woocommerce-product-template:not(.columns-1) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* No timeline indent before the name (category.css loads with the season grid) */
.org-daycards--cards .org-daycard__title--row .org-daycard__name { padding-inline-start: 0; }
