/* Shared Match Card Component (#126)
   Single source of truth for collapsed + expanded match cards across Scoreboard and Match Hub. */

.inoff-mc-list {
  background: #ffffff;
  border: 1px solid #d8d0c0;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(28, 28, 22, 0.04);
  overflow: hidden;
  display: block;
}

.inoff-mc {
  --mc-duration: 280ms;
  --mc-ease: cubic-bezier(0.22, 1, 0.36, 1);
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  overflow: hidden;
  box-shadow: none;
}

.inoff-mc + .inoff-mc {
  border-top: 1px dotted #d8d0c0;
}

.inoff-mc-header {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0 10px 0 12px;
  min-height: 46px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 34px;
  align-items: stretch;
  gap: 0 8px;
  text-align: left;
  font-family: inherit;
  color: #1c1c16;
  cursor: pointer;
}

.inoff-mc.is-h2h:not(.has-status) > .inoff-mc-header {
  grid-template-columns: 48px minmax(0, 1fr) 34px;
}

@media (hover: hover) {
  .inoff-mc-header:hover {
    background: #faf7f0;
  }
}

.inoff-mc-header:focus-visible {
  outline: 2px solid #47626c;
  outline-offset: -2px;
}

.inoff-mc-date {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 6px 0;
  font-size: 11px;
  line-height: 1.25;
  color: #59413a;
  font-weight: 500;
  white-space: nowrap;
}

.inoff-mc-date-top {
  font-weight: 600;
  color: #59413a;
}

.inoff-mc-date-sub {
  font-size: 10px;
  color: #6b767b;
}

.inoff-mc-names {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: #1c1c16;
}

.inoff-mc-names.is-h2h {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  padding: 0;
}

.inoff-mc-p1 {
  min-width: 0;
  text-align: right;
  padding: 6px 0;
  line-height: 1.2;
  overflow-wrap: break-word;
}

.inoff-mc-p2 {
  min-width: 0;
  text-align: left;
  padding: 6px 0;
  line-height: 1.2;
  overflow-wrap: break-word;
}

.inoff-mc-mid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 46px;
  padding: 0 7px;
  font-variant-numeric: tabular-nums;
}

.inoff-mc-mid.has-score {
  background: #f3efe6;
}

.inoff-mc-score {
  font-family: 'Oswald', 'Arial Narrow', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  color: #1c1c16;
  white-space: nowrap;
}

.inoff-mc-vs {
  font-size: 11px;
  font-weight: 600;
  color: #6b767b;
  text-transform: lowercase;
}

.inoff-mc-outcome {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 0 7px;
  min-height: 46px;
  background: #f3efe6;
}

.inoff-mc.is-h2h .inoff-mc-outcome {
  background: transparent;
  padding: 0;
}

.inoff-mc-outcome[hidden] {
  display: none;
}

.inoff-mc-wld {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
}

.inoff-mc-wld.is-win { background: #2e7d32; }
.inoff-mc-wld.is-loss { background: #c62828; }
.inoff-mc-wld.is-draw { background: #6b767b; }

.inoff-mc-status {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  line-height: 1.3;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fff3cd;
  color: #7c5200;
  white-space: nowrap;
}

.inoff-mc-status[hidden] {
  display: none;
}

.inoff-mc-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 14px;
  color: #8a9499;
}

.inoff-mc-chevron-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.inoff-mc-chevron-icon svg {
  transition: transform var(--mc-duration) var(--mc-ease);
}

.inoff-mc.is-open .inoff-mc-chevron-icon svg {
  transform: rotate(180deg);
}

.inoff-mc-video-ind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #47626c;
  pointer-events: none;
  flex-shrink: 0;
}

.inoff-mc-video-ind[hidden] {
  display: none;
}

.inoff-mc.is-open > .inoff-mc-header .inoff-mc-video-ind {
  display: none;
}

.inoff-mc-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Portrait reveal inside expanded header */
.inoff-mc-portrait-reveal {
  grid-column: 1 / -1;
}

.inoff-mc-portraits {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  padding: 6px 0 4px;
}

.inoff-mc-portraits > :first-child {
  justify-self: end;
}

.inoff-mc-portraits > :last-child {
  grid-column: 3;
  justify-self: start;
}

.inoff-mc-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #8da9b4;
  color: #1c1c16;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.inoff-mc-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Smooth grid-template-rows expand/collapse */
.inoff-mc-panel,
.inoff-mc-portrait-reveal {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows var(--mc-duration) var(--mc-ease),
              visibility 0s var(--mc-duration);
}

.inoff-mc.is-open .inoff-mc-panel,
.inoff-mc.is-open .inoff-mc-portrait-reveal {
  grid-template-rows: 1fr;
  visibility: visible;
  transition-delay: 0s;
}

.inoff-mc-clip {
  min-height: 0;
  overflow: hidden;
}

/* Expanded header layout (centered date + portraits + names) */
.inoff-mc.is-open > .inoff-mc-header {
  grid-template-columns: 14px minmax(0, 1fr) 14px;
  grid-template-areas:
    ". date chevron"
    "names names names";
  align-items: center;
  gap: 2px 8px;
  padding: 10px 12px 6px;
}

.inoff-mc.is-open > .inoff-mc-header .inoff-mc-date {
  grid-area: date;
  flex-direction: row;
  justify-content: center;
  align-items: baseline;
  gap: 5px;
  padding: 0;
  text-align: center;
}

.inoff-mc.is-open > .inoff-mc-header .inoff-mc-names {
  grid-area: names;
  justify-content: center;
}

.inoff-mc.is-open > .inoff-mc-header .inoff-mc-outcome {
  grid-area: date;
  justify-self: start;
  min-height: auto;
  background: transparent;
  padding: 0;
}

.inoff-mc.is-open > .inoff-mc-header .inoff-mc-chevron {
  grid-area: chevron;
  min-height: 20px;
}

.inoff-mc.is-open > .inoff-mc-header .inoff-mc-mid {
  min-height: 32px;
  background: transparent;
}

/* Expanded body (Portrait / narrow default) */
.inoff-mc-body {
  padding: 6px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inoff-mc-context {
  margin: 0;
  padding: 10px 12px;
  background: #f3efe6;
  border-radius: 10px;
  display: grid;
  gap: 6px;
}

.inoff-mc-context[hidden] {
  display: none;
}

.inoff-mc-pair {
  display: grid;
  grid-template-columns: minmax(82px, 34%) minmax(0, 1fr);
  align-items: baseline;
  column-gap: 10px;
  min-width: 0;
}

.inoff-mc-pair[hidden] {
  display: none;
}

.inoff-mc-dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #47626c;
  white-space: nowrap;
}

.inoff-mc-dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #1c1c16;
  min-width: 0;
  overflow-wrap: break-word;
}

.inoff-mc-dd a {
  color: #47626c;
  text-decoration: underline;
  text-decoration-color: #8da9b4;
}

/* Expanded video thumbnail tile (#161) */
.inoff-mc-video {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  min-height: 48px;
  border: 1px solid #d8d0c0;
  border-radius: 10px;
  background: #faf7f0;
  color: #1c1c16;
  text-decoration: none;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.inoff-mc-video[hidden] {
  display: none;
}

@media (hover: hover) {
  .inoff-mc-video:hover {
    border-color: #47626c;
    background: #f3efe6;
  }
}

.inoff-mc-video:focus-visible {
  outline: 2px solid #47626c;
  outline-offset: 2px;
}

.inoff-mc-video-preview {
  position: relative;
  width: clamp(120px, 42%, 172px);
  aspect-ratio: 16 / 9;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 7px;
  background: #47626c;
}

.inoff-mc-video-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 1;
  transition: opacity 160ms ease;
}

.inoff-mc-video-thumb.is-loading {
  opacity: 0;
}

.inoff-mc-video-thumb[hidden] {
  display: none;
}

.inoff-mc-video-play {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(253, 249, 240, 0.94);
  color: #aa3600;
  box-shadow: 0 2px 6px rgba(28, 28, 22, 0.22);
}

.inoff-mc-video-play svg {
  width: 18px;
  height: 18px;
}

.inoff-mc-video-caption {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.inoff-mc-video-caption strong {
  font-size: 13px;
  font-weight: 600;
  color: #1c1c16;
  line-height: 1.25;
}

.inoff-mc-video-host {
  font-size: 11px;
  color: #59413a;
  overflow-wrap: anywhere;
}

.inoff-mc-lower {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inoff-mc-meta {
  margin: 0;
  padding: 0 2px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
}

.inoff-mc-meta[hidden] {
  display: none;
}

.inoff-mc-meta .inoff-mc-pair {
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 7px;
}

.inoff-mc-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.inoff-mc-actions .btn {
  min-height: 44px;
  padding: 0 16px;
  white-space: nowrap;
}

.inoff-mc-readonly {
  font-size: 12px;
  font-weight: 600;
  color: #59413a;
  padding: 4px 10px;
  border-radius: 9999px;
  background: #f3efe6;
  white-space: nowrap;
}

/* Very narrow mobile header stacking */
@media (max-width: 375px) {
  .inoff-mc:not(.is-open) > .inoff-mc-header {
    grid-template-columns: minmax(0, 1fr) auto 34px;
    grid-template-areas:
      "date outcome chevron"
      "names outcome chevron";
    align-items: center;
    gap: 1px 8px;
    padding: 5px 10px 5px 12px;
  }

  .inoff-mc:not(.is-open) > .inoff-mc-header .inoff-mc-date {
    grid-area: date;
    flex-direction: row;
    gap: 5px;
    padding: 0;
  }

  .inoff-mc:not(.is-open) > .inoff-mc-header .inoff-mc-names {
    grid-area: names;
  }

  .inoff-mc:not(.is-open) > .inoff-mc-header .inoff-mc-outcome {
    grid-area: outcome;
    min-height: 36px;
  }

  .inoff-mc:not(.is-open) > .inoff-mc-header .inoff-mc-chevron {
    grid-area: chevron;
  }
}

/* Responsive 2-column landscape list + FULL-WIDTH NON-WRAPPING expanded card (#124 / #126) */
@media (orientation: landscape) and (min-width: 600px) {
  .inoff-mc-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: dense;
    align-items: start;
    column-gap: 10px;
    row-gap: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  .inoff-mc-list > .inoff-mc {
    background: #ffffff;
    border: 0;
    border-left: 1px solid #d8d0c0;
    border-right: 1px solid #d8d0c0;
    border-radius: 0;
  }

  .inoff-mc-list > .inoff-mc + .inoff-mc {
    border-top: 0;
  }

  .inoff-mc-list > .inoff-mc:nth-child(-n + 2) {
    border-top: 1px solid #d8d0c0;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
  }

  .inoff-mc-list > .inoff-mc:nth-child(n + 3) {
    border-top: 1px dotted #d8d0c0;
  }

  .inoff-mc-list > .inoff-mc:nth-last-child(-n + 2) {
    border-bottom: 1px solid #d8d0c0;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
  }

  /* Full-width expanded card: 2 clean horizontal non-wrapping rows */
  .inoff-mc-list > .inoff-mc.is-open {
    grid-column: 1 / -1;
    border: 1px solid #47626c;
    border-radius: 14px;
    margin-block: 6px;
    box-shadow: 0 4px 14px rgba(28, 28, 22, 0.08);
  }

  .inoff-mc.is-open .inoff-mc-body {
    padding: 6px 16px 14px;
    gap: 10px;
  }

  .inoff-mc.is-open .inoff-mc-video {
    align-self: stretch;
    gap: 16px;
    padding: 10px 14px;
  }

  .inoff-mc.is-open .inoff-mc-video-preview {
    width: clamp(180px, 28%, 240px);
  }

  .inoff-mc.is-open .inoff-mc-video-play {
    width: 38px;
    height: 38px;
  }

  .inoff-mc.is-open .inoff-mc-video-play svg {
    width: 22px;
    height: 22px;
  }

  /* Row 1: Full-width cream context strip (Venue + Competition side-by-side, zero wrapping) */
  .inoff-mc.is-open .inoff-mc-context {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px 24px;
    padding: 9px 14px;
  }

  .inoff-mc.is-open .inoff-mc-context .inoff-mc-pair {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    flex: 0 1 auto;
  }

  .inoff-mc.is-open .inoff-mc-context .inoff-mc-dd {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Row 2: Full-width metadata strip on left (zero wrapping) + actions anchored right */
  .inoff-mc.is-open .inoff-mc-lower {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }

  .inoff-mc.is-open .inoff-mc-meta {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 8px 18px;
    padding: 0 2px;
    min-width: 0;
    overflow: hidden;
  }

  .inoff-mc.is-open .inoff-mc-meta .inoff-mc-pair {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .inoff-mc.is-open .inoff-mc-meta .inoff-mc-dd {
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .inoff-mc-panel,
  .inoff-mc-portrait-reveal,
  .inoff-mc-chevron svg {
    transition: none;
  }
}
