/*===============
  global styles
===============*/

* {
  padding: 0;
  margin: 0;
  border: 0;
  outline: 0;
  background-color: inherit;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  box-shadow: none;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Poppins", sans-serif;
  line-height: 1.5;
  color: var(--clr-fg);
  background-color: var(--clr-bg);
}

.light {
  --clr-bg: #f5f7fa;
  --clr-bg-alt: #ffffff;
  --clr-fg: #333333;
  --clr-fg-alt: #222222;
  --clr-primary: #10b981;
  /* Security Green */
  --shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
}

.dark {
  --clr-bg: #0d1117;
  /* GitHub Dark Dimmed style */
  --clr-bg-alt: #161b22;
  --clr-fg: #c9d1d9;
  --clr-fg-alt: #f0f6fc;
  --clr-primary: #3fb950;
  /* Terminal Green */
  --shadow: rgba(0, 0, 0, 0.5) 0px 10px 36px 0px;
}

::-moz-selection {
  background: var(--clr-primary);
  color: var(--clr-bg);
}

::-webkit-selection,
::selection {
  background: var(--clr-primary);
  color: var(--clr-bg);
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  color: var(--clr-fg-alt);
}

h1 {
  text-align: left;
  font-size: 4rem;
  font-family: inherit;
  line-height: 1.2;
}

h2 {
  font-size: 1.5rem;
  line-height: 1.1;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.3rem;
}

ul {
  list-style-type: none;
}

a {
  text-decoration: none;
}

button {
  cursor: pointer;
}

@media (max-width: 900px) {
  h1 {
    font-size: 2.3rem;
  }
}

/*===================
  buttons and links
===================*/

.link {
  color: var(--clr-primary);
  padding: 0 0 0.3em 0;
  position: relative;
}

.link:hover {
  color: var(--clr-primary);
}

.link::before {
  content: "";
  display: inline;
  width: 0%;
  height: 0.2em;
  position: absolute;
  bottom: 0;
  background-color: var(--clr-primary);
  transition: width 0.2s ease-in;
}

.link:hover::before,
.link:focus::before {
  width: 100%;
}

.link--nav {
  color: var(--clr-fg);
  text-transform: lowercase;
  font-weight: 500;
}

.link--icon {
  color: var(--clr-fg);
  font-size: 1.2rem;
  padding: 0;
  display: flex;
  align-items: center;
}

.link--icon::before {
  display: none;
}

.project__title-link {
  color: var(--clr-fg-alt) !important;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 0.2em;
  text-underline-offset: 4px;
  text-decoration-skip-ink: none;
  transition: text-decoration-color 0.2s ease-in, color 0.2s ease-in;
  position: relative;
}

.project__title-link::before {
  display: none !important;
}

.project__title-link i {
  color: var(--clr-primary);
  font-size: 0.7em;
  margin-left: 0.5rem;
  text-decoration: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.project__title-link:hover {
  color: var(--clr-primary) !important;
  text-decoration-color: var(--clr-primary);
}

.btn {
  display: block;
  padding: 0.8em 1.4em;
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: lowercase;
  transition: transform 0.2s ease-in-out;
}

.btn--outline {
  color: var(--clr-primary);
  border: 2px solid var(--clr-primary);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn--outline:focus,
.btn--outline:hover {
  color: var(--clr-bg);
}

.btn--outline:before {
  content: "";
  position: absolute;
  background-color: var(--clr-primary);
  right: 100%;
  bottom: 0;
  left: 0;
  top: 0;
  z-index: -1;
  transition: right 0.2s ease-in-out;
}

.btn--outline:hover::before,
.btn--outline:focus::before {
  right: 0;
}

.btn--plain {
  text-transform: initial;
  background-color: var(--clr-bg-alt);
  box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 3px 0px;
  border: 0;
}

.btn--plain:hover {
  transform: translateY(-4px);
}

.btn--icon {
  padding: 0;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
}

.btn--icon:hover,
.btn--icon:focus {
  color: var(--clr-primary);
}

.btn--icon:active {
  transform: translateY(-5px);
}

/* Filter Buttons */
.filter-buttons {
  display: flex;
  justify-content: center;
  gap: 1.5em;
  /* Spacing between buttons */
  margin-bottom: 2em;
  flex-wrap: wrap;
}

.filter-btn {
  /* Inherit some base btn styles but override others if needed */
  min-width: 80px;
  text-align: center;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

.filter-btn.active {
  background-color: var(--clr-primary);
  color: var(--clr-bg);
  /* Ensure text is readable on primary color */
}

.filter-btn.active::before {
  right: 0;
  /* Make the background fill visible */
}

/* Transitions for filtering */
.project.hidden {
  display: none;
  /* simple hide for layout reflow */
}

/*========
  layout
========*/

.center {
  display: flex;
  align-items: center;
}

.header {
  height: 8em;
  max-width: 1100px;
  width: 95%;
  margin: 0 auto;
  justify-content: space-between;
  position: relative;
  z-index: 100;
}

main {
  max-width: 1100px;
  width: 95%;
  margin: 0 auto;
}

.section {
  margin-top: 5em;
}

.section__title {
  text-align: center;
  margin-bottom: 1em;
  text-transform: uppercase;
}

/* Obsolete nav list rules removed */
.nav__list {
  display: none;
  /* Safely hide if anything remains */
}

.nav__icons {
  display: flex;
  gap: 1.5em;
  /* Spacing between top icons */
  align-items: center;
  /* Ensure all icons including button align vertically */
}

.nav__hamburger {
  display: none;
}

.about {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4em;
  margin: 2em auto 0;
  /* Centered horizontally, top margin maintained */
  max-width: 1000px;
  width: 100%;
  /* Ensure it takes available space up to max-width */
  margin-bottom: 0;
  /* Adjusted margin-bottom */
}

.about__content {
  position: relative;
  /* Anchor for absolute icons */
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}


.about__desc {
  font-size: 1.1rem;
  max-width: 600px;
  margin-top: 0.8em;
  /* Reduced from 1.5em */
  text-align: left;
  white-space: pre-wrap;
  position: relative;
  font-family: 'Space Mono', monospace;
}

.about__desc-ghost {
  color: transparent;
  user-select: none;
}

.about__desc-active {
  position: absolute;
  top: 0;
  left: 0;
}

.about__role {
  margin-top: 0.2em;
  font-weight: 500;
  text-align: left;
}

/* .about__contact styling removed as element is gone */

.about .link--icon {
  margin-right: 0;
  /* Remove margin in favor of gap */
  font-size: 1.8rem;
  /* Bigger icons */
}

/* Typing Cursor Animation */
.cursor {
  display: inline-block;
  color: var(--clr-primary);
  margin-left: 5px;
  animation: blink 1s infinite;
}

@keyframes blink {
  0% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.projects__grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18em, 1fr));
  grid-gap: 2em;
}

.project {
  padding: 2em;
  margin: 0 auto;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s linear;
}

/* New: Anchor tag project cards */
.project--link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.project--link:hover h3 {
  text-decoration: underline;
  text-decoration-color: var(--clr-primary);
  text-decoration-thickness: 0.2em;
  text-underline-offset: 4px;
}

.project h3 {
  margin-bottom: 0.5em;
  text-align: center;
  line-height: 1.6;
}

.project:hover {
  transform: translateY(-7px);
}

.project__description {
  margin-top: 1em;
  text-align: left;
}

.project__stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1em;
  margin-bottom: 0;
}

.project__stack-item {
  margin: 0.5em;
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--clr-fg-alt);
}

.project .link--icon {
  margin-left: 0.5em;
}

/* Skills section removed */

.contact {
  flex-direction: column;
}

.contact__links {
  display: flex;
  gap: 2.5em;
  /* Slightly more spacing for a modern look */
  margin-top: 1em;
}

.contact .link--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.contact .link--icon svg {
  width: 2.5rem;
  height: 2.5rem;
  stroke: currentColor;
}

.contact .link--icon:hover {
  transform: scale(1.1);
  /* Subtle hover effect */
}

.footer {
  padding: 3em 0;
  margin-top: 4em;
  text-align: center;
}

.footer__link {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--clr-fg);
}

.scroll-top {
  display: none;
  position: fixed;
  bottom: 1em;
  right: 2em;
  background-color: transparent;
  font-size: 1.8rem;
  transition: transform 0.2s ease-in-out;
}

@media (max-width: 600px) {
  .header {
    height: 4.5em;
    /* Reduced from 6em */
  }

  .section {
    margin-top: 4em;
  }

  .nav__list {
    display: none;
  }

  .nav__icons {
    /* Ensure they are visible and centered/spaced correctly on mobile */
    gap: 1.5em;
    /* Maintain gap */
  }

  .nav__hamburger {
    display: flex;
    margin-left: 0.8em;
  }

  .about {
    flex-direction: column;
    text-align: left;
    align-items: flex-start;
    gap: 1.5em;
    /* Restore the tighter gap for mobile */
    margin-top: 0;
    /* Remove top margin completely to pull it up to the header */
  }

  .web-cam {
    width: 220px;
    height: 220px;
    margin-bottom: 0.5em;
    /* slight breathing room */
    align-self: center;
  }

  h1 {
    text-align: left;
    font-size: 1.8rem;
  }

  .about__desc {
    text-align: left;
  }

  .about__role {
    text-align: left;
  }

  /* .about__contact styling removed as element is gone */

  .footer {
    padding: 2em;
    margin-top: 3em;
  }

  .scroll-container {
    display: none;
  }
}

/*========
  custom video
========*/

.web-cam {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  /* Fully round */
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 4px solid var(--clr-primary);
  /* Tech border */
  flex-shrink: 0;
  /* Don't shrink */
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.subsection__title {
  text-align: center;
  margin-bottom: 1em;
  font-size: 1.5rem;
  color: var(--clr-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Timeline Container */
.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}

/* The Central Vertical Line */
.timeline::after {
  content: '';
  position: absolute;
  width: 4px;
  background-color: var(--clr-primary);
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -2px;
  border-radius: 2px;
}

/* Timeline Item Container */
.timeline__item {
  padding: 0 30px;
  position: relative;
  width: 50%;
  box-sizing: border-box;
  margin-bottom: -60px;
}

.timeline__item:last-child {
  margin-bottom: 0;
}

/* Left and Right Side Positioning */
.left {
  left: 0;
}

.right {
  left: 50%;
}

/* Add circles on the timeline */
.timeline__item::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  right: -6px;
  background-color: var(--clr-primary);
  border-radius: 50%;
  top: 25px;
  z-index: 1;
  box-shadow: 0 0 0 4px var(--clr-bg), 0 0 0 6px var(--clr-primary);
}

/* Fix circle position for right items */
.right::after {
  left: -6px;
}

/* .timeline__content reuses .project styles */

/* Date styling inside timeline */
.timeline__date {
  font-weight: bold;
  color: var(--clr-primary);
  margin-bottom: 0.2em;
  font-size: 0.85rem;
}

/* Responsive Timeline Fixes */
@media screen and (max-width: 768px) {
  .timeline::after {
    left: 20px;
  }

  .timeline__item {
    width: 100%;
    padding-left: 50px;
    padding-right: 15px;
    margin-bottom: 2em;
    /* Ensure spacing between cards */
  }

  .timeline__item:last-child {
    margin-bottom: 0;
  }

  /* Reset left/right positioning */
  .left,
  .right {
    left: 0;
  }

  .timeline__item::after,
  .right::after {
    left: 16px;
  }
}

/* Sidequests Trigger */
#sidequest-trigger {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#scroll-sentinel {
  height: 80px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  font-size: 0.9rem;
  color: var(--clr-primary);
  margin-top: 1em;
}

#scroll-sentinel::after {
  content: "Pull up to learn more about me 🔑";
  animation: bounce 1.5s infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(5px);
  }
}

/* Sidequests Section */
.sidequests {
  transition: opacity 0.8s ease, max-height 0.8s ease, transform 0.8s ease;
  overflow: hidden;
  max-height: 2000px;
}

.sidequests.hidden {
  opacity: 0;
  max-height: 0;
  pointer-events: none;
  margin-top: 0;
  padding: 0;
  transform: translateY(50px);
}

.sidequests.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Sidequest Card Styles */
.sidequest-card {
  border: 2px dashed var(--clr-primary);
  background: linear-gradient(145deg, var(--clr-bg), var(--clr-bg-alt));
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s linear;
}

.sidequest-card:hover {
  transform: translateY(-5px);
  border-style: solid;
}

.sidequest-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* 
   Fix Button Hover Visibility 
   Ensure text sits ABOVE the sliding background 
*/
.btn--outline {
  z-index: 1;
  position: relative;
  /* Ensure default text color is primary */
  color: var(--clr-primary);
  background-color: transparent !important;
  /* Fix: Stop inheriting opaque background */
}

/* Explicitly target all children to ensure they sit above the ::before pseudo-element */
.btn--outline span,
.btn--outline i,
.btn--outline .unlock-text,
.btn--outline .unlock-icon {
  position: relative;
  z-index: 2;
  transition: color 0.1s ease-in-out;
  background-color: transparent !important;
  /* Fix: Text container must be transparent */
}

/* LIGHT MODE HOVER: 
   Bg becomes Green (Primary). 
   Text must be White (bg-alt or #fff) to contrast with Green. 
*/
.btn--outline:hover,
.btn--outline:hover span,
.btn--outline:hover i,
.btn--outline:active,
.btn--outline:active span,
.btn--outline:active i {
  color: #ffffff !important;
}

/* DARK MODE HOVER:
   Bg becomes Green (Primary).
   Text must be Black (or dark bg) to contrast with Green.
*/
.dark .btn--outline:hover,
.dark .btn--outline:hover span,
.dark .btn--outline:hover i,
.dark .btn--outline:active,
.dark .btn--outline:active span,
.dark .btn--outline:active i {
  color: #000000 !important;
}

/* Responsive Logic */
@media (max-width: 768px) {
  #btn-unlock {
    display: none;
  }

  #sidequest-trigger {
    min-height: 50px;
  }

  #scroll-sentinel {
    height: 50px;
    opacity: 0.5;
    font-size: 0.8rem;
  }
}

@media (min-width: 769px) {
  #scroll-sentinel {
    display: none;
  }
}