/* =========================================================
   Checkout + My Card — loaded after styles.css and cards.css
   ========================================================= */

/* =========================================================
   CARD COMPONENT (.hc) — front + realistic back, 3D flip.
   All inner sizes use cqw so the card scales as one piece.
   ========================================================= */
.hc {
  position: relative;
  aspect-ratio: 620 / 396;
  container-type: inline-size;
  perspective: 1600px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  --ink: #d6dae1;
  --ink-soft: rgba(214, 218, 225, 0.6);
  --emboss: #d3d8e0;
  --emboss-shadow: 0 0.14cqw 0 rgba(0, 0, 0, 0.85), 0 -0.08cqw 0 rgba(255, 255, 255, 0.2);
}
.hc[data-finish="silver"] {
  --ink: #1d2126; --ink-soft: rgba(29, 33, 38, 0.62);
  --emboss: #2a3036; --emboss-shadow: 0 0.12cqw 0 rgba(255, 255, 255, 0.75), 0 -0.08cqw 0 rgba(0, 0, 0, 0.28);
}
.hc[data-finish="gold"] {
  --ink: #35250a; --ink-soft: rgba(53, 37, 10, 0.64);
  --emboss: #3d2b0c; --emboss-shadow: 0 0.12cqw 0 rgba(255, 245, 210, 0.7), 0 -0.08cqw 0 rgba(0, 0, 0, 0.3);
}
.hc[data-finish="rosegold"] {
  --ink: #44221c; --ink-soft: rgba(68, 34, 28, 0.64);
  --emboss: #4a261f; --emboss-shadow: 0 0.12cqw 0 rgba(255, 235, 228, 0.7), 0 -0.08cqw 0 rgba(0, 0, 0, 0.28);
}

.hc__tilt {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.6s var(--ease);
}
.hc:hover .hc__tilt { transition-duration: 0.15s; }
.hc__shadow {
  position: absolute;
  left: 8%; right: 8%; bottom: -8%;
  height: 16%;
  background: radial-gradient(closest-side, rgba(0, 0, 25, 0.55), transparent);
  filter: blur(10px);
  pointer-events: none;
}
.hc__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hc.is-flipped .hc__inner { transform: rotateY(180deg); }
.hc__face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
          backface-visibility: hidden;
}
.hc__back { transform: rotateY(180deg); -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.hc[data-finish="black"]    .hc__back { -webkit-mask-image: url("assets/cards/back-black.webp");    mask-image: url("assets/cards/back-black.webp"); }
.hc[data-finish="silver"]   .hc__back { -webkit-mask-image: url("assets/cards/back-silver.webp");   mask-image: url("assets/cards/back-silver.webp"); }
.hc[data-finish="gold"]     .hc__back { -webkit-mask-image: url("assets/cards/back-gold.webp");     mask-image: url("assets/cards/back-gold.webp"); }
.hc[data-finish="rosegold"] .hc__back { -webkit-mask-image: url("assets/cards/back-rosegold.webp"); mask-image: url("assets/cards/back-rosegold.webp"); }
.hc__img { position: absolute; inset: 0; width: 100%; height: 100%; }

/* front: embossed cardholder name */
.hc__name {
  position: absolute;
  left: 8.4%;
  bottom: 11.5%;
  max-width: 55%;
  overflow: hidden;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 3.1cqw;
  letter-spacing: 0.16em;
  white-space: nowrap;
  color: var(--emboss);
  text-shadow: var(--emboss-shadow);
}

/* front: embossed card number, above the name */
.hc__num {
  position: absolute;
  left: 8.4%;
  bottom: 21.5%;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 4cqw;
  letter-spacing: 0.1em;
  white-space: nowrap;
  color: var(--emboss);
  text-shadow: var(--emboss-shadow);
}

/* back */
.hc__content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 2.3cqw 5.6cqw 3.4cqw;
  color: var(--ink);
  font-family: var(--f-mono);
}
.hc__tiny { font-size: 1.22cqw; letter-spacing: 0.05em; text-align: center; color: var(--ink-soft); white-space: nowrap; }
.hc__stripe {
  margin: 1.4cqw -5.6cqw 0;
  height: 10.6cqw;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 0.12cqw, transparent 0.12cqw 0.42cqw),
    linear-gradient(180deg, #2d2d30 0%, #0b0b0c 20%, #161618 62%, #040405 100%);
  box-shadow: inset 0 0.16cqw 0 rgba(255, 255, 255, 0.09), inset 0 -0.16cqw 0 rgba(0, 0, 0, 0.55);
}
.hc__sigrow { display: flex; align-items: center; gap: 2.4cqw; margin-top: 3.3cqw; }
.hc__sig {
  position: relative;
  flex: 1;
  height: 8.2cqw;
  overflow: hidden;
  border-radius: 0.3cqw;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='14'%3E%3Ctext x='0' y='10' font-family='Arial' font-size='7' font-weight='700' fill='%233a5bb0' fill-opacity='.14'%3EHEXA CARD%3C/text%3E%3C/svg%3E") 0 0 / 7cqw 1.55cqw,
    repeating-linear-gradient(-45deg, rgba(58, 91, 176, 0.07) 0 0.25cqw, transparent 0.25cqw 0.7cqw),
    #f4f1e8;
  box-shadow: inset 0 0 0 0.12cqw rgba(0, 0, 0, 0.12);
}
.hc__sig-label { position: absolute; left: 1.2cqw; top: 0.6cqw; font-size: 0.95cqw; letter-spacing: 0.05em; color: rgba(30, 44, 90, 0.6); }
.hc__sig-name {
  position: absolute;
  left: 2.6cqw;
  bottom: 0.4cqw;
  max-width: 68%;
  overflow: hidden;
  white-space: nowrap;
  font-family: "Caveat", "Segoe Script", cursive;
  font-weight: 500;
  font-size: 4.7cqw;
  line-height: 1.2;
  color: #1f2f7a;
  transform: rotate(-3deg);
  transform-origin: left bottom;
}
.hc__cvv {
  position: absolute;
  right: 1cqw;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.55cqw 1.3cqw;
  background: #fff;
  font-style: italic;
  font-size: 2.1cqw;
  letter-spacing: 0.14em;
  color: #111;
  box-shadow: 0 0 0 0.1cqw rgba(0, 0, 0, 0.18);
}
.hc__holo {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 11cqw;
  height: 8.2cqw;
  overflow: hidden;
  border-radius: 0.6cqw;
  background: conic-gradient(from 210deg at 50% 50%, #ff9ad5, #9ad8ff, #b6ffb0, #fff3a0, #ffb3a0, #d6a0ff, #ff9ad5);
  box-shadow: inset 0 0 0 0.14cqw rgba(255, 255, 255, 0.55), 0 0 0 0.1cqw rgba(0, 0, 0, 0.15);
}
.hc__holo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.4) 0 0.3cqw, transparent 0.3cqw 0.9cqw);
  mix-blend-mode: overlay;
}
.hc__holo::after {
  content: "";
  position: absolute;
  inset: -50%;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.75) 50%, transparent 60%);
  animation: holo 3.6s ease-in-out infinite;
}
@keyframes holo {
  0%, 100% { transform: translateX(-28%); }
  50% { transform: translateX(28%); }
}
.hc__holo svg, .hc__holo img { position: relative; z-index: 1; width: 4.8cqw; height: 4.8cqw; object-fit: contain; color: rgba(255, 255, 255, 0.8); }
.hc__rows { display: grid; grid-template-columns: 1fr auto; column-gap: 3cqw; row-gap: 1.6cqw; margin-top: 3.1cqw; }
.hc__label { font-size: 1.42cqw; letter-spacing: 0.08em; color: var(--ink-soft); }
.hc__val { margin-top: 0.35cqw; font-size: 2.3cqw; letter-spacing: 0.1em; white-space: nowrap; }
.hc__right { text-align: right; }
.hc__span { grid-column: 1 / -1; }
.hc__wallet { font-size: 2.02cqw; letter-spacing: 0.04em; }
.hc__dots { opacity: 0.55; letter-spacing: 0.08em; white-space: pre; }
.hc__muted { font-family: var(--f-body); font-size: 1.8cqw; letter-spacing: 0; opacity: 0.55; }
.hc__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 4cqw; margin-top: auto; }
.hc__fine { max-width: 58%; font-family: var(--f-body); font-size: 1.3cqw; line-height: 1.35; letter-spacing: 0; color: var(--ink-soft); }
.hc__marks { display: flex; align-items: center; gap: 2.4cqw; }
.hc__brand { display: inline-flex; align-items: center; gap: 0.8cqw; font-family: var(--f-body); font-size: 2.3cqw; font-weight: 500; letter-spacing: 0.02em; white-space: nowrap; }
.hc__brand svg, .hc__brand img { width: 2.6cqw; height: 2.6cqw; object-fit: contain; }
.hc__net { display: flex; }
.hc__net i { width: 5.2cqw; height: 5.2cqw; border-radius: 50%; background: #eb001b; }
.hc__net i + i { margin-left: -2cqw; background: #f79e1b; opacity: 0.92; }

/* =========================================================
   CHECKOUT
   ========================================================= */
.checkout, .mycard {
  position: relative;
  min-height: 100vh;
  padding: 120px var(--pad-x) 110px;
  color: var(--white);
  background: linear-gradient(180deg, #00001e 0%, #010124 16%, #020e3a 42%, #0c2e63 80%, #173f78 100%);
  overflow: hidden;
}
.checkout::before, .mycard::before {
  content: "";
  position: absolute;
  left: 50%; top: -240px;
  width: 1100px; height: 700px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(90, 140, 255, 0.26), transparent 70%);
  pointer-events: none;
}
.co__top { position: relative; max-width: var(--max); margin: 0 auto; }
.co__back { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; opacity: 0.7; transition: opacity 0.2s; }
.co__back:hover { opacity: 1; }
.co__top .h2 { margin-top: 18px; }
.co__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 60px;
  max-width: var(--max);
  margin: 44px auto 0;
  align-items: start;
}
.co__preview { position: sticky; top: 30px; }
.co__preview .hc { width: 100%; max-width: 560px; margin: 0 auto; }
.co__hint { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 34px; }
.co__hint p { font-size: 12px; opacity: 0.6; }
.co__tier { max-width: 560px; margin: 36px auto 0; padding-top: 28px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.co__tier .tier__name h3 { font-size: 30px; }

.co__panel {
  padding: 28px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.co__step { margin: 28px 0 12px; font-size: 12px; opacity: 0.6; }
.co__step:first-child { margin-top: 0; }
.co__panel .finish-pick { justify-content: flex-start; }

.field { margin-top: 16px; }
.field > label { display: block; margin-bottom: 8px; font-family: var(--f-mono); font-size: 12px; letter-spacing: -0.02em; text-transform: uppercase; opacity: 0.75; }
.field input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  font: inherit;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 1px;
  outline: none;
  color-scheme: dark;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}
.field input::placeholder { color: rgba(255, 255, 255, 0.4); }
.field input:focus { border-color: var(--paper); background: rgba(255, 255, 255, 0.1); }
.field.is-invalid input { border-color: #ff8f80; }
.field__row { display: flex; gap: 8px; }
.field__row input { flex: 1; min-width: 0; font-family: var(--f-mono); font-size: 13px; }
.field__btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 50px;
  padding: 0 14px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: -0.02em;
  color: var(--white);
  background: rgba(171, 159, 242, 0.22);
  border: 1px solid rgba(171, 159, 242, 0.7);
  border-radius: 1px;
  transition: background-color 0.3s var(--ease);
}
.field__btn:hover { background: rgba(171, 159, 242, 0.34); }
.field__btn .wallet-btn__icon { width: 18px; height: 18px; }
.field__hint { margin-top: 6px; font-size: 12px; opacity: 0.55; }
.field__err { margin-top: 6px; font-size: 12px; color: #ffb4a8; }
.field__err:empty { display: none; }

.summary { margin-top: 28px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.summary__row { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; font-size: 15px; letter-spacing: -0.02em; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.summary__row span:first-child { opacity: 0.7; }
.summary__row--total { font-size: 18px; font-weight: 500; border-bottom: 0; }
.summary__row--total span:first-child { opacity: 1; }

.pay-btn { width: 100%; height: 56px; margin-top: 16px; justify-content: center; }
.pay-btn:disabled { cursor: progress; opacity: 0.85; }
.pay-btn.is-busy .btn__icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.co__note { margin-top: 14px; font-size: 11px; line-height: 1.5; opacity: 0.6; }
.co__msg { margin-top: 10px; min-height: 14px; font-size: 12px; line-height: 1.5; color: #ffb4a8; }
.co__msg a, .done__tx a { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }
.done__tx { margin-top: 12px; font-size: 12px; opacity: 0.85; }

/* success dialog */
.done {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 6, 20, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.done[hidden] { display: none; }
.done.is-open { opacity: 1; }
.done__box {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 32px 28px;
  text-align: center;
  color: var(--white);
  background: linear-gradient(180deg, #0d1a45, #081030);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  transform: translateY(24px) scale(0.98);
  transition: transform 0.6s var(--ease);
}
.done.is-open .done__box { transform: none; }
.done__check { width: 44px; height: 44px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: rgba(61, 220, 132, 0.16); color: #3ddc84; }
.done__check svg { width: 22px; height: 22px; }
.done__box .h2 { margin-top: 16px; font-size: 34px; }
.done__box .body { margin-top: 10px; opacity: 0.8; }
.done .hc { width: 100%; max-width: 380px; margin: 26px auto 30px; }
.done__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* =========================================================
   MY CARD
   ========================================================= */
.mc__head { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; }
.mc__head .h1 { margin-top: 24px; }
.mc__head .lead { margin-top: 14px; max-width: 520px; opacity: 0.8; }
.mc__switch { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 26px; }
.mc__switch[hidden] { display: none; }
.mc-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--white);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 1px;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.mc-chip:hover { background: rgba(255, 255, 255, 0.18); }
.mc-chip.is-active { background: var(--paper); color: var(--ink); }

.mc__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 60px;
  max-width: var(--max);
  margin: 54px auto 0;
  align-items: center;
}
.mc__grid[hidden] { display: none; }
.mc__stage .hc { width: 100%; max-width: 620px; margin: 0 auto; }
.mc__stage .hc__tilt { animation: floaty 6s ease-in-out infinite; }
.mc__actions { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 40px; }
.mc__actions p { font-size: 12px; opacity: 0.6; }

.mc__panel {
  padding: 28px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.mc__status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12px; color: #8ff3bd; background: rgba(61, 220, 132, 0.14); border-radius: 1px; }
.mc__list { margin: 20px 0 0; }
.mc__list > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.mc__list > div[hidden] { display: none; }
.mc__tx { font-size: 14px; text-decoration: underline; text-underline-offset: 3px; opacity: 0.9; }
.mc__tx:hover { opacity: 1; }
.mc__list dt { font-family: var(--f-mono); font-size: 12px; letter-spacing: -0.02em; opacity: 0.6; }
.mc__list dd { margin: 0; text-align: right; font-size: 15px; letter-spacing: -0.02em; }
.mc__list .mono-val { font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.02em; }
.mc__wallet { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.mc__copy { padding: 4px 8px; font-family: var(--f-mono); font-size: 11px; background: rgba(255, 255, 255, 0.12); border-radius: 1px; transition: background-color 0.2s; }
.mc__copy:hover { background: rgba(255, 255, 255, 0.22); }
.mc__buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.mc__remove { margin-top: 18px; font-family: var(--f-mono); font-size: 11px; color: #ffb4a8; opacity: 0.8; }
.mc__remove:hover { opacity: 1; text-decoration: underline; }

.mc__empty { position: relative; max-width: 520px; margin: 50px auto 0; text-align: center; }
.mc__empty[hidden] { display: none; }
.mc__empty img { width: min(360px, 90%); margin: 0 auto; opacity: 0.5; filter: grayscale(0.4) drop-shadow(0 20px 30px rgba(0, 0, 25, 0.5)); }
.mc__empty .body { margin-top: 26px; opacity: 0.8; }
.mc__empty .btn { margin-top: 22px; }

/* ---------- responsive ---------- */
@media (max-width: 991px) {
  .co__grid, .mc__grid { grid-template-columns: 1fr; gap: 40px; }
  .co__preview { position: static; }
}
@media (max-width: 767px) {
  .checkout, .mycard { padding: 100px 16px 80px; }
  .co__panel, .mc__panel { padding: 20px; }
  .field__row { flex-wrap: wrap; }
  .field__btn { width: 100%; justify-content: center; }
  .co__tier .tier__name h3 { font-size: 26px; }
  .done__box { padding: 26px 18px; }
  .done__box .h2 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .hc__inner { transition-duration: 0.01ms; }
}
