:root,
[data-theme="dark"] {
  --bg-primary: #080b12;
  --bg-secondary: #0f1520;
  --bg-card: #141c2b;
  --bg-card-hover: #1a2438;
  --border: rgba(148, 163, 184, 0.12);
  --border-hover: rgba(99, 102, 241, 0.4);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --cyan: #22d3ee;
  --gradient-hero: linear-gradient(135deg, #6366f1 0%, #22d3ee 100%);
  --gradient-card: linear-gradient(
    145deg,
    rgba(99, 102, 241, 0.08),
    rgba(34, 211, 238, 0.04)
  );
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px var(--accent-glow);
  --nav-bg: rgba(8, 11, 18, 0.85);
  --nav-bg-scrolled: rgba(8, 11, 18, 0.95);
  --nav-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --hero-glow-1: rgba(99, 102, 241, 0.15);
  --hero-glow-2: rgba(34, 211, 238, 0.1);
  --caption-bg: rgba(8, 11, 18, 0.9);
  --toggler-filter: invert(1);
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --nav-height: 72px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border: rgba(15, 23, 42, 0.1);
  --border-hover: rgba(79, 70, 229, 0.35);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-light: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --cyan: #0891b2;
  --gradient-hero: linear-gradient(135deg, #4f46e5 0%, #0891b2 100%);
  --gradient-card: linear-gradient(
    145deg,
    rgba(99, 102, 241, 0.06),
    rgba(8, 145, 178, 0.04)
  );
  --shadow-card: 0 4px 24px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.12);
  --nav-bg: rgba(248, 250, 252, 0.92);
  --nav-bg-scrolled: rgba(255, 255, 255, 0.98);
  --nav-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --hero-glow-1: rgba(99, 102, 241, 0.1);
  --hero-glow-2: rgba(8, 145, 178, 0.08);
  --caption-bg: rgba(255, 255, 255, 0.95);
  --toggler-filter: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  margin: 0;
  padding-top: var(--nav-height);
  -webkit-font-smoothing: antialiased;
  transition:
    background-color var(--transition),
    color var(--transition);
}

::selection {
  background: var(--accent);
  color: white;
}

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

a:hover {
  color: var(--cyan);
}

/* ── Navigation ── */
.navbar .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  height: var(--nav-height);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  transition:
    background var(--transition),
    box-shadow var(--transition);
}

.navbar-scrolled {
  background: var(--nav-bg-scrolled);
  box-shadow: var(--nav-shadow);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: 0.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition:
    border-color var(--transition),
    background var(--transition),
    transform var(--transition);
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.theme-toggle i {
  font-size: 1.05rem;
  color: var(--accent-light);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary) !important;
  letter-spacing: -0.02em;
}

.navbar-brand span {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-nav .nav-link {
  color: var(--text-secondary) !important;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.5rem 1rem !important;
  border-radius: var(--radius-sm);
  transition:
    color var(--transition),
    background var(--transition);
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-item.active .nav-link {
  color: var(--text-primary) !important;
  background: rgba(99, 102, 241, 0.1);
}

.navbar-toggler {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
}

.navbar-toggler-icon {
  filter: var(--toggler-filter);
}

.navbar-collapse {
  background: transparent;
}

@media (max-width: 767px) {
  .navbar-collapse {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    margin-top: 0.5rem;
  }
}

/* ── Hero ── */
.hero {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  padding: 4rem 0 3rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--hero-glow-1) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -10%;
  left: -5%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--hero-glow-2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-greeting {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero h1 .gradient-text {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  color: var(--text-secondary);
  max-width: 540px;
  margin-bottom: 2rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.btn-primary-custom {
  background: var(--gradient-hero);
  color: white;
  border: none;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition:
    transform var(--transition),
    box-shadow var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary-custom:hover {
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-outline-custom {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition:
    border-color var(--transition),
    background var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-outline-custom:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.hero-stat strong {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.hero-stat span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-visual {
  position: relative;
}

.hero-card-stack {
  position: relative;
  height: 380px;
}

.hero-floating-card {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition);
}

.hero-floating-card:nth-child(1) {
  top: 0;
  right: 0;
  width: 280px;
  z-index: 3;
}

.hero-floating-card:nth-child(2) {
  top: 80px;
  left: 0;
  width: 260px;
  z-index: 2;
  opacity: 0.85;
}

.hero-floating-card:nth-child(3) {
  bottom: 0;
  right: 40px;
  width: 240px;
  z-index: 1;
  opacity: 0.7;
}

.hero-floating-card .card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--gradient-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--accent-light);
}

.hero-floating-card h6 {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.hero-floating-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

/* ── Sections ── */
.section {
  padding: 5rem 0;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.section-desc {
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 3rem;
}

/* ── About ── */
.about-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
}

.about-content p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 0;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.skill-category {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.skill-category h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.skill-category h4 i {
  color: var(--accent-light);
}

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

.skill-tag {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-light);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.soft-skills {
  justify-content: center;
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.soft-skill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.soft-skill i {
  color: var(--cyan);
}

/* ── Projects ── */
.project-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
  color: var(--text-primary);
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}

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

.project-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.project-card-image {
  height: 180px;
  overflow: hidden;
  position: relative;
  background: var(--gradient-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

[data-theme="light"] .project-card-image--logo {
  background: var(--bg-secondary);
}

.project-card-image--logo img {
  object-fit: contain;
  padding: 2rem;
  max-height: 100%;
}

.project-card:hover .project-card-image img {
  transform: scale(1.05);
}

.project-card-placeholder {
  font-size: 2.5rem;
  color: var(--accent-light);
  opacity: 0.6;
}

.project-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-card-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.project-card-body p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.project-tag {
  background: rgba(34, 211, 238, 0.08);
  color: var(--cyan);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  font-family: var(--font-mono);
}

.project-card.featured {
  border-color: rgba(99, 102, 241, 0.3);
}

.project-card.featured:not(.client)::before {
  content: "Featured";
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--gradient-hero);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  z-index: 2;
}

.project-card.client::before {
  content: "Client Work";
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(34, 211, 238, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: var(--cyan);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  z-index: 2;
}

.project-card {
  position: relative;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 2000;
  background: var(--accent);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
}

/* ── Contact ── */
.contact-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.contact-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at top,
    var(--hero-glow-1),
    transparent 60%
  );
  pointer-events: none;
}

.contact-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 500;
  transition:
    border-color var(--transition),
    transform var(--transition);
}

.contact-link:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.contact-link i {
  font-size: 1.2rem;
  color: var(--accent-light);
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Project Detail Pages ── */
.project-detail {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.project-detail-header {
  text-align: center;
  margin-bottom: 3rem;
}

.project-detail-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.project-detail-header .subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.project-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.project-meta-item i {
  color: var(--accent-light);
}

.detail-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.detail-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--accent-light);
  background: none;
}

.detail-section p,
.detail-section li {
  color: var(--text-secondary);
}

.detail-section ul {
  padding-left: 1.25rem;
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.detail-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent-light);
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all var(--transition);
}

.detail-link-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--text-primary);
}

.detail-hero-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  background: var(--bg-secondary);
}

.detail-hero-image img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.detail-hero-image--logo img {
  padding: 2.5rem;
  max-height: 220px;
}

/* Legacy carousel (detail pages) */
.carousel-item {
  height: auto;
  min-height: 20rem;
  background-color: var(--bg-secondary);
}

#carousel-item2 {
  height: auto;
  min-height: 20rem;
}

.carousel-caption {
  font-size: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background-color: var(--caption-bg);
}

.thumbnails img {
  transition:
    transform var(--transition),
    opacity var(--transition);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.thumbnails img:hover {
  opacity: 0.8;
}

.thumbnails img.active {
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.card-body .text-bg-light,
.card-title.text-bg-light,
.card-text.text-bg-light {
  background: transparent !important;
  color: var(--text-primary) !important;
}

h2,
h3 {
  background: none;
  font-weight: 600;
}

.no-bullet {
  list-style: none;
  padding: 0;
}

.fade-in {
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none !important;
}

/* ── Responsive ── */
@media (max-width: 991px) {
  .hero-visual {
    display: none;
  }

  .hero {
    min-height: auto;
    padding: 3rem 0;
  }
}

@media (max-width: 576px) {
  .section {
    padding: 3rem 0;
  }

  .about-content,
  .contact-section {
    padding: 1.5rem;
  }

  .hero-stats {
    gap: 1.5rem;
  }
}
