/* War Cards (src/ui/cards.js): the button by the commander's portrait and the
   picker. Its own sheet, drawn from the palette and the type of style.css:
   gunmetal, bone and brass, Oswald for names, Montserrat for rules, Kameron
   for the line of colour. Three rarities, told apart by the frame:
   Field in steel, Staff in brass, Supreme in ember. */

/* ------------------------------------------------------------ the button */
.wc-btn {
  position: absolute; right: calc(100% + 26px); top: 8px; width: 48px; height: 48px; padding: 5px;
  display: grid; place-items: center; cursor: pointer; color: var(--brass, #c9a949);
  border: 1px solid var(--brass-dim, #8d7631); border-radius: 6px;
  background: linear-gradient(180deg, #2f3137, #17181c);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: filter .12s, transform .12s, border-color .12s;
}
.wc-btn svg { width: 100%; height: 100%; display: block; }
.wc-btn:hover { filter: brightness(1.2); border-color: var(--gold, #fff9bf); transform: translateY(-1px); }
.wc-btn .badge { top: -6px; right: -6px; }
.wc-btn.ready { color: #f3d67a; border-color: #e9c765; animation: wc-beckon 2.2s ease-in-out infinite; }
@keyframes wc-beckon {
  0%, 100% { box-shadow: 0 3px 10px rgba(0, 0, 0, .6), 0 0 0 0 rgba(233, 199, 101, .55); }
  50% { box-shadow: 0 3px 10px rgba(0, 0, 0, .6), 0 0 0 7px rgba(233, 199, 101, 0); }
}

/* ------------------------------------------------------------- the layer */
.wc-layer {
  --wc-field: #a9b2ba; --wc-staff: #e2bf5a; --wc-supreme: #f0703f;
  position: fixed; inset: 0; right: var(--ad-w, 0px); z-index: 88; outline: none;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(60, 52, 28, .35), transparent 62%),
    rgba(6, 7, 9, .9);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: wc-fade .22s ease both; overflow-y: auto;
  font-family: var(--f-ui, Montserrat, sans-serif); color: var(--text, #e5e2d5);
}
@keyframes wc-fade { from { opacity: 0; } }

.wc-stage { position: relative; width: min(900px, 100%); margin: auto; text-align: center; }
.wc-x {
  position: absolute; top: -4px; right: 0; width: 36px; height: 36px; display: grid; place-items: center;
  cursor: pointer; font-size: 16px; color: var(--bone, #c5bea8); background: rgba(20, 21, 25, .8);
  border: 1px solid #4a4c52; border-radius: 4px;
}
.wc-x:hover { color: var(--gold, #fff9bf); border-color: var(--brass, #c9a949); }

.wc-head { margin: 0 44px 18px; }
.wc-kicker {
  display: inline-block; padding: 3px 12px; font: 600 12px/1.4 var(--f-head, Oswald, sans-serif);
  letter-spacing: .22em; text-transform: uppercase; color: #17140d;
  background: linear-gradient(#e2c366, #a8862f); border-radius: 2px; box-shadow: 0 1px 0 #000;
}
.wc-head h2 {
  margin: 10px 0 4px; font: 600 30px/1.1 var(--f-head, Oswald, sans-serif); letter-spacing: .06em;
  text-transform: uppercase; color: var(--bone-lit, #dfdccd); text-shadow: 0 2px 0 #000, 0 0 24px rgba(201, 169, 73, .25);
}
.wc-sub { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-dim, #9b9682); }
.wc-sub b { color: var(--brass, #c9a949); font-weight: 600; }

/* ------------------------------------------------------------- the cards */
.wc-row { display: flex; justify-content: center; align-items: stretch; gap: 22px; perspective: 1400px; }
.wc-slot { flex: 1 1 0; max-width: 272px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.wc-card {
  --c: var(--wc-field);
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center;
  min-height: 396px; padding: 0 16px 16px; text-align: center; overflow: hidden;
  border: 2px solid var(--c); border-radius: 10px;
  background:
    radial-gradient(ellipse at 50% 0, color-mix(in srgb, var(--c) 26%, transparent), transparent 58%),
    linear-gradient(180deg, #33363d 0%, #1e2025 46%, #131418 100%);
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(255, 255, 255, .05), inset 0 0 0 5px rgba(0, 0, 0, .28),
    0 18px 44px rgba(0, 0, 0, .7), 0 0 26px color-mix(in srgb, var(--c) 22%, transparent);
  transition: transform .18s cubic-bezier(.2, .9, .3, 1), box-shadow .18s, opacity .3s, filter .3s;
  animation: wc-deal .5s cubic-bezier(.2, .9, .3, 1) both; animation-delay: calc(var(--i) * 90ms);
}
.wc-card.r-staff { --c: var(--wc-staff); }
.wc-card.r-supreme { --c: var(--wc-supreme); }
@keyframes wc-deal {
  from { opacity: 0; transform: translateY(46px) rotateY(-32deg) scale(.9); }
  to { opacity: 1; transform: none; }
}
.wc-card:hover, .wc-card:focus-within {
  transform: translateY(-8px);
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(255, 255, 255, .08), inset 0 0 0 5px rgba(0, 0, 0, .28),
    0 26px 54px rgba(0, 0, 0, .75), 0 0 40px color-mix(in srgb, var(--c) 45%, transparent);
}

.wc-band {
  align-self: stretch; margin: 0 -16px; padding: 6px 12px 5px; display: flex; justify-content: space-between; align-items: center;
  font: 600 11.5px/1.3 var(--f-head, Oswald, sans-serif); letter-spacing: .2em; text-transform: uppercase;
  color: #14120c; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 100%, #fff 0%), color-mix(in srgb, var(--c) 72%, #000));
  border-bottom: 1px solid #000; position: relative; overflow: hidden;
}
.wc-tag { opacity: .78; letter-spacing: .14em; }
/* A Supreme card catches the light now and then. */
.wc-card.r-supreme .wc-band::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: wc-sheen 3.6s ease-in-out infinite;
}
@keyframes wc-sheen { 0%, 60% { left: -40%; } 100% { left: 120%; } }

.wc-sigil {
  width: 68px; height: 68px; margin: 18px 0 12px; flex: none; display: grid; place-items: center;
  font-size: 34px; color: var(--c); border-radius: 50%;
  border: 2px solid var(--c);
  background: radial-gradient(circle at 50% 35%, #3b3e46, #121317 72%);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, .45), 0 0 0 5px color-mix(in srgb, var(--c) 40%, transparent), inset 0 2px 6px rgba(0, 0, 0, .8);
}
.wc-card h3 {
  margin: 0; font: 600 20px/1.15 var(--f-head, Oswald, sans-serif); letter-spacing: .05em; text-transform: uppercase;
  color: var(--bone-lit, #dfdccd); text-shadow: 0 1px 0 #000; text-wrap: balance;
}
.wc-own {
  margin-top: 5px; font: 500 10.5px/1.3 var(--f-head, Oswald, sans-serif); letter-spacing: .2em; text-transform: uppercase; color: var(--c);
}
.wc-fx {
  list-style: none; margin: 12px 0 0; padding: 10px 0 0; align-self: stretch; text-align: left;
  border-top: 1px solid rgba(197, 190, 168, .16); font-size: 13px; line-height: 1.4;
}
.wc-fx li { position: relative; padding: 2px 0 2px 16px; color: var(--text, #e5e2d5); font-variant-numeric: tabular-nums; }
.wc-fx li::before {
  content: ''; position: absolute; left: 3px; top: .62em; width: 6px; height: 6px; transform: rotate(45deg);
  background: var(--brass, #c9a949);
}
.wc-fx li.down { color: #e79a88; }
.wc-fx li.down::before { background: var(--red, #c43222); }
.wc-note {
  margin: 10px 0 0; align-self: stretch; text-align: left; font: italic 400 12.5px/1.45 var(--f-serif, Kameron, serif);
  color: var(--text-dim, #9b9682);
}
.wc-take {
  margin-top: auto; align-self: stretch; height: 40px; cursor: pointer;
  font: 600 14.5px/1 var(--f-head, Oswald, sans-serif); letter-spacing: .12em; text-transform: uppercase;
  color: #17140d; border: 1px solid #000; border-radius: 3px;
  background: linear-gradient(180deg, #ecd078, #b08c2f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 2px 4px rgba(0, 0, 0, .5);
  transition: filter .12s, transform .12s;
}
.wc-take:hover { filter: brightness(1.1); }
.wc-take:active { transform: translateY(1px); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .35); }
/* Room between the last rule and the button, however short the card's text. */
.wc-card > :nth-last-child(2) { margin-bottom: 14px; }

.wc-reroll {
  height: 32px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 12.5px/1 var(--f-head, Oswald, sans-serif); letter-spacing: .14em; text-transform: uppercase;
  color: var(--bone, #c5bea8); background: rgba(24, 25, 30, .85);
  border: 1px solid #55575e; border-radius: 3px;
  transition: filter .12s, border-color .12s, color .12s;
  animation: wc-fade .4s ease both; animation-delay: calc(var(--i) * 90ms + 260ms);
}
.wc-reroll:hover:not(:disabled) { color: var(--gold, #fff9bf); border-color: var(--brass, #c9a949); }
.wc-reroll:hover:not(:disabled) .wc-spin { transform: rotate(180deg); }
.wc-reroll:disabled { cursor: default; color: #6d6a5d; border-color: #33353a; background: rgba(18, 19, 22, .6); }
.wc-spin { display: inline-block; font-size: 15px; line-height: 1; transition: transform .3s; }

/* Choosing, and redrawing. */
.wc-card.taken {
  transform: translateY(-12px) scale(1.04); z-index: 2;
  box-shadow: 0 0 0 1px #000, 0 0 0 3px color-mix(in srgb, var(--c) 70%, transparent), 0 30px 60px rgba(0, 0, 0, .8), 0 0 70px color-mix(in srgb, var(--c) 70%, transparent);
}
.wc-layer.chosen .wc-card:not(.taken) { opacity: .18; transform: translateY(14px) scale(.96); filter: grayscale(.8); }
.wc-layer.chosen .wc-reroll, .wc-layer.chosen .wc-take { pointer-events: none; }
.wc-layer.chosen .wc-reroll { opacity: .2; }
.wc-card.turning { transform: rotateY(88deg); opacity: .4; transition: transform .24s ease-in, opacity .24s; }
.wc-slot.fresh .wc-card { animation: wc-turn .34s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes wc-turn { from { opacity: .3; transform: rotateY(-88deg); } to { opacity: 1; transform: none; } }
/* Only the first deal is staggered: a redraw or the next round comes at once. */
.wc-slot.fresh .wc-reroll { animation: none; }

/* -------------------------------------------------------------- the foot */
.wc-foot { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.wc-later {
  height: 30px; padding: 0 16px; cursor: pointer; background: none; border: 0;
  font: 500 12.5px/1 var(--f-head, Oswald, sans-serif); letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-dim, #9b9682); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: #55575e;
}
.wc-later:hover { color: var(--bone-lit, #dfdccd); }
.wc-foot.solo .wc-later {
  text-decoration: none; color: #17140d; border: 1px solid #000; border-radius: 3px; height: 36px; padding: 0 28px;
  background: linear-gradient(180deg, #ecd078, #b08c2f);
}

.wc-held {
  width: min(720px, 100%); text-align: left; border: 1px solid #3a3c42; border-radius: 4px;
  background: rgba(19, 19, 27, .82);
}
.wc-held summary {
  list-style: none; cursor: pointer; padding: 8px 12px; display: flex; align-items: center; gap: 8px;
  font: 500 12.5px/1.2 var(--f-head, Oswald, sans-serif); letter-spacing: .16em; text-transform: uppercase; color: var(--bone, #c5bea8);
}
.wc-held summary::-webkit-details-marker { display: none; }
.wc-held summary::after { content: '+'; margin-left: auto; font-size: 16px; color: var(--brass, #c9a949); }
.wc-held[open] summary::after { content: '\2212'; }
.wc-held summary b {
  min-width: 20px; padding: 1px 6px; border-radius: 9px; text-align: center; letter-spacing: 0;
  color: #17140d; background: var(--brass, #c9a949);
}
.wc-held ul { list-style: none; margin: 0; padding: 0 12px 10px; max-height: min(38vh, 300px); overflow-y: auto; }
.wc-held li {
  --c: var(--wc-field);
  display: grid; grid-template-columns: 4px 18px minmax(120px, auto) 1fr; align-items: center; gap: 4px 10px;
  padding: 7px 0; border-top: 1px solid rgba(197, 190, 168, .1); font-size: 12.5px; line-height: 1.4;
}
.wc-held li.r-staff { --c: var(--wc-staff); }
.wc-held li.r-supreme { --c: var(--wc-supreme); }
.wc-pip { align-self: stretch; border-radius: 2px; background: var(--c); }
.wc-hico { font-size: 16px; color: var(--c); display: grid; place-items: center; }
.wc-held li b { font: 500 13.5px/1.2 var(--f-head, Oswald, sans-serif); letter-spacing: .05em; text-transform: uppercase; color: var(--bone-lit, #dfdccd); }
.wc-held li span:last-child { color: var(--text-dim, #9b9682); }
.wc-empty { max-width: 460px; margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-dim, #9b9682); }

/* 2030: the same furniture under a colder light. */
.wc-layer.modern { background: radial-gradient(ellipse at 50% 38%, rgba(28, 52, 60, .4), transparent 62%), rgba(5, 7, 10, .9); }

/* ---------------------------------------------------------------- narrow */
@media (max-width: 760px) {
  .wc-layer { align-items: flex-start; padding: 12px 16px 20px; }
  .wc-head { margin: 0 40px 12px 0; text-align: left; }
  .wc-head h2 { font-size: 21px; margin-top: 8px; }
  .wc-sub { font-size: 12.5px; }
  .wc-row { flex-direction: column; gap: 10px; perspective: none; }
  .wc-slot { max-width: none; position: relative; flex: none; }
  .wc-card {
    min-height: 0; padding: 0 12px 12px; display: grid; grid-template-columns: 46px 1fr; column-gap: 12px;
    align-items: start; text-align: left; border-radius: 8px;
  }
  @keyframes wc-deal { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
  .wc-card:hover, .wc-card:focus-within { transform: none; }
  .wc-band { grid-column: 1 / -1; margin: 0 -12px 10px; padding: 4px 10px 3px; font-size: 10.5px; }
  .wc-sigil { grid-column: 1; grid-row: 2 / span 3; width: 46px; height: 46px; margin: 0; font-size: 23px; }
  .wc-card h3 { grid-column: 2; font-size: 17px; }
  .wc-own { grid-column: 2; margin-top: 2px; }
  .wc-fx { grid-column: 2; margin-top: 6px; padding-top: 6px; font-size: 12.5px; }
  .wc-fx li { padding: 1px 0 1px 14px; }
  .wc-note { display: none; }
  .wc-take { grid-column: 1 / -1; height: 36px; margin: 10px 108px 0 0; font-size: 13.5px; }
  .wc-card > :nth-last-child(2) { margin-bottom: 0; }
  .wc-reroll { position: absolute; right: 14px; bottom: 14px; width: 98px; height: 36px; font-size: 11.5px; letter-spacing: .1em; }
  .wc-card.taken { transform: scale(1.02); }
  .wc-layer.chosen .wc-card:not(.taken) { transform: none; }
  .wc-foot { margin-top: 12px; gap: 8px; }
  .wc-held li { grid-template-columns: 4px 18px 1fr; }
  .wc-held li span:last-child { grid-column: 3; }
  /* Under the map tools: the space beside the portrait is where the despatches land. */
  .wc-btn { right: -2px; top: 322px; width: 42px; height: 42px; }
}

@media (max-height: 640px) and (min-width: 761px) {
  .wc-head { margin-bottom: 10px; }
  .wc-head h2 { font-size: 22px; margin: 6px 0 2px; }
  .wc-card { min-height: 0; }
  .wc-sigil { width: 50px; height: 50px; font-size: 25px; margin: 10px 0 8px; }
  .wc-note { display: none; }
  .wc-foot { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .wc-layer, .wc-card, .wc-reroll, .wc-slot.fresh .wc-card { animation: none !important; }
  .wc-card, .wc-take, .wc-btn, .wc-spin { transition: none !important; }
  .wc-card:hover, .wc-card:focus-within, .wc-card.taken, .wc-card.turning { transform: none !important; }
  .wc-card.r-supreme .wc-band::after, .wc-btn.ready { animation: none !important; }
}
