/* Dapps (coded) */

.dapps-hero {
  padding-top: calc(var(--header-bottom) + clamp(24px, 4vw, 42px));
  padding-bottom: clamp(40px, 6vw, 76px);
  overflow: hidden;
  background: #fff;
}

.dapps-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--dapps-hero-art);
  background-repeat: no-repeat;
  background-position: right top;
  background-size: min(86vw, 1260px) auto;
  pointer-events: none;
  z-index: 0;
}

.dapps-hero__inner {
  position: relative;
  z-index: 1;
}

.dapps-hero__copy {
  width: 100%;
}

.dapps-hero__mobile-art {
  display: none;
}

.dapps-hero__title,
.dapps-hero__body,
.dapps-hero__actions {
  opacity: 0;
  transform: translateY(16px);
  animation: dappsHeroEnter 840ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.dapps-hero__title { animation-delay: 0ms; }
.dapps-hero__body { animation-delay: 140ms; }
.dapps-hero__actions { animation-delay: 420ms; }

.dapps-hero__title {
  margin: 0;
  max-width: 12ch;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(25px, min(9.38vw, 4dvh), 39px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.dapps-hero__body {
  margin: 20px 0 0;
  max-width: 42ch;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
}

.dapps-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  width: min(100%, 988px);
  margin-top: 42px;
}

.dapps-shortcut {
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 18px 20px 18px;
  border-radius: 32px;
  border: none;
  background: #f5f5f5;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  opacity: 0;
  animation: dappsShortcutFade 560ms ease forwards;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 420ms cubic-bezier(0.22, 1, 0.36, 1), background-color 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.dapps-shortcut:nth-child(1) { animation-delay: 280ms; }
.dapps-shortcut:nth-child(2) { animation-delay: 340ms; }
.dapps-shortcut:nth-child(3) { animation-delay: 400ms; }
.dapps-shortcut:nth-child(4) { animation-delay: 460ms; }

.dapps-shortcut:hover,
.dapps-shortcut:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
}

.dapps-shortcut__media {
  display: flex;
  flex: 0 0 138px;
  width: 100%;
  align-items: center;
  justify-content: center;
  min-height: 138px;
}

.dapps-shortcut__media img {
  display: block;
  width: auto;
  max-width: 170px;
  max-height: 124px;
  object-fit: contain;
}

.dapps-shortcut__title {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6em;
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.25;
  text-align: center;
}

.dapps-hero__actions {
  margin-top: 40px;
}

.dapps-launch-btn {
  min-width: 268px;
}

.dapps-directory {
  padding-top: clamp(12px, 2vw, 24px);
  padding-bottom: clamp(56px, 8vw, 112px);
  background: #fff;
}

.dapps-directory__shell {
  width: 100%;
}

.ecosys-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 8px 14px;
}

.ecosys-select {
  appearance: none;
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 9999px;
  padding: 10px 40px 10px 14px;
  font-size: 14px;
  line-height: 1;
  color: #111;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}

.ecosys-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  padding: 6px 8px 24px;
  overflow: visible;
}

.cex-card {
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 220px;
  padding: 24px;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  color: inherit;
  text-decoration: none;
  transition: opacity 420ms cubic-bezier(0.22, 1, 0.36, 1), transform 420ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 220ms ease;
  border: 1px solid #c8cac2;
  opacity: 0;
  transform: translateY(12px);
}

.cex-card.is-ready {
  opacity: 1;
  transform: translateY(0);
}

.cex-card:hover,
.cex-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  z-index: 50;
}

.cex-logo {
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  overflow: hidden;
}

.cex-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cex-name {
  margin-bottom: 8px;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.3;
  color: #111;
}

.cex-desc {
  font-size: 14px;
  line-height: 1.45;
  color: #505050;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 92%;
  position: relative;
}

.cex-tooltip {
  position: absolute;
  left: 50%;
  top: 87%;
  width: min(640px, calc(90% + 0px));
  background: #e6e8e3;
  color: #222;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
  z-index: 100;
}

.ecosys-grid.is-error {
  display: block;
  color: var(--text-muted);
  font-size: 15px;
  padding-top: 0;
}

@media (hover: hover) and (pointer: fine) {
  .cex-desc:hover + .cex-tooltip,
  .cex-card:focus-visible .cex-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 12px);
  }
}

@media (max-width: 1200px) {
  .dapps-hero::after {
    background-size: min(88vw, 1060px) auto;
  }

  .ecosys-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 981px) {
  .dapps-hero {
    min-height: 100svh;
    padding-top: var(--header-bottom);
    box-sizing: border-box;
    display: block;
  }

  .dapps-hero__inner {
    min-height: calc(100svh - var(--header-bottom) - clamp(56px, 8vh, 96px));
    display: grid;
    align-items: center;
  }
}

@media (max-width: 980px) {
  .dapps-hero {
    padding-top: calc(var(--header-bottom) + 28px);
    padding-bottom: 40px;
  }

  .dapps-hero::after {
    display: none;
  }

  .dapps-hero__copy {
    max-width: 100%;
    text-align: center;
  }

  .dapps-hero__mobile-art {
    display: block;
    width: calc(100% + (var(--gutter) * 2));
    height: clamp(180px, 46vw, 300px);
    margin: 0 calc(-1 * var(--gutter)) 24px;
    background-image: var(--dapps-hero-art);
    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;
  }

  .dapps-hero__title {
    max-width: none;
    font-size: 22px;
    line-height: 1.2;
    text-align: center;
  }

  .dapps-hero__body {
    max-width: 34ch;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }

  .dapps-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: min(100%, 420px);
    margin-top: 28px;
  }

  .dapps-hero__actions {
    margin-top: 28px;
    display: flex;
    justify-content: center;
  }

  .dapps-launch-btn {
    min-width: 0;
  }

  .dapps-directory {
    padding-top: 0;
  }

  .dapps-shortcut {
    border-radius: 24px;
    padding: 12px 12px 16px;
  }

  .dapps-shortcut__media {
    flex-basis: 118px;
    min-height: 118px;
  }

  .dapps-shortcut__media img {
    max-width: 168px;
    max-height: 118px;
  }

  .dapps-shortcut__title {
    min-height: 2.8em;
    font-size: 13px;
  }

  .ecosys-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .ecosys-filter {
    margin-left: 0;
    margin-right: 0;
  }

  .ecosys-select {
    width: 100%;
    max-width: 260px;
  }

  .ecosys-grid {
    grid-template-columns: 1fr;
    gap: 18px;
    padding-left: 0;
    padding-right: 0;
  }

  .cex-card {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dapps-hero__title,
  .dapps-hero__body,
  .dapps-hero__actions,
  .dapps-shortcut,
  .cex-card {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
}

@keyframes dappsHeroEnter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dappsShortcutFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
