/* ============================================================
   VG price comparison table (.vg-price-table)

   Scoped under .summary so width/padding beat the theme's
   `.summary table` rules. Specificity 0,2,x > theme's 0,1,x.
   ============================================================ */
.summary .vg-price-table {
	--vg-accent: #c8a24a;
	--vg-accent-bg: #fbf6ea;
	--vg-border: #e6e6e6;
	--vg-muted: #6b6b6b;
	width: 100%;
	max-width: 640px;
	box-sizing: border-box;
	border-collapse: collapse;
	font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	color: #222;
}

/* Caption stays display:table-caption here (the default).
   Do NOT set display:block at this width — a block-level child of a
   display:table box gets wrapped in an anonymous table-cell/row, which pulls
   the caption inside the table and breaks the desktop layout. The block
   override belongs in the media query below, where the table itself is
   display:block. */
.summary .vg-price-table caption {
	text-align: left;
	font-size: 13px;
	color: var(--vg-muted);
	padding-bottom: .75em;
	box-sizing: border-box;
}

.summary .vg-price-table th,
.summary .vg-price-table td {
	padding: 12px 14px;
	text-align: right;
	border-bottom: 1px solid var(--vg-border);
}
.summary .vg-price-table th:first-child,
.summary .vg-price-table td:first-child {
	text-align: left;
}
.summary .vg-price-table thead th {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--vg-muted);
	border-bottom: 2px solid #d9d9d9;
}
.summary .vg-price-table .vg-regular {
	color: var(--vg-muted);
	text-decoration: line-through;
}
.summary .vg-price-table .vg-save {
	font-weight: 600;
	color: #2e7d32;
}
.summary .vg-price-table tr.vg-best td {
	background: var(--vg-accent-bg);
	border-top: 2px solid var(--vg-accent);
	border-bottom: 2px solid var(--vg-accent);
}
.summary .vg-price-table tr.vg-best td:first-child {
	position: relative;
	font-weight: 700;
}
.summary .vg-price-table .vg-badge {
	display: inline-block;
	padding: 6px 8px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .03em;
	text-transform: uppercase;
	color: #fff;
	background: var(--vg-accent);
	border-radius: 10px;
	vertical-align: middle;
}
.summary .vg-price-table tr.vg-best .vg-permonth {
	font-weight: 700;
	color: #222;
}

/* The chevron only exists in accordion mode. */
.summary .vg-price-table .vg-chevron {
	display: none;
}

/* Author-level [hidden]. The UA stylesheet's `[hidden] { display: none }` would
   otherwise LOSE to our `display: flex` on td below, and the accordion would
   never actually collapse. */
.summary .vg-price-table td[hidden] {
	display: none !important;
}

/* --- Responsive: stack into cards / accordion on narrow screens --- */
@media (max-width: 560px) {
	.summary .vg-price-table {
		font-size: 14px;
		max-width: 100%;
	}

	/* Hide the header row visually but keep it for screen readers. */
	.summary .vg-price-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	/* Block-ify the table. The caption MUST be included here, otherwise Chrome
	   shrink-wraps an anonymous table box around the still-table-caption
	   element and the text renders in a narrow column. Firefox stretches it
	   instead — that engine divergence is the bug this line fixes. */
	.summary .vg-price-table,
	.summary .vg-price-table caption,
	.summary .vg-price-table tbody,
	.summary .vg-price-table tr,
	.summary .vg-price-table td {
		display: block;
		width: 100%;
		box-sizing: border-box;
	}

	.summary .vg-price-table tr {
		border: 1px solid var(--vg-border);
		border-radius: 8px;
		padding: 6px 4px;
		margin-bottom: 14px;
	}
	.summary .vg-price-table tr.vg-best {
		border: 2px solid var(--vg-accent);
		background: var(--vg-accent-bg);
	}
	.summary .vg-price-table td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		gap: 12px;
		text-align: right;
		border: 0;
		border-bottom: 1px solid var(--vg-border);
		padding: 9px 14px;
	}
	.summary .vg-price-table tr td:last-child {
		border-bottom: 0;
	}
	.summary .vg-price-table tr.vg-best td {
		background: transparent;
		border-top: 0;
		border-bottom: 1px solid rgba(200, 162, 74, .35);
	}
	.summary .vg-price-table tr.vg-best td:last-child {
		border-bottom: 0;
	}

	/* Show the column name as a label before each value. */
	.summary .vg-price-table td::before {
		content: attr(data-label);
		font-size: 12px;
		text-transform: uppercase;
		letter-spacing: .03em;
		color: var(--vg-muted);
		text-align: left;
		font-weight: 600;
	}

	/* First cell (option name) acts as a card heading. */
	.summary .vg-price-table td:first-child {
		font-size: 16px;
		font-weight: 700;
		background: rgba(0, 0, 0, .02);
		border-radius: 6px;
	}
	.summary .vg-price-table td:first-child::before {
		content: none;
	}
	.summary .vg-price-table tr.vg-best td:first-child {
		background: transparent;
	}

	/* --- Accordion (JS adds .vg-is-accordion) --- */
	.summary .vg-price-table.vg-is-accordion td:first-child {
		cursor: pointer;
		user-select: none;
		gap: 8px;
	}
	.summary .vg-price-table.vg-is-accordion td:first-child:focus-visible {
		outline: 2px solid var(--vg-accent);
		outline-offset: 2px;
	}
	.summary .vg-price-table.vg-is-accordion tr:not(.is-open) td:first-child {
		border-bottom: 0;
	}
	.summary .vg-price-table.vg-is-accordion .vg-chevron {
		display: block;
		flex: 0 0 auto;
		margin-left: auto;
		width: 9px;
		height: 9px;
		border-right: 2px solid var(--vg-muted);
		border-bottom: 2px solid var(--vg-muted);
		transform: rotate(45deg) translate(-2px, -2px);
		transition: transform .2s ease;
	}
	.summary .vg-price-table.vg-is-accordion tr.is-open .vg-chevron {
		transform: rotate(-135deg) translate(-2px, -2px);
	}
	.summary .vg-price-table.vg-is-accordion .vg-badge {
		flex: 0 0 auto;
	}
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
	.summary .vg-price-table .vg-chevron {
		transition: none;
	}
}
