/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent2: #39d2c0;
  --accent-gradient: linear-gradient(135deg, #58a6ff, #39d2c0);
  --radius: 10px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

/* ===== Light theme ===== */
body.light {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1a1d23;
  --text-muted: #5a606b;
  --accent: #2563eb;
  --accent2: #0d9488;
  --accent-gradient: linear-gradient(135deg, #2563eb, #0d9488);
}

body.light .navbar {
  background: rgba(255, 255, 255, 0.85);
}

body.light .nav-links.open {
  background: #ffffff;
}

body.light .hero {
  background: radial-gradient(ellipse at 50% 0%, #eef1f6 0%, var(--bg) 70%);
}

body.light .card {
  background: var(--surface);
}

body.light .footer {
  background: #ffffff;
}

body.light .form-status.error {
  color: #dc2626;
}

.normal {
  font-weight: 400;
  font-size: 14px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ===== Icons ===== */
.fa-solid {
  color: var(--accent2);
}

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  z-index: 1000;
}

.nav-brand {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

/* ===== Navbar controls (theme + language) ===== */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.icon-btn i {
  color: var(--accent2);
}

.lang-wrap {
  position: relative;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem 0.3rem 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}

.lang-btn i {
  color: var(--accent2);
  font-size: 0.85rem;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: none;
  z-index: 1100;
}

.lang-dropdown.show {
  display: block;
}

.lang-dropdown button {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  padding: 0.5rem 1rem;
  text-align: left;
  font-size: 0.85rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.lang-dropdown button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lang-dropdown button.active {
  color: var(--accent);
}

/* Same look for the theme and language buttons */
.icon-btn,
.lang-btn {
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.icon-btn:hover,
.lang-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}

/* Light mode: the same rules, tinted dark instead of white */
body.light .icon-btn,
body.light .lang-btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.18);
}

body.light .icon-btn:hover,
body.light .lang-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.3);
}

/* Light mode: social / cert buttons swap their white border for a visible dark one */
body.light .btn-social {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.16);
}

body.light .btn-social:hover {
  background: rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 0, 0, 0.3);
}

body.light .cert-link-btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.18);
}

body.light .cert-link-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.32);
}

/* No leftover outline after a click; keep a clean one for keyboard users */
.icon-btn:focus:not(:focus-visible),
.lang-btn:focus:not(:focus-visible) {
  outline: none;
}

.icon-btn:focus-visible,
.lang-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== Smooth transitions for theme changes ===== */
html,
body,
.navbar,
.nav-links.open,
.card,
.hero,
.contact-info,
.contact-info a,
.btn-social,
.icon-btn,
.lang-btn,
.lang-dropdown,
.lang-dropdown button,
.footer,
.form-status.error,
.form-status.success {
  transition: background-color 0.3s ease,
              border-color 0.3s ease,
              box-shadow 0.3s ease,
              color 0.3s ease;
}

.subtitle {
  transition: background 0.3s ease;
}

/* ===== Responsive ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem 4rem;
  background: radial-gradient(ellipse at 50% 0%, #1a2332 0%, var(--bg) 70%);
}

.avatar-img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 0 30px rgba(88,166,255,0.25);
  margin: 0 auto 1.2rem;
  display: block;
}

.avatar-bg {
  display: none;
}

.hero-content h1 {
  font-size: 3rem;
  font-weight: 700;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  margin-bottom: 0.5rem;
}

.hero-content .subtitle {
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 1rem;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent
}

.hero-content .tagline {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

.hero-contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.contact-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
}

.contact-info a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

.contact-info i {
  margin-right: 0.4rem;
}

/* ====== Unified transparent blur buttons (GitHub, LinkedIn, OpenCV) ====== */
.btn-social {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  text-decoration: none;
}

.btn-social:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-social i {
  color: var(--accent2);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

/* ===== Buttons ===== */
.btn-primary {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: var(--accent-gradient);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ===== Contact inline links (email, phone) ===== */
.contact-link {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
  display: block;
  margin: 0.2rem 0;
}

.contact-link span {
  display: inline-block;
  margin-right: 0.5rem;
}

.contact-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* ===== Sections ===== */
.section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.section h2 {
  font-size: 1.8rem;
  margin-bottom: 2rem;
  position: relative;
  display: inline-block;
}

.section h2::after {
  content: '';
  display: block;
  height: 3px;
  background: var(--accent-gradient);
  margin-top: 6px;
  border-radius: 2px;
}

.section-text {
  color: var(--text-muted);
  max-width: 700px;
  font-size: 1.05rem;
}

/* ===== Grid & Cards ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* ===== Projects (stacked vertically) ===== */
.projects-grid {
  grid-template-columns: 1fr;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.card h3, .card h4 {
  margin-bottom: 0.5rem;
}

.card h3 {
  font-size: 1.05rem;
}

.card h4 {
  font-size: 0.95rem;
  color: var(--accent);
}

.meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.card ul {
  padding-left: 1.2rem;
  margin-bottom: 0.75rem;
}

.card ul li {
  margin-bottom: 0.3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.tech {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent2);
}

/* ===== Project cards — content left, button right ===== */
.projects-grid .card {
  display: flex;
  flex-direction: column;
}

.projects-grid .project-info {
  flex: 1;
  min-width: 0;
}

.projects-grid .project-info > *:last-child {
  margin-bottom: 0;
}

.projects-grid .cert-link-btn {
  align-self: flex-start;
  margin-top: 1rem;
  flex-shrink: 0;
}

/* Mobile: stack button below content */
@media (max-width: 768px) {
  .projects-grid .card {
    flex-direction: column;
  }
  .projects-grid .cert-link-btn {
    align-self: flex-end;
    width: auto;
  }
}

/* ===== Skills ===== */
.skills-grid .card {
  text-align: center;
}

.skills-grid .card h4 {
  margin-bottom: 0.5rem;
}

.skills-grid .card p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ===== Timeline ===== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border-left: 3px solid var(--border);
  padding-left: 1.5rem;
  margin-left: 0.5rem;
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.15rem;
  top: 1.2rem;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}

/* ===== Certifications ===== */
.cert-card {
  display: flex;
  flex-direction: column;
  min-height: 175px;      /* adjust to taste */
}

.cert-card .meta {
  margin-bottom: 1rem;    /* keeps a gap above the button */
}

.cert-link-btn {
  margin-top: auto;
  margin-left: auto;      /* pushes the button to the right */
  display: flex;          /* block-level, so margin-left: auto can take effect */
  width: fit-content;     /* keeps it from stretching full width */
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.cert-link-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.cert-link-btn i {
  color: var(--accent2);
}

/* ===== Contact ===== */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 500px;
  margin-top: 1.5rem;
}

.contact-form input,
.contact-form textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
}

.form-status {
  margin-top: 1rem;
  font-weight: 600;
}

.form-status.success {
  color: var(--accent2);
}

.form-status.error {
  color: #f85149;
}

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

/* ===== Animated AI Background ===== */
#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    gap: 1rem;
  }

  .nav-links.open {
    display: flex;
  }

  .hero-content h1 {
    font-size: 2.2rem;
  }

  .hero-contact {
    flex-direction: column;
    gap: 0.5rem;
  }

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