/* Reset e variáveis CSS */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --text-color: #f8fafc;
  --bg-url: url(./assets/bg-mobile.jpg);
  --stroke-color: rgba(255, 255, 255, 0.2);
  --surface-color: rgba(255, 255, 255, 0.05);
  --surface-color-hover: rgba(255, 255, 255, 0.1);
  --highlight-color: rgba(255, 255, 255, 0.2);
  --switch-bg-url: url(./assets/moon-stars.svg);
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.light {
  --text-color: #1e293b;
  --bg-url: url(./assets/bg-mobile-light.jpg);
  --stroke-color: rgba(0, 0, 0, 0.1);
  --surface-color: rgba(0, 0, 0, 0.05);
  --surface-color-hover: rgba(0, 0, 0, 0.08);
  --highlight-color: rgba(0, 0, 0, 0.1);
  --switch-bg-url: url(./assets/sun.svg);
  --gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* CSS Nesting - Aplicado em todo o código */
body {
  background: var(--bg-url) no-repeat top center/cover;
  height: 100vh;
  font-family: "Inter", sans-serif;
  transition: background 0.5s ease;

  & * {
    color: var(--text-color);
    font-family: "Inter", sans-serif;
  }
}

#container {
  width: 100%;
  max-width: 588px;
  margin: 56px auto 0px;
  padding: 0 24px;

  /* CSS Nesting para elementos internos */
  & header {
    text-align: center;
    margin-bottom: 2rem;

    & #profile {
      padding: 24px;

      & img {
        width: 112px;
        height: 112px;
        border-radius: 50%;
        object-fit: cover;
        border: 3px solid transparent;
        background: var(--gradient) padding-box,
                    var(--gradient) border-box;
        box-shadow: var(--shadow);
        transition: var(--transition);

        &:hover {
          transform: scale(1.05);
        }
      }

      & h1 {
        font-weight: 700;
        font-size: 1.5rem;
        margin-top: 1rem;
        background: var(--gradient);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
      }

      & p {
        font-weight: 400;
        opacity: 0.8;
        margin-top: 0.5rem;
      }
    }

    & #switch {
      position: relative;
      width: 64px;
      margin: 1rem auto;

      & button {
        width: 32px;
        height: 32px;
        background: white var(--switch-bg-url) no-repeat center;
        border: none;
        border-radius: 50%;
        position: absolute;
        top: 50%;
        left: 0;
        z-index: 1;
        transform: translateY(-50%);
        cursor: pointer;
        animation: slide-back 0.3s;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        transition: var(--transition);

        &:hover {
          transform: translateY(-50%) scale(1.1);
        }
      }

      & span {
        display: block;
        width: 64px;
        height: 24px;
        background: var(--surface-color);
        border: 1px solid var(--stroke-color);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border-radius: 9999px;
      }
    }
  }

  & main {
    & ul {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 1rem;
      padding: 24px 0;

      & li {
        & a {
          display: flex;
          align-items: center;
          padding: 1rem 1.5rem;
          background: var(--surface-color);
          border: 1px solid var(--stroke-color);
          border-radius: 12px;
          backdrop-filter: blur(10px);
          -webkit-backdrop-filter: blur(10px);
          text-decoration: none;
          font-weight: 500;
          transition: var(--transition);
          position: relative;
          overflow: hidden;

          /* Efeito de brilho no hover */
          &::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(
              90deg,
              transparent,
              rgba(255, 255, 255, 0.1),
              transparent
            );
            transition: left 0.5s;
          }

          &:hover {
            background: var(--surface-color-hover);
            border: 1px solid var(--text-color);
            transform: translateY(-2px);
            box-shadow: var(--shadow);

            &::before {
              left: 100%;
            }

            & .arrow {
              transform: translateX(4px);
            }
          }

          & .icon {
            font-size: 1.25rem;
            margin-right: 0.75rem;
            flex-shrink: 0;
          }

          & .text {
            flex-grow: 1;
            text-align: left;
          }

          & .arrow {
            transition: transform 0.2s;
          }
        }
      }
    }
  }

  & #social-links {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 0;
    font-size: 1.5rem;

    & a {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0.75rem;
      border-radius: 50%;
      background: var(--surface-color);
      border: 1px solid var(--stroke-color);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      transition: var(--transition);

      &:hover {
        background: var(--surface-color-hover);
        transform: translateY(-3px);
        box-shadow: var(--shadow);
      }
    }
  }

  & footer {
    text-align: center;
    padding: 2rem 0;
    font-size: 0.875rem;
    opacity: 0.7;

    & .heart {
      display: inline-block;
      animation: heartbeat 1.5s ease infinite;
    }
  }
}

/* Animações */
@keyframes slide-in {
  from {
    left: 0;
  }
  to {
    left: 50%;
  }
}

@keyframes slide-back {
  from {
    left: 50%;
  }
  to {
    left: 0;
  }
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
  }
  5% {
    transform: scale(1.1);
  }
  10% {
    transform: scale(1);
  }
  15% {
    transform: scale(1.2);
  }
  50% {
    transform: scale(1);
  }
  100% {
    transform: scale(1);
  }
}

/* Modo claro com CSS Nesting */
.light {
  & #switch button {
    animation: slide-in 0.3s forwards;
  }
}

/* Media Queries com CSS Nesting */
@media (min-width: 700px) {
  :root {
    --bg-url: url(./assets/bg-desktop.jpg);
  }

  .light {
    --bg-url: url(./assets/bg-desktop-light.jpg);
  }

  body {
    & #container {
      & header {
        & #profile {
          & img {
            width: 128px;
            height: 128px;
          }
        }
      }
    }
  }
}

/* Acessibilidade - Foco visível */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--text-color);
  outline-offset: 2px;
}