/* The player index card: a handwritten, lined note card showing one player's run through a tournament.
   Everything is sized in --u, the card's own unit. On a phone the card is 100 units wide (so the writing fills it);
   as the screen gets wider the card gets more units wide, up to 140, so a long opponent and map name fits on one
   line instead of wrapping. The picture drawn for pasted links (tournament/player_card_image.py) is 140 units wide. */

@font-face {
	font-family: 'Caveat';
	src: url('../fonts/Caveat-Variable.woff2') format('woff2');
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
}

.pcCard {
	container-type: inline-size;
	width: 100%;
	max-width: 760px;
	margin: 0 auto;
	font-family: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;
	color: #1d2b4f;
	text-align: left;
}

.pcPaper {
	position: relative;
	--u: max(0.7143cqw, min(1cqw, 4px));      /* 1cqw up to a 400px-wide card, then smaller, until the card is 140 units wide */
	box-sizing: border-box;
	min-height: 60cqw;
	padding: calc(13 * var(--u)) calc(5 * var(--u)) 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fbf6e6;
	box-shadow: 0 calc(0.6 * var(--u)) calc(2 * var(--u)) rgba(40, 30, 10, 0.3);
}

/* The blue ruled lines, and the red rule under the heading */
.pcLines {
	position: absolute;
	inset: 0;
	background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(calc(6.4 * var(--u)) - 1px), #b7cbe6 calc(calc(6.4 * var(--u)) - 1px), #b7cbe6 calc(6.4 * var(--u)));
	background-position: 0 calc(5.85 * var(--u));
	pointer-events: none;
}
.pcRule {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(12.25 * var(--u));
	height: calc(0.6 * var(--u));
	background: #d4534b;
	opacity: 0.8;
	pointer-events: none;
}

.pcHead {
	position: absolute;
	left: calc(5 * var(--u));
	right: calc(5 * var(--u));
	top: 0;
	height: calc(12 * var(--u));
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: calc(3 * var(--u));
}
.pcName {
	font-size: calc(7.6 * var(--u));
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
}
.pcEvent {
	font-size: calc(4 * var(--u));
	color: #4a5a7a;
	line-height: 1;
	text-align: right;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 40%;
	flex: none;
}

.pcBody {
	position: relative;
	display: flex;
	flex-direction: column;
}

.pcStageHead {
	height: calc(6.4 * var(--u));
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: calc(4.8 * var(--u));
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.1em;
	color: #4a5a7a;
}
.pcStageName {
	text-decoration: underline;
	text-decoration-thickness: calc(0.35 * var(--u));
	text-underline-offset: calc(0.8 * var(--u));
}
.pcStageRecord {
	letter-spacing: 0;
	font-size: calc(4.4 * var(--u));
}

/* One round per row. A long opponent/map line wraps onto the next ruled line. */
.pcRow {
	min-height: calc(6.4 * var(--u));
	display: grid;
	grid-template-columns: calc(9 * var(--u)) minmax(0, 1fr) calc(7 * var(--u));
	align-items: start;
	font-size: calc(4.4 * var(--u));
	line-height: calc(6.4 * var(--u));
}
.pcLabel {
	color: #4a5a7a;
	font-weight: 700;
}
.pcMap {
	color: #4a5a7a;
}
.pcResult {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	height: calc(6.4 * var(--u));
}
.pcRes {
	font-weight: 700;
	font-size: calc(5.4 * var(--u));
	min-width: calc(5 * var(--u));
	text-align: center;
}
.pc-win { color: #1e6b34; }
.pc-loss { color: #b3261e; }
.pc-tie, .pc-bye, .pc-not_played { color: #1d2b4f; }
.pc-bye, .pc-not_played { font-size: calc(4.4 * var(--u)); font-weight: 500; }
.pcPending {
	display: inline-block;
	width: calc(5 * var(--u));
	height: calc(4.4 * var(--u));
	border: calc(0.45 * var(--u)) dashed #4a5a7a;
	border-radius: calc(0.8 * var(--u));
}
.pcEmpty {
	font-size: calc(4.6 * var(--u));
	line-height: calc(6.4 * var(--u));
	color: #4a5a7a;
}

.pcFoot {
	position: relative;
	margin-top: auto;
	padding: calc(2 * var(--u)) 0 calc(3 * var(--u));
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: calc(3 * var(--u));
}
.pcRecordBlock {
	display: flex;
	align-items: flex-end;
	gap: calc(2.5 * var(--u));
}
.pcRecord {
	font-size: calc(13 * var(--u));
	font-weight: 700;
	line-height: 0.9;
	white-space: nowrap;
}
.pcNote {
	font-size: calc(4.6 * var(--u));
	line-height: 1;
	color: #4a5a7a;
	padding-bottom: calc(1 * var(--u));
}
.pcRank {
	text-align: right;
	font-size: calc(4.8 * var(--u));
	line-height: 1.1;
	color: #4a5a7a;
}

/* The player card page */
.pcPage {
	max-width: 800px;
	margin: 0 auto;
	padding: 0 16px 24px;
}
.pcBack {
	margin: 0 0 12px;
}

/* The buttons under a card (page and pop-up) */
.pcActions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 10px;
	margin-top: 14px;
}
/* The site gives every <button> a blue fill (and a gold one on hover in dark mode), so these say their own look outright */
.pcActions .pcBtn,
.pcActions .pcBtn:hover,
.pcActions .pcBtn:focus,
.pcActions .pcBtn:active,
html[data-bs-theme=dark] .pcActions .pcBtn,
html[data-bs-theme=dark] .pcActions .pcBtn:hover {
	font: inherit;
	font-size: 0.95rem;
	padding: 5px 12px;
	border: 1px solid #8a8f98 !important;
	border-radius: 6px;
	background: transparent !important;
	color: inherit !important;
	text-decoration: none;
	cursor: pointer;
	transition: none;
}
.pcActions .pcBtn:hover,
html[data-bs-theme=dark] .pcActions .pcBtn:hover {
	background: rgba(128, 128, 128, 0.22) !important;
}

/* The pop-up opened by tapping a name in Standings */
.pcOverlay {
	position: fixed;
	inset: 0;
	z-index: 2000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.55);
	overflow-y: auto;
}
.pcOverlay[hidden] {
	display: none;
}
.pcPanel {
	position: relative;
	box-sizing: border-box;
	width: min(100%, 800px);
	max-height: 100%;
	overflow-y: auto;
	margin: auto;
	padding: 48px 14px 16px;
	border-radius: 10px;
	background: var(--bs-body-bg, #fff);
	color: var(--bs-body-color, #212529);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.pcClose {
	position: absolute;
	top: 7px;
	right: 8px;
	z-index: 1;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.85);
	color: #1d2b4f;
	font-size: 22px;
	line-height: 34px;
	cursor: pointer;
}
.pcStatus {
	padding: 30px 8px;
	text-align: center;
}

/* On a phone the pop-up slides up from the bottom of the screen */
@media (max-width: 575.98px) {
	.pcOverlay {
		align-items: flex-end;
		padding: 0;
	}
	.pcPanel {
		width: 100%;
		max-height: 92vh;
		margin: 0;
		border-radius: 14px 14px 0 0;
	}
}

/* Standings names that open the card look like names, not like links */
a.playerCardLink {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px dotted currentColor;
}
a.playerCardLink:hover {
	border-bottom-style: solid;
}
