@layer base, utils, components;


/* ================  SETUP + THEMING  ================ */
@layer base {
  :root {
    --font-size: 18px;
    --font-family: monospace, "Symbols Nerd Font";

    /* Custom Variables working across themes with fallback */
    --prompt-color: var(--green, #a6e3a1);
    --dark-background: hsl(from var(--background0) h s calc(l - 4));
    --darker-background: hsl(from var(--dark-background) h s calc(l - 4));

    --link-underline-color: var(--foreground0);
  }

  html[data-mode="light"] {
    --box-border-color: var(--foreground2);
    --table-border-color: var(--foreground2);
    --separator-color: var(--foreground2);

    strong {
      text-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
    }
  }

  html[data-mode="dark"] {
    --box-border-color: var(--background1);
    --table-border-color: var(--background1);
    --separator-color: var(--background1);

    strong {
      text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
  }

  html[data-webtui-theme*="catppuccin"] {
    --dark-background: var(--mantle);
    --darker-background: var(--crust);
  }

  html[data-webtui-theme*="everforest-light"] {
    --dark-background: var(--bg-dim);
  }

  html[data-webtui-theme*="everforest-light"] {


    /* --dark-background: hsl(from var(--background0) h s calc(l - 4)); */
    --darker-background: hsl(from var(--dark-background) h s calc(l - 4));
  }

  html[data-webtui-theme*="gruvbox"] {}

  html[data-webtui-theme*="vitesse"] {}
}


/* Invert black logo to white when dark mode is enabled */
html[data-mode="dark"] {
  img.blacklogo {
    filter: invert(100)
  }
}

/* Invert white logo to black when light mode is enabled */
html[data-mode="light"] {
  img.whitelogo {
    filter: invert(100)
  }
}

#theme-toggle,
#mode-toggle {
  text-decoration: none;
}


html,
body {
  height: 100%;
  /* margin: 0;
  padding: 0; */
  background-color: var(--background0);
  color: var(--foreground0);
  /* line-height: 1.6; */
}


/* ================  GENERAL  ================ */
/* Icons */
i[class^="nf "],
i[class*=" nf"] {
  font-display: swap;
  font-style: normal;
  font-weight: normal;
}

.centered {
  margin: auto;
  width: 50%;
  text-align: center;
}

.margin-container {
  margin: 0rem 1rem;
}


a {
  color: var(--foreground0);
}

a:hover {
  text-decoration: underline;
}

/* Show href if a text is empty */
a:empty::after {
  content: attr(href);
}

code {
  background-color: var(--darker-background);
}

#nav {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

#home-link {
  font-size: 1.9rem;
  padding: 0;
}


p {
  margin: 1lh 0;
}


.skills {
  .skill {
    display: flex;
    align-items: center;
    gap: 1ch;
    margin-bottom: 0.5lh;
  }

  span {
    width: 12ch;
  }

  [is-~='progress'] {
    max-width: 48ch;
    flex: 1;
  }

  i {
    font-size: 2rem;
    width: 2ch;
  }
}

/* ================  BOXES  ================ */
@layer utils {

  [box-~='square'],
  [box-~='round'],
  [box-~='double'] {
    /* Set the box-bg to the "default" value */
    --box-bg: var(--background0);
    padding: 1lh 2ch;
  }
}


.dark-box {
  --box-bg: var(--dark-background);
}

.dark-box::before {
  background: var(--box-bg);
  background-clip: border-box;
}

.darker-box {
  --box-bg: var(--darker-background);
}

.darker-box::before {
  background: var(--box-bg);
  background-clip: border-box;
}

.box-header {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  z-index: 1;

  span {
    /* Cover the box border behind the box caption */
    background: linear-gradient(to bottom,
        transparent 0%,
        transparent 40%,
        var(--box-bg) 40%,
        var(--box-bg) 100%);
    background-clip: padding-box;
    padding: 0 0.5ch;
  }
}


/* ================  HEADINGS  ================ */
h1 {
  font-size: 1.5rem;
  margin: 0.5lh 0;
}

h1::before {
  content: "# ";
}

h2 {
  font-size: 1.4rem;
  margin: 0.4lh 0;
}

h2::before {
  content: "## ";
}

h3 {
  font-size: 1.3rem;
  margin: 0.3lh 0;
}

h3::before {
  content: "### ";
}

h4 {
  font-size: 1.2rem;
  margin: 0.2lh 0;
}

h4::before {
  content: "#### ";
}

h5 {
  font-size: 1.1rem;
  margin: 0.2lh 0;
}

h5::before {
  content: "##### ";
}

h6 {
  font-size: 1.0rem;
  margin: 0.2lh 0;
}

h6::before {
  content: "###### ";
}


/* ================  FOOTER  ================ */
.footer-flex {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  /* Align items at the top of the header row */
  /* align-items: flex-start; */
}

footer {
  bottom: 0;
  padding-bottom: 1lh;
  width: 100%;
}


footer #made-with {
  flex-grow: 1;
  align-content: baseline;

  p {
    margin: 0;
    max-width: 120px;
    text-align: center;
  }
}

footer .links {
  flex-grow: 1;

  @media (min-width: 568px) {
    display: flex;
    justify-content: space-evenly;
    /* Vertically align items at the top */
    align-items: flex-start;
  }

  ul {
    display: grid;
    background-color: var(--darker-background);
  }

  li {
    list-style: none;
    padding-top: 0;
    padding-bottom: 0;
  }
}


@media (max-width: 567px) {
  .footer-flex {
    flex-direction: column;
    /* Since we are using column, cross axis is the horizontal axis */
    /* So align-items now center horizontally */
    align-items: center;
    flex-wrap: nowrap;
    row-gap: 20px;
  }

  #styling {
    display: none;
  }

  footer {
    .links {
      justify-content: center;
      margin: auto;
      min-width: 50%;
      /* width: 70%; */
      /* width: 50%; */
    }

    ul {
      justify-content: center;
      text-align: left;

      margin-left: auto;
      margin-right: auto;
      width: auto;
      /* width: 100%; */
      padding: 0.33lh 1ch;
      margin-top: 1lh;
      margin-bottom: 1lh;
    }

    #made-with {
      flex-grow: 1;
      /* width: 50%; */
      margin: auto;
      text-align: center;
    }
  }
}