/* ===== 1. משתנים כלליים (ROOT) ===== */
:root {
  /* צבעים */
  --bg: #ffffff;
  --text: #1f2937;
  --white: #ffffff;
  --accent-soft: #f5f3ff;
  --accent-medium: #ddd6fe;
  --accent-deep: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.15);
  --gray-text: #6b7280;
  --border-color: #ede9fe;
  --modal-overlay: rgba(0, 0, 0, 0.6);

  /* פריסה ומרווחים */
  --nav-height: 70px;
  --container-padding: 10%;
  --section-padding: 8rem var(--container-padding);
  --card-padding: 2.5rem;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-pill: 50px;

  /* טיפוגרפיה */
  --font-main: "Assistant", sans-serif;
  --font-mono: "Fira Code", monospace;

  /* אפקטים ועיצוב מודרני */
  --blur-nav: blur(12px);
  --blur-modal: blur(5px);
  --transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  --shadow-hover: 0 20px 50px var(--accent-glow);
}

/* ===== 2. איפוס והגדרות בסיס ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  direction: rtl; /* כיווניות מימין לשמאל */
  text-align: right; /* יישור טקסט לימין כברירת מחדל */
}

p,
h1,
h2,
h3,
span {
  unicode-bidi: plaintext;
}
/* הגדרת פוקוס לנגישות */
:focus-visible {
  outline: 3px solid var(--accent-medium);
  outline-offset: 4px;
}

/* ===== 3. סרגל ניווט ===== */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 8%;
  position: fixed;
  width: 100%;
  height: var(--nav-height);
  top: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: var(--blur-nav);
  z-index: 1000; /* מתחת למודאל (2000) */
  border-bottom: 1px solid var(--border-color);
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
  position: relative;
  cursor: pointer;
}

.logo::after {
  content: "";
  position: absolute;
  bottom: -4px;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--accent-deep);
  transition: var(--transition);
}

.logo:hover::after {
  width: 100%;
}

.logo span {
  color: var(--accent-deep);
}

nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
}

nav a {
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  transition: var(--transition);
}

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

/* ===== 4. אזור ראשי (Hero) ===== */
.hero {
  height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--container-padding);
  position: relative;
  background: linear-gradient(
    135deg,
    var(--white) 50%,
    var(--accent-soft) 100%
  );
  background-size: 200% 200%;
  animation: gradientMove 10s ease infinite;
}

@keyframes gradientMove {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.hero h1 {
  font-size: clamp(2.8rem, 8vw, 5rem);
  line-height: 1.1;
  margin-bottom: 2rem;
  letter-spacing: -3px;
}

.hero h1 span.highlight {
  color: var(--accent-deep);
  background: linear-gradient(
    to bottom,
    transparent 65%,
    var(--accent-medium) 65%
  );
  background-size: 0% 100%;
  background-repeat: no-repeat;
  animation: highlightLoad 1.5s ease forwards 0.5s;
}

@keyframes highlightLoad {
  to {
    background-size: 100% 100%;
  }
}

.hero p {
  font-size: 1.3rem;
  max-width: 600px;
  color: var(--gray-text);
  font-weight: 300;
  margin-bottom: 3rem;
  opacity: 0;
  animation: fadeIn 1s ease forwards 1s;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* ===== 5. אזור פרויקטים ===== */
.projects {
  padding: var(--section-padding);
  background-color: var(--bg);
  position: relative;
}

.projects::before {
  content: "+ + +";
  position: absolute;
  top: 2rem;
  left: 5%;
  font-family: var(--font-mono);
  color: var(--accent-medium);
  font-size: 2rem;
  opacity: 0.3;
}

.section-header {
  margin-bottom: 5rem;
  border-right: 4px solid var(--accent-medium);
  padding-right: 1.5rem;
}

.section-header h2 {
  font-size: 2.2rem;
  font-weight: 700;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.card {
  background: var(--accent-soft);
  padding: var(--card-padding);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.card:hover {
  border-color: var(--accent-deep);
  background: var(--white);
  transform: translateY(-10px);
  box-shadow: var(--shadow-hover);
}

.card::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 4px;
  background: var(--accent-deep);
  transition: var(--transition);
}

.card:hover::after {
  width: 100%;
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: 6px;
  width: fit-content;
  margin-bottom: 1.2rem;
  transition: var(--transition);
}

/* ===== 6. אזור אודות ===== */
.about {
  padding: var(--section-padding);
  background: var(--accent-soft);
  position: relative;
  overflow: hidden;
}

.about-box {
  max-width: 800px;
  position: relative;
  z-index: 10;
}

/* ===== 7. חלונית מודאל (Modal) ===== */

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: var(--modal-overlay);
  backdrop-filter: var(--blur-modal);
}

.modal-content {
  position: relative;
  background-color: var(--white);
  margin: 5vh auto;
  padding: 40px;
  border-radius: var(--radius-lg);
  width: 95%;
  max-width: 850px;
  box-shadow: var(--shadow-hover);
}

/* סידור במחשב: שתי עמודות */
.modal-flex-container {
  display: flex;
  gap: 40px;
  direction: ltr; /* טקסט משמאל, תמונה מימין */
  align-items: flex-start;
}

.modal-content-col {
  flex: 1.6;
  text-align: center;
}

.modal-title {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -1px;
}

.modal-desc {
  line-height: 1.8;
  font-size: 1.05rem;
  color: var(--gray-text);
}

.modal-side-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-img {
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--accent-soft);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}
/* מוודא שהמכולה של הכפתורים נותנת להם להימתח */
.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px; /* רווח קבוע בין הכפתורים */
  width: 100%; /* תופס את כל רוחב העמודה */
  align-items: stretch; /* הפקודה שגורמת לכולם להיות באותו אורך */
}

/* הגדרה לכפתורים עצמם בתוך המודאל */
.modal-buttons .contact-btn,
.modal-buttons .small-btn {
  width: 100% !important; /* כולם נמתחים לאותו אורך בדיוק */
  display: block !important;
  text-align: center !important;
  padding: 0.8rem 1.5rem !important; /* אחידות בנפח */
  box-sizing: border-box !important;
}

.secondary-btn {
  background: var(--accent-soft) !important;
  color: var(--accent-deep) !important;
  box-shadow: none !important;
}

/* ===== 8. כפתורים ופוטר ===== */
footer {
  padding: 6rem var(--container-padding);
  text-align: center;
  background: var(--bg);
}

footer h2 {
  margin-bottom: 2.5rem;
  font-size: 2.5rem;
  letter-spacing: -1px;
}

.footer-copy {
  margin-top: 4rem;
  color: var(--gray-text);
  font-size: 0.8rem;
  font-weight: 300;
}

.contact-btn {
  display: inline-block;
  padding: 1.2rem 3.5rem;
  background: var(--accent-deep);
  color: var(--white);
  text-decoration: none;
  border-radius: var(--radius-pill);
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 10px 20px var(--accent-glow);
  width: fit-content; /* מחליף את ה-inline style */
  border: none;
  cursor: pointer;
}

.contact-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(139, 92, 246, 0.3);
}

/* ===== 9. Responsive ===== */

/* טאבלטים */
@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* מובייל */
@media (max-width: 768px) {
  /* שחזור רספונסיביות אתר כללית */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hero h1 {
    font-size: 2.8rem;
    letter-spacing: -1px;
  }

  /* תיקון המודאל למובייל */
  .modal-content {
    padding: 30px 20px !important;
    width: 92% !important;
    text-align: center !important;
  }

  .modal-flex-container {
    flex-direction: column !important;
    direction: rtl !important; /* חזרה לעברית */
    align-items: center !important;
    gap: 15px !important;
  }

  .modal-img {
    display: none !important; /* העלמת תמונה במובייל */
  }

  .modal-content-col,
  .modal-side-col,
  .modal-buttons {
    width: 100% !important;
    text-align: center !important;
  }

  /* הכפתורים נמתחים לרוחב הטקסט אך לא נוגעים במסגרת */
  .modal-content .small-btn {
    padding: 1.2rem !important;
    font-size: 1.1rem !important;
    margin-bottom: 10px !important;
    box-sizing: border-box !important;
  }
}
