/* ==========================================================================
   Free basketball play board (/free-basketball-play-board/)
   ========================================================================== */

/* Hero: Figma pt 56, pb 48, gap 20 */
.bd-hero { padding-bottom: 48px; }
.bd-hero .page-hero__inner { gap: 20px; }
.bd-hero__title { max-width: 960px; }
.bd-hero__lead { max-width: 740px; }

/* --------------------------------------------------------------------------
   Board tool
   ----------------------------------------------------------------------- */
.bd-board-sec { padding-bottom: var(--sec-y); }

.bd-tool {
	--bd-blue: #2563eb;
	--bd-red: #dc2626;
	position: relative;
	display: grid;
	grid-template-columns: 216px minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr) 64px;
	height: 620px;
	border: 1px solid var(--border);
	border-radius: 18px;
	background: var(--panel);
	box-shadow: 0 24px 60px -10px rgba(21, 39, 59, .12);
	overflow: hidden;
	-webkit-user-select: none;
	user-select: none;
}

/* Palette ---------------------------------------------------------------- */
.bd-tool__palette {
	display: flex;
	flex-direction: column;
	gap: 18px;
	min-height: 0;
	padding: 14px 14px 18px;
	border-right: 1px solid var(--border);
	background: var(--white);
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}
.bd-group { display: flex; flex-direction: column; gap: 8px; }
.bd-tool button { touch-action: manipulation; }
.bd-group__label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--muted);
	line-height: normal;
}
.bd-group--tools { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }
.bd-sep { width: 1px; height: 22px; margin: 0 3px; background: var(--border); }

.bd-btn {
	display: inline-grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	color: var(--text);
	transition: background-color .2s, color .2s, opacity .2s;
}
.bd-btn:hover { background: var(--bg-alt); color: var(--ink); }
.bd-btn[aria-pressed="true"] { background: var(--orange-soft); color: var(--orange); }
.bd-btn:disabled { opacity: .35; cursor: default; background: none; }
.bd-btn:focus-visible,
.bd-token:focus-visible,
.bd-line:focus-visible,
.bd-seg button:focus-visible,
.bd-bar-btn:focus-visible { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px rgba(233, 106, 51, .55); }

.bd-tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.bd-tool .bd-token {
	touch-action: pan-y;
}
.bd-token {
	position: relative;
	display: inline-grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border: 2px solid var(--bd-blue);
	border-radius: 50%;
	background: var(--white);
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	color: var(--ink);
	cursor: grab;
	transition: transform .25s var(--ease), opacity .25s, box-shadow .25s, background-color .25s;
}
.bd-token:hover { transform: translateY(-2px); }
.bd-token--ball { border-color: #6b7280; border-width: 2.5px; background: #f1f5f9; }
.bd-token--def { border-color: var(--bd-red); font-size: 12px; }
.bd-token--def small { margin-left: 1px; font-size: 8.5px; font-weight: 700; transform: translateY(3px); }
.bd-token--def { display: inline-flex; align-items: center; justify-content: center; }
.bd-token.is-used { opacity: .45; }
.bd-token[aria-pressed="true"] { opacity: 1; background: var(--orange-soft); box-shadow: 0 0 0 3px rgba(233, 106, 51, .35); }

.bd-ghost {
	position: fixed;
	left: 0;
	top: 0;
	z-index: 1000;
	pointer-events: none;
	opacity: .9;
	box-shadow: 0 8px 18px -6px rgba(21, 39, 59, .45);
}

.bd-lines { display: flex; flex-direction: column; gap: 2px; }
.bd-line {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 6px 8px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	color: var(--text);
	text-align: left;
	transition: background-color .2s, color .2s;
}
.bd-line__sample { flex: none; color: var(--ink); }
.bd-line:hover { background: var(--bg-alt); }
.bd-line[aria-pressed="true"] { background: var(--orange-soft); color: var(--orange); }
.bd-line[aria-pressed="true"] .bd-line__sample { color: var(--orange); }

.bd-seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--panel); }
.bd-seg button {
	flex: 1 1 0;
	min-width: 64px;
	padding: 6px 12px;
	border-radius: 7px;
	font-size: 13px;
	font-weight: 600;
	color: var(--muted);
	transition: background-color .2s, color .2s, box-shadow .2s;
}
.bd-seg button[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(21, 39, 59, .14); }

.bd-hint { margin-top: auto; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* Stage ------------------------------------------------------------------ */
.bd-tool__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	min-height: 0;
	padding: 18px;
}
.bd-tool__svg {
	width: 100%;
	height: 100%;
	max-width: 100%;
	touch-action: none;
	cursor: default;
	-webkit-tap-highlight-color: transparent;
}
.bd-tool__svg .bd-item { cursor: grab; }
.bd-tool__svg .bd-handle { cursor: move; }
[data-mode-now="line"] .bd-tool__svg,
[data-mode-now="pen"] .bd-tool__svg,
[data-mode-now="line"] .bd-tool__svg .bd-item,
[data-mode-now="pen"] .bd-tool__svg .bd-item { cursor: crosshair; }
[data-mode-now="place"] .bd-tool__svg,
[data-mode-now="place"] .bd-tool__svg .bd-item { cursor: copy; }
[data-mode-now="text"] .bd-tool__svg,
[data-mode-now="text"] .bd-tool__svg .bd-item { cursor: text; }

.bd-tool__text {
	position: absolute;
	z-index: 3;
	width: 180px;
	padding: 6px 10px;
	border: 2px solid var(--orange);
	border-radius: 8px;
	background: var(--white);
	font: 600 15px/1.2 var(--font);
	color: var(--ink);
	transform: translate(-50%, -50%);
	box-shadow: 0 8px 20px -8px rgba(21, 39, 59, .35);
}
.bd-tool__text[hidden] { display: none; }

/* Bottom bar ------------------------------------------------------------- */
.bd-tool__bar {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 0 20px;
	border-top: 1px solid var(--border);
	background: var(--white);
}
.bd-tool__left { position: relative; display: flex; align-items: center; gap: 10px; }
.bd-tool__right { display: flex; align-items: center; gap: 12px; }
.bd-tool__note { font-size: 14px; color: var(--muted); line-height: normal; }
.bd-tool__cta { padding: 10px 22px; font-size: 15px; }

.bd-bar-btn {
	padding: 9px 14px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--white);
	font-size: 14px;
	font-weight: 500;
	line-height: normal;
	color: var(--ink);
	white-space: nowrap;
	transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.bd-bar-btn:hover { border-color: #cbd5e1; box-shadow: 0 6px 14px -8px rgba(21, 39, 59, .3); }
.bd-bar-btn--danger { border-color: #dc2626; background: #dc2626; color: var(--white); }
.bd-bar-btn--danger:hover { border-color: #b91c1c; background: #b91c1c; }

.bd-confirm {
	position: absolute;
	left: 0;
	bottom: calc(100% + 12px);
	z-index: 4;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 10px 10px 14px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--white);
	box-shadow: 0 16px 34px -12px rgba(21, 39, 59, .35);
	font-size: 14px;
	font-weight: 600;
	color: var(--ink);
	white-space: nowrap;
}
.bd-confirm[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Sections
   ----------------------------------------------------------------------- */
.bd-head { gap: 14px; }
.bd-head .h2 { max-width: 860px; }

/* How it works */
.bd-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.bd-step__num { font-size: 26px; font-weight: 800; line-height: normal; color: var(--orange); }
.bd-step__text { font-size: 15px; line-height: 1.5; color: var(--muted); }

/* Printable diagrams */
.bd-print__lead { max-width: 680px; }
.bd-diagrams { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.bd-diagram {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	padding: 24px;
	border: 1px solid var(--border);
	border-radius: 20px;
	background: var(--bg-alt);
	text-align: center;
	transition: transform .5s var(--ease), box-shadow .5s var(--ease), border-color .4s;
}
.js .bd-diagram.is-in { transition: opacity .9s var(--ease-out), transform .5s var(--ease), box-shadow .5s var(--ease), border-color .4s; transition-delay: 0s; }
.bd-diagram:hover { transform: translateY(-6px); border-color: #f3c3ad; box-shadow: 0 20px 40px -20px rgba(21, 39, 59, .22); }
.bd-diagram__art { display: grid; place-items: center; width: 240px; max-width: 100%; height: 226px; }
.bd-diagram__art img { width: auto; max-height: 100%; }
/* Preview of a whole PDF page (play sheet): shown as a sheet of paper */
.bd-diagram__art--page img { height: 100%; background: var(--white); border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 8px 18px -12px rgba(21, 39, 59, .35); }
.bd-diagram__desc { font-size: 14px; line-height: 1.45; color: var(--text); text-wrap: pretty; }
.bd-diagram__btn { margin-top: auto; }
.bd-diagram__text { display: flex; flex-direction: column; gap: 4px; line-height: normal; }
.bd-diagram__title { font-size: 19px; font-weight: 700; }
.bd-diagram__meta { font-size: 14px; color: var(--muted); }
.bd-diagram__meta a { text-decoration: underline; text-underline-offset: 2px; transition: color .25s; }
.bd-diagram__meta a:hover { color: var(--orange); }

/* Upgrade box (reuses .club from the homepage) */
.bd-upgrade-sec { padding-top: 0; }
/* After a grey section the box needs its own top space, otherwise it sticks to the colour edge. */
.section--alt + .bd-upgrade-sec { padding-top: var(--sec-y); }
/* One section gap between the box and the FAQ heading, not two. */
.bd-upgrade-sec + .faq { padding-top: 0; }
.bd-upgrade .club__text { gap: 18px; }
.bd-upgrade__title { max-width: 560px; }
.bd-upgrade__desc { max-width: 560px; }
.bd-upgrade__list {
	flex: none;
	display: flex;
	flex-direction: column;
	gap: 14px;
	width: 360px;
	max-width: 100%;
	font-size: 17px;
	font-weight: 500;
	line-height: normal;
	color: var(--white);
}
.bd-upgrade__list li { display: flex; align-items: center; gap: 12px; }

/* --------------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------- */
@media (max-width: 1180px) {
	.bd-tool { grid-template-columns: 196px minmax(0, 1fr); height: 580px; }
	.bd-tool__note { display: none; }

	.bd-steps,
	.bd-diagrams { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.bd-steps > :last-child:nth-child(odd),
	.bd-diagrams > :last-child:nth-child(odd) { grid-column: 1 / -1; }

	.bd-upgrade__list { width: 300px; }
}

@media (max-width: 960px) {
	.bd-upgrade { flex-direction: column; align-items: flex-start; }
	.bd-upgrade__list { width: 100%; }
}

@media (max-width: 900px) {
	.bd-tool { height: 540px; }
}

@media (max-width: 767px) {
	.bd-hero { padding-bottom: 32px; }
	.bd-hero .page-hero__inner { gap: 16px; }

	/* Tool: palette on top as a horizontal bar, court scales to width */
	.bd-tool {
		display: flex;
		flex-direction: column;
		height: auto;
		border-radius: 14px;
	}
	.bd-tool__palette {
		flex-direction: row;
		align-items: center;
		gap: 0;
		padding: 8px 6px;
		border-right: 0;
		border-bottom: 1px solid var(--border);
		overflow-x: auto;
		overflow-y: hidden;
		scrollbar-width: none;
	}
	.bd-tool__palette::-webkit-scrollbar { display: none; }
	.bd-group { flex: none; flex-direction: row; align-items: center; gap: 4px; padding: 0 8px; }
	.bd-group + .bd-group { border-left: 1px solid var(--border); }
	.bd-group--tools { flex-wrap: nowrap; gap: 2px; }
	.bd-group__label { display: none; }
	.bd-tokens { flex-wrap: nowrap; gap: 5px; }
	.bd-token { width: 32px; height: 32px; }
	.bd-tool .bd-token { touch-action: pan-x; }
	.bd-lines { flex-direction: row; gap: 2px; }
	.bd-line { flex-direction: column; gap: 2px; width: auto; padding: 5px 6px; font-size: 11px; }
	.bd-line__sample { width: 44px; height: 12px; }
	.bd-seg button { min-width: 48px; padding: 6px 10px; }
	.bd-hint { display: none; }

	.bd-tool__stage { display: block; padding: 8px; }
	.bd-tool__svg { height: auto; }

	.bd-tool__bar { flex-wrap: wrap; gap: 10px; padding: 12px; }
	.bd-tool__left { flex: 1 1 100%; }
	.bd-tool__left > .bd-bar-btn { flex: 1 1 0; }
	.bd-tool__right { flex: 1 1 100%; flex-direction: column; gap: 8px; }
	.bd-tool__note { display: block; font-size: 13px; }
	.bd-tool__cta { width: 100%; }
	.bd-confirm { right: 0; justify-content: space-between; white-space: normal; }

	/* Sections */
	.bd-how { padding-bottom: 60px; }
	.bd-steps,
	.bd-diagrams { grid-template-columns: minmax(0, 1fr); gap: 12px; }
	.bd-step { padding: 22px 20px; }
	.bd-diagram { padding: 24px 20px; gap: 14px; border-radius: 16px; }

	.bd-upgrade .club__text { gap: 16px; }
	.bd-upgrade__list { gap: 12px; font-size: 16px; }
}

/* Short link block ("Need a printable court?") */
.bd-print--link .section-head { margin-bottom: 0; }
.bd-print--link .section-head .btn { margin-top: 10px; }

/* Embedded app board (/free-play-board/) */
.bd-frame { border-radius: 16px; overflow: hidden; background: var(--panel); line-height: 0; }
.bd-frame__iframe { display: block; width: 100%; height: 720px; border: 0; border-radius: 16px; }
.bd-frame__note { margin-top: 20px; text-align: center; color: var(--text); font-size: 16px; }
.bd-frame__note a { color: var(--orange-dark); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 767px) {
	.bd-frame__iframe { height: 520px; }
}

/* The embedded board is wider than the page container so the app keeps its side-panel layout (needs about
   1280px), but capped so wide screens keep free space left and right where the wheel scrolls the page. */
.bd-board-sec .container { max-width: none; }
.bd-frame { max-width: 1320px; margin-inline: auto; }
