/* -------------- theming styles -------------- */

:root {
  --background: 0 0% 100%;
  --accent: 210 40% 96.1%;
  --secondary: 210 40% 92%;
  --foreground: 222.2 84% 4.9%;
}

[data-theme="dark"] {
  --background: 222.2 84% 4.9%;
  --accent: 222.2 40% 10%;
  --secondary: 217.2 32.6% 17.5%;
  --foreground: 210 40% 98%;
}

/* -------------- root styles -------------- */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

::-webkit-scrollbar {
  display: none;
}

:root {
  font-size: 1rem;
  line-height: 1.5rem;
  scrollbar-width: none;
}

body {
  position: relative;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  overflow-y: auto;
  overflow-x: hidden;
}

a:hover {
  text-decoration: underline;
}

a:active {
  color: hsl(var(--foreground) / 0.5);
}

/* -------------- header styles -------------- */

/* header root */

body > header {
  background-color: hsl(var(--background) / 0.5);
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-height: 15vh;
  width: 100%;
  padding-inline: 2rem;
  padding-block: 1.75rem;
  backdrop-filter: blur(8px);
  z-index: 10;
}

@media screen and (max-width: 500px) {
  body > header {
    padding-inline: 1rem;
  }
}

/* header nav root */

header > nav {
  display: flex;
  flex-grow: 1;
  justify-content: space-between;
  align-items: center;
}

/* header nav root link */

.root-link {
  font-weight: 700;
  font-size: x-large;
  line-height: 1.75rem;
}

/* header nav container */

.desktop-nav {
  display: flex;
  gap: 1rem;
  font-weight: 600;
}

.mobile-nav {
  display: none;
}

@media screen and (max-width: 500px) {
  .desktop-nav {
    display: none;
  }

  .mobile-nav {
    display: block;
  }
}

/* -------------- dropdown styles -------------- */

/* dropdown root */

.dropdown {
  position: relative;
}

/* dropdown container */

.dropdown-container {
  position: absolute;
  top: 100%;
  right: 0;
  height: max-content;
  min-width: 100px;
  max-width: max-content;
  background-color: hsl(var(--accent));
  border-radius: 5px;
  transform: scaleY(0);
}

/* dropdown animation */

@keyframes growDown {
  0% {
    transform: scaleY(0);
  }

  80% {
    transform: scaleY(1.1);
  }

  100% {
    transform: scaleY(1);
  }
}

.dropdown[data-open="true"] > .dropdown-container {
  animation: growDown 0.3s ease-in-out forwards;
  transform-origin: top center;
}

@keyframes shrinkUp {
  0% {
    transform: scaleY(1);
  }

  20% {
    transform: scaleY(1.1);
  }

  100% {
    transform: scaleY(0);
  }
}

/* made sure shrinkUp animation not played when page just loaded */
/* prevent-animation class will be removed with js after dropdown opens for the first time */
.dropdown-container:not(.prevent-animation) {
  animation: shrinkUp 0.3s ease-in-out forwards;
  transform-origin: top center;
}

/* dropdown trigger & item */

.dropdown-trigger,
.dropdown-item {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem;
  border-radius: 5px;
  transition:
    color 0.5s ease-in-out,
    transform 0.1s ease-in-out;
}

.dropdown-trigger:hover,
.dropdown-item:hover {
  background-color: hsl(var(--foreground) / 0.1);
}

.dropdown-trigger:active,
.dropdown-item:active {
  background-color: hsl(var(--background));
  transform: scale(0.9, 0.9);
}

/* -------------- main styles -------------- */

/* main typography */

main h1,
main h2 {
  font-size: xx-large;
  line-height: 2rem;
  font-weight: bold;
}

main p {
  font-size: large;
  line-height: 1.75rem;
}

/* main article root */

main > article {
  min-height: 100vh;
  padding-top: 20vh;
  text-align: center;
}

@media screen and (max-width: 500px) {
  main > article {
    padding-inline: 0.17rem;
  }
}

main > article > *:not(:last-child) {
  margin-bottom: 1rem;
}

/* main hero article */

main > article:first-child {
  position: relative;
  padding-top: 10vh;
}

main > article:first-child > .backdrop {
  position: absolute;
  z-index: -1;
  top: 30vh;
  width: 100%;
  height: 50vh;
  background-image: linear-gradient(to bottom, hsl(var(--accent)), hsl(var(--background)));
  border-radius: 25px 25px 0 0;
}

main > article:first-child > img {
  max-height: 40vh;
  margin-inline: auto;
  background-color: hsl(var(--accent));
  border: 0.75rem solid hsl(var(--accent));
  border-radius: 999px;
}

/* main article card container */

main .card-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

@media screen and (max-width: 500px) {
  main .card-container {
    padding-inline: 1rem;
  }
}

/* main article card item */

main .card-container > .card-item {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  padding: 2rem;
  min-width: 15%;
  max-width: 180px;
  background-color: hsl(var(--accent));
  border-radius: 10px;
  font-weight: 500;
  font-size: x-large;
  transition:
    transform 0.1s,
    box-shadow 0.1s ease-in-out;
}

@media screen and (max-width: 500px) {
  main .card-container > .card-item {
    flex-direction: row;
    min-width: 100%;
    max-width: 300px;
    font-size: xx-large;
    line-height: 2rem;
    text-align: left;
  }
}

main .card-container > .card-item:hover {
  transform: translateY(-3px) scale(1.02, 1.02);
  transform-origin: bottom center;
  box-shadow: 0 3px 20px 10px hsl(var(--shadow) / 0.5);
}

main .card-container > .card-item:active {
  transform: translateX(0) scale(1, 1);
}

main .card-container > .card-item > img {
  width: 90%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

@media screen and (max-width: 500px) {
  main .card-container > .card-item > img {
    width: 30%;
  }
}

/* project section | TO BE STYLED LATER */

/* the projects section */
#projects,
/* hyperlink directing to projects section */
li > a[href="#projects"] {
  display: none;
}

/* -------------- aside styles -------------- */

/* aside root */

aside {
  --aside-width: min(450px, 80vw);
  position: fixed;
  top: 0;
  bottom: 0;
  right: calc(var(--aside-width) * -1);
  background-color: hsl(var(--background));
  border-left: 0.25rem hsl(var(--secondary)) solid;
  z-index: 90;
  transition: transform 0.5s ease-in-out;
}

aside[data-show="true"] {
  transform: translate(calc(var(--aside-width) * -1), 0);
}

/* aside toggle button */

aside .sidebar-toggle {
  position: absolute;
  left: -4rem;
  top: 50%;
  bottom: 50%;
  height: 2rem;
  padding-inline: 0.5rem;
  border-radius: 5px 5px 0 0;
  background-color: hsl(var(--secondary));
  z-index: 99;
  rotate: 270deg;
  transition:
    translate 0.3s ease-in-out,
    scale 0.1s ease-in-out;
}

@media screen and (max-width: 500px) {
  aside[data-show="true"] .sidebar-toggle {
    translate: 2rem;
    border-radius: 0 0 5px 5px;
  }
}

aside .sidebar-toggle:hover {
  scale: 1.1;
}

/* aside article root */

aside article {
  height: 100vh;
  width: var(--aside-width);
  overflow-y: auto;
}

/* aside article header */

aside header {
  position: sticky;
  top: 0;
  background-color: hsl(var(--background) / 0.5);
  padding: 1rem;
  padding-top: 2.25rem;
  backdrop-filter: blur(8px);
  z-index: 10;
  text-align: center;
}

aside header > *:not(:last-child) {
  margin-bottom: 1rem;
}

aside header > h3 {
  font-size: x-large;
  font-weight: 600;
}

aside header img {
  max-height: 30vh;
  margin: auto;
  border: 0.25rem hsl(var(--secondary)) solid;
  border-radius: 10px;
}

/* aside article content root */

aside .aside-content {
  padding: 1rem;
  padding-top: 0;
}

aside .aside-content > *:not(:last-child) {
  margin-bottom: 1rem;
}

/* aside article content item */

aside section {
  background-color: hsl(var(--accent));
  border-radius: 10px;
  padding: 0.5rem;
}

aside section > h3 {
  text-align: center;
  font-size: large;
  font-weight: 600;
  line-height: 2rem;
  border-bottom: 0.125rem hsl(var(--secondary)) solid;
  margin-bottom: 0.25rem;
}

/* aside table */

aside table {
  width: 100%;
}

aside th {
  text-align: left;
}

aside th,
aside td {
  vertical-align: top;
  padding: 0.25rem 0.5rem;
  word-break: break-all;
}

aside td:last-child {
  text-align: right;
}

aside td h4 {
  font-weight: bold;
}

aside td p {
  font-size: smaller;
  line-height: normal;
}

/* -------------- footer styles -------------- */

footer {
  background-color: hsl(var(--accent));
  border-radius: 25px 25px 0 0;
  text-align: center;
  padding-top: 3rem;
  padding-bottom: 1rem;
  margin-top: 1rem;
}

footer > h3 {
  font-size: xx-large;
  line-height: 2rem;
  font-weight: bold;
}

footer > *:not(:last-child) {
  margin-bottom: 1rem;
}

footer > p:first-of-type {
  font-size: larger;
}
