/* ==========================================================================
   Responsive overrides for the ported Webflow pages.
   Loaded AFTER /css/martialytics-live.min.css (in WebflowLayout) so these win
   the cascade. Native .astro pages use .cmp-* classes with their own @media in
   compare.css and are unaffected by the selectors here.
   ========================================================================== */

/* Homepage hero video frame: it's a wide ~2.28:1 box tuned for the old video, but
   the new 2.0 dashboard video is ~1.54:1, so cover was cropping ~33% off the top
   and bottom. Match the frame aspect to the video so the dashboard shows in full.
   display:block is needed for aspect-ratio to drive height (it's a flex item). */
.screen-container {
  display: block !important;
  height: 0 !important;
  padding-bottom: 65.07% !important; /* 937/1440 -> matches the 2.0 video aspect */
  position: relative;
}
.screen-container > .background-video {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* Compare-button rows (why-choose-us): .pricing-link's `margin: 15px auto 36px`
   spreads the buttons across the full width (auto margins eat the flex free
   space). Zero the margins so they group together with the row's gap instead.
   (The buttons' bottom breathing room is set inline on the row in the page HTML
   so it hot-reloads, unlike this cached public stylesheet.) */
.compare-cta-row .pricing-link { margin: 0; }

/* why-choose-us "Our Martial Arts Origins": three fixed-width (300px) rotated
   photo cards sit in a flex row with no tablet breakpoint in the live CSS
   (only <=767px and <=479px overrides exist), so between 768-1012px the row
   is wider than the viewport and forces a page-wide horizontal scrollbar.

   Rather than clip the photos (cropping any part of a rotated "polaroid" is
   not acceptable) or approximate a scale factor, this measures the row's
   true geometry directly and computes the exact scale that fits it, so
   nothing is ever cropped and nothing is ever guessed. No overflow/clipping
   property is set anywhere here — a transform:scale() shrinks the whole
   painted row (this container and everything in it) uniformly, the same way
   shrinking a background-image keeps it proportional, so once the widest
   point is within the viewport nothing needs to be cut off to enforce it.

   With flex-shrink disabled (below) so the cards stay at their real 300px and
   don't ALSO independently shrink, the pre-transform distance from this
   container's left edge to the rightmost card's right edge is an exact linear
   function of the viewport width: 0.5px per 1px of width, plus a fixed
   492.3px (measured directly with the devtools protocol at 7 widths from
   768-1023px — not a fit, an exact match at every one of them, since it
   comes from how flex centering plus each card's own fixed rotate+translate
   offset compose). Scaling from the container's own left edge (rather than
   its center) keeps the formula correct despite that offset being
   asymmetric — the individual cards' translate() values bleed further right
   of centre than left, so a centred scale still left the rightmost card
   hanging over the edge even once the container's own box fit.

   (An earlier version of this rule also added overflow:hidden as a "just in
   case" backstop. That was a mistake, not a safety net: transform:scale()
   shrinks a box's own layout height by the same factor as everything inside
   it, so the rotated cards' vertical bleed stays the same *percentage* of
   that height no matter the scale — meaning the backstop clipped the top and
   bottom of every card's rotated corners at every width, unconditionally. The
   fix above is exact, so nothing here needs a backstop.) */
@media (min-width: 768px) and (max-width: 1023px) {
  .history-card-1 { flex-shrink: 0; }
  .history-cards-cont {
    transform: scale(min(1, calc((100vw - 30px) / (0.5 * 100vw + 492.3px))));
    transform-origin: left center;
  }
}

/* why-choose-us "why-choose-two-hands": swap the stock two_hands.avif photo
   for the new tablet-dashboard photo, keeping the decorative curve.svg layer
   (the teal "hill" that blends the photo into the section below) on top of
   it, same as the live stylesheet. The stock photo had a dark vignette baked
   into the top of the shot that faded it into the page's #232323 background
   above; the new photo's studio backdrop doesn't, leaving a hard seam, so a
   matching gradient is layered on top here to reproduce that same blend.
   This rule alone overrides both the base and the live stylesheet's
   <=479px background-position/size rule, since it's a single-class selector
   (same specificity) placed later in the cascade — height/margin/position
   are untouched so the section's layout is unaffected. */
.why-choose-two-hands {
  background-image:
    linear-gradient(to bottom, #232323, rgba(35, 35, 35, 0) 100%),
    url(https://pub-ecf72b9227e2493dbde23b9a28db07b8.r2.dev/wf/6837485031bbfd3cf40e9522_curve.svg),
    url(/images/why-choose-tablet-dojo.avif);
  background-position: top, 50% 101%, center;
  background-size: 100% 100%, 120%, cover;
  background-repeat: no-repeat, no-repeat, no-repeat;
}

/* Blog post "Keep Reading" band: 3 related-post cards injected by
   [...slug].astro between the article and the closing CTA. The cards reuse
   the blog hub's own classes (.collection-list, .blog-card, .heading-5,
   .blog-card-gradient) so they inherit the live stylesheet's card look
   untouched; only the band wrapper + heading are new. Cream background
   matches the article section it follows, so the band reads as part of the
   post rather than a bolted-on widget. */
.related-posts-section {
  background-color: var(--ma-background-cream);
  padding: 0 15px 84px;
}
.related-posts-heading {
  color: var(--ma-background-dark-grey);
  text-align: center;
  margin: 0 0 36px;
  font-family: Montserrat, "Montserrat Fallback", sans-serif;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
}

/* .div-block-3 (icon + bullet list, used on why-choose-us and pricing),
   .hero-paragraph-benefits (why-choose-us, benefits, demo) and .cta-para
   (the site-wide closing CTA block) are all fixed-width (35rem/560px,
   31.25rem/500px) with no override between the 479px and 767px breakpoints,
   so they overflow any viewport narrower than their fixed width and add to
   the page's horizontal scroll. Cap them instead of resizing them. */
.div-block-3,
.hero-paragraph-benefits,
.cta-para { max-width: 100%; }

/* The two-CTA hero row (site-wide "book a demo" block, .cta-button-container)
   only stacks into a column at <=479px. Between 480-767px the row stays
   side-by-side and the flex box shrinks .right-cta-button-container below its
   fixed 18.75rem width — but the absolutely-positioned .brad-wave photo inside
   it doesn't shrink with it, so it sticks out past the squeezed container and
   off the edge of the viewport. Stop the container from shrinking and let the
   row wrap instead, matching the same stacked look the 479px breakpoint
   already uses intentionally. */
.cta-button-container { flex-wrap: wrap; }
.right-cta-button-container { flex-shrink: 0; }

@media (max-width: 767px) {
  /* .cta-left (site-wide closing CTA column) has margin: auto left/right
     (set at the 991px breakpoint) to center it, but a flex item with cross-
     axis auto margins never stretches to its container's width even though
     the row is align-items:flex-start with no width of its own — so .cta-left
     shrinks to fit its widest fixed-width child (.cta-para's 31.25rem) and
     grows past the viewport instead of letting that child wrap. Pin it to
     100% width directly (auto margins then resolve to 0, same visual result)
     so max-width:100% above and normal text wrapping can clamp .cta-para /
     .cta-headline to the screen. */
  .cta-left { width: 100%; min-width: 0; }
}

/* .nav-bar (every page), .angled-rect/.leverage-angled-rect (footer, CTA
   sections, pricing) and .bg-vid-why (why-choose-us hero video layer) all use
   the live stylesheet's `width: 100vw` full-bleed pattern. `vw` is defined
   against the initial containing block, which does NOT shrink for a reserved
   (non-overlay) scrollbar the way `%`/clientWidth does — so on any browser
   that reserves scrollbar space (most non-macOS browsers, and macOS Chrome
   with "Always show scroll bars" or a physical mouse instead of a trackpad),
   each of these renders exactly one scrollbar-width too wide, adding a real,
   permanent horizontal scrollbar. This never surfaces in a headless-Chrome
   test (which reserves 0px for its scrollbar), only in real, scrollbar-
   reserving browsers, so it can pass every automated width sweep and still be
   visibly broken. `width: 100%` gives the same full-bleed look here (their
   containing blocks are already edge-to-edge sections or the viewport itself
   for the fixed nav bar) without the vw/scrollbar quirk. */
.nav-bar,
.angled-rect,
.leverage-angled-rect,
.bg-vid-why {
  width: 100%;
}

@media (max-width: 991px) {
  /* Same 100vw/scrollbar issue as above, but only kicks in at this
     breakpoint: .bg-video (referrals/trial-signup hero image band) switches
     from a safe 40vw to 100vw here. */
  .bg-video { width: 100%; }
}
@media (max-width: 479px) {
  /* Same again: .signup-container (trial-signup form card) switches from a
     safe 30vw to 100vw only on small phones. */
  .signup-container { width: 100%; }
}

@media (max-width: 640px) {
  /* Hero headline. The live stylesheet pins min-width: 46.5625rem (~745px),
     which is wider than a phone, so the headline overflows the viewport.
     Neutralise that and scale the type to fit. */
  .main-headline {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    font-size: clamp(2.3rem, 11.5vw, 3.1rem) !important;
    line-height: 1.06 !important;
    letter-spacing: -0.03em !important;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Squiggle + underline decorations are absolutely positioned for desktop;
     on mobile they land in the wrong place, so hide them. */
  .title-squiggle,
  .title-squiggle-pricing,
  .ma-schools-line { display: none !important; }

  /* Trust lines forced a wide, non-wrapping box (one has inline white-space:nowrap).
     Let them wrap and stay inside the viewport. */
  .trusted-text {
    max-width: 100% !important;
    white-space: normal !important;
  }

  /* The dashboard video frame + the waving-Brad photo are sized/placed for
     desktop; keep them inside the viewport. */
  .screenshot,
  .screen-container,
  .brad-wave { max-width: 100% !important; }

  /* This benefits paragraph keeps width:25rem (400px) on mobile (its breakpoint
     rule clears max-width but not width), forcing ~10px of horizontal scroll. */
  .benefits-para-1-cont,
  .benefits-para-1-cont.mobile {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Homepage bento: full-width Student Insight tile at the top of the grid.
   Same recipe as the other tiles: flat brand colour, one bold line, a clay
   3D illustration (a lightbulb in a gi) on the right, here as a looping
   muted video with the still as its poster. The tile's ::before paints the
   warm top-left wash and the feather over the video's edge, above the video
   and below the copy and cards. Spans all 8 desktop columns, 5 at tablet,
   stacks like the others on phones. */
.bento-item.bento0 {
  grid-area: span 4 / span 8 / span 4 / span 8;
  background-color: #cba0ce;
  color: #333;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0.75rem;
  height: 26rem;
  overflow: hidden;
  position: relative;
}
.bento-item.bento0 .insight-video {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: auto;
  z-index: 0;
  display: block;
  object-fit: cover;
}
.bento-item.bento0::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(135deg, rgba(219, 165, 113, 0.62) 0%, rgba(219, 165, 113, 0.22) 32%, rgba(219, 165, 113, 0) 58%),
    linear-gradient(90deg, #cba0ce 0%, #cba0ce 44%, rgba(203, 160, 206, 0) 64%);
}
.bento-item.bento0 .bento-text.insight,
.bento-item.bento0 .bento-sub,
.bento-item.bento0 .insight-cards { position: relative; z-index: 2; }
.bento-item.bento0 .bento-text.insight { max-width: 30rem; }
/* Example insight lines, styled like the rows in the class modal, floating
   between the copy and the figure. */
.bento-item.bento0 .insight-cards {
  position: absolute;
  left: 46%;
  top: 50%;
  transform: translateY(-50%);
  width: 22rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.bento-item.bento0 .insight-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.8rem 1rem;
  border-radius: 0.6rem;
  background: #6A5A8C;
  color: #fff;
  box-shadow: 0 14px 32px rgba(58, 42, 85, 0.28), 0 2px 6px rgba(58, 42, 85, 0.16);
  font-family: Montserrat, "Montserrat Fallback", sans-serif;
  letter-spacing: 0;
}
/* Each card drifts up and down a few pixels on its own cycle, offset so they
   never move in step. The stagger is kept in a custom property so the float
   animation can add to it. */
.bento-item.bento0 .insight-card { --sx: 0rem; animation: insight-float 5.2s ease-in-out infinite; }
.bento-item.bento0 .insight-card:nth-child(1) { --sx: -1.5rem; animation-delay: 0s; }
.bento-item.bento0 .insight-card:nth-child(2) { --sx: 1.75rem; animation-delay: -1.7s; animation-duration: 6.1s; }
.bento-item.bento0 .insight-card:nth-child(3) { --sx: -0.25rem; animation-delay: -3.4s; animation-duration: 5.6s; }
@keyframes insight-float {
  0%, 100% { transform: translate(var(--sx), 0); }
  50% { transform: translate(calc(var(--sx) + 10px), -2px); }
}
@media (prefers-reduced-motion: reduce) {
  .bento-item.bento0 .insight-card { animation: none; transform: translate(var(--sx), 0); }
}
.bento-item.bento0 .insight-name { font-size: 0.8rem; font-weight: 700; color: #fff; }
.bento-item.bento0 .insight-line { font-size: 0.8rem; line-height: 1.35; font-weight: 500; color: rgba(255,255,255,0.88); }
.bento-item.bento0 .bento-sub {
  max-width: 27rem;
  margin: 0;
  font-family: Montserrat, "Montserrat Fallback", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  font-weight: 500;
  color: #4A4A4A;
}
@media (max-width: 991px) {
  .bento-item.bento0 {
    grid-area: span 4 / span 8 / span 4 / span 8;
    height: 31rem;
    justify-content: flex-start;
  }
  .bento-item.bento0 .insight-video { top: auto; bottom: 0; height: 58%; }
  .bento-item.bento0::before {
    background-image:
      linear-gradient(135deg, rgba(219, 165, 113, 0.62) 0%, rgba(219, 165, 113, 0.22) 32%, rgba(219, 165, 113, 0) 58%),
      linear-gradient(180deg, #cba0ce 0%, #cba0ce 45%, rgba(203, 160, 206, 0) 60%),
      linear-gradient(90deg, #cba0ce 0%, #cba0ce 20%, rgba(203, 160, 206, 0) 58%);
  }
  .bento-item.bento0 .bento-text.insight { max-width: 24rem; font-size: 2rem; line-height: 2.1rem; }
  .bento-item.bento0 .bento-sub { max-width: 19rem; }
  .bento-item.bento0 .insight-cards { left: 1.75rem; top: auto; bottom: 1.5rem; transform: none; width: 16rem; }
  .bento-item.bento0 .insight-card:nth-child(3) { display: none; }
  .bento-item.bento0 .insight-card:nth-child(1) { --sx: 0rem; }
  .bento-item.bento0 .insight-card:nth-child(2) { --sx: 1rem; }
}
@media screen and (max-width: 767px) {
  .bento-item.bento0 { grid-area: 1 / 1 / 4 / 6; order: -9999; }
  #w-node-_7a3c331a-191f-04df-23e5-8ff94c8df898-cdc157fc { grid-area: 4 / 1 / 7 / 6; order: -9998; }
}
@media screen and (max-width: 479px) {
  .bento-item.bento0 {
    width: 90vw;
    margin-left: auto;
    margin-right: auto;
    height: 34rem;
    justify-content: flex-start;
  }
  .bento-item.bento0 .insight-video { height: 40%; }
  .bento-item.bento0::before {
    background-image:
      linear-gradient(135deg, rgba(219, 165, 113, 0.62) 0%, rgba(219, 165, 113, 0.22) 32%, rgba(219, 165, 113, 0) 58%),
      linear-gradient(180deg, #cba0ce 0%, #cba0ce 62%, rgba(203, 160, 206, 0) 74%),
      linear-gradient(90deg, #cba0ce 0%, #cba0ce 30%, rgba(203, 160, 206, 0) 62%);
  }
  .bento-item.bento0 .bento-text.insight { max-width: none; font-size: 1.85rem; line-height: 1.95rem; }
  .bento-item.bento0 .bento-sub { font-size: 1rem; max-width: none; }
  .bento-item.bento0 .insight-cards { left: 1.5rem; bottom: 1.25rem; width: 11.5rem; }
  .bento-item.bento0 .insight-card:nth-child(2) { display: none; }
}

/* The two trust lines under the hero (one carries an inline white-space:nowrap)
   were only allowed to wrap at <=640px, so from 641px up to the desktop
   breakpoint the review quote ran ~550px past the viewport and the page could
   scroll sideways. Let them wrap at every width below desktop. */
@media (max-width: 1023px) {
  .trusted-text {
    max-width: 100% !important;
    white-space: normal !important;
  }
}

/* Between 992px and ~1300px the hero dashboard (scaled 1.2x and tilted by the
   scroll animation) and a floating school logo in the green bento tile poke a
   little past the viewport. They are decorative at the edges, so clip the
   sections horizontally rather than resize the animated elements. `clip`
   does not create a scroll container, so vertical scrolling is unaffected. */
@media (max-width: 1339px) {
  .below-hero-section,
  .feature-bento-section { overflow-x: clip; }
}

/* Benefits page: the school website card, a fourth full-width photo card in
   the hero-benefit style (Webflow places the other three by w-node id). The
   laptop sits right of centre, so the copy keeps the bottom-left corner. */
.hero-benefit.website {
  grid-area: span 1 / span 8 / span 1 / span 8;
  background-image: linear-gradient(194deg, #0000, #000000ab), url(/images/websites/website-hero-bjj.webp);
  background-position: 0 0, 60% 50%;
  background-size: auto, cover;
  flex-flow: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 28px 28px 36px;
  display: flex;
}
.hero-benefit.website .benefits-page-card-heading,
.hero-benefit.website .benefits-page-card-para { max-width: 44%; }
@media screen and (max-width: 767px) {
  .hero-benefit.website {
    background-image: linear-gradient(to top, #000000e0 0%, #000000b3 55%, #00000040 100%), url(/images/websites/website-hero-bjj.webp);
    background-position: 0 0, 72% 50%;
  }
  .hero-benefit.website .benefits-page-card-heading,
  .hero-benefit.website .benefits-page-card-para { max-width: none; }
}

/* Pricing: the inclusions row (now with the free school website) wraps and
   centres instead of running off the edge below desktop width. */
@media screen and (min-width: 480px) {
  .pricing-features { flex-wrap: wrap; justify-content: center; row-gap: 6px; padding-left: 1rem; padding-right: 1rem; }
}
