/* Define CSS variables for theming */
:root {
  --bg-primary: #f8fafc;
  /* Light blue-gray background */
  --bg-secondary: #ffffff;
  /* White background */
  --bg-tertiary: #f3f4f6;
  /* Light gray for sections */
  --text-primary: #334155;
  /* Darker text */
  --text-secondary: #64748b;
  /* Muted text */
  --accent-primary: #8b5cf6;
  /* Purple accent */
  --accent-hover: #7c3aed;
  /* Darker purple for hover */
  --header-bg: #ffffff;
  /* Header background */
  --hero-bg-from: #4f46e5;
  /* Hero gradient start */
  --hero-bg-to: #7c3aed;
  /* Hero gradient end */
  --card-bg: #ffffff;
  /* Card background */
  --skill-card-bg: #f3e8ff;
  /* Skill card background */
  --shadow-color: rgba(0, 0, 0, 0.1);
  /* Shadow */
  --footer-bg: #1f2937;
  /* Footer background */
  --footer-text: #ffffff;
  /* Footer text */
  --form-bg: #f3f4f6;
  /* Form background */
  --border-accent: #d8b4fe;
  /* Border accent */
  --carousel-btn-bg: rgba(255, 255, 255, 0.3);
  /* Carousel button background */
  --carousel-btn-hover: rgba(255, 255, 255, 0.5);
  /* Carousel button hover */
}

/* Dark theme overrides */
.dark {
  --bg-primary: #1f2937;
  /* Dark gray-blue background */
  --bg-secondary: #111827;
  /* Darker background */
  --bg-tertiary: #374151;
  /* Dark gray for sections */
  --text-primary: #e5e7eb;
  /* Light text */
  --text-secondary: #9ca3af;
  /* Muted light text */
  --accent-primary: #a78bfa;
  /* Lighter purple accent */
  --accent-hover: #c4b5fd;
  /* Lighter purple for hover */
  --header-bg: #111827;
  /* Dark header */
  --hero-bg-from: #312e81;
  /* Darker hero gradient start */
  --hero-bg-to: #5b21b6;
  /* Darker hero gradient end */
  --card-bg: #1f2937;
  /* Dark card background */
  --skill-card-bg: #2e1065;
  /* Dark skill card background */
  --shadow-color: rgba(0, 0, 0, 0.3);
  /* Darker shadow */
  --footer-bg: #111827;
  /* Darker footer */
  --footer-text: #d1d5db;
  /* Slightly muted footer text */
  --form-bg: #374151;
  /* Dark form background */
  --border-accent: #a78bfa;
  /* Lighter border accent */
  --carousel-btn-bg: rgba(17, 24, 39, 0.3);
  /* Dark carousel button */
  --carousel-btn-hover: rgba(17, 24, 39, 0.5);
  /* Dark carousel button hover */
}

/* Apply CSS variables */
body {
  font-family: "Inter", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

.section-title {
  position: relative;
  display: inline-block;
  padding-bottom: 8px;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 60%;
  height: 4px;
  background-color: var(--accent-primary);
  border-radius: 2px;
}

/* Theme toggle button styles */
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  color: var(--text-primary);
}

#theme-toggle svg {
  width: 24px;
  height: 24px;
}

/* Update header for theme */
/* ===============================
   GLASSMORPHIC HEADER
================================ */
header {
  position: fixed;
  width: 100%;
  z-index: 1000;

  /* existing styles (kept) */
  background-color: var(--header-bg);
  box-shadow: 0 2px 4px var(--shadow-color);

  /* glass effect */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  /* subtle transparency */
  background-color: rgba(255, 255, 255, 0.7);

  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.dark header {
  background-color: rgba(17, 24, 39, 0.7);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Update hero section */
#hero {
  background: linear-gradient(to right, var(--hero-bg-from), var(--hero-bg-to));
}

/* Update section backgrounds */
#about,
#projects {
  background-color: var(--bg-tertiary);
}

#skills,
#contact {
  background-color: var(--bg-secondary);
}

/* ===============================
   SKILLS – CLEAN CARD STYLE
================================ */

.skill-card {
  background-color: var(--skill-card-bg);
  box-shadow: 0 8px 20px var(--shadow-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.skill-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.skill-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.skill-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.15);
}

.dark .skill-card:hover {
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.4);
}

.project-card {
  background-color: var(--card-bg);
  box-shadow: 0 4px 6px var(--shadow-color);
}

#modalTitle:hover {
  text-decoration: underline;
}


/* Update form background */
#contact-form {
  background-color: var(--form-bg);
}

/* Update footer */
footer {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  margin-top: -65px;
}

/* Update carousel buttons */
.carousel-btn {
  background-color: var(--carousel-btn-bg);
  border-color: var(--border-accent);
}

.carousel-btn:hover {
  background-color: var(--carousel-btn-hover);
}

/* Hover effects using theme variables */
a:hover,
button:hover {
  color: var(--accent-hover);
}

.hover\:text-accent:hover {
  color: var(--accent-hover);
}

.hover\:bg-accent:hover {
  background-color: var(--accent-hover);
}

.hero-content {
  animation: fadeIn 1s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

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

/* Base Card */
.project-card {
  position: relative;
  transition: transform 0.2s ease-out, box-shadow 0.3s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
  overflow: hidden;
}

/* Scale on hover */
.project-card:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 35px rgba(0, 200, 255, 0.25);
}

/* Glow following mouse */
.project-card::before {
  content: "";
  position: absolute;
  top: var(--y);
  left: var(--x);
  transform: translate(-50%, -50%);
  width: 0px;
  height: 0px;
  background: radial-gradient(
    circle,
    rgba(0, 255, 255, 0.25) 0%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.project-card:hover::before {
  width: 300px;
  height: 300px;
  opacity: 1;
}

/* ===============================
   PROJECT SECTION – SIMPLE CARDS
================================ */

/* Project card base */
.project-card {
  background-color: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 25px var(--shadow-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Image */
.project-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

/* Title */
.project-card h3 a {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Description */
.project-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Links */
.project-card a {
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

/* Hover effect */
.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.15);
}

/* Dark mode hover tweak */
.dark .project-card:hover {
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.4);
}

.typing-hero::after {
  content: "|";
  margin-left: 6px;
  animation: blink 1s infinite;
  color: #fde047;
  /* same yellow */
}

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

  25%,
  75% {
    opacity: 0;
  }
}

/* =========================================
   MOBILE UI – FINAL POLISH (≤ 768px)
========================================= */
@media (max-width: 768px) {
  /* ---------- GLOBAL ---------- */
  body {
    font-size: 15px;
    line-height: 1.6;
  }

  section {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }

  /* ---------- HEADER ---------- */
  header {
    padding: 0.75rem 1rem;
    backdrop-filter: blur(14px);
  }

  header nav {
    padding: 0;
  }

  header img {
    width: 42px;
    height: 42px;
  }

  /* ---------- HERO ---------- */
  #hero {
    min-height: 100vh;
  }

  .hero-content {
    padding-top: 5.5rem;
  }

  #hero h1 {
    font-size: 2.2rem !important;
    line-height: 1.25;
  }

  #hero p {
    font-size: 1.05rem;
  }

  #hero a {
    padding: 0.9rem 1.8rem;
    font-size: 1rem;
  }

  /* ---------- SECTION TITLES ---------- */
  .section-title {
    font-size: 1.9rem !important;
  }

  .section-title::after {
    width: 50%;
  }

  /* ---------- ABOUT ---------- */
  #about img {
    width: 130px;
    height: 130px;
  }

  #about p {
    font-size: 0.95rem;
  }

  /* ---------- SKILLS ---------- */
  #skills .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .skill-card {
    padding: 1rem;
  }

  .skill-card h3 {
    font-size: 0.95rem;
  }

  .skill-card p {
    font-size: 0.8rem;
  }

  /* ---------- PROJECTS ---------- */
  #projects .grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

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

  .project-card img {
    height: 170px;
  }

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

  .project-card p {
    font-size: 0.9rem;
  }

  .project-card .flex {
    gap: 1rem;
  }

  /* ---------- CONTACT ---------- */
  #contact p {
    font-size: 0.95rem;
  }

  #contact-form {
    padding: 1.25rem;
  }

  #contact-form input,
  #contact-form textarea {
    font-size: 0.9rem;
    padding: 0.7rem;
  }

  #contact-form button {
    width: 100%;
    margin-top: 0.5rem;
  }

  /* ---------- FOOTER ---------- */
  footer {
    font-size: 0.85rem;
    padding: 1rem;
  }

  /* ---------- TOUCH OPTIMIZATION ---------- */
  a,
  button {
    min-height: 44px;
  }

  /* ---------- DISABLE HEAVY EFFECTS ---------- */
  .project-card::before {
    display: none;
  }
}

/* =========================================
   PORTRAIT MOBILE – 412px OPTIMIZATION
========================================= */
@media screen and (max-width: 412px) and (orientation: portrait) {
  /* -------- GLOBAL -------- */
  body {
    font-size: 14px;
    line-height: 1.55;
    overflow-x: hidden;
  }

  section {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* -------- HEADER -------- */
  header {
    padding: 0.6rem 0.8rem;
    backdrop-filter: blur(14px);
  }

  header img {
    width: 38px;
    height: 38px;
  }

  /* -------- HERO -------- */
  #hero {
    min-height: 100vh;
  }

  .hero-content {
    padding-top: 5.8rem;
  }

  #hero h1 {
    font-size: 2rem !important;
    line-height: 1.25;
  }

  #hero p {
    font-size: 0.95rem;
  }

  #hero a {
    padding: 0.85rem 1.6rem;
    font-size: 0.95rem;
  }

  /* -------- SECTION TITLES -------- */
  .section-title {
    font-size: 1.75rem !important;
  }

  .section-title::after {
    width: 45%;
  }

  /* -------- ABOUT -------- */
  #about img {
    width: 120px;
    height: 120px;
  }

  #about p {
    font-size: 0.9rem;
  }

  /* -------- SKILLS -------- */
  #skills .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem;
  }

  .skill-card {
    padding: 0.85rem;
  }

  .skill-card h3 {
    font-size: 0.9rem;
  }

  .skill-card p {
    font-size: 0.75rem;
  }

  /* -------- PROJECTS -------- */
  #projects .grid {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }

  .project-card img {
    height: 160px;
  }

  .project-card h3 {
    font-size: 1rem;
  }

  .project-card p {
    font-size: 0.85rem;
  }

  /* -------- CONTACT -------- */
  #contact p {
    font-size: 0.9rem;
  }

  #contact-form {
    padding: 1rem;
  }

  #contact-form input,
  #contact-form textarea {
    font-size: 0.85rem;
    padding: 0.65rem;
  }

  #contact-form button {
    width: 100%;
  }

  /* -------- FOOTER -------- */
  footer {
    font-size: 0.8rem;
    padding: 0.9rem;
  }

  /* -------- PERFORMANCE & TOUCH -------- */
  .project-card::before {
    display: none;
  }

  .project-card:hover {
    transform: none;
  }

  a,
  button {
    min-height: 44px;
  }
}

/* =========================================
   MOBILE (412px) – PROJECT = SKILL CARD SIZE
========================================= */
@media screen and (max-width: 412px) and (orientation: portrait) {
  /* Match project card base to skill card */
  .project-card {
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 6px 14px var(--shadow-color);
  }

  /* Image becomes compact like skill card top */
  .project-card img {
    height: 110px; /* similar visual weight */
    border-radius: 12px 12px 0 0;
  }

  /* Inner content spacing same as skill-card */
  .project-card .p-6 {
    padding: 0.8rem !important;
  }

  /* Title same scale as skill heading */
  .project-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    line-height: 1.3;
  }

  /* Description same scale as skill text */
  .project-card p {
    font-size: 0.75rem;
    line-height: 1.45;
    margin-bottom: 0.6rem;
  }

  /* Action row compact */
  .project-card .flex {
    font-size: 0.75rem;
  }

  .project-card a {
    font-size: 0.75rem;
  }

  /* Grid spacing same as skills */
  #projects .grid {
    gap: 0.8rem;
  }

  /* Disable hover/3D effects on mobile */
  .project-card:hover {
    transform: none;
    box-shadow: 0 6px 14px var(--shadow-color);
  }

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

/* =========================================
   MOBILE 412px – PROJECTS SAME AS SKILLS
========================================= */
@media screen and (max-width: 412px) and (orientation: portrait) {
  /* Force 2-column grid like skills */
  #projects .grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.8rem;
  }

  /* Hide project images (pure card style) */
  .project-card img {
    display: none;
  }

  /* Match skill-card size */
  .project-card {
    padding: 0.9rem;
    border-radius: 12px;
    box-shadow: 0 6px 14px var(--shadow-color);
    background-color: var(--card-bg);
  }

  /* Text sizing same as skill cards */
  .project-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.4rem;
  }

  .project-card h3 a {
    font-weight: 700;
    color: inherit;
  }

  .project-card p {
    font-size: 0.75rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
  }

  .project-card a {
    font-size: 0.75rem;
  }

  /* Disable hover / 3D effects on mobile */
  .project-card:hover {
    transform: none;
    box-shadow: 0 6px 14px var(--shadow-color);
  }

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

/* =========================================
   MOBILE PROJECTS – ANDROID SAFE (≤ 480px)
========================================= */
@media screen and (max-width: 480px) {
  /* 2-column grid like skills (ALL phones) */
  #projects .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
  }

  /* Remove images for compact cards */
  .project-card img {
    display: none;
  }

  /* Match skill-card size exactly */
  .project-card {
    padding: 0.85rem;
    border-radius: 12px;
    background-color: var(--card-bg);
    box-shadow: 0 6px 14px var(--shadow-color);
    min-height: auto;
  }

  /* Title */
  .project-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 0.35rem;
  }

  /* Description */
  .project-card p {
    font-size: 0.75rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
  }

  /* Links */
  .project-card a {
    font-size: 0.75rem;
  }

  /* Disable hover effects on mobile */
  .project-card:hover {
    transform: none;
    box-shadow: 0 6px 14px var(--shadow-color);
  }

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

/* =========================================
   MOBILE 412px – PROJECTS SAME AS SKILLS
========================================= */
@media screen and (max-width: 600px) and (orientation: portrait) {
  /* Force 2-column grid like skills */
  #projects .grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.8rem;
  }

  /* Hide project images (pure card style) */
  .project-card img {
    display: none;
  }

  /* Match skill-card size */
  .project-card {
    padding: 0.9rem;
    border-radius: 12px;
    box-shadow: 0 6px 14px var(--shadow-color);
    background-color: var(--card-bg);
  }

  /* Text sizing same as skill cards */
  .project-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.4rem;
  }

  .project-card p {
    font-size: 0.75rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
  }

  .project-card a {
    font-size: 0.75rem;
  }

  /* Disable hover / 3D effects on mobile */
  .project-card:hover {
    transform: none;
    box-shadow: 0 6px 14px var(--shadow-color);
  }

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

/* additional fix for very small screens */

@media screen and (max-width: 412px) {
  .project-card img {
    display: none;
  }
}

@media screen and (max-width: 600px) {
  .project-card img {
    display: none;
  }
}

@media screen and (max-width: 770px) {
  .project-card img {
    display: none;
  }
}

@media screen and (max-width: 412px) {
  .project-card .p-6 {
    padding-top: 1rem;
  }
}

/* =====================================
   FIX: PROJECT CARD ACTIONS STICK BOTTOM
===================================== */

/* Make project card a vertical layout */
.project-card {
  display: flex;
  flex-direction: column;
}

/* Make inner content fill height */
.project-card > .p-6 {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Push View + GitHub to bottom */
.project-card > .p-6 > .flex {
  margin-top: auto;
}


/* =====================================
   PREMIUM MOBILE MENU – FINAL (SAFE)
===================================== */
@media (max-width: 768px) {
  .mobile-menu {
    position: fixed;
    inset: 0;
    height: 100vh;
    width: 100%;

    display: none; /* 🔥 hidden by default */
    flex-direction: column;
    align-items: center;

    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    padding-top: 5.5rem;
    padding-bottom: 2rem;

    animation: menuFadeSlide 0.35s ease-out;
  }

  /* DARK MODE */
  .dark .mobile-menu {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
  }

  /* ACTIVE STATE */
  .mobile-menu.active {
    display: flex;
  }

  /* MENU LIST */
  .mobile-menu ul {
    width: 100%;
    max-width: 250px;
    padding: 1rem 1.25rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
  }

  /* MENU BUTTONS */
  .mobile-menu a,
  .mobile-menu button {
    width: 100%;
    padding: 1rem 1.25rem;
    border-radius: 16px;

    font-size: 1.05rem;
    font-weight: 600;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.1);

    transition: transform 0.2s ease, background 0.2s ease;
  }

  .dark .mobile-menu a,
  .dark .mobile-menu button {
    background: rgba(30, 41, 59, 0.85);
  }

  .mobile-menu a:active,
  .mobile-menu button:active {
    transform: scale(0.96);
  }

  /* ===== ABSOLUTE ANDROID-SAFE CLOSE BUTTON ===== */
  #close-mobile-menu {
    position: fixed !important;
    top: 16px;
    right: 16px;

    width: 44px;
    height: 44px;

    border-radius: 50%;
    border: none;

    background: rgba(255, 255, 255, 0.95);
    color: #111827;

    font-size: 26px;
    font-weight: 700;
    line-height: 1;

    display: flex !important;
    align-items: center;
    justify-content: center;

    z-index: 2147483647 !important;
    cursor: pointer;
  }

  /* Dark mode */
  .dark #close-mobile-menu {
    background: rgba(0, 0, 0, 0.95);
    color: #f9fafb;
  }

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

@media (max-width: 768px) {
  .mobile-menu {
    height: 100vh;
    width: 100%;
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.9),
      rgba(245, 247, 250, 0.97)
    );
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    overflow-y: auto;
    padding-top: 5.5rem;
  }

  .dark .mobile-menu {
    background: linear-gradient(
      180deg,
      rgba(17, 24, 39, 0.95),
      rgba(2, 6, 23, 0.98)
    );
  }
}

/* FIX: Light mode menu contrast */
.mobile-menu a,
.mobile-menu button {
  color: #111827; /* strong dark text */
}

/* Hover clarity in light mode */
.mobile-menu a:hover,
.mobile-menu button:hover {
  color: #ffffff;
}

#mobile-menu-button {
  margin-left: 250px;
}

#mobile-menu-button {
  border-radius: 9999px;
  transition: background 0.2s ease, transform 0.2s ease;
}

#mobile-menu-button:hover {
  background: rgba(139, 92, 246, 0.15);
  transform: scale(1.05);
}

#close-mobile-menu {
  background: rgba(255, 255, 255, 0.9) !important;
  color: #111827 !important;

  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.dark #close-mobile-menu {
  background: rgba(0, 0, 0, 0.85) !important;
  color: #ffffff !important;

  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

/* ===============================
   PROJECT MODAL – THEME FIX
================================ */

/* Light mode */
.modal-content {
  background-color: #ffffff;
  color: #111827;
}

/* Dark mode */
.dark .modal-content {
  background-color: #1f2937;
  color: #e5e7eb;
}

/* Description text */
#modalDesc {
  color: var(--text-secondary);
}

/* GitHub button – light mode */
#modalGithub {
  border-color: #cbd5f5;
  color: #1f2937;
}

/* GitHub button – dark mode */
.dark #modalGithub {
  border-color: #6b7280;
  color: #e5e7eb;
}

#modalTitle:hover {
  text-decoration: underline;
  opacity: 0.9;
}

/* ===============================
   MODAL BUTTON – LIGHT & DARK FIX
================================ */

/* Default (LIGHT MODE) */
.modal-live-btn {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.35);
}

/* Hover */
.modal-live-btn:hover {
  background-color: var(--accent-hover);
}

/* DARK MODE */
.dark .modal-live-btn {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(167, 139, 250, 0.35);
}

#modalGithub {
  color: var(--text-primary);
  border-color: var(--border-accent);
}

#modalGithub:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* ===============================
   MODAL CLOSE BUTTON – LIGHT & DARK
================================ */

/* Light mode */
.modal-close-btn {
  color: #111827; /* dark visible on white */
}

/* Hover */
.modal-close-btn:hover {
  color: var(--accent-primary);
}

/* Dark mode */
.dark .modal-close-btn {
  color: #e5e7eb; /* light visible on dark */
}

/* Dark hover */
.dark .modal-close-btn:hover {
  color: var(--accent-hover);
}

.modal-close-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: rgba(139, 92, 246, 0.12);
}

/* =====================================
   FIX: MODAL CLOSE BUTTON VISIBILITY
===================================== */

.modal-close-btn {
  z-index: 50;              /* 🔥 above image */
  pointer-events: auto;
}

/* Mobile specific safety */
@media (max-width: 768px) {
  .modal-close-btn {
    top: 12px;
    right: 12px;

    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #111827;

    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  }

  .dark .modal-close-btn {
    background: rgba(0, 0, 0, 0.85);
    color: #f9fafb;
  }
}

/* =====================================
   MOBILE LOGO ALIGNMENT (≤ 412px)
===================================== */
@media screen and (max-width: 480px) {
  header a.flex.items-center {
    margin-left: -30px; /* move logo slightly left */
  }
}
