:root {
  --btnText: #ffffff;
  --btnTextOnAccent: #ffffff;
  --bg: #05050A;
  --surface: #0E0E16;
  --card: #151522;
  --text: #ffffff;
  --muted: #A3A3B5;
  --accent: #00E6F6;
  --accent2: #8A2BE2;
  --border: rgba(255, 255, 255, .1);
  --shadow: 0 10px 40px rgba(0, 0, 0, .6);
  --navH: 76px;
}

[data-theme="light"] {
  --bg: #F4F5F7;
  --surface: #ffffff;
  --card: #ffffff;
  --text: #111827;
  --muted: #6B7280;
  --accent: #0EA5E9;
  --accent2: #6366F1;
  --border: rgba(0, 0, 0, .08);
  --shadow: 0 20px 40px rgba(0, 0, 0, .08);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(circle at top left, rgba(138, 43, 226, .15), transparent 40%), radial-gradient(circle at bottom right, rgba(0, 230, 246, .1), transparent 40%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-top: var(--navH);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.navbar {
  background: rgba(15, 26, 45, .75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, .75);
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-weight: 800;
  letter-spacing: .3px;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.brand .name {
  line-height: 1;
}

.brand .name small {
  display: block;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}

.container-narrow {
  max-width: 1100px;
}

.hero {
  padding-top: 4.5rem;
  padding-bottom: 3rem;
}

.badge-soft {
  display: inline-flex;
  gap: .45rem;
  align-items: center;
  padding: .45rem .75rem;
  background: rgba(91, 140, 255, .14);
  border: 1px solid rgba(91, 140, 255, .25);
  border-radius: 999px;
  font-weight: 700;
}

.hero h1 {
  font-size: clamp(2.2rem, 3.8vw, 3.2rem);
  font-weight: 900;
  margin-top: .8rem;
  letter-spacing: .2px;
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 60ch;
}

.hero-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), transparent), var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-photo {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  object-position: center;
}

.hero-meta {
  padding: 1rem 1.1rem;
  border-top: 1px solid var(--border);
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  height: 100%;
  box-shadow: var(--shadow);
}

.kpi h6 {
  margin: 0;
  font-weight: 900;
}

.kpi p {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .95rem;
}

.section {
  padding: 3.2rem 0;
}

.section-title {
  font-weight: 900;
  font-size: 1.6rem;
  margin-bottom: 1.3rem;
}

.page-center {
  min-height: calc(100vh - var(--navH));
  display: flex;
  align-items: center;
}

.card-soft {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  font-weight: 700;
  margin: .25rem;
  color: var(--text);
}

[data-theme="light"] .pill {
  background: rgba(2, 6, 23, .03);
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  height: 100%;
  transition: transform .2s ease, border-color .2s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(91, 140, 255, .35);
}

.project-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--card);
}

.project-body {
  padding: 1rem 1.1rem 1.2rem;
}

.project-body h5 {
  font-weight: 900;
  margin: 0 0 .4rem;
}

.project-body p {
  color: var(--muted);
  margin: 0 0 .9rem;
  font-size: .95rem;
}

/* feature cards (home) */
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  height: 100%;
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(91, 140, 255, .14);
  border: 1px solid rgba(91, 140, 255, .24);
  margin-bottom: 10px;
}

.feature-icon i {
  color: var(--text);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  font-weight: 800;
  border-radius: 12px;
  padding: .65rem 1rem;
  color: var(--btnTextOnAccent);
}

.btn-outline-soft {
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: .65rem 1rem;
  font-weight: 800;
}

.btn-outline-soft:hover {
  border-color: rgba(91, 140, 255, .35);
}

footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  background: rgba(15, 26, 45, .35);
}

[data-theme="light"] footer {
  background: rgba(255, 255, 255, .45);
}

.footer-icons a {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-right: .4rem;
}

.footer-icons a:hover {
  border-color: rgba(91, 140, 255, .35);
}

#backToTop {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  z-index: 9999;
}

.reveal {
  opacity: 1;
  transform: none;
}

.js-reveal .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s ease, transform .7s ease;
}

.js-reveal .reveal.show {
  opacity: 1;
  transform: translateY(0);
}

.rtl {
  direction: rtl;
  text-align: right;
}


/* ===== Navbar & Controls (Improved visibility on mobile) ===== */
.navbar-glass {
  backdrop-filter: blur(14px);
}

.navbar-glass .navbar-nav .nav-link {
  color: var(--text) !important;
  opacity: .9;
  font-weight: 500;
}

.navbar-glass .navbar-nav .nav-link:hover,
.navbar-glass .navbar-nav .nav-link:focus {
  opacity: 1;
  color: var(--text) !important;
}

.navbar-glass .navbar-nav .nav-link.active {
  opacity: 1;
  color: var(--accent) !important;
}

.nav-actions .btn,
.btn-nav {
  border: 1px solid var(--border) !important;
  background: rgba(255, 255, 255, .06) !important;
  color: var(--text) !important;
}

.btn-nav:hover {
  color: var(--text) !important;
}

[data-theme="light"] .nav-actions .btn,
[data-theme="light"] .btn-nav {
  background: rgba(2, 6, 23, .04) !important;
}

.nav-actions .btn:hover,
.btn-nav:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
}

@media (max-width: 991.98px) {
  .navbar-glass .navbar-collapse {
    margin-top: .75rem;
    background: rgba(15, 26, 45, .92);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: .75rem;
  }

  [data-theme="light"] .navbar-glass .navbar-collapse {
    background: rgba(255, 255, 255, .92);
  }

  .navbar-glass .navbar-nav .nav-link {
    padding: .65rem .75rem;
    border-radius: 12px;
  }

  .navbar-glass .navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, .06);
  }

  [data-theme="light"] .navbar-glass .navbar-nav .nav-link:hover {
    background: rgba(2, 6, 23, .04);
  }
}

/* ===== Back To Top (Always reliable) ===== */
#backToTop {
  display: flex !important;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
  z-index: 9999;
}

#backToTop.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}


/* Improve top-right actions contrast */
.nav-actions .btn-nav {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .18);
}

[data-theme="light"] .nav-actions .btn-nav {
  background: rgba(0, 0, 0, .04);
  border-color: rgba(0, 0, 0, .12);
}

/* Bootstrap navbar toggler icon visibility */
.navbar .navbar-toggler {
  border-color: rgba(255, 255, 255, .25);
}

[data-theme="light"] .navbar .navbar-toggler {
  border-color: rgba(0, 0, 0, .18);
}

.navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

[data-theme="light"] .navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0,0,0,0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ---- Navbar visibility fixes ---- */
.navbar {
  backdrop-filter: blur(10px);
}

.navbar .navbar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.navbar .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.navbar .brand-text small {
  margin-top: 2px;
  opacity: .85;
}

.navbar .nav-link,
.navbar .navbar-brand,
.navbar .navbar-toggler {
  color: var(--text) !important;
}

.navbar .nav-link {
  opacity: .92;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
  opacity: 1;
}

.navbar .btn,
.navbar .btn i {
  color: var(--text) !important;
}

.navbar .btn {
  border-color: color-mix(in srgb, var(--text) 45%, transparent) !important;
}

/* Mobile nav dropdown */
.navbar .navbar-collapse {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}

.navbar .navbar-nav .nav-link {
  padding: .6rem .75rem;
  border-radius: 10px;
}

.navbar .navbar-nav .nav-link:hover {
  background: color-mix(in srgb, var(--card) 75%, transparent);
}

/* Make buttons/links readable globally */
.btn,
.btn a,
a.btn {
  text-decoration: none;
}

.btn,
.btn-link {
  color: inherit;
}

/* Brand sizing */
.navbar .navbar-brand img {
  height: 48px;
  width: auto;
  border-radius: 12px;
}

.navbar .navbar-brand .name {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.navbar .navbar-brand .name small {
  margin-top: 3px;
}

/* --- Premium Animated Frames --- */
.premium-frame {
  position: relative;
  padding: 3px;
  overflow: hidden;
  display: inline-flex;
  z-index: 1;
}

.premium-frame::before {
  content: '';
  position: absolute;
  inset: -100%;
  width: 300%;
  height: 300%;
  background: conic-gradient(from 0deg, transparent 0%, transparent 40%, var(--accent) 50%, var(--accent2) 60%, transparent 100%);
  animation: rotate-border 4s linear infinite;
  z-index: -1;
  top: 50%;
  left: 50%;
  transform-origin: 0 0;
  /* Centering the conic gradient origin */
}

@keyframes rotate-border {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.premium-frame::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: var(--surface);
  z-index: -1;
}

/* Modifying Logo Frame */
.brand .premium-frame {
  width: 46px;
  height: 46px;
  border-radius: 12px;
}

.brand .premium-frame::after {
  border-radius: 9px;
  background: var(--card);
}

.brand .premium-frame img {
  width: 100%;
  height: 100%;
  border-radius: 9px;
  object-fit: cover;
  position: relative;
  z-index: 2;
}

/* Hero Photo Frame Masterpiece */
.hero-photo-wrapper.premium-frame {
  width: 100%;
  aspect-ratio: 4/5;
  border-radius: 24px;
  position: relative;
  padding: 0;
  background: transparent;
  transform-style: preserve-3d;
  perspective: 1000px;
}

.hero-photo-wrapper.premium-frame::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 30px;
  background: linear-gradient(45deg, var(--accent), var(--accent2), #ff007f, var(--accent));
  background-size: 300% 300%;
  animation: bg-gradient-glow 6s ease infinite, float-frame 6s ease-in-out infinite;
  z-index: -2;
  filter: blur(15px);
  opacity: 0.8;
}

.hero-photo-wrapper.premium-frame::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 28px;
  background: linear-gradient(45deg, var(--accent), var(--accent2), #ff007f, var(--accent));
  background-size: 300% 300%;
  animation: bg-gradient-glow 6s ease infinite, float-frame 6s ease-in-out infinite;
  z-index: -1;
}

.hero-photo-wrapper.premium-frame img {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  object-fit: cover;
  position: relative;
  z-index: 2;
  border: 4px solid var(--surface);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  animation: float-frame 6s ease-in-out infinite;
  animation-delay: 0.1s;
}

@keyframes bg-gradient-glow {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes float-frame {
  0% {
    transform: translateY(0px) rotateX(0deg) rotateY(0deg);
  }

  50% {
    transform: translateY(-15px) rotateX(2deg) rotateY(-2deg);
  }

  100% {
    transform: translateY(0px) rotateX(0deg) rotateY(0deg);
  }
}

/* Hide old hero photo default img if inside frame */
.hero-card {
  background: none;
  border: none;
  box-shadow: none;
}

.hero-card .hero-meta {
  border-top: none;
  padding: 1.5rem 0.5rem 0.5rem;
}

/* --- Marquee Projects Slider --- */
.projects-marquee-section {
  padding: 3rem 0;
  overflow: hidden;
  background: linear-gradient(90deg, transparent, rgba(91, 140, 255, .05) 50%, transparent);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.marquee-title {
  text-align: center;
  margin-bottom: 2rem;
  font-weight: 800;
  font-size: 1.8rem;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.marquee {
  display: flex;
  overflow: hidden;
  user-select: none;
  gap: 2rem;
}

.marquee-content {
  flex-shrink: 0;
  display: flex;
  gap: 2rem;
  justify-content: space-around;
  min-width: 100%;
  animation: scroll 20s linear infinite;
}

.marquee:hover .marquee-content {
  animation-play-state: paused;
}

.marquee-item {
  width: 320px;
  aspect-ratio: 16/9;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, border-color 0.3s ease;
  display: block;
}

.marquee-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.marquee-item:hover img {
  transform: scale(1.08);
}

.marquee-item:hover {
  transform: translateY(-8px);
  border-color: var(--accent);
  box-shadow: 0 15px 35px rgba(91, 140, 255, .15);
}

.marquee-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 70%);
  display: flex;
  align-items: flex-end;
  padding: 1.2rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.marquee-item:hover .marquee-overlay {
  opacity: 1;
}

.marquee-overlay h6 {
  color: #fff;
  margin: 0;
  font-weight: 700;
  font-size: 1.15rem;
  transform: translateY(10px);
  transition: transform 0.3s ease;
}

.marquee-item:hover .marquee-overlay h6 {
  transform: translateY(0);
}

@keyframes scroll {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(calc(-100% - 2rem));
  }
}

@media (max-width: 768px) {
  .marquee-item {
    width: 260px;
  }
}