/* Team initial avatars + match-detail modal restyle.
   Loaded last on the homepage only.
   Rule: the Amsal crest (/logo.png) is for Amsal FC only. Any other team
   without a logo gets a circle with its first grapheme (e.g. B, S, ब्र)
   — never the crest. Broken logo URLs hide themselves and reveal the
   hidden initial sibling (see the onerror handlers in index.astro). */

/* ---- Initial avatar base ---- */
.team-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: #181733;
  color: #ffffff;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  user-select: none;
}
/* Hero cards: match the 44px crest (36px on phones). */
.tp-team .team-initial {
  width: 44px;
  height: 44px;
  font-size: 20px;
  margin: 0 auto 6px;
}
/* Match Center cards: match the 52px team-logo. */
.match-content .team .team-initial {
  width: 52px;
  height: 52px;
  font-size: 22px;
  margin: 0 auto 8px;
}
/* Events fixture lists: match the 26px fixture-logo, inline with the name. */
.team-initial.fixture-initial {
  width: 26px;
  height: 26px;
  font-size: 12px;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: none;
}
@media (max-width: 600px) {
  .tp-team .team-initial { width: 36px; height: 36px; font-size: 17px; }
  .match-content .team .team-initial { width: 44px; height: 44px; font-size: 20px; }
}

/* ---- Match-detail modal restyle (FC Barcelona design-language tokens) ----
   Before: a plain white panel (style.css .modal-content) with a bounce
   scale-in, unstyled team rows and label: value paragraphs.
   After: dark canvas #181733 panel, surface #154284 details card floating
   on it, white primary text, gold #fdc52c sparingly (status pill, dark
   text on gold), red #cd122d for the Live pill, condensed-bold team
   names and score, pill (9999px) status badges, 6-10px card radii, one
   soft shadow, compact gaps, calm 200-300ms motion, visible focus ring.
   Light mode inverts the same tokens sensibly (light panel + white
   details card + dark ink) — no white-on-white, no dark-on-dark. */
#match-detail-modal .modal-content.match-detail-content {
  background: #181733 !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 10px !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5) !important;
  padding: 24px !important;
  max-width: 480px !important;
  width: calc(100% - 32px) !important;
  transform: none !important;
  transition: opacity 200ms ease !important;
}
#match-detail-modal.active .modal-content.match-detail-content {
  transform: none !important;
}
#match-detail-modal .modal-content.match-detail-content .modal-close {
  background: #fdc52c !important;
  color: #181733 !important;
  border: none !important;
  box-shadow: none !important;
}
#match-detail-modal .modal-content.match-detail-content .modal-close:hover {
  background: #fdc52c !important;
  color: #181733 !important;
}
#match-detail-modal .modal-content.match-detail-content .modal-close:focus-visible {
  outline: 3px solid #5e9ed6 !important;
  outline-offset: 2px !important;
}
.md-teams {
  display: flex;
  align-items: center;
  gap: 7px;
}
.md-team {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  min-width: 0;
}
.modal-team-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.team-initial.modal-team-initial {
  width: 56px;
  height: 56px;
  font-size: 24px;
}
.md-team-name {
  font-family: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  overflow-wrap: anywhere;
}
.md-centre {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.md-score {
  font-family: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
}
.md-vs-text {
  font-family: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  color: #fdc52c;
}
.md-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 800;
  background: #fdc52c;
  color: #181733;
}
.md-status-live { background: #cd122d; color: #ffffff; }
.md-status-scheduled { background: #154284; color: #ffffff; }
.md-status-cancelled, .md-status-postponed { background: #154284; color: #ffffff; }
/* One details surface card — rows have no borders or nested boxes. */
.md-details {
  background: #154284;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
  display: grid;
  gap: 7px;
}
.md-details > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: none !important;
}
.md-details > div > span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}
.md-details > div > strong {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  text-align: right;
}
.md-details > .md-notes { flex-direction: column; }
.md-details > .md-notes > strong { text-align: left; font-weight: 400; }
/* Light mode: same tokens inverted — light panel, white details card. */
html[data-theme="light"] #match-detail-modal .modal-content.match-detail-content {
  background: #f5f5f6 !important;
  color: #181733 !important;
}
html[data-theme="light"] .md-team-name,
html[data-theme="light"] .md-score { color: #181733; }
html[data-theme="light"] .md-vs-text { color: #154284; }
html[data-theme="light"] .md-details { background: #ffffff; }
html[data-theme="light"] .md-details > div > span { color: #666666; }
html[data-theme="light"] .md-details > div > strong { color: #181733; }
@media (prefers-reduced-motion: reduce) {
  #match-detail-modal .modal-content.match-detail-content { transition: none !important; }
}
