:root {
  --bachelor-text: #1E8F3B;
  --bachelor-badge: rgba(77, 217, 114, 0.4);

  --master-text: #B54706;
  --master-badge: rgba(248, 174, 110, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bachelor-text: #B5FFB2; 
    --bachelor-badge: rgba(50, 180, 80, 0.45);

    --master-text: #ffb648; 
    --master-badge: rgba(255, 140, 0, 0.35);
  }
}

html, body {
    height: auto;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
  
    flex-direction: column;
    background-color: var(--background-color);
  
    transition: background-color 0.4s ease;
    will-change: background-color;

    scroll-behavior: initial;
  }

  .back-button-container {
    margin-left: 0;
    margin-right: auto;

    padding: 1.5rem;
  }

  .back-button {
    height: fit-content;
    width: fit-content;

    padding: 0.75rem;
    border-radius: 6.25rem;

    background-color: var(--popup-background);

    display: inline-flex;
    align-items: center;
    gap: 0.5rem;

    text-decoration: none;
    color: var(--text-color-secondary);

    box-shadow: var(--shadow);
    transform: scale(1);
    transition: all 0.2s ease;
  }

  .back-button:hover {
    color: white;
    transform: scale(1.1);
    box-shadow: 
      0 25px 50px rgba(0, 0, 0, 0.1),
      0 10px 10px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
  }

  .back-button-icon {
    font-family: 'Material Symbols Outlined';
    font-size: 1.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;

    color: var(--text-color-secondary);
  }

  .back-button-label {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.375rem;

    font-size: 1rem;
    font-weight: bold;
    color: var(--text-color);
  }

  .back-button-favicon {
    width: 1.5rem;
    height: 1.5rem;
  }


  .projects-hero-container {
    display: flex;
    flex-direction: column;
    gap: 0;

    min-height: 75vh;
    height: auto;

    justify-content: center;
  }

  .projects-intro {
    max-width: 44rem;
    margin: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color, #333);
  }
  
  .projects-intro p {
    margin-bottom: 1rem;
    font-weight: 500;

    background: var(--hero-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    background-clip: text;
    color: transparent;
  }

  .projects-hero-title {
    font-size: 4rem;
    background: var(--hero-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  
    position: relative;
    display: inline-block;

    margin-top: 7rem;
    margin-bottom: 0.5rem;
  }

.projects-hero-icons-container {
  position: relative;
  width: 100%;
  height: 18.75rem;
  min-height: 18.75rem;
  overflow: visible;
}

.projects-page-hero-profile-picture {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(0deg);

  width: 12.5rem;
  height: 12.5rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 
    0 69px 19px rgba(0,0,0,0),
    0 44px 18px rgba(0, 0, 0, 0.01),
    0 25px 15px rgba(0, 0, 0, 0.05),
    0 11px 11px rgba(0, 0, 0, 0.09),
    0 3px 6px rgba(0, 0, 0, 0.10);
  max-width: 100%;

  /* Prevent any pointer interaction on the image itself */
  pointer-events: none;
  
  /* Prevent long-press menus on iOS / Safari */
  -webkit-touch-callout: none;

  /* Prevent image dragging */
  -webkit-user-drag: none;
  user-drag: none;

  /* Prevent selection */
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 500px) {
  .projects-page-hero-profile-picture {
    width: 10rem;
    height: 10rem;
  }
}


/* Icons to use in the Hero section of the Projects page */

/* Common base for all hero icons */
.projects-hero-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
  opacity: 0;
  filter: blur(12px);

  /* Prevent any pointer interaction on the image itself */
  pointer-events: none;
  
  /* Prevent long-press menus on iOS / Safari */
  -webkit-touch-callout: none;

  /* Prevent image dragging */
  -webkit-user-drag: none;
  user-drag: none;

  /* Prevent selection */
  user-select: none;
  -webkit-user-select: none;
}

.projects-hero-icons-container.animate .projects-hero-icon {
  top: var(--final-top);
  left: var(--final-left);
  right: var(--final-right); /* if used */
  opacity: 1;
  transform: scale(1) rotate(var(--rotation, 0deg));
  transition: all 1s cubic-bezier(0.25, 1, 0.5, 1);
  filter: blur(0);
}

/* Size modifiers */
.projects-hero-icon.large {
  width: 7.5rem;
  height: 7.5rem;
}

.projects-hero-icon.medium {
  width: 5.5rem;
  height: 5.5rem;
}

.projects-hero-icon.small {
  width: 3rem;
  height: 3rem;
}

/* Position slots */
.projects-hero-icon:nth-child(1) { --final-top: 6%;  --final-left: 8%;  }
.projects-hero-icon:nth-child(2) { --final-top: 12%; --final-right: 12%; }
.projects-hero-icon:nth-child(3) { --final-top: 50%; --final-left: 25%; }
.projects-hero-icon:nth-child(4) { --final-top: 45%; --final-right: 10%; }
.projects-hero-icon:nth-child(5) { --final-top: 85%; --final-left: 65%; }
.projects-hero-icon:nth-child(6) { --final-top: 60%; --final-left: 10%; }
.projects-hero-icon:nth-child(7) { --final-top: 15%; --final-right: 35%; }
.projects-hero-icon:nth-child(8) { --final-top: 70%; --final-right: 15%; }
.projects-hero-icon:nth-child(9) { --final-top: 82%; --final-left: 25%; }

/* Post pop-in animation */
.projects-hero-icon.floating {
  animation: floatAround 6s infinite ease-in-out;
}

@keyframes floatAround {
  0%   { transform: translate(0, 0) rotate(var(--rotation)); }
  25%  { transform: translate(5px, -10px) rotate(calc(var(--rotation) + 3deg)); }
  50%  { transform: translate(-5px, 10px) rotate(calc(var(--rotation) - 2deg)); }
  75%  { transform: translate(8px, 5px) rotate(calc(var(--rotation) + 1deg)); }
  100% { transform: translate(0, 0) rotate(var(--rotation)); }
}

/* Projects Grid */
.projects-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;

  width: 100%;

  padding: 1.25rem;
  box-sizing: border-box;
}

.project-grid-card {
  border-radius: 1.5rem;
  box-sizing: border-box;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: all ease 0.3s;

  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;

  cursor: pointer;
}

/* Light mode variant (default) */
@media (prefers-color-scheme: light) {
  .project-grid-card {
    background: radial-gradient(
      circle at top right,
      color-mix(in srgb, var(--accent-color) 60%, var(--popup-background) 40%) 0%,
      color-mix(in srgb, var(--accent-color) 15%, var(--popup-background) 85%) 60%,
      var(--popup-background) 100%
    );
  }
}

/* Dark mode variant */
@media (prefers-color-scheme: dark) {
  .project-grid-card {
    background: radial-gradient(
      circle at top right,
      color-mix(in srgb, var(--accent-color) 100%,var(--popup-background) 0%) 0%,
      color-mix(in srgb, var(--accent-color) 25%, var(--popup-background) 75%) 60%,
      var(--popup-background) 100%
    );
  }
}

.project-grid-card:hover {
  transform: scale(1.05);
}

.project-card-icon {
  width: 7.5rem;
  height: 7.5rem;
  object-fit: contain;

  /* Prevent any pointer interaction on the image itself */
  pointer-events: none;
  
  /* Prevent long-press menus on iOS / Safari */
  -webkit-touch-callout: none;

  /* Prevent image dragging */
  -webkit-user-drag: none;
  user-drag: none;

  /* Prevent selection */
  user-select: none;
  -webkit-user-select: none;
}

.project-card-title {
  font-size: 1.125rem;
  margin: 0;
  padding: 0;
}

.project-type-container {
  display: inline-flex;
  gap: 0.25rem;

  align-items: center;
  justify-self: baseline;
}

.project-type-icon {
  font-family: 'Material Symbols Outlined';
  font-size: 0.875rem;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0.75;
}

.project-type-text {
  font-size: 0.875rem;
  opacity: 0.75;
}

.degree-badge-container {
  padding: 0.25rem 1rem;
  display: inline-block;
  border-radius: 9999px;

  width: fit-content;

  margin-left: auto;
  margin-right: auto;

  opacity: 0.7;
}

.bachelor-badge {
  background: var(--bachelor-badge);
}

.master-badge {
  background: var(--master-badge)
}

.degree-badge-text {
  font-size: 0.875rem;
  font-weight: bold;
  margin: 0;
}

.bachelor-text {
  color: var(--bachelor-text);
}

.master-text {
  color: var(--master-text);
}

.project-card-details-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  margin-top: -0.625rem;
}

/* Expanded state */
.project-grid-card.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 80vw;
  height: 80vh;

  z-index: 999;
  border-radius: 1.5rem;
  transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  height: 100dvh;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;

  display: none;
}

.popup-overlay.active {
  opacity: 1;
  pointer-events: auto;
  height: 100vh;
  z-index: 1;

  transition: all 0.3s;

  display: block;
}

.popup-content {
  padding: 2rem;
  font-size: 1.1rem;
}

.popup-button {
  display: inline-block;
  margin: 0.5rem 1rem 0 0;
  padding: 0.6rem 1.2rem;
  background: var(--accent-color, #007aff);
  color: #fff;
  border-radius: 0.5rem;
  text-decoration: none;
}

.popup-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease, transform 0.2s ease;
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.85);

}

.popup-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

.project-popup-icon {
  width: 10rem;
  height: 10rem;
  object-fit: contain;

  /* Prevent any pointer interaction on the image itself */
  pointer-events: none;
  
  /* Prevent long-press menus on iOS / Safari */
  -webkit-touch-callout: none;

  /* Prevent image dragging */
  -webkit-user-drag: none;
  user-drag: none;

  /* Prevent selection */
  user-select: none;
  -webkit-user-select: none;
}

.project-popup-title-container {
  display: flex;
  flex-direction: column;
  gap: 0;

  justify-content: center;
  align-items: center;
}

.project-popup-title-container > h1 {
  margin: 0;
  padding: 0;
}

.project-popup-skill-pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;

  margin: 1.25rem;
  height: fit-content;

  justify-content: center;
}

.project-popup-description {
  text-align: left;
  margin: 0;
}

.project-skill-text {
  font-weight: bold;
  font-size: 0.75rem;
}

.project-skill-icon {
  font-family: 'Material Symbols Outlined';
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.popup-new {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 95vh;
}

.github-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background-color: rgba(30, 30, 30, 0.08);
  border-radius: 9999px;
  text-decoration: none;
  font-weight: 600;
  color: #24292f;

  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.github-badge:hover {
  transform: scale(1.1);
  background-color: rgba(30, 30, 30, 0.15);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.open-button-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background-color: rgba(0, 122, 255, 0.75); /* blue-stained glass */
  color: white;
  font-weight: 600;
  text-decoration: none;
  border-radius: 9999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.open-button-badge:hover {
  background-color: rgba(0, 122, 255, 0.85);
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}

.open-button-badge:active {
  transform: scale(1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Icon inside the badge */
.open-button-badge .button-icon {
  width: 1.4rem;
  height: 1.4rem;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 0.2s ease;
}

.open-button-badge:hover .button-icon {
  transform: translateX(3px); /* subtle right movement */
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .open-button-badge {
    background-color: rgba(10, 132, 255, 0.75); /* slightly muted blue for dark mode */
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  }
  .open-button-badge:hover {
    background-color: rgba(10, 132, 255, 0.85);
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
  }
  .open-button-badge .button-icon {
    stroke: white;
  }
}

.github-icon {
  width: 1.4rem;
  height: 1.4rem;
  color: #24292f;
}

.open-button-icon {
  width: 1.4rem;
  height: 1.4rem;
  color: #fff;
}

.github-text {
  font-size: 0.9rem;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .github-badge {
      background-color: rgba(255, 255, 255, 0.08);
      color: #fff;
  }
  .github-badge:hover {
      background-color: rgba(255, 255, 255, 0.15);
  }
  .github-icon {
      color: #fff;
  }
}

.project-popup-buttons-container {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  justify-content: center;
  gap: 0.75rem;
}

.project-exam-couse {
  font-size: 1rem;
  font-weight: bold;
  opacity: 0.75;

  margin: 0;
}

.project-university-details-container {
  display: flex;
  flex-direction: column;

  gap: 0.5rem;
}