/* brovbro game tile (public/gamecard.js): icon, short name, how to win, who brought it and what
   happened to it. The tile fills the width it is given; lg about 220-320 px, md 160-240 px,
   sm about 130-170 px (the stream strip). Needs theme.css for the tokens. */

.gct {
  --oc: var(--violet);
  --oc-hi: var(--violet-hi);
  --oc-deep: var(--violet-deep);
  --wc: var(--muted);
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel) 60%);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  text-align: left;
  overflow: hidden;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
button.gct {
  cursor: pointer;
  transition:
    transform 0.14s var(--ease-out),
    box-shadow 0.14s var(--ease-out);
}
button.gct:hover {
  transform: translateY(-2px);
}
button.gct:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}
button.gct:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.gct-o0 {
  --oc: var(--blue);
  --oc-hi: var(--blue-hi);
  --oc-deep: var(--blue-deep);
}
.gct-o1 {
  --oc: var(--red);
  --oc-hi: var(--red-hi);
  --oc-deep: var(--red-deep);
}
.gct-w0 {
  --wc: var(--blue);
}
.gct-w1 {
  --wc: var(--red);
}

/* the art: the 3D icon on a burst in the owner's color, an owner band along the top */
.gct-art {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border-bottom: 3px solid var(--ink);
  background:
    radial-gradient(70% 80% at 50% 45%, color-mix(in srgb, var(--oc) 75%, transparent), transparent 75%),
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 255, 255, 0.08) 0 9deg, transparent 9deg 24deg),
    linear-gradient(180deg, var(--oc-deep), #120f24);
  overflow: hidden;
}
.gct-art::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  background: var(--oc);
  box-shadow: 0 2px 0 var(--ink);
  z-index: 1;
}
.gct-ico {
  display: block;
  height: 92%;
  width: auto;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.4));
  user-select: none;
  -webkit-user-drag: none;
}

.gct-body {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 8px 10px 10px;
}
.gct-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 400 22px/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 2px 0 var(--ink);
}
.gct-win {
  display: block;
  font: 700 14px/1.22 var(--font-body);
  color: #e4e1f5;
  text-wrap: balance;
}

/* the corner tag: whose pick, up next, the opener, who won */
.gct-tag {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 16px);
  padding: 4px 7px 3px;
  border: 2.5px solid var(--ink);
  border-radius: 7px;
  background: var(--oc-deep);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  font: 800 11px/1 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
}
.gct-tag span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gct-tag svg {
  flex: none;
  width: 13px;
  height: 13px;
}
.gct-on .gct-tag {
  background: var(--violet);
}

/* up next: gold frame that breathes */
.gct.is-next {
  border-color: var(--ink);
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.45),
    0 0 0 3px var(--gold),
    0 0 26px rgba(255, 201, 60, 0.55);
  animation: gct-next 1.6s ease-in-out infinite;
}
.gct.is-next .gct-tag {
  background: var(--gold);
  color: var(--ink);
}
@keyframes gct-next {
  50% {
    box-shadow:
      0 5px 0 rgba(0, 0, 0, 0.45),
      0 0 0 3px var(--gold),
      0 0 40px rgba(255, 201, 60, 0.8);
  }
}

/* the opener: fixed, so it wears a lock */
.gct.is-locked .gct-tag {
  background: #fff;
  color: var(--ink);
}
.gct.is-locked {
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.45),
    0 0 0 3px rgba(255, 255, 255, 0.85);
}

/* played: the art goes grey and a slash in the winner's color crosses the tile */
.gct.is-done .gct-art {
  filter: grayscale(0.9) brightness(0.55);
}
/* the name stays readable: no strike through it, the slash and the tag say it is done */
.gct.is-done .gct-name {
  color: #d6d3ea;
}
.gct.is-done .gct-win {
  color: #b9b5d3;
}
.gct-slash {
  position: absolute;
  z-index: 2;
  left: -10%;
  right: -10%;
  top: 34%;
  height: 12px;
  margin-top: -6px;
  border-block: 3px solid var(--ink);
  background: var(--wc);
  transform: rotate(-16deg);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.gct.is-played .gct-slash,
.gct.is-draw .gct-slash {
  background: #8f8bb0;
}
.gct.gct-w0 .gct-tag {
  background: var(--blue-deep);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5), inset 0 -3px 0 var(--blue);
}
.gct.gct-w1 .gct-tag {
  background: var(--red-deep);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5), inset 0 -3px 0 var(--red);
}
.gct.is-draw .gct-tag,
.gct.is-played .gct-tag {
  background: var(--panel-hi);
}

/* sizes */
.gct-lg {
  border-radius: 18px;
}
.gct-lg .gct-body {
  padding: 10px 14px 14px;
  gap: 6px;
}
.gct-lg .gct-name {
  font-size: 30px;
}
.gct-lg .gct-win {
  font-size: 16px;
}
.gct-lg .gct-tag {
  top: 14px;
  left: 10px;
  font-size: 12px;
  padding: 5px 8px 4px;
}
.gct-lg .gct-slash {
  height: 16px;
  margin-top: -8px;
}

.gct-sm {
  border-radius: 12px;
}
.gct-sm .gct-art {
  aspect-ratio: 16 / 11;
}
.gct-sm .gct-art::before {
  height: 5px;
}
.gct-sm .gct-body {
  padding: 6px 8px 8px;
}
.gct-sm .gct-name {
  font-size: 20px;
  text-align: center;
}
.gct-sm .gct-tag {
  top: 9px;
  left: 6px;
  max-width: calc(100% - 12px);
  font-size: 11px;
  padding: 3px 6px 2px;
}
.gct-sm .gct-tag svg {
  width: 12px;
  height: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .gct.is-next {
    animation: none;
  }
  button.gct {
    transition: none;
  }
}
