/* sp-mobile-fixes — Sapient Perception mobile optimisations
   Single source of truth, shared across all pages. Linked LAST in <head> so it
   wins the cascade over each page's inline styles without editing them.
   Marker string (do not remove): sp-mobile-fixes */

/* --- Brand webfonts (self-hosted) ---------------------------------------- *
   Client-supplied WOFF2, latin + latin-ext subsets, in /assets/fonts/:
     Poppins   300, 300 italic, 400, 500, 500 italic   (body)
     Tomorrow  400 Regular                             (display / headlines)
     Exo 2     400, 500, 600                           (logo / brand)
   Only these weights exist as files, so nothing requests a weight we do not
   have — see the "display weight normalisation" block further down. ~160 KB total,
   cached for a year via _headers.
 * ------------------------------------------------------------------------- */
@font-face{font-family:"Poppins";src:url("/assets/fonts/poppins-300.woff2") format("woff2");font-weight:300;font-style:normal;font-display:swap}
@font-face{font-family:"Poppins";src:url("/assets/fonts/poppins-300-italic.woff2") format("woff2");font-weight:300;font-style:italic;font-display:swap}
@font-face{font-family:"Poppins";src:url("/assets/fonts/poppins-400.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"Poppins";src:url("/assets/fonts/poppins-500.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap}
@font-face{font-family:"Poppins";src:url("/assets/fonts/poppins-500-italic.woff2") format("woff2");font-weight:500;font-style:italic;font-display:swap}
/* Tomorrow ships as Regular only (per the brand guide). The 100-500 range maps those
   requested weights to this one file, so nothing mismatches or gets faux-bolded. */
@font-face{font-family:"Tomorrow";src:url("/assets/fonts/tomorrow-400.woff2") format("woff2");font-weight:100 500;font-style:normal;font-display:swap}

@font-face{font-family:"Exo 2";src:url("/assets/fonts/exo2-400.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"Exo 2";src:url("/assets/fonts/exo2-500.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap}
@font-face{font-family:"Exo 2";src:url("/assets/fonts/exo2-600.woff2") format("woff2");font-weight:600;font-style:normal;font-display:swap}

/* Never fake a weight or a slant we do not ship. */
html{font-synthesis-weight:none;-webkit-font-synthesis:style}

/* --- base (all viewports) --- */
h1,h2,h3{overflow-wrap:break-word;word-break:normal}          /* never clip long words */
.sub-toggle{display:none}                                     /* caret toggle: mobile-only, injected by JS */

/* floating simulator tabs: hide the pull-tab while its drawer is open; keep drawer above tab */
.rf-tab[aria-expanded="true"],.beam-tab[aria-expanded="true"],
.cfg-tab[aria-expanded="true"],.rec-tab[aria-expanded="true"]{opacity:0;visibility:hidden;pointer-events:none;transition:none}
.rf-drawer,.beam-drawer,.cfg-drawer,.rec-drawer{z-index:95}

/* small phones: tighter gutters + slightly smaller display type */
@media (max-width:480px){
  .wrap{padding-left:18px;padding-right:18px}
  h1{font-size:clamp(1.9rem,7.6vw,2.45rem)}
  .tech-hero h1{font-size:clamp(1.9rem,7.2vw,2.45rem)}
  .hero p.lede{font-size:1rem}
  .spec-cta{flex-direction:column;align-items:stretch}
  .spec-cta a{white-space:normal}
}

/* phones/small tablets: dock the pull-tab to bottom-right as a compact pill so it
   never sits over body copy. transform:none (not a slide) so always-on tabs (cfg/rec)
   stay visible while Explore's rf/beam tabs remain gated by their own visibility toggle. */
@media (max-width:768px){
  .rf-tab,.beam-tab,.cfg-tab,.rec-tab{
    top:auto;bottom:14px;right:12px;left:auto;transform:none;
    writing-mode:horizontal-tb;text-orientation:mixed;
    border:1px solid var(--cta);border-right:1px solid var(--cta);border-radius:8px;
    padding:.62rem 1rem;font-size:.68rem;letter-spacing:.13em;
    gap:.5rem;box-shadow:0 8px 22px rgba(0,0,0,.45);
    max-width:calc(100vw - 24px);white-space:nowrap;
  }
  .rf-tab.on-screen,.beam-tab.on-screen,.cfg-tab.on-screen,.rec-tab.on-screen{transform:none}
  .rf-drawer,.beam-drawer,.cfg-drawer,.rec-drawer{width:100vw}
}

/* mobile nav: scrollable panel + collapsible submenus */
@media (max-width:900px){
  #site-nav.open{max-height:calc(100vh - 68px);overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding-bottom:1rem}
  .has-sub{display:flex;flex-wrap:wrap;align-items:stretch}
  .has-sub>a{flex:1 1 auto}
  .has-sub>.sub{flex:0 0 100%;width:100%}
  .sub{display:none}
  .has-sub:hover>.sub,.has-sub:focus-within>.sub{display:none}
  .has-sub.sub-open>.sub{display:block}
  .sub-toggle{display:flex;align-items:center;justify-content:center;flex:0 0 auto;width:58px;min-height:50px;background:none;border:none;border-left:1px solid var(--line);color:var(--text);cursor:pointer}
  .sub-toggle span{display:block;width:9px;height:9px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg);margin-top:-3px;transition:transform .2s}
  .has-sub.sub-open>.sub-toggle{color:var(--accent)}
  .has-sub.sub-open>.sub-toggle span{transform:rotate(-135deg);margin-top:3px}
}

/* === Brand + accessibility layer (audit review, Aug 2026) ================== *
   Loaded last, so these win over each page's inline <style> without editing it.
 * ========================================================================== */

/* c30 — CTAs are body-face, normal weight, and quiet. The resting fill is #c83200
   (white 5.37:1) so no size or weight gymnastics are needed for AA; #e84000 — the
   brand CTA colour — takes hover and pressed. Tomorrow Bold is no longer used. */
.btn{font-family:var(--font-body);font-size:1rem;font-weight:400;letter-spacing:.01em;
     min-height:44px;display:inline-flex;align-items:center;justify-content:center;
     padding:.7rem 1.5rem;border-radius:6px;
     background:var(--cta-press);border:1px solid var(--cta-press);color:#fff}
.btn:hover,.btn:focus-visible{background:var(--cta);border-color:var(--cta);color:#fff;text-decoration:none}
.btn:active{background:var(--cta-press);border-color:var(--cta-press)}
/* the secondary CTA takes a neutral outline, so orange stays exclusive to the primary */
.btn-ghost,.pp-hero .hero-ctas .btn-ghost,.hero .hero-ctas .btn-ghost{
  background:transparent;border-color:var(--line);color:var(--text-strong)}
.btn-ghost:hover,.btn-ghost:focus-visible,.pp-hero .hero-ctas .btn-ghost:hover{
  background:transparent;border-color:var(--accent-2);color:var(--accent-2)}
.nav .btn{background:transparent;border-color:var(--cta-press);color:var(--text-strong);
          font-size:.92rem;font-weight:400;padding:.5rem 1.15rem;min-height:40px}
.nav .btn:hover{background:var(--cta);border-color:var(--cta);color:#fff}

/* F011 — minimum 44px touch targets on the controls that operate the site */
.menu-toggle{min-height:44px;padding:.6rem .9rem;font-size:.9rem}
.g-thumb{min-height:44px;font-size:.72rem;padding:.5rem .9rem}
[role="tab"],.slider-tab,.beam-tbtn,.area-mode{min-height:44px}
.slider-tab,.area-mode{padding-top:.55rem;padding-bottom:.55rem}
.ax-tier{min-height:44px}

/* F044 — docked simulator pull-tabs: readable label, comfortable target */
@media (max-width:768px){
  .rf-tab,.beam-tab,.cfg-tab,.rec-tab{min-height:44px;font-size:.75rem;padding:.7rem 1.1rem}
}

/* F029 / F052 — the comparison counters carry meaning, so they use the brand CTA
   colour. #e84000 on --bg-1 is 3.36:1, so the counter is set at 24px where the WCAG
   large-text threshold of 3:1 applies unambiguously (no bold weight required). */
.uu-count{font-size:1.5rem;font-weight:400;letter-spacing:.05em;line-height:1.3}

/* F030 — display headings at Tomorrow Regular (400); 500 reserved for emphasis */
main h1,main h2,main h3,.hero h1,.pp-hero h1,.tech-hero h1,.cn-hero h1{font-weight:400}

/* F011 (extended) — every button-like control clears 44px. Visual weight is kept
   by growing padding, and the 8px slider dots grow only their hit area. */
.ax-case,.rec-reset,.slider-arrow,.disclose,.sp-consent button,#sp-consent-ok{min-height:44px}
.ax-case,.rec-reset,.slider-arrow,.disclose{padding-top:.55rem;padding-bottom:.55rem}
.rec-close,.rf-close,.beam-close,.cfg-close{min-width:44px;min-height:44px;
  display:inline-flex;align-items:center;justify-content:center}
.slider-dot{position:relative}
.slider-dot::after{content:"";position:absolute;left:50%;top:50%;width:44px;height:44px;
  transform:translate(-50%,-50%)}
.rf-open-link,.beam-open-link,.cfg-open-link{display:inline-block;padding:.55rem 0;min-height:34px}


/* === Review round 2 — shared fixes (comments 4, 5, 11, 27) ================= */

/* c11 — .specs rows: dt and dd were both grid-column:2 with no row assigned, so a
   long dt pushed the dd down an extra implicit row. Explicit rows kill the gap. */
.specs div{grid-template-rows:auto auto;align-content:start}
.specs dt{grid-row:1}
.specs dd{grid-row:2}

/* c5 — the global h2 cap at 26ch forced breaks long before the column ran out,
   orphaning single words. Lift it and let balance handle any wrap that remains. */
h1,h2,h3{text-wrap:balance}
h2{max-width:46ch}
.section-head h2,#proof-h,#where-h,#stack-h{max-width:none}

/* c4 — Applications cards get the Go Deeper hover, and the whole card is the
   click target via a stretched pseudo-element on the existing "Read more" link. */
.case{position:relative;transition:border-color .15s}
.case:hover{border-color:var(--accent-2)}
.case .more{position:static}
.case .more::after{content:"";position:absolute;inset:0;z-index:1}
.case:focus-within{border-color:var(--accent-2)}

/* c27+c36 — simulator pull-tabs. The label was 12.5px Tomorrow 400, tracked wide and
   rotated vertical, with children at .85 opacity — it read as disabled. Rotated text
   needs more size and weight: Poppins 500 at 13.5px, pure white, tight tracking,
   every child at full opacity, and a light hairline so the pill separates from the
   page instead of dissolving into it. */
.rf-tab,.beam-tab,.cfg-tab,.rec-tab{
  background:var(--cta-press) !important;border:1px solid rgba(255,255,255,.30) !important;
  border-right:none !important;color:#fff !important;
  font-family:var(--font-body);font-weight:500;font-size:.84rem;letter-spacing:.12em;
  padding-top:1.3rem;padding-bottom:1.3rem;
  box-shadow:0 6px 24px rgba(0,0,0,.5)}
.rf-tab *,.beam-tab *,.cfg-tab *,.rec-tab *{opacity:1 !important;color:#fff}
.rf-tab::after,.beam-tab::after,.cfg-tab::after,.rec-tab::after,
.rf-tab::before,.beam-tab::before,.cfg-tab::before,.rec-tab::before{opacity:1;color:#fff}
.rf-tab:hover,.beam-tab:hover,.cfg-tab:hover,.rec-tab:hover,
.rf-tab:focus-visible,.beam-tab:focus-visible,.cfg-tab:focus-visible,.rec-tab:focus-visible{
  background:var(--cta) !important;border-color:rgba(255,255,255,.45) !important}
/* one slow attention pulse on first appearance, never a loop */
@keyframes sp-tab-in{0%{box-shadow:0 0 0 1px rgba(245,245,245,.14),0 0 0 0 rgba(232,64,0,.55)}
  60%{box-shadow:0 0 0 1px rgba(245,245,245,.3),0 0 0 12px rgba(232,64,0,0)}
  100%{box-shadow:0 0 0 1px rgba(245,245,245,.14),0 6px 22px rgba(0,0,0,.45)}}
.rf-tab.on-screen,.beam-tab.on-screen,.cfg-tab.on-screen,.rec-tab.is-visible{
  animation:sp-tab-in 1.6s ease-out 1}
@media (prefers-reduced-motion:reduce){
  .rf-tab.on-screen,.beam-tab.on-screen,.cfg-tab.on-screen,.rec-tab.is-visible{animation:none}}

/* the prose prompt that makes the simulators discoverable — now at every width */
.sim-prompt{display:block;margin-top:1rem;color:var(--accent-2);
  font-family:var(--font-display);font-size:.92rem;letter-spacing:.02em}

/* c36 — the tabs were LITERALLY in shadow: the closed drawers sit just off-screen
   (translateX(100%)) but still cast their 48px box-shadow back over the viewport
   edge, darkening the pull-tabs by ~35%. Shadow only while open. */
.rf-drawer,.beam-drawer,.cfg-drawer,.rec-drawer{box-shadow:none}
.rf-drawer.open,.beam-drawer.open,.cfg-drawer.open,.rec-drawer.open{box-shadow:-16px 0 48px rgba(0,0,0,.45)}

/* c58 — H1 in Poppins. The base h1 rule is declared once per page at the same
   specificity, so this sheet (linked last) wins; .hero h1 and .cn-hero h1 are
   more specific and are matched below. letter-spacing was set for Tomorrow's
   narrower forms and goes to 0 for Poppins at display size. */
h1,.hero h1,.cn-hero h1{font-family:var(--font-body);font-weight:400;letter-spacing:0}
.hero h1{letter-spacing:-.005em}

/* ── c74/c76/c84 — heading levels in Poppins ────────────────────────────────
   The base h1/h2/h3 rules are declared once per page at this specificity, so
   this sheet (linked last) wins. Rules with higher specificity are matched
   individually below. Tomorrow stays on labels, numerals and figure text. */
h1,h2,h3,
.hero h1,.cn-hero h1,
.pp h2.pp-name,.cn-statement h2,.cn-sec h2,.cn-founders>.wrap>h2,
.rec-head h2,.rf-head h2,.cfg-head h2,
.case h3,.chapter h3,.prod h3,.layer h3,.glance h3,.mission h3,.ov-card h3,
.prose h3,.dp-mod h3,.ig-mods .dp-mod h3,.ig-grouprow h3,.rec-card h3,
.cn-row h3,.cn-row .no,.cn-facts b,
.mx-changes b,.mx-uses b{
  font-family:var(--font-body);
  letter-spacing:0;
}
h1,h2,h3,.hero h1,.cn-hero h1,.pp h2.pp-name{font-weight:400}
.hero h1{letter-spacing:-.005em}
/* named values keep their weight but lose the tracking Tomorrow needed */
.cn-facts b,.cn-row .no{font-weight:400;letter-spacing:0}

/* ---------------------------------------------------------------------------
   c120 — diagram legibility on phones.
   These SVGs are drawn in large viewBoxes (560–1120 units). At 390 px the
   browser scales them to ~0.3–0.5, which put 108 text nodes below 9 px —
   unreadable. Enlarging the type instead would collide with fixed geometry,
   so each diagram keeps its design and gets a minimum legible width inside a
   scrollable frame. The container scrolls, not the page.
   :has() is a progressive enhancement — without it the diagram simply renders
   as it does today.
--------------------------------------------------------------------------- */
@media (max-width:760px){
  .arch-fig:has(> svg),
  .ignite-diagram:has(> svg),
  .tc-fig:has(> svg),
  .tech-fig:has(> svg),
  .proof-fig:has(> svg),
  .beam-scene:has(> svg),
  .fig-block:has(svg),
  .viewport:has(> svg){
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain;
    min-width:0;   /* grid and flex items default to min-width:auto and would
                      otherwise refuse to shrink, pushing the page sideways */
  }
  /* A wide svg inside a grid item sizes the whole column, which stretches its
     sibling copy off-screen. Grid and flex items are single-column here anyway,
     so letting them shrink is safe. */
  .component > *,.comp-fig,.pp-grid > *,.fig-grid > *,.tlayout > *,.mx > *,
  .hero-grid > *,.comp-copy,.payload > *{min-width:0}
  .arch-fig > svg{min-width:860px}
  .ignite-diagram > svg{min-width:660px}
  .tc-fig > svg{min-width:660px}
  .tech-fig > svg{min-width:800px}
  .proof-fig > svg{min-width:500px}
  .beam-scene > svg{min-width:400px}
  .fig-block .fig-mob svg,
  .fig-block > svg{min-width:480px}
  .viewport > svg{min-width:520px}
}

/* ================================================================
   c151 — iPhone pass: gutters, tap targets, micro-type, form zoom
   Measured at 320/360/375/390/393/414/430. This sheet is linked last,
   so these win over the per-page rules without touching 13 files.
   ================================================================ */
@media (max-width:760px){

  /* --- 1. form fields: anything under 16px makes iOS zoom the page on focus --- */
  input:not([type=range]):not([type=checkbox]):not([type=radio]),
  select,textarea,
  .field input,.field select,.field textarea,
  .rf-field input[type=number]{font-size:16px}
  /* a 4px-tall slider is not draggable with a thumb — give it a real touch area */
  .rf-field input[type=range]{height:26px;background:transparent}
  .rf-field input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:var(--panel-2)}
  .rf-field input[type=range]::-moz-range-track{height:4px;border-radius:2px;background:var(--panel-2)}
  .rf-field input[type=range]::-webkit-slider-thumb{width:22px;height:22px;margin-top:-9px}
  .rf-field input[type=range]::-moz-range-thumb{width:22px;height:22px}
  input[type=number]{min-height:44px;font-size:16px}
  /* keep the honeypot exactly as it is — off-screen and bot-visible by design */
  .hp input{font-size:inherit}

  /* --- 2. tap targets: 44px minimum on standalone controls (iOS HIG).
         Inline links inside prose are left alone deliberately. --- */
  .brand{min-height:44px;display:inline-flex;align-items:center}
  a.learn-more,a.more,.gd-row a,.see-hw a,.eio-note a,.ig-jump a,.res-access a,
  .capstack li>a,.layer>a{
    min-height:44px;display:inline-flex;align-items:center}
  .foot-links a,.foot-meta a{display:inline-block;padding:.45rem 0}
  .foot-links{gap:.1rem 1.6rem}
  .psub a{padding-top:.95rem;padding-bottom:.95rem}

  /* --- 3. micro-labels: nothing below 11.5px on a phone --- */
  .gd-src.gd-src,.cp-k.cp-k,.dep-num.dep-num,.mdl-k.mdl-k,.mx-k.mx-k,.rec-k.rec-k,
  .layers.layers,.ifc-k.ifc-k,.mi-n.mi-n,.r-label.r-label,.t-idx.t-idx,
  .ig-road.ig-road,.ig-h-tier.ig-h-tier,.eio-k.eio-k,.bnd-n.bnd-n,
  .lad-miss span,.tc-ai b,.tc-note b,.trail p,.trail>p{font-size:11.5px}
  .best-for.best-for b{font-size:11.5px}

  /* --- 4. big card padding eats the screen on a phone --- */
  .cta-box{padding:1.6rem}
}

/* --- 5. hero gutters: two heroes used a "Xrem 0 Yrem" shorthand, which zeroed
       the horizontal padding. Masked at desktop by their max-width, flush to the
       screen edge on a phone. --- */
.res-hero .wrap,.legal-head .wrap{padding-left:24px;padding-right:24px}
@media (max-width:760px){
  .res-hero .wrap,.legal-head .wrap,.tech-hero .wrap,.pp-hero .wrap{padding-left:18px;padding-right:18px}
}
