:root {
  --bg-body: #050505;
  --bg-card: rgba(30, 30, 30, 0.35);
  --bg-card-rgb: 30, 30, 30;
  --header-height: 60px;
  --border-color: rgba(255, 255, 255, 0.12);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
  --primary: #3b82f6;
  --accent: #06b6d4;
  --text-main: #ededed;
  --text-secondary: #a1a1aa;
  --tag-bg: rgba(255, 255, 255, 0.03);
  --tag-border: rgba(255, 255, 255, 0.1);
  --gradient-title-start: #fff;
  --gradient-title-end: #94a3b8;
  --glow-opacity: 0.55;
  --card-blur: 24px;
  --font-heading: "Google Sans", sans-serif;
  --font-body: "Montserrat", sans-serif;
  --radius: 16px;
}

[data-theme="light"] {
  --bg-body: #f0f2f5;
  --bg-card: rgba(255, 255, 255, 0.45);
  --bg-card-rgb: 255, 255, 255;
  --border-color: rgba(255, 255, 255, 0.8);
  --shadow-card: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --text-main: #1e293b;
  --text-secondary: #475569;
  --gradient-title-start: #0f172a;
  --gradient-title-end: #334155;
  --glow-opacity: 0.5;
  --card-blur: 20px;
  --tag-bg: rgba(255, 255, 255, 0.6);
  --tag-border: rgba(255, 255, 255, 0.9);
}

/* Flash prevention: Target everything */
.no-transition,
.no-transition * {
  transition: none !important;
}

/* Ensure theme is applied before any rendering */
html:not([data-theme]) {
  opacity: 0;
}

html[data-theme] {
  opacity: 1;
}

.glow-1 {
  top: -120px;
  left: -120px;
  background: #2563eb;
}

.glow-2 {
  bottom: -50px;
  right: -120px;
  background: #0891b2;
}

[data-theme="light"] .glow-1 {
  background: #3b82f6;
  filter: blur(140px);
}

[data-theme="light"] .glow-2 {
  background: #06b6d4;
  filter: blur(140px);
}

[data-theme="light"] .credentials {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-body);
}

body {
  width: 100%;
  overflow-x: hidden;
  background-color: transparent;
  color: var(--text-main);
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  transition: color 0.15s ease;
}

.glow {
  position: fixed;
  width: 450px;
  height: 450px;
  border-radius: 50%;
  filter: blur(130px);
  opacity: var(--glow-opacity);
  transition:
    opacity 0.5s ease,
    background 0.5s ease;
  z-index: 0;
  pointer-events: none;
}

button::-moz-focus-inner {
  border: 0;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.fade-in {
  display: block;
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- UNIVERSAL REVEAL ANIMATION --- */
.reveal,
.card.reveal {
  opacity: 0;
  transform: translateY(30px);

  transition:
    opacity 0.8s ease-out,
    transform 0.8s ease-out;
  will-change: opacity, transform;
}

.reveal.active,
.card.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.container {
  width: 100%;
  max-width: 900px;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.hero-section {
  position: relative;
  margin-bottom: 60px;
}

.profile-header {
  display: flex;
  gap: 30px;
  align-items: center;
}

.avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  background: var(--bg-card);
}

.no-copy {
  user-select: none;
  -ms-user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

.hero-content h1 {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  line-height: 1.1;
  margin-bottom: 12px;
  background: linear-gradient(
    to right,
    var(--gradient-title-start),
    var(--gradient-title-end)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.credentials {
  display: inline-block;
  margin-bottom: 16px;
  padding: 4px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.4px;
  color: var(--text-main);
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  backdrop-filter: blur(5px);
}

.credentials span {
  color: var(--accent);
  font-weight: 600;
}

.role {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.institution {
  display: block;
  font-size: 0.95rem;
  color: var(--text-secondary);
  opacity: 0.8;
  margin-top: 4px;
}

.social-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 15px;
  border-radius: 10px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 1rem;
}

.btn-glass {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: all 0.3s ease;
}

[data-theme="light"] .btn-glass {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.btn-glass:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.btn-glass.linkedin {
  border-color: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

[data-theme="light"] .btn-glass.linkedin {
  color: #0077b5;
}

.btn-glass.linkedin:hover {
  background: #0077b5;
  border-color: #0077b5;
  color: #fff;
}

.btn-glass.github {
  border-color: rgba(255, 255, 255, 0.2);
  color: #a1a1aa;
}

[data-theme="light"] .btn-glass.github {
  color: #333;
}

.btn-glass.github:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
  color: #fff;
}

[data-theme="light"] .btn-glass.github:hover {
  background: #333;
  border-color: #333;
  color: #fff;
}

/* --- THEME TOGGLE (Desktop) --- */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  width: 45px !important;
  height: 45px;
  border-radius: 50%;
  background: transparent !important;
  backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}
.theme-toggle:active {
  transform: scale(0.95);
}

.theme-icon {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  width: fit-content;
  height: fit-content;
  font-size: 1.1rem;
  opacity: 0;
  transform: rotate(90deg) scale(0);
  transition:
    opacity 0.3s ease,
    transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Light Mode: Sun rotates to 0 (upright) */
[data-theme="light"] .theme-icon[data-icon="sun"] {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Light Mode: Moon rotates away to 90 degrees */
[data-theme="light"] .theme-icon[data-icon="moon"] {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

/* Dark Mode: Moon rotates to 0 (upright) */
[data-theme="dark"] .theme-icon[data-icon="moon"] {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Dark Mode: Sun rotates away to 90 degrees */
[data-theme="dark"] .theme-icon[data-icon="sun"] {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

.mobile-toggle-wrapper {
  position: relative;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
}
#mobile-theme-toggle {
  cursor: pointer;
}

#footer-theme-btn.btn-glass-sm {
  height: 40px;
  padding: 0 16px;
  border-radius: 50px;
  background: transparent !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  color: var(--text-main);
  cursor: pointer;
  font-family: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.footer-theme-wrapper {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-theme-wrapper .theme-icon {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  width: auto;
  height: auto;
  line-height: 24px;
}

/* --- ACTIVE STATE (Touch Feedback) --- */
#footer-theme-btn.btn-glass-sm:active {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(0.96);
  transition: transform 0.1s;
}

@media (hover: hover) {
  #footer-theme-btn.btn-glass-sm:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.5);
  }
}

.bento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 40px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition:
    transform 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
  will-change: transform;
}

.card:hover {
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.5);
  cursor: pointer;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--text-main);
}

.icon-accent {
  color: var(--accent);
  font-size: 1.2rem;
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.4));
}

.card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.sub-text {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: auto;
}

.about-card,
.quote-card {
  grid-column: span 2;
}

.quote-card {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  font-style: italic;
}

.quote-card blockquote {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text-main);
  opacity: 0.9;
}

.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list li {
  font-size: 0.85rem;
  padding: 6px 12px;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.tag-list li:has(a.li-link) {
  padding: 0;
}

.tag-list li a.li-link {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 6px 12px;
  color: inherit;
  text-decoration: none;
}

.tag-list li:hover {
  color: var(--text-main);
  transform: translateY(-1px);
  background: rgba(59, 130, 246, 0.1);
  cursor: pointer;
}

footer {
  text-align: center;
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  position: relative;
  z-index: 1;
}

footer p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  opacity: 0.8;
}

.mobile-show {
  display: none;
}

@media (max-width: 1024px) {
  :root {
    --header-height: 60px;
  }

  .mobile-hide {
    display: none !important;
  }

  .theme-toggle.mobile-hide {
    display: none !important;
  }

  .mobile-show {
    display: block;
  }

  body {
    padding-top: var(--header-height);
  }

  .fa-spin {
    animation-duration: 1.5s;
  }

  .glass-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    padding: 0 15px;
    background: rgba(var(--bg-card-rgb), 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 2001;
  }

  .nav-content {
    width: 100%;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .mobile-branding {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .mobile-branding img {
    height: 38px;
    width: auto;
    border-radius: 6px;
  }

  .mobile-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
  }

  .mobile-brand-text span {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    color: var(--text-main);
  }

  .mobile-brand-text small {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-body);
    margin-top: 2px;
  }

  .mobile-footer-extras {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 25px;
  }

  #footer-theme-btn.btn-glass-sm {
    padding: 10px 15px;
    border-radius: 99px;
    border: 1px solid var(--border-color);
    background: rgba(var(--bg-card-rgb), 0.1);
    color: var(--text-main);
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  }

  #footer-theme-btn:active {
    transform: scale(0.95);
    background: var(--tag-bg);
  }

  /* --- Mobile Footer Button Animation --- */
  #footer-theme-btn.btn-glass-sm {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  }

  #footer-theme-btn.btn-glass-sm:active {
    transform: scale(0.96);
    background: rgba(var(--bg-card-rgb), 0.5);
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    margin-top: 10px;
  }

  .hero-content h1 {
    font-size: 2rem;
    margin-top: 15px;
  }

  .social-links {
    justify-content: center;
  }

  .bento-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .about-card,
  .quote-card {
    grid-column: span 1;
  }

  .card:hover {
    transform: none;
    box-shadow: var(--shadow-card);
  }
}
