@use '../globals';
@use '../variables' as *;
@use '../mixins' as *;

.about-section {
  background: var(--about-background);
  position: relative;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(
      90deg,
      transparent 0%,
      var(--color-primary) 30%,
      var(--color-secondary) 70%,
      transparent 100%
    );
  }

  &__container {
    @include section-container;
  }

  &__header {
    @include section-header;
  }

  &__title {
    @include section-title;
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 800;
  }

  &__subtitle {
    @include section-subtitle;
  }

  &__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    margin-bottom: 4rem;

    @include globals.desktop-only {
      flex-direction: row;
      align-items: center;
    }
  }

  &__image-wrapper {
    flex-shrink: 0;
    position: relative;
  }

  &__image {
    width: 16rem;
    height: 21rem;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 4px solid var(--color-background);
  }

  &__image-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--gradient-image-overlay);
  }

  &__pixel-bg {
    position: absolute;
    inset: 0 0 0 -35px;
    background-color: #dbeafe;
    opacity: 1;
    transition: opacity 1.2s ease-in-out;
    will-change: opacity;
    pointer-events: none;

    [data-theme='dark'] & {
      background-color: #1e3a8a;
    }

    &--fade {
      opacity: 0;
    }

    @media (prefers-reduced-motion: reduce) {
      display: none;
    }
  }

  &__pixel-overlay {
    position: absolute;
    inset: 0 0 0 -35px;
    width: calc(100% + 35px);
    height: 100%;
    object-fit: cover;
    object-position: calc(30%) 50%;
    border: 4px solid var(--color-background);
    opacity: 1;
    transition: opacity 1.2s ease-in-out;
    will-change: opacity;
    pointer-events: none;

    &--fade {
      opacity: 0;
    }

    @media (prefers-reduced-motion: reduce) {
      display: none;
    }
  }

  &__bio-section {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;

    @include globals.desktop-only {
      text-align: left;
    }
  }

  &__bio-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  &__greeting {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: $color-heading;
  }

  &__bio-text {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    line-height: 1.625;

    p {
      margin-bottom: 1.5rem;

      &:last-child {
        margin-bottom: 0;
      }
    }
  }

  &__skill-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;

    @include globals.desktop-only {
      justify-content: flex-start;
    }
  }

  &__skill-badge {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: $transition-base;

    &:hover {
      transform: translateY(-2px) scale(1.05);
      box-shadow: var(--shadow-glow);
    }

    &--primary {
      background: var(--skill-badge-primary-bg);
      color: var(--skill-badge-primary-text);
    }

    &--secondary {
      background: var(--skill-badge-secondary-bg);
      color: var(--skill-badge-secondary-text);
    }

    &--tertiary {
      background: var(--skill-badge-tertiary-bg);
      color: var(--skill-badge-tertiary-text);
    }

    &--quaternary {
      background: var(--skill-badge-quaternary-bg);
      color: var(--skill-badge-quaternary-text);
    }
  }

  &__features {
    margin-top: 4rem;
  }

  &__features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;

    @media (min-width: 768px) and (max-width: 1199px) {
      grid-template-columns: repeat(2, 1fr);
    }

    @media (min-width: 1200px) {
      grid-template-columns: repeat(4, 1fr);
    }
  }

  &__feature-card {
    text-align: center;
    border: none;
    border-radius: $card-border-radius-sm;
    box-shadow: $shadow-card-lg;
    transition: var(--transition-slow);
    overflow: hidden;
    padding: 0;
    position: relative;

    &:hover {
      box-shadow: var(--shadow-glow-hover);
      transform: translateY(-4px) scale(1.02);
    }

    // Enhanced focus state for accessibility
    &:focus {
      outline: 3px solid var(--color-focus-ring, #2563eb);
      outline-offset: 2px;
      transform: translateY(-2px);
    }

    &--primary {
      background: var(--feature-card-primary-bg);
    }

    &--secondary {
      background: var(--feature-card-secondary-bg);
    }

    &--tertiary {
      background: var(--feature-card-tertiary-bg);
    }

    &--quaternary {
      background: var(--feature-card-quaternary-bg);
    }
  }

  &__feature-header {
    padding: $card-padding-lg;
  }

  &__feature-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem auto;

    &--primary {
      color: var(--feature-icon-primary);
    }

    &--secondary {
      color: var(--feature-icon-secondary);
    }

    &--tertiary {
      color: var(--feature-icon-tertiary);
    }

    &--quaternary {
      color: var(--feature-icon-quaternary);
    }
  }

  &__feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;

    &--primary {
      color: var(--feature-title-primary);
    }

    &--secondary {
      color: var(--feature-title-secondary);
    }

    &--tertiary {
      color: var(--feature-title-tertiary);
    }

    &--quaternary {
      color: var(--feature-title-quaternary);
    }
  }

  &__feature-content {
    padding: 0 1.5rem 1.5rem 1.5rem;
  }

  &__feature-description {
    margin: 0;

    &--primary {
      color: var(--feature-description-primary);
    }

    &--secondary {
      color: var(--feature-description-secondary);
    }

    &--tertiary {
      color: var(--feature-description-tertiary);
    }

    &--quaternary {
      color: var(--feature-description-quaternary);
    }
  }
}

// Mobile responsiveness
@include globals.mobile-only {
  .about-section {
    padding: $section-padding-y 0;

    &__container {
      padding: 0 1rem;
    }

    &__image {
      width: 12rem;
      height: 12rem;
    }

    &__title {
      font-size: 1.5rem;
    }

    &__subtitle {
      font-size: 1rem;
    }

    &__bio-text {
      font-size: 1rem;

      p {
        margin-bottom: 1.25rem;

        &:last-child {
          margin-bottom: 0;
        }
      }
    }

    &__greeting {
      font-size: 1.25rem;
    }
  }
}
