/* ==========================================================================
   Explore Forex — four equal cards (4 / 2 / 1 columns) + service dialog
   Motion is intentionally limited to colour/shadow hover transitions;
   all animation will be refined together later.
   ========================================================================== */

.explore {
  padding-block: clamp(56px, 7vw, 96px);
  background: var(--c-bg);
  scroll-margin-top: var(--header-h);
}

.explore-title {
  margin: 0 0 clamp(24px, 3vw, 40px);
  color: var(--c-ink);
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3.2rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.explore-title .accent {
  margin-left: -0.04em;
  color: var(--c-red);
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.4vw, 20px);
}

/* --------------------------------------------------------------------------
   Card shell — the whole card is a <button> that opens its detail panel
   -------------------------------------------------------------------------- */

.xcard {
  --tint: var(--c-bg-soft);
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(20, 20, 20, 0.06);
  border-radius: 24px;
  background: var(--tint);
  color: var(--c-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.xcard:hover,
.xcard:focus-visible {
  border-color: rgba(20, 20, 20, 0.22);
  box-shadow: 0 18px 40px -26px rgba(20, 20, 20, 0.4);
}

.xcard:focus-visible {
  outline-offset: 4px;
}

.xcard--buy { --tint: #f6f4f0; }
.xcard--explore { --tint: #fdf2f1; }
.xcard--cards { --tint: #f1f1f3; }
.xcard--corp { --tint: #eff2f6; }

/* Visual: same proportion on every card so the text below aligns */
.xcard-visual {
  position: relative;
  display: block;
  flex: none;
  aspect-ratio: 10 / 7;
  container-type: inline-size;
}

.xcard-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 4px clamp(18px, 1.8vw, 24px) clamp(18px, 1.8vw, 24px);
}

.xcard-title {
  display: block;
  font-size: clamp(1.12rem, 1rem + 0.35vw, 1.3rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.xcard-line {
  display: block;
  margin-top: 6px;
  color: var(--c-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* CTA label pinned to the bottom so all four line up */
.xcard-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 16px;
  color: var(--c-ink);
  font-size: 0.92rem;
  font-weight: 700;
  transition: color 0.2s ease;
}

.xcard-cta .icon {
  width: 1.05em;
  height: 1.05em;
}

.xcard:hover .xcard-cta,
.xcard:focus-visible .xcard-cta {
  color: var(--c-red);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

/* Shared flag swatch */
.flag {
  display: block;
  flex: none;
  width: 30px;
  height: 20px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(20, 20, 20, 0.08);
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   1. Buy & Sell — two banknote fans
   -------------------------------------------------------------------------- */

.xbuy-note {
  position: absolute;
  width: 68%;
  height: auto;
}

.xbuy-note--back {
  top: 9%;
  left: 5%;
  rotate: -7deg;
  filter: brightness(0.97) drop-shadow(0 1px 1.5px rgba(20, 20, 20, 0.14))
    drop-shadow(0 10px 14px rgba(20, 20, 20, 0.14));
}

.xbuy-note--front {
  right: 4%;
  bottom: 7%;
  rotate: 4deg;
  filter: drop-shadow(0 2px 2px rgba(20, 20, 20, 0.18))
    drop-shadow(0 14px 20px rgba(20, 20, 20, 0.2));
}

/* --------------------------------------------------------------------------
   2. Explore Currencies — curated flag + symbol tokens
   -------------------------------------------------------------------------- */

.xflags {
  position: absolute;
  inset: 10% 6% 6%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 6cqi 7cqi;
}

.xflag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6cqi;
  width: 19cqi;
  color: var(--c-ink);
  font-size: max(11px, 4.4cqi);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.xflag-disc {
  position: relative;
  display: block;
  width: 17cqi;
  aspect-ratio: 1;
}

.xflag-disc .flag {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff, 0 8px 16px -8px rgba(20, 20, 20, 0.4);
}

.xflag-disc b {
  position: absolute;
  right: -10%;
  bottom: -8%;
  display: grid;
  place-items: center;
  width: 8.5cqi;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c-red);
  color: #fff;
  font-size: max(10px, 4cqi);
  font-weight: 800;
  box-shadow: 0 0 0 2px var(--tint, #fff);
}

/* --------------------------------------------------------------------------
   3. Forex Cards — matte black card with chip, contactless mark, red edge
   -------------------------------------------------------------------------- */

.fxcard {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64%;
  aspect-ratio: 1.586;
  border-radius: 4.5cqi;
  translate: -50% -50%;
}

.fxcard--back {
  background: linear-gradient(135deg, #f7f7f8, #d9dbdf);
  box-shadow: 0 14px 24px -16px rgba(20, 20, 20, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  transform: translate(13%, -14%) rotate(10deg);
}

.fxcard--front {
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 18% 0%, rgba(255, 255, 255, 0.16), transparent 55%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 5px),
    linear-gradient(135deg, #2a2a2c 0%, #141414 60%, #0b0b0c 100%);
  color: #fff;
  box-shadow: 0 22px 34px -20px rgba(20, 20, 20, 0.65), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: rotate(-6deg);
}

.fxcard-label {
  position: absolute;
  top: 12%;
  left: 8%;
  font-size: max(9px, 3.4cqi);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.fxcard-nfc {
  position: absolute;
  top: 10%;
  right: 8%;
  width: 7cqi;
  height: 7cqi;
  opacity: 0.7;
}

.fxcard-chip {
  position: absolute;
  top: 38%;
  left: 8%;
  width: 16%;
  aspect-ratio: 1.3;
  border-radius: 1.4cqi;
  background:
    linear-gradient(90deg, transparent 32%, rgba(0, 0, 0, 0.25) 33% 35%, transparent 36% 64%, rgba(0, 0, 0, 0.25) 65% 67%, transparent 68%),
    linear-gradient(0deg, transparent 47%, rgba(0, 0, 0, 0.25) 48% 52%, transparent 53%),
    linear-gradient(135deg, #f3e2a8, #c9a85a 55%, #e9d49a);
}

.fxcard-num {
  position: absolute;
  left: 8%;
  bottom: 13%;
  font-size: max(8px, 3.2cqi);
  letter-spacing: 0.14em;
  white-space: nowrap;
  opacity: 0.75;
}

.fxcard-stripe {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 34%;
  height: 3px;
  background: var(--c-red);
}

/* --------------------------------------------------------------------------
   4. Corporate Forex — statement panel with a currency pair
   -------------------------------------------------------------------------- */

.xcorp-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  gap: 5cqi;
  width: 80%;
  padding: 6cqi;
  border-radius: 5cqi;
  background: #fff;
  box-shadow: 0 20px 34px -24px rgba(20, 20, 20, 0.4), 0 0 0 1px rgba(20, 20, 20, 0.04);
  translate: -50% -50%;
}

.xcorp-badge {
  position: absolute;
  top: -5cqi;
  right: -4cqi;
  display: grid;
  place-items: center;
  width: 13cqi;
  aspect-ratio: 1;
  border-radius: 4cqi;
  background: var(--c-ink);
  color: #fff;
  font-size: max(12px, 5cqi);
  box-shadow: 0 10px 20px -10px rgba(20, 20, 20, 0.6);
}

.xcorp-head,
.xcorp-lines {
  display: flex;
  flex-direction: column;
  gap: 2.4cqi;
}

.xcorp-head span,
.xcorp-lines span {
  display: block;
  height: 2.4cqi;
  border-radius: 2cqi;
  background: #eceef1;
}

.xcorp-head span:first-child { width: 50%; height: 3cqi; background: #dcdfe4; }
.xcorp-head span:last-child { width: 30%; }
.xcorp-lines span:nth-child(1) { width: 90%; }
.xcorp-lines span:nth-child(2) { width: 64%; }

.xcorp-swap {
  display: flex;
  align-items: center;
  gap: 2.6cqi;
}

.xcorp-ccy {
  display: inline-flex;
  align-items: center;
  gap: 2cqi;
  padding: 1.8cqi 3cqi 1.8cqi 1.8cqi;
  border-radius: 999px;
  background: var(--c-bg-soft);
  font-size: max(10px, 4cqi);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.xcorp-ccy .flag {
  width: 7cqi;
  height: 7cqi;
  border-radius: 50%;
}

.xcorp-arrow {
  display: grid;
  place-items: center;
  width: 9cqi;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c-red);
  color: #fff;
  font-size: max(10px, 3.6cqi);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Tablet (and large phones in landscape): two per row */
@media (max-width: 1099.98px) {
  .explore-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Small phones: one per row, shorter visuals to keep the section compact */
@media (max-width: 519.98px) {
  .explore-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .xcard-visual {
    aspect-ratio: 2 / 1;
  }

  .xbuy-note {
    width: 50%;
  }

  .xbuy-note--back {
    left: 14%;
  }

  .xbuy-note--front {
    right: 14%;
  }

  .xflags {
    inset: 8% 3%;
    gap: 3cqi 2.4cqi;
  }

  .xflag {
    width: 16.5cqi;
    font-size: max(11px, 3.4cqi);
  }

  .xflag-disc {
    width: 13.5cqi;
  }

  .xflag-disc b {
    width: 6.5cqi;
    font-size: max(10px, 3.2cqi);
  }

  .fxcard {
    width: 46%;
  }

  .xcorp-panel {
    width: 62%;
    gap: 3.4cqi;
    padding: 4.4cqi;
  }

  .xcorp-ccy {
    font-size: max(11px, 3.2cqi);
  }

  .xcorp-ccy .flag {
    width: 5.4cqi;
    height: 5.4cqi;
  }

  .xcorp-arrow {
    width: 7cqi;
  }

  .xcorp-badge {
    width: 9cqi;
    top: -3.4cqi;
    right: -3cqi;
  }

  .xcorp-head span,
  .xcorp-lines span {
    height: 1.8cqi;
  }
}

/* ==========================================================================
   Service dialog — centred card on desktop, bottom sheet on mobile
   (no open/close animation yet)
   ========================================================================== */

.svc-dialog {
  width: 100%;
  max-width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--c-ink);
  overflow: visible;
}

.svc-dialog::backdrop {
  background: rgba(20, 20, 20, 0.4);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.svc-card {
  position: relative;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 32px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 40px 100px -30px rgba(20, 20, 20, 0.5), 0 0 0 1px rgba(20, 20, 20, 0.05);
}

.svc-card:focus {
  outline: none;
}

.svc-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--c-bg-soft);
  color: var(--c-ink);
  cursor: pointer;
  font-size: 1.05rem;
  transition: background-color 0.2s ease;
}

.svc-close:hover {
  background: #e9eaed;
}

.svc-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 18px;
  border-radius: 16px;
  font-size: 1.3rem;
}

.svc-icon--warm { background: #f6f4f0; color: var(--c-ink); }
.svc-icon--red { background: var(--c-red-50); color: var(--c-red); }
.svc-icon--ink { background: var(--c-ink); color: #fff; }
.svc-icon--cool { background: #eff2f6; color: var(--c-ink); }

.svc-title {
  margin: 0;
  padding-right: 48px;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.svc-text {
  margin: 8px 0 0;
  color: var(--c-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.svc-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.svc-ctas .btn {
  flex: 1 1 200px;
}

.svc-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 18px 0 0;
  color: var(--c-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.svc-note .icon {
  margin-top: 1px;
}

/* Segmented control (Buy / Sell) ------------------------------------------ */

.seg {
  display: inline-flex;
  gap: 4px;
  margin: 22px 0 0;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--c-bg-soft);
}

.seg label {
  position: relative;
}

.seg input,
.dest input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg span {
  display: block;
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--c-muted);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.seg input:checked + span {
  background: var(--c-ink);
  color: #fff;
}

.seg input:focus-visible + span,
.dest input:focus-visible + span {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}

/* Destination selector ------------------------------------------------------ */

.dest {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

.dest-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dest-options label {
  position: relative;
}

.dest-options span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 8px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: var(--c-bg-soft);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.dest-options .flag {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.dest-options span:hover {
  background: #ececef;
}

.dest-options input:checked + span {
  border-color: var(--c-ink);
  background: #fff;
}

.dest-detail {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 20px;
  background: var(--c-red-50);
}

.dest-flag {
  width: 60px;
  height: 40px;
  border-radius: 8px;
}

.dest-info {
  min-width: 0;
}

.dest-currency {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dest-meta {
  margin: 2px 0 0;
  color: var(--c-muted);
  font-size: 0.9rem;
}

.dest-symbol {
  margin-left: auto;
  color: var(--c-red);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}

/* Mobile: bottom sheet */
@media (max-width: 599.98px) {
  .svc-dialog {
    max-width: 100%;
    margin: auto 0 0;
    max-height: 92dvh;
  }

  .svc-card {
    max-height: 92dvh;
    padding: 28px 20px calc(22px + env(safe-area-inset-bottom, 0px));
    border-radius: 24px 24px 0 0;
  }

  .seg {
    display: flex;
  }

  .seg label {
    flex: 1;
    text-align: center;
  }
}
