/*
 * Librarium Militaris — battle report cards and their two layouts.
 */

.cardgrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .cardgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .cardgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .cardgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------- card -- */

.card {
  display: flex;
  flex-direction: column;
  background-color: var(--grim-800);
  border: 1px solid var(--grim-700);
  border-radius: 0.125rem;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: var(--accent-50);
  box-shadow: 0 0 15px rgba(229, 169, 61, 0.1);
}

.card__thumb {
  display: block;
  position: relative;
  flex: none;
  aspect-ratio: 16 / 9;
  background-color: #000;
  cursor: pointer;
  overflow: hidden;
}

.card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.card:hover .card__thumb img {
  opacity: 1;
  transform: scale(1.05);
}

.card__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.card:hover .card__play,
.card__thumb:focus-visible .card__play {
  opacity: 1;
}

/* Sized rather than padded: the icon's optical offset would otherwise widen the
   box on one axis only and turn the circle into an ellipse. */
.card__play span {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  background-color: var(--accent-90);
  color: #000;
  border-radius: 9999px;
  transform: scale(0.9);
  transition: transform 0.15s ease;
}

.card:hover .card__play span { transform: scale(1); }

/* No optical nudge: the icon path already carries one. Its vertices are
   (8,5) (8,19) (19,12), putting the centroid at x=11.67 in a 24-wide viewBox,
   so flex centring alone lands the triangle's visual mass on the circle's
   centre. Shifting it further is what made it look right-heavy. */
.card__play svg {
  width: 1.5rem;
  height: 1.5rem;
}

.card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  padding: 1rem;
}

/* ---------------------------------------------------------------- matchup -- */

.card__matchup {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  line-height: 1.25rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.card__dot {
  width: 0.5rem;
  height: 0.5rem;
  flex: none;
  border-radius: 0.125rem;
  box-shadow: 0 0 5px currentColor;
}

.card__faction {
  min-width: 0;
  color: var(--zinc-200);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.card__faction:hover { color: #fff; }

.card__vs {
  flex: none;
  margin: 0 0.25rem;
  color: var(--zinc-600);
  font-size: 0.75rem;
  line-height: 1rem;
  font-style: italic;
  transition: color 0.15s ease;
}

.card__vs:hover { color: var(--accent); }

.card__faction:focus-visible,
.card__vs:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease;
}

.card__title:hover { color: var(--accent); }

.card__title:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------- tags -- */

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: auto;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.125rem 0.5rem;
  background-color: var(--grim-900);
  border: 1px solid var(--grim-700);
  border-radius: 0.125rem;
  color: var(--zinc-400);
  font-size: 0.75rem;
  line-height: 1rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tag:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.tag:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tag svg {
  width: 0.75rem;
  height: 0.75rem;
  flex: none;
  opacity: 0.7;
}

.tag__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------------------------------------------- result -- */

.card__result {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--grim-700-50);
}

/* Both outcomes are in the markup; .archive-root--spoilers picks which one shows. */
.card__result-open {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* Nothing to spoil when the outcome was never recorded, so it stays visible. */
.archive-root--spoilers .card__result-open:not(.card__result-open--unknown) { display: none; }

.card__result-placeholder {
  color: var(--zinc-600);
  font-family: var(--font-heading);
  letter-spacing: 0.1em;
  cursor: help;
}

.archive-root--spoilers .spoiler { display: flex; }

.card__result-label { color: var(--zinc-400); }

.card__result-value {
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  text-align: right;
}

.card__score {
  margin-left: 0.25rem;
  color: var(--zinc-500);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1rem;
  text-transform: none;
}

/* Masked until clicked, so browsing the index never spoils the outcome. */
.spoiler {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.375rem 0.5rem;
  background-color: var(--zinc-900);
  border: 1px solid var(--zinc-700);
  border-radius: 0.25rem;
  color: var(--zinc-500);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0.05em;
  text-align: center;
  cursor: pointer;
  user-select: none;
  filter: blur(4px);
  transition: filter 0.3s ease, color 0.15s ease;
}

.spoiler:hover {
  filter: blur(2px);
  color: var(--zinc-300);
}

.spoiler svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.spoiler.is-revealed,
.spoiler.is-revealed:hover {
  filter: blur(0);
  cursor: default;
}

.spoiler__prompt {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.spoiler__answer { display: none; }

.spoiler.is-revealed .spoiler__prompt { display: none; }
.spoiler.is-revealed .spoiler__answer { display: inline; }

.spoiler__winner {
  color: var(--accent);
  font-weight: 700;
}

.spoiler__score { color: var(--zinc-400); }

/* ------------------------------------------------------------------- meta -- */

.card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--grim-700-50);
  color: var(--zinc-500);
  font-size: 0.75rem;
  line-height: 1rem;
}

.card__channel {
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  transition: color 0.15s ease;
}

.card__channel:hover { color: #fff; }

.card__stat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.card__stat svg {
  width: 0.75rem;
  height: 0.75rem;
  flex: none;
}
