/**
 * Bandwidth Estimator — Encore-branded styles.
 *
 * All colors/spacing/type are CSS custom properties on .bwe-calculator, so
 * the whole thing can be re-themed from a child theme without touching this
 * file — just redeclare the variables you want to change, e.g.:
 *
 *   .bwe-calculator { --bwe-blue: #0060a3; }
 *
 * Category colors are Encore's own brand palette (see the theme's
 * _mixins.scss $blue / $light_blue / $purple / $pink / $yellow / $green) —
 * six distinct hues so the six categories are visually distinguishable, not
 * a single-hue gradient.
 *
 * Font stack assumes Open Sans is already loaded by the Encore theme (it
 * is, site-wide); falls back cleanly to the system UI font if not.
 */

.bwe-calculator {
	/* Brand palette */
	--bwe-dark-blue: #1f1646;
	--bwe-blue: #1b75bc;
	--bwe-light-blue: #00bfde;
	--bwe-purple: #a7549f;
	--bwe-pink: #e7018a;
	--bwe-yellow: #f29835;
	--bwe-green: #93c94e;
	--bwe-gray: #d1d3d5;
	--bwe-bg-muted: #f5f6f7;

	/* Category → color assignment (used by the bar, legend, card icons) */
	--bwe-tab1: var(--bwe-blue);
	--bwe-tab2: var(--bwe-light-blue);
	--bwe-tab3: var(--bwe-purple);
	--bwe-tab4: var(--bwe-pink);
	--bwe-tab5: var(--bwe-yellow);
	--bwe-tab6: var(--bwe-green);

	--bwe-radius-lg: 16px;
	--bwe-radius-md: 10px;
	--bwe-radius-pill: 999px;
	--bwe-shadow: 0 2px 16px rgba(31, 22, 70, 0.08);
	--bwe-font: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	max-width: 1120px;
	margin: 0 auto;
	color: var(--bwe-dark-blue);
	font-family: var(--bwe-font);
	font-size: 16px;
	line-height: 1.5;
	box-sizing: border-box;
}

.bwe-calculator *,
.bwe-calculator *::before,
.bwe-calculator *::after {
	box-sizing: inherit;
}

/* This site doesn't render plain `font-weight` correctly (see the other
   font-variation-settings rules throughout this file) — <strong>/<b> rely
   on the browser's default `font-weight: bolder`, so without this they'd
   render as regular weight here. */
.bwe-calculator strong,
.bwe-calculator b {
	font-weight: normal;
	font-variation-settings: "wght" 700;
}

/* Several elements below set their own `display` (flex/inline-flex) for
   their visible state, which — being an author rule — otherwise beats the
   browser's default `[hidden] { display: none }` UA rule when both apply.
   This guarantees the hidden attribute always wins. */
.bwe-calculator [hidden] {
	display: none !important;
}

/* Defensive reset: the host theme may apply its own custom list-bullet
   styling (e.g. a ::before "content" diamond/square) to <li> elements
   site-wide, which `list-style: none` alone does not suppress — that only
   removes the native ::marker box. Scoped to this widget only. */
.bwe-calculator ul,
.bwe-calculator ol {
	list-style: none;
	margin: 0;
	padding: 0;
}

.bwe-calculator li::marker {
	content: none !important;
}

.bwe-calculator li::before {
	content: none !important;
}

.bwe-noscript {
	padding: 16px;
	background: #fff4e5;
	border: 1px solid var(--bwe-yellow);
	border-radius: var(--bwe-radius-md);
	margin-bottom: 20px;
}

.bwe-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------------- */
/* Header                                                                  */
/* ---------------------------------------------------------------------- */

.bwe-header {
	margin-bottom: 28px;
}

.bwe-title {
	margin: 0 0 8px;
	font-size: 1.9em;
	font-variation-settings: "wght" 700;
	color: var(--bwe-dark-blue);
}

.bwe-subtitle {
	margin: 0;
	color: #555;
}

/* ---------------------------------------------------------------------- */
/* How it works — compact 3-step strip                                    */
/* ---------------------------------------------------------------------- */

/* Specificity note: must beat ".bwe-calculator ol" (the defensive list-style
   reset above, a class+type selector) or its `padding: 0; margin: 0;` wins
   and this box's spacing collapses back to zero no matter what's set below.
   ".bwe-calculator .bwe-steps" (two classes) outranks it. Confirmed via live
   DevTools inspection — the plain ".bwe-steps" version was always losing. */
.bwe-calculator .bwe-steps {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
	list-style: none;
	margin: 0 0 40px;
	padding: 20px 24px;
	background: var(--bwe-bg-muted);
	border-radius: var(--bwe-radius-lg);
}

.bwe-step {
	display: flex;
	gap: 14px;
	align-items: flex-start;
}

.bwe-step-num {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 100%;
	background: var(--bwe-blue);
	color: #fff;
	font-size: 0.8em;
    font-variation-settings: "wght" 700;
	margin-top: 1px;
}

.bwe-step-text {
	min-width: 0;
}

.bwe-step-label {
	margin: 0 0 2px;
	font-size: 0.85em;
    font-variation-settings: "wght" 700;
	color: var(--bwe-dark-blue);
}

.bwe-step-text p:last-child {
	margin: 0;
	font-size: 0.8em;
	line-height: 1.4;
	color: #666;
}

@media (max-width: 780px) {
	.bwe-steps {
		grid-template-columns: 1fr;
		gap: 14px;
	}
}

/* ---------------------------------------------------------------------- */
/* Layout: cards + sticky summary                                         */
/* ---------------------------------------------------------------------- */

.bwe-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: 24px;
	align-items: start;
}

@media (min-width: 900px) {
	.bwe-layout {
		grid-template-columns: 1fr 340px;
	}

	/* Summary comes second in the DOM (for a sane mobile reading order) but
	   should sit on the right on desktop. Targets both the plain element
	   (no-JS / before JS runs) and the wrapper JS inserts around it. */
	.bwe-cards {
		order: 1;
	}

	.bwe-summary,
	.bwe-summary-col {
		order: 2;
	}
}

/* JS wraps .bwe-summary in this at runtime so its grid column keeps its
   width/height reserved while the summary itself switches to
   position:fixed for scroll-proof sticking. Inert/no-op if JS never runs. */
.bwe-summary-col {
	min-width: 0;
}

.bwe-summary-placeholder {
	visibility: hidden;
}

.bwe-cards {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
}

/* ---------------------------------------------------------------------- */
/* Category cards                                                         */
/* ---------------------------------------------------------------------- */

.bwe-card {
	background: #fff;
	border: 1px solid var(--bwe-gray);
	border-radius: var(--bwe-radius-lg);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bwe-card.is-on {
	border-color: var(--bwe-accent, var(--bwe-blue));
	box-shadow: var(--bwe-shadow);
}

.bwe-card-header {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px 20px;
}

.bwe-card-icon {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 100%;
	background: var(--bwe-bg-muted);
	color: var(--bwe-gray);
	transition: background-color 0.15s ease, color 0.15s ease;
}

.bwe-card.is-on .bwe-card-icon {
	background: var(--bwe-bg-muted); /* fallback for browsers without color-mix() */
	background: color-mix(in srgb, var(--bwe-accent) 14%, white);
	color: var(--bwe-accent);
}

.bwe-card-icon svg {
	width: 20px;
	height: 20px;
}

.bwe-card-heading {
	flex: 1 1 auto;
	min-width: 0;
}

.bwe-card-heading h3 {
	margin: 0;
	font-size: 1.05em;
    font-variation-settings: "wght" 700;
}

.bwe-card-heading p {
	margin: 2px 0 0;
	font-size: 0.85em;
	color: #666;
}

/* Toggle switch */

.bwe-switch {
	flex: 0 0 auto;
	position: relative;
	display: inline-flex;
	cursor: pointer;
}

.bwe-switch input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
}

.bwe-switch-track {
	width: 44px;
	height: 26px;
	background: var(--bwe-gray);
	border-radius: var(--bwe-radius-pill);
	position: relative;
	pointer-events: none; /* clicks must go to the real checkbox underneath */
	transition: background-color 0.15s ease;
}

.bwe-switch-thumb {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	background: #fff;
	border-radius: 100%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.15s ease;
}

.bwe-switch input:checked + .bwe-switch-track {
	background: var(--bwe-blue);
}

.bwe-switch input:checked + .bwe-switch-track .bwe-switch-thumb {
	transform: translateX(18px);
}

.bwe-switch input:focus-visible + .bwe-switch-track {
	outline: 3px solid var(--bwe-purple);
	outline-offset: 2px;
}

/* Card body / fields */

.bwe-card-body {
	padding: 4px 20px 20px;
	display: flex;
	flex-direction: column;
	gap: 18px;
	border-top: 1px solid var(--bwe-gray);
	margin-top: 2px;
	padding-top: 18px;
}

.bwe-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.bwe-field label,
.bwe-field-label {

	font-size: 0.9em;
}

.bwe-input-unit {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	width: fit-content;
}

.bwe-input-unit input[type="number"] {
	width: 100px;
	height: 42px;
	padding: 4px 10px;
	border: 1.5px solid var(--bwe-gray);
	border-radius: var(--bwe-radius-md);
	background: #fff;
	font-size: 1em;
	font-family: inherit;
	color: var(--bwe-dark-blue);
}

.bwe-input-unit input[type="number"]:focus-visible {
	outline: none;
	border-color: var(--bwe-blue);
	box-shadow: 0 0 0 3px rgba(27, 117, 188, 0.35); /* fallback for browsers without color-mix() */
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--bwe-blue) 20%, transparent);
}

.bwe-input-unit span {
	font-size: 0.85em;
	color: #666;
	white-space: nowrap;
}

.bwe-hint {
	margin: 0;
	font-size: 0.8em;
	color: #666;
}

.bwe-hint[data-tier-hint-group] {
	min-height: 1px; /* avoid a layout jump when the visible line wraps to a different number of lines */
}

.bwe-tier-hint p {
	margin: 0;
}

/* Bullet lists inside .bwe-hint / .bwe-tier-hint (plain field guidance, or
   the per-tier breakdown swapped in/out by updateTierHints() in the JS)
   and inside .bwe-more-content (the "Read more" panels below) need a plain
   default bullet (a small round dot, in the same muted text color as the
   line itself — no color accent, no divider).
   Deliberately NOT built as <ul>/<li>: the Encore theme injects its own
   diamond bullet on <li> site-wide, and the defensive reset above (scoped
   to `.bwe-calculator li::marker` / `::before`) wasn't reliably beating it
   in every browser even with `!important` — the theme's marker kept
   showing through alongside ours. Rather than keep fighting that cascade
   war blind, these rows are plain <div>/<p> (.bwe-bullet-list /
   .bwe-bullet-item) — the theme's li-scoped rule simply can't match them,
   so there's nothing to override. */

.bwe-bullet-item {
	position: relative;
	margin: 0;
	padding-left: 14px;
}

.bwe-bullet-item + .bwe-bullet-item {
	margin-top: 2px;
}

.bwe-bullet-item::before {
	content: "\2022"; /* • */
	position: absolute;
	left: 0;
	color: currentColor;
}

/* "Read more" disclosure: native <details>/<summary>, so opening/closing
   needs no JS of our own — just styled to match the rest of the card. */

.bwe-more {
	font-size: 0.8em;
}

.bwe-more summary {
	cursor: pointer;
	color: var(--bwe-blue);
	font-variation-settings: "wght" 700;
	list-style: none;
	width: fit-content;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.bwe-more summary::-webkit-details-marker {
	display: none;
}

.bwe-more summary::after {
	content: "▾";
	font-size: 0.85em;
	transition: transform 0.15s ease;
}

.bwe-more[open] summary::after {
	transform: rotate(180deg);
}

.bwe-more-content {
	margin-top: 8px;
	padding: 12px 14px;
	background: var(--bwe-bg-muted);
	border-radius: var(--bwe-radius-md);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.bwe-more-content .bwe-bullet-item {
	color: #555;
}

/* Segmented control (styled radio group) */

.bwe-segmented {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 6px;
	background: var(--bwe-bg-muted);
	padding: 4px;
	border-radius: var(--bwe-radius-pill);
	width: fit-content;
}

.bwe-segmented-option {
	position: relative;
	cursor: pointer;
}

.bwe-segmented-option input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.bwe-segmented-option span {
	display: inline-block;
	padding: 8px 16px;
	border-radius: var(--bwe-radius-pill);
	font-size: 0.85em;
	font-variation-settings: "wght" 700;
	color: var(--bwe-dark-blue);
	transition: background-color 0.15s ease, color 0.15s ease;
	white-space: nowrap;
}

.bwe-segmented-option input:checked + span {
	background: var(--bwe-blue);
	color: #fff;
}

.bwe-segmented-option input:focus-visible + span {
	outline: 3px solid var(--bwe-purple);
	outline-offset: 1px;
}

/* ---------------------------------------------------------------------- */
/* Summary panel                                                          */
/* ---------------------------------------------------------------------- */

.bwe-summary {
	position: sticky;
	top: 30px;
	background: var(--bwe-dark-blue);
	color: #fff;
	border-radius: var(--bwe-radius-lg);
	padding: 24px;
}

.bwe-summary-label {
	margin: 0 0 4px;
	font-size: 0.8em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.7;
	font-variation-settings: "wght" 700;
}

.bwe-summary-total {
	margin: 0 0 18px;
	font-size: 2.1em;
	font-variation-settings: "wght" 700;
	line-height: 1.1;
}

.bwe-bar {
	display: flex;
	overflow: hidden;
	width: 100%;
	height: 10px;
	border-radius: var(--bwe-radius-pill);
	background: rgba(255, 255, 255, 0.15);
	margin-bottom: 16px;
}

.bwe-bar-seg {
	display: block;
	height: 100%;
	width: 0%;
	transition: width 0.25s ease;
}

.bwe-legend {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 260px;
	overflow-y: auto;
}

.bwe-legend-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	font-size: 0.85em;
	border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.bwe-legend-row:last-child {
	border-bottom: 0;
}

.bwe-legend-swatch {
	flex: 0 0 auto;
	width: 10px;
	height: 10px;
	border-radius: 100%;
}

.bwe-legend-label {
	flex: 1 1 auto;
	opacity: 0.85;
}

.bwe-legend-value {
	flex: 0 0 auto;
	font-variation-settings: "wght" 700;
}

.bwe-summary-empty {
	margin: 4px 0 0;
	font-size: 0.85em;
	opacity: 0.7;
	font-variation-settings: "wght" 700;

}

.bwe-cta {
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid rgba(255, 255, 255, 0.15);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.bwe-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--bwe-radius-pill);
	padding: 12px 20px;
	font-size: 0.9em;
	font-variation-settings: "wght" 700;
	text-decoration: none;
	cursor: pointer;
	border: 0;
	font-family: inherit;
	text-align: center;
}

.bwe-btn-primary {
	background: var(--bwe-purple);
	color: #fff;
}

.bwe-btn-primary:hover,
.bwe-btn-primary:focus-visible {
	background: var(--bwe-dark-blue); /* fallback for browsers without color-mix() */
	background: color-mix(in srgb, var(--bwe-purple) 85%, black);
}

.bwe-btn-text {
	background: transparent;
	color: rgba(255, 255, 255, 0.75);
	padding: 6px 4px;
}

.bwe-btn-text:hover,
.bwe-btn-text:focus-visible {
	color: #fff;
	text-decoration: underline;
}

.bwe-btn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                             */
/* ---------------------------------------------------------------------- */

@media (max-width: 899px) {
	.bwe-summary {
		position: static;
	}

	.bwe-legend {
		max-height: none;
	}
}

@media (max-width: 480px) {
	.bwe-summary-total {
		font-size: 1.7em;
	}

	.bwe-card-header {
		padding: 16px;
	}

	.bwe-card-body {
		padding-left: 16px;
		padding-right: 16px;
	}
}
