/* Card grid section — currencies, category nav, document links (Figma 472:14049 + expand/collapse) */

.currencies-section {
  background: var(--color-bg);
}

.currencies-section__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

.currencies-section__title {
  margin: 0 0 clamp(16px, 2.5vw, 24px);
  max-width: 100%;
  width: 100%;
  font-size: clamp(1.75rem, 3.5vw + 0.85rem, var(--font-display));
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--color-black);
}

/*
 * Clips grid when collapsed; bottom fade on last visible row.
 * Padding gives room for .currencies-section__card:hover scale so edges are not clipped
 * (overflow clips to the padding box — scale can paint into this inset).
 */
.currencies-section__grid-scroll {
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  padding: clamp(8px, 1.2vw, 14px) clamp(12px, 2vw, 24px);
  max-height: var(--currencies-scroll-max, 9999px);
  transition: max-height 0.48s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.currencies-section__grid-scroll--collapsed {
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 72%,
    rgba(0, 0, 0, 0.55) 88%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 72%,
    rgba(0, 0, 0, 0.55) 88%,
    transparent 100%
  );
}

.currencies-section__grid-scroll:not(.currencies-section__grid-scroll--collapsed) {
  -webkit-mask-image: none;
  mask-image: none;
}

.currencies-section__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(6px, 1vw, 10px);
  width: 100%;
  overflow: visible;
}

.currencies-section__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  padding: clamp(12px, 1.8vw, 18px);
  border-radius: var(--radius-card);
  background: var(--color-light-grey-opacity);
  box-sizing: border-box;
  transform: scale(1);
  transform-origin: center center;
  transition: transform var(--kpi-card-hover-duration) var(--kpi-card-enter-ease);
}

.currencies-section__card:hover {
  transform: scale(var(--kpi-card-hover-scale));
}

.currencies-section__card-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  direction: ltr;
}

/* Match .features-card__btn + .btn--primary (45px circle, 20px chevron) */
.currencies-section__card-cta.btn--primary {
  flex-shrink: 0;
  width: 45px;
  height: 45px;
  min-width: 45px;
  padding: 0;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  color: var(--color-bg);
  text-decoration: none;
  box-sizing: border-box;
}

.currencies-section__card-cta.btn--primary svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.currencies-section__card-cta.btn--primary .currencies-section__card-cta-icon--info {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.currencies-section__card-cta:focus-visible {
  outline: 2px solid var(--color-blue-dark);
  outline-offset: 3px;
}

.currencies-section__flag-wrap {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  overflow: hidden;
  background: var(--color-light-grey);
  box-shadow: 0 1px 2px rgba(19, 24, 26, 0.1);
}

.currencies-section__flag {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.currencies-section__label {
  margin: 0;
  font-size: clamp(0.8125rem, 0.65vw + 0.65rem, 1rem);
  font-weight: 700;
  line-height: 1.3;
  text-align: right;
  color: var(--color-black);
}

/* Figma 559:10058 / 559:10064 — centered under grid */
.currencies-section__toggle-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: clamp(10px, 2vw, 16px);
}

.currencies-section__toggle-wrap[hidden] {
  display: none !important;
}

.currencies-section__toggle {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px;
  border: none;
  border-radius: var(--radius-inner);
  background: var(--color-light-grey);
  color: var(--color-black);
  font-family: inherit;
  font-size: var(--font-body);
  font-weight: 400;
  line-height: normal;
  cursor: pointer;
  box-sizing: border-box;
  transition: background var(--transition), color var(--transition);
}

.currencies-section__toggle:hover,
.currencies-section__toggle:focus-visible {
  background: var(--color-natural-grey);
}

.currencies-section__toggle:focus-visible {
  outline: 2px solid var(--color-blue-dark);
  outline-offset: 2px;
}

.currencies-section__toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.currencies-section__toggle-icon svg {
  display: block;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.currencies-section__toggle[aria-expanded="true"] .currencies-section__toggle-icon svg {
  transform: rotate(180deg);
}

.currencies-section__toggle-label {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .currencies-section__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .currencies-section__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .currencies-section__flag-wrap {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 400px) {
  .currencies-section__grid {
    grid-template-columns: 1fr;
  }

  .currencies-section__card-top {
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .currencies-section__card {
    transition: none;
  }

  .currencies-section__card:hover {
    transform: none;
  }

  .currencies-section__grid-scroll {
    max-height: none !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
    transition: none !important;
  }

  .currencies-section__grid-scroll--collapsed {
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }

  .currencies-section__toggle-wrap {
    display: none !important;
  }

  .currencies-section__toggle-icon svg {
    transition: none;
  }
}
