/* =========================================================================
   07-calculator — Currency Exchange Calculator
   Interactive EUR <-> GBP converter, centered, orange tone.
   Ported from CurrencyExchangeCalculator + the converter rules in entry.css.
   Every rule is scoped under ._currency-exchange-calculator.
   ========================================================================= */

._currency-exchange-calculator {
  /* pull up under the previous section, then large vertical padding */
  margin-top: calc(var(--180-64) * -1);
  /* effective gap above = padding-top − |margin-top| = 0.75 × token
     (was 1 × token; −25% together with the QR section's bottom padding) */
  padding-top: calc(var(--180-64) * 1.75);
  padding-bottom: clamp(36px, 144.999px + 100vw * -.0641, 120px);
  position: relative;
  z-index: 2;
}
@media only screen and (min-width: 2000px) {
  ._currency-exchange-calculator { padding-bottom: 1.8vw; }
}

/* keep real content above the decorative backdrop */
._currency-exchange-calculator > :not(._bg) { position: relative; }

/* Soft radial glow standing in for the original animated <canvas> */
._currency-exchange-calculator ._bg {
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 50% 38%, rgba(10, 10, 10, .05), transparent 70%);
}

/* ---- Grid-width helpers (column spans used by this section) -------------- */
/* width of N of the 16 fluid columns, including the inner gaps it spans */
._currency-exchange-calculator .w-cols-4 {
  width: calc((var(--grid-width) + var(--grid-gap)) / 16 * 4 - var(--grid-gap));
}
._currency-exchange-calculator .w-cols-10 {
  width: calc((var(--grid-width) + var(--grid-gap)) / 16 * 10 - var(--grid-gap));
}
@media (max-width: 1290px) {
  ._currency-exchange-calculator .md-w-cols-6 {
    width: calc((var(--grid-width) + var(--grid-gap)) / 16 * 6 - var(--grid-gap));
  }
}
@media (max-width: 1023px) {
  ._currency-exchange-calculator .sm-w-cols-7 {
    width: calc((var(--grid-width) + var(--grid-gap)) / 16 * 7 - var(--grid-gap));
  }
  ._currency-exchange-calculator .sm-w-cols-8 {
    width: calc((var(--grid-width) + var(--grid-gap)) / 16 * 8 - var(--grid-gap));
  }
}
@media (max-width: 743px) {
  ._currency-exchange-calculator .xs-w-cols-12 {
    width: calc((var(--grid-width) + var(--grid-gap)) / 16 * 12 - var(--grid-gap));
  }
  ._currency-exchange-calculator .xs-w-cols-14 {
    width: calc((var(--grid-width) + var(--grid-gap)) / 16 * 14 - var(--grid-gap));
  }
}

/* ---- Generic helpers used locally (not provided globally) --------------- */
._currency-exchange-calculator .mb-96-48 { margin-bottom: var(--96-48); }
._currency-exchange-calculator .uppercase { text-transform: uppercase; }
._currency-exchange-calculator .br-16 { border-radius: var(--16); }
._currency-exchange-calculator .br-inherit { border-radius: inherit; }
._currency-exchange-calculator .pb-120-64 { padding-bottom: var(--120-64); }
._currency-exchange-calculator .caption {
  font-size: 12px;
  letter-spacing: .03em;
  line-height: 1.5;
}
@media (max-width: 743px) {
  ._currency-exchange-calculator .caption { letter-spacing: .04em; }
}
@media only screen and (min-width: 2000px) {
  ._currency-exchange-calculator .caption { font-size: .6vw; }
}

/* ---- Tag pill ----------------------------------------------------------- */
._currency-exchange-calculator ._tag {
  --color: #fff;
  color: var(--color);
  display: inline-block; /* .inline-block utility isn't global; needed for width:max-content */
  padding: 4px 12px;
  width: max-content;
}
._currency-exchange-calculator ._tag[data-tone="orange"] { --color: var(--orange); }
._currency-exchange-calculator ._tag .outline {
  border-radius: 4em;
  outline: 1px solid var(--color);
  outline-offset: -1px;
}
@media only screen and (min-width: 2000px) {
  ._currency-exchange-calculator ._tag { padding: .2vw .6vw; }
}

/* ---- Converter ---------------------------------------------------------- */
._currency-exchange-calculator .converter-container { margin-inline: auto; }

._currency-exchange-calculator ._currency-converter[data-disabled="true"] {
  cursor: wait;
  opacity: .9;
}
._currency-exchange-calculator ._currency-converter[data-disabled="true"] > * {
  pointer-events: none;
}
._currency-exchange-calculator ._currency-converter[data-disabled="true"] .input-container {
  opacity: .7;
}

/* Card shell wrapping a currency selector + amount field */
._currency-exchange-calculator ._currency-card {
  background-color: rgba(10, 10, 10, .045);
  border-radius: var(--16);
}
._currency-exchange-calculator ._currency-card .slot { padding: var(--16); }

/* ---- Currency select button -------------------------------------------- */
._currency-exchange-calculator ._currency-select button {
  position: relative;
  color: var(--black);
  padding: 12px;
  width: 100%;
}
@media only screen and (min-width: 2000px) {
  ._currency-exchange-calculator ._currency-select button { padding: .6vw; }
}
._currency-exchange-calculator ._currency-select button .background {
  background-color: #fff;
  opacity: 0;
  transition: opacity .2s cubic-bezier(.25, .46, .45, .94);
}
._currency-exchange-calculator ._currency-select button .chevron {
  --color: var(--orange);
  color: var(--orange);
  background-color: rgba(10, 10, 10, .045);
  transition: transform .2s cubic-bezier(.25, .46, .45, .94);
}
._currency-exchange-calculator ._currency-select button:focus-visible {
  box-shadow: 0 0 0 1px var(--orange), 0 0 0 3px rgba(10, 10, 10, .35);
}
@media (hover: hover) and (pointer: fine) {
  ._currency-exchange-calculator ._currency-select button:hover .background { opacity: .4; }
}
._currency-exchange-calculator ._currency-select button:active .background { opacity: .5; }

/* selected currency flag/icon sizing */
._currency-exchange-calculator ._currency-select .currency-icon {
  height: var(--24);
  width: var(--24);
}

/* ---- Amount inputs ------------------------------------------------------ */
._currency-exchange-calculator ._currency-converter input {
  background: transparent;
  border: none;
  padding: 0;
  width: 100%;
  font: inherit;
  color: inherit;
}
/* hide native number spinners */
._currency-exchange-calculator ._currency-converter input::-webkit-outer-spin-button,
._currency-exchange-calculator ._currency-converter input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
._currency-exchange-calculator ._currency-converter input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
._currency-exchange-calculator ._currency-converter .input-focus {
  border-radius: var(--16);
  inset: calc(var(--16) * -1);
  pointer-events: none;
  transition: box-shadow .2s cubic-bezier(.25, .46, .45, .94);
}
._currency-exchange-calculator ._currency-converter input:focus-visible + .input-focus {
  box-shadow: 0 0 0 1px var(--orange), 0 0 0 3px rgba(10, 10, 10, .35);
}
/* The slot-contour ring above is the ONLY focus indicator — suppress the
   browser's native inner outline around the input itself. */
._currency-exchange-calculator ._currency-converter input:focus,
._currency-exchange-calculator ._currency-converter input:focus-visible {
  outline: none;
}

/* subtle pop when a value is computed (JS toggles ._tick) */
._currency-exchange-calculator ._currency-converter .input-container._tick .grow {
  animation: _cec-tick .28s var(--ease-out-quart);
}
@keyframes _cec-tick {
  0%   { transform: translateY(2px); opacity: .55; }
  100% { transform: translateY(0);   opacity: 1; }
}

/* ---- Swap control ------------------------------------------------------- */
._currency-exchange-calculator ._currency-converter .swap-btn {
  border: 1px solid #f6f7f8;
  border-radius: 100%;
  display: grid;
  place-items: center;
  height: var(--32);
  width: var(--32);
  transition: background-color .2s, border-color .2s,
              transform .3s cubic-bezier(.645, .045, .355, 1);
}
._currency-exchange-calculator ._currency-converter .swap-btn[data-swapped="true"] {
  transform: rotate(180deg);
}
._currency-exchange-calculator ._currency-converter .swap-btn ._icon {
  --color: var(--blue);
  color: var(--blue);
  width: var(--20);
  height: var(--20);
  transform: rotate(90deg);
}
._currency-exchange-calculator ._currency-converter .swap-btn ._icon path {
  fill: currentColor;
  transition: transform .2s cubic-bezier(.25, .46, .45, .94);
}
._currency-exchange-calculator ._currency-converter .swap-btn ._icon path:first-child { opacity: .2; }
@media (hover: hover) and (pointer: fine) {
  ._currency-exchange-calculator ._currency-converter .swap-btn:hover {
    background-color: rgba(73, 132, 239, .05);
    border-color: rgba(73, 132, 239, .15);
  }
  ._currency-exchange-calculator ._currency-converter .swap-btn:hover ._icon path:first-child {
    transform: translate(5%);
  }
  ._currency-exchange-calculator ._currency-converter .swap-btn:hover ._icon path:last-child {
    transform: translate(-5%);
  }
}
._currency-exchange-calculator ._currency-converter .swap-btn:active {
  background-color: rgba(73, 132, 239, .1);
  border-color: rgba(73, 132, 239, .25);
}
._currency-exchange-calculator ._currency-converter .swap-btn:focus-visible {
  box-shadow: 0 0 0 1px var(--blue), 0 0 0 3px rgba(73, 132, 239, .5);
}

/* chevron icon sizing (matches the global ._icon convention) */
._currency-exchange-calculator ._currency-select .chevron {
  width: var(--24);
  height: var(--24);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
._currency-exchange-calculator ._currency-select .chevron svg path { fill: currentColor; }

/* flag placeholder shape (round, like the source currency icons) */
._currency-exchange-calculator .currency-icon.ph-flag {
  border-radius: 100%;
  outline: 1px solid rgba(255, 255, 255, .3);
}

/* ---- Currency dropdown menu (flags + names) ------------------------------ */
._currency-select { position: relative; }
._currency-select .currency-menu {
  position: absolute;
  top: calc(100% + 8px);
  /* full converter width at any scale: the select wrapper spans the card,
     so left/right pin the panel to the card's edges */
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 16px 48px rgba(10, 10, 10, .16);
  max-height: 340px;
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  z-index: 40;
}
._currency-select[data-expanded="true"] .currency-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
}
._currency-select .currency-menu ul {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
._currency-select .currency-menu [role="option"] {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  transition: background-color .15s ease;
}
._currency-select .currency-menu [role="option"]:hover { background: var(--orange-25); }
._currency-select .currency-menu [role="option"] .ph-flag {
  width: 40px;
  height: 40px;
  font-size: 13px;
  flex: 0 0 auto;
}
._currency-select .currency-menu .texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
._currency-select .currency-menu .code {
  font-weight: var(--fw-medium);
  font-size: 17px;
  color: var(--orange-900);
}
._currency-select .currency-menu .name {
  font-size: 13px;
  color: rgba(10, 10, 10, .45);
}
._currency-select .currency-menu .check {
  width: 20px;
  height: 20px;
  margin-left: auto;
  flex: 0 0 auto;
  opacity: 0;
  color: #fff;
}
._currency-select .currency-menu [role="option"][aria-selected="true"] { background: var(--orange); }
._currency-select .currency-menu [role="option"][aria-selected="true"] .code { color: #fff; }
._currency-select .currency-menu [role="option"][aria-selected="true"] .name { color: rgba(255, 255, 255, .6); }
._currency-select .currency-menu [role="option"][aria-selected="true"] .check { opacity: 1; }

/* toggle chevron flips while the menu is open */
._currency-select .chevron { transition: transform .2s ease; }
._currency-select[data-expanded="true"] .chevron { transform: rotate(180deg); }

/* real flag image covers the monogram circle; removed by JS if the asset 404s */
._currency-exchange-calculator .currency-icon { position: relative; overflow: hidden; }
._currency-exchange-calculator .currency-icon .flag-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
