/* =========================================================================
 * DriveCrate — plan selector ([drivecrate_plans], [drivecrate_price])
 *
 * Markup and class names follow the PDP prototype. Everything is scoped to
 * .dc-plans, apart from the rules that show the selected plan's values,
 * which also reach [drivecrate_price] anywhere on the page.
 * ====================================================================== */

/* -------------------------------------------------------------------------
 * Selected plan. Each value is printed once per plan; only the selected
 * plan's shows. Works from the checked radio alone (no JavaScript needed);
 * plans.js also sets html[data-dc-plan] for browsers without :has().
 * With no selector on the page, the default plan's value shows.
 * ---------------------------------------------------------------------- */
[data-dc-show] { display: none; }

body:not(:has(.dc-plans input:checked)) [data-dc-default],
body:has(.dc-plans input[value="oneoff"]:checked) [data-dc-show="oneoff"],
body:has(.dc-plans input[value="1"]:checked) [data-dc-show="1"],
body:has(.dc-plans input[value="2"]:checked) [data-dc-show="2"],
body:has(.dc-plans input[value="3"]:checked) [data-dc-show="3"],
body:has(.dc-plans input[value="4"]:checked) [data-dc-show="4"],
body:has(.dc-plans input[value="6"]:checked) [data-dc-show="6"],
body:has(.dc-plans input[value="12"]:checked) [data-dc-show="12"],
body:has(.dc-plans input[value="24"]:checked) [data-dc-show="24"] { display: revert; }

/* Separate rule: a browser without :has() drops the whole rule above. */
html[data-dc-plan="oneoff"] [data-dc-show="oneoff"],
html[data-dc-plan="1"] [data-dc-show="1"],
html[data-dc-plan="2"] [data-dc-show="2"],
html[data-dc-plan="3"] [data-dc-show="3"],
html[data-dc-plan="4"] [data-dc-show="4"],
html[data-dc-plan="6"] [data-dc-show="6"],
html[data-dc-plan="12"] [data-dc-show="12"],
html[data-dc-plan="24"] [data-dc-show="24"] { display: revert; }

/* A price waiting for the visitor's zone on a cached page: hidden, but
   keeping its space so nothing moves when it arrives. */
.dc-wait { visibility: hidden; }

.dc-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}

/* -------------------------------------------------------------------------
 * Tokens (from the prototype)
 * ---------------------------------------------------------------------- */
.dc-plans {
	--navy: #0A1E4A;
	--blue: #2749B6;
	--lime: #C6F63A;
	--lime-ink: #1F3300;
	--paper: #F2F4F9;
	--mist: #D9DFEC;
	--ink: #0A1E4A;
	--ink-soft: #4C5878;

	color: var(--ink);
	line-height: 1.5;
}
.dc-plans *,
.dc-plans *::before,
.dc-plans *::after { box-sizing: border-box; }
.dc-plans :focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }

/* -------------------------------------------------------------------------
 * Live price
 * ---------------------------------------------------------------------- */
.dc-plans .price-now { display: flex; align-items: baseline; gap: 10px; margin: 20px 0 4px; flex-wrap: wrap; }
.dc-plans .price-now strong { font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1; color: #0A1E4A; }
/* The theme may colour WooCommerce price markup; keep the large price navy. */
.dc-plans .price-now strong .woocommerce-Price-amount,
.dc-plans .price-now strong .woocommerce-Price-currencySymbol { color: inherit; }
.dc-plans .price-now .unit { font-size: 15px; color: var(--ink-soft); }
.dc-plans .price-now .save { background: var(--lime); color: var(--lime-ink); font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.dc-plans .price-sub { font-size: 14px; color: var(--ink-soft); min-height: 21px; margin: 0; }

/* -------------------------------------------------------------------------
 * Options
 * ---------------------------------------------------------------------- */
.dc-plans .opts { display: grid; gap: 8px; margin: 18px 0 16px; padding: 0; border: 0; min-width: 0; }
.dc-plans .opt-wrap { position: relative; }
.dc-plans .opt-tag { position: absolute; top: -9px; right: 16px; z-index: 2; background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; line-height: 1.4; }
.dc-plans .opt {
	display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 12px; align-items: center;
	margin: 0; border: 1.5px solid var(--mist); border-radius: 14px; padding: 13px 15px; cursor: pointer; background: #fff;
	transition: border-color .12s ease, background .12s ease;
}
.dc-plans .opt:hover { border-color: var(--ink-soft); }
.dc-plans .opt input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--mist); margin: 0; cursor: pointer; background: #fff; }
.dc-plans .opt input:checked { border-color: var(--blue); background: radial-gradient(circle, var(--blue) 0 42%, #fff 46% 100%); }
.dc-plans .opt:has(input:checked) { border-color: var(--navy); background: var(--paper); }
.dc-plans .opt .lbl { display: grid; gap: 2px; min-width: 0; }
.dc-plans .opt .lbl b { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.dc-plans .opt .lbl span { font-size: 13px; color: var(--ink-soft); }
.dc-plans .opt .rt { text-align: right; white-space: nowrap; display: grid; gap: 2px; }
.dc-plans .opt .rt b { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.dc-plans .opt .rt i { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--lime-ink); background: var(--lime); padding: 2px 8px; border-radius: 999px; justify-self: end; }
.dc-plans .opt .rt i.flat { background: var(--paper); color: var(--ink-soft); font-weight: 600; }

/* -------------------------------------------------------------------------
 * The prepaid terms: one row of cards under the full-width options. As many
 * equal columns as there are terms; the same radio and the same selected
 * state as a row, so nothing else has to know the difference.
 * ---------------------------------------------------------------------- */
.dc-plans .opts-more { margin: 10px 0 4px; font-size: 13px; color: var(--ink-soft); }
.dc-plans .opts-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.dc-plans .opts-row .opt-wrap { display: flex; }
.dc-plans .opts-row .opt-tag { right: 10px; }
.dc-plans .opt--card {
	display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
	flex: 1 1 auto; min-width: 0; padding: 15px 13px 13px;
}
.dc-plans .opt--card .hd { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dc-plans .opt--card .hd input { flex: 0 0 auto; }
.dc-plans .opt--card .hd b { font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.dc-plans .opt--card .pr b { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
/* Direct child only: the price itself is WooCommerce markup, spans and all. */
.dc-plans .opt--card .pr > span { font-size: 12px; color: var(--ink-soft); }
.dc-plans .opt--card > i { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--lime-ink); background: var(--lime); padding: 2px 8px; border-radius: 999px; }

/* -------------------------------------------------------------------------
 * Button
 * ---------------------------------------------------------------------- */
.dc-plans .btn {
	display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 4px;
	padding: 15px 28px; border-radius: 12px; border: 2px solid transparent;
	font: inherit; font-weight: 700; font-size: 17px; line-height: 1.15; text-align: center; cursor: pointer;
	transition: transform .12s ease, background .12s ease;
}
.dc-plans .btn:active { transform: translateY(1px); }
.dc-plans .btn-lime { background: var(--lime); color: var(--lime-ink); }
.dc-plans .btn-lime:hover { background: #D5FF5A; }
.dc-plans .btn[aria-busy="true"] { opacity: .7; cursor: progress; }

/* -------------------------------------------------------------------------
 * Notices
 * ---------------------------------------------------------------------- */
.dc-plans-member,
.dc-plans-empty { padding: 13px 15px; border-radius: 12px; background: #F2F4F9; color: #0A1E4A; font-size: 14px; }
.dc-plans-member a { font-weight: 700; }

@media (max-width: 560px) {
	.dc-plans .price-now strong { font-size: 38px; }
	.dc-plans .opt { grid-template-columns: 18px minmax(0, 1fr) auto; padding: 11px 13px; gap: 10px; }
	.dc-plans .opt .lbl b { font-size: 15px; }
	.dc-plans .opt .rt b { font-size: 16px; }
	.dc-plans .opts-row { gap: 6px; }
	.dc-plans .opts-row .opt-tag { right: 6px; padding: 2px 7px; font-size: 10.5px; }
	.dc-plans .opt--card { padding: 14px 8px 11px; }
	.dc-plans .opt--card .hd { gap: 5px; }
	.dc-plans .opt--card .hd input { width: 16px; height: 16px; }
	.dc-plans .opt--card .hd b { font-size: 13.5px; }
	.dc-plans .opt--card .pr b { font-size: 16px; }
	.dc-plans .opt--card .pr > span { font-size: 11.5px; }
}

/* Too narrow for three across: one card to a row, laid out like the rows above. */
@media (max-width: 380px) {
	.dc-plans .opts-row { grid-auto-flow: row; grid-auto-columns: auto; gap: 8px; }
	.dc-plans .opts-row .opt-tag { right: 16px; }
	.dc-plans .opt--card { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 11px 13px; }
	.dc-plans .opt--card .pr { margin-left: auto; }
}

/* -------------------------------------------------------------------------
 * [drivecrate_prepaid_plans]: the prepaid terms as a row of cards, each with
 * its own button. The featured term (the longest, unless told otherwise) is
 * picked out with a navy outline, a tag and the lime button.
 * ---------------------------------------------------------------------- */
.dc-terms {
	--navy: #0A1E4A;
	--lime: #C6F63A;
	--lime-ink: #1F3300;
	--mist: #D9DFEC;
	--ink: #0A1E4A;
	--ink-soft: #4C5878;

	display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px;
	padding-top: 14px; /* room for the featured tag */
	color: var(--ink); line-height: 1.5;
}
.dc-terms *,
.dc-terms *::before,
.dc-terms *::after { box-sizing: border-box; }
.dc-terms :focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }

.dc-term {
	position: relative; display: flex; flex-direction: column; min-width: 0; margin: 0;
	padding: 30px 26px 26px; background: #fff;
	border: 1.5px solid var(--mist); border-radius: 26px;
}
.dc-term--featured { border: 2px solid var(--navy); box-shadow: 0 18px 40px -22px rgba(10, 30, 74, .45); }
.dc-term__tag {
	position: absolute; top: -14px; left: 24px;
	background: var(--lime); color: var(--lime-ink);
	font-size: 13px; font-weight: 700; line-height: 1.4; padding: 4px 12px; border-radius: 999px;
}
.dc-term .dc-term__title { margin: 0; padding: 0; font: inherit; font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; color: var(--ink); text-transform: none; }
.dc-term .dc-term__desc { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }
.dc-term .dc-term__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin: 14px 0 0; }
.dc-term__amount { font-size: 46px; font-weight: 700; letter-spacing: -.035em; line-height: 1.05; color: var(--ink); }
/* The theme may colour WooCommerce price markup; keep it the card's own. */
.dc-term .woocommerce-Price-amount,
.dc-term .woocommerce-Price-currencySymbol { color: inherit; font: inherit; }
.dc-term__note { font-size: 15px; color: var(--ink-soft); }
.dc-term .dc-term__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 12px 0 18px; }
.dc-term__per { font-size: 15px; font-weight: 600; white-space: nowrap; }
.dc-term__save { background: var(--lime); color: var(--lime-ink); font-size: 13px; font-weight: 700; line-height: 1.4; padding: 4px 11px; border-radius: 999px; white-space: nowrap; }
.dc-term .dc-term__btn {
	display: flex; align-items: center; justify-content: center; width: 100%; margin: auto 0 0;
	padding: 16px 20px; border: 2px solid transparent; border-radius: 12px;
	background: var(--navy); color: #fff;
	font: inherit; font-size: 17px; font-weight: 700; line-height: 1.15; text-align: center; text-transform: none; letter-spacing: 0;
	cursor: pointer; transition: transform .12s ease, background .12s ease;
}
.dc-term .dc-term__btn:hover { background: #16307A; color: #fff; }
.dc-term .dc-term__btn:active { transform: translateY(1px); }
.dc-term--featured .dc-term__btn { background: var(--lime); color: var(--lime-ink); }
.dc-term--featured .dc-term__btn:hover { background: #D5FF5A; color: var(--lime-ink); }
.dc-term .dc-term__btn[aria-busy="true"] { opacity: .7; cursor: progress; }

@media (max-width: 560px) {
	.dc-terms { gap: 22px; }
	.dc-term { padding: 26px 20px 20px; border-radius: 22px; }
	.dc-term .dc-term__title { font-size: 24px; }
	.dc-term__amount { font-size: 40px; }
}

@media (prefers-reduced-motion: reduce) {
	.dc-plans *,
	.dc-terms * { transition: none !important; }
}
