Template:Bracket.css

Template page
Revision as of 17:31, 7 October 2023 by Couchor (talk | contribs)
.bracket {
	display: flex;
	gap: 10px;
	width: max-content;
}

.grand-final .match {
	justify-content: flex-end;
}

.bracket-wrapper, .grand-final {
	display: flex;
	flex-direction: column;
	row-gap: 10px;
}
.bracket-header, .bracket-rounds {
	display: grid;
	column-gap: 10px;
}

.bracket-header {
	height: 26px;
	text-align: center;
}

.bracket-header div:not(:empty) {
	background-color: lightgrey;
}

.bracket-round {
	display: flex;
	flex-direction: column;
	row-gap: 10px;
	justify-content: space-around;
}

.round-offset .match {
	margin-top: 28px;
}

/* CONNECTOR */
/* From middle of winning bracket to the right*/
.bracket .conn-r .match::after {
	content: "";
	position: absolute;
    top: calc(50% - 1px);
    right: -5px;
    width: 5px;
    height: 2px;
    background-color: black;
}
/* Vertical line to middle of height of next rounds team element */
.bracket .conn-r .match::before {
	content: "";
    position: absolute;
    top: 8px;
    right: -5px;
    width: 2px;
    height: calc(50% - 8px);
    background-color: black;
}

/* If rounds-offset is present (meaning that two adjacent rounds have same amount of matches) */
.bracket .round-offset .match::after {
	content: "";
	position: absolute;
    top: calc(50% - 1px);
    right: -5px;
    width: 5px;
    height: 2px;
    background-color: black;
}

/* If vertical line needs to go down*/
.bracket .conn-r:not(.last) .match:nth-child(odd)::before {
	top: 50%;
}

/* Adjust vertical line lengths if next round has round-offset */
.bracket .conn-r.conn-adj .match::before {
	height: calc(50% - 23px);
	top: 22px
}
.bracket .conn-r:not(.last).conn-adj  .match:nth-child(odd)::before {
	height: calc(50% + 6px);
}

/* If round is not the first child, then have line come out of the backs of teamnames */ 
.bracket .bracket-round:not(:first-child) .team::before,
.bracket .grand-final .team::before {
	content: "";
	position: absolute;
    top: calc(50% - 1px);
    left: 0;
    width: 5px;
    height: 2px;
    background-color: black;
    transform: translateX(-100%);
}

.bracket .bracket-round.long:not(:first-child) .team::before {
	width: calc(100% + 15px);
}
.bracket .bracket-round.first .team::before {
	content: none;
}

.bracket .bracket-round:not(:first-child) .match-details .team::before {
	content: none;
}

.bracket.de .bracket-round:last-child .match::before {
	height: calc(50% - 28px - 13px);
}
.bracket.de .bracket-round.last:last-child .match::before {
	height: calc(50% + 26px + 10px + 10px + 14px + 1px);
    top: auto;
    bottom: 50%;
}