@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
    scroll-behavior: smooth;
  }

  body,
  h1,
  h2,
  h3,
  h4,
  p,
  figure,
  blockquote,
  dl,
  dd {
    margin: 0;
  }

  [role="list"] {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  body {
    min-block-size: 100vh;
    line-height: 1.6;
  }

  h1,
  h2,
  h3,
  button,
  input,
  label {
    line-height: 1.1;
  }

  h1,
  h2,
  h3,
  h4 {
    text-wrap: balance;
  }

  p,
  li {
    text-wrap: pretty;
  }

  img,
  picture {
    max-inline-size: 100%;
    display: block;
  }

  input,
  button,
  textarea,
  select {
    font: inherit;
  }
}

@layer base {
  :root {
    --clr-yellow: #b58900;
    --clr-orange: #cb4b16;
    --clr-red: #dc322f;
    --clr-magenta: #d33682;
    --clr-violet: #5358a8;
    --clr-blue: #268bd2;
    --clr-cyan: #2aa198;
    --clr-cyan-alpha: #2aa19839;
    --clr-green: #859900;
    --clr-green-alpha: #85990039;

    --ff: "IBM Plex Mono", monospace;
    --fs-300: 0.875rem;
    --fs-400: 1rem;
    --fs-500: 1.125rem;
    --fs-600: 1.25rem;
    --fs-700: 1.5rem;
    --fs-800: 2rem;
    --fs-900: 3.75rem;
    --fs-1000: 3.75rem;

    @media (width > 760px) {
      --fs-300: 0.875rem;
      --fs-400: 1rem;
      --fs-500: 1.25rem;
      --fs-600: 1.5rem;
      --fs-700: 2rem;
      --fs-800: 3rem;
      --fs-900: 5rem;
      --fs-1000: 7.5rem;
    }

    --font-size-heading-sm: var(--fs-700);
    --font-size-heading-regular: var(--fs-800);
    --font-size-heading-lg: var(--fs-900);
    --font-size-heading-xl: var(--fs-1000);

    --font-size-sm: var(--fs-300);
    --font-size-regular: var(--fs-400);
    --font-size-md: var(--fs-500);
    --font-size-lg: var(--fs-600);
  }

  [data-theme="light"] {
    --clr-bg: #fdf6e3;
    --clr-surface: #eee8d5;
    --clr-border: #93a1a1;
    --clr-text: #657b83;
    --clr-bg-reverse: #002b36;
    --clr-surface-reverse: #073642;
    --clr-border-reverse: #586e75;
    --clr-text-reverse: #eee8d5;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.2);
    --clr-bg-alpha: #fdf6e3a3;
  }

  [data-theme="dark"] {
    --clr-bg: #002b36;
    --clr-surface: #073642;
    --clr-border: #586e75;
    --clr-text: #eee8d5;
    --clr-bg-reverse: #fdf6e3;
    --clr-surface-reverse: #eee8d5;
    --clr-border-reverse: #93a1a1;
    --clr-text-reverse: #657b83;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.4);
    --clr-bg-alpha: #002b36a3;
  }

  html {
    font-family: var(--ff);
    line-height: 1.6;
  }

  body {
    font-size: var(--font-size-regular);
    color: var(--clr-text);
    background-color: var(--clr-bg);
  }

  body,
  header,
  main,
  footer,
  a,
  button,
  i,
  li {
    transition: background-color 0.8s ease, color 0.8s ease;
  }

  h1,
  h2,
  h3,
  h4 {
    color: var(--clr-orange);
  }

  h1 {
    font-size: var(--font-size-heading-regular);
  }

  h2 {
    margin-bottom: 1.5rem;
    font-size: var(--font-size-heading-regular);
  }

  a {
    color: var(--clr-green);
  }

  a:hover,
  a:focus-visible {
    color: var(--clr-yellow);
  }
}

@layer components {
  /* SECTION DIVIDER */

  .section-divider {
    border: 0;
    height: 1px;
    background-image: linear-gradient(
      to right,
      transparent,
      var(--clr-border),
      transparent
    );
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.4;
  }

  /*TO TOP BUTTON*/
  .to-top {
    display: none;
    position: fixed;
    bottom: 3.5rem;
    right: 1rem;
    z-index: 99;
    border: none;
    outline: none;
    background-color: var(--clr-red);
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 100%;
    font-size: 18px;
    opacity: 0.5;

    &:hover {
      background-color: var(--clr-magenta);
      opacity: 1;
    }
  }

  @media (width < 760px) {
    .to-top {
      transform: scale(0.8);
    }
  }

  /* HEADER */
  .header {
    padding: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--clr-bg);
    z-index: 100;
    box-shadow: var(--shadow);
  }

  .header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;

    .header__inner-wrapper {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 3rem;
    }

    a {
      text-decoration: none;
    }

    .header__logo {
      font-weight: 700;
      font-size: var(--font-size-heading-regular);
      color: var(--clr-orange);
    }

    /* NAVIGATION MENU*/
    ul {
      display: flex;
      justify-content: space-between;
      gap: 1.5rem;
      list-style: none;
      font-weight: 500;
      font-size: var(--font-size-lg);

      li a {
        position: relative;

        &::before {
          position: absolute;
          display: block;
          content: "";
          width: 0;
          right: 0;
          height: 3px;
          bottom: -0.3rem;
          background-color: var(--clr-blue);
          transition: width ease-in-out 0.5s;
          pointer-events: none;
        }

        &:hover::before {
          width: 100%;
          left: 0;
          background-color: var(--clr-blue);
          transition: width ease-in-out 0.5s;
        }
      }
    }

    @media (width < 900px) {
      .header__logo {
        font-size: var(--font-size-heading-sm);
      }
      ul {
        font-size: var(--font-size-md);
      }
    }

    @media (width < 875px) {
      .header__nav {
        position: absolute;
        top: var(--font-size-heading-lg);
        left: 0;
        right: 0;
        height: 100vh;
        background-color: var(--clr-bg);
        transform: translateX(100%);
        transition: transform 0.5s 0.5s ease-in-out;

        overflow: auto;

        ul {
          margin-top: 3rem;
          flex-direction: column;
          text-align: center;
        }

        &.active {
          display: flex;
          justify-content: center;
          align-items: flex-start;
          transform: translate(0, 0);
        }
      }
    }

    /*BURGER MENU*/
    .header__burger-menu {
      display: none;
      position: relative;
      width: 24px;
      height: 22px;

      cursor: pointer;

      span {
        position: absolute;
        top: 50%;
        transform: translate(6px, -50%);
        width: 12px;
        height: 2px;
        background-color: var(--clr-border);
      }

      &::before,
      &::after {
        position: absolute;
        content: "";
        width: 24px;
        height: 2px;
        background-color: var(--clr-border);
        transition: top 0.1s 0.2s ease, bottom 0.1s 0.2s ease,
          transform 0.1s ease;
      }

      &::before {
        top: 0;
        left: 0;
      }

      &::after {
        bottom: 0;
        left: 0;
      }

      &.clicked::before {
        top: 10px;
        transform: rotate(45deg);
        transition: top 0.3s ease, transform 0.3s 0.3s ease;
      }

      &.clicked::after {
        bottom: 10px;
        transform: rotate(-45deg);
        transition: bottom 0.3s ease, transform 0.3s 0.3s ease;
      }

      &.clicked span {
        display: none;
      }
    }

    @media (width < 875px) {
      .header__burger-menu {
        display: block;
      }
    }

    /*THEME TOGGLE BUTTON*/

    .theme-toggle-btn {
      color: var(--clr-bg-reverse);
      font-size: var(--font-size-heading-sm);
      cursor: pointer;
      transition: transform 0.3s;
    }

    .theme-toggle-btn:hover {
      transform: scale(1.1);
    }
  }

  /* SECTION ABOUT */
  .about {
    margin: 100px auto 0 auto;
    text-align: center;

    .about__icons-mobile {
      display: none;
    }

    .about__img-icons {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto;
      width: 300px;
      height: 300px;

      .img-container {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 200px;
        height: 200px;
        border-radius: 50%;
        transform: translate(-50%, -50%);
        background-color: #dcd1c3;

        img {
          width: 100%;
          height: 100%;
          border-radius: 50%;
          object-fit: contain;
        }
      }
    }

    h2 {
      margin-block: 1.5rem;
      color: var(--clr-text);
      font-weight: 500;
      font-size: var(--font-size-heading-sm);
      span {
        color: var(--clr-orange);
        font-weight: 600;
      }
    }

    h1 {
      margin-block: 0.67em;
      color: var(--clr-text);
    }

    .about__icon-link {
      width: 3rem;
      height: 3rem;
      border-radius: 50%;
      text-decoration: none;

      display: flex;
      justify-content: center;
      align-items: center;
      transition: transform 0.3s ease;

      i {
        font-size: 1.5rem;
      }

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

    .about__contact-and-cv {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 1rem;
    }
    .icon-animated {
      position: absolute;
      transform-origin: center center;
    }

    .icon-animated.linkedin-animated {
      animation: rotate 60s infinite linear;
    }

    .icon-animated.git-animated {
      animation: rotate-reverse 60s infinite linear;
    }

    a.about__linkedin-link {
      background-color: var(--clr-green-alpha);

      i {
        color: var(--clr-green);
      }
    }

    a.about__github-link {
      background-color: var(--clr-cyan-alpha);

      i {
        color: var(--clr-cyan);
      }
    }

    .about__contact-button {
      background-color: var(--clr-orange);
      a {
        color: var(--clr-surface);
        text-decoration: none;
      }
    }

    .about__download-button {
      background-color: var(--clr-surface-reverse);
    }
  }

  @keyframes rotate {
    0% {
      transform: rotate(0deg) translateX(140px) rotate(0deg);
    }
    100% {
      transform: rotate(360deg) translateX(140px) rotate(-360deg);
    }
  }
  @keyframes rotate-reverse {
    0% {
      transform: rotate(0deg) translateX(-140px) rotate(0deg);
    }
    100% {
      transform: rotate(360deg) translateX(-140px) rotate(-360deg);
    }
  }

  @media (width < 760px) {
    .about {
      padding-block: 1rem;
      .about__img-icons {
        width: 200px;
        height: 200px;

        img {
          width: 150px;
          height: 150px;
        }
      }

      h2 {
        margin-block: 1rem;
      }
    }

    .icon-animated {
      display: none;
    }

    .about .about__icons-mobile {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 1rem;
      margin-block: 1rem;

      a:hover {
        transform: none;
      }
    }
  }

  .about__introduction {
    margin-block: 2rem;
    text-align: left;

    & > p:not(:last-child) {
      margin-bottom: 1rem;
    }
  }

  /*SKILLS SECTION*/
  .skills {
    .skills__inner {
      padding: 1.5rem 1rem;
      width: 100%;
      border-radius: 20px;
      background-color: var(--clr-green-alpha);

      h2 {
        text-align: left;
      }

      .skills__tech-stack {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 2rem;

        h3 {
          margin-bottom: 1rem;
        }

        .skills-list {
          list-style: none;
          padding: 0;
          display: flex;
          flex-direction: column;
          gap: 0.5rem;

          li {
            background-color: var(--clr-surface-reverse);
            padding: 0.5rem;
            border-radius: 0.75rem;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
            font-size: var(--font-size-regular);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--clr-text-reverse);

            i {
              font-size: 1.5rem;
              color: var(--clr-red);
            }
          }
        }
      }
    }
  }

  /*PROJECTS SECTION*/
  .projects__inner {
    & > * + * {
      margin-top: 2rem;
    }

    .projects__item {
      display: flex;
      justify-content: flex-end;
      margin-left: auto;

      width: 80%;
      min-height: 400px;
      border-radius: 10px;
      padding: 2rem;

      img {
        display: none;
      }

      .item__content {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        text-align: right;
        max-width: 70%;
        padding: 2rem;
        border-radius: 10px;
        background-color: var(--clr-bg-alpha);

        & > * + * {
          margin-top: 1rem;
        }

        .content__technologies-text {
          color: var(--clr-text);
        }

        .content__button {
          background-color: var(--clr-blue);
        }
      }

      &:nth-of-type(2n) {
        justify-content: flex-start;
        margin-left: 0;

        .item__content {
          text-align: left;
          align-items: flex-start;
          a {
            align-self: flex-start;
          }
        }
      }
    }
  }

  @media (width > 600px) {
    .projects__item {
      position: relative;
      z-index: 0;

      .item__content {
        display: flex;
        flex-direction: column;
        justify-content: space-between;

        a {
          align-self: flex-end;
        }
      }

      &::before {
        content: "";
        position: absolute;
        inset: 0;
        background-size: cover;
        background-position: center;
        opacity: 0.3;
        z-index: -1;
        border-radius: 10px;
      }

      &.projects__item--1::before {
        background-image: url("assets/main_screen_fittrack.webp");
      }

      &.projects__item--2::before {
        background-image: url("assets/main_screen_portfolio.webp");
      }
    }
  }

  @media (width <= 600px) {
    .projects__inner {
      display: grid;
      grid-template-columns: 1fr;

      .projects__item {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;

        padding: 0;
        border: none;

        img {
          display: block;
          width: 100%;
          height: 240px;
          object-fit: contain;
          border-radius: 20px;
        }

        .item__content {
          width: 100%;
          max-width: 100%;
          text-align: left;
          background-color: transparent;
        }
      }
    }
  }

  /*LANGUAGES SECTION*/
  .languages__heading {
    h2 {
      margin-bottom: 0;
    }

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

  .languages__list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 28px;
    grid-template-rows: repeat(2, auto);
    margin-top: 1rem;
    justify-items: center;

    dt {
      grid-row: 1/2;
      font-weight: 600;
      font-size: var(--font-size-heading-sm);
    }

    dd {
      grid-row: 2/2;
      text-align: center;
    }
  }

  /*FOOOTER*/
  .footer {
    margin-block: 5rem 2rem;
    .footer__inner {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
  }
}

@layer shared {
  .hidden {
    display: none;
  }
  section {
    padding-block: 2rem;
    scroll-margin-top: 5rem;
  }
  .visible {
    display: inline-block;
  }

  .preserve-whitespace {
    white-space: pre-wrap;
  }

  .fade-away {
    opacity: 0;
    transition: opacity 1s ease;
  }

  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding-inline: 1rem;

    &[data-width="large"] {
      max-width: 1350px;
    }
  }

  .no-scrolling {
    overflow: hidden;
  }

  .tag {
    color: var(--clr-green);
  }

  .button {
    display: inline-block;
    text-decoration: none;
    position: relative;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    color: var(--clr-surface);
    transition: all 0.3s ease;
    overflow: hidden;

    &::before {
      content: "";
      position: absolute;
      width: 100%;
      height: 100%;
      background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
      );
      top: -100%;
      left: -100%;
      transition: all 0.5s ease;
    }

    &:hover::before {
      top: 100%;
      left: 100%;
    }

    &.pointer:hover {
      transform: scale(1.05);
      box-shadow: 0 0 5px var(--clr-bg-reverse);
    }
  }
}
