/*
 * CTS free tools layout layer (v2). Loaded ONLY on /tools/ hub + children
 * via cts_tool_page_assets(). Everything is namespaced under .cts-toolpage
 * or .cts-toolhead so nothing leaks into other views.
 *
 * The per-tool fragments keep their own scoped .ctool-* styles; this file
 * provides the shared page frame: full-width content, the highlighted
 * "stage" that makes the tool the focal point, the supporting-copy measure
 * and the shared PDF button.
 */

/* ---- Head band ---------------------------------------------------- */
.cts-toolhead h1 { max-width: 30ch; }
.cts-toolhead__standfirst {
	margin: 1rem 0 0;
	max-width: 62ch;
	font-size: clamp(1.02rem, 1.4vw, 1.14rem);
	line-height: 1.6;
	color: var(--cts-on-ink, rgba(255,255,255,.82));
}
.cts-toolhead__facts {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: .55rem .6rem;
	margin: 1.35rem 0 0;
	padding: 0;
}
.cts-toolhead__facts li {
	font-size: .82rem;
	font-weight: 600;
	letter-spacing: .01em;
	color: rgba(255,255,255,.88);
	border: 1px solid rgba(255,255,255,.28);
	border-radius: 999px;
	padding: .32rem .8rem;
	background: rgba(255,255,255,.06);
}

/* ---- Page frame ---------------------------------------------------- */
.cts-toolpage {
	background: linear-gradient(180deg, var(--cts-stone) 0, var(--cts-stone) 300px, #fff 640px);
}
.cts-toolpage .cts-content--tool { max-width: none; }
.cts-toolpage .ctool { max-width: none; }

/* ---- The tool stage: the focal point of the page ------------------- */
.cts-toolpage .ctool-stage {
	position: relative;
	background: #fff;
	border: 1px solid var(--cts-line);
	border-radius: var(--cts-radius-lg, 20px);
	box-shadow: 0 24px 60px rgba(7, 24, 44, .10), 0 2px 8px rgba(7, 24, 44, .05);
	padding: clamp(1.2rem, 2.6vw, 2.2rem);
	margin: 0 0 clamp(2.2rem, 4vw, 3.2rem);
	overflow: hidden;
}
.cts-toolpage .ctool-stage::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 5px;
	background: linear-gradient(90deg, var(--cts-brand), #6EA8FF);
}
/* Inner panels flatten inside the stage so the stage carries the elevation. */
.cts-toolpage .ctool-stage .ctool-panel {
	box-shadow: none;
	margin-bottom: 0;
}

/* Two-column stage: inputs left, results right. Stacks under 1020px. */
.cts-toolpage .ctool-stage__grid {
	display: grid;
	grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
	gap: clamp(1.1rem, 2vw, 1.7rem);
	align-items: start;
}
.cts-toolpage .ctool-stage__grid--stack { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1020px) {
	.cts-toolpage .ctool-stage__grid { grid-template-columns: minmax(0, 1fr); }
}

/* Results column: quiet placeholder before first calculation. */
.cts-toolpage .ctool-stage__out:empty::before,
.cts-toolpage .ctool-stage__out .ctool-placeholder {
	display: block;
	border: 1.5px dashed var(--cts-line-2, #CBD5E1);
	border-radius: 14px;
	padding: 2.2rem 1.4rem;
	text-align: center;
	color: var(--cts-muted);
	font-size: .95rem;
}
.cts-toolpage .ctool-stage__out:empty::before { content: attr(data-empty); }

/* How-to line inside the stage, above the form. */
.cts-toolpage .ctool-stage .ctool-how {
	margin: 0 0 1.1rem;
	font-size: .95rem;
	color: var(--cts-muted);
}

/* ---- Supporting copy below the stage -------------------------------- */
.cts-toolpage .ctool-support { max-width: 900px; }
.cts-toolpage .ctool-support .ctool-lead { font-size: 1.04rem; line-height: 1.65; color: var(--cts-text-2); }
@media (min-width: 1020px) {
	.cts-toolpage .ctool-support__cols {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: 2.6rem;
		max-width: none;
	}
}
.cts-toolpage .ctool-support__cols > div > h2:first-child { margin-top: 0; }
@media (min-width: 1020px) {
	.cts-toolpage .ctool-support--wide { max-width: none; }
}

/* ---- Shared PDF button ---------------------------------------------- */
.cts-toolpage .ctool-btn--pdf {
	background: #fff;
	color: var(--cts-ink);
	border: 1px solid var(--cts-line-2, #CBD5E1);
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	border-radius: 10px;
	font-weight: 700;
	font-size: .95rem;
	font-family: inherit;
	padding: 11px 18px;
	cursor: pointer;
	line-height: 1.2;
	text-decoration: none;
}
.cts-toolpage .ctool-btn--pdf::before {
	content: "";
	width: 16px;
	height: 16px;
	flex: none;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m6 11 6 6 6-6'/%3E%3Cpath d='M4 21h16'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m6 11 6 6 6-6'/%3E%3Cpath d='M4 21h16'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cts-toolpage .ctool-btn--pdf:hover { background: var(--cts-stone); border-color: var(--cts-brand); color: var(--cts-brand-700); }
.cts-toolpage .ctool-btn--pdf[disabled] { opacity: .55; cursor: wait; }

/* ---- Small screens --------------------------------------------------- */
@media (max-width: 560px) {
	.cts-toolhead__facts li { font-size: .76rem; padding: .26rem .65rem; }
	.cts-toolpage .ctool-stage { border-radius: 14px; }
}

/* ---- Mobile pass (shared, overrides the per-tool fragment styles) ----- */
@media (max-width: 700px) {
	/* 16px stops iOS zooming the page when an input gets focus. */
	.cts-toolpage .ctool input[type=text],
	.cts-toolpage .ctool input[type=number],
	.cts-toolpage .ctool input[type=time],
	.cts-toolpage .ctool select { font-size: 16px; }

	/* Comfortable touch targets for the tick controls. */
	.cts-toolpage .ctool input[type=checkbox],
	.cts-toolpage .ctool input[type=radio] { width: 21px; height: 21px; }

	/* Horizontal-scroll containers (tables, the hours timeline): smooth
	 * touch scrolling plus edge shadows so it is obvious there is more to
	 * the side. Shadows fade out via the white covers when fully scrolled. */
	.cts-toolpage .ctool-tablewrap,
	.cts-toolpage .ctool-tbl-wrap,
	.cts-toolpage .ctool-timewrap {
		-webkit-overflow-scrolling: touch;
		background:
			linear-gradient(90deg, #fff 40%, rgba(255,255,255,0)) left / 28px 100% no-repeat local,
			linear-gradient(270deg, #fff 40%, rgba(255,255,255,0)) right / 28px 100% no-repeat local,
			radial-gradient(farthest-side at 0 50%, rgba(7,24,44,.18), transparent) left / 14px 100% no-repeat scroll,
			radial-gradient(farthest-side at 100% 50%, rgba(7,24,44,.18), transparent) right / 14px 100% no-repeat scroll;
	}

	/* Primary action rows: full-width, easy-to-hit buttons. */
	.cts-toolpage .ctool-actions { gap: .6rem; }
	.cts-toolpage .ctool-actions .ctool-btn { flex: 1 1 auto; text-align: center; }
}
