/**
 * Kauppakeskus Lounaslistat — perustyylit.
 *
 * Nämä ovat tarkoituksella kevyet ja helposti ylikirjoitettavat.
 * Jos sivustolla on käytössä Tailwind, voit halutessasi kirjoittaa
 * nämä säännöt uudelleen omassa teemassasi ja jättää tämän tiedoston
 * lataamatta (esim. suodattimella tai poistamalla enqueue-kutsu).
 */

[x-cloak] {
	display: none !important;
}

.kklv-lounaslistat {
	--kklv-primary: var(--primary, #194994);
	--kklv-accent: var(--pink, #ee2a7b);
	--kklv-line: rgba(25, 73, 148, 0.15);
	--kklv-text: var(--ink, #2d2d2d);
	--kklv-muted: var(--muted, #6b7280);
	--kklv-surface: var(--surface, #eef2f7);
	--kklv-surface-strong: var(--surface-blue, #bacad9);
	--kklv-radius: var(--radius-card, 0.5rem);
	max-width: 100%;
	margin: 0 0 2em;
}

/* --- Viikkonäkymä (oletus, [kklv_lounaslistat]) --------------------------- */

/* Own container: the shortcode usually sits straight in the page content, outside .content-wrapper */
.kklv-lounaslistat--week {
	box-sizing: border-box;
	max-width: 56rem;
	margin: 0 auto;
	padding: 3rem 1.5rem;
	color: var(--kklv-text);
}

@media (min-width: 1024px) {
	.kklv-lounaslistat--week {
		padding: 4.5rem 2rem;
	}
}

.kklv-week-header {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 2rem;
	text-align: center;
}

.kklv-week-title {
	margin: 0;
	font-size: clamp(1.875rem, 2vw + 1.2rem, 2.75rem);
	line-height: 1.1;
	font-weight: 800;
	letter-spacing: -0.02em;
	color: var(--kklv-primary);
}

.kklv-week-date {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--kklv-accent);
}

/* Restaurant picker: pills, centred, wrap onto more rows when needed */
.kklv-tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
	margin: 0 0 2rem;
}

.kklv-tab {
	appearance: none;
	background: transparent;
	border: 2px solid var(--kklv-primary);
	border-radius: 0;
	padding: 0.55em 1.2em;
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.2;
	color: var(--kklv-primary);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.kklv-tab:hover {
	background: rgba(25, 73, 148, 0.08);
}

.kklv-tab--active,
.kklv-tab--active:hover {
	background: var(--kklv-primary);
	color: #fff;
}

.kklv-tab:focus-visible,
.kklv-day-toggle:focus-visible {
	outline: 2px solid var(--kklv-accent);
	outline-offset: 2px;
}

.kklv-panel {
	line-height: 1.6;
}

/* Lists (accordion days and the undated "same all week" list) */
.kklv-day-items,
.kklv-menu-content ul,
.kklv-menu-content ol {
	list-style: none;
	margin: 0;
	padding: 0;
}

.kklv-day-items li,
.kklv-menu-content li {
	position: relative;
	margin: 0 0 0.4em;
	padding-left: 1.1em;
}

.kklv-day-items li::before,
.kklv-menu-content li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.65em;
	width: 0.35em;
	height: 0.35em;
	border-radius: 50%;
	background: var(--kklv-accent);
}

.kklv-day-items li:last-child,
.kklv-menu-content li:last-child {
	margin-bottom: 0;
}

/* A list without weekdays (same all week, or the restaurant's raw HTML): a light card instead of
   the accordion. No bullets here: these lists mix dishes with loose price/hours lines. */
.kklv-lounaslistat--week .kklv-menu-content {
	padding: 1.25rem 1.5rem;
	border: 1px solid var(--kklv-line);
	border-radius: var(--kklv-radius);
	background: var(--kklv-surface);
}

.kklv-lounaslistat--week .kklv-menu-content li {
	padding-left: 0;
}

.kklv-lounaslistat--week .kklv-menu-content li::before {
	display: none;
}

.kklv-menu-content--week .kklv-day-heading {
	display: none;
}

/* Grouped lines (both views): a title with its price / hours lines under it
   (e.g. "Buffet Lounas" + "14,50€ /per henkilö" + "Ma-pe 10:30-16:00") */
.kklv-item-group + .kklv-item-group,
li + .kklv-item-group,
.kklv-item-group + li {
	margin-top: 0.9em;
}

.kklv-item-title,
.kklv-item-detail {
	display: block;
}

.kklv-item-title {
	font-weight: 700;
	color: var(--kklv-primary);
}

.kklv-item-detail {
	font-size: 0.95em;
}

/* Raw HTML from the restaurant's site: tame its headings to the page's scale */
.kklv-lounaslistat--week .kklv-menu-content :is(h1, h2, h3) {
	margin: 1.5rem 0 0.5rem;
	font-size: 1.15rem;
	line-height: 1.3;
	font-weight: 800;
	color: var(--kklv-primary);
}

.kklv-lounaslistat--week .kklv-menu-content :is(h4, h5, h6) {
	margin: 1rem 0 0.15rem;
	font-size: 1rem;
	line-height: 1.3;
	font-weight: 700;
	color: var(--kklv-primary);
}

.kklv-lounaslistat--week .kklv-menu-content p {
	margin: 0 0 0.5rem;
}

.kklv-lounaslistat--week .kklv-menu-content > :first-child,
.kklv-lounaslistat--week .kklv-menu-content > :first-child :is(h1, h2, h3, h4, h5, h6) {
	margin-top: 0;
}

.kklv-menu-content table {
	width: 100%;
	border-collapse: collapse;
}

.kklv-menu-content td,
.kklv-menu-content th {
	padding: 0.4em 0.6em;
	border-bottom: 1px solid var(--kklv-line);
	text-align: left;
	vertical-align: top;
}

.kklv-day-empty,
.kklv-no-content,
.kklv-empty {
	margin: 0;
	color: var(--kklv-muted);
	font-style: italic;
}

/* Day accordion */
.kklv-day-accordion {
	border-top: 1px solid var(--kklv-line);
}

.kklv-day-item {
	border-bottom: 1px solid var(--kklv-line);
}

.kklv-day-toggle {
	appearance: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	background: transparent;
	border: none;
	cursor: pointer;
	text-align: left;
	padding: 1rem 0.25rem;
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--kklv-primary);
}

.kklv-day-item--today .kklv-day-toggle {
	color: var(--kklv-accent);
}

.kklv-day-toggle-label {
	display: flex;
	align-items: center;
	gap: 0.6em;
}

.kklv-today-badge {
	font-size: 0.65rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	background: var(--kklv-accent);
	color: #fff;
	border-radius: 0;
	padding: 0.3em 0.75em;
}

.kklv-day-toggle-icon {
	flex: 0 0 auto;
	width: 0.55em;
	height: 0.55em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-25%) rotate(45deg);
	transition: transform 0.2s ease;
	margin-left: 0.75em;
}

.kklv-day-toggle-icon--open {
	transform: translateY(25%) rotate(-135deg);
}

.kklv-day-content {
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.25s ease;
	padding: 0 0.25rem;
}

.kklv-day-content--open {
	max-height: 1200px;
	padding-bottom: 1.25rem;
}

/* Below the list: when it was updated + the restaurant's own page */
.kklv-panel-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.5rem 1.5rem;
	margin-top: 1.25rem;
}

.kklv-updated-at {
	margin: 0;
	font-size: 0.85rem;
	color: var(--kklv-muted);
}

.kklv-source-link {
	margin: 0;
	font-size: 0.95rem;
}

.kklv-source-link a {
	font-weight: 700;
	color: var(--kklv-primary);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.kklv-source-link a:hover {
	text-decoration: none;
}

/* --- Korttinäkymä ([kklv_lounaslistat layout="cards"]) --------------------- */

.kklv-lounaslistat--cards {
	margin: 0;
	padding: 1.25rem 0 0.75rem;
	background: var(--kklv-surface-strong);
}

/* Title centred, CTA in the right column. Width matches a row of four cards so the
   CTA lines up with the last card's edge. Stacks below 1024px (see bottom). */
.kklv-cards-header {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	column-gap: 1.5rem;
	margin: 0 auto 2rem;
	padding: 0 1rem;
	max-width: calc(4 * 260px + 3 * 1.1rem + 2rem);
	box-sizing: border-box;
}

.kklv-cards-header > .kklv-cards-heading {
	grid-column: 2;
}

.kklv-cards-title {
	margin: 0;
	font-size: clamp(2rem, 2vw + 1.2rem, 3rem);
	line-height: 1.1;
	font-weight: 800;
	letter-spacing: -0.03em;
	color: var(--kklv-primary);
	text-align: center;
}

.kklv-cards-heading {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
}

.kklv-cards-date {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--kklv-primary);
	text-align: center;
}

.kklv-cards-cta {
	grid-column: 3;
	justify-self: end;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	padding: 0.8rem 1.2rem 0.8rem 1.4rem;
	border-radius: 0;
	background: var(--kklv-primary);
	color: #fff;
	font-weight: 700;
	font-size: 1.05rem;
	line-height: 1;
	text-decoration: none;
	transition: opacity 0.2s ease;
}

.kklv-cards-cta:hover {
	opacity: 0.92;
	color: #fff;
}

.kklv-cards-cta span {
	font-size: 1.7rem;
	line-height: 1;
	transform: translateY(-1px);
}

.kklv-cards-grid {
	display: flex;
	gap: 1.1rem;
	overflow-x: auto;
	padding: 0 1rem 0.5rem;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
}

/* Centre the row while it fits; auto margins collapse to 0 once it overflows, so
   scrolling still starts at the first card (justify-content: center would clip it). */
.kklv-card:first-child {
	margin-left: auto;
}

.kklv-card:last-child {
	margin-right: auto;
}

.kklv-cards-grid::-webkit-scrollbar {
	height: 8px;
}

.kklv-cards-grid::-webkit-scrollbar-thumb {
	background: rgba(25, 73, 148, 0.35);
	border-radius: 999px;
}

.kklv-card {
	flex: 0 0 260px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-width: 0;
	border-radius: var(--kklv-radius);
	background: rgba(255, 255, 255, 0.72);
	border: 1px solid var(--kklv-line);
	box-shadow: 0 6px 14px rgba(15, 42, 71, 0.08);
	scroll-snap-align: start;
}

.kklv-card-image-wrap {
	display: block;
	background: var(--kklv-surface);
	min-height: 220px;
}

.kklv-card-image {
	display: block;
	width: 100%;
	height: 220px;
	object-fit: cover;
	background: var(--kklv-surface);
}

.kklv-card-image--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--kklv-surface);
	font-size: 3rem;
	font-weight: 800;
	color: var(--kklv-primary);
}

.kklv-card-body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto; /* fill the card so the link's margin-top: auto pins it to the bottom */
	gap: 0.75rem;
	padding: 0.95rem 1rem 1rem;
	min-width: 0;
}

.kklv-card-title {
	margin: 0;
	font-size: 1.05rem;
	line-height: 1.3;
	font-weight: 700;
	color: var(--kklv-primary);
	text-align: center;
}

.kklv-card-title a {
	color: inherit;
	text-decoration: none;
}

.kklv-card-items {
	margin: 0;
	padding-left: 1.15rem;
	color: var(--kklv-text);
	font-size: 0.95rem;
	line-height: 1.5;
	max-width: 100%;
}

.kklv-card-items li {
	overflow-wrap: anywhere;
	word-break: break-word;
}

.kklv-card-items li + li {
	margin-top: 0.2rem;
}

.kklv-card-empty {
	margin: 0;
	color: var(--kklv-muted);
	font-style: italic;
	text-align: center;
}

.kklv-card-link {
	margin-top: auto;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--kklv-primary);
	text-decoration: none;
	text-align: center;
}

@media (max-width: 1023px) {
	.kklv-cards-header {
		grid-template-columns: 1fr;
		row-gap: 1.25rem;
		justify-items: center;
	}

	.kklv-cards-header > .kklv-cards-heading,
	.kklv-cards-cta {
		grid-column: 1;
	}

	.kklv-cards-cta {
		justify-self: center;
	}
}

@media (max-width: 768px) {
	.kklv-cards-header {
		padding: 0 0.5rem;
	}

	.kklv-cards-cta {
		padding: 0.7rem 1rem;
		font-size: 0.9rem;
	}

	.kklv-card {
		flex-basis: 230px;
	}
}
