html {
  scroll-behavior: smooth;
}
:root {
  color-scheme: light dark;

  /* Formatted for single-variable usage */
  --bg: #f5f7fa;
  --text: #1a1a1a;
  --accent: #0066cc;
  --secondary: #4da6ff;
  --border: #e0e0e0;

  /* Performance-friendly animation easing */
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  --transition-base: 0.3s var(--ease-out);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark mode overrides */
    --bg: #0a0e27;
    --text: #e8eef5;
    --accent: #4da6ff;
    --secondary: #1e2749;
    --border: #1e2749;
  }
}

.back-to-top {
  position: fixed;
  bottom: 0.25rem;
  right: center;
  padding: 0.75rem 1.25rem;
  background-color: var(--bg);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.8;
  transition:
    opacity var(--transition-base),
    transform var(--transition-base);
}
.back-to-top img {
  width: 20px;
  height: 20px;
  font-weight: 900;
}
.back-to-top:hover {
  opacity: 1;
  transform: translateY(-4px);
}

/* 1. Modern Minimal Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 2. Base Document Styles */
body {
  background-color: var(--bg);
  color: var(--text);
  /* System font stack = 0 network load time */
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color var(--transition-base),
    color var(--transition-base);
}

/* Base Image Styles */
img,
picture,
svg {
  display: block;
  max-width: 100%;
}

/* SVG Dark Mode Inversion Magic! */
@media (prefers-color-scheme: dark) {
  .social-links img,
  .Titleicon img,
  .skills img,
  .timeline-header img,
  .back-to-top img,
  .course-list img {
    /* Perfectly flips black pixels to white pixels */
    filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg)
      brightness(200%) contrast(100%);
  }

  /* Make sure your profile picture does NOT invert! */
  .profile-pic {
    filter: none;
  }
}

/* 3. Typography */
h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
}
h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
  max-width: 65ch; /* Optimal reading character width */
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--transition-base);
}

a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* 4. Layout & Section Boxes */
body {
  padding: 1rem 0.5rem;
  /* Flex layout to easily center our section boxes */
  display: flex;
  flex-direction: column;
  align-items: center;
}

.Introduction,
section {
  width: 100%;
  max-width: 1200px;
  margin-bottom: 2rem;
  padding: 2rem;
  /* Uses a native CSS color-mix to create a faux "surface" color slightly lighter/darker than the background */
  background-color: color-mix(in srgb, var(--bg) 96%, var(--text) 4%);
  border: 1px solid var(--border);
  border-radius: 12px;

  /* Preps the hardware-accelerated transitions */
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base);
}

/* Performant hover effect */
.Introduction:hover,
section:hover {
  transform: translateY(-4px); /* Moves it up slightly */
  box-shadow: 0 12px 24px -10px
    color-mix(in srgb, var(--accent) 30%, transparent 70%); /* Subtle accent glow shadow */
  border-color: var(--accent);
}

/* 5. Introduction & Profile Layout */
.intro-header {
  display: flex;
  align-items: center;
  gap: 2rem;
}

/* Make it responsive: stack on small screens */
@media (max-width: 768px) {
  .intro-header {
    flex-direction: column;
    text-align: center;
  }
}

.profile-pic {
  width: 150px;
  height: 150px;
  flex-shrink: 0;
  border-radius: 50%; /* Absolute circle */
  object-fit: cover; /* Ensures image isn't distorted */
  border: 3px solid var(--accent);
  box-shadow: 0 8px 16px -4px
    color-mix(in srgb, var(--accent) 30%, transparent 70%);
}

.title-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap; /* Allows smooth wrapping if the screen gets tight */
}

@media (max-width: 768px) {
  .title-row {
    justify-content: center;
  }
}

.title-row h1 {
  margin-bottom: 0; /* Remove bottom margin to align with social links */
}

.social-links {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: color-mix(
    in srgb,
    var(--bg) 90%,
    var(--text) 10%
  ); /* Subtle background for icons */
  transition:
    transform var(--transition-base),
    background-color var(--transition-base);
}

.social-links img {
  width: 25px;
  height: 25px;
}

.social-links a:hover {
  transform: translateY(-4px) scale(1.05);
  background-color: color-mix(in srgb, var(--accent) 20%, var(--bg) 80%);
}

.about-container,
.education-container,
.journey-container {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.about-text,
.education-text,
.journey-text {
  flex: 1;
}

.AboutMe img,
.Journey img,
.Education img {
  width: 100%;
  max-width: 350px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}

/* Ensure it stacks vertically on smaller screens */
@media (max-width: 768px) {
  .about-container,
  .education-container,
  .journey-container {
    flex-direction: column;
    text-align: center;
  }
}

/* Education Course List */
.course-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
}

.course-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background-color: color-mix(in srgb, var(--bg) 92%, var(--text) 8%);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base);
}

.course-list li:hover {
  transform: translateX(6px); /* A subtle slide-right effect on hover */
  box-shadow: 0 4px 12px -4px
    color-mix(in srgb, var(--accent) 40%, transparent 60%);
  border-color: var(--accent);
}

.course-list li img {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
}

/* 6. Skills Grid (Auto-sizing!) */
.skills h2,
.skills p {
  margin-top: 2rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.skills ul {
  display: grid;
  /* The magic auto-grid formula: creates as many columns as fit, scaling dynamically! */
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  list-style: none; /* Removes the default bullet points */
  padding: 0;
  margin: 0;
}

.skills li {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Puts name on left, icon on right */
  padding: 0.75rem 1.25rem;
  background-color: color-mix(in srgb, var(--bg) 92%, var(--text) 8%);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base);
}

.skills li:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px -4px
    color-mix(in srgb, var(--accent) 40%, transparent 60%);
  border-color: var(--accent);
}

.skills li img {
  width: 48px;
  height: 44px;
  object-fit: contain;
}

/* 7. Journey Timeline */
.Journey h2 {
  margin-bottom: 1.5rem;
  margin-top: 2rem;
}

.timeline-shell {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.5rem 0 1rem;
  /* JS drives animation; smooth behavior here causes choppy double-easing in WebKit. */
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--accent)
    color-mix(in srgb, var(--bg) 88%, var(--text) 12%);
}

.timeline-shell::-webkit-scrollbar {
  height: 10px;
}

.timeline-shell::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--bg) 88%, var(--text) 12%);
  border-radius: 999px;
}

.timeline-shell::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 999px;
}

.timeline-track {
  display: grid;
  grid-template-columns: repeat(6, minmax(300px, 1fr));
  gap: 1rem;
  min-width: 1200px;
  padding-top: 2.25rem;
}

.timeline-card {
  position: relative;
  display: block;
  background-color: color-mix(in srgb, var(--bg) 92%, var(--text) 8%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem;
  min-height: 190px;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--accent)
    color-mix(in srgb, var(--bg) 88%, var(--text) 12%);
  box-shadow: 0 6px 16px -10px
    color-mix(in srgb, var(--text) 40%, transparent 60%);
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base),
    min-height var(--transition-base);
}

.timeline-card > summary {
  list-style: none;
  cursor: pointer;
}

.timeline-card > summary::-webkit-details-marker {
  display: none;
}

.timeline-card > summary::marker {
  content: "";
}

.timeline-card::before {
  content: "";
  position: absolute;
  top: -1.35rem;
  left: 0.3rem;
  right: 0.3rem;
  height: 3px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 70%, transparent 30%),
    color-mix(in srgb, var(--accent) 25%, transparent 75%)
  );
  border-radius: 999px;
}

.timeline-year {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.timeline-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}
.timeline-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  align-content: center;
}
.header-icon {
  width: 50px;
  height: 50px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}
.timeline-summary {
  display: block;
  position: relative;
  padding-right: 2rem;
  margin-bottom: 0;
  border-bottom: none;
  max-width: unset;
}

.timeline-summary::after {
  content: "";
  position: absolute;
  top: 0.3rem;
  right: 0.25rem;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transform-origin: center;
  transition: transform var(--transition-base);
}

.timeline-card[open] .timeline-summary::after {
  transform: rotate(-135deg);
}

.timeline-summary-text {
  margin-bottom: 0;
  border-bottom: none;
  max-width: unset;
}

.timeline-details {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  border-bottom: none;
  transition:
    opacity var(--transition-base),
    max-height var(--transition-base),
    margin-top var(--transition-base);
}
.timeline-card:hover,
.timeline-card:focus-within {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -12px
    color-mix(in srgb, var(--accent) 35%, transparent 65%);
}

.timeline-card[open] {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -10px
    color-mix(in srgb, var(--accent) 40%, transparent 60%);
  min-height: 245px;
  overflow-y: auto;
}
.timeline-card[open] .timeline-details {
  opacity: 1;
  max-height: 140px;
  margin-top: 0.75rem;
}

.timeline-card:not([open]) .timeline-details {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
}

@media (max-width: 780px),
  ((max-width: 1024px) and (hover: none) and (pointer: coarse)) {
  .timeline-shell {
    overflow-x: visible;
    padding-bottom: 0;
  }

  .timeline-track {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 0;
  }

  .timeline-card {
    min-height: auto;
    padding-top: 1.5rem;
    overflow-y: hidden;
  }

  .timeline-card::before {
    top: 0.65rem;
    left: 1rem;
    right: 1rem;
  }

  .timeline-year {
    top: 0.2rem;
    left: 1rem;
  }

  .timeline-card:hover,
  .timeline-card:focus-within {
    min-height: auto;
    transform: none;
    box-shadow: 0 6px 16px -10px
      color-mix(in srgb, var(--text) 40%, transparent 60%);
    border-color: var(--border);
    overflow-y: hidden;
  }

  .timeline-card[open] {
    min-height: auto;
    transform: none;
    box-shadow: 0 6px 16px -10px
      color-mix(in srgb, var(--text) 40%, transparent 60%);
    border-color: var(--accent);
    overflow-y: hidden;
  }

  .timeline-details {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
  }

  .timeline-card[open] .timeline-details {
    opacity: 1;
    max-height: 500px;
    margin-top: 0.6rem;
  }
}

/*Github calendar styling */

/* Container styling */
.github-calendar {
  padding: 1rem;
  border-radius: 12px;
  width: 100%;
  margin: 0 auto;
}
.github-calendar h2 {
  margin-bottom: 1rem;
}
.github-calendar p {
  margin-bottom: 1.5rem;
  max-width: 100ch;
  border-bottom: 3px solid var(--border);
  padding-bottom: 0.5rem;
}

.github-calendar:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px
    color-mix(in srgb, var(--accent) 40%, transparent 60%);
  border-color: var(--accent);
}

.calendar-img {
  width: 100%;
  height: auto;
  margin-top: 1rem;
}
/* 7. Projects Grid */
.Projects h2 {
  margin-bottom: 0.5rem;
}
.Projects p {
  margin-bottom: 1.5rem;
  max-width: 100ch;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.project-list {
  display: grid;
  /* Bumps up the minimum width so cards don't get too squished before wrapping */
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  background-color: color-mix(in srgb, var(--bg) 92%, var(--text) 8%);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden; /* Clips the top corners of the image perfectly */
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base);
}
.Titleicon {
  display: flex;

  gap: 0.75rem;
}

.Titleicon img {
  width: 25px;
  height: 25px;
  object-fit: contain;
}
.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px -8px
    color-mix(in srgb, var(--accent) 40%, transparent 60%);
  border-color: var(--accent);
}

.project-img {
  width: 100%;
  height: 180px;
  object-fit: cover; /* Prevents screenshot distortion */
  background-color: color-mix(
    in srgb,
    var(--bg) 80%,
    var(--text) 20%
  ); /* Fallback color before images load/exist */
  border-bottom: 1px solid var(--border);
}

/* Modifier for vertical/mobile screenshots */
.project-img.mobile {
  object-fit: contain;
  padding: 0.2rem; /* Little bit of padding so it doesn't touch the top/bottom edges */
}

.project-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1; /* Pushes the button links to the bottom if text lengths are uneven! */
}

.body-text {
  max-width: 100ch;
  max-height: 10.5em; /* Roughly 4 lines of text */
  overflow-y: auto;
  border-bottom: 5px solid var(--border);
}
.project-content h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.project-content p {
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.project-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: -0.5rem; /* Pulls up the buttons a bit to visually connect with the content above */
}

.project-links a {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background-color: transparent;
  color: var(--text);
  text-align: center;
  flex: 1; /* Makes buttons equal width */
  transition:
    background-color var(--transition-base),
    color var(--transition-base),
    transform var(--transition-base);
}

.project-links a:hover {
  background-color: var(--accent);
  color: #fff; /* White text looks best on pure accent color */
  text-decoration: none; /* overrides default underline */
  transform: translateY(-2px);
}

.Feedback h2 {
  margin-bottom: 0.5rem;
}
.Feedback p {
  max-width: 150ch;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}
.Feedback p a {
  color: var(--accent);
  font-weight: 600;
}
.Feedback p a:hover {
  text-decoration: underline;
}
