/**
 * Connect Wallet popup.
 *
 * Defaults reproduce the supplied reference. Every value below is a CSS
 * custom property that the plugin overrides from the saved settings, so the
 * stylesheet is the design and the settings only tune it.
 */

@font-face {
  font-family: "Outfit";
  src: url("../fonts/Outfit-Variable.woff2") format("woff2-variations"),
       url("../fonts/Outfit-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

.w3cp {
  --w3cp-bg: #09131d;
  --w3cp-text: #ffffff;
  --w3cp-muted: #d6dbde;
  --w3cp-accent: #e1b83c;
  --w3cp-panel-bg: #09131d;
  --w3cp-panel-border: #1e2329;
  --w3cp-close-bg: #1e2329;
  --w3cp-close-color: #ffffff;
  --w3cp-border-color: #1b2530;
  --w3cp-border-width: 1px;
  --w3cp-overlay-color: #02050a;
  --w3cp-overlay-opacity: 0.78;
  --w3cp-overlay: rgba(2, 5, 10, 0.78);
  --w3cp-shadow: 0 40px 90px rgba(0, 0, 0, 0.55);
  --w3cp-font: "Outfit", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --w3cp-width: 480px;
  --w3cp-radius: 18px;
  --w3cp-pad-top: 26px;
  --w3cp-pad-x: 20px;
  --w3cp-pad-bottom: 44px;

  --w3cp-title-size: 29px;
  --w3cp-title-weight: 700;
  --w3cp-title-spacing: -0.3px;
  --w3cp-sub-size: 20.5px;
  --w3cp-tab-size: 23px;
  --w3cp-tab-weight: 700;
  --w3cp-panel-size: 26px;
  --w3cp-panel-weight: 700;

  --w3cp-gap-sub: 16px;
  --w3cp-gap-tabs: 62px;
  --w3cp-tab-pad: 30px;
  --w3cp-tab-gap: 12px;
  --w3cp-tab-bar: 3px;
  --w3cp-gap-panel: 46px;
  --w3cp-panel-pad: 22px;
  --w3cp-panel-pad-bottom: 31px;
  --w3cp-panel-radius: 17px;
  --w3cp-icon-gap: 22px;
  --w3cp-icon-size: 72px;
  --w3cp-btn-gap: 30px;

  --w3cp-btn-bg: #3996fe;
  --w3cp-btn-color: #ffffff;
  --w3cp-btn-hover: #1f84f7;
  --w3cp-btn-size: 20px;
  --w3cp-btn-weight: 600;
  --w3cp-btn-pad-x: 30px;
  --w3cp-btn-pad-y: 15px;
  --w3cp-btn-radius: 28px;

  --w3cp-mobile-margin: 14px;
  --w3cp-mobile-scale: 0.92;

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: var(--w3cp-font);
  font-size: 16px;
  line-height: 1.4;
  color: var(--w3cp-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.w3cp[hidden] {
  display: none !important;
}

.w3cp__overlay {
  position: absolute;
  inset: 0;
  background: var(--w3cp-overlay);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.w3cp.is-open .w3cp__overlay {
  opacity: 1;
}

/* ---------------------------------------------------------------- dialog */

.w3cp__dialog {
  position: relative;
  width: min(var(--w3cp-width), 100%);
  max-width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  background: var(--w3cp-bg);
  border: var(--w3cp-border-width) solid var(--w3cp-border-color);
  border-radius: var(--w3cp-radius);
  box-shadow: var(--w3cp-shadow);
  padding: var(--w3cp-pad-top) var(--w3cp-pad-x) var(--w3cp-pad-bottom);
  transform: translateY(12px) scale(0.985);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.24s ease;
}

.w3cp.is-open .w3cp__dialog {
  transform: none;
  opacity: 1;
}

/* Scrollbar inside the dialog, dark like the card. */
.w3cp__dialog {
  scrollbar-width: thin;
  scrollbar-color: #263444 transparent;
}
.w3cp__dialog::-webkit-scrollbar {
  width: 8px;
}
.w3cp__dialog::-webkit-scrollbar-thumb {
  background: #263444;
  border-radius: 4px;
}

/* ------------------------------------------------------------------ head */

.w3cp__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.w3cp__head-copy {
  min-width: 0;
}

.w3cp__title {
  margin: 0;
  font-family: var(--w3cp-font);
  font-size: var(--w3cp-title-size);
  font-weight: var(--w3cp-title-weight);
  letter-spacing: var(--w3cp-title-spacing);
  line-height: 1.2;
  color: var(--w3cp-text);
}

.w3cp__sub {
  margin: var(--w3cp-gap-sub) 0 0;
  font-size: var(--w3cp-sub-size);
  font-weight: 400;
  line-height: 1.3;
  color: var(--w3cp-muted);
}

.w3cp__close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--w3cp-close-bg);
  color: var(--w3cp-close-color);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.w3cp__close:hover {
  background: #2a323b;
}

.w3cp__close:active {
  transform: scale(0.96);
}

.w3cp__close svg {
  display: block;
  width: 26px;
  height: 26px;
}

/* ------------------------------------------------------------------ tabs */

.w3cp__tabs {
  margin-top: var(--w3cp-gap-tabs);
}

.w3cp__tab {
  display: inline-block;
  padding: 0 var(--w3cp-tab-pad) var(--w3cp-tab-gap);
  border-bottom: var(--w3cp-tab-bar) solid var(--w3cp-accent);
  font-size: var(--w3cp-tab-size);
  font-weight: var(--w3cp-tab-weight);
  line-height: 1.25;
  color: var(--w3cp-text);
}

/* ----------------------------------------------------------------- panel */

.w3cp__panel {
  margin-top: var(--w3cp-gap-panel);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: var(--w3cp-icon-gap);
  row-gap: var(--w3cp-btn-gap);
  align-items: center;
  padding: var(--w3cp-panel-pad) var(--w3cp-panel-pad) var(--w3cp-panel-pad-bottom);
  background: var(--w3cp-panel-bg);
  border: 1px solid var(--w3cp-panel-border);
  border-radius: var(--w3cp-panel-radius);
}

.w3cp__icon {
  grid-column: 1;
  grid-row: 1;
  display: block;
  width: var(--w3cp-icon-size);
  max-width: 100%;
  height: auto;
  align-self: center;
}

.w3cp__panel-title {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  min-width: 0;
  font-family: var(--w3cp-font);
  font-size: var(--w3cp-panel-size);
  font-weight: var(--w3cp-panel-weight);
  line-height: 1.2;
  color: var(--w3cp-text);
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  text-wrap: balance;
}

.w3cp--no-icon .w3cp__panel {
  grid-template-columns: minmax(0, 1fr);
}

.w3cp--no-icon .w3cp__panel-title {
  grid-column: 1;
}

/* ----------------------------------------------------------------- button */

.w3cp__btn {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  max-width: 100%;
  padding: var(--w3cp-btn-pad-y) var(--w3cp-btn-pad-x);
  border: 0;
  border-radius: var(--w3cp-btn-radius);
  background: var(--w3cp-btn-bg);
  color: var(--w3cp-btn-color);
  font-family: var(--w3cp-font);
  font-size: var(--w3cp-btn-size);
  font-weight: var(--w3cp-btn-weight);
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.w3cp--full .w3cp__btn {
  justify-self: stretch;
  width: 100%;
}

.w3cp__btn:hover,
.w3cp__btn:focus {
  background: var(--w3cp-btn-hover);
  color: var(--w3cp-btn-color);
}

.w3cp__btn:active {
  transform: scale(0.99);
}

.w3cp__close:focus-visible,
.w3cp__btn:focus-visible {
  outline: 2px solid var(--w3cp-accent);
  outline-offset: 3px;
}

/* ------------------------------------------------------------- admin preview */

.w3cp--preview {
  position: relative;
  inset: auto;
  z-index: 1;
  display: block;
  width: 100%;
  padding: 0;
  background: radial-gradient(120% 120% at 20% 0%, #0c1a27 0%, #05090f 70%);
  border-radius: 12px;
}

.w3cp--preview .w3cp__overlay {
  display: none;
}

.w3cp--preview .w3cp__dialog {
  width: 100%;
  max-height: none;
  transform: none;
  opacity: 1;
  margin: 0 auto;
  box-shadow: none;
}

/* ----------------------------------------------------------------- mobile */

@media (max-width: 600px) {
  .w3cp {
    padding: var(--w3cp-mobile-margin);
  }

  .w3cp__dialog {
    width: 100%;
    max-height: calc(100vh - (var(--w3cp-mobile-margin) * 2));
    max-height: calc(100dvh - (var(--w3cp-mobile-margin) * 2));
    padding: calc(var(--w3cp-pad-top) * var(--w3cp-mobile-scale))
             calc(var(--w3cp-pad-x) * var(--w3cp-mobile-scale))
             calc(var(--w3cp-pad-bottom) * var(--w3cp-mobile-scale));
    border-radius: calc(var(--w3cp-radius) * var(--w3cp-mobile-scale));
  }

  .w3cp__title {
    font-size: calc(var(--w3cp-title-size) * var(--w3cp-mobile-scale));
  }

  .w3cp__sub {
    margin-top: calc(var(--w3cp-gap-sub) * var(--w3cp-mobile-scale));
    font-size: calc(var(--w3cp-sub-size) * var(--w3cp-mobile-scale));
  }

  .w3cp__close {
    width: 50px;
    height: 50px;
  }

  .w3cp__close svg {
    width: 22px;
    height: 22px;
  }

  .w3cp__tabs {
    margin-top: calc(var(--w3cp-gap-tabs) * var(--w3cp-mobile-scale));
  }

  .w3cp__tab {
    padding: 0 calc(var(--w3cp-tab-pad) * var(--w3cp-mobile-scale)) calc(var(--w3cp-tab-gap) * var(--w3cp-mobile-scale));
    font-size: calc(var(--w3cp-tab-size) * var(--w3cp-mobile-scale));
  }

  .w3cp__panel {
    margin-top: calc(var(--w3cp-gap-panel) * var(--w3cp-mobile-scale));
    column-gap: calc(var(--w3cp-icon-gap) * var(--w3cp-mobile-scale));
    row-gap: calc(var(--w3cp-btn-gap) * var(--w3cp-mobile-scale));
    padding: calc(var(--w3cp-panel-pad) * var(--w3cp-mobile-scale))
             calc(var(--w3cp-panel-pad) * var(--w3cp-mobile-scale))
             calc(var(--w3cp-panel-pad-bottom) * var(--w3cp-mobile-scale));
    border-radius: calc(var(--w3cp-panel-radius) * var(--w3cp-mobile-scale));
  }

  .w3cp__icon {
    width: calc(var(--w3cp-icon-size) * var(--w3cp-mobile-scale));
  }

  .w3cp__panel-title {
    font-size: calc(var(--w3cp-panel-size) * var(--w3cp-mobile-scale));
  }

  /* Comfortably tappable on a phone. */
  .w3cp__btn {
    min-height: 48px;
    padding: calc(var(--w3cp-btn-pad-y) * var(--w3cp-mobile-scale))
             calc(var(--w3cp-btn-pad-x) * var(--w3cp-mobile-scale));
    font-size: calc(var(--w3cp-btn-size) * var(--w3cp-mobile-scale));
    border-radius: max(24px, var(--w3cp-btn-radius));
  }

  .w3cp__btn:active {
    transform: none;
  }
}

/* Narrow phones: stack the icon above its label, so “Automatic/Manual” keeps
   its natural break instead of splitting a word. */
@media (max-width: 420px) {
  .w3cp__panel {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
    row-gap: 0;
    padding-bottom: calc(var(--w3cp-panel-pad-bottom) * var(--w3cp-mobile-scale) * 0.55);
  }

  .w3cp__icon {
    grid-column: 1;
    grid-row: 1;
    margin-bottom: 14px;
  }

  .w3cp__panel-title {
    margin-bottom: calc(var(--w3cp-btn-gap) * var(--w3cp-mobile-scale));
  }

  .w3cp__panel-title {
    grid-column: 1;
    grid-row: 2;
  }

  .w3cp__btn {
    grid-row: 3;
  }
}

/* Short landscape screens. */
@media (max-height: 520px) {
  .w3cp__dialog {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .w3cp__tabs {
    margin-top: calc(var(--w3cp-gap-tabs) * 0.5);
  }

  .w3cp__panel {
    margin-top: calc(var(--w3cp-gap-panel) * 0.6);
    padding-bottom: var(--w3cp-panel-pad);
  }
}

@media (prefers-reduced-motion: reduce) {
  .w3cp__dialog,
  .w3cp__overlay,
  .w3cp__close,
  .w3cp__btn {
    transition: none !important;
  }
}
