/* ==========================================================================
   Klass360 – Layout: top bar, header & navigation, footer, floating CTAs
   ========================================================================== */

/* ---------- Top bar ---------- */
.topbar {
  background: var(--c-secondary);
  color: #fff;
  font-size: var(--fs-xs);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: 40px;
  padding-block: 6px;
  text-align: center;
}
.topbar__text { display: none; }
.topbar__btn {
  padding: 3px 12px;
  border-radius: 6px;
  background: var(--c-primary);
  color: var(--c-heading);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  transition: background var(--t-fast);
}
.topbar__btn:hover { background: #fff; }

@media (min-width: 576px) {
  .topbar { font-size: var(--fs-sm); }
  .topbar__text { display: block; }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--c-surface);
  transition: box-shadow var(--t-base);
}
.site-header.is-scrolled { box-shadow: 0 6px 24px rgba(6, 43, 59, 0.08); }

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-h);
}

.brand img { width: 136px; height: auto; }

.site-header__actions { display: flex; align-items: center; gap: var(--space-2); }
.site-header__cta { display: none; } /* on phones the sticky bottom bar takes over */

@media (min-width: 768px) {
  .site-header__cta { display: inline-flex; }
}
@media (min-width: 768px) {
  .brand img { width: 164px; }
}

/* ---------- Primary navigation: mobile drawer (default) ---------- */
.primary-nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-nav);
  display: flex;
  flex-direction: column;
  width: min(86vw, 340px);
  padding: var(--space-5);
  background: var(--c-surface);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  transform: translateX(-105%);
  visibility: hidden;
  transition: transform var(--t-base) var(--ease), visibility var(--t-base);
}
.primary-nav.is-open { transform: none; visibility: visible; }

.primary-nav__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}
.primary-nav__head img { width: 128px; }

.primary-nav__list > li { border-bottom: 1px solid var(--c-border); }

.primary-nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  padding: 0.875rem 0;
  color: var(--c-heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: color var(--t-fast);
}
.primary-nav__link:hover,
.primary-nav__link.is-active { color: var(--c-secondary); }
.primary-nav__link .icon { transition: transform var(--t-fast); }
.has-sub.is-open > .primary-nav__link .icon { transform: rotate(180deg); }

/* Product mega menu – mobile: simple stacked list */
.sub-menu { display: none; padding-bottom: var(--space-4); }
.has-sub.is-open > .sub-menu { display: block; }
.mega { display: grid; gap: 2px; }
.mega__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.5rem 0.5rem;
  border-radius: var(--r-sm);
  color: var(--c-heading);
  font-size: var(--fs-sm);
  transition: background var(--t-fast);
}
.mega__link:hover { background: var(--c-primary-soft); }
.mega__link b { display: block; font-weight: var(--fw-medium); line-height: 1.3; }
.mega__link small { display: none; color: var(--c-text); font-size: var(--fs-xs); line-height: 1.4; }
.mega__icon {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--c-secondary);
  color: var(--c-primary);
}
.mega__icon .icon { width: 1.125rem; height: 1.125rem; }
.mega__all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: var(--space-3) 0 0 0.5rem;
  color: var(--c-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}
.mega__all:hover { color: var(--c-heading); }
.mega__foot { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); }

.primary-nav__cta { margin-top: var(--space-6); }

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgba(3, 24, 33, 0.5);
  backdrop-filter: blur(2px);
}

body.nav-open { overflow: hidden; }
/* header is its own stacking context – lift it above the overlay while the drawer is open */
body.nav-open .site-header { z-index: var(--z-nav); }

/* ---------- Primary navigation: desktop ---------- */
@media (min-width: 1100px) {
  .nav-toggle,
  .nav-overlay,
  .primary-nav__head,
  .primary-nav__cta { display: none !important; }

  .primary-nav {
    position: static;
    flex-direction: row;
    width: auto;
    padding: 0;
    background: none;
    box-shadow: none;
    overflow: visible;
    transform: none;
    visibility: visible;
  }
  .primary-nav__list { display: flex; align-items: center; gap: 1.5rem; }
  .primary-nav__home { display: none; } /* the logo links home on desktop */
  .primary-nav__list > li { position: relative; border: 0; }
  .primary-nav__link { padding: 0.5rem 0; width: auto; }

  .sub-menu {
    position: absolute;
    top: calc(100% + 18px);
    left: 50%;
    display: block;
    width: 640px;
    padding: var(--space-4);
    background: var(--c-surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translate(-30%, 10px);
    transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
  }
  /* invisible bridge so the menu stays open while the pointer travels to it */
  .sub-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -20px; height: 20px; }
  .has-sub:hover > .sub-menu,
  .has-sub:focus-within > .sub-menu,
  .has-sub.is-open > .sub-menu { opacity: 1; visibility: visible; transform: translate(-30%, 0); }
  .has-sub:hover > .primary-nav__link .icon { transform: rotate(180deg); }
  .sub-menu--right { left: auto; right: -24px; width: 560px; transform: translateY(10px); }
  .has-sub:hover > .sub-menu--right,
  .has-sub:focus-within > .sub-menu--right,
  .has-sub.is-open > .sub-menu--right { transform: none; }
  .mega { grid-template-columns: repeat(2, 1fr); gap: var(--space-1) var(--space-2); }
  .mega__link { align-items: flex-start; padding: 0.75rem; }
  .mega__link small { display: block; margin-top: 2px; }
  .mega__icon { width: 38px; height: 38px; }
  .mega__foot { gap: var(--space-2); margin-top: var(--space-3); }
  .mega__all {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0.75rem;
    border-radius: var(--r-md);
    background: var(--c-bg);
  }
}

@media (min-width: 1280px) {
  .primary-nav__list { gap: 2.25rem; }
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  padding-top: var(--section-y);
  background:
    radial-gradient(60% 40% at 70% 100%, rgba(150, 207, 0, 0.16), transparent 70%),
    var(--c-bg);
  overflow: hidden;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-10) var(--space-6);
}
.site-footer__brand { grid-column: 1 / -1; }
.site-footer__brand p { max-width: 380px; margin: var(--space-5) 0 var(--space-5); font-size: var(--fs-sm); }
.site-footer__contact { display: grid; gap: var(--space-2); margin-bottom: var(--space-6); font-size: var(--fs-sm); }
.site-footer__contact a { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--c-heading); font-weight: var(--fw-medium); }
.site-footer__contact .icon { color: var(--c-secondary); }
.site-footer__contact a:hover { color: var(--c-secondary); }
.social { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); }
.social a {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-secondary);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.social a:hover { background: var(--c-secondary); color: var(--c-primary); transform: translateY(-2px); }
.social .icon { width: 1.125rem; height: 1.125rem; }
.site-footer__title { font-size: var(--fs-md); margin-bottom: var(--space-5); }
.site-footer__col li + li { margin-top: var(--space-3); }
.site-footer__col a { font-size: var(--fs-sm); transition: color var(--t-fast); }
.site-footer__col a:hover { color: var(--c-secondary); }

.site-footer__watermark {
  margin-top: var(--space-10);
  font-size: clamp(4.5rem, 20vw, 17rem);
  font-weight: var(--fw-bold);
  line-height: 0.8;
  letter-spacing: -0.04em;
  text-align: center;
  color: rgba(6, 78, 106, 0.05);
  user-select: none;
  white-space: nowrap;
}

.site-footer__bottom {
  position: relative;
  background: var(--c-surface);
  font-size: var(--fs-sm);
}
.site-footer__bottom-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding-block: var(--space-5);
  text-align: center;
}
.site-footer__bottom ul { display: flex; gap: var(--space-6); }
.site-footer__bottom a:hover { color: var(--c-secondary); }

@media (min-width: 768px) {
  .site-footer__grid { grid-template-columns: repeat(4, 1fr); }
  .site-footer__bottom-inner { flex-direction: row; justify-content: space-between; }
}
@media (min-width: 1100px) {
  .site-footer__grid { grid-template-columns: 1.6fr repeat(4, 1fr); }
  .site-footer__brand { grid-column: auto; }
}

/* ---------- Floating WhatsApp button ----------
   Look, animation and hover match the turfbox.in WhatsApp CTA. */
.whatsapp-float {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120; /* above content, below the nav overlay & demo popup */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #25D366;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 25px -5px rgba(37, 211, 102, 0.4), 0 8px 10px -6px rgba(37, 211, 102, 0.2);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.whatsapp-float:hover {
  color: #fff;
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 20px 30px -10px rgba(37, 211, 102, 0.5), 0 10px 15px -5px rgba(37, 211, 102, 0.3);
}
.whatsapp-float svg { display: block; width: 28px; height: 28px; }

.whatsapp-status-dot,
.whatsapp-pulse {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #22C55E;
}
.whatsapp-status-dot { z-index: 2; border: 2px solid #fff; }
.whatsapp-pulse { z-index: 1; animation: wa-pulse 2s ease infinite; }

@keyframes wa-pulse {
  0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70%  { transform: scale(1);    box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.whatsapp-tooltip {
  position: absolute;
  top: 50%;
  right: 68px;
  padding: 7px 14px;
  border-radius: 20px;
  background: #0F172A;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) translateX(8px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.whatsapp-tooltip::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -5px;
  width: 8px;
  height: 8px;
  border-radius: 1px;
  background: #0F172A;
  transform: translateY(-50%) rotate(45deg);
}
.whatsapp-float:hover .whatsapp-tooltip { opacity: 1; visibility: visible; transform: translateY(-50%) translateX(0); }

/* ---------- Mobile sticky "Book a Demo" bar ----------
   Fills the space to the left of the WhatsApp button on small screens.
   --fab-size / --fab-edge mirror the WhatsApp button so the two never overlap
   (a 12px gap leaves room for the WhatsApp hover scale). */
.mobile-cta { display: none; }

@media (max-width: 767.98px) {
  :root { --fab-size: 50px; --fab-edge: 16px; --fab-gap: 12px; }

  .whatsapp-float { right: var(--fab-edge); bottom: var(--fab-edge); width: var(--fab-size); height: var(--fab-size); }
  .whatsapp-float svg { width: 25px; height: 25px; }
  .whatsapp-tooltip { display: none; }

  .mobile-cta {
    position: fixed;
    left: var(--fab-edge);
    right: calc(var(--fab-edge) + var(--fab-size) + var(--fab-gap));
    bottom: var(--fab-edge);
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: var(--fab-size);
    border-radius: var(--r-sm);
    background: var(--c-primary);
    color: var(--c-heading);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    box-shadow: 0 10px 25px -5px rgba(6, 43, 59, 0.3), 0 8px 10px -6px rgba(150, 207, 0, 0.35);
    transition: background var(--t-fast), box-shadow var(--t-fast);
  }
  .mobile-cta:hover,
  .mobile-cta:active { background: var(--c-primary-hover); }

  /* keep page content clear of the fixed bar */
  body { padding-bottom: calc(var(--fab-size) + var(--fab-edge) * 2); }
}

@media (max-width: 480px) {
  :root { --fab-size: 46px; --fab-edge: 14px; --fab-gap: 10px; }
  .whatsapp-float svg { width: 22px; height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-pulse { animation: none; }
}
