/* ==========================================================================
   Smart Moon - Landing Page Styles
   Clean, responsive, RTL/LTR. Brand colors from logo.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Design tokens (logo / brand colors)
   --------------------------------------------------------------------------- */
:root {
  /* Primary green – from logo */
  --color-primary: #0d9488;
  --color-primary-dark: #0f766e;
  --color-primary-light: #2dd4bf;
  --color-primary-bg: rgba(13, 148, 136, 0.08);

  /* Neutrals */
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-bg: #ffffff;
  --color-bg-subtle: #f8fafc;
  --color-border: #e2e8f0;

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Typography */
  --font-ar: 'Tajawal', sans-serif;
  --font-en: 'Plus Jakarta Sans', sans-serif;
  --font-body: var(--font-ar);
  --font-heading: var(--font-ar);

  /* Layout */
  --container-max: 75rem;
  --container-padding: 1.25rem;
  --header-height: 4.5rem;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.06);
}

/* LTR (English) overrides */
[dir="ltr"] {
  --font-body: var(--font-en);
  --font-heading: var(--font-en);
}

/* ---------------------------------------------------------------------------
   Base & reset
   --------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

[dir="ltr"] body {
  text-align: left;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-dark);
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---------------------------------------------------------------------------
   Skip link (a11y)
   --------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  transition: top 0.2s;
}

.skip-link:focus {
  top: var(--space-md);
}

/* ---------------------------------------------------------------------------
   Layout: container
   --------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  min-width: 0;
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

/* ---------------------------------------------------------------------------
   Header
   --------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: var(--space-md);
  min-width: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
  flex-shrink: 1;
  color: var(--color-text);
}

.logo:hover {
  color: var(--color-text);
}

.logo-img {
  height: 2.75rem;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  overflow: hidden;
}

.logo-name {
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo-tagline {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.nav-main {
  flex: 1;
  display: flex;
  justify-content: center;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav-menu a {
  color: var(--color-text);
  font-weight: 500;
  padding: var(--space-sm) 0;
}

.nav-menu a:hover {
  color: var(--color-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.lang-switch {
  padding: 0.375rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--color-bg-subtle);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.lang-switch:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
}

/* ---------------------------------------------------------------------------
   Hero
   --------------------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 32rem;
  display: flex;
  align-items: center;
  padding-block: var(--space-3xl);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  /* خلفية احتياطية تظهر عند عدم وجود صورة الهيدر */
  background: linear-gradient(135deg, var(--color-bg-subtle) 0%, var(--color-primary-bg) 50%, rgba(255, 255, 255, 0.95) 100%);
}

.hero-bg-img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* طبقة خفيفة فقط لتحسين وضوح النص فوق الصورة دون إخفاء الخلفية */
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.08) 60%, transparent 100%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  align-items: center;
}

.hero-content {
  max-width: 36rem;
}

.hero-title {
  margin: 0 0 var(--space-lg);
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--color-text);
}

.hero-desc {
  margin: 0 0 var(--space-xl);
  font-size: 1.0625rem;
  color: var(--color-text-muted);
  max-width: 28rem;
}

.hero-content .btn-lg {
  margin-bottom: var(--space-xl);
}

.hero-scroll {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  border: 2px solid var(--color-primary);
  border-radius: 9999px;
}

.hero-scroll:hover {
  color: var(--color-primary);
  border-color: var(--color-primary-dark);
}

.scroll-icon {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid currentColor;
  border-top: none;
  border-radius: 0 0 50% 50%;
  animation: scroll-bounce 2s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ---------------------------------------------------------------------------
   Sections common
   --------------------------------------------------------------------------- */
.main-content {
  min-width: 0;
}

.section {
  padding-block: var(--space-3xl);
  min-width: 0;
}

.section-title {
  margin: 0 0 var(--space-md);
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 700;
  text-align: center;
  color: var(--color-text);
}

.section-desc {
  margin: 0 auto var(--space-2xl);
  max-width: 36rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 1rem;
}

/* قسم خدماتنا – صورة خلفية */
#services.section-why {
  position: relative;
  background-image: url('../images/services.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#services.section-why::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  z-index: 0;
}

#services.section-why .container {
  position: relative;
  z-index: 1;
}

/* ---------------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------------- */
.cards {
  display: grid;
  gap: var(--space-xl);
  min-width: 0;
}

.cards-three {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}

.cards-four {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: var(--space-md);
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-radius: var(--radius);
}

.card-icon-cloud::before {
  content: '☁';
  font-size: 1.5rem;
}

.card-icon-shield::before {
  content: '🛡';
  font-size: 1.5rem;
}

.card-icon-dev::before {
  content: '⟳';
  font-size: 1.5rem;
  font-weight: bold;
}

.card-icon-briefcase::before {
  content: '💼';
  font-size: 1.5rem;
}

.card-icon-price::before {
  content: '⏱';
  font-size: 1.5rem;
}

.card-icon-star::before {
  content: '★';
  font-size: 1.5rem;
}

.card-icon-calendar::before {
  content: '📅';
  font-size: 1.5rem;
}

.card-title {
  margin: 0 0 var(--space-sm);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.card-text {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* ---------------------------------------------------------------------------
   Services list (legal / types)
   --------------------------------------------------------------------------- */
.services-list {
  margin-top: var(--space-2xl);
  padding: var(--space-lg);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-lg);
  max-width: 40rem;
  margin-inline: auto;
}

.services-intro {
  margin: 0 0 var(--space-md);
  font-weight: 600;
  color: var(--color-text);
}

.services-list ul li {
  position: relative;
  padding-inline-start: 1.25rem;
  margin-bottom: var(--space-sm);
  color: var(--color-text-muted);
}

.services-list ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.4rem;
  height: 0.4rem;
  background: var(--color-primary);
  border-radius: 50%;
}

[dir="rtl"] .services-list ul li {
  padding-inline-start: 0;
  padding-inline-end: 1.25rem;
}

[dir="rtl"] .services-list ul li::before {
  left: auto;
  right: 0;
}

/* ---------------------------------------------------------------------------
   Contact
   --------------------------------------------------------------------------- */
.section-contact {
  background: var(--color-bg-subtle);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  margin-top: var(--space-xl);
}

.contact-info .legal {
  margin: 0 0 var(--space-lg);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--color-text);
}

.contact-item:hover {
  color: var(--color-primary);
}

a.contact-item {
  text-decoration: none;
}

.contact-icon {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  background: var(--color-primary);
  border-radius: 50%;
  position: relative;
}

.contact-icon-phone::after {
  content: '';
  position: absolute;
  inset: 30%;
  border: 2px solid #fff;
  border-radius: 50%;
  border-top-color: transparent;
  transform: rotate(-45deg);
}

.contact-icon-email::after {
  content: '';
  position: absolute;
  inset: 25% 20%;
  border: 2px solid #fff;
  border-top: none;
  border-radius: 0 0 50% 50%;
}

.contact-icon-pin::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 6px 0 -2px #fff;
}

.contact-address {
  display: flex;
}

.map-caption {
  margin: 0 0 var(--space-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.map-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-border);
}

.map-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */
.site-footer {
  padding-block: var(--space-xl);
  background: var(--color-primary);
  color: #fff;
}

.site-footer a {
  color: #fff;
}

.site-footer a:hover {
  color: rgba(255, 255, 255, 0.9);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  text-align: center;
}

.footer-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.footer-brand-block {
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

.logo-img-sm {
  height: 2rem;
  max-width: 90px;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.footer-brand .logo-name {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.footer-tagline {
  margin: 0;
  font-size: 0.875rem;
  opacity: 0.9;
}

.footer-col-title {
  margin: 0 0 var(--space-xs);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.footer-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  line-height: 1.6;
  opacity: 0.95;
}

.footer-list li {
  margin-bottom: 0.25rem;
}

.footer-link {
  text-decoration: none;
}

.footer-bottom {
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  text-align: center;
}

.footer-copyright {
  margin: 0;
  font-size: 0.8125rem;
  opacity: 0.9;
}

@media (min-width: 48rem) {
  .footer-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-2xl);
    text-align: start;
  }

  .footer-col {
    align-items: flex-start;
  }

  .footer-brand-block {
    text-align: start;
  }

  .footer-brand {
    justify-content: flex-start;
  }
}

/* ---------------------------------------------------------------------------
   Responsive: tablet and up
   --------------------------------------------------------------------------- */
@media (min-width: 48rem) {
  :root {
    --container-padding: 2rem;
  }

  .contact-grid {
    grid-template-columns: 1fr 1.2fr;
  }
}

/* ---------------------------------------------------------------------------
   Responsive: mobile nav
   --------------------------------------------------------------------------- */
@media (max-width: 47.9375rem) {
  :root {
    --container-padding: 1rem;
  }

  /* هيدر ثابت عند السكرول في الريسبونسيف */
  .site-header {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
  }

  .main-content {
    padding-top: var(--header-height);
  }

  /* ترتيب: لوجو | EN | هامبرغر (مكان زر اتصل بنا) */
  .header-inner {
    flex-wrap: nowrap;
  }

  .logo {
    order: 1;
  }

  .header-actions {
    order: 2;
    flex-shrink: 0;
    gap: var(--space-sm);
  }

  .header-actions .btn {
    display: none;
  }

  .nav-main {
    order: 3;
    flex: 0 0 auto;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: var(--space-lg);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
  }

  .nav-menu[hidden] {
    display: none;
  }

  .nav-menu:not([hidden]) {
    display: flex;
  }

  .logo-tagline {
    display: none;
  }

  .logo-img {
    max-width: 100px;
    height: 2.25rem;
  }

  .cards-three,
  .cards-four {
    grid-template-columns: 1fr;
  }

  .card {
    padding: var(--space-lg);
  }
}

/* ---------------------------------------------------------------------------
   Responsive: small mobile
   --------------------------------------------------------------------------- */
@media (max-width: 23.4375rem) {
  :root {
    --container-padding: 0.75rem;
  }

  .header-inner {
    gap: var(--space-sm);
  }

  .logo-text .logo-name {
    font-size: 0.9375rem;
  }

  .logo-img {
    max-width: 80px;
    height: 2rem;
  }

  .header-actions .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }
}
