/* === Variables === */
:root {
  --primary: #4f46e5;
  --secondary: #6b7280;
  --bg: #f9fafb;
  --header-bg: #ffffff;
  --text: #111827;
  --card-bg: #ffffff;
}
[data-theme="dark"] {
  --primary: #9eb3ff;
  --secondary: #9ca3af;
  --bg: #18191f;
  --header-bg: #242731;
  --text: #d1d5db;
  --card-bg: #242731;
}

/* === Global Reset === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-padding-top: 80px;
  scroll-behavior: smooth;
}
body {
  font-family: "Poppins", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

/* === Scroll to Top Button === */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  background: rgba(79, 70, 229, 0.8);
  transform: translateY(-2px);
}

/* === Loading States === */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--primary);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* === Page Animations === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.8s ease-out;
}

section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === Header & Navigation === */
header {
  background: var(--header-bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: auto;
  padding: 1rem;
  position: relative;
}
.logo img {
  height: 32px;
  width: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.theme-toggle svg {
  width: 28px;
  height: 28px;
  display: block;
  transition: fill 0.2s;
  color: var(--primary);
}
[data-theme="dark"] .theme-toggle svg {
  color: #ffe066;
}
[data-theme="light"] .theme-toggle svg {
  color: #333;
}

/* Mobile toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
}

/* Smooth slide-down menu */
.nav-links {
  display: flex;
  gap: 1.5rem;
  flex-direction: row;
}

nav .nav-links a:hover {
  color: var(--primary) !important;
  border-bottom: 2px solid var(--primary);
}

@media (max-width: 768px) {
  .nav-links {
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg);
    overflow: hidden;
    max-height: 0;
    transform: translateY(-15px);
    opacity: 0;
    transition: max-height 0.4s ease, transform 0.3s ease-out,
      opacity 0.3s ease-out;
    padding: 0;
  }
  .nav-links.open {
    max-height: 500px;
    transform: translateY(0);
    opacity: 1;
    padding: 0.5rem 0;
  }
  .nav-links a {
    padding: 0.75rem 1.5rem;
  }
  .mobile-toggle {
    display: block;
  }
}
.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  margin-left: 1rem;
}

.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 25vh;
  text-align: center;
  padding: 0 1rem;
}
.hero h1 {
  font-size: 3rem;
  color: var(--primary);
}
.hero p {
  margin-top: 1rem;
  color: var(--secondary);
  font-size: 1.125rem;
}

/* === Sections & Layout === */
section {
  scroll-margin-top: 80px;
  max-width: 1200px;
  margin: 4rem auto;
  padding: 0 1rem;
}
.section-title {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--primary);
  text-align: left;
}

/* About */
.about-cards-container {
  display: flex;
  width: 100%;
  gap: 0.75rem;
  margin-top: 1rem;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.75rem;
  width: 60%;
}

.about-card,
.about-side-card {
  flex: 1 1 200px;
  background: var(--card-bg);
  border: 1px solid var(--secondary);
  border-radius: 0.5rem;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.about-side-card {
  width: 40%;
  min-width: 210px;
  max-width: 340px;
  justify-content: flex-start;
}

.about-card-title {
  margin-bottom: 0.5rem;
  color: var(--primary);
}
.about-grid.no-activity {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 0.75rem;
}

@media (max-width: 900px) {
  .about-cards-container {
    flex-direction: column !important;
    align-items: center !important;
    gap: 1rem !important;
  }
  .about-grid {
    width: 100% !important;
  }
  .about-side-card {
    width: 100% !important;
    max-width: 400px;
    margin: 0 auto;
    display: block !important;
  }
  .about-grid.no-activity {
    flex-wrap: wrap;
  }
}

#discord-activity {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: center;
  justify-items: start;
  padding-top: 8px;
}

.activity-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 0.7rem;
  min-height: 32px;
  width: 100%;
}

.activity-item svg {
  display: block;
  margin: 0 auto;
  width: 30px;
  height: 30px;
}

@media (max-width: 600px) {
  .about-side-card {
    padding: 0.7rem 0.3rem !important;
    min-width: 0 !important;
    max-width: 97vw !important;
  }
  .about-side-card .about-card-title {
    text-align: center;
    font-size: 1.08rem !important;
  }
  #discord-activity {
    justify-items: start;
    padding-top: 2px;
    padding-bottom: 4px;
    margin: 0 auto;
    width: 100%;
  }
  #doing-card:empty,
  #doing-card:not(:has(.activity-item)) {
    display: none !important;
  }
  .activity-item {
    grid-template-columns: 26px 1fr !important;
    gap: 0.5rem !important;
    width: 100% !important;
    min-height: 0 !important;
  }
  .activity-item svg {
    width: 21px !important;
    height: 21px !important;
  }
  .activity-item span {
    font-size: 0.95rem !important;
    line-height: 1.8;
    word-break: break-word;
  }
}

/* === Skills Section === */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.skill-category {
  background: var(--card-bg);
  border: 1px solid var(--secondary);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.skill-category h3 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.skill-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  background: var(--primary);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s;
}

.skill-tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Timeline */
.timeline {
  position: relative;
  margin: 2.5rem 0 4rem 0;
  padding-left: 45px;
  width: 100% - 68px;
}
.timeline-line {
  position: absolute;
  top: 0;
  left: 32px; /* Adjust this value until it matches the content cards/text */
  width: 4px;
  height: 100%;
  background: var(--primary);
  z-index: 0;
  border-radius: 2px;
}
.timeline-group {
  position: relative;
  margin-bottom: 3.5rem;
}
.timeline-date-bubble {
  position: static;
  display: block;
  margin-left: 10px; /* aligns with timeline line and content */
  margin-bottom: 0.7rem;
  margin-top: 0.3rem;
  font-size: 1.07rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg);
  padding: 4px 18px;
  border-radius: 1rem;
  box-shadow: 0 2px 6px #0002;
  letter-spacing: 0.03em;
  width: max-content;
}
.timeline-group .timeline-item {
  margin-bottom: 1.1rem;
  margin-left: 0;
  margin-right: 0;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s, transform 0.6s;
}
.timeline-group .timeline-item:last-child {
  margin-bottom: 0;
}
.timeline-group .timeline-item.active {
  opacity: 1;
  transform: translateY(0);
  width: 95%;
}
.timeline-content {
  background: var(--card-bg);
  padding: 1.3rem 1.7rem;
  border-radius: 1rem;
  border: 2px solid var(--secondary);
  position: relative;
  z-index: 2;
  box-shadow: 0 4px 16px #0001;
  transition: border 0.2s, box-shadow 0.2s;
  left: 10px;
}
.timeline-date {
  font-size: 0.95rem;
  color: var(--secondary);
  display: block;
  margin-bottom: 0.7rem;
}
.timeline-item.irl .timeline-content {
  border-color: #58c990;
  box-shadow: 0 4px 16px #58c99026;
}
.timeline-item.discord .timeline-content {
  border-color: #6b7bfa;
  box-shadow: 0 4px 16px #6b7bfa26;
}
.timeline-item.hide {
  display: none !important;
}
.timeline-toggle {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.7rem;
}
.toggle-btn {
  background: var(--card-bg);
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: 0.5rem 1.5rem;
  border-radius: 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.toggle-btn.active,
.toggle-btn:focus {
  background: var(--primary);
  color: #fff;
  outline: none;
}

.job-title {
  font-size: 1.17em;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text);
}
.job-company {
  font-size: 1.05em;
  font-weight: 500;
  color: var(--primary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.job-dates {
  font-size: 1em;
  color: var(--secondary);
  margin-bottom: 0px;
}
.job-duration {
  font-size: 0.95em;
  color: var(--primary);
  margin-left: 8px;
}
@media (max-width: 700px) {
  .timeline {
    padding-left: 20px;
  }
  .timeline-line {
    left: 10px;
  }
  .timeline-date-bubble {
    left: -35px;
    font-size: 0.98rem;
    padding: 2px 8px;
  }
  .timeline-content {
    padding: 1rem;
  }
}

/* Projects Grid */
.projects {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 768px) {
  .projects {
    grid-template-columns: repeat(2, 1fr);
  }
}

.project-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.project-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 600px) {
  .project-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .project-links {
    justify-content: flex-start;
  }
}

.tech-icons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.tech-icons .tooltip {
  position: relative;
  display: inline-block;
}
.tech-icons img {
  width: 32px;
  height: 32px;
  background: white;
  border-radius: 0.22rem;
  padding: 2px;
  box-shadow: 0 1px 3px #0001;
  transition: transform 0.12s;
  vertical-align: middle;
  cursor: pointer;
}
.tech-icons img:hover,
.tech-icons img:focus {
  transform: scale(1.13) rotate(-2deg);
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  width: max-content;
  background: #333;
  color: #fff;
  border-radius: 4px;
  padding: 2px 8px;
  position: absolute;
  left: 115%; /* to the right */
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.92em;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 10;
  box-shadow: 0 2px 8px #0003;
}
.tooltip:hover .tooltip-text,
.tooltip:focus .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.project-links {
  display: flex;
  justify-content: center;
}
.project-links a + a:before {
  content: "|";
  margin: 0 0.5rem;
  color: var(--secondary);
}
.project-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

/* Resume & Achievements */
.resume-section {
  padding: 2rem 1rem;
  margin-bottom: 4rem;
}
/* Button container flex */
.resume-section .buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.resume-section .buttons a {
  display: inline-block;
  padding: 0.75rem 1.8rem;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px #0003;
  transition: transform 0.2s, box-shadow 0.2s;
}

.resume-section .buttons a.primary-link {
  background: linear-gradient(135deg, #059669, #10b981);
}

.resume-section .buttons a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px #0004;
}
.cert-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 600px) {
  .cert-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.cert-group.full-width {
  grid-column: 1 / -1;
}
.cert-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}
.cert-item {
  border: 1px solid var(--secondary);
  border-radius: 0.5rem;
  padding: 1rem;
  background: var(--card-bg);
}
.cert-item h4 {
  margin-bottom: 0.5rem;
  color: var(--primary);
}
.cert-group {
  margin-bottom: 2rem;
}
.cert-group h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.contact {
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
}
.contact a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--secondary);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  transition: background 0.3s;
}
.contact a:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

@media (max-width: 768px) {
  .contact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}
@media (max-width: 850px) {
  .contact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }
}

.email-section {
  text-align: left;
  margin-bottom: 4rem;
}
.email-section a {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 0.5rem;
  transition: background 0.3s;
}
.email-section a:hover {
  background: rgba(79, 70, 229, 0.8);
}
.contact-form {
  display: flex;
  flex-direction: column;
  max-width: 600px;
  margin: 0 auto;
  gap: 1rem;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--secondary);
  border-radius: 0.5rem;
  background: var(--card-bg);
  color: var(--text);
}
.contact-form button {
  align-self: center;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.3s;
}
.contact-form button:hover {
  background: rgba(79, 70, 229, 0.8);
}
footer {
  text-align: center;
  margin: 2rem 0;
  color: var(--secondary);
}
.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.footer-left {
  color: var(--secondary);
  font-size: 1rem;
}

.footer-right {
  display: flex;
  gap: 1.2rem;
}

.footer-icon {
  width: 28px;
  height: 28px;
  vertical-align: middle;
}

/* Brand colors (non-dark/light dependent) */
.footer-icon[src*="bluesky"] {
  filter: invert(31%) sepia(98%) saturate(1200%) hue-rotate(180deg); /* #0085FF */
}
.footer-icon[src*="discord"] {
  filter: brightness(0) saturate(100%) invert(56%) sepia(74%) saturate(6335%)
    hue-rotate(224deg) brightness(96%) contrast(97%); /* #5865F2 */
}

.footer-icon[src*="linkedin"] {
  filter: invert(34%) sepia(91%) saturate(745%) hue-rotate(173deg); /* #0077B5 */
}
.footer-icon[src*="twitch"] {
  filter: brightness(0) saturate(100%) invert(40%) sepia(58%) saturate(4143%)
    hue-rotate(239deg) brightness(98%) contrast(101%); /* #8956FB */
}
.footer-icon[src*="youtube"] {
  filter: invert(16%) sepia(94%) saturate(7491%) hue-rotate(353deg); /* #FF0000 */
}

.footer-icon:hover {
  transform: scale(1.12);
}

@media (max-width: 600px) {
  .footer-content {
    flex-direction: column;
    gap: 0.7rem;
    align-items: flex-start;
  }
  .footer-right {
    gap: 0.9rem;
  }
}

.testimonials {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  justify-items: start;
}

@media (min-width: 700px) {
  .testimonials {
    grid-template-columns: repeat(2, 1fr);
  }
}

.testimonial-card {
  background: var(--card-bg);
  border: 1px solid var(--secondary);
  border-radius: 0.75rem;
  padding: 2rem 1.5rem 1.2rem 1.5rem;
  box-shadow: 0 4px 12px #0001;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.testimonial-text {
  font-style: italic;
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 1.2rem;
}

.testimonial-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.8rem; /* More space between avatar and text */
  font-size: 0.96rem;
  margin-top: 0.2rem;
}
.testimonial-meta-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.testimonial-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  box-shadow: 0 2px 6px #0002;
}

.testimonial-author {
  font-weight: 600;
  color: var(--primary);
}

.testimonial-role {
  font-style: normal;
  font-size: 0.92rem;
  color: var(--secondary);
}

/* === Call to Action Section === */
.cta-section {
  text-align: center;
}

.cta-text {
  font-size: 1.1rem;
  color: var(--secondary);
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.contact-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.cta-button {
  display: inline-block;
  padding: 0.75rem 2rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.cta-button.primary {
  background: var(--primary);
  color: white;
}

.cta-button.primary:hover {
  background: rgba(79, 70, 229, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.cta-button.secondary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.cta-button.secondary:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

@media (max-width: 600px) {
  .contact-buttons {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  .cta-button {
    width: 100%;
    max-width: 280px;
    text-align: center;
  }
}
