:root {
  --bg-main: #f8f9fa;
  --bg-secondary: #ffffff;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --accent: #0d9488; /* Teal */
  --accent-hover: #0f766e;
  --border-color: #dee2e6;
  --shadow-color: rgba(0, 0, 0, 0.05);
  --font-family: 'Rubik', sans-serif;
}

[data-theme="dark"] {
  --bg-main: #111827;
  --bg-secondary: #1f2937;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --accent: #2dd4bf; /* Bright Teal */
  --accent-hover: #5eead4;
  --border-color: #374151;
  --shadow-color: rgba(45, 212, 191, 0.1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-family);
  direction: rtl;
  margin: 0;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.site-header {
  text-align: center;
  margin-bottom: 4rem;
  padding-top: 1rem;
  position: relative;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  direction: ltr; /* For correct flexbox ordering */
}

.action-buttons {
  display: flex;
  gap: 0.75rem;
}

.action-btn, .theme-toggle {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover, .theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.theme-toggle .fa-sun { display: none; }
.theme-toggle .fa-moon { display: block; }
[data-theme="dark"] .theme-toggle .fa-sun { display: block; }
[data-theme="dark"] .theme-toggle .fa-moon { display: none; }


.site-header .logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  margin-bottom: 1.5rem;
  margin-top: 3.5rem; /* Make space for top buttons */
}

.site-header h1 {
  font-size: 2.8rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.site-header .tagline {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.section { margin-bottom: 4rem; }
.section-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 500;
  margin-bottom: 2rem;
  color: var(--text-primary);
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  padding-bottom: 0.5rem;
}
.center-title { display: flex; justify-content: center; }

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.highlight-card {
  background-color: var(--bg-secondary);
  padding: 2rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease, border-color 0.3s ease;
  box-shadow: 0 4px 6px -1px var(--shadow-color);
}
.highlight-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
}
.highlight-card h3 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem 0;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.highlight-card p {
  color: var(--text-secondary);
  margin: 0;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background-color: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 6px -1px var(--shadow-color);
}
.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px var(--shadow-color);
}

.card-image-wrapper {
  height: 200px;
  background-color: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.card-image-wrapper.no-image .card-initials {
  font-size: 5rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  user-select: none;
}
.p-color-1 { background: linear-gradient(45deg, #0d9488, #0f766e); }
.p-color-2 { background: linear-gradient(45deg, #be123c, #9f1239); }
.p-color-3 { background: linear-gradient(45deg, #4f46e5, #4338ca); }
.p-color-4 { background: linear-gradient(45deg, #d97706, #b45309); }
[data-theme="dark"] .p-color-1 { background: linear-gradient(45deg, #14b8a6, #2dd4bf); }
[data-theme="dark"] .p-color-2 { background: linear-gradient(45deg, #f43f5e, #fb7185); }
[data-theme="dark"] .p-color-3 { background: linear-gradient(45deg, #6366f1, #818cf8); }
[data-theme="dark"] .p-color-4 { background: linear-gradient(45deg, #f59e0b, #fbbf24); }

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.card-content h4 {
  font-size: 1.25rem;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}
.card-content p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  flex-grow: 1;
  margin-bottom: 1rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.card-tags span {
  background-color: var(--bg-main);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
}

.site-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: none;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.5s ease;
  border: 1px solid var(--border-color);
}
.cookie-banner.show { opacity: 1; }
.cookie-banner p { margin: 0; }
.cookie-button {
  background-color: var(--accent);
  color: var(--bg-main);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 0.3s ease;
  white-space: nowrap;
}
[data-theme="dark"] .cookie-button {
  color: #111827;
}

.cookie-button:hover { background-color: var(--accent-hover); }

@media (max-width: 600px) {
  .header-top { position: static; direction: rtl; padding: 0 0 1rem 0; }
  .site-header .logo { margin-top: 0; }
  .cookie-banner { flex-direction: column; text-align: center; }
}