/* ============================================================
   SquareOps v4 design layer
   Shared by the v4 homepage and the product pages (/atmosly/,
   /alert6/, /verity/, /spendzero/). Loaded after ds.css.

   The page markup comes from the Claude Design project and keeps
   the design's inline styles, so the rules here are deliberately
   small: shared animation/texture classes, the interaction states
   v4.js toggles, and a responsive layer. The design itself is
   desktop-only; the r-* classes are added at import time to the
   grids, rows and type that need to adapt (see
   scripts/v4-import/README.md).
   ============================================================ */

html { overflow-x: clip; scroll-behavior: smooth; }
body.v4-page { margin: 0; background: #fff; font-family: var(--so-font-sans); color: var(--so-fg); }
.v4-page a { color: var(--so-teal-alt); text-decoration: none; }
.v4-page a:hover { color: var(--so-teal); }
.v4-page [id] { scroll-margin-top: 84px; }
.v4-page button { font: inherit; }

/* Hidden interaction states (inactive tab panels, collapsed strips, form states) */
.v4-off { display: none !important; }

/* Shared design classes */
@keyframes h3rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.h3-rise { animation: h3rise .8s cubic-bezier(.23,1,.32,1) both; }
.h3-rise2 { animation: h3rise .8s .15s cubic-bezier(.23,1,.32,1) both; }
.grid-light { background-image: linear-gradient(rgba(23,199,153,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(23,199,153,.07) 1px, transparent 1px); background-size: 48px 48px; }
.grid-dark { background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 48px 48px; }

/* FAQ accordions open/close smoothly whichever page they are on */
.v4-page [data-v4="faq"] > button { cursor: pointer; }

/* Mobile menu button, injected into the header at import time */
.v4-menu-btn { display: none; width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--so-border); background: #fff; color: var(--so-navy); font-size: 17px; cursor: pointer; align-items: center; justify-content: center; flex: none; }

/* Testimonial cards are clickable to move the carousel */
.v4-page [data-v4="t-prev"], .v4-page [data-v4="t-next"] { cursor: pointer; }

/* Case-study thumbnails replace the design's image slots */
.v4-page [data-v4="case-img"] { width: 100%; height: 100%; object-fit: contain; padding: 28px 36px; box-sizing: border-box; background: #fff; display: block; }

/* Reduced motion: keep the layout, drop the movement */
@media (prefers-reduced-motion: reduce) {
  .v4-page *, .v4-page *::before, .v4-page *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   Responsive layer
   ============================================================ */
@media (max-width: 1100px) {
  .r-g[data-rc="5"], .r-g[data-rc="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

@media (max-width: 960px) {
  .r-g { grid-template-columns: minmax(0, 1fr) !important; }
  .r-g[data-rc="4"], .r-g[data-rc="5"], .r-g[data-rc="6"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .r-f { flex-wrap: wrap !important; }
  .r-w { width: auto !important; min-width: 0 !important; max-width: 100% !important; }
  .r-p { padding-top: 64px !important; padding-bottom: 64px !important; }
  .r-t1 { font-size: 40px !important; }
  .r-t2 { font-size: 30px !important; }

}

@media (max-width: 640px) {
  .r-g, .r-g[data-rc="4"], .r-g[data-rc="5"], .r-g[data-rc="6"] { grid-template-columns: minmax(0, 1fr) !important; }
  .r-p { padding-top: 56px !important; padding-bottom: 56px !important; }
  .r-t1 { font-size: 34px !important; line-height: 1.12 !important; }
  .r-t2 { font-size: 27px !important; line-height: 1.2 !important; }
  .r-t3 { font-size: 22px !important; }
}


/* Homepage service strips: a stacked, tap-to-expand list below desktop width */
@media (max-width: 960px) {
  [data-v4="strips"] { flex-direction: column !important; flex-wrap: nowrap !important; height: auto !important; }
  [data-v4="strips"] > [data-strip] { flex: none !important; min-width: 0 !important; width: 100%; }
  [data-v4="strips"] [data-part="off"] { position: static !important; flex-direction: row !important; justify-content: flex-start !important; gap: 14px; padding: 16px 18px !important; }
  [data-v4="strips"] [data-part="off"] > span:nth-child(2) { writing-mode: horizontal-tb !important; transform: none !important; flex: 1; white-space: normal !important; }
  [data-v4="strips"] [data-part="on"] { position: static !important; padding: 22px !important; }
}

@media (max-width: 640px) {
  [data-v4="hdr-cta"] { display: none !important; }
  /* the 3D scenes are decorative and unreadable at phone width */
  [data-v4="iso-col"] { display: none !important; }
  /* testimonials: just the current card; arrows and dots still work */
  [data-v4="t-prev"], [data-v4="t-next"] { display: none !important; }
}


/* Grids of small cells (pipeline steps, badge rows): fewer columns, never one */
@media (max-width: 640px) {
  .r-gs { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

/* Grid-built tables (header row + data rows) scroll sideways instead of stacking */
@media (max-width: 640px) {
  .r-tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .r-tscroll > .r-trow { min-width: 560px; }
}

/* Testimonials: each rotation slides the cards in from the direction of travel */
@keyframes v4TInNext { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes v4TInPrev { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
.v4-page .v4-t-in-next > blockquote, .v4-page .v4-t-in-next > figcaption { animation: v4TInNext .55s var(--so-ease-out) both; }
.v4-page .v4-t-in-prev > blockquote, .v4-page .v4-t-in-prev > figcaption { animation: v4TInPrev .55s var(--so-ease-out) both; }

/* ============================================================
   Mega menu (partials/nav-menu.html, shared with the site header)
   Hover or keyboard focus opens a panel on desktop; below 961px the
   nav becomes the mobile menu and each item expands in place.
   ============================================================ */
.v4-page header [data-v4="nav"] { display: flex; align-items: center; justify-content: flex-end; }
.v4-mega { display: flex; align-items: center; gap: 4px 24px; list-style: none; margin: 0; padding: 0; }
.v4-mega > .nav-item { position: relative; }
/* the full Services menu is centred on the header, not on its trigger */
.v4-mega > .nav-item:has(> .megamenu-dropdown:not(.megamenu-compact):not(.megamenu-2col)) { position: static; }
.v4-mega .nav-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 23px 0;
  color: var(--so-fg) !important; font-size: 14.5px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: color var(--so-dur-fast) var(--so-ease-out);
}
.v4-mega .nav-link i { font-size: 9px; opacity: .55; transition: transform var(--so-dur-base) var(--so-ease-out); }
.v4-mega > .nav-item:hover > .nav-link, .v4-mega > .nav-item.open > .nav-link { color: var(--so-teal-alt) !important; }
.v4-mega > .nav-item:hover > .nav-link i, .v4-mega > .nav-item.open > .nav-link i { transform: rotate(180deg); opacity: 1; }

.v4-mega .megamenu-dropdown {
  position: absolute; top: 100%; left: 50%; transform: translate(-50%, -6px);
  min-width: 1000px; display: flex; gap: 32px; padding: 26px 28px;
  background: #fff; border: 1px solid var(--so-border); border-radius: 16px; box-shadow: var(--so-shadow-2xl);
  opacity: 0; visibility: hidden; z-index: 60;
  transition: opacity .2s var(--so-ease-out), transform .2s var(--so-ease-out), visibility .2s;
}
.v4-mega .megamenu-dropdown.megamenu-2col { min-width: 540px; }
.v4-mega .megamenu-dropdown.megamenu-compact { min-width: 290px; }
.v4-mega > .nav-item:hover > .megamenu-dropdown,
.v4-mega > .nav-item:focus-within > .megamenu-dropdown,
.v4-mega > .nav-item.open > .megamenu-dropdown { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.v4-mega .megamenu-column { flex: 1; min-width: 0; }
.v4-mega .megamenu-title {
  margin: 0 0 10px; padding: 0 12px 10px; border-bottom: 1px solid var(--so-border);
  font: 700 12px/1.2 var(--so-font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--so-teal-alt);
}
.v4-mega .megamenu-column ul { list-style: none; margin: 0; padding: 0; }
.v4-mega .megamenu-column a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: var(--so-fg) !important; font-size: 14px; font-weight: 500; line-height: 1.35;
  transition: background var(--so-dur-fast) var(--so-ease-out), color var(--so-dur-fast) var(--so-ease-out);
}
.v4-mega .megamenu-column a i { width: 18px; flex: none; text-align: center; color: var(--so-teal-alt); font-size: 14px; }
.v4-mega .megamenu-column a:hover { background: var(--so-success-soft); color: var(--so-navy) !important; }
.v4-mega .v4-nav-extra { display: none; }

/* Narrow desktops: tighten the bar */
@media (max-width: 1320px) and (min-width: 1201px) {
  .v4-mega { gap: 4px 16px; }
  .v4-mega .nav-link { font-size: 14px; }
}

/* The header collapses to the menu button below 1201px: product pages carry a
   product logo and two CTAs, and six menu items no longer fit beside them. */
@media (max-width: 1200px) {
  [data-v4="nav"] { display: none !important; }
  .v4-menu-btn { display: inline-flex; margin-left: 0; }
  header.v4-nav-open [data-v4="nav"] {
    display: block !important; position: absolute; top: 100%; left: 0; right: 0;
    max-height: calc(100vh - 68px); overflow-y: auto; margin: 0 !important;
    background: #fff; border-bottom: 1px solid var(--so-border); box-shadow: 0 12px 24px rgba(5,51,75,.08);
    padding: 6px 20px 18px; z-index: 50;
  }
  .v4-mega { display: block; }
  .v4-mega > .nav-item, .v4-mega > .nav-item:has(> .megamenu-dropdown) { position: static; border-bottom: 1px solid var(--so-border); }
  .v4-mega .nav-link { display: flex; justify-content: space-between; width: 100%; padding: 14px 0; font-size: 16px; }
  .v4-mega .megamenu-dropdown {
    position: static; transform: none !important; min-width: 0 !important; display: none;
    flex-direction: column; gap: 14px; padding: 4px 0 14px; border: 0; box-shadow: none; border-radius: 0;
    opacity: 1; visibility: visible;
  }
  .v4-mega > .nav-item:hover > .megamenu-dropdown, .v4-mega > .nav-item:focus-within > .megamenu-dropdown { display: none; }
  .v4-mega > .nav-item.open > .megamenu-dropdown { display: flex; }
  .v4-mega .megamenu-title { padding-left: 0; font-size: 11px; }
  .v4-mega .megamenu-column a { padding: 9px 0; }
  .v4-mega .v4-nav-extra { display: block; padding: 14px 0 0; }
  .v4-mega .v4-nav-extra a { font-weight: 700; color: var(--so-teal-alt) !important; font-size: 16px; }
}

/* Phones: the header CTA is hidden, so the menu button takes the right edge */
@media (max-width: 640px) { .v4-menu-btn { margin-left: auto; } }

/* Atmosly alternative and IDP pages: the FAQ intro column sits beside the
   list on desktop (sticky on alternative pages). Once the grid is one column
   it would slide over the questions, and the list's span-2 would add an
   implicit second column. */
@media (max-width: 1200px) {
  #al-faq > div > div:first-child { position: static !important; }
  #al-faq > div > div:nth-child(2), #id-faq > div > div:nth-child(2) { grid-column: auto !important; }
}
