/* --- CSS VARIABLES --- */
:root {
  --bg-color: #ffffff;
  --card-bg: #f8f9fa;
  --text-color: #1a1a1a;
  --text-muted: #666666;
  --accent-color: #000000;
  --border-color: #e5e7eb;
  --header-bg: rgba(255, 255, 255, 0.95);
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  --transition: all 0.3s ease-in-out;
}

body.dark-mode {
  --bg-color: #111111;
  --card-bg: #1f1f1f;
  --text-color: #ffffff;
  --text-muted: #a0a0a0;
  --accent-color: #ffffff;
  --border-color: #333333;
  --header-bg: rgba(17, 17, 17, 0.95);
  --shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  text-decoration: none;
  list-style: none;
  scroll-behavior: smooth;
}

a, button, .play-btn, #theme-toggle, #menu-icon {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
.skill-item:focus-visible {
  outline: 3px solid #4f8cff;
  outline-offset: 3px;
}

.is-magnetic {
  transform: translate3d(var(--magnet-x, 0), var(--magnet-y, 0), 0);
}


body {
  font-family: "Poppins", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
}


.cursor-glow {
  --cursor-x: 50vw;
  --cursor-y: 50vh;
  position: fixed;
  left: var(--cursor-x);
  top: var(--cursor-y);
  width: 260px;
  height: 260px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 126, 179, 0.18), rgba(142, 68, 173, 0.08) 42%, transparent 70%);
  mix-blend-mode: screen;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cursor-glow.is-visible {
  opacity: 1;
}

.cursor-trail {
  --trail-x: 50vw;
  --trail-y: 50vh;
  --trail-size: 8px;
  --trail-alpha: 0.5;
  position: fixed;
  left: var(--trail-x);
  top: var(--trail-y);
  width: var(--trail-size);
  height: var(--trail-size);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #ff7eb3, #8e44ad, #4facfe);
  box-shadow: 0 0 18px rgba(255, 126, 179, 0.45);
  opacity: 0;
  mix-blend-mode: screen;
  z-index: 10000;
  transition: opacity 0.18s ease;
}

.cursor-trail.is-visible {
  opacity: var(--trail-alpha);
}

.cursor-spark {
  position: fixed;
  left: var(--spark-x);
  top: var(--spark-y);
  width: var(--spark-size);
  height: var(--spark-size);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  background: color-mix(in srgb, var(--accent-color) 40%, #ff7eb3);
  box-shadow: 0 0 14px rgba(255, 126, 179, 0.6);
  z-index: 10000;
  animation: cursorSpark 0.75s ease-out forwards;
}

@keyframes cursorSpark {
  from {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--spark-dx)), calc(-50% + var(--spark-dy))) scale(0.2);
  }
}

body.project-page-transition::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(255, 126, 179, 0.14), transparent 42%);
  opacity: 0;
  z-index: 9998;
  animation: pagePulse 0.55s ease-out;
}

@keyframes pagePulse {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
  45% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.04);
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* --- HEADER --- */
header {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 15px 8%;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  border-bottom: 1px solid var(--border-color);
}

.logo {

  font-family: 'Montserrat', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-color);
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

#language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

#language-toggle:hover {
  border-color: var(--accent-color);
  color: var(--text-color);
}

#language-toggle .lang-active {
  color: var(--text-color);
  font-weight: 800;
}

.navbar a {
  font-size: 14px;
  color: var(--text-color);
  margin-left: 25px;
  font-weight: 500;
  transition: var(--transition);
}

.navbar a:hover,
.navbar a.active {
  color: var(--text-muted);
}



#menu-icon {
  font-size: 22px;
  color: var(--text-color);
  display: none;
  cursor: pointer;
}

/* --- SECTIONS --- */
section {
  padding: 80px 8% 40px;
  overflow: hidden;
}

.heading {

  font-family: 'Montserrat', sans-serif;
  font-size: 32px;
  margin-bottom: 40px;
  font-weight: 700;
  position: relative;
  display: inline-block;
  letter-spacing: -1px;
}

.heading::after {
  content: '';
  position: absolute;
  width: 40%;
  height: 3px;
  background: var(--accent-color);
  bottom: -5px;
  left: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.heading.heading-in-view::after,
.heading.active::after {
  transform: scaleX(1);
}

/* --- HERO --- */
.unified-hero {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  position: relative;
  isolation: isolate;
}

.hero-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.hero-particles span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-color) 35%, transparent);
  opacity: 0.28;
  animation: particleFloat var(--duration) ease-in-out var(--delay) infinite alternate;
}

@keyframes particleFloat {
  from {
    transform: translate3d(-10px, 8px, 0) scale(0.8);
    opacity: 0.12;
  }
  to {
    transform: translate3d(18px, -22px, 0) scale(1.25);
    opacity: 0.38;
  }
}

.hero-text {
  flex: 1;
}

.hero-reveal {
  opacity: 0;
  transform: translateY(16px);
}

body.hero-ready .hero-reveal {
  animation: heroReveal 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--reveal-delay, 0ms);
}

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

@keyframes mobileAvatarEntrance {
  from {
    opacity: 0;
    transform: translate3d(-42px, 0, 0) scale(.96);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes mobileHeaderEntrance {
  from {
    opacity: 0;
    transform: translate3d(0, -24px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes mobileHeroContentEntrance {
  from {
    opacity: 0;
    transform: translate3d(24px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.hero-text h1 {

  font-family: 'Montserrat', sans-serif;
  font-size: 48px;
  font-weight: 800;
  margin: 10px 0;
  line-height: 1.1;
  letter-spacing: -1px;
}

.bio {
  margin: 15px 0 25px;
  color: var(--text-muted);
  font-size: 15px;
}

/* AVATAR */
.hero-img {
  flex: 0.8;
  display: flex;
  justify-content: center;
}

.hero-img img {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  transition: transform 0.4s ease, filter 0.3s ease;
}

.hero-img img:hover {
  transform: scale(1.1);
  border-color: var(--accent-color);
}

/* --- PROJECTS --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  justify-content: center;
}

.project-card {
  background: var(--card-bg);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  max-width: 300px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
}

.project-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--glow-x, 50%) var(--glow-y, 50%), rgba(255, 126, 179, 0.22), transparent 38%);
  transition: opacity 0.25s ease;
}

.project-thumb {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 12px;
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-color);
  box-shadow: var(--shadow);
}

.project-card.is-tilting {
  transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) translateY(-6px);
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.14);
}

.project-card.is-tilting::before {
  opacity: 1;
}

.project-card.project-launching {
  animation: projectLaunch 0.55s ease-out;
}

@keyframes projectLaunch {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(0.97);
  }
  100% {
    transform: scale(1.02);
  }
}

.project-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
  filter: grayscale(20%);
  display: block;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.project-card:hover img {
  filter: grayscale(0%);
  transform: scale(1.04);
}

.project-featured {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.project-card.featured-card {
  border-color: transparent;
  background:
    linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
    linear-gradient(120deg, #ff7eb3, #8e44ad, #4facfe, #ff7eb3) border-box;
  background-size: 100% 100%, 300% 300%;
  animation: featuredBorder 8s linear infinite;
}

@keyframes featuredBorder {
  to {
    background-position: 0 0, 300% 0;
  }
}

.project-info h4 {
  font-size: 18px;
  margin-bottom: 5px;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
}

.project-tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 14px;
}

.project-tech {
  padding: 4px 9px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.project-btn {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}

.project-btn:hover {
  border-bottom: 1px solid var(--accent-color);
  gap: 5px;
}

.project-btn i {
  margin-left: 5px;
  font-size: 11px;
  transition: transform 0.3s;
}

.project-btn:hover i {
  transform: translateX(3px);
}

/* --- SKILLS --- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 20px;
  text-align: center;
}

.skill-item {
  background: var(--card-bg);
  padding: 20px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative; /* for tooltip */
}

.skill-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  background: var(--bg-color);
}

.skill-item i {
  font-size: 40px;
  transition: transform 0.3s;
}

.skill-item:hover i {
  transform: scale(1.1);
}

.skill-item span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color);
}

/* --- TIMELINE --- */
.timeline-container {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  border-left: 2px solid var(--border-color);
  padding-left: 30px;
}

.timeline-item {
  position: relative;
  margin-bottom: 30px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -37px;
  top: 5px;
  width: 12px;
  height: 12px;
  background: var(--bg-color);
  border: 2px solid var(--accent-color);
  border-radius: 50%;
}

.time-stamp {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
  margin-bottom: 5px;
}

.timeline-content h3 {
  font-size: 16px;
  margin-bottom: 3px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
}

.timeline-content p {
  font-size: 14px;
  color: var(--text-muted);
}

/* --- STUDY MATERIAL --- */
.study-banner {
  background: var(--card-bg);
  padding: 40px;
  text-align: center;
  border-radius: 15px;
  border: 1px solid var(--border-color);
  max-width: 600px;
  margin: 0 auto;
}

.study-banner h2 {
  font-size: 24px;
  margin-bottom: 10px;
  font-family: 'Montserrat', sans-serif;
}

.study-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 30px;
  background: var(--accent-color);
  color: var(--bg-color);
  border-radius: 50px;
  font-weight: 600;
  transition: var(--transition);
  border: 2px solid var(--accent-color);
  font-size: 14px;
}

.study-btn:hover {
  background: transparent;
  color: var(--accent-color);
}

#skills {
  overflow-x: clip;
}

.skills-grid.skills-marquee {
  --skills-gap: 20px;
  display: flex;
  width: max-content;
  max-width: none;
  gap: var(--skills-gap);
  animation: skillsMarquee 24s linear infinite;
  will-change: transform;
}

@media (hover: hover) {
  .skills-grid.skills-marquee:hover {
    animation-play-state: paused;
  }
}

.skills-grid.skills-marquee .skill-item {
  width: clamp(132px, 11vw, 170px);
  min-width: clamp(132px, 11vw, 170px);
}

@keyframes skillsMarquee {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(calc(-50% - (var(--skills-gap) / 2)), 0, 0); }
}

/* --- FOREVER CLOCK --- */
.forever-clock {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 920;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background:
    linear-gradient(color-mix(in srgb, var(--card-bg) 88%, transparent), color-mix(in srgb, var(--card-bg) 88%, transparent)) padding-box,
    linear-gradient(135deg, rgba(255, 126, 179, 0.65), rgba(142, 68, 173, 0.65), rgba(79, 172, 254, 0.65)) border-box;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
  max-width: 100%;
  transform: translateY(0);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
}

.forever-clock:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, #ff7eb3 60%, var(--border-color));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
}

.forever-clock:focus-visible {
  outline: 3px solid rgba(255, 126, 179, 0.35);
  outline-offset: 4px;
}

.clock-face {
  position: relative;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  flex: 0 0 auto;
  background:
    radial-gradient(circle at 50% 50%, var(--card-bg) 0 57%, transparent 58%),
    conic-gradient(from 0deg, #ff7eb3, #8e44ad, #4facfe, #ff7eb3);
  box-shadow:
    inset 0 0 0 5px var(--bg-color),
    0 10px 24px rgba(0, 0, 0, 0.12);
}

.clock-face::before {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--accent-color) 28%, transparent);
}

.clock-mark {
  position: absolute;
  color: var(--text-muted);
  font-family: 'Montserrat', sans-serif;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}

.mark-12 {
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
}

.mark-3 {
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.mark-6 {
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
}

.mark-9 {
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.clock-hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  border-radius: 999px;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(0deg);
}

.hour-hand {
  width: 4px;
  height: 18px;
  background: var(--text-color);
}

.minute-hand {
  width: 3px;
  height: 24px;
  background: var(--text-muted);
}

.second-hand {
  width: 2px;
  height: 28px;
  background: #ff7eb3;
  box-shadow: 0 0 10px rgba(255, 126, 179, 0.7);
}

.clock-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff7eb3, #8e44ad);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px var(--card-bg);
}

.clock-orbit {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #ff7eb3;
  border-right-color: rgba(79, 172, 254, 0.85);
  animation: foreverClockOrbit 1.8s linear infinite;
}

@keyframes foreverClockOrbit {
  to {
    transform: rotate(360deg);
  }
}

.clock-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.clock-label {
  color: #ff7eb3;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
}

.clock-copy strong {
  color: var(--text-color);
  font-family: 'Montserrat', sans-serif;
  font-size: 17px;
  line-height: 1.15;
  white-space: nowrap;
}

.clock-copy span:last-child {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.clock-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 14px);
  width: 260px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--border-color) 70%, #ff7eb3);
  border-radius: 16px;
  background: color-mix(in srgb, var(--card-bg) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.96);
  transform-origin: bottom left;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.clock-panel::after {
  content: '';
  position: absolute;
  left: 30px;
  top: 100%;
  width: 14px;
  height: 14px;
  background: color-mix(in srgb, var(--card-bg) 92%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--border-color) 70%, #ff7eb3);
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 70%, #ff7eb3);
  transform: translateY(-7px) rotate(45deg);
}

.forever-clock.panel-open .clock-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.clock-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--text-color);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 800;
}

.clock-panel-head button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--bg-color);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: var(--transition);
}

.clock-panel-head button:hover {
  color: var(--text-color);
  border-color: #ff7eb3;
}

.clock-panel-note {
  margin-bottom: 10px;
  padding: 10px 11px;
  border-radius: 12px;
  border-left: 3px solid #ff7eb3;
  background: color-mix(in srgb, #ff7eb3 12%, transparent);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.clock-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border-color);
}

.clock-panel-row span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.clock-panel-row strong {
  color: var(--text-color);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

/* --- FOOTER --- */
footer {
  padding: 40px 10%;
  background: var(--card-bg);
  text-align: center;
  border-top: 1px solid var(--border-color);
  margin-top: 50px;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
}

.social-link {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 18px;
  transition: var(--transition);
}

.social-link:hover {
  background: var(--accent-color);
  color: var(--bg-color);
  border-color: var(--accent-color);
  transform: translateY(-3px);
}

footer p {
  color: var(--text-muted);
  font-size: 13px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .unified-hero {
    flex-direction: column-reverse;
    text-align: center;
    gap: 1.5rem;
    padding-top: 100px;
    min-height: auto;
  }

  .hero-img img {
    width: 220px;
    height: 220px;
  }

  .hero-text h1 {
    font-size: 34px;
    line-height: 1.2;
  }

  .heading {
    font-size: 26px;
    margin-bottom: 25px;
  }

  .bio {
    font-size: 14px;
  }

  .navbar {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-color);
    flex-direction: column;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
  }

  .navbar a {
    margin: 5px 0;
    padding: 12px;
    font-size: 16px;
    text-align: center;
    display: block;
    width: 100%;
  }

  .navbar.active {
    display: flex;
  }

  #menu-icon {
    display: block;
  }

  section {
    padding: 50px 5% 30px;
  }
}


/* ANIMATION CLASSES */
.animate-scroll {
  opacity: 0;
  transition: all 1s ease-out;
  transition-delay: var(--scroll-delay, 0ms);
  filter: blur(5px);
  will-change: opacity, transform, filter;
}

.from-left {
  transform: translateX(-50px);
}

.from-right {
  transform: translateX(50px);
}

.from-bottom {
  transform: translateY(50px);
}

.from-top {
  transform: translateY(-30px);
}

.animate-scroll.active {
  opacity: 1;
  transform: translate(0, 0);
  filter: blur(0);
}

/* === CSS MUSIC WIDGET (BẢN TO & RÕ CHỮ) === */
.music-widget {
  /* Tăng độ đậm nền để chữ nổi hơn (kính mờ tối màu) */
  background: rgba(20, 20, 20, 0.7);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  /* Hỗ trợ Safari */

  /* Viền sáng hơn chút để tạo khối */
  border: 1px solid rgba(255, 255, 255, 0.15);

  /* Bo tròn & Kích thước to hơn */
  border-radius: 60px;
  padding: 15px 25px;
  /* Tăng khoảng cách lề */

  display: flex;
  align-items: center;
  width: fit-content;
  min-width: 380px;
  /* Kéo dài chiều ngang ra */
  max-width: 100%;
  margin-bottom: 35px;

  /* Đổ bóng đậm hơn để widget "bay" lên khỏi nền */
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.music-widget:hover {
  background: rgba(30, 30, 30, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-3px);
}

/* Ảnh bìa (To hơn) */
.album-wrapper {
  width: 70px;
  /* Tăng từ 55px -> 70px */
  height: 70px;
  margin-right: 20px;
  flex-shrink: 0;
  position: relative;
}

.cover {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.2);

  /* Animation xoay */
  animation: rotateCover 10s linear infinite;
  animation-play-state: paused;
}

.music-widget.playing .cover {
  animation-play-state: running;
}

@keyframes rotateCover {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Phần chữ (Chỉnh lại cho rõ) */
.info {
  flex-grow: 1;
  padding-right: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.music-widget .tag {
  font-size: 10px;
  /* To hơn xíu */
  font-weight: 800;
  color: #ff7eb3;
  /* Màu hồng neon */
  letter-spacing: 1.5px;
  margin-bottom: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 126, 179, 0.4);
  /* Phát sáng nhẹ */
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.music-visualizer {
  display: inline-flex;
  align-items: end;
  gap: 2px;
  height: 12px;
}

.music-visualizer span {
  width: 3px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.45;
  transform-origin: bottom;
}

.music-widget.playing .music-visualizer span {
  animation: visualizerBeat 0.8s ease-in-out infinite;
}

.music-widget.playing .music-visualizer span:nth-child(2) {
  animation-delay: 0.12s;
}

.music-widget.playing .music-visualizer span:nth-child(3) {
  animation-delay: 0.24s;
}

.music-widget.playing .music-visualizer span:nth-child(4) {
  animation-delay: 0.36s;
}

@keyframes visualizerBeat {
  0%, 100% {
    transform: scaleY(0.55);
    opacity: 0.45;
  }
  50% {
    transform: scaleY(1.8);
    opacity: 1;
  }
}

.music-widget .title {
  font-size: 16px;
  /* Tăng cỡ chữ tên bài hát */
  font-weight: 700;
  color: #ffffff;
  /* Trắng tinh */
  margin: 0 0 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  /* Thêm bóng đen dưới chữ để nổi bần bật trên nền bất kỳ */
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.music-widget .artist {
  font-size: 12px;
  color: #e0e0e0;
  /* Xám sáng hơn để dễ đọc */
  font-weight: 500;
}

/* --- NÚT PLAY (To hơn & Cute) --- */
.play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #ff7eb3 0%, #8e44ad 100%);
  box-shadow: 0 5px 15px rgba(255, 117, 140, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex-shrink: 0;
}

/* --- MUSIC CONTROLS --- */
.controls-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.prev-btn, .next-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.prev-btn:hover, .next-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
  border-color: #ff7eb3;
}

.play-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 25px rgba(255, 117, 140, 0.7);
}

.play-btn:active {
  transform: scale(0.95);
}

.icon-play {
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 16px solid #fff;
  /* Icon to hơn */
  margin-left: 5px;
}

.icon-pause {
  width: 14px;
  height: 18px;
  border-left: 5px solid #fff;
  border-right: 5px solid #fff;
  display: none;
}

.music-widget.playing .icon-play {
  display: none;
}

.music-widget.playing .icon-pause {
  display: block;
}

/* Mobile */
@media (max-width: 768px) {
  .music-widget {
    min-width: unset;
    width: 100%;
    border-radius: 25px;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .album-wrapper {
    width: 55px;
    height: 55px;
    margin-right: 15px;
  }

  .music-widget .title {
    max-width: 140px;
    font-size: 14px;
  }

  .music-widget .artist {
    font-size: 11px;
  }

  .play-btn {
    width: 45px;
    height: 45px;
  }

  .prev-btn, .next-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .controls-wrapper {
    gap: 8px;
  }

  .icon-play {
    border-left: 14px solid #fff;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
  }
}

/* ============================================================
   NEW FEATURES
   ============================================================ */

/* --- DARK / LIGHT MODE TOGGLE --- */
#theme-toggle {
  cursor: pointer;
  width: 44px;
  height: 24px;
  background: var(--border-color);
  border-radius: 50px;
  position: relative;
  transition: background 0.3s;
  flex-shrink: 0;
}

#theme-toggle::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--text-color);
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.3s, background 0.3s;
}

body.dark-mode #theme-toggle {
  background: #555;
}

body.dark-mode #theme-toggle::after {
  transform: translateX(20px);
}

/* toggle icon inside */
#theme-toggle i {
  position: absolute;
  font-size: 11px;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.3s;
  pointer-events: none;
}
#theme-toggle .icon-sun { right: 5px; opacity: 1; color: #f5a623; }
#theme-toggle .icon-moon { left: 5px; opacity: 0; color: #fff; }

body.dark-mode #theme-toggle .icon-sun { opacity: 0; }
body.dark-mode #theme-toggle .icon-moon { opacity: 1; }

/* --- SCROLL TO TOP BUTTON --- */
#scroll-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-color);
  color: var(--bg-color);
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

#scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
}

#scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* --- PROJECT FILTER TABS --- */
.project-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-btn {
  padding: 6px 18px;
  border-radius: 50px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Poppins', sans-serif;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent-color);
  color: var(--bg-color);
  border-color: var(--accent-color);
}

.project-card.hidden {
  display: none;
}

.project-count {
  min-height: 20px;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

/* --- VISITOR COUNTER --- */
.visitor-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

/* --- COPY EMAIL BUTTON --- */
.copy-email-btn {
  background: none;
  cursor: pointer;
  color: var(--text-color);
  font-size: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}

.copy-email-btn:hover {
  background: var(--accent-color);
  color: var(--bg-color);
  border-color: var(--accent-color);
  transform: translateY(-3px);
}

.copy-email-btn .tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: var(--accent-color);
  color: var(--bg-color);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  font-family: 'Poppins', sans-serif;
}

.copy-email-btn.copied .tooltip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ============================================================
   NEW FEATURES V2
   ============================================================ */

/* --- READING PROGRESS BAR --- */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #ff7eb3, #8e44ad);
  z-index: 9999;
  transition: width 0.1s linear;
}

/* --- TYPING CURSOR --- */
.typing-cursor {
  display: inline-block;
  animation: blink 0.7s step-end infinite;
  font-weight: 300;
  opacity: 0.7;
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* --- PROJECT SEARCH BOX --- */
.project-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  max-width: 340px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  padding: 8px 18px;
  transition: var(--transition);
}

.clear-search-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: var(--transition);
}

.clear-search-btn.visible {
  display: flex;
}

.clear-search-btn:hover {
  background: var(--border-color);
  color: var(--text-color);
}

.project-search-wrap:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.07);
}

.project-search-wrap i {
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
}

#projectSearch {
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  color: var(--text-color);
  width: 100%;
}

#projectSearch::placeholder {
  color: var(--text-muted);
}

.project-empty-state {
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  background: var(--card-bg);
}

.project-empty-state i {
  font-size: 34px;
  margin-bottom: 12px;
}

.project-empty-state h3 {
  color: var(--text-color);
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  margin-bottom: 6px;
}

.project-empty-state p {
  font-size: 13px;
}

.skill-item::before {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  background: var(--accent-color);
  color: var(--bg-color);
  font-size: 11px;
  font-family: 'Poppins', sans-serif;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}

.skill-item:hover::before,
.skill-item:focus-visible::before,
.skill-item.tip-active::before {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ============================================================
   MOBILE OPTIMIZATION (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* --- Hero H1: typing text xuống dòng riêng, không tràn --- */
  .hero-text h1 {
    font-size: 28px;
    line-height: 1.3;
    word-break: break-word;
  }

  .hero-text h1 .typing-cursor {
    display: inline;
  }

  /* --- Avatar nhỏ hơn chút --- */
  .hero-img img {
    width: 180px;
    height: 180px;
  }

  /* --- Project Search: full width --- */
  .project-search-wrap {
    max-width: 100%;
  }

  /* --- Project Filters: scroll ngang không wrap --- */
  .project-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .project-filters::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    flex-shrink: 0;
    padding: 7px 16px;
  }

  /* --- Scroll to Top: nhỏ hơn, xa edge hơn để không đè cử chỉ iOS --- */
  #scroll-top {
    bottom: 20px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 15px;
  }

  /* --- Skill tooltip: dùng :active thay :hover cho touch --- */
  .skill-item:active::before,
  .skill-item.tip-active::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }

  /* --- Tooltip vị trí: đảm bảo không bị cắt bởi edge screen --- */
  .skill-item::before {
    font-size: 10px;
    padding: 4px 10px;
    bottom: calc(100% + 6px);
  }

  /* --- Timeline: giảm padding --- */
  .timeline-container {
    padding-left: 20px;
  }

  .timeline-item::before {
    left: -27px;
  }

  /* --- Study banner: padding nhỏ hơn --- */
  .study-banner {
    padding: 24px 20px;
  }

  .forever-clock {
    display: none;
  }

  /* --- Footer social icons: to hơn cho ngón tay --- */
  .social-link,
  .copy-email-btn {
    width: 46px;
    height: 46px;
    font-size: 20px;
  }

  /* --- Visitor badge: wrap text --- */
  .visitor-badge {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }

  /* --- Disable blur animation trên mobile (tiết kiệm pin + smoother) --- */
  .animate-scroll {
    filter: none !important;
  }

  /* --- Reading progress: dày thêm chút trên touch --- */
  #reading-progress {
    height: 4px;
  }

  /* --- Section padding --- */
  section {
    padding: 60px 4% 30px;
  }
}

/* ============================================================
   SMALL PHONE (max-width: 400px)
   ============================================================ */
@media (max-width: 400px) {
  .hero-text h1 {
    font-size: 24px;
  }

  .logo {
    font-size: 18px;
  }

  .music-widget .title {
    max-width: 110px;
    font-size: 13px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .social-icons {
    gap: 12px;
  }
}

body .is-magnetic {
  transform: translate3d(var(--magnet-x, 0), var(--magnet-y, 0), 0);
}

@media (max-width: 768px) {
  .cursor-glow,
  .cursor-trail,
  .cursor-spark {
    display: none !important;
  }

  .hero-particles span {
    opacity: 0.18;
  }

  .project-card,
  .project-card:hover,
  .project-card.is-tilting {
    transform: none;
  }

  .project-card::before {
    display: none;
  }

  .project-card {
    max-width: 100%;
    border-radius: 10px;
  }

  .project-thumb,
  .project-card img {
    border-radius: 7px;
  }

  .project-tech-list {
    gap: 5px;
  }

  .music-visualizer {
    height: 10px;
  }

  body .is-magnetic {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .hero-particles,
  .cursor-glow {
    display: none !important;
  }
}

/* Hero actions */
.hero-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-cta .study-btn,
.hero-outline-btn {
  min-height: 44px;
  padding: 10px 20px;
  font-size: 13px;
}

.hero-outline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  background: var(--card-bg);
  font-weight: 600;
  transition: var(--transition);
}

.hero-outline-btn:hover {
  color: var(--bg-color);
  background: var(--accent-color);
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

@media (max-width: 480px) {
  .hero-cta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-cta .study-btn,
  .hero-outline-btn {
    width: 100%;
  }
}

/* Compact professional profile hero */
.profile-hero {
  min-height: auto;
  padding-top: 145px;
  padding-bottom: 85px;
  justify-content: flex-start;
  gap: 300px;
  width: min(1500px, 100%);
  margin-inline: auto;
  align-items: center;
}

.profile-hero .hero-img {
  flex: 0 0 auto;
}

.profile-hero .hero-img img {
  width: 290px;
  height: 290px;
  border-radius: 14px;
  filter: none;
}

.profile-hero .hero-img img:hover {
  transform: translateY(-3px);
}

.profile-hero .hero-text {
  flex: 1;
  max-width: 850px;
  min-width: 0;
}

.profile-role {
  margin-bottom: 3px;
  color: var(--text-muted);
  font-family: "Montserrat", sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

.profile-hero .hero-text h1 {
  margin: 0;
  font-size: clamp(36px, 4vw, 58px);
  line-height: 1.05;
  white-space: nowrap;
}

.profile-hero .bio {
  max-width: 820px;
  margin: 13px 0 18px;
  font-size: 14px;
  line-height: 1.75;
}

.profile-bottom,
.profile-tags,
.profile-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.profile-bottom {
  align-items: flex-start;
  flex-direction: column;
  gap: 14px;
}
.profile-tags { gap: 7px; }

.profile-tags span {
  padding: 4px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 10px;
  font-weight: 700;
}

.profile-divider { display: none; }

.profile-links { gap: 15px; }

@media (min-width: 769px) {
  .profile-links { margin-left: 0; }
}

@media (min-width: 769px) and (max-width: 1200px) {
  .profile-hero { gap: 120px; }
}

.profile-links a {
  color: var(--text-color);
  font-size: 11px;
  font-weight: 700;
  transition: var(--transition);
}

.profile-links a:hover {
  color: var(--text-muted);
  transform: translateY(-2px);
}

.profile-links i { margin-right: 4px; }

.credibility-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
}

.credibility-list b { color: var(--text-color); }
.credibility-list i { margin-right: 5px; }

.projects-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.project-card { max-width: none; }

.project-card img { height: 125px; }
.project-info h4 { font-size: 15px; }
.project-tech-list { margin: 8px 0 10px; }
.project-tech { padding: 4px 7px; font-size: 9px; }

.project-placeholder {
  height: 125px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--card-bg), var(--bg-color));
  color: var(--text-muted);
  text-align: center;
  font-weight: 700;
}

.project-placeholder i { font-size: 30px; }

.case-study {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.case-study p {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
}

.case-study strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text-color);
  font-size: 9px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.project-summary {
  min-height: 44px;
  margin: 9px 0 12px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.case-link { color: var(--text-color); }

.project-links {
  display: flex;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.credentials-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.credential-card {
  position: relative;
  padding: 24px 24px 24px 68px;
  border: 1px solid var(--border-color);
  border-radius: 13px;
  background: var(--card-bg);
}

.credential-card > i {
  position: absolute;
  top: 24px;
  left: 24px;
  font-size: 24px;
  color: var(--text-muted);
}

.credential-card span { color: var(--text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.credential-card h3 { margin: 5px 0; font: 700 15px Montserrat, sans-serif; }
.credential-card p { color: var(--text-muted); font-size: 11px; }

@media (min-width: 769px) and (max-width: 1100px) {
  .projects-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .profile-hero {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding-top: 110px;
    gap: 24px;
  }

  .profile-hero .hero-img img {
    width: 165px;
    height: 165px;
  }

  .profile-hero .hero-text h1 {
    font-size: clamp(32px, 10vw, 44px);
    white-space: normal;
  }

  .profile-bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .profile-divider { display: none; }
  .profile-links { gap: 12px 16px; }
  .profile-links { margin-left: 0; }
  .projects-grid { grid-template-columns: 1fr; }
  .credentials-grid { grid-template-columns: 1fr; }
}

/* Mobile-first polish: compact, touch-friendly and low-cost motion */
@media (max-width: 768px) {
  html {
    scroll-padding-top: 82px;
    -webkit-text-size-adjust: 100%;
  }

  body {
    overflow-x: clip;
  }

  body.menu-open {
    overflow: hidden;
  }

  header {
    top: 10px;
    width: calc(100% - 20px);
    min-height: 58px;
    padding: 8px 10px 8px 16px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .1);
  }

  .logo {
    max-width: 42vw;
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-right {
    gap: 6px;
  }

  #language-toggle,
  #theme-toggle,
  #menu-icon {
    min-width: 42px;
    min-height: 42px;
    margin: 0;
    border: 0;
  }

  #language-toggle {
    width: auto;
    padding-inline: 7px;
    font-size: 11px;
  }

  #menu-icon {
    display: inline-grid;
    place-items: center;
    color: var(--text-color);
    background: transparent;
    font-size: 18px;
    cursor: pointer;
  }

  .navbar {
    position: fixed;
    inset: 78px 10px auto;
    display: grid;
    gap: 4px;
    max-height: calc(100dvh - 94px);
    padding: 10px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: color-mix(in srgb, var(--card-bg) 94%, transparent);
    box-shadow: 0 22px 55px rgba(0, 0, 0, .2);
    opacity: 0;
    transform: translateY(-10px) scale(.98);
    pointer-events: none;
    visibility: hidden;
    backdrop-filter: blur(18px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
  }

  .navbar.active {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    visibility: visible;
  }

  .navbar a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 15px;
    border-radius: 11px;
    font-size: 14px;
  }

  .navbar a.active {
    background: var(--text-color);
    color: var(--bg-color);
  }

  section {
    width: 100%;
    padding: 64px 18px 24px;
  }

  .profile-hero {
    gap: 20px;
    min-height: auto;
    padding: 104px 18px 36px;
  }

  .profile-hero .hero-img img {
    width: clamp(138px, 42vw, 176px);
    height: clamp(138px, 42vw, 176px);
    border-radius: 18px;
    box-shadow: 0 16px 38px rgba(0, 0, 0, .14);
  }

  .profile-role {
    font-size: 10px;
    line-height: 1.45;
  }

  .profile-hero .hero-text h1 {
    margin-top: 4px;
    font-size: clamp(31px, 9.5vw, 42px);
    letter-spacing: -1.5px;
  }

  .profile-hero .bio {
    margin: 12px 0 16px;
    font-size: 14px;
    line-height: 1.65;
  }

  .profile-tags {
    gap: 7px;
  }

  .profile-tags span {
    min-height: 30px;
    padding: 6px 10px;
  }

  .profile-links {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .profile-links a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 11px;
    background: var(--card-bg);
    font-size: 11px;
  }

  .profile-links a:first-child {
    background: var(--text-color);
    color: var(--bg-color);
  }

  .credibility-list {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 16px;
    font-size: 11px;
  }

  .credibility-list > span {
    display: flex;
    align-items: center;
    min-height: 36px;
  }

  .heading {
    margin-bottom: 24px;
    font-size: clamp(25px, 8vw, 34px);
    letter-spacing: -1px;
  }

  .project-search-wrap {
    width: 100%;
    min-height: 48px;
    border-radius: 13px;
  }

  .project-search-wrap input {
    font-size: 16px;
  }

  .project-filters {
    width: calc(100% + 36px);
    margin-inline: -18px;
    padding: 2px 18px 10px;
    scroll-padding-inline: 18px;
  }

  .filter-btn {
    min-height: 42px;
    padding: 0 15px;
    border-radius: 999px;
    scroll-snap-align: start;
  }

  .projects-grid {
    gap: 14px;
  }

  .project-card {
    border-radius: 16px;
    content-visibility: auto;
    contain-intrinsic-size: 560px;
  }

  .project-card img,
  .project-placeholder {
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
  }

  .project-info {
    padding: 16px;
  }

  .project-info h4 {
    font-size: 17px;
    line-height: 1.35;
  }

  .project-summary {
    min-height: 0;
    font-size: 12px;
  }

  .case-study p {
    font-size: 11px;
  }

  .project-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .project-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 11px;
  }

  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .skills-grid.skills-marquee {
    --skills-gap: 10px;
    display: flex;
    gap: var(--skills-gap);
    animation-duration: 28s;
    contain: layout style;
    backface-visibility: hidden;
    perspective: 1000px;
  }

  .skills-grid.skills-marquee .skill-item {
    width: 132px;
    min-width: 132px;
    backface-visibility: hidden;
    transition: background-color .25s ease, box-shadow .25s ease;
  }

  .skills-grid.skills-marquee .skill-item i {
    transition: transform .25s cubic-bezier(.2, .8, .2, 1), filter .25s ease;
  }

  .skills-grid.skills-marquee .skill-item:active {
    background: var(--bg-color);
    box-shadow: var(--shadow);
  }

  .skills-grid.skills-marquee .skill-item:active i,
  .skills-grid.skills-marquee .skill-item.tip-active i {
    animation: none;
    filter: drop-shadow(0 5px 8px rgba(0, 0, 0, .18));
    transform: translateY(-5px) scale(1.16) rotate(-4deg);
  }

  .skill-item {
    min-height: 110px;
    border-radius: 14px;
  }

  .timeline-container {
    padding-left: 22px;
  }

  .timeline-item {
    margin-bottom: 28px;
    padding-left: 18px;
  }

  .credential-card,
  .study-banner {
    border-radius: 16px;
  }

  .study-banner {
    padding: 28px 20px;
  }

  .study-btn {
    position: relative;
    justify-content: center;
    width: 100%;
    min-height: 48px;
  }

  #study .study-btn i {
    position: absolute;
    right: 18px;
    margin-left: 0 !important;
  }

  #scroll-top {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 46px;
    height: 46px;
  }

  .animate-scroll {
    --scroll-delay: 0ms;
    opacity: 1;
    filter: none;
    transform: none !important;
    transition: none !important;
    will-change: auto;
  }

  .animate-scroll.active {
    opacity: 1;
    transform: translate3d(0, 0, 0) !important;
  }

  /* Skills stay as a stable two-column grid on touch screens. Individual
     reveal transforms can otherwise leave the whole row invisible. */
  .skills-grid.animate-scroll,
  .skills-grid .skill-item.animate-scroll {
    opacity: 1;
    filter: none;
    transform: none !important;
    transition: background-color .25s ease, box-shadow .25s ease !important;
  }

  /* Animate only the header and hero. Sections below remain immediately visible. */
  header.animate-scroll {
    animation: mobileHeaderEntrance .9s cubic-bezier(.16, 1, .3, 1) both;
  }

  .profile-hero .hero-img img {
    animation: mobileAvatarEntrance .9s .12s cubic-bezier(.16, 1, .3, 1) both;
  }

  .profile-hero .hero-text > * {
    animation: mobileHeroContentEntrance .9s cubic-bezier(.16, 1, .3, 1) both;
  }

  .profile-hero .hero-text > :nth-child(1) { animation-delay: .2s; }
  .profile-hero .hero-text > :nth-child(2) { animation-delay: .27s; }
  .profile-hero .hero-text > :nth-child(3) { animation-delay: .34s; }
  .profile-hero .hero-text > :nth-child(4) { animation-delay: .41s; }
  .profile-hero .hero-text > :nth-child(5) { animation-delay: .48s; }

  #projects .animate-scroll,
  #skills .animate-scroll,
  #timeline .animate-scroll,
  #credentials .animate-scroll,
  #study .animate-scroll,
  footer.animate-scroll {
    animation: none;
  }

  .profile-hero .hero-img.animate-scroll.from-left {
    transform: none !important;
  }

  .profile-hero .hero-text.animate-scroll.from-right {
    transform: none !important;
  }

  .profile-hero .hero-img.animate-scroll.active,
  .profile-hero .hero-text.animate-scroll.active {
    transform: translate3d(0, 0, 0) !important;
  }

}

@media (max-width: 380px) {
  .logo { max-width: 34vw; }
  .profile-links { grid-template-columns: 1fr; }
  .credential-card { padding: 20px 18px 20px 58px; }
  .credential-card > i { left: 19px; }
}

@media (hover: none) and (pointer: coarse) {
  a:active,
  button:active,
  .project-card:active,
  .skill-item:active {
    transform: scale(.98);
  }
}

/* Consistent theme switch after converting the control to a semantic button */
#theme-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: inline-block;
  position: relative;
  width: 52px;
  min-width: 52px;
  height: 32px;
  min-height: 32px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  vertical-align: middle;
  border: 1px solid color-mix(in srgb, var(--text-color) 20%, transparent);
  border-radius: 999px;
  background: var(--border-color);
  box-shadow: none;
}

#theme-toggle::after {
  top: 3px;
  left: 3px;
  z-index: 2;
  width: 24px;
  height: 24px;
}

body.dark-mode #theme-toggle::after {
  transform: translateX(20px);
}

#theme-toggle i {
  z-index: 1;
  font-size: 12px;
}

#theme-toggle .icon-sun { right: 7px; }
#theme-toggle .icon-moon { left: 7px; }

/* Mobile overflow fix: project reveal transforms must never widen the page */
@media (max-width: 768px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  #projects,
  #study,
  footer,
  .projects-grid,
  .project-card,
  .project-thumb,
  .project-info,
  .project-links,
  .study-banner {
    min-width: 0;
    max-width: 100%;
  }

  #projects,
  #study {
    overflow-x: hidden;
  }

  .projects-grid {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
  }

  .project-card,
  .project-card:hover,
  .project-card.is-tilting {
    width: 100%;
    margin-inline: 0;
    filter: none;
    will-change: auto;
  }

  .project-card.animate-scroll {
    transform: none !important;
  }

  .project-card.animate-scroll.active {
    transform: translate3d(0, 0, 0) !important;
  }

  .project-thumb,
  .project-card img,
  .project-placeholder {
    width: 100%;
  }

  .project-card img {
    object-position: center center;
  }

  .project-info,
  .project-info h4,
  .project-summary,
  .case-study p {
    overflow-wrap: anywhere;
  }

  .project-links {
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr));
  }

  .project-btn:only-child {
    grid-column: 1 / -1;
  }

  #study {
    display: flex;
    justify-content: center;
  }

  .study-banner {
    width: min(100%, 600px);
    margin-inline: auto;
    transform: none !important;
  }

  footer {
    overflow: hidden;
    padding-inline: 18px;
  }

  footer p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}


