/*
 * Avecas modern layer v1 - progressive enhancement (2026-10-19).
 * Every rule is scoped to html[data-next], which the mu-plugin sets only for previewers
 * (?avnext=1 on, ?avnext=0 off) until the layer is switched live. Nothing here is required
 * for the site to work: browsers without support simply skip a rule. Motion respects
 * prefers-reduced-motion. Delete wp-content/mu-plugins/avecas-modern.php to remove.
 */

html[data-next] {
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
}

/* ---- Typography: balanced headings, no orphaned last words (Baseline / progressive) ---- */
html[data-next] main :is(h1, h2, h3) {
  text-wrap: balance;
}
html[data-next] main :is(p, li, blockquote, figcaption) {
  text-wrap: pretty;
}

/* ---- Selection + one consistent keyboard focus ring ---- */
html[data-next] ::selection {
  background: #cfe0fb;
  background: color-mix(in srgb, #075bd8 24%, #fff);
  color: #152332;
}
html[data-next] :where(a, button, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid #0068d8;
  outline-offset: 3px;
}
html[data-next] :where(.avs-cinematic, .avs-footer, .avs-cta-premium) :where(a, button, summary):focus-visible {
  outline-color: #fff;
}
@media (forced-colors: active) {
  html[data-next] :focus-visible {
    outline-color: Highlight;
  }
}

/* ---- Motion: only for people who have not asked for reduced motion ---- */
@media (prefers-reduced-motion: no-preference) {
  /* Cards, steps and article tiles rise gently into view (scroll-driven, no JavaScript). */
  @supports (animation-timeline: view()) {
    html[data-next] :is(.avs-photo-card, .avs-editorial-card, .avs-section article, .avs-solutions-section article, .avs-tk-home li) {
      animation: avs-rise linear both;
      animation-timeline: view();
      animation-range: entry 4% entry 36%;
    }
    @keyframes avs-rise {
      from {
        opacity: 0;
        translate: 0 26px;
      }
      to {
        opacity: 1;
        translate: 0 0;
      }
    }
  }

  /* The sticky header gains a soft shadow once the page scrolls. */
  @supports (animation-timeline: scroll()) {
    html[data-next] .avs-header {
      animation: avs-header-lift linear both;
      animation-timeline: scroll(root block);
      animation-range: 0 90px;
    }
    @keyframes avs-header-lift {
      to {
        box-shadow: 0 1px 0 rgb(21 35 50 / 0.06), 0 12px 32px -20px rgb(21 35 50 / 0.4);
      }
    }
  }

  /* Cross-page transitions (opt-in rule is injected by the mu-plugin): keep the header still, fade the page. */
  html[data-next] .avs-header {
    view-transition-name: avs-header;
  }
  html[data-next]::view-transition-group(avs-header) {
    animation-duration: 0s;
  }
  html[data-next]::view-transition-old(avs-header) {
    display: none;
  }
  html[data-next]::view-transition-new(avs-header) {
    animation: none;
  }
  html[data-next]::view-transition-old(root),
  html[data-next]::view-transition-new(root) {
    animation-duration: 0.22s;
    animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
  }
}


/* Blog grid tightening — scoped to .avs-posts. Uses !important to beat theme-level overrides on .avs-eyebrow / h2 margin. Added 2026-11-08. */
html[data-next] body.avs-site .avs-posts{gap:28px}
html[data-next] body.avs-site .avs-posts .avs-card{border-radius:16px;border:1px solid #e9edf1;background:#fff;overflow:hidden;transition:transform .25s cubic-bezier(.2,.7,.2,1),box-shadow .25s,border-color .25s}
html[data-next] body.avs-site .avs-posts .avs-card:hover{transform:translateY(-4px);border-color:#c6dbf2;box-shadow:0 12px 32px -14px rgba(10,30,60,.18)}
html[data-next] body.avs-site .avs-posts .avs-post-image{aspect-ratio:16/10;background:linear-gradient(135deg,#eef3fa,#dde7f3)}
html[data-next] body.avs-site .avs-posts .avs-post-copy{padding:20px 22px 22px !important;display:flex;flex-direction:column;flex:1;gap:10px}
html[data-next] body.avs-site .avs-posts .avs-post-copy .avs-eyebrow{font:600 11px/1 ui-monospace,SFMono-Regular,Menlo,monospace !important;letter-spacing:.09em !important;text-transform:uppercase !important;color:var(--avs-blue) !important;margin:0 !important;padding:0 !important}
html[data-next] body.avs-site .avs-posts .avs-post-copy h2{font-size:18.5px !important;line-height:1.3 !important;letter-spacing:-.02em !important;margin:0 !important;font-weight:650;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
html[data-next] body.avs-site .avs-posts .avs-post-copy h2 a{color:var(--avs-ink);text-decoration:none}
html[data-next] body.avs-site .avs-posts .avs-post-copy h2 a:hover{color:var(--avs-blue)}
html[data-next] body.avs-site .avs-posts .avs-post-copy>p:not(.avs-eyebrow){color:var(--avs-muted) !important;font-size:14.5px !important;line-height:1.6 !important;margin:0 !important;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;flex:1}
html[data-next] body.avs-site .avs-posts .avs-text-link{margin-top:6px;font-size:13px;font-weight:600;color:var(--avs-blue);display:inline-flex;align-items:center;gap:6px;text-decoration:none}
html[data-next] body.avs-site .avs-posts .avs-text-link span[aria-hidden]{transition:transform .2s;display:inline-block}
html[data-next] body.avs-site .avs-posts .avs-card:hover .avs-text-link span[aria-hidden]{transform:translate(2px,-2px)}
html[data-next] body.avs-site .avs-pagination{margin-block:48px 20px !important;gap:6px}
html[data-next] body.avs-site .avs-pagination .page-numbers{min-width:40px;min-height:40px;border-radius:10px;font-size:14px;font-weight:600;transition:background .15s,color .15s,border-color .15s}
html[data-next] body.avs-site .avs-pagination .page-numbers:not(.current):hover{background:#f3f6fa;border-color:#c6dbf2}
html[data-next] body.avs-site .avs-pagination .current{box-shadow:0 2px 8px -2px rgba(7,91,216,.35)}
@media (max-width:900px){html[data-next] body.avs-site .avs-posts{gap:20px}html[data-next] body.avs-site .avs-posts .avs-post-copy{padding:16px 18px 18px !important}html[data-next] body.avs-site .avs-posts .avs-post-copy h2{font-size:17px !important}}
