/* Title font */
@font-face {
  font-family: "Montserrat";
  src: url("./Assets/fonts/Montserrat.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
  font-style: normal;
}

/* Body font */
@font-face {
  font-family: "OpenSans";
  src: url("./Assets/fonts/OpenSans.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
  font-style: normal;
}

:root {
  --title-font: "Montserrat", Arial, sans-serif;
  --body-font: "OpenSans", Arial, sans-serif;
  --fluid: calc(0.5vw + 12px); /* Base font size based on viewport width */
  --horizontal-padding: clamp(40px, 6vw, 100px); /* Responsive horizontal padding */
  --custom-separator: linear-gradient(to right, transparent, #6a6a6a 50%, transparent) 1;
  --color-text: #ffffff; /* Body text */
  --secondary-color-text: #ededed; /* Headings */
  --color-accent: rgb(126, 255, 246); /* Highlighter */
  --color-hover: rgb(255, 239, 138); /* Subtle hover effects */
}

* {
  box-sizing: border-box;

  body,
  html {
    margin: 0;
    padding: 0;
  }
}

/* Scroll behavior and base font responsiveness */
html {
  font-size: clamp(14px, var(--fluid), 16px);
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;

  section,
  footer {
    scroll-snap-align: center;
  }
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: rgb(0, 0, 0);
}

/* Section separator */
div.line-separation {
  width: 85%;
  margin: 0 auto;
  border: 0.05rem solid;
  border-image: var(--custom-separator);
}

/* Font styling */
header,
section :is(.intro > *, .projects h2, .projects h3),
footer h2 {
  font-family: var(--title-font);
  letter-spacing: 0.5px;
}

section.about .description p,
section.projects article.card p,
footer div.footer-info p {
  font-family: var(--body-font);
  line-height: 1.5;
}

section :is(h2.title-role, .project-header h3) {
  color: var(--color-accent);
}

section.about :is(h1.title-name, .description),
p,
p > a {
  color: var(--color-text);
}

header :is(.logo, nav ul li > a),
h2:not(.title-role) {
  color: var(--secondary-color-text);
}

/* HEADER SECTION */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px clamp(20px, 6vw, 100px);
  position: sticky;
  z-index: 99999;
  top: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 10px rgba(21, 21, 21, 0.9);
}

header div.logo {
  font-size: 2.3rem;
  display: flex;
  gap: 8px;

  span {
    align-self: center;
    width: 0.2rem;
    height: 2.3rem;
    background: rgba(224, 224, 224, 0.65);
    animation: 1s CaretBlink infinite step-end;
  }
}

@keyframes CaretBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

header nav > ul {
  display: flex;
  gap: clamp(25px, 4vw, 45px);
  margin: 0;
  padding: 0;

  li {
    list-style-type: none;

    a {
      font-size: 1.1rem;
      padding: 5px 0;
      text-decoration: none;
      opacity: 1;
      transition: opacity 0.2s ease;
    }
  }
}

header ul:hover > li a {
  border-bottom: 2px solid transparent;
  opacity: 0.5;
}

header ul > li a:hover {
  border-bottom: 2px solid var(--color-hover);
  opacity: 1;
}

/* ABOUT SECTION */
section.about {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 90px var(--horizontal-padding);
  gap: 70px;

  background-image: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.1) 90%, rgba(0, 0, 0, 1)),
    linear-gradient(to left, transparent, rgba(0, 0, 0, 0.1) 90%, rgba(0, 0, 0, 1)),
    linear-gradient(to top, transparent, rgba(0, 0, 0, 0.1) 70%, rgba(0, 0, 0, 1)), url("Assets/img/black2.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Profile pic  */
.left-section {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;

  img {
    width: clamp(250px, 40vw, 500px);
    padding: clamp(8px, 1.5vw, 16px);
    aspect-ratio: 1 / 1;
    object-fit: cover;
    filter: brightness(0.9) contrast(1.05);
    border-radius: 50%;
    backdrop-filter: blur(0.5px);
    --webkit-backdrop-filter: blur(0.5px);
  }
}

/* Avi custom border */
.left-section::before,
.left-section::after {
  box-sizing: border-box;
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  left: 0;
  bottom: 0;
  border-radius: 50%;
  border: 1px solid transparent;
  box-shadow: 0 0 14px rgba(46, 207, 255, 0.28);
}

/* Intro content */
.right-section {
  max-width: 650px;

  .intro {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
  }

  h1,
  h2,
  p.greeting {
    margin: 0;
  }

  p.greeting {
    font-size: 1.6rem;
    color: #c9c9c9;
  }

  h1.title-name {
    font-size: 3.5rem;
  }

  h2.title-role {
    font-size: 1.9rem;
  }

  .description p {
    font-size: 1.1rem;
  }
}

/* Intro  + Footer socials */
.socials {
  display: flex;
  width: fit-content;
  gap: clamp(10px, 4vw, 15px);
  border-radius: 8px;
  background-color: #7070702f;

  a {
    text-decoration: none;
    padding: clamp(4px, 0.5vw, 6px);
    border-radius: inherit;
    will-change: box-shadow, background-color;
    transition: box-shadow 0.3s ease, background-color 0.3s ease, transform 0.3s;

    img {
      vertical-align: middle;
      width: clamp(22px, 2vw, 26px);
    }
  }

  a:hover {
    box-shadow: 0 0 0 1px var(--color-hover);
    background-color: rgb(0, 0, 0);
  }

  a:active {
    transform: scale(1.1);
  }
}

/* MY WORK SECTION */
section.projects {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-auto-rows: max-content;
  column-gap: 75px;
  row-gap: clamp(60px, 4vw, 90px);
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(50px, 7vw, 90px) var(--horizontal-padding);

  background-image: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.1) 90%, rgba(0, 0, 0, 1)),
    linear-gradient(to left, transparent, rgba(0, 0, 0, 0.1) 90%, rgba(0, 0, 0, 1)),
    linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1) 90%, rgba(0, 0, 0, 1)),
    linear-gradient(to top, transparent, rgba(0, 0, 0, 0.1) 90%, rgba(0, 0, 0, 1)), url("Assets/img/black.webp");
  background-size: cover;
  background-repeat: no-repeat;
}

section.projects h2 {
  font-size: 1.75rem;
  grid-column: 1 / -1;
  width: max-content;
  margin-bottom: calc((clamp(30px, 3vw, 60px)) * -0.5);
  line-height: 1.4;
  border-bottom: 1px solid var(--secondary-color-text);
}

article.card {
  aspect-ratio: 4/3;
  display: flex;
  flex-direction: column;
  box-shadow: rgb(0, 0, 0) 0px 0px 15px 8px;
  border-radius: 35px;
  cursor: default;

  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: transform 0.3s ease-out;
  will-change: box-shadow;
}

article.card:hover {
  transform: scale(1.05);
  box-shadow: -3px 0 0 -1px var(--color-accent);
}

article.card .img-wrapper {
  position: relative;
  width: 100%;

  img {
    object-fit: contain;
    object-position: center;
    width: inherit;
    border-top-right-radius: 35px;
    border-top-left-radius: 35px;
  }
}

article.card .img-wrapper::after {
  position: absolute;
  top: 0;
  width: 100%;
  box-shadow: inset 0 -20px 20px -15px rgba(0, 0, 0, 0.8);
  content: "";
  display: block;
  height: 100%;
}

article.card .project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid;
  border-image: linear-gradient(to right, #797979 30%, transparent 80%) 100% 1;

  h3 {
    font-size: 1.3rem;
  }
}

.project-links {
  display: flex;
  align-items: center;
  gap: 15px;

  a {
    transition: transform 0.3s ease;
  }

  a:hover {
    transform: scale(1.25);
  }

  a:active {
    transform: scale(1.4);
  }

  /* Github project link */
  :nth-child(1) > img {
    width: 20px;
  }

  /* Preview project link */
  :nth-child(2) > img {
    width: 25px;
  }
}

article.card p {
  font-size: 1rem;
  padding: 2px 20px;
}

/* FOOTER SECTION */
footer {
  min-height: 50vh;
  min-height: 50dvh;
  position: relative;
  display: flex;
  justify-content: center;
  gap: clamp(80px, 10vw, 150px);
  padding: 90px var(--horizontal-padding);
  max-width: 1400px;
  margin: 0 auto;

  background-image: linear-gradient(to top, transparent, rgba(0, 0, 0, 0.9) 90%, rgba(0, 0, 0, 1)),
    url("Assets/img/black2.webp");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;

  .footer-info {
    display: flex;
    flex-direction: column;
    gap: 30px;

    h2 {
      font-size: 1.75rem;
      margin: 0;
      border-bottom: 1px solid var(--secondary-color-text);
      width: fit-content;
      line-height: 1.4;

      ~ p {
        font-size: 1.1rem;
        margin: 0;
      }
    }
  }
}

footer p.contact a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

footer p.contact a:hover {
  color: var(--color-hover);
}

footer p.contact a > img {
  width: 22px;
  display: block;
  object-fit: contain;
}

footer .footer-img {
  max-width: 600px;
  align-self: center;

  img {
    object-fit: contain;
    object-position: center;
    width: 100%;

    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent),
      linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    mask-composite: intersect;
    -webkit-mask-composite: source-in;
    filter: brightness(80%) contrast(110%);
  }
}

/* Tablet + Mobile design and responsiveness */
@media (max-width: 768px) {
  * {
    -webkit-tap-highlight-color: transparent;
  }

  html,
  body {
    scroll-snap-type: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    touch-action: pan-x pan-y;
  }

  header {
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  section.about {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 30px;

    background-size: cover;
    background-position: center;
    overflow: hidden;

    .socials.about {
      margin: 0 auto;
    }
  }

  /* Background image */
  section.about::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 0;
  }

  section.about > * {
    position: relative;
    z-index: 1;
  }

  a {
    touch-action: manipulation;
  }
}

@media (max-width: 480px) {
  header div.logo {
    display: none;
  }

  header nav {
    margin: 0 auto;
  }

  section.about .right-section {
    display: flex;
    flex-direction: column;
    gap: 5px;

    .description p {
      display: none;
    }
  }

  footer {
    display: flex;
    align-items: center;

    .footer-info {
      text-align: center;

      h2,
      .socials.footer {
        margin: 0 auto;
      }
    }

    .footer-img {
      display: none;
    }
  }
}

@media (hover: none) {
  header ul > li a:focus {
    border-bottom: 2px solid var(--color-hover);
    opacity: 1;
    outline: none;
  }
  .socials a:focus {
    box-shadow: 0 0 0 1px var(--color-hover);
    background-color: rgb(0, 0, 0);
    outline: none;
  }

  article.card:hover {
    transform: none;
    box-shadow: -3px 0 0 -1px var(--color-accent);
    outline: none;
  }
}
