/* =============================================================
   Tamkeen — Landing Page
   Style inspiré de Fylo : palette teal/navy, courbes, cartes.
   Police Cairo, thèmes light/dark, i18n (LTR/RTL), responsive.
   ============================================================= */

/* ---------- 1. Tokens : Light (par défaut) ---------- */
:root {
  color-scheme: light;

  --bg:        #FFFFFF;
  --bg-alt:    #F9FAFB;
  --card:      #FFFFFF;
  --cta-bg:    #E9EBEF;
  --field-bg:  #FFFFFF;
  --text:      #1B2330;
  --muted:     #64748B;
  --border:    #E5E7EB;

  /* Accent Fylo (teal) */
  --accent:      #62E0D9;
  --accent-dim:  #43C9C2;
  --accent-ink:  #0B7A72;   /* teal lisible sur fond clair */
  --on-accent:   #1B2330;   /* texte foncé sur teal */

  --hero-fg:   #FFFFFF;
  --footer-bg: #0B1524;

  --header-bg: rgba(255, 255, 255, .9);
  --header-fg: var(--text);

  --ring:      color-mix(in srgb, var(--accent) 60%, transparent);
  --shadow-sm: 0 1px 2px rgba(27, 35, 48, .06);
  --shadow-md: 0 24px 48px -28px rgba(27, 35, 48, .35);
  --shadow-lg: 0 40px 80px -40px rgba(27, 35, 48, .45);

  --font-sans: 'Cairo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --radius:    10px;
  --radius-lg: 14px;
  --pill:      999px;
  --header-h:  84px;
  --maxw:      1140px;
  --ease:      cubic-bezier(.22, .61, .36, 1);
}

/* ---------- 2. Tokens : Dark ---------- */
[data-theme="dark"] {
  color-scheme: dark;

  --bg:      #181F2B;
  --bg-alt:  #1C2431;
  --card:    #202A3C;
  --cta-bg:  #202A3C;
  --field-bg:#181F2B;
  --text:    #FFFFFF;
  --muted:   #C9D5E1;
  --border:  #2C3A4E;

  --accent:     #62E0D9;
  --accent-dim: #7EEAE4;
  --accent-ink: #62E0D9;

  --header-bg: rgba(24, 31, 43, .9);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 24px 48px -28px rgba(0, 0, 0, .8);
  --shadow-lg: 0 40px 80px -40px rgba(0, 0, 0, .9);
}

/* En haut de page, au-dessus du hero vidéo : accent teal vif */
.site-header.is-over-hero { --accent-ink: #62E0D9; }

/* ---------- 3. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }

h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
  border-radius: 8px;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 32px);
}

.skip-link {
  position: fixed;
  inset-block-start: 10px;
  inset-inline-start: 10px;
  z-index: 200;
  transform: translateY(-160%);
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 16px;
  border-radius: var(--pill);
  font-weight: 700;
  transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- 4. Typographie utilitaire ---------- */
.eyebrow {
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 16px;
}
.eyebrow--center { text-align: center; }
html[lang="ar"] .eyebrow { letter-spacing: normal; }

.section { padding-block: clamp(72px, 9vw, 120px); }
.section--alt { background: var(--bg-alt); }

.section__head { max-width: 660px; margin-inline: auto; margin-bottom: clamp(48px, 7vw, 80px); text-align: center; }
.section__title {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 700;
  text-wrap: balance;
}
.section__lead {
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.1rem);
  line-height: 1.75;
}

/* ---------- 5. Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 34px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  transition: transform .2s var(--ease), background-color .2s var(--ease),
              box-shadow .2s var(--ease), color .2s var(--ease);
  will-change: transform;
}
.btn .icon { width: 18px; height: 18px; }
.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 18px 36px -18px color-mix(in srgb, var(--accent) 90%, transparent);
}
.btn--primary:hover { background: var(--accent-dim); transform: scale(.96); }
.btn--primary:active { transform: scale(.94); }

/* ---------- 6. Header ---------- */
.site-header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  color: var(--header-fg);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color .3s var(--ease), border-color .3s var(--ease),
              color .3s var(--ease), backdrop-filter .3s var(--ease);
}
.header__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.site-header.is-over-hero { --header-fg: #FFFFFF; --header-border: transparent; }
.site-header.is-scrolled {
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom-color: var(--border);
  --header-fg: var(--text);
}

/* Logo adaptatif : onLight (logo foncé) / onDark (logo clair) */
.brand { display: inline-flex; align-items: center; flex: none; margin-inline-end: auto; }
.brand__logo { height: 46px; width: auto; }
.brand__logo--onDark { display: none; }
[data-theme="dark"] .brand__logo--onLight { display: none; }
[data-theme="dark"] .brand__logo--onDark { display: block; }
.site-header.is-over-hero .brand__logo--onLight { display: none; }
.site-header.is-over-hero .brand__logo--onDark { display: block; }

/* Contrôles */
.header__controls { display: flex; align-items: center; gap: 18px; flex: none; }

/* Sélecteur de langue : langue courante + menu déroulant */
.lang { position: relative; }
.lang__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--header-fg);
  font-size: .86rem;
  font-weight: 700;
  letter-spacing: .06em;
  transition: color .2s var(--ease), opacity .2s var(--ease);
}
.lang__toggle:hover { color: var(--accent-ink); }
.lang__chevron { width: 15px; height: 15px; transition: transform .2s var(--ease); }
.lang__toggle[aria-expanded="true"] .lang__chevron { transform: rotate(180deg); }

.lang__menu {
  position: absolute;
  inset-block-start: calc(100% + 10px);
  inset-inline-end: 0;
  z-index: 120;
  min-width: 150px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 2px;
}
.lang__menu[hidden] { display: none; }
.lang__btn {
  width: 100%;
  text-align: start;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: .92rem;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: 8px;
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.lang__btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.lang__btn.is-active { color: var(--on-accent); background: var(--accent); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--header-fg);
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.icon-btn:hover { color: var(--accent-ink); transform: translateY(-1px); }
.icon-btn .icon { width: 21px; height: 21px; }

/* Icônes selon le thème */
.icon--sun { display: none; }
[data-theme="dark"] .icon--moon { display: none; }
[data-theme="dark"] .icon--sun { display: block; }

/* ---------- 7. Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
  color: var(--hero-fg);
  background: #0B1524;
  padding-block: calc(var(--header-h) + 40px) clamp(150px, 16vw, 210px);
}
.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 32%;
  z-index: 0;
}
.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to top, rgba(11,21,36,.94) 0%, rgba(11,21,36,.58) 45%, rgba(11,21,36,.68) 100%),
    radial-gradient(85% 70% at 50% 42%, rgba(98,224,217,.18), transparent 62%);
}
.hero__content { position: relative; z-index: 2; }

.hero__title {
  margin-inline: auto;
  max-width: 20ch;
  font-size: clamp(2.4rem, 6.5vw, 4.6rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  text-wrap: balance;
}
.hero__line { display: block; }
.hero__line--future { margin-top: .12em; }

/* Signature : le mot « avenir » contouré puis rempli d'un dégradé teal */
.future {
  color: transparent;
  -webkit-text-stroke: 1.4px var(--accent);
  text-stroke: 1.4px var(--accent);
  white-space: nowrap;
}
.future__fill {
  background: linear-gradient(100deg, var(--accent) 0%, #B8F5F1 70%, #FFFFFF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  opacity: 0;
  animation: future-fill 1.3s var(--ease) .85s forwards;
}
@keyframes future-fill { to { opacity: 1; } }

.hero__actions {
  margin-top: 42px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

/* Courbe de transition vers la section suivante */
.hero__wave {
  position: absolute;
  inset-inline: 0;
  inset-block-end: -1px;
  z-index: 2;
  line-height: 0;
  color: var(--bg-alt);
}
.hero__wave svg { width: 100%; height: clamp(70px, 9vw, 130px); }

/* ---------- 8. Services (Features) ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(44px, 6vw, 76px) clamp(32px, 6vw, 96px);
}
.feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform .3s var(--ease);
}
.feature:hover { transform: translateY(-4px); }
.feature__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  margin-bottom: 22px;
  color: var(--accent);
}
.feature__icon svg { width: 60px; height: 60px; }
.feature__title { font-size: 1.25rem; font-weight: 700; margin-bottom: 10px; }
.feature__text { color: var(--muted); max-width: 44ch; font-size: 1rem; }

/* ---------- 9. À propos (Productive) ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 7vw, 88px);
  align-items: center;
}
.split__media { color: var(--accent); }
.illustration { width: 100%; height: auto; }
.split__title { font-size: clamp(1.6rem, 3.2vw, 2.35rem); font-weight: 700; }
.split__lead { margin-top: 20px; color: var(--muted); font-size: 1.05rem; line-height: 1.75; }

.principle-list { margin-top: 30px; display: grid; gap: 20px; }
.principle-list li { display: grid; grid-template-columns: auto 1fr; gap: 15px; align-items: start; }
.principle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-ink);
}
.principle__icon svg { width: 22px; height: 22px; }
.principle__title { font-size: 1.05rem; margin-bottom: 4px; }
.principle__text { color: var(--muted); font-size: .96rem; line-height: 1.6; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
  padding-bottom: 3px;
  color: var(--accent-ink);
  font-weight: 700;
  border-bottom: 1px solid var(--accent);
  transition: gap .2s var(--ease), color .2s var(--ease);
}
.link-arrow:hover { gap: 16px; }
.link-arrow svg { width: 18px; height: 18px; }
html[dir="rtl"] .link-arrow svg { transform: scaleX(-1); }

/* ---------- 10. Contact (Early access) ---------- */
.contact { background: var(--bg); padding-block: clamp(48px, 6vw, 72px) clamp(72px, 9vw, 120px); }
.contact__card {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  background: var(--cta-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(32px, 5vw, 56px);
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.contact__title { font-size: clamp(1.6rem, 3.4vw, 2.3rem); font-weight: 700; }
.contact__lead { margin: 16px auto 0; max-width: 58ch; color: var(--muted); }

.form { margin-top: 34px; text-align: start; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field__label { font-size: .86rem; font-weight: 600; color: var(--text); }
.field__input {
  width: 100%;
  font: inherit;
  font-size: .97rem;
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field__input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.field__input:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
.field__input--area { resize: vertical; min-height: 120px; }
.field__input:user-invalid { border-color: #E24A4A; }

.form__submit { width: 100%; margin-top: 8px; }
.form__submit:disabled { opacity: .65; cursor: wait; transform: none; }
.form-response {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: .92rem;
  font-weight: 600;
  display: none;
}
.form-response.success {
  display: block;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
}
.form-response.error {
  display: block;
  background: color-mix(in srgb, #E24A4A 12%, transparent);
  color: #E24A4A;
  border-color: color-mix(in srgb, #E24A4A 45%, transparent);
}

.contact__details {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 40px;
}
.contact__details li { display: flex; align-items: center; gap: 10px; }
.contact__ico { display: inline-flex; color: var(--accent-ink); }
.contact__ico svg { width: 22px; height: 22px; }
.contact__value { font-size: .95rem; font-weight: 600; }
a.contact__value { color: var(--accent-ink); }
a.contact__value:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 11. Footer ---------- */
.site-footer {
  background: var(--footer-bg);
  color: #E2E8F0;
  padding-block: clamp(56px, 7vw, 82px) 30px;
}
.footer__inner {
  display: grid;
  grid-template-columns: 1.7fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 46px;
  border-bottom: 1px solid rgba(226, 232, 240, .12);
}
.footer__logo { height: 50px; width: auto; margin-bottom: 20px; }
.footer__tagline { max-width: 38ch; color: #94A3B8; font-size: .97rem; line-height: 1.7; }
.footer__contact { margin-top: 24px; display: grid; gap: 12px; }
.footer__contact li { display: flex; align-items: center; gap: 12px; color: #CBD5E1; font-size: .95rem; }
.footer__contact a:hover { color: var(--accent); }
.footer__ico { display: inline-flex; color: var(--accent); }
.footer__ico svg { width: 16px; height: 16px; }

.footer__heading {
  display: block;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #64748B;
  margin-bottom: 18px;
}
html[lang="ar"] .footer__heading { letter-spacing: normal; }
.footer__nav { display: flex; flex-direction: column; }
.footer__nav a { padding: 5px 0; color: #CBD5E1; font-size: .96rem; width: fit-content; transition: color .2s var(--ease); }
.footer__nav a:hover { color: var(--accent); }
.footer__social-links { display: flex; gap: 12px; }
.footer__social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--pill);
  border: 1px solid rgba(226, 232, 240, .18);
  color: #CBD5E1;
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease), transform .2s var(--ease);
}
.footer__social-links a:hover { color: var(--on-accent); background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.footer__social-links svg { width: 20px; height: 20px; }

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 26px;
}
.footer__copy { color: #64748B; font-size: .87rem; }
.footer__top {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  color: #CBD5E1;
  font-size: .87rem;
  transition: color .2s var(--ease);
}
.footer__top:hover { color: var(--accent); }
.footer__top .icon { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.footer__top:hover .icon { transform: translateY(-3px); }

/* Sens des flèches en RTL */
html[dir="rtl"] .icon--arrow { transform: scaleX(-1); }

/* ---------- 12. Révélation au défilement ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--d, 0ms);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- 13. Responsive ---------- */
@media (max-width: 1024px) {
  .split { grid-template-columns: 1fr; gap: 48px; }
  .split__media { max-width: 520px; margin-inline: auto; }
  .footer__inner { grid-template-columns: 1.4fr 1fr 1fr; }
}

@media (max-width: 860px) {
  .features-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  body { font-size: 16px; }
  .footer__inner { grid-template-columns: 1fr; gap: 34px; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }
  .contact__details { flex-direction: column; align-items: center; gap: 14px; text-align: center; }
}

@media (max-width: 640px) {
  .hero { min-height: 94svh; }
  .form__row { grid-template-columns: 1fr; }
  .brand__logo { height: 36px; }
  .lang__toggle { padding: 6px 2px; }
  .header__controls { gap: 10px; }
  .contact__card { text-align: start; }
  .contact__card .eyebrow--center { text-align: start; }
}

/* ---------- 14. Préférences de mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .future__fill { opacity: 1; animation: none; }
}
