/* ==========================================================
   Startbench - Site-wide UI/UX polish
   Loaded last on public pages (after responsive.css).
   Fixes shared components: header, mobile menu, floating
   controls, spacing, type scale, buttons, stat cards, forms,
   focus states and reduced motion.
   ========================================================== */

/* ---------- 1. Header: always readable ----------
   The header used to be transparent until scrolled, which left the navy
   logo and menu icon unreadable on dark page banners. Give it a solid,
   lightly frosted bar at all times. */
.header.navbar-area {
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  padding: 8px 0;
}

.header.navbar-area.sticky {
  background: rgba(255, 255, 255, 0.96);
  border-bottom-color: rgba(5, 20, 65, 0.08);
  box-shadow: 0 6px 24px rgba(5, 20, 65, 0.06);
  padding: 4px 0;
}

.header .navbar,
.header.sticky .navbar {
  padding: 6px 0;
}

[data-theme="dark"] .header.navbar-area {
  background: rgba(10, 14, 26, 0.88);
}

[data-theme="dark"] .header.navbar-area.sticky {
  background: rgba(10, 14, 26, 0.95);
  border-bottom-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

/* Dropdown arrow: the hover underline and Bootstrap's caret both used
   ::after on dropdown links, drawing the caret as a bar under the label. */
.navbar-nav .nav-item a.dropdown-toggle::after {
  position: static;
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  background: none;
  border-radius: 0;
  transform: translateY(-3px) rotate(45deg);
  vertical-align: middle;
  transition: transform 0.2s;
}

.navbar-nav .nav-item a.dropdown-toggle:hover::after,
.navbar-nav .nav-item a.dropdown-toggle.active::after {
  width: 7px;
}

.navbar-nav .nav-item a.dropdown-toggle[aria-expanded="true"]::after {
  transform: translateY(1px) rotate(-135deg);
}

/* Dark-mode toggle: sit in the nav instead of floating over page content. */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-actions .theme-toggle {
  position: static;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  background: transparent;
  border: 1px solid rgba(5, 20, 65, 0.14);
  box-shadow: none;
}

.navbar-actions .theme-toggle:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--primary);
}

.navbar-actions .theme-toggle i {
  color: var(--dark);
  font-size: 18px;
}

[data-theme="dark"] .navbar-actions .theme-toggle {
  border-color: rgba(255, 255, 255, 0.18);
}

/* Menu button: one clean set of bars that morphs into a cross. */
.header .navbar-toggler {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.header .navbar-toggler:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.header .navbar-toggler .toggler-icon,
.header .navbar-toggler.active .toggler-icon {
  display: block;
  position: relative;
  top: 0;
  width: 22px;
  height: 2px;
  margin: 0;
  border-radius: 2px;
  background: var(--dark);
  opacity: 1;
  transform: none;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.header .navbar-toggler .toggler-icon + .toggler-icon {
  margin-top: 5px;
}

.header .navbar-toggler.active .toggler-icon:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.header .navbar-toggler.active .toggler-icon:nth-child(2) {
  opacity: 0;
}

.header .navbar-toggler.active .toggler-icon:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- 2. Mobile & tablet menu ---------- */
@media (max-width: 991.98px) {
  .header .navbar-toggler {
    display: flex;
  }

  .header .navbar-collapse {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    width: auto;
    max-height: calc(100vh - 96px);
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    background: #fff;
    border: 1px solid rgba(5, 20, 65, 0.08);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(5, 20, 65, 0.14);
    z-index: 20;
  }

  [data-theme="dark"] .header .navbar-collapse {
    background: #121a2c;
    border-color: rgba(255, 255, 255, 0.08);
  }

  .header .navbar-nav {
    margin: 0;
  }

  .header .navbar-nav .nav-item {
    margin: 0;
  }

  .header .navbar-nav .nav-item + .nav-item {
    border-top: 1px solid rgba(5, 20, 65, 0.06);
  }

  [data-theme="dark"] .header .navbar-nav .nav-item + .nav-item {
    border-top-color: rgba(255, 255, 255, 0.06);
  }

  .header .navbar-nav .nav-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 12px 14px !important;
    font-size: 16px;
    border-radius: 10px;
  }

  .header .navbar-nav .nav-item a:not(.dropdown-toggle)::after {
    display: none;
  }

  .header .navbar-nav .nav-item a.active {
    background: rgba(9, 120, 30, 0.07);
  }

  .header .navbar-nav .nav-item a.dropdown-toggle::after {
    margin-left: auto;
  }

  .header .navbar-collapse .dropdown-menu {
    position: static;
    float: none;
    width: auto;
    margin: 0 0 8px 14px;
    padding: 0 0 0 10px;
    background: transparent;
    border: 0;
    border-left: 2px solid rgba(9, 120, 30, 0.2);
    border-radius: 0;
    box-shadow: none;
  }

  .header .navbar-collapse .dropdown-menu .dropdown-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 12px !important;
    font-size: 15px;
    white-space: normal;
    border-radius: 8px;
  }

  .header .navbar-collapse .navbar-actions {
    display: flex;
    gap: 10px;
    margin: 6px 0 0;
    padding: 12px 6px 6px;
    border-top: 1px solid rgba(5, 20, 65, 0.08);
  }

  .header .navbar-collapse .navbar-actions .nav-cta {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 44px;
  }
}

@media (min-width: 992px) {
  .header .navbar-actions {
    margin-left: 12px;
  }
}

/* ---------- 3. Floating controls ---------- */
@media (max-width: 767.98px) {
  .scroll-top {
    width: 44px;
    height: 44px;
    right: 16px;
    bottom: 16px;
  }
}

/* The security chat button and the scroll-to-top button shared a corner. */
body:has(.security-agent-widget) .scroll-top {
  bottom: 104px;
}

@media (max-width: 480px) {
  body:has(.security-agent-widget) .scroll-top {
    bottom: 88px;
  }
}

/* ---------- 4. Focus & motion ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .wow {
    visibility: visible !important;
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- 5. Mobile rhythm: spacing, type, buttons ---------- */
@media (max-width: 767.98px) {
  /* Section spacing built for desktop (100-150px) wastes a phone screen. */
  .pt-150, .pt-140, .pt-130, .pt-120, .pt-110, .pt-100 { padding-top: 64px; }
  .pb-150, .pb-140, .pb-130, .pb-120, .pb-110, .pb-100 { padding-bottom: 64px; }
  .pt-70 { padding-top: 48px; }
  .pb-70 { padding-bottom: 48px; }
  .mb-60 { margin-bottom: 40px; }
  .mb-50 { margin-bottom: 32px; }

  body {
    font-size: 16px;
  }

  p {
    line-height: 1.65;
  }

  .section-title {
    margin-bottom: 36px;
  }

  .section-title h2 {
    font-size: clamp(1.625rem, 6.4vw, 2rem);
    line-height: 1.2;
  }

  .section-title p {
    font-size: 1rem;
    line-height: 1.6;
  }

  .theme-btn {
    min-height: 44px;
  }

  .theme-btn.btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
    min-height: 50px;
  }

  /* Stacked call-to-action buttons: consistent spacing, less bulk. */
  .hero-cta {
    gap: 12px;
  }

  .hero-cta .theme-btn,
  .hero-cta .theme-btn.btn-lg {
    margin: 0 !important;
  }

  /* Forms: 16px text stops iOS from zooming in on focus. */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  input[type="date"],
  select,
  textarea,
  .form-control,
  .form-select {
    font-size: 16px;
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  input[type="date"],
  select,
  .form-control:not(textarea),
  .form-select {
    min-height: 48px;
  }

  /* Footer links: larger tap targets. */
  .footer-links li a,
  .footer-legal a {
    display: inline-block;
    padding: 6px 0;
  }

  .footer-social a {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ---------- 6. Stat cards: two per row on phones ----------
   Four full-width cards, each ~330px tall, took more than a screen to show
   four numbers. */
@media (max-width: 767.98px) {
  .row > [class*="col-"]:has(> .about-stat-card),
  .row > [class*="col-"]:has(> .portfolio-stat-card) {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .about-stat-card,
  .portfolio-stat-card {
    padding: 20px 12px;
    margin-bottom: 16px;
    height: calc(100% - 16px);
  }

  .about-stat-card:hover,
  .portfolio-stat-card:hover {
    transform: none;
  }

  .about-stat-card .stat-icon,
  .portfolio-stat-card .stat-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    font-size: 20px;
    border-radius: 12px;
  }

  .about-stat-card .stat-icon i,
  .portfolio-stat-card .stat-icon i {
    font-size: 20px;
  }

  .about-stat-card .stat-number,
  .portfolio-stat-card .stat-number {
    font-size: 1.75rem;
    line-height: 1.1;
    margin-bottom: 4px;
  }

  .about-stat-card .stat-label,
  .portfolio-stat-card .stat-label {
    font-size: 0.75rem;
    line-height: 1.35;
    letter-spacing: 0.04em;
  }
}

/* ---------- 7. Cards on touch screens ----------
   Hover lifts don't exist on touch and leave cards stuck "lifted" after a tap. */
@media (hover: none) {
  .service-box:hover,
  .value-card:hover,
  .team-card:hover,
  .team-member-card:hover,
  .testimonial-card:hover,
  .challenge-card:hover {
    transform: none;
  }
}

/* ---------- 8. Buttons: icon spacing either side of the label ----------
   Icons only had a left margin, so leading icons touched the text. */
.theme-btn {
  gap: 10px;
}

.theme-btn i {
  margin-left: 0;
  margin-right: 0;
}

/* ---------- 9. Service card icons ----------
   styles.css drew a white circle while custom.css made the glyph white, so
   every service card showed a white icon on white. Use one style: a green
   tile with a white glyph, matching the stat cards. */
.box-style .service-icon.box-icon-style {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 0;
  background: var(--primary-gradient);
  color: #fff;
}

.box-style .service-icon.box-icon-style i {
  color: #fff;
  font-size: 28px;
}

.box-style .service-icon.box-icon-style::after {
  border-radius: 18px;
}

@media (max-width: 767.98px) {
  .box-style .service-icon.box-icon-style {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    margin-bottom: 18px;
  }

  .box-style .service-icon.box-icon-style i {
    font-size: 24px;
  }

  .box-style .box-content-style h4 {
    font-size: 1.375rem;
  }
}

/* ---------- 10. Phones: show content immediately ----------
   Scroll-reveal animations kept sections invisible until they were scrolled
   into view, which reads as blank screens during a quick scroll on a phone. */
@media (max-width: 767.98px) {
  .wow {
    visibility: visible !important;
    animation-name: none !important;
  }
}

/* ---------- 11. Footer on phones ----------
   ~2,300px tall: one column per link list, 35px line-height and stray
   bullets. Put the two link lists side by side and tighten spacing. */
.footer .footer-widget ul.footer-links {
  padding-left: 0;
}

.footer .footer-widget ul.footer-links li {
  list-style: none;
}

@media (max-width: 767.98px) {
  .footer.pt-100 {
    padding-top: 56px;
  }

  .footer .footer-widget {
    margin-bottom: 32px;
  }

  .footer .row > [class*="col-"]:has(> .footer-widget .footer-links) {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .footer .footer-widget h4 {
    font-size: 1.0625rem;
    margin-bottom: 14px;
  }

  .footer .footer-widget ul.footer-links li {
    margin-bottom: 0;
  }

  .footer .footer-widget ul.footer-links li a {
    line-height: 1.4;
    padding: 9px 0;
    font-size: 0.9375rem;
  }

  .footer-desc.mb-30,
  .footer .logo.mb-30 {
    margin-bottom: 16px;
  }

  .footer-contact li {
    margin-bottom: 14px;
  }

  .footer-newsletter {
    padding: 24px 20px;
    margin-bottom: 40px;
  }

  .footer-newsletter .newsletter-form {
    flex-direction: column;
    gap: 10px;
  }

  .footer-newsletter .newsletter-form input,
  .footer-newsletter .newsletter-form .theme-btn {
    width: 100%;
  }

  .footer-bottom .row > [class*="col-"] {
    text-align: center;
  }
}

/* Footer link contrast: #6A7C92 on navy was about 3.9:1. */
.footer .footer-widget ul.footer-links li a {
  color: rgba(255, 255, 255, 0.74);
}

.footer .footer-widget ul.footer-links li a:hover {
  color: var(--primary-light);
}

@media (max-width: 767.98px) {
  .footer .logo img {
    width: 64px;
  }
}

@media (max-width: 767.98px) {
  .footer-bottom .footer-legal {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 0;
    margin: 4px 0 0;
  }
}

/* ---------- 12. FAQ accordions ----------
   The bundled Bootstrap 5 alpha ships no accordion styles, so question
   buttons shrank to their text, centred themselves and had no indicator. */
.accordion-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  text-align: left;
  line-height: 1.4;
  cursor: pointer;
}

.accordion-button::after {
  content: '';
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  filter: none;
  background: none;
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.2s;
}

.accordion-button:not(.collapsed)::after {
  filter: none;
  transform: translateY(2px) rotate(-135deg);
}

.accordion-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.accordion-header {
  margin: 0;
}

@media (max-width: 767.98px) {
  .accordion-button {
    font-size: 1rem;
    padding: 16px 18px;
  }

  .accordion-body {
    padding: 16px 18px;
    line-height: 1.7;
  }
}

/* ---------- 13. Page banner breadcrumb on phones ----------
   Long page names wrapped and stranded the "/" separator. The title is
   already shown above, so keep the crumb to one line and truncate. */
@media (max-width: 767.98px) {
  .page-breadcrumb .breadcrumb {
    flex-wrap: nowrap;
    font-size: 0.875rem;
  }

  .page-breadcrumb .breadcrumb-item {
    white-space: nowrap;
  }

  .page-breadcrumb .breadcrumb-item.active {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-banner-section.pt-120 {
    padding-top: 112px;
  }

  .page-banner-section.pb-120 {
    padding-bottom: 56px;
  }
}

/* ---------- 14. Checkboxes & radios ----------
   A generic input rule stretched them into wide grey pills. */
input[type="checkbox"],
input[type="radio"],
.form-check-input {
  -webkit-appearance: auto;
  appearance: auto;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 0;
  flex: 0 0 20px;
  padding: 0;
  margin-top: 2px;
  border-radius: 4px;
  background: none;
  box-shadow: none;
  accent-color: var(--primary);
  cursor: pointer;
}

input[type="radio"] {
  border-radius: 50%;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-left: 0;
}

.form-check .form-check-input {
  float: none;
  margin-left: 0;
  position: static;
}

.form-check-label {
  cursor: pointer;
  line-height: 1.5;
}

/* ---------- 15. Buttons keep their icon on the label's line ---------- */
.theme-btn {
  flex-wrap: nowrap;
}

.theme-btn i {
  flex-shrink: 0;
}

/* ---------- 16. Portfolio project list on phones ----------
   The header row's four labels stacked into a meaningless green block.
   Show each project as a card: name, then badges, then services. */
@media (max-width: 768px) {
  .project-row.header-row {
    display: none;
  }

  .project-table .project-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 16px 18px;
  }

  .project-table .project-cell {
    flex: 0 0 auto;
    width: auto;
    padding: 0;
  }

  .project-table .project-cell:first-child {
    flex: 1 1 100%;
  }

  .project-table .project-cell:nth-child(3) {
    flex: 1 1 100%;
    order: 3;
    font-size: 0.9375rem;
  }
}

/* ---------- 17. Desktop header fit ----------
   With the theme toggle inline, the nav overflowed below ~1400px. */
@media (min-width: 992px) and (max-width: 1399.98px) {
  .header .navbar-nav .nav-item {
    margin: 0;
  }

  .header .navbar-nav .nav-item a {
    padding: 10px 9px !important;
    font-size: 15px;
  }

  .header .navbar-actions .nav-cta {
    padding: 10px 16px;
  }

  .header .navbar-actions .nav-cta i {
    display: none;
  }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  .header .navbar-brand .brand-text {
    display: none;
  }

  .header .navbar-nav .nav-item a {
    padding: 10px 7px !important;
    font-size: 14.5px;
  }

  .header .navbar-actions {
    margin-left: 6px;
    gap: 6px;
  }
}

/* ---------- 18. White button variant ----------
   .btn-white is used on five service pages but was never defined, leaving
   dark text on a green gradient over a coloured panel. */
.theme-btn.btn-white,
.theme-btn.btn-white:not(.btn-sm):not(.border-btn) {
  background: #fff;
  background-image: none;
  color: var(--dark);
}

.theme-btn.btn-white:hover {
  background: var(--dark);
  color: #fff;
}

/* ---------- 19. Security center scanner ----------
   The scanner card's negative margin tucked it under the banner overlay. */
.scanner-box {
  position: relative;
  z-index: 2;
}

@media (max-width: 767.98px) {
  .scanner-box {
    padding: 20px;
    margin-top: -32px;
  }

  .page-banner-section .banner-subtitle {
    display: inline-block;
    max-width: 100%;
    line-height: 1.5;
    letter-spacing: 0.08em;
  }
}

/* ---------- 20. Cohort hero highlights ----------
   Icon left, text centred on some badges: align all text left. */
.cohort-highlights .highlight-badge {
  text-align: left;
  justify-content: flex-start;
}

@media (max-width: 767.98px) {
  .cohort-highlights .highlight-badge {
    width: 100%;
  }
}

/* ---------- 21. Dark mode: filled button text ----------
   Buttons use color: var(--white), which flips to near-black in dark mode,
   leaving dark text on the green gradient. */
[data-theme="dark"] .theme-btn:not(.btn-white):not(.border-btn),
[data-theme="dark"] .theme-btn:not(.btn-white):not(.border-btn):hover {
  color: #fff;
}

/* Breadcrumb truncation: the list must be capped for the ellipsis to engage. */
@media (max-width: 767.98px) {
  .page-breadcrumb,
  .page-breadcrumb nav,
  .page-breadcrumb .breadcrumb {
    max-width: 100%;
    min-width: 0;
  }

  .page-breadcrumb .breadcrumb {
    display: flex;
    width: 100%;
    overflow: hidden;
  }

  .page-breadcrumb .breadcrumb-item:first-child {
    flex: 0 0 auto;
  }

  .page-breadcrumb .breadcrumb-item.active {
    flex: 0 1 auto;
  }
}

/* Service card "Learn More" links: 24px tall, too small to tap reliably. */
.service-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 0;
}
