.tech-card {
  position: relative;
  min-height: 8rem;
  overflow: visible;
  grid-template-rows: 5rem minmax(1.7rem, auto) 1.25rem;
  background: var(--pal-card-blue-deep);
  border: 1px solid #4d9bce;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px rgba(4, 18, 28, .55);
  transition:
    filter 180ms cubic-bezier(.22, .61, .36, 1),
    transform 180ms cubic-bezier(.22, .61, .36, 1),
    box-shadow 180ms cubic-bezier(.22, .61, .36, 1),
    border-color 180ms cubic-bezier(.22, .61, .36, 1);
}

.tech-card:hover,
.tech-card:focus-within,
.tech-card.is-selected {
  z-index: 4;
  border-color: var(--pal-cyan);
  transform: translateY(-3px) scale(1.025);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, .48),
    0 0 0 2px rgba(0, 232, 248, .55),
    0 0 22px rgba(0, 232, 248, .42);
}

.tech-card::before,
.tech-card::after {
  position: absolute;
  z-index: 6;
  width: .65rem;
  height: .65rem;
  opacity: 0;
  content: "";
  pointer-events: none;
  transition: opacity .14s ease;
}

.tech-card::before {
  top: -.35rem;
  left: -.35rem;
  border-top: 3px solid var(--pal-cyan);
  border-left: 3px solid var(--pal-cyan);
}

.tech-card::after {
  right: -.35rem;
  bottom: -.35rem;
  border-right: 3px solid var(--pal-cyan);
  border-bottom: 3px solid var(--pal-cyan);
}

.tech-card:hover::before,
.tech-card:hover::after,
.tech-card:focus-within::before,
.tech-card:focus-within::after,
.tech-card.is-selected::before,
.tech-card.is-selected::after {
  opacity: 1;
}

.tech-card::before,
.tech-card::after {
  display: none;
}

.tech-card--ancient {
  background: #3b1b4c;
  border-color: #9c59aa;
}

.tech-card--ancient:hover,
.tech-card--ancient:focus-within,
.tech-card--ancient.is-selected {
  border-color: #db72ed;
  transform: translateY(-3px) scale(1.025);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, .48),
    0 0 0 2px rgba(210, 89, 232, .48),
    0 0 22px rgba(210, 89, 232, .36);
}

.tech-card--ancient::before,
.tech-card--ancient::after {
  border-color: #df79f0;
}

.tech-media {
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .08) 0 42%, transparent 42% 100%),
    linear-gradient(155deg, #287db6, #18518b);
  border-bottom-color: rgba(204, 230, 239, .3);
}

.tech-card-category {
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  min-height: .9rem;
  display: grid;
  padding: .04rem .2rem;
  place-items: center;
  color: #9cc7d5;
  background: rgba(3, 25, 42, .93);
  border-bottom: 1px solid rgba(143, 197, 221, .2);
  font-size: .5rem;
  font-weight: 520;
  letter-spacing: .015em;
  line-height: 1;
}

.tech-card--ancient .tech-card-category {
  color: #e5b8ec;
  background: rgba(40, 11, 54, .94);
  border-bottom-color: rgba(215, 139, 229, .22);
}

.tech-card--ancient .tech-media {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .07) 0 42%, transparent 42% 100%),
    linear-gradient(155deg, #7b3588, #4b205a);
  border-bottom-color: rgba(225, 178, 235, .32);
}

.tech-media img {
  z-index: 0;
  width: 3.5rem;
  height: 3.5rem;
  margin-top: .65rem;
}

.tech-cost {
  z-index: 3;
  top: auto;
  right: auto;
  bottom: .18rem;
  left: .18rem;
  min-width: 1.15rem;
  min-height: 1.15rem;
  color: #03171b;
  background: var(--pal-cyan);
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 0;
  font-size: .6rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .38);
}

.tech-card-select {
  position: absolute;
  z-index: 4;
  inset: 0 0 1.25rem;
  width: auto;
  height: auto;
  padding: 0;
  color: transparent;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.tech-card-select::after {
  position: absolute;
  top: 1.1rem;
  right: .25rem;
  display: grid;
  width: .95rem;
  height: .95rem;
  place-items: center;
  color: rgba(224, 247, 249, .78);
  border: 1px solid rgba(205, 236, 239, .38);
  content: "i";
  font-family: Georgia, serif;
  font-size: .6rem;
  font-weight: 700;
  line-height: 1;
  transition: color .14s ease, border-color .14s ease, background .14s ease;
}

.tech-card-select:hover::after,
.tech-card-select:focus-visible::after,
.tech-card-select[aria-expanded="true"]::after {
  color: #061a20;
  background: var(--pal-cyan);
  border-color: var(--pal-cyan);
}

.tech-card--ancient .tech-card-select::after {
  color: #f0cef5;
  border-color: rgba(228, 171, 238, .42);
}

.tech-card--ancient .tech-card-select:hover::after,
.tech-card--ancient .tech-card-select:focus-visible::after,
.tech-card--ancient .tech-card-select[aria-expanded="true"]::after {
  color: #fff;
  background: var(--pal-ancient-bright);
  border-color: var(--pal-ancient-bright);
}

.tech-card-select:focus-visible {
  outline: 2px solid var(--pal-cyan);
  outline-offset: -3px;
}

.tech-selection-frame {
  position: absolute;
  z-index: 9;
  inset: -.42rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease;
}

.tech-card:hover .tech-selection-frame,
.tech-card:focus-within .tech-selection-frame,
.tech-card.is-selected .tech-selection-frame {
  opacity: 1;
}

.tech-selection-frame i {
  position: absolute;
  width: .78rem;
  height: .78rem;
  border-color: var(--pal-cyan);
  filter: drop-shadow(0 0 5px rgba(0, 232, 248, .78));
}

.tech-selection-frame i:nth-child(1) { top: 0; left: 0; border-top: 3px solid; border-left: 3px solid; }
.tech-selection-frame i:nth-child(2) { top: 0; right: 0; border-top: 3px solid; border-right: 3px solid; }
.tech-selection-frame i:nth-child(3) { right: 0; bottom: 0; border-right: 3px solid; border-bottom: 3px solid; }
.tech-selection-frame i:nth-child(4) { bottom: 0; left: 0; border-bottom: 3px solid; border-left: 3px solid; }

.tech-card--ancient .tech-selection-frame i {
  border-color: #df79f0;
  filter: drop-shadow(0 0 5px rgba(223, 121, 240, .7));
}

.tech-card--ancient .tech-cost {
  color: #fff;
  background: var(--pal-ancient-bright);
}

.tech-info-trigger {
  z-index: 4;
  width: 2rem;
  height: 2rem;
  color: #b9d8df;
}

.tech-card--ancient .tech-info-trigger {
  color: #e7b7ef;
}

.tech-card h4 {
  padding: .14rem .2rem;
  color: #f3f7f8;
  background: rgba(8, 36, 53, .78);
  border-top: 1px solid rgba(199, 228, 237, .2);
  font-size: .58rem;
  font-weight: 650;
  line-height: 1.12;
}

.tech-card--ancient h4 {
  background: rgba(42, 14, 54, .76);
}

.tech-card-footer {
  position: relative;
  z-index: 6;
  background: rgba(6, 24, 33, .94);
  border-top-color: rgba(200, 224, 228, .2);
}

.tech-card--ancient .tech-card-footer {
  background: rgba(35, 13, 44, .94);
  border-top-color: rgba(221, 177, 231, .22);
}

.tech-kind {
  padding-left: .24rem;
  color: #a8cbd2;
  font-size: .4rem;
  font-weight: 720;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.tech-card--ancient .tech-kind {
  color: #dcb7e3;
}

.materials-trigger {
  min-width: 2.8rem;
  color: #dce8ea;
  background: rgba(100, 139, 151, .16);
  border-left-color: rgba(200, 223, 225, .22);
  font-size: .42rem;
}

.materials-trigger[aria-expanded="true"] {
  color: #04191e;
  background: var(--pal-cyan);
}

.materials-trigger-label svg {
  width: .65rem;
  height: .65rem;
}

.tech-card--ancient .materials-trigger {
  background: rgba(162, 74, 179, .18);
  border-left-color: rgba(218, 165, 229, .24);
}

.tech-card--ancient .materials-trigger::before {
  background: var(--pal-ancient-bright);
}

.filter-dialog,
.command-popover,
.material-popover,
.info-popover {
  color: var(--pal-text);
  background: #091a1f;
  border-color: rgba(189, 222, 225, .54);
  border-top: 3px solid var(--pal-cyan);
  border-radius: 0;
  box-shadow: var(--pal-shadow);
  clip-path: polygon(var(--pal-cut) 0, 100% 0, 100% calc(100% - var(--pal-cut)), calc(100% - var(--pal-cut)) 100%, 0 100%, 0 var(--pal-cut));
}

.material-popover.is-ancient,
.info-popover.is-ancient {
  border-color: rgba(190, 105, 207, .75);
  border-top-color: var(--pal-ancient-bright);
}
