/* ── Variables & Reset ── */
:root {
  --text: #6b6375;
  --text-h: #08060d;
  --bg-gradient: linear-gradient(160deg, #faf9f7 0%, #f3f0f8 50%, #faf9f7 100%);
  --border: #e5e4e7;
  --accent: #aa3bff;
  --accent-bg: rgba(170, 59, 255, 0.07);
  --accent-border: rgba(170, 59, 255, 0.3);
  --social-bg: rgba(244, 243, 236, 0.5);
  --shadow: rgba(0, 0, 0, 0.06) 0 10px 15px -3px, rgba(0, 0, 0, 0.03) 0 4px 6px -2px;
  --shadow-hover: rgba(0, 0, 0, 0.1) 0 20px 30px -6px, rgba(0, 0, 0, 0.06) 0 8px 12px -4px;
  --sans: system-ui, 'Segoe UI', Roboto, sans-serif;
  --transition: 0.2s ease;
  font: 18px/145% var(--sans);
  letter-spacing: 0.18px;
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Dark Mode via .dark class */
.dark {
  --text: #9ca3af;
  --text-h: #f3f4f6;
  --bg-gradient: linear-gradient(160deg, #111118 0%, #16101f 50%, #111118 100%);
  --border: #2e303a;
  --accent: #c084fc;
  --accent-bg: rgba(192, 132, 252, 0.12);
  --accent-border: rgba(192, 132, 252, 0.4);
  --social-bg: rgba(47, 48, 58, 0.75);
  --shadow: rgba(0, 0, 0, 0.5) 0 10px 15px -3px, rgba(0, 0, 0, 0.3) 0 4px 6px -2px;
  --shadow-hover: rgba(0, 0, 0, 0.6) 0 20px 30px -6px, rgba(0, 0, 0, 0.4) 0 8px 12px -4px;
}

/* Keep your original prefers-color-scheme as fallback */
@media (prefers-color-scheme: dark) {
  :root:not(.dark) {
    --text: #9ca3af;
    --text-h: #f3f4f6;
    --bg-gradient: linear-gradient(160deg, #111118 0%, #16101f 50%, #111118 100%);
    --border: #2e303a;
    --accent: #c084fc;
    --accent-bg: rgba(192, 132, 252, 0.08);
    --accent-border: rgba(192, 132, 252, 0.3);
    --social-bg: rgba(47, 48, 58, 0.5);
    --shadow: rgba(0, 0, 0, 0.5) 0 10px 15px -3px, rgba(0, 0, 0, 0.3) 0 4px 6px -2px;
    --shadow-hover: rgba(0, 0, 0, 0.6) 0 20px 30px -6px, rgba(0, 0, 0, 0.4) 0 8px 12px -4px;
  }
}

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

body {
  min-height: 100vh;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
}

#root {
  max-width: 1126px;
  margin: 0 auto;
  border-inline: 1px solid var(--border);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
}

/* ── Typography ── */
h1, h2 {
  font-weight: 500;
  color: var(--text-h);
}

h1 {
  font-size: 52px;
  letter-spacing: -1.5px;
  margin-bottom: 12px;
}

h2 {
  font-size: 24px;
  letter-spacing: -0.24px;
  margin-bottom: 8px;
}

p { line-height: 1.75; }

/* ── Page Transition Animations ── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

.page-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page-enter {
  animation: slideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page-exit {
  animation: slideDown 0.18s ease-in both;
  pointer-events: none;
}

/* ── Buttons ── */
button { cursor: pointer; font-family: var(--sans); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 11px 24px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  border: none;
  transition: opacity var(--transition), transform var(--transition);
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  padding: 11px 24px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  border: 1px solid var(--accent-border);
  transition: background var(--transition), transform var(--transition);
}
.btn-outline:hover { background: var(--accent-bg); transform: translateY(-1px); }
.btn-outline:active { transform: translateY(0); }

/* ── WhatsApp send button ── */
.btn-whatsapp {
  background: #25d366;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-whatsapp:hover { background: #1ebe5d; opacity: 1; }

/* ── Navbar ── */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 48px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--social-bg) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-wrap: wrap;
}

.navbar-logo {
  font-weight: 600;
  font-size: 18px;
  color: var(--text-h);
  cursor: pointer;
  letter-spacing: -0.3px;
  background: none;
  border: none;
  font-family: var(--sans);
  transition: opacity var(--transition);
}
.navbar-logo:hover { opacity: 0.75; }

.navbar-links { display: flex; gap: 28px; }

.navbar-link {
  font-size: 14px;
  color: var(--text);
  background: none;
  border: none;
  font-family: var(--sans);
  transition: color var(--transition);
  letter-spacing: 0.01em;
  padding: 0;
}
.navbar-link:hover,
.navbar-link.active { color: var(--accent); }

/* ── Hamburger ── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  width: 32px;
  height: 32px;
}

.ham-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-h);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

.hamburger .ham-line:nth-child(1).open { transform: translateY(7px) rotate(45deg); }
.hamburger .ham-line:nth-child(2).open { opacity: 0; }
.hamburger .ham-line:nth-child(3).open { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile menu ── */
.mobile-menu {
  display: none;
  flex-direction: column;
  width: 100%;
  border-top: 1px solid var(--border);
  padding: 12px 0 4px;
  gap: 2px;
}

.mobile-link {
  font-size: 15px;
  color: var(--text);
  background: none;
  border: none;
  font-family: var(--sans);
  text-align: left;
  padding: 10px 0;
  cursor: pointer;
  transition: color var(--transition);
  border-bottom: 1px solid var(--border);
  width: 100%;
}
.mobile-link:last-child { border-bottom: none; }
.mobile-link:hover,
.mobile-link.active { color: var(--accent); }

/* ── Main content ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Hero ── */
.hero {
  padding: 80px 64px;
  display: flex;
  align-items: center;
  gap: 64px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.hero-photo-wrap { flex-shrink: 0; }

.hero-photo {
  width: 220px;
  height: 260px;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.hero-photo:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-hover);
}

.hero-text { text-align: left; flex: 1; }
.hero-text h1 { margin-bottom: 8px; }

.hero-subtitle {
  font-size: 17px;
  color: var(--accent);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.hero-text p {
  color: var(--text);
  font-size: 16px;
  margin-bottom: 32px;
  line-height: 1.75;
}

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

/* ── Skills ── */
.skills {
  padding: 60px 48px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.skills h2 { margin-bottom: 20px; }

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.skills-grid span {
  background: var(--accent-bg);
  color: var(--accent);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid var(--accent-border);
  transition: background var(--transition), transform var(--transition);
}
.skills-grid span:hover {
  background: rgba(170, 59, 255, 0.14);
  transform: translateY(-2px);
}

/* ── Projects Preview (Home) ── */
.projects-preview {
  padding: 60px 48px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.projects-preview p {
  color: var(--text);
  font-size: 15px;
  margin-bottom: 24px;
}

/* ── CTA ── */
.cta {
  padding: 80px 48px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.cta h2 { font-size: 32px; margin-bottom: 24px; }

/* ── About ── */
.about {
  padding: 80px 48px;
  max-width: 860px;
  margin: 0 auto;
  text-align: left;
  flex: 1;
}

.about-hero {
  display: flex;
  align-items: flex-start;
  gap: 56px;
  margin-bottom: 56px;
}

.about-text { flex: 1; }
.about-text h1 { margin-bottom: 24px; }

.about-text p {
  color: var(--text);
  font-size: 16px;
  margin-bottom: 14px;
  line-height: 1.75;
}

.about-photo-wrap { flex-shrink: 0; }

.about-photo {
  width: 200px;
  height: 240px;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.about-photo:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-hover);
}

.about-details {
  display: flex;
  flex-direction: column;
  gap: 36px;
  border-top: 1px solid var(--border);
  padding-top: 48px;
}

.about-section h2 { font-size: 20px; margin-bottom: 12px; }
.about-section p { color: var(--text); font-size: 15px; }
.about-section ul {
  color: var(--text);
  padding-left: 20px;
  line-height: 2;
  font-size: 15px;
}

/* ── Projects Page ── */
.projects-page {
  padding: 80px 48px;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.projects-page h1 { margin-bottom: 8px; }

.projects-subtitle {
  color: var(--text);
  font-size: 15px;
  margin-top: 8px;
  margin-bottom: 48px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  text-align: left;
  width: 100%;
}

/* ── Project Card ── */
.project-card {
  background: var(--social-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

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

.project-card h2 { font-size: 17px; margin-bottom: 8px; }

.project-card p {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.project-card-tech {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  padding: 4px 12px;
  display: inline-block;
}

/* ── Contact ── */
.contact {
  padding: 80px 48px;
  max-width: 560px;
  margin: 0 auto;
  text-align: left;
  flex: 1;
}

.contact h1 { margin-bottom: 10px; }

.contact-intro {
  color: var(--text);
  font-size: 15px;
  margin-bottom: 32px;
  line-height: 1.7;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--social-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

.contact-form:hover {
  box-shadow: var(--shadow-hover);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-h);
}

.form-group input,
.form-group textarea {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-h);
  font-family: var(--sans);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text);
  opacity: 0.7;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-group input.error,
.form-group textarea.error {
  border-color: #e55353;
  box-shadow: 0 0 0 3px rgba(229, 83, 83, 0.1);
}

.field-error {
  font-size: 12px;
  color: #e55353;
  margin-top: -2px;
  animation: slideUp 0.2s ease-out;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.btn-email {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-border);
  transition: background var(--transition), transform var(--transition);
}

.btn-email:hover {
  background: var(--accent-bg);
  transform: translateY(-1px);
}

.btn-email:active {
  transform: translateY(0);
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .btn-primary,
  .btn-outline {
    width: 100%;
    justify-content: center;
  }
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 48px 28px;
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-h);
  display: block;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.footer-tagline {
  font-size: 13px;
  color: var(--text);
  max-width: 200px;
  line-height: 1.6;
}

.footer-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: none;
  border: none;
}

.footer-link {
  font-size: 13px;
  color: var(--text);
  background: none;
  border: none;
  font-family: var(--sans);
  text-align: left;
  padding: 0;
  cursor: pointer;
  transition: color var(--transition);
}
.footer-link:hover { color: var(--accent); }

.footer-social { display: flex; gap: 10px; align-items: center; }

.footer-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--social-bg);
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition),
              background var(--transition), transform var(--transition);
}
.footer-social-link:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-bg);
  transform: translateY(-2px);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.footer-dot { opacity: 0.4; }

/* ══════════════════════════════════════
   RESPONSIVE — Tablet (768px)
   ══════════════════════════════════════ */
@media (max-width: 768px) {

  .navbar { padding: 16px 20px; }
  .navbar-links { display: none; }
  .hamburger { display: flex; }
  .mobile-menu { display: flex; }

  .hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 60px 24px 48px;
    gap: 36px;
  }

  .hero-text { text-align: center; }
  .hero-photo { width: 180px; height: 210px; }
  .buttons { justify-content: center; }

  .skills, .projects-preview, .cta { padding: 48px 24px; }
  .cta h2 { font-size: 26px; }

  .about { padding: 60px 24px 48px; }
  .about-hero {
    flex-direction: column-reverse;
    align-items: center;
    gap: 32px;
    text-align: center;
  }
  .about-text h1 { text-align: center; }
  .about-photo { width: 160px; height: 190px; }
  .about-section ul { text-align: left; }

  .projects-page { padding: 60px 24px 48px; }
  .project-grid { grid-template-columns: 1fr; }
  .contact { padding: 60px 24px 48px; }

  .footer { padding: 32px 24px 20px; }
  .footer-inner { flex-direction: column; align-items: center; text-align: center; }
  .footer-tagline { max-width: 100%; }
  .footer-link { text-align: center; }
  .footer-nav { align-items: center; }
}

/* ══════════════════════════════════════
   RESPONSIVE — Small phones (480px)
   ══════════════════════════════════════ */
@media (max-width: 480px) {

  h1 { font-size: 36px; letter-spacing: -1px; }
  h2 { font-size: 20px; }

  .hero { padding: 48px 16px 40px; gap: 28px; }
  .hero-text p { font-size: 15px; }
  .hero-subtitle { font-size: 15px; }
  .hero-photo { width: 150px; height: 175px; border-radius: 16px; }

  .buttons { flex-direction: column; align-items: stretch; width: 100%; }
  .btn-primary, .btn-outline { width: 100%; text-align: center; }

  .skills, .projects-preview, .cta { padding: 40px 16px; }
  .about, .contact, .projects-page { padding: 48px 16px 40px; }
  .about-photo { width: 140px; height: 168px; border-radius: 16px; }
  .footer { padding: 28px 16px 16px; }
}

/* ══════════════════════════════════════
   RESPONSIVE — Tiny phones (320px)
   ══════════════════════════════════════ */
@media (max-width: 320px) {

  h1 { font-size: 28px; }
  h2 { font-size: 18px; }

  .navbar { padding: 14px 12px; }
  .navbar-logo { font-size: 16px; }

  .hero { padding: 40px 12px 32px; }
  .hero-photo { width: 130px; height: 155px; border-radius: 14px; }

  .skills, .projects-preview, .cta { padding: 32px 12px; }
  .about, .contact, .projects-page { padding: 40px 12px 32px; }
  .about-photo { width: 120px; height: 144px; border-radius: 14px; }

  .project-grid { gap: 14px; }
  .project-card { padding: 18px; }

  .footer { padding: 24px 12px 14px; }
  .footer-bottom { flex-direction: column; gap: 4px; }
  .footer-dot { display: none; }
}

/* === NEW STYLES FROM LAST UPDATE === */

/* Theme Toggle */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
}

/* Typing Cursor */
.cursor {
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Skill Bars */
.skills-container {
  max-width: 680px;
  margin: 40px auto 0;
}

.skill-bar {
  margin-bottom: 26px;
}

.skill-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 500;
}

.bar-bg {
  height: 11px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #d8b4fe);
  border-radius: 999px;
  animation: fillBar 1.4s ease forwards;
}

@keyframes fillBar {
  from { width: 0; }
  to { width: var(--width); }
}

/* Tech Filters */
.tech-filters {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 30px 0 40px;
}

.filter-btn {
  padding: 9px 22px;
  border-radius: 30px;
  border: 1px solid var(--accent-border);
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s;
}

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

/* Project Links */
.project-links {
  margin-top: 18px;
}

.project-link {
  color: var(--accent);
  font-size: 14px;
  text-decoration: none;
}

.project-link:hover {
  text-decoration: underline;
}

/* Floating GitHub Button (Optional) */
.floating-github {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: var(--accent);
  color: white;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-hover);
  z-index: 1000;
  text-decoration: none;
  transition: transform 0.3s;
}

.floating-github:hover {
  transform: scale(1.12);
}

/* Force dark mode on entire page when .dark is present */
html.dark,
html.dark body,
body.dark {
  background: var(--bg-gradient) !important;
}

/* Ensure all elements inherit the correct text/border colors */
html.dark *,
body.dark * {
  color: var(--text);
  border-color: var(--border);
}

/* Make sure root container doesn't block the body background */
#root {
  background: transparent !important;
}

/* Smooth skill bar transition (fixes animation) */
.bar-fill {
  transition: width 1.4s ease;
}

/* Floating GitHub button responsive fix */
@media (max-width: 768px) {
  .floating-github {
    width: 44px;
    height: 44px;
    bottom: 15px;
    right: 15px;
  }
}
