/* =========================================================
   AI additions: guided chat, AI service blocks, case study
   strip, inner pages (AI services, industries) and footer.
   Uses the site's existing colour variables from utilities.css.
   ========================================================= */

/* ---------- Guided chat ("Apptology Assistant") ---------- */
.ai-chat {
  background: #0b0b0b;
  border: 1px solid #ffffff1f;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(121, 183, 83, 0.35);
  font-family: "Neue Montreal", sans-serif;
  color: #fff;
}

.ai-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #ffffff1a;
  font-family: Poppins, sans-serif;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffffffb3;
}

.ai-chat__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-chat__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #b9e59b, var(--green-pri) 55%, #2f5a1a);
  flex-shrink: 0;
}

.ai-chat__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-pri);
  box-shadow: 0 0 0 4px rgba(121, 183, 83, 0.2);
}

.ai-chat__log {
  height: 340px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.ai-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.55;
  animation: ai-pop 0.25s ease-out;
}

.ai-msg--bot {
  align-self: flex-start;
  background: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.ai-msg--user {
  align-self: flex-end;
  background: var(--green-pri);
  color: #040404;
  border-bottom-right-radius: 4px;
}

.ai-msg--typing {
  display: flex;
  gap: 5px;
  align-items: center;
}

.ai-msg--typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff80;
  animation: ai-blink 1s infinite;
}

.ai-msg--typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-msg--typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-pop {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

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

.ai-chat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 14px;
}

.ai-chip {
  border: 1px solid #ffffff33;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  color: #fff;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.ai-chip:hover,
.ai-chip:focus-visible {
  border-color: var(--green-pri);
  background: rgba(121, 183, 83, 0.12);
  outline: none;
}

.ai-chat__form {
  display: flex;
  gap: 8px;
  padding: 14px 20px 20px;
  border-top: 1px solid #ffffff1a;
}

.ai-chat__form input {
  flex: 1;
  min-width: 0;
  background: #141414;
  border: 1px solid #ffffff26;
  border-radius: 12px;
  padding: 12px 14px;
  color: #fff;
  font-size: 15px;
}

.ai-chat__form input:focus {
  outline: none;
  border-color: var(--green-pri);
}

.ai-chat__send {
  background: var(--green-pri);
  color: #040404;
  border-radius: 12px;
  padding: 0 16px;
  font-weight: 500;
  flex-shrink: 0;
}

.ai-chat__send:disabled {
  opacity: 0.5;
}

.ai-chat__note {
  padding: 0 20px 16px;
  font-size: 12px;
  color: #ffffff73;
}

/* ---------- Home: AI section ---------- */
.ai-section {
  background: var(--black-pri);
  color: #fff;
  padding: 120px 0;
  position: relative;
  overflow: hidden;
}

.ai-section::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 70vw;
  height: 70vw;
  max-width: 900px;
  max-height: 900px;
  background: radial-gradient(circle, rgba(121, 183, 83, 0.18), transparent 60%);
  pointer-events: none;
}

.ai-eyebrow {
  font-family: Poppins, sans-serif;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green-pri);
}

.ai-points li {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #ffffff1a;
}

.ai-points li::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 9px;
  border-radius: 50%;
  background: var(--green-pri);
  flex-shrink: 0;
}

/* ---------- Case study strip ---------- */
.ai-case {
  border: 1px solid #ffffff1f;
  border-radius: 20px;
  background: linear-gradient(135deg, #111 0%, #0a0a0a 60%, #13200c 100%);
}

.ai-case__metric {
  font-family: "Playfair Display", serif;
  font-size: clamp(64px, 9vw, 120px);
  line-height: 1;
  color: var(--green-pri);
}

.ai-tag {
  display: inline-block;
  border: 1px solid #ffffff2e;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: #ffffffb3;
}

.ai-stat {
  border-top: 1px solid #ffffff26;
  padding-top: 14px;
}

.ai-stat b {
  display: block;
  font-family: "Playfair Display", serif;
  font-weight: 500;
  font-size: 32px;
  color: #fff;
}

/* ---------- Inner pages (AI services, industries) ---------- */
.page-hero {
  background: var(--black-pri);
  color: #fff;
  padding: 80px 0 100px;
  position: relative;
  overflow: hidden;
}

.page-hero::after {
  content: "";
  position: absolute;
  top: -30%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  max-width: 800px;
  max-height: 800px;
  background: radial-gradient(circle, rgba(121, 183, 83, 0.16), transparent 60%);
  pointer-events: none;
}

.page-hero h1 {
  font-family: "Playfair Display", serif;
  font-weight: 500;
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1.12;
}

.page-section {
  padding: 96px 0;
}

.page-section--dark {
  background: var(--black-pri);
  color: #fff;
}

.page-section--light {
  background: #fff;
  color: #101010;
}

.page-section h2 {
  font-family: "Playfair Display", serif;
  font-weight: 500;
  font-size: clamp(32px, 4.4vw, 56px);
  line-height: 1.15;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.info-card {
  border: 1px solid #ffffff1f;
  border-radius: 18px;
  padding: 28px;
  background: #0d0d0d;
  transition: border-color 0.25s, transform 0.25s;
}

.page-section--light .info-card {
  background: #fafafa;
  border-color: #10101014;
}

a.info-card:hover {
  border-color: var(--green-pri);
  transform: translateY(-3px);
}

.info-card h3 {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 10px;
}

.info-card p {
  font-size: 15px;
  line-height: 1.65;
  opacity: 0.75;
}

.info-card .card-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--green-pri);
  font-size: 14px;
}

.step-num {
  font-family: Poppins, sans-serif;
  font-size: 13px;
  color: var(--green-pri);
}

.quote-card {
  border-left: 2px solid var(--green-pri);
  padding: 6px 0 6px 20px;
  font-family: "Playfair Display", serif;
  font-size: 22px;
  line-height: 1.45;
}

.faq details {
  border-bottom: 1px solid #10101020;
  padding: 22px 0;
}

.page-section--dark .faq details {
  border-bottom-color: #ffffff1f;
}

.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 19px;
  font-weight: 500;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  color: var(--green-pri);
  font-size: 24px;
  line-height: 1;
}

.faq details[open] summary::after { content: "−"; }

.faq details p {
  margin-top: 14px;
  line-height: 1.7;
  opacity: 0.8;
}

.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stack-list span {
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  opacity: 0.75;
}

.cta-band {
  border-radius: 24px;
  background: linear-gradient(120deg, #13200c, #0b0b0b 55%);
  border: 1px solid #ffffff1f;
  color: #fff;
}

.nav-links a.is-active {
  color: var(--green-pri);
}

/* ---------- Footer (site-wide) ---------- */
.site-footer {
  background: var(--black-pri);
  color: #fff;
  font-family: "Neue Montreal", sans-serif;
  padding: 96px 0 40px;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr);
  gap: 48px;
}

.site-footer h4 {
  font-family: Poppins, sans-serif;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffffff80;
  margin-bottom: 18px;
}

.site-footer ul li {
  margin-bottom: 12px;
}

.site-footer ul a {
  color: #ffffffd9;
  font-size: 15px;
  transition: color 0.2s;
}

.site-footer ul a:hover {
  color: var(--green-pri);
}

.site-footer__offices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
  padding: 48px 0;
  margin-top: 56px;
  border-top: 1px solid #ffffff1a;
  border-bottom: 1px solid #ffffff1a;
}

.site-footer__offices b {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
}

.site-footer__offices span {
  font-size: 13px;
  line-height: 1.6;
  color: var(--gray-pri);
}

@media (max-width: 1024px) {
  .site-footer__grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .site-footer__brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .ai-section { padding: 80px 0; }
  .page-section { padding: 64px 0; }
  .page-hero { padding: 48px 0 72px; }
  .ai-chat__log { height: 300px; }
  .site-footer__grid { gap: 36px; }
}

/* Arabic pages */
/* rtl.css flips some flex rows on Arabic pages that are laid out left-to-right.
   The new footer and AI section are already right-to-left, so undo that flip. */
[lang="ar"] .site-footer .flex.justify-between,
[lang="ar"] [dir="rtl"] .flex.gap-2.mt-6 {
  flex-direction: row;
}

[lang="ar"] .ai-msg--bot { border-bottom-left-radius: 16px; border-bottom-right-radius: 4px; }
[lang="ar"] .ai-msg--user { border-bottom-right-radius: 16px; border-bottom-left-radius: 4px; }
[lang="ar"] .quote-card { border-left: 0; border-right: 2px solid var(--green-pri); padding: 6px 20px 6px 0; }
[lang="ar"] .ai-eyebrow,
[lang="ar"] .site-footer h4,
[lang="ar"] .ai-chat__head { letter-spacing: 0; }

/* ---------- "AI Factory" header menu ---------- */
.ai-menu {
  position: relative;
}

.nav .green-btn {
  white-space: nowrap;
}

/* Keep the logo full size and tighten link spacing on tablets,
   now that the header carries the AI Factory menu too. */
.nav .app-container > a:first-child {
  flex-shrink: 0;
}

.nav .app-container a {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .nav .app-container .md\:gap-16,
  .nav .app-container .md\:gap-12 {
    gap: 24px;
  }
}

@media (max-width: 767px) {
  .nav .app-container {
    padding-left: 24px;
    padding-right: 24px;
  }
  .nav .app-container .md\:gap-16,
  .nav .app-container .md\:gap-12 {
    gap: 16px;
  }
}

.ai-menu__btn {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  font: inherit;
  background: none;
  cursor: pointer;
}

.ai-menu__btn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-pri);
  box-shadow: 0 0 0 3px rgba(121, 183, 83, 0.25);
}

.ai-menu__btn i {
  font-size: 10px;
  transition: transform 0.2s;
}

.ai-menu__btn.is-active,
.ai-menu.is-open .ai-menu__btn {
  color: var(--green-pri);
}

.ai-menu.is-open .ai-menu__btn i {
  transform: rotate(180deg);
}

.ai-menu__panel {
  position: absolute;
  top: calc(100% + 16px);
  right: -24px;
  width: min(580px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 24px;
  padding: 22px;
  background: #0b0b0b;
  border: 1px solid #ffffff1f;
  border-radius: 18px;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.8), 0 0 60px -30px rgba(121, 183, 83, 0.45);
  color: #fff;
  font-family: "Neue Montreal", sans-serif;
  text-align: start;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
  z-index: 300;
}

/* invisible bridge so the panel stays open while the pointer moves down to it */
.ai-menu__panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -18px;
  height: 18px;
}

.ai-menu.is-open .ai-menu__panel {
  opacity: 1;
  visibility: visible;
  transform: none;
}

@media (hover: hover) {
  .ai-menu:hover .ai-menu__panel {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
}

.ai-menu__label {
  font-family: Poppins, sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffffff80;
  margin-bottom: 12px;
}

.ai-menu__card {
  display: block;
  padding: 14px 16px;
  border: 1px solid #ffffff14;
  border-radius: 14px;
  margin-bottom: 10px;
  transition: border-color 0.2s, background 0.2s;
}

.ai-menu__card:hover,
.ai-menu__card:focus-visible {
  border-color: var(--green-pri);
  background: rgba(121, 183, 83, 0.08);
  outline: none;
}

.ai-menu__card b {
  display: block;
  font-weight: 500;
  font-size: 15px;
}

.ai-menu__card span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: #ffffffa6;
}

.ai-menu__list li a {
  display: block;
  padding: 7px 0;
  font-size: 14px;
  color: #ffffffd9;
  transition: color 0.2s;
}

.ai-menu__list li a:hover,
.ai-menu__all:hover {
  color: var(--green-pri);
}

.ai-menu__all {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--green-pri);
}

/* Arabic: the menu sits on the left of the header, so open the panel to the right */
[lang="ar"] .ai-menu__panel {
  right: auto;
  left: -24px;
}

[lang="ar"] .ai-menu__label {
  letter-spacing: 0;
}

/* Phone menu group */
.ai-menu-mobile {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 24px;
  border-bottom: 1px solid #ffffff1f;
}

.ai-menu-mobile__label {
  font-family: Poppins, sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green-pri);
}

[lang="ar"] .ai-menu-mobile__label {
  letter-spacing: 0;
}

@media (max-width: 760px) {
  .ai-menu__panel {
    grid-template-columns: 1fr;
  }
}

/* ---------- EN | AR language switcher (shared; matches rtl.css) ---------- */
.language-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.language-switcher a {
  padding: 0.25rem 0.5rem;
  border-radius: 15px;
  transition: all 0.3s;
}

.language-switcher a.active {
  background-color: #8BC34A;
  color: white;
}

.language-switcher a:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Phones: keep logo, EN | AR, "Schedule call" and the menu button on one line */
@media (max-width: 639px) {
  .nav .app-container .nav-links,
  .nav .app-container .flex.items-center.gap-4 {
    gap: 10px;
  }
  .nav .language-switcher {
    gap: 4px;
    padding: 2px 6px;
    font-size: 12px;
  }
  .nav .language-switcher a {
    padding: 2px 6px;
  }
  .nav .green-btn {
    padding: 2px 12px;
  }
  .nav .burger-btn {
    margin-left: 6px;
  }
  [lang="ar"] .nav .burger-btn {
    margin-left: 0;
    margin-right: 6px;
  }
}

/* Phones and portrait tablets (under 1024px): the home page scrolls normally and
   blocks fade in (phoneScrollAnims in js/home.js adds .phone-scroll to <html>).
   These rules undo the layout that only existed for the held-in-place sections. */
html.phone-scroll .intro { padding-bottom: 0; }
html.phone-scroll .intro .main-components { min-height: 100svh; }
html.phone-scroll .side > .fixed { position: absolute; }
html.phone-scroll .industries .locations { position: relative; left: 0; will-change: transform; }
html.phone-scroll .industries > .relative { height: auto; overflow: hidden; }
html.phone-scroll #testimonial-2,
html.phone-scroll #testimonial-3 { position: relative; top: auto; left: auto; height: auto; margin-top: 24px; }
html.phone-scroll .coming-soon .main-text { padding-bottom: 0; }
html.phone-scroll .coming-soon .img-container { margin-top: 0; padding: 48px 0; }
