/* The Legal.id card — ported from the approved artifact design.
   Dark faces are intentional against the warm app chrome. */

.id-card {
  perspective: 1800px;
  width: 540px;
  height: 340px;
  max-width: 100%;
  position: relative;
  /* The card is a self-contained component: never inherit text alignment from
     a centered hero/container (front identifier + back copy stay left). */
  text-align: left;
}
.id-card-interactive { cursor: pointer; animation: card-floaty 7s ease-in-out infinite; }
.id-card-interactive:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 6px; border-radius: 24px; }

@keyframes card-floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes holoshift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.id-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.85s cubic-bezier(0.4, 0.1, 0.2, 1);
  transform-style: preserve-3d;
}
.id-card-inner.is-flipped { transform: rotateY(180deg); }

.id-card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 2px 1px rgba(255, 255, 255, 0.10) inset,
              0 -1px 1px rgba(0, 0, 0, 0.6) inset,
              0 40px 80px -20px rgba(5, 9, 17, 0.55),
              0 0 0 1px rgba(255, 255, 255, 0.06);
}
.id-card-front { background: linear-gradient(150deg, #1a1b1f 0%, #0b0c0e 52%, #000 100%); }
.id-card-back {
  background: linear-gradient(150deg, #161719 0%, #0a0b0d 60%, #000 100%);
  transform: rotateY(180deg);
}

.id-card-sheen {
  position: absolute;
  top: -40%;
  left: -10%;
  width: 80%;
  height: 160%;
  background: radial-gradient(60% 50% at 50% 50%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 70%);
  transform: rotate(20deg);
  pointer-events: none;
}

.id-card-body {
  position: absolute;
  inset: 0;
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.id-card-back .id-card-body { padding: 30px 34px; }

/* Top row */
.id-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.id-card-wordmark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 29px;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1;
}
.id-tld { color: #83a1dc; }
.id-card-tier {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 5px 12px;
}
.id-card-tier-dot { width: 6px; height: 6px; border-radius: 50%; }
.id-card-tier-label {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 600;
  font-family: var(--font-sans);
}

/* Middle: chip + NFC */
.id-card-middle { display: flex; align-items: center; gap: 16px; }
.id-card-chip {
  width: 52px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e9d9a8 0%, #bfa760 38%, #8c7733 60%, #d8c489 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.25) inset;
  position: relative;
  overflow: hidden;
}
.chip-line-h { position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: rgba(0, 0, 0, 0.35); }
.chip-line-v1 { position: absolute; top: 22%; bottom: 22%; left: 33%; width: 1px; background: rgba(0, 0, 0, 0.35); }
.chip-line-v2 { position: absolute; top: 22%; bottom: 22%; left: 66%; width: 1px; background: rgba(0, 0, 0, 0.35); }
.chip-core { position: absolute; inset: 34% 38%; border: 1px solid rgba(0, 0, 0, 0.3); border-radius: 2px; }

/* Bottom: identifier + holder/re-attest */
.id-card-bottom { display: flex; flex-direction: column; gap: 11px; }
.id-card-identifier { display: flex; flex-direction: column; gap: 4px; }
.id-card-microlabel {
  font-size: 8px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
  font-family: var(--font-sans);
}
.id-card-microlabel.wide { font-size: 9px; letter-spacing: 0.28em; color: rgba(255, 255, 255, 0.42); }
.id-card-handle {
  font-size: 25px;
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  font-family: var(--font-sans);
}
.id-card-did {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.44);
  letter-spacing: 0.01em;
}
.id-card-meta { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.id-card-holder { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.id-card-holder-name { font-size: 13px; color: rgba(255, 255, 255, 0.82); font-weight: 500; letter-spacing: 0.02em; }
.id-card-reattest { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; flex: none; }
.id-card-reattest .id-card-microlabel { letter-spacing: 0.24em; }
.id-card-reattest-date { font-size: 14px; color: #fff; font-weight: 600; letter-spacing: 0.06em; }
.id-card-reattest-date.is-overdue { color: #ff8a8a; }
.id-card-credential-badge { font-size: 13px; color: #fff; font-weight: 600; letter-spacing: 0.04em; }

/* Back face */
.id-card-honesty { display: flex; flex-direction: column; gap: 6px; }
.id-card-honesty-copy { font-size: 12.5px; line-height: 1.5; color: rgba(255, 255, 255, 0.72); max-width: 300px; }

.id-card-verify-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.id-card-verify-text { display: flex; flex-direction: column; gap: 8px; }
.id-card-verify-title { display: flex; align-items: center; gap: 10px; }
.id-card-verify-title span { font-size: 15px; color: #fff; font-weight: 600; }
.id-card-verify-url { font-family: var(--font-mono); font-size: 12px; color: rgba(255, 255, 255, 0.55); letter-spacing: 0.02em; }
.id-card-verify-note { font-size: 10px; color: rgba(255, 255, 255, 0.4); letter-spacing: 0.02em; max-width: 210px; line-height: 1.45; }

.id-card-qr {
  flex: none;
  width: 98px;
  height: 98px;
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.id-card-qr svg { width: 100%; height: 100%; display: block; }

.id-card-back-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.id-card-holo-wrap { display: flex; flex-direction: column; gap: 5px; }
.id-card-holo {
  width: 96px;
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(115deg, #8f5cff, #4fd8ff 22%, #fff2b0 46%, #5cffb0 68%, #8f5cff);
  background-size: 220% 100%;
  animation: holoshift 6s linear infinite;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  opacity: 0.82;
  position: relative;
  overflow: hidden;
}
.id-card-holo-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 4px);
}
.id-card-holo-wrap .id-card-microlabel { letter-spacing: 0.2em; color: rgba(255, 255, 255, 0.34); }

.id-card-issuer { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.id-card-issuer-mark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: -0.02em;
}
.id-card-issuer-line {
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.34);
  font-weight: 500;
  font-family: var(--font-sans);
}

.id-card-hint {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}
.on-dark .id-card-hint { color: rgba(255, 255, 255, 0.4); }

/* ============================================================
   Card themes — user-selectable finishes. Themes restyle the card
   background + animation only; the tier dot stays tier-derived.
   All animations are slow and subtle; disabled under reduced motion.
   ============================================================ */

@keyframes card-sheen-sweep {
  0% { transform: translateX(-130%) rotate(20deg); }
  55% { transform: translateX(240%) rotate(20deg); }
  100% { transform: translateX(240%) rotate(20deg); }
}

@keyframes card-gradient-drift {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

@keyframes card-glow-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* Keep card content above theme overlay layers (face ::after). */
.id-card-body { z-index: 2; }

/* --- Onyx (default): current graphite black + a slow light sweep --- */
.id-card-theme-onyx .id-card-sheen { animation: card-sheen-sweep 11s ease-in-out infinite; }

/* --- Cobalt: midnight-to-cobalt gradient, slow drift --- */
.id-card-theme-cobalt .id-card-front,
.card-theme-swatch-cobalt {
  background: linear-gradient(135deg, #040814 0%, #081a4d 38%, #1237ad 72%, #050d24 100%);
  background-size: 220% 220%;
  animation: card-gradient-drift 16s ease-in-out infinite alternate;
}
.id-card-theme-cobalt .id-card-back {
  background: linear-gradient(135deg, #040814 0%, #071539 45%, #0c2a7e 85%, #050d24 100%);
  background-size: 220% 220%;
  animation: card-gradient-drift 16s ease-in-out infinite alternate;
}
.id-card-theme-cobalt .id-tld { color: #a8b8f0; }

/* --- Aurora: near-black base with an iridescent shimmer overlay --- */
.id-card-theme-aurora .id-card-front,
.id-card-theme-aurora .id-card-back,
.card-theme-swatch-aurora {
  background: linear-gradient(150deg, #12121c 0%, #0a0a12 55%, #050508 100%);
}
.id-card-theme-aurora .id-card-face::after,
.card-theme-swatch-aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(143, 92, 255, 0.55), rgba(79, 216, 255, 0.5) 25%, rgba(255, 242, 176, 0.42) 50%, rgba(92, 255, 176, 0.5) 75%, rgba(143, 92, 255, 0.55));
  background-size: 300% 100%;
  animation: holoshift 14s linear infinite;
  opacity: 0.14;
  pointer-events: none;
  z-index: 1;
}
.id-card-theme-aurora .id-tld { color: #b9a8f0; }

/* --- Bronze: warm charcoal with a soft bronze glow pulse --- */
.id-card-theme-bronze .id-card-front,
.card-theme-swatch-bronze {
  background: linear-gradient(150deg, #241c12 0%, #120d07 55%, #030201 100%);
}
.id-card-theme-bronze .id-card-back { background: linear-gradient(150deg, #1e1710 0%, #0f0b06 60%, #030201 100%); }
.id-card-theme-bronze .id-card-face::after,
.card-theme-swatch-bronze::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 80% at 85% 92%, rgba(224, 164, 88, 0.24), rgba(224, 164, 88, 0) 65%);
  animation: card-glow-pulse 7s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
.id-card-theme-bronze .id-tld { color: #d9b47e; }

/* --- Porcelain: light paper face with dark ink --- */
.id-card-theme-porcelain .id-card-front,
.card-theme-swatch-porcelain {
  background: linear-gradient(150deg, #ffffff 0%, #f3f0e9 58%, #e5e0d4 100%);
}
.id-card-theme-porcelain .id-card-back { background: linear-gradient(150deg, #f8f6f1 0%, #eeeae1 60%, #e0dbce 100%); }
.id-card-theme-porcelain .id-card-face {
  box-shadow: 0 2px 1px rgba(255, 255, 255, 0.6) inset,
              0 -1px 1px rgba(5, 9, 17, 0.12) inset,
              0 40px 80px -20px rgba(5, 9, 17, 0.35),
              0 0 0 1px rgba(5, 9, 17, 0.08);
}
.id-card-theme-porcelain .id-card-sheen {
  background: radial-gradient(60% 50% at 50% 50%, rgba(5, 9, 17, 0.05), rgba(5, 9, 17, 0) 70%);
  animation: card-sheen-sweep 11s ease-in-out infinite;
}
.id-card-theme-porcelain .id-card-wordmark,
.id-card-theme-porcelain .id-card-handle,
.id-card-theme-porcelain .id-card-reattest-date,
.id-card-theme-porcelain .id-card-credential-badge,
.id-card-theme-porcelain .id-card-verify-title span { color: var(--navy); }
.id-card-theme-porcelain .id-tld { color: var(--cobalt); }
.id-card-theme-porcelain .id-card-tier { border-color: rgba(5, 9, 17, 0.18); }
.id-card-theme-porcelain .id-card-tier-label { color: rgba(5, 9, 17, 0.62); }
.id-card-theme-porcelain .id-card-microlabel,
.id-card-theme-porcelain .id-card-microlabel.wide { color: rgba(5, 9, 17, 0.44); }
.id-card-theme-porcelain .id-card-did,
.id-card-theme-porcelain .id-card-verify-url { color: rgba(5, 9, 17, 0.5); }
.id-card-theme-porcelain .id-card-holder-name { color: rgba(5, 9, 17, 0.78); }
.id-card-theme-porcelain .id-card-honesty-copy { color: rgba(5, 9, 17, 0.68); }
.id-card-theme-porcelain .id-card-verify-note { color: rgba(5, 9, 17, 0.42); }
.id-card-theme-porcelain .id-card-front .id-card-nfc { stroke: rgba(5, 9, 17, 0.45); }
.id-card-theme-porcelain .id-card-reattest-date.is-overdue { color: #c0392b; }
.id-card-theme-porcelain .id-card-issuer-mark { color: rgba(5, 9, 17, 0.85); }
.id-card-theme-porcelain .id-card-issuer-line,
.id-card-theme-porcelain .id-card-holo-wrap .id-card-microlabel { color: rgba(5, 9, 17, 0.4); }
.id-card-theme-porcelain .id-card-qr { box-shadow: 0 6px 18px rgba(5, 9, 17, 0.18), 0 0 0 1px rgba(5, 9, 17, 0.1); }

@media (prefers-reduced-motion: reduce) {
  .id-card,
  .id-card *,
  .id-card *::after,
  .card-theme-swatch,
  .card-theme-swatch::after { animation: none !important; }
}

/* Responsive scale-down */
@media (max-width: 620px) {
  .id-card { width: 100%; height: auto; aspect-ratio: 540 / 340; }
  .id-card-body { padding: 22px 24px; }
  .id-card-handle { font-size: 20px; }
  .id-card-wordmark { font-size: 23px; }
  .id-card-qr { width: 80px; height: 80px; padding: 6px; }
  .id-card-honesty-copy { font-size: 11px; max-width: 240px; }
}
