@use 'abstracts';

@keyframes card-fade-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.projects {
  padding-block: calc(var(--space-4) * 2);
  background-color: var(--bg-muted);

  &__wrapper {
    @include abstracts.container-wrapper;
    width: 100%;
  }

  &__header {
    text-align: center;
    margin-bottom: calc(var(--space-4) * 1.5);

    h2 {
      font-size: var(--font-size-xl);
      margin-bottom: var(--space-2);
    }

    p {
      font-size: var(--font-size-lg);
    }
  }

  &__label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: var(--space-2);
  }

  &__card-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);

    @include abstracts.breakpoint('md') {
      grid-template-columns: repeat(3, 1fr);
    }
  }

  &__card {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.3s ease;

    animation: card-fade-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) var(--delay, 0ms) both;

    &:hover {
      transform: translateY(-6px);
      box-shadow: 0 20px 50px oklch(0% 0 0 / 0.12);
    }
  }

  &__card-image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      transition: transform 0.4s ease;
    }

    .projects__card:hover & img {
      transform: scale(1.05);
    }
  }

  &__card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      to top,
      oklch(0% 0 0 / 0.4) 0%,
      transparent 50%
    );
    pointer-events: none;
  }

  &__card-content {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  &__card-branch {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
  }

  &__card-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-main);
  }

  &__card-description {
    font-size: var(--font-size-base);
    color: var(--text-muted);
    line-height: 1.6;
  }

  &__card-features {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: var(--space-1);
  }

  &__tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, oklch(from var(--accent) l c h / 0.12) 0%, oklch(from var(--accent) l c h / 0.08) 100%);
    color: var(--accent);
  }

  &__card-result {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--accent);

    svg {
      flex-shrink: 0;
    }
  }

  &__card-cta {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: var(--space-2);
    transition: gap 0.2s ease;

    .projects__card:hover & {
      gap: var(--space-2);
    }
  }
}
