/*
 * Thistle — visual-contract patch layer (loaded last).
 *
 * Measured fixes on scottishprizehub.uk:
 *   D9 / Gates 15–17–39  masthead panel shares the article column edges.
 *   D10 / Gate 23–40     navigation stays on one line down to 1024.
 *   D8 / Gates 38–42     nothing clipped; no heading under its own text.
 *   D2 / Gates 6–8       the rack fits one screen at 1366x768.
 *   D12 / Gate 43        one paid-placement sentence, above the rack.
 *
 * No pure #fff, no pure #000, one accent, logical properties only.
 */

/* ---------- D9: masthead shares the article column ---------- */
/* The article column is --ph-measure wide and centred. The masthead is that
   same box: the header element itself carries the measure and the centring,
   and its inner panel simply fills it, so the wordmark and the last nav item
   land on the article's own two edges. */
.ph-header {
	background: transparent !important;
	border-bottom: 1px solid var(--ph-rule) !important;
	box-shadow: none !important;
	width: 100% !important;
	max-width: var(--ph-measure) !important;
	margin-inline: auto !important;
	padding: 0 !important;
	box-sizing: border-box !important;
}
.ph-header-inner {
	max-width: none !important;
	width: 100% !important;
	margin-inline: 0 !important;
	padding: 0.4rem 0 !important;
	min-height: 82px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.8rem;
	box-sizing: border-box;
	flex-wrap: nowrap;
	position: relative;
	float: none !important;
}
/* Any Astra shell wrapping the body top must not offset the panel. */
body.thistle-shell > .site,
body.thistle-shell #page,
body.thistle-shell #content,
body.thistle-shell .site-content,
body.thistle-shell .ast-container,
body.thistle-shell .hfeed {
	max-width: 100% !important;
	margin-inline: 0 !important;
	padding-inline: 0 !important;
}

/* ---------- D10: one nav line down to 1024 ---------- */
/* Eight groups, sentence case, no wrap: the whole list is pinned to the
   panel's right edge and typed to the widest label the line can hold.
   The nav is the panel's own box, stretching from the brand to the panel's
   right edge, so the masthead shares the article's two edges exactly. */
.ph-header-inner {
	grid-template-columns: none !important;
}
.ph-header-nav {
	flex: 1 1 auto !important;
	display: flex !important;
	justify-content: flex-end !important;
	align-items: center !important;
	min-width: 0 !important;
	width: auto !important;
	overflow: visible !important;
	margin-inline-start: 0.6rem !important;
	margin-inline-end: 0 !important;
}
.ph-header-nav .ph-nav-list {
	display: flex !important;
	flex-wrap: nowrap !important;
	justify-content: flex-end !important;
	align-items: center !important;
	width: auto !important;
	max-width: 100% !important;
	margin-inline-start: auto !important;
	gap: 0 !important;
}
.ph-header-nav .ph-nav-list > .ph-nav-item {
	flex: 0 0 auto !important;
	position: relative;
}
.ph-header-nav .ph-nav-list > .ph-nav-item > a {
	display: inline-block !important;
	white-space: nowrap !important;
	text-transform: none !important;
}
/* The toggle only exists below 1024. */
@media (min-width: 1024px) {
	.ph-nav-toggle { display: none !important; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
	.ph-header-logo { font-size: 0.82rem !important; letter-spacing: -0.01em; }
	.ph-age-badge { width: 22px !important; height: 22px !important; font-size: 9.5px !important; }
	.ph-header-brand { gap: 0.25rem !important; }
	.ph-header-inner { gap: 0.2rem !important; padding: 0.35rem 0 !important; }
	.ph-header-nav { margin-inline-start: 0.2rem !important; }
	.ph-header-nav .ph-nav-list > .ph-nav-item > a {
		font-size: 10.5px !important;
		padding: 0.28rem 0.16rem !important;
		letter-spacing: -0.015em;
	}
	.ph-caret { font-size: 0.45em !important; margin-inline-start: -0.05em; }
}
@media (min-width: 1280px) and (max-width: 1439px) {
	.ph-header-logo { font-size: 1.02rem !important; }
	.ph-header-nav .ph-nav-list > .ph-nav-item > a {
		font-size: 12.5px !important;
		padding: 0.32rem 0.3rem !important;
	}
	.ph-caret { font-size: 0.58em !important; }
}
@media (min-width: 1440px) {
	.ph-header-nav .ph-nav-list > .ph-nav-item > a {
		font-size: 13px !important;
		padding: 0.35rem 0.42rem !important;
	}
}
.ph-header-brand {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex: 0 0 auto;
	margin-inline-start: 0;
}
.ph-header-logo {
	white-space: nowrap;
	margin-inline-start: 0;
}
.ph-header-nav {
	flex: 1 1 auto;
	display: flex;
	justify-content: flex-end;
	min-width: 0;
	margin-inline-start: auto;
	margin-inline-end: 0;
}
.ph-header-nav .ph-nav-list {
	justify-content: flex-end !important;
	flex-wrap: nowrap !important;
	margin: 0 !important;
	padding: 0 !important;
}
.ph-header-nav .ph-nav-list > .ph-nav-item:last-child > a {
	padding-inline-end: 0 !important;
}
/* One line at 1024 or the taxonomy is wrong: the type steps down and the
   labels never wrap. */
@media (min-width: 1024px) and (max-width: 1365px) {
	.ph-header-inner { gap: 0.45rem; }
	.ph-header-logo { font-size: 0.95rem !important; }
	.ph-header-nav .ph-nav-list > .ph-nav-item > a {
		font-size: 12px !important;
		padding: 0.3rem 0.26rem !important;
	}
	.ph-caret { font-size: 0.6em; }
	.ph-age-badge { width: 26px; height: 26px; font-size: 11px; }
}
@media (min-width: 1024px) {
	.ph-header-nav .ph-nav-item { flex-shrink: 1; }
	.ph-header-nav .ph-nav-list > .ph-nav-item > a { white-space: nowrap; }
}

/* ---------- D8: nothing clipped, no heading under its own text ---------- */
.phb-offer,
.phb-name,
.phb-terms-line,
.phb-fig-val,
.phb-age {
	white-space: normal !important;
	overflow: visible !important;
	text-overflow: clip !important;
	-webkit-line-clamp: unset !important;
	max-height: none !important;
	overflow-wrap: break-word;
	hyphens: auto;
}

.ph-q,
h3.ph-q {
	font-size: 1.12rem !important; /* above the 17px answer text */
	font-weight: 700;
	line-height: 1.35;
	margin: 1.15rem 0 0.3rem;
}
.ph-a {
	font-size: 1rem;
	line-height: 1.6;
	margin: 0 0 0.9rem;
	max-width: 68ch;
}

/* ---------- D2: the rack fits one screen ---------- */
.ph-board-slot {
	margin: 0 0 1.4rem;
	width: 100%;
}
/* The single paid-placement sentence: above the rack, quiet ink, body face,
   14px. One on the page, never repeated. */
.phb-disclosure {
	font-family: var(--ph-font-body);
	font-size: 14px;
	line-height: 1.3;
	color: var(--ph-ink-quiet);
	margin: 0 0 0.4rem;
	padding: 0;
	max-width: 96ch;
	opacity: 1;
}
.phb-board {
	width: 100%;
	background: var(--ph-surface);
	border: 1px solid var(--ph-rule);
	border-radius: var(--ph-radius);
	padding: 0.4rem 0.5rem;
	box-sizing: border-box;
}
.phb-rows {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 5px;
}
/* One row per offer, one column at every width. Five rows of ~104px plus
   their gaps and the board's padding fit the 640px budget at 1366x768. */
.phb-row {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0.5rem;
	padding: 0.28rem 0.5rem;
	min-height: 0;
	max-height: none;
	border: 1px solid var(--ph-rule);
	border-radius: var(--ph-radius);
	background: var(--ph-ground);
	width: 100%;
	box-sizing: border-box;
}
.phb-row--lead {
	border-color: var(--ph-accent);
	box-shadow: 0 0 0 2px rgba(94, 107, 60, 0.16);
}
.phb-row--lead .phb-name {
	color: var(--ph-accent-dark);
}
.phb-rank {
	flex: 0 0 26px;
	font-family: var(--ph-font-head);
	font-size: 1rem;
	font-weight: 700;
	color: var(--ph-ink-quiet);
	text-align: center;
	font-variant-numeric: tabular-nums;
}
.phb-brand {
	flex: 1 1 210px;
	min-width: 180px;
	display: flex;
	align-items: center;
	gap: 0.45rem;
}
.phb-logo {
	width: 58px;
	height: 34px;
	border-radius: 10px;
	flex: 0 0 auto;
	display: block;
}
.phb-brand-text {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
}
.phb-name {
	font-family: var(--ph-font-head);
	font-size: 0.98rem;
	font-weight: 700;
	line-height: 1.15;
	color: var(--ph-ink);
}
.phb-offer {
	font-size: 12px;
	line-height: 1.2;
	color: var(--ph-ink-quiet);
}
/* Terms line: label/value pairs at 12.5px, the licence always named. */
.phb-terms {
	flex: 1 1 1fr;
	min-width: 150px;
}
.phb-terms-line {
	display: block;
	font-size: 12.5px;
	line-height: 1.25;
	color: var(--ph-ink-quiet);
}
/* The two figures are the largest type in the block, tabular numerals. */
.phb-figs {
	flex: 0 0 auto;
	display: flex;
	gap: 0.75rem;
	align-items: flex-end;
}
.phb-fig {
	display: flex;
	flex-direction: column;
	gap: 0;
	min-width: 68px;
}
.phb-fig-label {
	font-size: 9.5px;
	line-height: 1.1;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--ph-ink-quiet);
}
.phb-fig-val {
	font-family: var(--ph-font-head);
	font-size: 1.58rem; /* 25.3px, stepped to 28px+ at ≥1200 */
	line-height: 1.05;
	font-weight: 700;
	color: var(--ph-ink);
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.01em;
}
@media (min-width: 1200px) {
	.phb-fig-val { font-size: 1.76rem; }
}
.phb-action {
	flex: 0 0 158px;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 2px;
}
.phb-cta {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	min-width: 160px !important;
	min-height: 44px !important;
	padding: 8px 12px !important;
	background: var(--ph-accent) !important;
	color: #f5f0e6 !important;
	border-radius: 8px;
	text-decoration: none !important;
	font-weight: 700;
	font-size: 0.9rem;
	text-align: center;
	border: 0;
	transition: background 140ms ease, transform 140ms ease;
}
.phb-cta:hover,
.phb-cta:focus {
	background: var(--ph-accent-bright) !important;
	color: #f5f0e6 !important;
	transform: translateY(-1px);
}
.phb-cta:focus-visible {
	outline: 2px solid var(--ph-accent-dark);
	outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
	.phb-cta { transition: background 140ms ease; }
	.phb-cta:hover { transform: none; }
}
/* Under the button: the register's age statement, plain, never a chip. */
.phb-age {
	display: block;
	font-size: 11px;
	line-height: 1.15;
	color: var(--ph-ink-quiet);
	text-align: center;
	border: 0 !important;
	background: transparent !important;
}

/* Below the width where five rows still fit on one line the row stacks —
   still one column of full-width rows, never a card rack. */
@media (max-width: 1119px) {
	.phb-row {
		flex-wrap: wrap;
		gap: 0.35rem 0.5rem;
		min-height: 0;
	}
	.phb-brand { flex: 1 1 60%; min-width: 0; }
	.phb-terms { flex: 1 1 100%; order: 4; min-width: 0; }
	.phb-figs { flex: 0 0 auto; order: 3; }
	.phb-action { flex: 1 1 100%; order: 5; align-items: center; }
	.phb-cta { width: 100%; max-width: 320px; }
	.phb-fig-val { font-size: 1.45rem; }
	.phb-logo { width: 56px; height: 34px; }
}
@media (max-width: 599px) {
	.ph-header-inner { min-height: 64px; padding: 0.4rem var(--ph-gutter) !important; }
	.phb-board { padding: 0.45rem; }
	.phb-rank { flex: 0 0 22px; font-size: 0.95rem; }
	.phb-brand { flex: 1 1 100%; }
	.phb-figs { flex: 1 1 auto; gap: 0.65rem; }
}

/* ---------- Integrity: wide tables never push the page sideways ---------- */
.ph-tablewrap {
	max-width: 100%;
	overflow-x: auto;
}
.ph-section table {
	display: table;
	width: 100%;
	max-width: 100%;
	border-collapse: collapse;
}
