/* ===== ENHANCEMENTS: Animations, Dark Theme, AI Widget, Accessibility ===== */

/* Reveal animations */
.reveal-element {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-element.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-on-scroll {
  opacity: 1;
  transition: opacity 0.5s ease;
}
.fade-in-on-scroll.is-visible { opacity: 1; }

.slide-in-up {
  opacity: 1;
  transform: translateY(40px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.slide-in-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Dark theme */
html[data-theme="dark"] {
  --bg: #0f1923;
  --surface: #1a2736;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #2d3f52;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 18px 40px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .site-header {
  background: rgba(15, 25, 35, 0.95);
  border-bottom-color: rgba(45, 63, 82, 0.6);
}
html[data-theme="dark"] .why-us__card,
html[data-theme="dark"] .product-card-new,
html[data-theme="dark"] .faq-card,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .calculator-preview,
html[data-theme="dark"] .trust-bar {
  background: var(--surface);
  border-color: var(--border);
}
html[data-theme="dark"] .section-light { background: #141f2b; }
html[data-theme="dark"] .mobile-nav-shell { background: var(--surface); border-color: var(--border); }

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 90;
  box-shadow: var(--shadow-soft);
  transition: all 0.3s ease;
}
.theme-toggle:hover { transform: scale(1.1); }

/* AI Assistant Widget */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #0a4d8f 100%);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 90;
  box-shadow: 0 8px 24px rgba(0, 59, 113, 0.3);
  transition: all 0.3s ease;
  border: none;
}
.ai-fab:hover { transform: scale(1.08); box-shadow: 0 12px 32px rgba(0, 59, 113, 0.4); }
.ai-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 380px;
  max-height: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-hover);
  z-index: 91;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.ai-panel.is-open { display: flex; }
.ai-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ai-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  max-width: 85%;
}
.ai-msg--bot {
  background: rgba(0, 59, 113, 0.08);
  color: var(--text);
  align-self: flex-start;
}
.ai-msg--user {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
}
.ai-panel-input {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
.ai-panel-input input {
  flex: 1;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  font: inherit;
  font-size: 14px;
}
.ai-panel-input button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
}
.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 20px 12px;
}
.ai-chip {
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(0,59,113,0.06);
  border: 1px solid rgba(0,59,113,0.12);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ai-chip:hover { background: rgba(0,59,113,0.12); }

/* Form validation states */
.field-row input.is-invalid,
.field-row textarea.is-invalid {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.04);
}
.field-row input.is-valid,
.field-row textarea.is-valid {
  border-color: #22c55e;
}
.field-error {
  color: #ef4444;
  font-size: 12px;
  margin-top: 4px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  padding: 12px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  z-index: 200;
  transition: top 0.2s;
}
.skip-link:focus { top: 16px; }

/* Focus visible */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Mobile sticky CTA */
@media (max-width: 820px) {
  .mobile-sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 80;
    display: flex;
    gap: 8px;
  }
  .mobile-sticky-cta .btn { flex: 1; min-height: 48px; font-size: 14px; }
  .ai-panel { width: calc(100vw - 32px); right: 16px; bottom: 80px; }
  .ai-fab { bottom: 80px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal-element,
  .fade-in-on-scroll,
  .slide-in-up {
    opacity: 1;
    transform: none;
    transition: none;
  }
  * { transition-duration: 0.01ms !important; }
}

/* Print */
@media print {
  .site-header, .site-footer, .ai-fab, .ai-panel, .mobile-sticky-cta, .theme-toggle { display: none !important; }
  .hero-new { min-height: auto; padding: 20px 0; }
  .section { padding: 20px 0; }
}

/* Progressive enhancement: content is visible without JavaScript.
   GSAP applies temporary inline states only while an element is animated. */
.reveal-element {
  opacity: 1;
  transform: none;
  transition: none;
  visibility: visible;
}

.why-us__card, .savings__card, .tools__card, .industries__item {
  opacity: 1;
  visibility: visible;
}
.why-us__card h3, .savings__card h3, .tools__card h3 {
  color: #003b71 !important;
  opacity: 1;
}
.why-us__card p, .savings__card p, .tools__card p {
  color: #1f2937 !important;
  opacity: 1;
}
.section-title {
  color: #072a4a !important;
  opacity: 1;
}

/* Tabs */
.tabs-nav { display:flex; gap:0; border-bottom:2px solid rgba(255,255,255,0.1); margin-bottom:2rem; flex-wrap:wrap; }
.tab-btn { background:none; border:none; color:var(--steel-600,#475569); padding:0.75rem 1.5rem; font-size:1rem; font-weight:600; cursor:pointer; border-bottom:3px solid transparent; transition:all 0.3s; }
.tab-btn:hover { color:var(--accent,#ffb000); }
.tab-btn.active { color:var(--accent,#ffb000); border-bottom-color:var(--accent,#ffb000); }
.tab-panel { display:none; animation:fadeIn 0.3s ease; }
.tab-panel.active { display:block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

/* Timeline */
.timeline { position:relative; padding-left:2rem; }
.timeline::before { content:''; position:absolute; left:0; top:0; bottom:0; width:2px; background:linear-gradient(to bottom,var(--accent,#60a5fa),var(--steel-700,#334155)); }
.timeline-item { position:relative; margin-bottom:2rem; padding-left:1.5rem; }
.timeline-item::before { content:''; position:absolute; left:-2rem; top:0.5rem; width:12px; height:12px; border-radius:50%; background:var(--accent,#60a5fa); border:2px solid var(--bg-card,#1e293b); }
.timeline-year { font-size:0.85rem; font-weight:700; color:var(--accent,#ffb000); text-transform:uppercase; letter-spacing:0.05em; margin-bottom:0.25rem; }
.timeline-content h4 { margin:0 0 0.5rem; color:var(--text-primary,#003b71); font-size:1.1rem; }
.timeline-content p { margin:0; color:var(--steel-600,#475569); line-height:1.6; }

/* Guarantee page */
.content-grid-2 { display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:1.5rem; }
.guarantee-step { text-align:center; padding:2rem; }
.guarantee-icon { margin-bottom:1rem; }
.guarantee-process { display:flex; flex-direction:column; gap:1.5rem; }
.process-step { display:flex; gap:1.5rem; align-items:flex-start; padding:1.5rem; background:#f8fafc; border-radius:12px; border:1px solid #e2e8f0; }
.process-number { flex-shrink:0; width:48px; height:48px; border-radius:50%; background:var(--accent,#ffb000); color:#000; display:flex; align-items:center; justify-content:center; font-size:1.25rem; font-weight:700; }
.process-content h4 { margin:0 0 0.5rem; color:var(--text-primary,#003b71); }
.process-content p { margin:0; color:var(--steel-600,#475569); line-height:1.6; }

/* ===== FIX 1: Trust bar value+unit on one line ===== */
.trust-bar__item {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.trust-bar__item .trust-bar__value,
.trust-bar__item .trust-bar__unit {
  display: inline;
  white-space: nowrap;
}

/* ===== FIX 2: Header button fully visible ===== */
.site-header .container.header-row {
  max-width: calc(100% - 16px);
}
.header-actions .btn-accent-sm {
  padding: 8px 14px !important;
  font-size: 11px !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
}

/* ===== FIX 4: Page hero headers - better text readability ===== */
.page-hero {
  position: relative;
}
.page-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 20, 50, 0.4);
  z-index: 0;
}
.page-hero > * {
  position: relative;
  z-index: 1;
}
.page-hero h1,
.page-hero .page-hero__title {
  text-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.3);
}
.page-hero p,
.page-hero .page-hero__subtitle {
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}


/* Fix: Sidebar chips clickable */
.chip-list a.chip {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s, color 0.2s;
}
.chip-list a.chip:hover {
  background: var(--primary);
  color: #fff;
}
.chip-list a.chip.active {
  background: var(--primary);
  color: #fff;
}


/* Fix: Page hero text - make subtitle and breadcrumbs more visible */
.page-hero p {
  opacity: 1 !important;
  color: rgba(255, 255, 255, 0.95) !important;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.page-hero .breadcrumbs {
  opacity: 1 !important;
  color: rgba(255, 255, 255, 0.9) !important;
}
.page-hero .breadcrumbs a {
  color: rgba(255, 255, 255, 0.95) !important;
}
.page-hero .eyebrow {
  color: rgba(255, 255, 255, 0.9) !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.page-hero .page-meta-chip {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Also fix the catalog hero-inner header */
.hero-inner .section-head {
  color: #fff;
}
.hero-inner .section-head h1 {
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.hero-inner .section-head p {
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}


/* Fix: Header button overflow - ensure it stays within viewport */
.site-header {
  overflow-x: hidden;
}
.site-header .container.header-row {
  max-width: 100%;
  padding-left: 12px;
  padding-right: 12px;
  box-sizing: border-box;
}
.header-actions {
  flex-shrink: 0;
  margin-right: 0;
}
.header-actions .btn-accent-sm {
  padding: 7px 12px !important;
  font-size: 10px !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 1100px) {
  .header-actions .btn-accent-sm {
    padding: 10px 18px !important;
    font-size: 12px !important;
    max-width: none;
    overflow: visible;
  }
}


/* Fix: At medium viewport (820-1024px) hide phone to make room for button */
@media (max-width: 1024px) and (min-width: 821px) {
  .header-phone {
    display: none !important;
  }
  .header-actions .btn-accent-sm {
    display: inline-flex !important;
    padding: 8px 16px !important;
    font-size: 11px !important;
    max-width: none !important;
    overflow: visible !important;
  }
}


/* Fix: Prevent horizontal overflow on the entire page */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}
.site-header .container.header-row {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  box-sizing: border-box !important;
}
.header-actions {
  flex-shrink: 1 !important;
  min-width: 0;
}
.header-actions .btn-accent-sm {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* === Header layout: full menu and an unclipped call-back button === */
.site-header .container.header-row {
  overflow: visible !important;
}
.header-actions {
  flex-shrink: 0 !important;
  min-width: max-content !important;
}
.header-actions .btn-accent-sm {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  min-width: 172px !important;
  min-height: 40px;
  padding: 10px 18px !important;
  font-size: 12px !important;
  line-height: 1.2;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}
@media (min-width: 1181px) {
  .site-header .container.header-row {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 18px;
    row-gap: 4px;
  }
  .nav.desktop-nav {
    display: flex !important;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 14px;
  }
}
/* At intermediate desktop widths the top bar still shows the phone number. */
@media (min-width: 1181px) and (max-width: 1550px) {
  .header-phone { display: none !important; }
}
@media (max-width: 1180px) {
  .nav.desktop-nav { display: none !important; }
  .mobile-nav-toggle { display: inline-flex !important; }
  .header-phone { display: none !important; }
  .header-actions .btn-accent-sm {
    min-width: 164px !important;
    padding: 9px 16px !important;
    font-size: 11.5px !important;
  }
}
@media (max-width: 820px) {
  .header-actions .btn-accent-sm { display: none !important; }
}

/* Sticky header must not sit inside an overflow scroll container. */
html,
body {
  overflow-x: clip !important;
}
.site-header {
  overflow-x: visible !important;
}

/* Catalog hero contrast fix — 2026-08-17 */
.catalog-hero .section-head {
  color: var(--primary) !important;
}
.catalog-hero .section-head h1 {
  color: var(--primary) !important;
  text-shadow: none !important;
}
.catalog-hero .section-head p {
  color: #334155 !important;
  opacity: 1 !important;
  text-shadow: none !important;
}
.catalog-hero .breadcrumbs,
.catalog-hero .breadcrumbs a,
.catalog-hero .breadcrumbs span {
  color: #526274 !important;
  text-shadow: none !important;
}
.catalog-hero .section-head .eyebrow {
  color: var(--accent) !important;
  text-shadow: none !important;
}
