/* The digital room key: a glass key card lit by the room's LED. Used on home (teaser), booking (live) and status. */
.key {
  --tx: 0deg;
  --ty: 0deg;
  --mx: 50%;
  --my: 30%;
  width: min(100%, 440px);
  aspect-ratio: 1.586;
  perspective: 1100px;
  container-type: inline-size;
}
.key__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(var(--tx)) rotateY(calc(var(--ty) + var(--flip, 0deg)));
  transition: transform 0.9s var(--ease);
}
.key.is-tilting .key__inner { transition: transform 0.12s linear; }
.key.is-flipped { --flip: 180deg; }
.key__face {
  position: absolute;
  inset: 0;
  border-radius: 5.5cqi;
  padding: 6cqi 6.5cqi;
  display: flex;
  flex-direction: column;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at var(--mx) var(--my), color-mix(in oklab, var(--led) 26%, transparent), transparent 60%),
    linear-gradient(145deg, #1c1c22, #0c0c0f 60%, #141419);
  border: 1px solid color-mix(in oklab, var(--led) 55%, white 8%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 26px -6px var(--led),
    0 30px 60px -20px rgba(0, 0, 0, 0.9);
}
/* Holographic sheen that follows the pointer */
.key__face::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.09) 45%, color-mix(in oklab, var(--led) 25%, transparent) 50%, transparent 62%);
  background-size: 250% 250%;
  background-position: var(--mx) var(--my);
  mix-blend-mode: screen;
  pointer-events: none;
}
/* LED strip along the bottom edge of the card */
.key__face::after {
  content: '';
  position: absolute;
  left: 6cqi;
  right: 6cqi;
  bottom: 0;
  height: 2px;
  background: var(--led);
  box-shadow: 0 0 12px 1px var(--led);
  border-radius: 2px;
}
.key__back { transform: rotateY(180deg); align-items: center; justify-content: center; gap: 3cqi; text-align: center; }
.key__top { display: flex; justify-content: space-between; align-items: center; }
.key__brand { font: 700 2.9cqi/1 var(--f-display); letter-spacing: 0.22em; color: rgba(238, 236, 232, 0.75); }
.key__nfc { width: 6.5cqi; height: 6.5cqi; color: var(--led); filter: drop-shadow(0 0 4px var(--led)); }
.key__room { margin-top: auto; font: 800 13cqi/0.9 var(--f-display); letter-spacing: -0.03em; transition: opacity 0.3s; }
.key__meta { display: flex; justify-content: space-between; align-items: baseline; gap: 2cqi; margin-top: 2.4cqi; font-size: 3.6cqi; color: var(--mute); }
.key__meta b { color: var(--marble); font: 700 5cqi/1 var(--f-display); }
.key__bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 4cqi; padding-top: 3cqi; border-top: 1px dashed rgba(238, 236, 232, 0.14); }
.key__code { font: 700 4cqi/1 var(--f-display); letter-spacing: 0.14em; }
.key__status {
  display: inline-flex;
  align-items: center;
  gap: 1.6cqi;
  font: 600 3cqi/1 var(--f-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1.6cqi 2.6cqi;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
}
.key__status::before { content: ''; width: 1.8cqi; height: 1.8cqi; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.key__status[data-s='na_cekanju'] { color: #ffd36b; }
.key__status[data-s='na_cekanju']::before { animation: pulse 1.4s ease-in-out infinite; }
.key__status[data-s='potvrdjeno'] { color: #6bffb0; }
.key__status[data-s='odbijeno'], .key__status[data-s='otkazano'] { color: #ff7a7a; }
.key__status[data-s='draft'] { color: var(--mute); }
.key__qr { width: 34cqi; aspect-ratio: 1; padding: 2cqi; border-radius: 2.5cqi; background: var(--marble); }
.key__qr svg { width: 100%; height: 100%; display: block; }
.key__back small { font-size: 3cqi; color: var(--mute); letter-spacing: 0.06em; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* Issue animation: the card slides out of the "reader" */
.key.is-issued .key__inner { animation: issue 1.3s var(--ease) both; }
@keyframes issue {
  0% { transform: translateY(40%) rotateX(60deg) scale(0.8); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: rotateX(var(--tx)) rotateY(calc(var(--ty) + var(--flip, 0deg))); }
}
@media (prefers-reduced-motion: reduce) {
  .key__inner { transition: none; }
  .key.is-issued .key__inner { animation: none; }
}
