@import "./variables.css";
@import "./animations.css";

/* CSS global reset */
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

html {
  background-color: light-dark(var(--background-light), var(--background-dark));
  color: light-dark(var(--text-light), var(--text-dark));
  font-family: var(--font-primary, sans-serif);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Hamburger menu toggle */
#menu-toggle {
  display: none;
}

.hamburger-label {
  display: none;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  position: relative;
  z-index: 1000;
}

.hamburger-icon,
.close-icon {
  width: 100%;
  height: 100%;
  transition: opacity 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
}

/* Show black icons in light mode, white icons in dark mode */
.hamburger-icon-light,
.close-icon-light {
  opacity: 0;
}

.hamburger-icon-dark,
.close-icon-dark {
  opacity: 0;
}

@media (prefers-color-scheme: light) {
  .hamburger-icon-light {
    opacity: 1;
  }
  .hamburger-icon-dark {
    opacity: 0;
  }
  .close-icon-light {
    opacity: 0;
  }
  .close-icon-dark {
    opacity: 0;
  }
}

@media (prefers-color-scheme: dark) {
  .hamburger-icon-light {
    opacity: 0;
  }
  .hamburger-icon-dark {
    opacity: 1;
  }
  .close-icon-light {
    opacity: 0;
  }
  .close-icon-dark {
    opacity: 0;
  }
}

#menu-toggle:checked ~ .hamburger-label .hamburger-icon {
  opacity: 0 !important;
}

#menu-toggle:checked ~ .hamburger-label .close-icon-light {
  opacity: 1 !important;
}

#menu-toggle:checked ~ .hamburger-label .close-icon-dark {
  opacity: 1 !important;
}

@media (prefers-color-scheme: light) {
  #menu-toggle:checked ~ .hamburger-label .close-icon-light {
    opacity: 1 !important;
  }
  #menu-toggle:checked ~ .hamburger-label .close-icon-dark {
    opacity: 0 !important;
  }
}

@media (prefers-color-scheme: dark) {
  #menu-toggle:checked ~ .hamburger-label .close-icon-light {
    opacity: 0 !important;
  }
  #menu-toggle:checked ~ .hamburger-label .close-icon-dark {
    opacity: 1 !important;
  }
}

/* custom navbar styles */
nav ul {
  display: flex;
  justify-content: space-between;
  flex-direction: row;
  list-style: none;
  position: relative;

  /* custom highlighter themed navbar */
  &::before {
    content: "";
    position: absolute;
    z-index: -3;
    top: -35%;
    left: -5%;
    height: 2rem;
    width: 110%;
    background-color: light-dark(
      var(--primary-foreground-light),
      var(--primary-foreground-dark)
    );
  }
  &::after {
    content: "";
    position: absolute;
    z-index: -2;
    top: 50%;
    left: 5%;
    height: 1.5rem;
    width: 110%;
    background-color: light-dark(
      var(--secondary-foreground-light),
      var(--secondary-foreground-dark)
    );
  }

  a {
    position: relative;
    color: light-dark(var(--primary-light), var(--primary-dark));
    text-decoration: none;
    transition: color 0.2s ease;
  }

  a:active {
    color: light-dark(var(--secondary-light), var(--secondary-dark));
  }

  a:hover {
    color: light-dark(var(--text-light), var(--text-dark));
    z-index: 1;
  }

  /* custom navbar highlighter animation on hover */
  a::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 40%;
    left: 8%;
    height: 75%;
    width: 0%;
    background-color: light-dark(
      var(--accent-light),
      var(--accent-foreground-dark)
    );
    transition: width 0.3s ease;
  }

  a:hover::before {
    width: 100%;
  }
}

/* Mobile hamburger menu styles */
@media screen and (max-width: 430px) {
  .hamburger-label {
    display: block;
  }

  nav ul {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    height: 100dvh;
    background-color: light-dark(
      var(--background-light),
      var(--background-dark)
    );
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 4rem 2rem 2rem;
    gap: 1.5rem;
    transition: right 0.3s ease;
    box-shadow: -0.25rem 0 1rem
      light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.1));
    z-index: 999;

    &::before,
    &::after {
      display: none;
    }

    li {
      width: 100%;
    }

    a {
      display: block;
      padding: 0.75rem 1rem;
      font-size: 1.125rem;
    }
  }

  #menu-toggle:checked ~ ul {
    right: 0;
  }
}

.site-frame {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  padding: 0 var(--page-padding-width, 10%);
}

.site-frame-header {
  grid-row: 1;
  background-color: transparent;
  color: light-dark(var(--text-light), var(--text-dark));
  margin-top: var(--page-padding-height);
  margin-bottom: clamp(1.5rem, 3vw, 3rem);
  font-size: clamp(0.875rem, 2dvw, 1.125rem);
}

.site-frame-body {
  grid-row: 2;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  line-height: 1.6;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;

  h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.2;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    font-weight: 700;
  }

  h2 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    line-height: 1.3;
    margin-top: clamp(2rem, 4vw, 3rem);
    margin-bottom: clamp(0.75rem, 1.5vw, 1.25rem);
    font-weight: 700;
  }

  h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    line-height: 1.4;
    margin-top: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: clamp(0.5rem, 1vw, 1rem);
    font-weight: 600;
  }

  p {
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    line-height: 1.7;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    max-width: 75ch;
  }

  ul,
  ol {
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    padding-left: clamp(1.5rem, 3vw, 2rem);

    li {
      margin-bottom: clamp(0.5rem, 1vw, 0.75rem);
      line-height: 1.6;
    }
  }

  section {
    margin-bottom: clamp(1rem, 3vw, 3rem);
  }

  iframe {
    width: 100%;
    max-width: 100%;
    border: 0.125rem solid light-dark(var(--text-light), var(--text-dark));
    border-radius: 0.5rem;
    display: block;
  }

  a {
    color: light-dark(var(--primary-light), var(--primary-dark));
    text-decoration: underline;
    transition: color 0.2s ease;

    &:hover {
      color: light-dark(var(--secondary-light), var(--secondary-dark));
    }
  }
}

/* different layout for the home page */
.hero-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: clamp(2rem, 4vw, 4rem);
  margin-bottom: clamp(2rem, 4vw, 4rem);
}

.headshot-container {
  flex-shrink: 0;
}

.headshot-image {
  width: clamp(150px, 20vw, 250px);
  height: clamp(150px, 20vw, 250px);
  border-radius: 50%;
  object-fit: cover;
  border: 0.25rem solid light-dark(var(--primary-light), var(--primary-dark));
}

.about-me-text {
  flex: 1;
  min-width: 0;

  h2 {
    margin-top: 0;
  }
}

/* Social media links */
.social-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  margin-bottom: clamp(2rem, 4vw, 4rem);

  a {
    display: block;
    transition: transform 0.2s ease, opacity 0.2s ease;
    text-decoration: none;

    &:hover {
      transform: scale(1.1);
      opacity: 0.8;
    }

    img {
      width: clamp(2.5rem, 5vw, 4rem);
      height: clamp(2.5rem, 5vw, 4rem);
      display: block;
    }
  }
}

/* Mobile responsive layout for hero section */
@media screen and (max-width: 430px) {
  .hero header {
    align-self: center;
  }

  .hero-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .about-me-text {
    p {
      margin-left: auto;
      margin-right: auto;
    }
  }
}

.site-frame-footer {
  grid-row: 3;
  background-color: light-dark(var(--background-light), var(--background-dark));
  color: light-dark(var(--text-light), var(--text-dark));
  padding-bottom: clamp(1.5rem, 3vw, 2rem);
  margin-top: clamp(2rem, 4vw, 3rem);
  text-align: center;
  font-size: clamp(0.875rem, 1.5vw, 1rem);
  line-height: 1.5;
}

/* Custom CSS element: cat-image */
cat-image {
  display: block;
  position: relative;
  min-width: clamp(250px, 20vw, 350px);
  width: clamp(250px, 20vw, 350px);
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  transition: transform 0.3s ease;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  &:hover {
    transform: scale(1.05);
    z-index: 10;
  }
}

/* Category variations with pastel/highlighter theme */
cat-image[category="pastel-pink"] {
  border: 0.25rem solid
    light-dark(
      var(--secondary-foreground-light),
      var(--secondary-foreground-dark)
    );
}

cat-image[category="pastel-blue"] {
  border: 0.25rem solid
    light-dark(var(--primary-foreground-light), var(--primary-foreground-dark));
}

cat-image[category="pastel-yellow"] {
  border: 0.25rem solid
    light-dark(var(--accent-foreground-light), var(--accent-foreground-dark));
}

cat-image[category="pastel-green"] {
  border: 0.25rem solid light-dark(var(--primary-light), var(--primary-dark));
}

cat-image[category="pastel-purple"] {
  border: 0.25rem solid
    light-dark(var(--secondary-light), var(--secondary-dark));
}

/* Custom CSS element: skill-badge (for career page) */
skill-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  margin: 0.25rem;
  border: 0.125rem solid light-dark(var(--text-light), var(--text-dark));
  background-color: light-dark(var(--background-light), var(--background-dark));
  font-size: 0.875rem;
  font-weight: bold;
  text-align: center;
  transition: transform 0.2s ease;

  &:hover {
    transform: scale(1.05);
  }
}

skill-badge[category="language"] {
  background-color: light-dark(
    var(--primary-foreground-light),
    var(--primary-foreground-dark)
  );
}

skill-badge[category="technology"] {
  background-color: light-dark(
    var(--secondary-foreground-light),
    var(--secondary-foreground-dark)
  );
}

skill-badge[category="framework"] {
  background-color: light-dark(
    var(--accent-foreground-light),
    var(--accent-foreground-dark)
  );
}
