/**
 * UK Social Care Directory — Print
 * ----------------------------------------------------------------------------
 * Enqueued with media="print", so it never costs anything on screen.
 *
 * Consolidates the two inline @media print blocks (the individual profile
 * and the family-funnels rights sheet). Both existed because these pages are
 * genuinely printed: social workers take profiles into meetings, and the
 * rights sheet is handed to young people on paper.
 *
 * The dark theme is inverted wholesale here — printing #0f172a backgrounds
 * wastes an enormous amount of toner and renders most text unreadable on
 * paper.
 */

@page {
	margin: 15mm;
}

/* Force the light palette regardless of which theme class is on the wrapper.
 * This is the one place overriding the palette tokens directly is correct. */
.scd-root,
.scd-root.scd-theme-dark {
	--scd-surface-0: #ffffff;
	--scd-surface-1: #ffffff;
	--scd-surface-2: #ffffff;
	--scd-surface-3: #ffffff;
	--scd-surface-inset: #ffffff;
	--scd-border: #999999;
	--scd-border-subtle: #cccccc;
	--scd-border-strong: #666666;
	--scd-text: #000000;
	--scd-text-secondary: #222222;
	--scd-text-muted: #444444;
	--scd-text-subtle: #666666;
	--scd-accent: #000000;
	--scd-accent-contrast: #ffffff;
	--scd-accent-soft: #f2f2f2;
	--scd-accent-on-soft: #000000;
	--scd-success-soft: #f2f2f2;
	--scd-warning-soft: #f2f2f2;
	--scd-danger-soft: #f2f2f2;
	--scd-info-soft: #f2f2f2;

	background: #ffffff;
	color: #000000;
	font-size: 11pt;
}

.scd-root * {
	background: transparent;
	box-shadow: none;
	text-shadow: none;
}

/* --- Hide interactive chrome ---------------------------------------- */

.scd-nav,
.scd-tray,
.scd-modal,
.scd-banner,
.scd-filters,
.scd-pagination,
.scd-map,
.scd-btn,
.scd-chip__remove,
.scd-skeleton,
.scd-spinner,
.scd-u-no-print,
.scd-root form:not(.scd-print-keep),
.scd-root video,
.scd-root iframe {
	display: none !important;
}

/* --- Tabs become sections --------------------------------------------
 * A printed page has no tabs. Reveal every panel and label each with its
 * tab name so the printout is complete rather than showing only whichever
 * panel happened to be open. */

.scd-tabs__list { display: none !important; }

.scd-tabs__panel,
.scd-tabs__panel[hidden] {
	display: block !important;
	animation: none;
	page-break-inside: auto;
	margin-bottom: 8mm;
}

.scd-tabs__panel::before {
	content: attr(data-print-title);
	display: block;
	margin-bottom: 4mm;
	padding-bottom: 2mm;
	border-bottom: 1pt solid #999999;
	font-size: 14pt;
	font-weight: 700;
}

/* --- Typography ------------------------------------------------------ */

.scd-root h1 { font-size: 20pt; }
.scd-root h2 { font-size: 16pt; }
.scd-root h3 { font-size: 13pt; }
.scd-root h4,
.scd-root h5,
.scd-root h6 { font-size: 11pt; }

.scd-root h1,
.scd-root h2,
.scd-root h3,
.scd-root h4 {
	page-break-after: avoid;
	break-after: avoid;
}

.scd-root p,
.scd-root li,
.scd-root tr {
	page-break-inside: avoid;
	break-inside: avoid;
	orphans: 3;
	widows: 3;
}

/* Expand link targets so a printed page is still actionable. `[href^="/"]`
 * is excluded because a bare path is not useful off-screen. */
.scd-root a[href^="http"]::after {
	content: ' (' attr(href) ')';
	font-size: 8pt;
	color: #666666;
	word-break: break-all;
}

/* --- Components ------------------------------------------------------ */

.scd-card,
.scd-panel,
.scd-stat,
.scd-notice {
	border: 1pt solid #999999 !important;
	border-radius: 0;
	padding: 4mm;
	page-break-inside: avoid;
	break-inside: avoid;
}

.scd-badge {
	border: 1pt solid #666666 !important;
	color: #000000 !important;
}

.scd-table,
.scd-info-table { page-break-inside: auto; }
.scd-table thead { display: table-header-group; }
.scd-table th,
.scd-table td,
.scd-info-table th,
.scd-info-table td { border-bottom: 0.5pt solid #cccccc !important; }

/* Undo the mobile stacked layout — paper is never 600px wide. */
.scd-info-table,
.scd-info-table tbody,
.scd-info-table tr,
.scd-info-table th,
.scd-info-table td {
	display: revert;
}

/* Grids print better as a single column than as squeezed columns. */
.scd-grid,
.scd-autogrid,
.scd-results,
.scd-grid--sidebar {
	display: block;
}

.scd-grid > *,
.scd-autogrid > *,
.scd-results > * { margin-bottom: 4mm; }

.scd-sheet { overflow: visible; }
