/* Images for social media (docs/decisions/0078-share-images.md). Each card is drawn at its real size
   (1080 x 1350 for a post, 1080 x 1920 for a story) and printed on one ground: no panels, no boxes.
   The structure is shared (logo, title, what it's about, the content, the site's address); a design
   (share-design--*) sets the ground and the inks through the custom properties below.
   --share-primary and --share-accent come from the site's colors; both are readable under white.
   Sizes are px on purpose: the card is a fixed canvas, scaled down only in its preview. */
.share-card {
  --share-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --share-text: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* The inks, set per design. */
  --share-ground: var(--share-primary);
  --share-ink: #fff;
  --share-muted: rgb(255 255 255 / 0.72);
  --share-rule: rgb(255 255 255 / 0.3);
  --share-rule-strong: #fff;
  --share-title: #fff;
  --share-hl: #fff;
  --share-hl-ink: var(--share-primary);
  --share-number: #fff;

  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 1080px;
  height: 1350px;
  padding: 64px 72px 56px;
  overflow: hidden;
  transform-origin: 0 0;
  background-color: var(--share-ground);
  color: var(--share-ink);
  font-family: var(--share-display);
  font-weight: 800;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
.share-card *,
.share-card *::before,
.share-card *::after {
  box-sizing: border-box;
}
/* A story keeps clear of what Instagram lays over it: the account on top, the reply box below. */
.share-card--story {
  height: 1920px;
  padding-top: 220px;
  padding-bottom: 260px;
}
.share-card__ground {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* --- The frame: logo, title, content, address ------------------------------------------------ */
.share-card__head {
  position: relative;
  display: flex;
  min-height: 120px;
  align-items: center;
}
.share-card__logo {
  display: grid;
  place-items: center;
  height: 120px;
}
.share-card__logo img {
  display: block;
  width: auto;
  max-width: 340px;
  height: 120px;
  object-fit: contain;
}
.share-card__league {
  font-size: 44px;
  line-height: 1;
  text-transform: uppercase;
}
.share-card__title {
  position: relative;
  margin-top: 40px;
}
.share-card__title h3 {
  margin: 0;
  color: var(--share-title);
  font-family: var(--share-display);
  font-weight: 800;
  line-height: 0.84;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}
.share-card__arc {
  display: none;
}
.share-card__tag {
  margin: 18px 0 0;
  color: var(--share-muted);
  font-size: 46px;
  line-height: 1;
  text-transform: uppercase;
}
.share-card__body {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  justify-content: safe center;
  margin-top: 44px;
}
.share-card__foot {
  position: relative;
  margin-top: 36px;
  font-size: 34px;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* Density: the row height and type size a list is set at, so it fills the card without spilling. */
.share-d-xxl { --row: 110px; --fs: 48px; --crest: 62px; }
.share-d-xl { --row: 90px; --fs: 40px; --crest: 52px; }
.share-d-l { --row: 72px; --fs: 34px; --crest: 44px; }
.share-d-m { --row: 57px; --fs: 28px; --crest: 38px; }
.share-d-s { --row: 47px; --fs: 24px; --crest: 32px; }
.share-d-xs { --row: 39px; --fs: 20px; --crest: 26px; }
.share-d-xxs { --row: 32px; --fs: 17px; --crest: 22px; }

/* --- Pieces ------------------------------------------------------------------------------------ */
/* A crest fits a square of the row's size whatever its shape: a tall or wide logo is scaled down
   inside it, never stretching the row. (A block box, not a grid: a grid's auto row would grow to
   a tall image and the image would spill over the rows around it.) */
.share-crest {
  display: block;
  flex: none;
  width: var(--crest);
  height: var(--crest);
  overflow: hidden;
}
.share-crest img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
}
.share-crest--blank {
  visibility: hidden;
}
.share-crestless .share-crest {
  display: none;
}
.share-team {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
}
.share-team__name {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-group__name {
  margin: 0 0 12px;
  color: var(--share-title);
  font-size: calc(var(--fs) * 1.05);
  line-height: 1;
  text-transform: uppercase;
}
.share-matches + .share-group__name {
  margin-top: calc(var(--row) * 0.45);
}

/* A table: place, team, the counts, then the points. The leader's row is printed solid. */
.share-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--fs);
  font-variant-numeric: tabular-nums lining-nums;
}
.share-table th {
  width: calc(var(--fs) * 1.75);
  padding: 0 0 12px;
  border-bottom: 3px solid var(--share-rule-strong);
  color: var(--share-muted);
  font-family: var(--share-text);
  font-size: calc(var(--fs) * 0.48);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}
.share-table td {
  height: var(--row);
  padding: 0 4px;
  border-bottom: 2px solid var(--share-rule);
  text-align: center;
}
.share-table th.share-table__team {
  width: auto;
  text-align: left;
}
.share-table td.share-table__team {
  padding-left: 8px;
  text-align: left;
  text-transform: uppercase;
}
.share-table th.share-table__pos {
  width: calc(var(--fs) * 1.6);
}
.share-table th.share-table__pts {
  width: calc(var(--fs) * 2.3);
}
.share-table td.share-table__pts {
  color: var(--share-number);
  font-size: 1.2em;
}
.share-table tr.is-first td {
  border-bottom-color: var(--share-hl);
  background: var(--share-hl);
  color: var(--share-hl-ink);
}

/* All the groups, in columns; a last row that isn't full is centred (7 groups: 2, 2, 2, then 1 in
   the middle). A wrapping flex row, not a grid: a grid can't centre its last row. */
.share-groups {
  --share-gap: 44px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 36px var(--share-gap);
}
.share-group {
  flex: none;
  width: calc((100% - (var(--share-columns) - 1) * var(--share-gap)) / var(--share-columns));
  min-width: 0;
}
.share-table--mini .share-team {
  gap: 10px;
}

/* A board's leader: the count as the shirt number, the name beside it. */
.share-leader {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 36px;
  padding-bottom: 32px;
  margin-bottom: 8px;
  border-bottom: 3px solid var(--share-rule-strong);
}
.share-leader__number {
  color: var(--share-number);
  font-size: 260px;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 0.76;
  letter-spacing: -0.02em;
}
.share-leader__name {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 84px;
  line-height: 0.9;
  text-transform: uppercase;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.share-leader__team {
  --crest: 44px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 0;
  color: var(--share-muted);
  font-family: var(--share-text);
  font-size: 30px;
  font-weight: 600;
}
.share-leader__team span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A ranked list: place, crest, player and team, the count. */
.share-list {
  margin: 0;
  padding: 0;
  font-size: var(--fs);
  list-style: none;
}
.share-list__row {
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--row);
  border-bottom: 2px solid var(--share-rule);
}
.share-list__rank {
  width: calc(var(--fs) * 1.3);
  flex: none;
  color: var(--share-muted);
  font-variant-numeric: tabular-nums lining-nums;
}
.share-list__who {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: baseline;
  gap: 14px;
}
.share-list__name {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.share-list__team {
  flex: none;
  color: var(--share-muted);
  font-family: var(--share-text);
  font-size: calc(var(--fs) * 0.58);
  font-weight: 600;
  white-space: nowrap;
}
.share-list__value {
  min-width: calc(var(--fs) * 2);
  flex: none;
  color: var(--share-number);
  font-size: 1.15em;
  font-variant-numeric: tabular-nums lining-nums;
  text-align: right;
}

/* Cards: a yellow and a red card, with their counts. */
.share-cards {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
}
.share-cards > span {
  display: inline-grid;
  place-items: center;
  min-width: 1.2em;
  height: 1.5em;
  padding: 0.08em 0.2em 0;
  border-radius: 0.12em;
  color: #fff;
  font-size: 0.78em;
  line-height: 1;
}
.share-cards .share-cards__yellow {
  background: #facc15;
  color: #1c1917;
}
.share-cards .share-cards__red {
  background: #dc2626;
}
.share-cards--big {
  gap: 0.14em;
  font-size: 0.5em;
}

/* Matches: home on the right of its half, the score in the middle, away on the left of its half. */
.share-matches {
  margin: 0;
  padding: 0;
  list-style: none;
}
.share-match {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  height: var(--row);
  border-bottom: 2px solid var(--share-rule);
  font-size: var(--fs);
  text-transform: uppercase;
}
.share-match__side {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}
.share-match__side--home {
  justify-content: flex-end;
  text-align: right;
}
.share-match__side.is-behind {
  color: var(--share-muted);
}
.share-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.22em;
  min-width: 3.2em;
  padding: 0.12em 0.4em 0.04em;
  background: var(--share-hl);
  color: var(--share-hl-ink);
  font-size: 1.12em;
  font-variant-numeric: tabular-nums lining-nums;
}
.share-score__dash {
  opacity: 0.6;
}
.share-match--fixture {
  grid-template-columns: auto minmax(0, 1fr);
  height: auto;
  min-height: var(--row);
  padding: calc(var(--row) * 0.16) 0;
}
.share-time {
  min-width: 3em;
  color: var(--share-number);
  font-variant-numeric: tabular-nums lining-nums;
}
.share-fixture {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}
.share-fixture__teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}
.share-fixture__vs {
  color: var(--share-muted);
  font-size: 0.6em;
}
.share-fixture__field {
  overflow: hidden;
  color: var(--share-muted);
  font-family: var(--share-text);
  font-size: calc(var(--fs) * 0.56);
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

/* A bracket: rounds as columns, each pair of ties joined to the tie it feeds. */
.share-bracket {
  display: grid;
  grid-template-columns: repeat(var(--share-rounds), minmax(0, 1fr));
  gap: 40px;
}
.share-round {
  display: flex;
  min-width: 0;
  flex-direction: column;
}
.share-round__name {
  margin: 0 0 8px;
  overflow: hidden;
  color: var(--share-title);
  font-size: calc(var(--fs) * 0.92);
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.share-round__ties,
.share-round__pair {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-around;
}
.share-round__pair {
  position: relative;
}
.share-round__pair.is-joined::after {
  position: absolute;
  top: 25%;
  right: -20px;
  bottom: 25%;
  width: 20px;
  border: 3px solid var(--share-rule-strong);
  border-left: 0;
  content: "";
}
.share-round__pair.is-fed::before {
  position: absolute;
  top: 50%;
  right: -40px;
  width: 40px;
  border-top: 3px solid var(--share-rule-strong);
  content: "";
}
.share-round__pair.is-joined::before {
  width: 20px;
}
.share-tie {
  position: relative;
  margin: 5px 0;
  border-top: 3px solid var(--share-rule-strong);
  border-bottom: 3px solid var(--share-rule-strong);
}
.share-tie__label {
  margin: 0;
  padding: 8px 0 0;
  color: var(--share-muted);
  font-family: var(--share-text);
  font-size: calc(var(--fs) * 0.48);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.share-tie__side {
  --crest: calc(var(--row) * 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--row) * 0.82);
  padding: 0 10px;
  font-size: calc(var(--fs) * 0.86);
  text-transform: uppercase;
}
.share-tie__side + .share-tie__side {
  border-top: 2px solid var(--share-rule);
}
.share-tie__side.is-winner {
  background: var(--share-hl);
  color: var(--share-hl-ink);
}
.share-tie__name {
  overflow: hidden;
  min-width: 0;
  flex: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-tie__side.is-open .share-tie__name {
  color: var(--share-muted);
  font-family: var(--share-text);
  font-size: 0.74em;
  font-weight: 600;
  text-transform: none;
}
.share-tie__score {
  flex: none;
  font-size: 1.1em;
  font-variant-numeric: tabular-nums lining-nums;
}
.share-tie__score small {
  margin-left: 0.2em;
  font-size: 0.6em;
  opacity: 0.75;
}

/* --- Jersey: the back of the league's shirt, everything printed on it in white ---------------- */
.share-design--jersey {
  --share-muted: #fff;
  --share-rule: rgb(255 255 255 / 0.85);
  padding-left: 110px;
  padding-right: 110px;
  text-align: center;
}
.share-design--jersey .share-card__ground {
  background-image:
    /* the knit: a fine pique of darker and lighter threads */
    radial-gradient(circle at 2px 2px, rgb(0 0 0 / 0.1) 1.1px, transparent 1.4px),
    radial-gradient(circle at 5px 5px, rgb(255 255 255 / 0.05) 1.1px, transparent 1.4px),
    linear-gradient(180deg, rgb(255 255 255 / 0.06), transparent 30%, transparent 70%, rgb(0 0 0 / 0.14));
  background-size: 6px 6px, 6px 6px, 100% 100%;
}
/* the side panels, in the accent with a white pinstripe */
.share-design--jersey .share-card__ground::before,
.share-design--jersey .share-card__ground::after {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36px;
  background: linear-gradient(90deg, var(--share-accent) 0 25px, #fff 25px 29px, var(--share-accent) 29px 36px);
  content: "";
}
.share-design--jersey .share-card__ground::before {
  left: 0;
}
.share-design--jersey .share-card__ground::after {
  right: 0;
  transform: scaleX(-1);
}
/* the collar, a ribbed band in the accent */
.share-design--jersey::before {
  position: absolute;
  top: -150px;
  left: 50%;
  width: 460px;
  height: 260px;
  border: 34px solid var(--share-accent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px #fff, inset 0 14px 30px -10px rgb(0 0 0 / 0.35);
  background: color-mix(in oklab, var(--share-primary) 82%, black);
  content: "";
  transform: translateX(-50%);
}
.share-design--jersey .share-card__head {
  justify-content: center;
  margin-top: 56px;
  min-height: 112px;
}
.share-design--jersey .share-card__logo {
  display: block;
  overflow: hidden;
  width: 112px;
  height: 112px;
  padding: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px var(--share-primary), 0 0 0 7px #fff;
}
.share-design--jersey .share-card__logo img {
  width: 100%;
  height: 100%;
}
.share-design--jersey .share-card__title {
  margin-top: 26px;
}
.share-design--jersey .share-card__title h3 {
  display: none;
}
.share-design--jersey .share-card__arc {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 -38px;
  width: calc(100% + 76px);
  overflow: visible;
}
.share-design--jersey .share-card__arc text {
  fill: #fff;
  font-family: var(--share-display);
  font-weight: 800;
  letter-spacing: 4px;
  text-transform: uppercase;
}
.share-design--jersey .share-card__tag {
  margin-top: 4px;
  color: #fff;
  font-size: 44px;
  letter-spacing: 0.1em;
}
.share-design--jersey .share-card__body {
  margin-top: 28px;
}
.share-design--jersey .share-leader__name {
  font-size: 70px;
}
.share-design--jersey .share-card__foot {
  font-size: 32px;
}
/* a printed shirt carries no colored crests */
.share-design--jersey .share-crest {
  display: none;
}
.share-design--jersey .share-leader {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 14px;
}
.share-design--jersey .share-leader__number {
  font-size: 230px;
  -webkit-text-stroke: 10px var(--share-accent);
  paint-order: stroke fill;
}
.share-design--jersey .share-leader__team {
  justify-content: center;
}
.share-design--jersey .share-list__row,
.share-design--jersey .share-group__name {
  text-align: left;
}

/* --- Paper: a sports daily's back page, black ink and the league's color as the spot ---------- */
.share-design--paper {
  --share-ground: #f3efe4;
  --share-ink: #141414;
  --share-muted: #5a554c;
  --share-rule: #141414;
  --share-rule-strong: #141414;
  --share-title: #141414;
  --share-hl: var(--share-primary);
  --share-hl-ink: #fff;
  --share-number: #141414;
}
.share-design--paper .share-card__head {
  padding-bottom: 20px;
  border-bottom: 10px solid #141414;
}
.share-design--paper .share-card__title h3 {
  letter-spacing: -0.02em;
}
.share-design--paper .share-card__tag {
  color: var(--share-primary);
}
.share-design--paper .share-table td {
  border-bottom-width: 1.5px;
}
.share-design--paper .share-leader__number {
  color: var(--share-primary);
}
.share-design--paper .share-card__foot {
  padding-top: 16px;
  border-top: 10px solid #141414;
}

/* --- Solid: the league's color, framed in the accent with a white pinline ----------------------- */
.share-design--solid .share-card__ground {
  box-shadow: inset 0 0 0 24px var(--share-accent), inset 0 0 0 29px #fff;
}
.share-design--solid .share-card__tag {
  color: #fff;
}
.share-design--solid .share-card__tag::after {
  display: block;
  width: 120px;
  height: 12px;
  margin-top: 22px;
  background: var(--share-accent);
  box-shadow: 0 0 0 3px #fff;
  content: "";
}

/* --- Solid and light: centred, the logo over the words ---------------------------------------- */
.share-design--solid .share-card__head,
.share-design--light .share-card__head {
  justify-content: center;
}
.share-design--solid .share-card__title,
.share-design--light .share-card__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 32px;
  text-align: center;
}
.share-design--solid .share-card__foot,
.share-design--light .share-card__foot {
  text-align: center;
}
.share-design--solid .share-card__tag::after {
  margin-right: auto;
  margin-left: auto;
}
/* swapped: the title small on top, what it's about large under it */
.share-card__title--swapped h3 {
  color: var(--share-muted);
  letter-spacing: 0.08em;
}
.share-card__title--swapped .share-card__tag {
  margin-top: 14px;
  color: var(--share-title);
  line-height: 0.84;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.share-design--light .share-card__title--swapped h3 {
  color: var(--share-accent);
}

/* --- Light: white, with the league's color in the title and the leader ------------------------- */
.share-design--light {
  --share-ground: #fff;
  --share-ink: #121417;
  --share-muted: #5b616a;
  --share-rule: #e2e5e9;
  --share-rule-strong: #121417;
  --share-title: var(--share-primary);
  --share-hl: var(--share-primary);
  --share-hl-ink: #fff;
  --share-number: var(--share-primary);
}
.share-design--light .share-card__ground {
  border-top: 26px solid var(--share-primary);
  box-shadow: inset 0 8px 0 var(--share-accent);
}
.share-design--light .share-card__tag {
  color: var(--share-accent);
}
.share-design--light.share-card--post {
  padding-top: 84px;
}
.share-design--light .share-card__title--swapped .share-card__tag {
  color: var(--share-title);
}
