/* ==========================================================================
   HEADER, NAV (+ services mega-menu), MOBILE DRAWER, THEME TOGGLE,
   FOOTER, WHATSAPP-STYLE CHAT WIDGET — identical on every page.
   ========================================================================== */

/* ---- Scroll progress bar (fills as the user scrolls down the page) ---- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #246BFF, #8B3DFF, #FF2E93, #FF8A00);
  z-index: 9999;
  pointer-events: none;
  transition: width 0.1s linear;
}
@media (prefers-reduced-motion: reduce) {
  .scroll-progress { transition: none; }
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  width: 100%;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--header-border);
  transition: background-color 0.4s cubic-bezier(.16,.84,.44,1),
              border-color 0.4s cubic-bezier(.16,.84,.44,1),
              box-shadow 0.4s cubic-bezier(.16,.84,.44,1),
              backdrop-filter 0.4s cubic-bezier(.16,.84,.44,1);
}
/* Elevated "floating" state once scrolled: deeper glass blur, a soft
   layered shadow (ambient + a faint brand-red glow line), and the hairline
   border fades out since the shadow now carries the separation. */
.site-header.is-scrolled {
  background: var(--header-bg-scrolled);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border-bottom-color: transparent;
  box-shadow: 0 1px 0 rgba(239,68,68,0.14), 0 12px 32px -16px rgba(17,24,39,0.22), 0 2px 8px -2px rgba(17,24,39,0.08);
}
html[data-theme="dark"] .site-header.is-scrolled {
  box-shadow: 0 1px 0 rgba(239,68,68,0.18), 0 12px 32px -16px rgba(0,0,0,0.65), 0 2px 8px -2px rgba(0,0,0,0.4);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  height: 64px;
  transition: height 0.4s cubic-bezier(.16,.84,.44,1);
}
.site-header.is-scrolled .header-inner { height: 53px; }
@media (min-width: 480px) { .header-inner { gap: 1rem; } }

.brand { display: inline-flex; align-items: center; gap: 0.4rem; flex-shrink: 0; min-width: 0; }
@media (min-width: 480px) { .brand { gap: 0.65rem; } }
.brand-logo {
  height: 1.75rem; width: 1.75rem;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
@media (min-width: 480px) { .brand-logo { height: 2rem; width: 2rem; } }
.brand-logo img { height: 100%; width: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; color: var(--text-strong); white-space: nowrap; }
@media (min-width: 480px) { .brand-name { font-size: 1.3rem; } }
@media (min-width: 768px) { .brand-name { font-size: 1.4rem; } }
/* Word colors matched to the exact swatches sampled from assets/images/logo.png (#ed3237 / #4c4c4d) */
.brand-name .brand-word-modern { color: #ed3237; }
.brand-name .brand-word-it { color: #030712; }
html[data-theme="dark"] .brand-name .brand-word-it { color: var(--text-strong); }
.brand-name span { background: linear-gradient(to right, var(--red-500), var(--rose-500)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-tagline { display: none; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
@media (min-width: 480px) { .brand-tagline { display: block; } }

/* ---- Desktop nav ---- */
.nav-desktop { display: none; align-items: center; gap: 0.15rem; }
@media (min-width: 1024px) { .nav-desktop { display: flex; } }
.nav-link {
  position: relative;
  padding: 0.55rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 650;
  border-radius: var(--radius-lg);
  color: var(--text);
  background: transparent;
  border: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.nav-link:hover { color: var(--red-600); background: var(--surface); }
.nav-link.active { color: var(--red-700); background: rgba(239, 68, 68, 0.1); }
/* Dark theme's active-pill background is a dark red-tinted blend, not a
   light tint like in light theme, so red-600/700 (still fairly dark hues)
   fall short of 4.5:1 there — needs a much lighter red instead. */
html[data-theme="dark"] .nav-link.active { color: #fca5a5; }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0.3rem; left: 50%; transform: translateX(-50%);
  height: 2px; width: 0.75rem; border-radius: 999px; background: var(--red-600);
}

.nav-item-has-menu { position: relative; }
.nav-item-has-menu > .nav-link { display: inline-flex; align-items: center; gap: 0.3rem; }
.nav-caret { transition: transform 0.2s ease; font-size: 0.95rem; line-height: 1; }
.nav-item-has-menu:hover .nav-caret,
.nav-item-has-menu:focus-within .nav-caret { transform: rotate(180deg); }

/* Services mega-menu
   The menu sits inside a "bridge" wrapper that starts flush against the nav
   item (top: 100%, zero gap) and pushes the visible panel down with its own
   padding-top instead of a margin/offset on the panel itself. A gap between
   the trigger and the panel would otherwise be un-hoverable dead space —
   moving the mouse diagonally from the trigger down into the menu would
   briefly leave both elements and close the menu before it was reached. */
.mega-menu-bridge {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding-top: 0.6rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
  z-index: 70;
}
.nav-item-has-menu:hover .mega-menu-bridge,
.nav-item-has-menu:focus-within .mega-menu-bridge {
  opacity: 1; visibility: visible; pointer-events: auto;
}
.mega-menu {
  width: min(56rem, 90vw);
  background: var(--surface-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr) 14rem;
  gap: 1.5rem;
  transform: translateY(6px);
  transition: transform 0.18s ease;
}
/* The bridge centers on the "Services" trigger, not on the viewport, so at
   the narrow end of the desktop nav (1024px is also exactly iPad landscape
   width) a 56rem-wide menu can run past the right edge even though it's
   invisible until hover/focus — visibility:hidden still counts toward the
   page's horizontal scroll extent. Narrower here closes that gap. */
@media (min-width: 1024px) and (max-width: 1199px) { .mega-menu { width: min(46rem, 85vw); } }
.nav-item-has-menu:hover .mega-menu,
.nav-item-has-menu:focus-within .mega-menu {
  transform: translateY(0);
}
.mega-col h5 {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 0.85rem;
}
.mega-col ul { display: flex; flex-direction: column; gap: 0.35rem; }
.mega-col a {
  display: flex; align-items: center; gap: 0.55rem;
  font-size: 0.85rem; font-weight: 650; color: var(--text);
  padding: 0.4rem 0.5rem; border-radius: var(--radius-lg);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.mega-col a .mega-ico { font-size: 0.95rem; flex-shrink: 0; transition: transform 0.25s cubic-bezier(.34, 1.56, .64, 1); }
.mega-col a:hover { background: var(--surface); color: var(--red-600); transform: translateX(3px); }
.mega-col a:hover .mega-ico { transform: scale(1.2); }
.mega-col a.current, .mobile-accordion-panel a.current { background: var(--surface); color: var(--red-600); font-weight: 800; }
@media (prefers-reduced-motion: reduce) {
  .mega-col a, .mega-col a .mega-ico { transition: none; }
}
.mega-feature {
  background: linear-gradient(160deg, var(--red-600), var(--rose-500));
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 0.75rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.mega-feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.mega-feature h5 { color: #fff; opacity: 0.85; }
.mega-feature p { font-size: 0.82rem; line-height: 1.5; opacity: 0.95; }
.mega-feature .btn { background: #fff; color: var(--red-600); font-size: 0.78rem; padding: 0.55rem 0.9rem; }

/* Header right-hand actions */
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.header-call {
  display: none;
  align-items: center; gap: 0.5rem;
  font-size: 0.8rem; font-weight: 800; color: var(--text-strong);
  padding: 0.5rem 0.9rem; border-radius: 999px; border: 1px solid var(--border);
}
@media (min-width: 1280px) { .header-call { display: inline-flex; } }
.header-call:hover { border-color: var(--red-400, var(--red-500)); color: var(--red-600); }

/* Theme toggle switch */
.theme-toggle {
  position: relative;
  display: inline-flex; align-items: center;
  width: 3.1rem; height: 1.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.15rem;
  flex-shrink: 0;
}
.theme-toggle .knob {
  height: 1.25rem; width: 1.25rem; border-radius: 999px;
  background: linear-gradient(135deg, var(--red-500), var(--rose-500));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.68rem;
  transform: translateX(0);
  transition: transform 0.25s ease;
}
html[data-theme="dark"] .theme-toggle .knob { transform: translateX(1.4rem); }
.theme-toggle .icon-fixed { position: absolute; font-size: 0.7rem; top: 50%; transform: translateY(-50%); opacity: 0.6; }
.theme-toggle .icon-fixed.sun { left: 0.4rem; }
.theme-toggle .icon-fixed.moon { right: 0.4rem; }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  height: 2.5rem; width: 2.5rem;
  border-radius: var(--radius-xl); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
@media (min-width: 1024px) { .nav-toggle { display: none; } }
.nav-toggle:hover { border-color: var(--red-500); }

/* ---- Mobile drawer ---- */
.nav-mobile {
  display: none;
  max-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--header-border);
  background: var(--surface-raised);
  flex-direction: column;
  transition: max-height 0.3s ease;
}
.nav-mobile.open { display: flex; max-height: 32rem; overflow-y: auto; }
@media (min-width: 1024px) { .nav-mobile { display: none !important; } }
.nav-mobile .container { padding-top: 0.75rem; padding-bottom: 1.25rem; display: flex; flex-direction: column; gap: 0.2rem; }
.nav-mobile .nav-link { text-align: left; padding: 0.8rem 1rem; }

.mobile-accordion { border-radius: var(--radius-xl); overflow: hidden; }
.mobile-accordion-head { display: flex; align-items: stretch; justify-content: space-between; }
.mobile-accordion-link {
  flex: 1; display: flex; align-items: center;
  padding: 0.8rem 1rem; font-size: 0.875rem; font-weight: 650; color: var(--text);
  border-radius: var(--radius-xl);
}
.mobile-accordion-link:hover { color: var(--red-600); background: var(--surface); }
.mobile-accordion-trigger {
  display: flex; align-items: center; justify-content: center;
  padding: 0.8rem 1rem; font-size: 0.875rem; color: var(--text-muted);
  background: none; border: none;
}
.mobile-accordion-trigger:hover { color: var(--red-600); }
.mobile-accordion-trigger .car { transition: transform 0.2s ease; }
.mobile-accordion.open .mobile-accordion-trigger .car { transform: rotate(180deg); }
.mobile-accordion-panel {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
  display: flex; flex-direction: column; padding: 0 1rem;
}
.mobile-accordion.open .mobile-accordion-panel { max-height: 40rem; padding-bottom: 0.5rem; }
.mobile-accordion-panel a {
  padding: 0.55rem 0.75rem 0.55rem 1.25rem; font-size: 0.83rem; color: var(--text-muted);
  border-radius: var(--radius-lg);
}
.mobile-accordion-panel a:hover { color: var(--red-600); background: var(--surface); }
.mobile-cta { margin: 0.75rem 1rem 0; }

/* ---- Footer ---- */
/* Always dark, in both site themes — so the tokens that normally follow
   page theme (raised surfaces, strong text, muted text, borders) are
   pinned here to their dark-theme values. Every rule below that reads
   --text-strong / --surface-raised / --text-muted / --border(-soft) stays
   correct without needing its own light/dark override. */
.site-footer {
  position: relative;
  background: var(--footer-bg);
  border-top: 1px solid var(--footer-border);
  padding-top: 4.5rem;
  overflow: hidden;
  transition: background-color 0.25s ease, border-color 0.25s ease;
  --text-strong: #ffffff;
  --text-muted: #a1a1aa;
  --surface-raised: var(--zinc-850);
  --border: var(--zinc-800);
  --border-soft: rgba(255, 255, 255, 0.08);
}
.footer-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 15% 0%, rgba(244,63,94,0.12), transparent 55%),
              radial-gradient(circle at 85% 20%, rgba(239,68,68,0.10), transparent 50%);
}
.footer-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.75rem;
  padding-bottom: 3.5rem;
}
@media (min-width: 768px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: repeat(12, 1fr); } }
.footer-brand { display: flex; flex-direction: column; gap: 1.25rem; }
@media (min-width: 1024px) { .footer-brand { grid-column: span 4; } }
.footer-brand p { font-size: 0.9rem; color: var(--footer-text); line-height: 1.7; max-width: 24rem; }
.footer-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.footer-badge {
  font-size: 0.68rem; font-weight: 800; color: var(--text-strong);
  background: var(--surface-raised); border: 1px solid var(--border-soft);
  padding: 0.35rem 0.7rem; border-radius: 999px;
}
.footer-social { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.footer-social a {
  height: 2.75rem; width: 2.75rem; border-radius: 999px;
  background: var(--surface-raised); border: 1px solid var(--border-soft);
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.footer-social a svg { width: 1.4rem; height: 1.4rem; }
.footer-social a:hover { transform: translateY(-3px) scale(1.08); color: #fff; }
/* Each platform gets its own hover color so the icons read as "official"
   brand marks rather than a generic uniform hover treatment. */
.footer-social a.social-fb:hover { background: #1877f2; border-color: #1877f2; box-shadow: 0 8px 18px -6px rgba(24,119,242,0.55); }
.footer-social a.social-ig:hover { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); border-color: transparent; box-shadow: 0 8px 18px -6px rgba(220,39,67,0.5); }
.footer-social a.social-li:hover { background: #0a66c2; border-color: #0a66c2; box-shadow: 0 8px 18px -6px rgba(10,102,194,0.55); }
/* Footer is always dark, so X's hover uses its light/white variant —
   black-on-black here would be invisible regardless of site theme. */
.footer-social a.social-x:hover { background: #fff; border-color: #fff; color: #000; box-shadow: 0 8px 18px -6px rgba(0,0,0,0.35); }
.footer-social a.social-wa:hover { background: #25d366; border-color: #25d366; box-shadow: 0 8px 18px -6px rgba(37,211,102,0.55); }
.footer-col { display: flex; flex-direction: column; gap: 1.25rem; position: relative; }
@media (min-width: 1024px) {
  .footer-col.links-a { grid-column: 5 / span 3; }
  .footer-col.links-b { grid-column: 8 / span 2; }
  .footer-col.contact { grid-column: 10 / span 3; }
}
.footer-col h2 { font-family: var(--font-display); font-weight: 800; font-size: 0.95rem; color: var(--text-strong); }
.footer-col ul { display: flex; flex-direction: column; gap: 0.75rem; font-size: 0.85rem; color: var(--footer-text); }
.footer-col ul li a { display: flex; align-items: center; gap: 0.55rem; }
.footer-col ul li a:hover { color: var(--red-600); }
.footer-col ul li .dot { width: 0.3rem; height: 0.3rem; border-radius: 999px; background: var(--red-500); flex-shrink: 0; }
.footer-contact-item { display: flex; align-items: flex-start; gap: 0.7rem; font-size: 0.85rem; color: var(--footer-text); }
.footer-contact-item .icon-box {
  padding: 0.4rem; background: var(--surface-raised); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); color: var(--red-500); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.footer-contact-item .icon-box svg { width: 1rem; height: 1rem; }
.footer-bottom {
  position: relative; z-index: 10;
  border-top: 1px solid var(--footer-border);
  background: rgba(0, 0, 0, 0.2);
  padding: 1.35rem 0;
}
.footer-bottom .container { display: flex; flex-direction: column; gap: 0.75rem; align-items: center; justify-content: space-between; font-size: 0.75rem; color: var(--footer-text); text-align: center; }
@media (min-width: 768px) { .footer-bottom .container { flex-direction: row; text-align: left; } }
.footer-bottom strong { color: var(--text-strong); }
.footer-legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 1rem; }
@media (min-width: 768px) { .footer-legal-links { justify-content: flex-start; } }
.footer-legal-links a:hover { color: var(--red-600); }

/* ---- WhatsApp / chat widget ---- */
.chat-widget { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 80; display: flex; flex-direction: column; align-items: flex-end; }
.chat-trigger {
  height: 3.5rem; width: 3.5rem;
  background: none; border: none; padding: 0;
  color: #25d366;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s ease;
}
.chat-trigger:hover { transform: scale(1.08); }
.chat-trigger svg { width: 2.75rem; height: 2.75rem; }

/* ---- Scroll-to-top button ---- */
.scroll-top {
  position: fixed; bottom: 5.5rem; right: 1.5rem; z-index: 79;
  height: 2.75rem; width: 2.75rem; border-radius: 999px;
  background: linear-gradient(to right, var(--red-600), var(--rose-500));
  border: none;
  color: #fff; font-size: 1.3rem; font-weight: 800; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 22px -8px rgba(220, 38, 38, 0.55);
  opacity: 0; pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
}
.scroll-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.scroll-top:hover { background: linear-gradient(to right, var(--red-700), var(--red-600)); }
.chat-window {
  display: none;
  margin-bottom: 1rem;
  width: 320px;
  max-width: 85vw;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  background: var(--surface-raised);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-soft);
}
.chat-window.open { display: block; }
.chat-header { background: linear-gradient(to right, var(--emerald-600), var(--green-600)); color: #fff; padding: 1rem; display: flex; align-items: center; justify-content: space-between; }
.chat-header .who { display: flex; align-items: center; gap: 0.75rem; }
.chat-avatar { height: 2.5rem; width: 2.5rem; border-radius: 999px; background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0.4rem; }
.chat-avatar img { height: 100%; width: 100%; object-fit: contain; }
.chat-header h4 { font-size: 0.875rem; font-weight: 800; }
/* Matches the exact swatch used for the "Modern" word in the site header logo (#ed3237); "IT Solution" stays white since this header is always on the green WhatsApp gradient regardless of site theme.
   Plain red on this green has almost no luminance contrast (measured ~1.2:1), so a layered white
   text-shadow acts as a soft outline to keep the red legible without changing the brand hex. */
.chat-header h4 .chat-brand-modern { color: #ed3237; font-weight: 900; text-shadow: 0 0 1px #fff, 0 0 1px #fff, 0 0 3px rgba(255,255,255,0.8); }
.chat-header h4 .chat-brand-it { color: #fff; }
.chat-header p { font-size: 0.7rem; color: #d1fae5; }
.chat-close { background: none; border: none; color: rgba(255,255,255,0.85); padding: 0.35rem; border-radius: 999px; font-size: 0.9rem; }
.chat-close:hover { background: rgba(255,255,255,0.15); }
.chat-body { max-height: 260px; overflow-y: auto; padding: 1rem; background: var(--surface); display: flex; flex-direction: column; gap: 1rem; }
.chat-bubble { background: var(--surface-raised); border-radius: var(--radius-xl) var(--radius-xl) var(--radius-xl) 0; padding: 0.75rem; font-size: 0.85rem; color: var(--text); box-shadow: var(--shadow-sm); }
.chat-bubble .from { font-size: 0.7rem; font-weight: 700; color: var(--green-600); margin-bottom: 0.25rem; }
.chat-topics { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chat-topic {
  font-size: 0.7rem; padding: 0.4rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-raised); color: var(--text-muted);
}
.chat-topic:hover { border-color: var(--emerald-500); }
.chat-topic.selected { background: rgba(16, 185, 129, 0.12); border-color: var(--green-500); color: var(--green-600); }
.chat-input-row { border-top: 1px solid var(--border-soft); padding: 0.75rem; background: var(--surface-raised); display: flex; align-items: center; gap: 0.5rem; }
.chat-input-row input { flex: 1; background: var(--surface); border: 1px solid var(--border-soft); color: var(--text); border-radius: var(--radius-xl); padding: 0.55rem 0.9rem; font-size: 0.85rem; }
.chat-input-row input:focus { outline: none; box-shadow: 0 0 0 2px rgba(16,185,129,0.4); }
.chat-send { height: 2.25rem; width: 2.25rem; border-radius: var(--radius-xl); background: linear-gradient(to right, var(--emerald-600), var(--green-600)); color: #fff; border: none; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
