@layer reset, defaults, components, utilities, buttons;

/* ********************************** */
/* RESET */
/* ********************************** */
@layer reset {
  /* 1. Use a more-intuitive box-sizing model */
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  /* 2. Remove default margin */
  *:not(dialog) {
    margin: 0;
  }

  /* 3. Enable keyword animations */
  @media (prefers-reduced-motion: no-preference) {
    html {
      interpolate-size: allow-keywords;
      scroll-behavior: smooth;
    }
  }

  body {
    /* 4. Increase line-height */
    line-height: 1.5;
    /* 5. Improve text rendering */
    -webkit-font-smoothing: antialiased;
  }

  /* 6. Improve media defaults */
  img,
  picture,
  video,
  canvas,
  svg {
    display: block;
    max-width: 100%;
  }

  /* 7. Inherit fonts for form controls */
  input,
  button,
  textarea,
  select {
    font: inherit;
  }

  /* 8. Avoid text overflows */
  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    overflow-wrap: break-word;
  }

  /* 9. Improve line wrapping */
  p {
    text-wrap: pretty;
  }
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    text-wrap: balance;
  }

  a {
    text-decoration: none;
    color: inherit;
  }
}

/* ********************************** */
/* DEFAULT */
/* ********************************** */
/*
@media (min-width: 480px) {}

@media (min-width: 768px) {}

@media (min-width: 1024px) {}

@media (min-width: 1280px) {}
*/

@layer defaults {
  /* COLOUR */
  :root {
    --main-colour: #0087aa;
    --secondary-colour: #fcfffbff;
    --tertiary-colour: #262420;
    --accent-colour: #ffbe46;
    --background-gradient: linear-gradient(45deg, #0087aa, #00ccff);
    --pattern:
      linear-gradient(135deg, #008fb355 25%, transparent 25%) -40px 0/80px 80px,
      linear-gradient(225deg, #008fb3 25%, transparent 25%) -40px 0/80px 80px,
      linear-gradient(315deg, #008fb355 25%, transparent 25%) 0px 0/80px 80px,
      linear-gradient(45deg, #008fb3 25%, #0088aa 25%) 0px 0/80px 80px;

    --content-width: 1200px;
    --radius: 5px;
    --button_radius: 0.75em;
    --box-shadow: 0.2em 0.2em 0.5em oklch(0 0 0 / 0.4);
    --box-shadow-below: 0 0.4em 0.6em oklch(0 0 0 / 0.45);
    --text-shadow: 2px 2px 7px oklch(0 0 0 / 0.4);
  }

  /* FONTS */
  @font-face {
    font-family: "SofiaSans";
    src: url("../font/SofiaSans-VariableFont_wght.ttf") format("truetype");
    font-display: swap;
  }

  @font-face {
    font-family: "SofiaSansItalic";
    src: url("../font/SofiaSans-Italic-VariableFont_wght.ttf")
      format("truetype");
    font-display: swap;
  }
  @font-face {
    font-display: swap;
    font-family: "Roboto";
    font-style: normal;
    src: url("../font/Roboto_Condensed-Regular.ttf") format("truetype");
  }
  @font-face {
    font-display: swap;
    font-family: "Elephant";
    font-style: normal;
    src: url("../font/Elephant.otf") format("opentype");
  }

  h1,
  h2,
  h3 {
    font-family: "Elephant", Arial, Helvetica, sans-serif;
  }
  p,
  li,
  footer,
  .subClaim {
    font-family: "SofiaSans", serif;
  }
  a,
  button {
    font-family: "Roboto", sans-serif;
  }

  /* FONT SIZE */
  h1 {
    font-size: clamp(3rem, 5vw + 1rem, 4rem);
    line-height: 1.1;
    text-align: center;
  }
  h2 {
    font-size: clamp(3rem, 5vw + 1rem, 4rem);
    line-height: 1.1;
    margin-bottom: 3rem;
    text-align: center;
  }
  h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5em;
  }
  p,
  a,
  li,
  button {
    font-size: 1.2rem;
    hyphens: auto;
    text-align: left;
  }
  p:not(p:last-child) {
    margin-bottom: 0.3em;
  }
  .subClaim {
    font-size: 1.2rem;
  }
}

/* ********************************** */
/* COMPONENTS */
/* ********************************** */
@layer components {
  body {
    color: var(--tertiary-colour);
    isolation: isolate;
    /* background-color: var(--main-colour); */
  }

  /* ********************************** */
  /* HEADER */
  header {
    position: sticky;
    top: 1em;
    height: 0;
    display: flex;
    justify-content: space-between;
    padding-right: 1em;
    z-index: 5;
  }
  #headerLogo {
    width: 150px;
    height: auto;
    filter: drop-shadow(var(--box-shadow-below));
  }
  #openSidebarButton {
    display: block;
    border: none;
    padding: 0.3em;
    cursor: pointer;
    background-color: var(--secondary-colour);
    border-radius: 50%;
    fill: var(--tertiary-colour);
    transition: all 0.4s;
  }
  #openSidebarButton:hover {
    fill: var(--main-colour);
  }

  @media (min-width: 1000px) {
    #openSidebarButton {
      display: none;
    }
  }

  /* ********************************** */
  /* NAVIGATION */
  nav {
    display: flex;
    align-items: start;
    position: fixed;
    top: 0;
    right: -100%;
    height: 100vh;
    width: min(15em, 100%);
    z-index: 10;
    transition: right 300ms ease-out;
    padding: 0;
    background-color: var(--secondary-colour);
    box-shadow: var(--box-shadow);
  }
  nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
  }
  nav a {
    display: block;
    color: var(--tertiary-colour);
    font-size: 1rem;
    transition: all 0.4s;
    text-transform: uppercase;
    padding: 0.8em 0 0.8em 2.5em;
    border-left: 3px solid transparent;
  }
  nav a:hover {
    color: var(--main-colour);
    border-left: 3px solid currentColor;
    background-color: rgba(204, 226, 245, 0.4);
  }
  nav.show {
    right: 0;
  }
  nav.show ~ #overlay,
  .onlySidebar {
    display: block;
  }

  #closeSidebarButton {
    display: block;
    background: none;
    border: none;
    padding-top: 1em;
    padding-left: 2em;
    padding-bottom: 1em;
    cursor: pointer;
    fill: var(--tertiary-colour);
    transition: all 0.4s;
  }

  #closeSidebarButton:hover {
    fill: var(--main-colour);
  }
  #overlay {
    position: fixed;
    inset: 0;
    background-color: oklch(46.988% 0.02303 221.334 / 0.5);
    z-index: 9;
    display: none;
  }

  @media (min-width: 1000px) {
    nav {
      position: sticky;
      top: 1.6em;
      height: 0;
      width: 100%;
      justify-content: flex-end;
      padding-right: 1.5em;
      overflow: visible;
      box-shadow: none;
    }
    nav ul {
      display: flex;
      flex-direction: row;
      gap: 1em;
      align-items: stretch;
      width: auto;
      overflow: visible;
    }
    nav a {
      color: var(--secondary-colour);
      background-color: rgba(38, 36, 32, 0.5);
      border: 1px solid var(--secondary-colour);
      box-shadow: var(--box-shadow);
      padding: 0.5em 0.9em;
      display: block;
      overflow: hidden;
      cursor: pointer;
      z-index: 1;
      position: relative;
    }

    nav a::before {
      position: absolute;
      content: "";
      background: var(--accent-colour);
      width: 150px;
      height: 180px;
      z-index: -1;
      border-radius: 50%;
      top: 100%;
      left: 100%;
      transition: 0.6s all;
    }

    nav a:hover {
      color: var(--secondary-colour);
      background-color: var(--secondary-colour);
      border: 1px solid currentColor;
      /* border-left: none; */
    }

    nav a:hover::before {
      top: -30px;
      left: -30px;
    }

    .onlySidebar {
      display: none;
    }
    #closeSidebarButton {
      display: none;
    }
  }

  /* Button to skip nav */
  .skipLink {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: 0.6em 1.2em;
    background: var(--main-colour);
    font-weight: bold;
    text-decoration: none;
  }
  .skipLink:focus {
    left: 0;
  }

  /* ********************************** */
  /* MAIN */
  /* footer stuck to bottom */
  .fixedFooterGrid {
    display: grid;
    grid-template-rows: 1fr auto;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    z-index: 0;
  }

  section {
    padding-top: 5rem;
    padding-bottom: 6rem;
    border-bottom: 2px solid var(--secondary-colour);
  }
  .sectionContent {
    padding-left: 2rem;
    padding-right: 2rem;
    margin: 0 auto;
    max-width: 1024px;
  }

  /*********************************************/
  /* START */
  #start {
    position: relative;
    height: 100vh;
    height: 100dvh;
    display: grid;
    place-items: center;
  }
  .startItem {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
    z-index: 1;
    color: var(--secondary-colour);
    text-align: center;
  }
  .startItem img {
    width: auto;
    height: clamp(8rem, 12vw + 5rem, 18em);
  }
  .backgroundImageTop {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    background-color: var(--main-colour);
  }
  .backgroundImageTop img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
  }
  #myService,
  #myContact,
  #myWork {
    color: var(--secondary-colour);
    background-color: var(--tertiary-colour);
  }
  #myWork {
    border-top: 2px solid var(--secondary-colour);
  }
  #aboutMe,
  #myContact {
    color: var(--secondary-colour);
    background: var(--pattern);
    margin-bottom: 6rem;
  }

  /*********************************************/
  /* SERVICE */
  .serviceGrid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
  }
  .serviceItem {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 1rem;
  }
  .serviceItem div:first-child {
    display: grid;
    place-items: center;
    width: 13rem;
    height: 13rem;
    border-radius: 50%;
    background-color: var(--secondary-colour);
    box-shadow: var(--box-shadow);
    margin: 0 auto;
  }
  .serviceItem h3 {
    text-align: center;
  }
  .serviceItem img {
    width: 60%;
    height: 60%;
  }
  @media (min-width: 580px) {
    .serviceItem {
      grid-template-columns: auto 1fr;
      align-items: start;
      gap: 3rem;
    }
    .serviceItem h3 {
      text-align: left;
    }
  }
  @media (min-width: 768px) {
    .serviceGrid {
      grid-template-columns: 1fr 1fr;
      gap: 4rem;
    }
    .serviceItem {
      grid-template-columns: 1fr;
      grid-template-rows: auto 1fr;
      gap: 2rem;
    }
    .serviceItem h3 {
      text-align: center;
    }
    .serviceItem div:first-child {
      width: 14rem;
      height: 14rem;
    }
  }
  @media (min-width: 1024px) {
    .serviceItem div:first-child {
      width: 15rem;
      height: 15rem;
    }
  }

  /*********************************************/
  /* ABOUT ME */
  .aboutMeGrid {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 2rem;
  }
  .aboutMeGrid h3 {
    text-align: center;
  }
  .aboutMeGrid img {
    width: 13rem;
    height: auto;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--secondary-colour);
    box-shadow: var(--box-shadow);
    margin: 0 auto;
  }
  .text-box p {
    text-align: justify;
    hyphens: auto;
  }
  @media (min-width: 768px) {
    .aboutMeGrid {
      grid-template-columns: 17rem 1fr;
      align-items: start;
    }
    .aboutMeGrid h3 {
      text-align: left;
    }
    .aboutMeGrid img {
      width: 17rem;
    }
  }
  /*********************************************/
  /* PROJECT */
  .workGrid {
    display: grid;
    gap: 1.3em;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    margin: 0 auto;
    padding: 0 2rem;
  }

  #MyWork img {
    width: 100%;
    height: 100%;
    box-shadow: var(--box-shadow);
  }
  /*********************************************/
  /* CONTACT */
  .contactGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 200px);
    gap: 3em;
    justify-content: center;
  }
  .contactItem {
    color: var(--secondary-colour);
  }
  .contactItem div {
    display: grid;
    justify-items: center;
    gap: 0.5em;
    text-align: center;
  }
  .contactItem img {
    width: 9rem;
    height: auto;
    background-color: var(--secondary-colour);
    border-radius: 50%;
    padding: 1em;
    box-shadow: var(--box-shadow);
  }

  /* ********************************** */
  /* FOOTER */
  footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5em;
    color: var(--secondary-colour);
    background: var(--tertiary-colour);
    padding: 3rem 0 2rem 0;
    border-top: 2px solid var(--secondary-colour);
  }
  footer div {
    /* font-family: "SofiaSans", sans-serif; */
    line-height: 1.7;
    text-align: center;
  }
  footer img {
    width: 7.5rem;
  }
}

/* ********************************** */
/* UTILITIES */
/* ********************************** */
@layer utilities {
  .startButtons {
    display: grid;
    justify-content: center;
  }
}
/* ********************************** */
/* BUTTONS */
/* ********************************** */
@layer buttons {
  /* From Uiverse.io by yaasiinaxmed */
}
