:root {
  --card-bg: var(--bg);
  --card-hover: var(--surface0);
}
:root[data-theme="dark"] {
  --card-bg: var(--surface);
  --card-hover: var(--surface1);
}
.body {
  --page-content-width: 48rem;

  main {
    width: 100%;
    color: var(--text);

    .loader {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      color: var(--subtext);
      padding: var(--space-3) 0;

      svg {
        animation: spin 0.8s linear infinite;
      }
    }

    .bang-error {
      margin: 0;
      color: var(--red);
      font-size: 0.95rem;
      line-height: 1.5;
    }

    .bang-results {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: var(--space-3);
      margin-top: var(--space-2);

      @media (max-width: 700px) {
        grid-template-columns: 1fr;
      }

      .bang {
        display: flex;
        gap: var(--space-3, 12px);
        padding: var(--space-2, 8px) var(--space-3, 12px);
        border-radius: var(--r-xl);
        align-items: center;
        overflow: hidden;
        cursor: default;
        text-decoration: none;
        color: inherit;
        background: var(--card-hover);
        transition: background var(--duration-base) var(--ease-out);

        @media (hover: hover) and (pointer: fine) {
          &:hover {
            background: color-mix(
              in srgb,
              var(--card-hover) 70%,
              var(--surface1)
            );
          }
        }

        .bang-icon {
          background-color: var(--surface0);
          outline: 2px solid var(--surface0);
          outline-offset: -1px;
          border-radius: var(--r-sm);
          width: 32px;
          height: 32px;
          min-width: 32px;
          position: relative;
          user-select: none;

          & > * {
            width: 32px;
            height: 32px;
            aspect-ratio: 1 / 1;
            border-radius: var(--r-sm);
            display: flex;
            align-items: center;
            justify-content: center;
            object-fit: cover;
            animation: fade-in var(--duration-slow) var(--ease-out) backwards;
          }

          & > .failed {
            color: var(--muted);
            opacity: 0.8;

            svg {
              width: 21px;
              height: 21px;
            }
          }

          & > .shimmer {
            --shimmer-size: 120px;
            background-image: linear-gradient(
              -60deg,
              rgba(0, 0, 0, 0) 40%,
              var(--border) 50%,
              rgba(0, 0, 0, 0) 60%
            );
            background-repeat: no-repeat;
            animation: svelte-shimmer 1.5s infinite linear;
            background-size: var(--shimmer-size) 100%;
          }
        }

        .bang-info {
          width: 100%;
          overflow: hidden;
          display: flex;
          flex-direction: column;
          gap: 2px;

          .bang-title {
            font-size: 16px;
            white-space: nowrap;
            -webkit-mask-image: linear-gradient(to right, #000 90%, #0000);
            mask-image: linear-gradient(to right, #000 90%, #0000);
            font-weight: 500;
          }

          .bang-triggers {
            font-size: 15px;
            color: var(--blue);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }

          .bang-url {
            color: var(--subtext);
            font-size: 13px;
            text-decoration: none;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;

            &:hover {
              text-decoration: underline;
              color: var(--blue);
            }
          }
        }
      }

      .bang-empty {
        grid-column: 1 / -1;
        margin: var(--space-6) auto;
        padding: var(--space-7) var(--space-4);
        max-width: 28rem;
        text-align: center;
        color: var(--muted);
        font-size: 0.95rem;
        line-height: 1.5;
      }

      .poweredBy {
        display: flex;
        align-items: center;
        gap: 6px;
        text-decoration: none;
        color: var(--text);
        margin-top: 12px;
        width: fit-content;
        transition: transform var(--duration-base) var(--ease-spring);

        @media (hover: hover) and (pointer: fine) {
          &:hover {
            transform: scale(1.03);
          }
        }
        &:active {
          transform: scale(0.95);
        }

        svg {
          width: 16px;
          height: 16px;
        }
      }
    }
  }
}

.hidden {
  display: none !important;
}

@keyframes svelte-shimmer {
  0% {
    background-position: calc(-1 * var(--shimmer-size)) 0;
  }
  100% {
    background-position: var(--shimmer-size) 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bangs-page .bang-result,
  .bangs-page .bang-copy,
  .bangs-page .loader svg {
    transition: none !important;
    animation: none !important;
  }

  .bangs-page .bang-result:active,
  .bangs-page .bang-copy:active {
    transform: none !important;
  }
}
