/* GLOBAL */

:root {
  /* color variables */
  --bg-body: hsl(0, 0%, 8%);
  --bg-contact: hsl(0, 0%, 14%);
  --accent: hsl(153, 71%, 59%);
  --text-1: hsl(0, 0%, 100%);
  --text-2: hsl(0, 0%, 85%);
  --invalid: hsl(7, 100%, 68%);
  /* font-size variables x/16 = y rem */
  --fs-18: 1.125rem;
  --fs-88: 5.5rem;
  --fs-72: 4.5rem;
  --fs-40: 2.5rem;
  --fs-48: 3rem;
  --fs-36: 2.25rem;
  --fs-32: 2rem;
  --fs-24: 1.5rem;
  --fs-20: 1.25rem;
  --container: 69.375rem; /* 1110px / 16px */
  --transition: 250ms ease-in-out;
}

/* preventing elements sticking out the viewport */
html,
body {
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
  box-sizing: border-box;
  font-size: 100%;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body,
input,
textarea,
button {
  font-family: "Space Grotesk", sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-body);
  color: var(--text-1);
  font-size: var(--fs-18);
  /* 28/18=1.56 */
  line-height: 1.56;
  /* overflow: hidden */
}

h1,
h2,
h3,
p {
  margin: 0;
}

p {
  /* Using online fluid typography calculator https://royalfig.github.io/fluid-typography-calculator/ to set up clamp function 
  min font size - 16px, max font size - 18px, min viewport - 375px, max viewport - 600px, viewport range is when the font-size change
  clamp function is handy not to write media queries just for fonts */
  font-size: 1rem;
  font-size: clamp(1rem, 0.79rem + 0.89vw, 1.125rem);
  color: var(--text-2);
  line-height: 1.5;
}

/* color transition to a link */
a {
  transition: color var(--transition);
  color: var(--text-1);
}

a.underline,
button {
  font-size: 1rem;
  line-height: 1.625;
  letter-spacing: 0.143em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-1);
  text-decoration: none;
  /* underline */
  background-image: linear-gradient(
    to right,
    var(--accent) 75%,
    var(--accent) 75%
  );
  background-position: 0 2.1em;
  background-repeat: repeat-x;
  background-size: 8px 2px;
  /* adjusting line under 'CONTACT ME' */
  /* in order the line to show up so low, we need to display: inline-block; to make padding padding work */
  display: inline-block;
  padding-bottom: 10px;
}

a:hover,
button:hover {
  color: var(--accent);
  cursor: pointer;
}

/* giving a focus a visibility for keyboard users and padding */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  /* and padding */
  outline-offset: 2px;
}

i {
  font-size: 3.5rem;
  color: white;
  margin-bottom: 10px;
}

.wrapper {
  /* calc(100% - 2rem) is the width of this wrapper for mobile view as 1 rem (16px) is the space between wrapper and viewport edge on each side */
  width: calc(100% - 2rem);
  /* we use 'rem' instead of pixels because it's more accessible when user change the browser's base font size (16px) */
  max-width: var(--container); /* 1110px */
  /* centering on larger viewport widths */
  margin: 0 auto;
}

/* TABLET view - 600px */
@media screen and (min-width: 37.5em) {
  .wrapper {
    /* calc(100% - 3.75rem) is the width of this wrapper for tablet view as 1,875 rem (30/16) is the space between wrapper and viewport edge on each side */
    width: calc(100% - 3.75rem);
  }
}

img,
svg {
  display: block;
}

.projects__picture > img {
  object-fit: contain;
}

/* HEADER */
/* MOBILE view */
.header {
  margin-top: 20px;
}

.header__nav {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  left: 50%;
  z-index: 1;
}

.header__home {
  /* Using online fluid typography calculator https://royalfig.github.io/fluid-typography-calculator/ to set up clamp function 
  min font size - 24px, max font size - 32px, min viewport - 375px, max viewport - 768px 
  clam function is handy not to write media queries just for fonts */
  font-size: 1.5rem;
  font-size: clamp(1.5rem, 1.02rem + 2.04vw, 2rem);
  color: var(--text-1);
  text-decoration: none;
  line-height: 1;
}

.header__social_wrapper {
  display: flex;
  gap: 25px;
  align-items: center;
  /* getting rid of descenders (that gives an extra space underneath a tags) by font-size: 0 */
  font-size: 0;
}

.header__social {
  display: inline-block;
}

/* color transition to SVG */
.header__social > svg > path {
  transition: fill var(--transition);
}

/* hover effect on SVG using path attribute */
.header__social:hover > svg > path {
  fill: var(--accent);
}

/* making Accessibility span invisible but accessible for screen readers */
.visually-hidden {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* TABLET view - 600px */
@media screen and (min-width: 37.5em) {
  .header {
    margin-top: 30px;
  }
  .header__nav {
    flex-direction: row;
    justify-content: space-between;
  }
  .header__social_wrapper {
    gap: 32px;
  }
}

/* DESKTOP view */
@media screen and (min-width: 62.5em) {
  .header {
    margin-top: 40px;
  }
  .header__social_wrapper {
    margin-right: 32px;
  }
  footer .header__social_wrapper {
    margin-right: 0px;
  }
}

/* HERO */
/* MOBILE view*/
.hero {
  position: relative;
}

.hero__wrapper {
  padding-bottom: 80px;
  border-bottom: 1px solid var(--text-2);
}

.hero__img {
  width: 174px;
  margin: 0 auto;
  padding-top: 100px;
  /* background: rgb(20, 20, 20);
  background: linear-gradient(
    180deg,
    rgba(20, 20, 20, 1) 18%,
    rgba(116, 116, 116, 1) 100%
  ); */
}

.hero__img img {
  width: 100%;
  font-size: 0;
  position: relative;
  z-index: 2;
}

.hero__text {
  text-align: center;
}

.hero__headline {
  margin: 24px 0;
  /* Using online fluid typography calculator https://royalfig.github.io/fluid-typography-calculator/ to set up clamp function 
  min font size - 40px, max font size - 88px, min viewport - 375px, max viewport - 1000px 
  clam function is handy not to write media queries just for fonts */
  font-size: 2.5rem;
  font-size: clamp(2.5rem, 0.7rem + 7.68vw, 5.5rem);
  line-height: 1.15;
}

.br-visible {
  display: none;
}

/* green underline under Janis Karasa */
.hero__text > h1 > span {
  background-image: linear-gradient(
    to right,
    var(--accent) 75%,
    var(--accent) 75%
  );
  background-position: 0 1.1em;
  background-repeat: repeat-x;
  background-size: 8px 4px;
}

.hero__description {
  margin-bottom: 24px;
}

/* HERO RINGS and CIRCLE */
.hero__rings {
  position: absolute;
  top: 90px;
  right: 50%;
  z-index: 1;
}

.hero__circle {
  position: absolute;
  top: 204px;
  right: 0;
  transform: translateX(50%);
  opacity: 40%;
}

/* TABLET view - 600px */
@media screen and (min-width: 37.5em) {
  .hero__wrapper {
    padding-bottom: 60px;
  }
  .hero__img {
    z-index: -1;
    width: 322px;
    height: auto;
    margin: 0 -2rem 0 auto;
    position: relative;
    /* background: rgb(52, 52, 52) 100%; */
    padding-top: 182px;
    top: -64px;
  }
  .hero__text {
    top: 0;
    text-align: left;
    position: absolute;
  }
  .hero__headline {
    margin-top: 105px;
    margin-bottom: 60px;
  }
  .br-visible {
    display: initial;
  }
  .hero__description {
    width: 450px;
    margin-bottom: 34px;
  }
  .hero__circle {
    top: 418px;
  }
  .hero__rings {
    top: 45px;
    right: 65%;
  }
}

/* DESKTOP view */
@media screen and (min-width: 62.5em) {
  .hero__wrapper {
    /* getting circle to stick on hero section */
    position: relative;
  }
  .hero__headline {
    margin-top: 127px;
    margin-bottom: 43px;
    width: 800px;
    line-height: 1;
  }
  .hero__description {
    margin-bottom: 66px;
  }
  .br-visible {
    display: none;
  }
  .hero__img {
    margin: 0 0 0 auto;
    top: -74px;
    /* background: rgb(52, 52, 52) 100%; */
    padding-top: 152px;
    width: 445px;
  }
  .hero__circle {
    top: 460px;
    right: 400px;
  }
  .hero__rings {
    top: 70px;
  }
}

/* SKILLS */
/* MOBILE view */
.skills {
  /* getting rings in right position - sticking to in boundaries of the skills section */
  position: relative;
}

.skills__wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  text-align: center;
  padding: 40px 0;
  border-bottom: 1px solid var(--text-2);
}

.skills__title {
  /* Using online fluid typography calculator https://royalfig.github.io/fluid-typography-calculator/ to set up clamp function 
  min font size - 32px, max font size - 48px, min viewport - 375px, max viewport - 600px, viewport range is when the font-size change
  clamp function is handy not to write media queries just for fonts */
  font-size: 2rem;
  font-size: clamp(2rem, 0.33rem + 7.11vw, 3rem);
  line-height: 1.17;
  margin-bottom: 2px;
}

.skills__rings {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateY(50%);
}

/* TABLET view - 600px */
@media screen and (min-width: 37.5em) {
  .skills__wrapper {
    /* Changing grid to 2 columns */
    grid-template-columns: repeat(2, 1fr);
    gap: 52px;
    text-align: left;
    border-bottom: none;
    padding: 52px 0;
  }
  .skills__rings {
    transform: translateX(45%);
  }
}

/* DESKTOP view */
@media screen and (min-width: 62.5em) {
  .skills__wrapper {
    /* Changing grid to 2 columns */
    grid-template-columns: repeat(3, 1fr);
    gap: 58px;
    padding-top: 72px 0;
  }
  .skills__rings {
    right: 100%;
    transform: translateX(70%);
  }
}

/* SERVICES */
/* MOBILE view */
.services__wrapper {
  padding: 40px 0;
  border-bottom: 1px solid var(--text-2);
}

.services__headline {
  /* headline 'Projects' will start on the first vertical grid-line and end on the second one */
  font-size: 2.5rem;
  font-size: clamp(2.5rem, 0.7rem + 7.68vw, 5.5rem);
  line-height: 1;
}

.services__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.services__item {
  min-height: 250px;
  position: relative;
  grid-column: span 1;
  /* animate a card */
  transition: 0.3s ease transform;
}

.services__item:nth-child(2) {
  border-top: 1px solid var(--accent);
}

.services__card {
  display: block;
  /* to put card's front and back in the same place */
  position: absolute;
  height: 100%;
  width: 100%;
  /* to make it flip */
  transform-style: preserve-3d;
  transition: 0.3s ease transform;
}

.services__card-front,
.services__card-back {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.services__card-back {
  /* rotates/removes a back-card content */
  transform: rotateY(180deg);
}

.services__card-front__heading,
.services__card-back__heading {
  text-transform: capitalize;
  font-size: 2rem;
  font-size: clamp(2rem, 0.33rem + 7.11vw, 3rem);
  line-height: 1.17;
  text-align: center;
}

/* Make the card flip on hover */
.services__item:hover .services__card {
  transform: rotateY(180deg);
}

.services__item:focus-within .services__card {
  transform: rotateY(180deg);
  outline: 2px solid var(--accent);
}

.services__card-back__description {
  font-size: 1.3rem;
  margin-top: 20px;
  text-align: center;
}

.services__card-front__heading {
  margin-top: 20px;
}

/* TABLET view - 600px */
@media screen and (min-width: 37.5em) {
  .services__wrapper {
    border-bottom: none;
    padding: 40px 0;
  }
  .services__grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .services__headline {
    margin-bottom: 3.75rem;
  }
  .services__item {
    min-height: 300px;
  }
  .services__item:nth-child(1) {
    border-bottom: 1px solid var(--text-2);
  }
  .services__item:nth-child(2) {
    border-top: 1px solid var(--accent);
  }
  i {
    font-size: 4rem;
  }
}
/* DESKTOP view */

/* PROJECTS */
/* MOBILE view */
.projects__wrapper {
  padding: 80px 0;
}

.projects__grid {
  display: grid;
  /* grid in 2 columns so we can line up the headline 'Projects' with 'contact me' */
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
}

.projects__headline {
  /* headline 'Projects' will start on the first vertical grid-line and end on the second one */
  grid-column: 1 / 2;
  font-size: 2.5rem;
  font-size: clamp(2.5rem, 0.7rem + 7.68vw, 5.5rem);
  line-height: 1;
}

.projects__contact {
  /* 'contact me' will start on the second vertical grid-line and go till the third grid-line */
  grid-column: 2 / 3;
  /* getting an element on the right and vertically centered */
  justify-self: end;
  align-self: center;
}

.projects__item {
  /* 'projects item' column going to start at first and will end at third grid-line */
  grid-column: 1 / 3;
}

.projects__picture {
  display: block;
  margin-bottom: 20px;
}

.projects__img {
  width: 100%;
  height: auto;
}

.projects__name {
  font-size: 1.5rem;
  line-height: 1.3;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 7px;
}

.projects__tags {
  margin-bottom: 20px;
  font-size: 1rem;
}

.projects__tags > span {
  margin-right: 18px;
  text-transform: uppercase;
}

.projects__links a:nth-child(2) {
  margin-left: 30px;
}

/* Button View Project that opens Modal */
.projects__links button {
  background-color: transparent;
  border: none;
  outline: none;
  line-height: 1.625;
  padding-inline: 0;
  padding-bottom: 10px;
  padding-top: 0;
}

.modal {
  background-color: var(--bg-body);
  text-align: center;
}

.modal::backdrop {
  background-color: hsla(0, 0%, 13%, 0.617);
}

.modal p {
  padding-bottom: 10px;
}

.modal a.underline {
  margin-left: 0;
  margin-right: 30px;
}

/* TABLET view - 600px */
@media screen and (min-width: 37.5em) {
  .projects__grid {
    gap: 60px 24px;
  }
  .projects__item {
    /* Getting projects stacking in 2 columns */
    grid-column: span 1;
  }
}

/* DESKTOP view */
@media screen and (min-width: 62.5em) {
  .project__grid {
    gap: 70px 30px;
  }
  .projects__item {
    /* setting projects_item as a grid to place projects_links on the top of it*/
    display: grid;
    /* setting 1 column */
    grid-template-columns: 1fr;
    /* setting 4 rows with auto height */
    grid-template-rows: repeat(4, auto);
  }
  .projects__picture {
    position: relative;
    /* setting picture element (that includes the projects__image) on 2 columns and 2 rows */
    grid-column: 1 / 2;
    grid-row: 1 / 2;
  }
  .projects__picture::after {
    /* always set the content field with content attribute otherwise element's not going to exist on the page at all */
    content: "";
    /* set it as absolute and projects__items picture as relative */
    position: absolute;
    /* giving it some shape and color */
    width: 100%;
    height: 100%;
    bottom: 0;
    background-color: hsl(0, 0%, 0%);
    /* 1. giving an initial opacity 0 and if you hover the image, change opacity to 0.5 */
    opacity: 0;
    /* 3. add the transition to opacity change */
    transition: opacity 150ms ease-in-out;
  }
  /* 5. if you hover over the projects__item, then the 'after' pseudo element of the picture(tag) will change an opacity to 0.5 */
  /* that way we're giving to overlay an opacity when the links are hovered too as before opacity didn't work on overlay for links' hover state */
  .projects__item:hover .projects__picture::after {
    opacity: 0.5;
  }
  .projects__links {
    /* setting projects__links on 2 columns and 2 rows */
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    /* then center the links on the picture */
    justify-self: center;
    align-self: center;
    /* 4. setting links above the pictures ::after pseudo element */
    z-index: 1;
    /* 6. Making Links invisible until Hover state on projects__item is enabled (7.) */
    opacity: 0;
    /* Making links appear after overlay */
    transition: opacity 450ms ease-in-out;
  }
  /* 7. Making Links visible once Hover state on projects__item is enabled */
  .projects__item:hover .projects__links {
    opacity: 1;
  }
  /* Trigger overlay for keyboard users */
  .projects__item:focus-within .projects__links {
    opacity: 1;
  }
  .projects__item:focus-within .projects__picture::after {
    opacity: 0.5;
  }
}

/* CONTACT */
/* MOBILE view */
.contact {
  background-color: var(--bg-contact);
}

.contact__wrapper {
  /* make it relative to position the rings */
  position: relative;
  padding: 60px 0 100px 0;
  border-bottom: 2px solid var(--text-2);
}

.contact__text {
  text-align: center;
}

.contact__headline {
  font-size: 2.5rem;
  font-size: clamp(2.5rem, 0.7rem + 7.68vw, 5.5rem);
  line-height: 1;
  margin-bottom: 1.25rem;
}

.contact__details {
  /* 1. make it relative to position invalid icon on the right side of the input and textarea elements */
  position: relative;
}

.contact__details > input,
textarea {
  display: block;
  width: 100%;
  background-color: transparent;
  border: none;
  border-bottom: 2px solid var(--text-2);
  font-size: 1.3rem;
  line-height: 1.625;
  color: var(--text-1);
  margin-top: 36px;
  padding: 0 0 16px 24px;
}

/* Disable resizing of text area (the small triangle in bottom-right corner) */
textarea {
  resize: none;
}

.contact__details > *::placeholder {
  color: var(--text-1);
  text-transform: uppercase;
  opacity: 0.5;
}

/* getting button to the right */
.align-right {
  display: flex;
  justify-content: flex-end;
}

.contact__details button {
  background-color: transparent;
  border: none;
  margin-top: 36px;
  font-size: 1.3rem;
  line-height: 1.625;
  padding-inline: 0;
  padding-bottom: 11px;
}

/* 2. position invalid icon on the right side of the input and textarea elements */
.contact__invalid-icon {
  display: none;
  position: absolute;
  top: 0.31rem;
  right: 0;
}

/* 3. if input and textarea is invalid on focus-visible state, then (use a sibling selector (~)) invalid icon ... */
input:focus-visible:invalid ~ .contact__invalid-icon,
textarea:focus-visible:invalid ~ .contact__invalid-icon {
  /* ... should be display: inline-block to have it next to the text box (input) */
  display: inline-block;
}

/* changing color of bottom border to red if the fields are not filled properly on focus mode */
input:focus-visible:invalid,
textarea:focus-visible:invalid {
  border-bottom-color: var(--invalid);
}

/* changing color of bottom border on focus mode */
input:focus-visible,
textarea:focus-visible {
  outline: none;
  border-bottom-color: var(--accent);
}

.contact__rings {
  position: absolute;
  bottom: 25.3%;
  right: 50%;
  /* transform: translateY(-21%); */
}

/* reCAPTCHA */
.reCaptcha__wrapper {
  text-align: right;
}

.g-recaptcha {
  display: inline-block;
  position: relative;
  z-index: 1;
  padding: 10px 0;
  transform: scale(0.77);
  transform-origin: right top;
}

/* TABLET view - 600px */
@media screen and (min-width: 37.5em) {
  .contact__wrapper {
    border-bottom: none;
  }
  .contact__rings {
    right: 100%;
    bottom: 0;
    transform: translateY(-40%);
  }
}

/* DESKTOP view */
@media screen and (min-width: 62.5em) {
  .contact__wrapper {
    display: grid;
    /* setting 2 grid columns, each 27.8rem wide */
    grid-template-columns: repeat(2, 27.8rem);
    /* giving a space between columns */
    justify-content: space-between;
  }
  .contact__text {
    margin-top: 36px;
    text-align: left;
  }
  .contact__rings {
    top: 50%;
    left: 0;
    transform: translateX(-70%);
  }
}

/* In max-width of 999.98px of the viewpoint the contact__wrapper max-width stays 27.8rem wide */
@media (max-width: 62.49875em) {
  .contact__wrapper {
    max-width: 27.8rem;
  }
}

/* FOOTER */
/* MOBILE view */
.footer {
  background-color: var(--bg-contact);
}

.footer__wrapper {
  padding: 40px 0 60px 0;
}

/* TABLET view - 600px */
@media screen and (min-width: 37.5em) {
  .footer__wrapper {
    padding: 30px 0 40px 0;
    border-top: 2px solid var(--text-2);
  }
}

/* DESKTOP view */
@media screen and (min-width: 62.5em) {
  .footer__wrapper {
    padding: 47px 0 92px 0;
  }
}

/* ---- PROJECT PAGE STYLES ---- */
.project_main_img img {
  width: 100%;
  padding: 30px 0;
}

.projects__wrapper h1 {
  padding-top: 30px;
}

.project__description {
  font-style: italic;
}

.project__description__subtitle {
  margin-top: 20px;
}

/* PROJECT NAVIGATION */
.project__navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 80px;
}

.project__navigation button {
  background-color: transparent;
  border: none;
  font-size: 1rem;
  font-size: clamp(1rem, 0.79rem + 0.89vw, 1.3rem);
  line-height: 1.625;
  padding-inline: 0;
  padding-bottom: 11px;
}

/* PROJECT FOOTER */
.project__footer__wrapper {
  background-color: var(--bg-body);
  padding: 40px 0 60px 0;
  border-top: 2px solid var(--text-2);
}

.project__header__social_wrapper {
  display: flex;
  gap: 25px;
  align-items: center;
  font-size: 0;
}

/* TABLET view - 600px */
@media screen and (min-width: 37.5em) {
  .project__footer__wrapper {
    padding: 30px 0 40px 0;
  }
  .project__header__social_wrapper {
    gap: 32px;
  }
}

/* DESKTOP view */
@media screen and (min-width: 62.5em) {
  .project__footer__wrapper {
    padding: 47px 0 92px 0;
  }
  .project__header__social_wrapper {
    margin-right: 0;
  }
}
