/* Y Cymry: the definition, the peoples of Wales, the timeline, the language
   tree and the studies. The page text uses the site's own .prose styles. */

.yc-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: clamp(24px, 4vw, 56px);
	align-items: start;
}

@media (max-width: 860px) {
	.yc-grid {
		grid-template-columns: 1fr;
	}
}

.yc-def {
	margin: 0;
	font: 400 clamp(1.25rem, 2vw, 1.5rem) / 1.55 var(--serif);
	color: var(--ink);
	text-wrap: pretty;
}

.yc-def b {
	font-weight: 400;
	color: #fff;
	background: linear-gradient(transparent 62%, rgba(200, 16, 46, 0.45) 62%);
}

.yc-names {
	display: grid;
	gap: 1px;
	margin-top: 28px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--line);
	overflow: hidden;
}

.yc-names > div {
	display: grid;
	gap: 6px;
	padding: 16px 18px;
	background: var(--bg-2);
}

.yc-names h3 {
	margin: 0;
	font-size: 1.75rem;
	font-weight: 800;
	line-height: 1;
}

.yc-names h3 small {
	margin-left: 8px;
	font: italic 400 0.9375rem/1 var(--serif);
	text-transform: none;
	color: var(--ink-3);
}

.yc-names p {
	margin: 0;
	font-size: 0.9375rem;
	color: var(--ink-2);
}

.yc-tribes,
.yc-tree {
	margin: 0;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--bg-2);
	overflow: hidden;
}

.yc-map {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1060 / 1157;
	max-height: 540px;
}

.yc-tribes figcaption,
.yc-tree figcaption {
	padding: 10px 14px;
	border-top: 1px solid var(--line);
	font: 400 0.8125rem/1.45 var(--sans);
	color: var(--ink-3);
}

/* The four peoples: tones from one family, with a gap between them, so no border is
   drawn that the sources do not give. Silures is the only one with colour in it. */
.yc-tile {
	fill: #232327;
	stroke: var(--line-2);
	stroke-width: 1;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
	transition: fill var(--ease), opacity var(--ease);
}

.yc-tile-ordovices {
	fill: #2d2d33;
}

.yc-tile-silures {
	fill: #3a2328;
}

.yc-ready .yc-tile {
	cursor: pointer;
}

.yc-ready .yc-tile:not(.is-on):hover {
	fill: #2e2e34;
}

.yc-ready .yc-tile-ordovices:not(.is-on):hover {
	fill: #383840;
}

.yc-ready .yc-tile-silures:not(.is-on):hover {
	fill: #4a2830;
}

.yc-tile.is-on {
	fill: #3b3b44;
	stroke: var(--ink);
	stroke-width: 2.5px;
}

.yc-tile-ordovices.is-on {
	fill: #454550;
}

.yc-tile-silures.is-on {
	fill: #5d2b34;
}

.yc-has-on .yc-tile:not(.is-on) {
	opacity: 0.62;
}

.yc-tile:focus {
	outline: none;
}

.yc-tile:focus-visible {
	stroke: #fff;
	stroke-width: 3px;
	stroke-dasharray: 9 5;
}

.yc-valleys {
	fill: var(--red);
	stroke: var(--red);
	stroke-width: 1;
	vector-effect: non-scaling-stroke;
	pointer-events: none;
}

.yc-tribe {
	font: 800 46px var(--display);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	fill: var(--ink);
	paint-order: stroke;
	stroke: var(--bg-2);
	stroke-width: 10px;
	stroke-linejoin: round;
	pointer-events: none;
}

.yc-tribe-v {
	fill: #fff;
	stroke: var(--red);
}

.yc-dot {
	fill: var(--ink);
	stroke: var(--bg-2);
	stroke-width: 4;
	pointer-events: none;
}

.yc-place {
	font: italic 500 30px var(--sans);
	fill: var(--ink-2);
	paint-order: stroke;
	stroke: var(--bg-2);
	stroke-width: 8px;
	pointer-events: none;
}

/* The card for the chosen people. Without the script all four are listed. */
.yc-panel {
	position: relative;
	padding: 14px 18px 16px;
	border-top: 1px solid var(--line);
}

.yc-people {
	position: relative;
}

.yc-people + .yc-people {
	margin-top: 18px;
	padding-top: 18px;
	border-top: 1px solid var(--line);
}

.yc-people-name {
	margin: 0;
	padding-right: 96px;
	font: 800 1.75rem/1 var(--display);
	text-transform: uppercase;
	color: var(--ink);
}

.yc-where {
	margin: 6px 0 0;
	font: 600 0.6875rem/1.3 var(--sans);
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ink-3);
}

.yc-facts {
	display: grid;
	gap: 7px;
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

.yc-facts li {
	position: relative;
	padding-left: 16px;
	font: 500 0.875rem/1.4 var(--sans);
	color: var(--ink);
}

.yc-facts li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0.5em;
	width: 7px;
	height: 7px;
	border-radius: 2px;
	background: #ff6077;
}

.yc-note {
	margin: 10px 0 0;
	font: 400 0.78125rem/1.4 var(--sans);
	color: var(--ink-3);
}

.yc-note b {
	margin-right: 6px;
	font: 600 0.6875rem/1 var(--sans);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #e6b24a;
}

.yc-hint {
	margin: 0;
	font: 600 0.6875rem/1.3 var(--sans);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink-2);
}

.yc-all {
	position: absolute;
	top: 0;
	right: 0;
	min-height: 32px;
	padding: 0 12px;
	border: 1px solid var(--line-2);
	border-radius: 999px;
	background: transparent;
	font: 600 0.6875rem/1 var(--sans);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ink-2);
	cursor: pointer;
	transition: border-color var(--ease), color var(--ease);
}

.yc-all::before {
	content: '';
	position: absolute;
	inset: -6px -4px;
}

.yc-all:hover {
	border-color: var(--ink-3);
	color: var(--ink);
}

/* With the script, the hint and the four cards share one cell, so the figure keeps
   the height of the tallest card and nothing below it moves when a people is chosen. */
.yc-ready .yc-panel {
	display: grid;
}

.yc-ready .yc-panel > * {
	grid-area: 1 / 1;
}

.yc-ready .yc-people + .yc-people {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

.yc-ready .yc-people:not(.is-on),
.yc-ready .yc-hint:not(.is-on) {
	visibility: hidden;
}

.yc-ready .yc-hint {
	align-self: center;
}

@media (prefers-reduced-motion: reduce) {
	.yc-tile,
	.yc-all {
		transition: none;
	}
}

/* Timeline */
.yc-timeline-band {
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
	background: var(--bg-2);
}

.yc-timeline {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(180px, 1fr);
	margin: 0;
	padding: 26px 0 22px;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x proximity;
}

.yc-timeline li {
	position: relative;
	display: grid;
	align-content: start;
	gap: 6px;
	padding: 30px 18px 0 0;
	scroll-snap-align: start;
}

.yc-timeline li::before {
	content: '';
	position: absolute;
	top: 10px;
	left: 0;
	right: 0;
	height: 1px;
	background: var(--line-2);
}

.yc-timeline li::after {
	content: '';
	position: absolute;
	top: 5px;
	left: 0;
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: var(--bg-2);
	box-shadow: inset 0 0 0 2px var(--ink-3);
}

.yc-timeline li.yc-hi::after {
	background: var(--red);
	box-shadow: none;
}

.yc-timeline b {
	font: 800 1.5rem/1 var(--display);
	text-transform: uppercase;
}

.yc-timeline span {
	font-size: 0.875rem;
	color: var(--ink-2);
}

/* Each era is named above its stretch of the line. */
.yc-timeline .yc-era-tag {
	position: absolute;
	top: -22px;
	left: 0;
	font: 600 0.6875rem/1 var(--sans);
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: #ff6077;
	white-space: nowrap;
}

/* With the script each entry is a button, and a pane under the rail tells more. */
.yc-timeline li > button {
	display: grid;
	gap: 6px;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	text-align: left;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.yc-timeline li > button:hover span {
	color: var(--ink);
}

.yc-timeline li > button:focus-visible {
	outline: 2px solid var(--ink);
	outline-offset: 4px;
}

.yc-timeline li.is-on::after {
	background: var(--ink);
	box-shadow: none;
}

.yc-timeline li.is-on b {
	color: #fff;
}

.yc-timeline li.is-on span:not(.yc-era-tag) {
	color: var(--ink);
}

.yc-tl-nav {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding-top: 14px;
}

.yc-tl-nav button {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 1px solid var(--line-2);
	border-radius: 50%;
	background: transparent;
	color: var(--ink-2);
	cursor: pointer;
	transition: border-color var(--ease), color var(--ease);
}

.yc-tl-nav button:hover:not(:disabled) {
	border-color: var(--ink-3);
	color: var(--ink);
}

.yc-tl-nav button:disabled {
	opacity: 0.35;
	cursor: default;
}

/* The hint and every entry's text share one cell, so the pane keeps the height of
   the tallest and nothing below it moves when an entry is chosen. */
.yc-tl-pane {
	display: grid;
	margin: 0 0 26px;
	padding: 16px 18px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--bg);
}

.yc-tl-pane[hidden] {
	display: none;
}

.yc-tl-pane > * {
	grid-area: 1 / 1;
}

.yc-tl-pane > :not(.is-on) {
	visibility: hidden;
}

.yc-tl-hint {
	align-self: center;
	margin: 0;
	font: 600 0.6875rem/1.3 var(--sans);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink-2);
}

.yc-tl-when {
	margin: 0;
	font: 800 1.2rem/1 var(--display);
	text-transform: uppercase;
	color: #ff6077;
}

.yc-tl-title {
	margin: 6px 0 0;
	font: 600 1.0625rem/1.3 var(--sans);
	color: var(--ink);
}

.yc-tl-more {
	max-width: 70ch;
	margin: 8px 0 0;
	font: 400 0.9375rem/1.55 var(--sans);
	color: var(--ink-2);
}

.yc-tl-src {
	margin: 10px 0 0;
	font-size: 0.8125rem;
	color: var(--ink-3);
}

.yc-tl-src b {
	margin-right: 6px;
	font: 600 0.6875rem/1 var(--sans);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ink-2);
}

/* The language tree */
.yc-tree {
	margin: 2em 0;
}

.yc-fig-title {
	margin: 0;
	padding: 14px 16px 0;
	font: 700 1.25rem/1.1 var(--display);
	text-transform: uppercase;
	color: var(--ink);
}

.yc-tree-wrap {
	padding: 12px 16px;
	overflow-x: auto;
}

.yc-tree svg {
	display: block;
	width: 100%;
	min-width: 520px;
	height: auto;
}

.yc-line {
	fill: none;
	stroke: var(--line-2);
	stroke-width: 1.25;
}

.yc-box {
	fill: var(--bg-2);
	stroke: var(--line-2);
	stroke-width: 1;
}

.yc-box-hi {
	fill: rgba(200, 16, 46, 0.18);
	stroke: #ff6077;
	stroke-width: 2;
}

.yc-t1 {
	font: 800 17px var(--display);
	letter-spacing: 0.03em;
	text-transform: uppercase;
	fill: var(--ink);
}

.yc-t2 {
	font: italic 400 12.5px var(--sans);
	fill: var(--ink-3);
}

.yc-t2-hi {
	font-style: normal;
}

/* What DNA studies found, in time order, each with where it applies */
.yc-genes {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 14px;
	margin: 2em 0;
}

.yc-genes > div {
	display: grid;
	align-content: start;
	justify-items: start;
	gap: 8px;
	padding: 18px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--bg-2);
}

.yc-genes > .is-wales {
	border-color: var(--red);
	background: linear-gradient(var(--red-glow), var(--red-glow)), var(--bg-2);
}

.yc-genes small {
	font: 600 0.75rem/1 var(--sans);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ink-3);
}

.yc-scope {
	font: 600 0.75rem/1 var(--sans);
	font-style: normal;
	padding: 5px 9px;
	border: 1px solid var(--line-2);
	border-radius: 99px;
	color: var(--ink-2);
}

.is-wales .yc-scope {
	border-color: var(--red);
	color: #fff;
}

.yc-genes b {
	font: 800 2.25rem/0.9 var(--display);
	text-transform: uppercase;
	color: var(--ink);
}

.yc-genes span {
	font: 400 0.9375rem/1.5 var(--sans);
	color: var(--ink-2);
}

.yc-genes a {
	font: 400 0.8125rem/1.4 var(--sans);
	color: var(--ink-3);
}

/* Two-column "sign / the Welsh" tables in the article */
.yc-signs {
	width: 100%;
	margin: 1.6em 0;
	border-collapse: collapse;
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.yc-signs th,
.yc-signs td {
	padding: 12px 16px;
	vertical-align: top;
	text-align: left;
	border-bottom: 1px solid var(--line);
	font: 400 0.9375rem/1.5 var(--sans);
}

.yc-signs thead th {
	font: 600 0.75rem/1 var(--sans);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ink-3);
	background: var(--bg-2);
}

.yc-signs tbody th {
	width: 34%;
	font-weight: 600;
	color: var(--ink);
}

.yc-signs td {
	color: var(--ink-2);
}

.yc-signs tbody tr:last-child th,
.yc-signs tbody tr:last-child td {
	border-bottom: 0;
}

@media (max-width: 560px) {
	.yc-signs th,
	.yc-signs td {
		padding: 10px 12px;
	}

	.yc-signs tbody th {
		width: 38%;
	}
}

/* The 2021 census: the merged ethnic group box, then national identity as bars */
.yc-identity {
	margin: 2em 0;
}

.yc-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 14px;
}

.yc-stats > div {
	display: grid;
	align-content: start;
	gap: 8px;
	padding: 18px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--bg-2);
}

.yc-stats > div:last-child {
	border-color: var(--red);
	background: linear-gradient(var(--red-glow), var(--red-glow)), var(--bg-2);
}

.yc-stats b {
	font: 800 2.25rem/0.9 var(--display);
	text-transform: uppercase;
	color: var(--ink);
}

.yc-stats span {
	font: 400 0.9375rem/1.5 var(--sans);
	color: var(--ink-2);
}

.yc-bars {
	width: 100%;
	margin: 28px 0 0;
	border-collapse: collapse;
}

.yc-bars caption {
	padding: 0 0 10px;
	text-align: left;
	font: 600 0.9375rem/1.3 var(--sans);
	color: var(--ink);
}

.yc-bars caption small {
	margin-left: 8px;
	font-weight: 400;
	color: var(--ink-3);
}

.yc-bars th,
.yc-bars td {
	padding: 6px 0;
	vertical-align: middle;
	border: 0;
}

.yc-bars th {
	width: 38%;
	padding-right: 14px;
	text-align: left;
	font: 400 0.9375rem/1.3 var(--sans);
	color: var(--ink-2);
}

.yc-bars td {
	display: flex;
	align-items: center;
	gap: 10px;
}

.yc-bar {
	flex: 1;
	height: 14px;
	border-radius: 2px;
	background: var(--bg-3);
}

.yc-bar i {
	display: block;
	height: 100%;
	min-width: 3px;
	border-radius: 2px;
	background: var(--ink-3);
}

.is-welsh .yc-bar i {
	background: var(--red);
}

.is-welsh th {
	color: var(--ink);
}

.yc-bar-n {
	min-width: 3.6em;
	font: 600 0.875rem/1 var(--sans);
	font-variant-numeric: tabular-nums;
	color: var(--ink);
}

.yc-note {
	margin: 16px 0 0;
	font: 400 0.8125rem/1.55 var(--sans);
	color: var(--ink-3);
}

.yc-note a {
	color: var(--ink-3);
}

@media (max-width: 560px) {
	.yc-bars th {
		width: 44%;
	}
}

.yc-article h2 {
	scroll-margin-top: calc(var(--header) + var(--adminbar) + 12px);
}
