/* Muallim Match v3.2 — swipe + hover-edge navigation */
body.mm-home-carousel .app-shell > main.mm-carousel-root {
  position: relative;
  min-height: calc(100vh - 92px);
  padding-bottom: 72px;
  overflow-x: hidden;
  touch-action: pan-y pinch-zoom;
}

body.mm-home-carousel .app-shell > main.mm-carousel-root > section.mm-carousel-slide {
  display: none !important;
  min-height: calc(100vh - 160px);
  width: 100%;
  animation: mmSlideIn .28s ease both;
}

body.mm-home-carousel .app-shell > main.mm-carousel-root > section.mm-carousel-slide.is-active {
  display: block !important;
}

@keyframes mmSlideIn {
  from { opacity: .25; transform: translateX(22px); }
  to { opacity: 1; transform: translateX(0); }
}

body.mm-home-carousel.mm-slide-back .app-shell > main.mm-carousel-root > section.mm-carousel-slide.is-active {
  animation-name: mmSlideInBack;
}

@keyframes mmSlideInBack {
  from { opacity: .25; transform: translateX(-22px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Pagination dots */
#mm-home-dots {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 14px;
  border: 1px solid rgba(15,81,50,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 8px 28px rgba(15,81,50,.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#mm-home-dots[hidden] { display: none !important; }

#mm-home-dots button {
  width: 9px;
  height: 9px;
  min-width: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #c9d8d0;
  cursor: pointer;
  transition: width .18s ease, border-radius .18s ease, background .18s ease, transform .18s ease;
}

#mm-home-dots button:hover,
#mm-home-dots button:focus-visible {
  transform: scale(1.15);
  outline: none;
}

#mm-home-dots button.is-active {
  width: 28px;
  border-radius: 999px;
  background: #0f6847;
}

/* Desktop hover-edge navigation.
   The edge zone is present only on devices with a real hover-capable pointer.
   Buttons are intentionally subtle and appear only on hover/focus. */
.mm-carousel-edge {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .mm-carousel-edge {
    position: fixed;
    z-index: 58;
    top: 92px;
    bottom: 58px;
    width: clamp(54px, 5vw, 82px);
    display: flex;
    align-items: center;
    pointer-events: auto;
  }

  .mm-carousel-edge[hidden] {
    display: none !important;
  }

  .mm-carousel-edge-left {
    left: 0;
    justify-content: flex-start;
    padding-left: 8px;
  }

  .mm-carousel-edge-right {
    right: 0;
    justify-content: flex-end;
    padding-right: 8px;
  }

  .mm-carousel-edge::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
  }

  .mm-carousel-edge-left::before {
    background: linear-gradient(90deg, rgba(13,74,51,.055), rgba(13,74,51,0));
  }

  .mm-carousel-edge-right::before {
    background: linear-gradient(270deg, rgba(13,74,51,.055), rgba(13,74,51,0));
  }

  .mm-carousel-edge:hover::before,
  .mm-carousel-edge:focus-within::before {
    opacity: 1;
  }

  .mm-carousel-edge-button {
    position: relative;
    z-index: 1;
    width: 42px;
    height: 72px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(15,81,50,.10);
    border-radius: 16px;
    background: rgba(255,255,255,.48);
    color: rgba(15,81,50,.55);
    box-shadow: 0 7px 24px rgba(15,81,50,.06);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transform: translateX(-5px);
    transition: opacity .2s ease, transform .2s ease, background .2s ease, color .2s ease;
  }

  .mm-carousel-edge-right .mm-carousel-edge-button {
    transform: translateX(5px);
  }

  .mm-carousel-edge:hover .mm-carousel-edge-button,
  .mm-carousel-edge:focus-within .mm-carousel-edge-button,
  .mm-carousel-edge-button:focus-visible {
    opacity: .72;
    transform: translateX(0);
  }

  .mm-carousel-edge-button:hover,
  .mm-carousel-edge-button:focus-visible {
    opacity: .92;
    color: rgba(15,81,50,.78);
    background: rgba(255,255,255,.68);
    outline: 2px solid rgba(15,104,71,.16);
    outline-offset: 2px;
  }
}

/* Explicitly remove hover zones on touch-first devices so they never block gestures. */
@media (hover: none), (pointer: coarse) {
  .mm-carousel-edge {
    display: none !important;
    pointer-events: none !important;
  }
}

body.mm-home-carousel .mm-home-section,
body.mm-home-carousel .mm-cta-section {
  padding-top: clamp(38px,6vh,76px);
  padding-bottom: clamp(38px,6vh,76px);
}

body.mm-home-carousel .mm-home-hero {
  min-height: calc(100vh - 150px);
}

body.mm-home-carousel .mm-hero-grid {
  min-height: calc(100vh - 150px);
}

/* Guest landing: no navigation menu, only sign in/enroll/join teacher + hero search/start */
body.mm-landing-guest .topbar .desktop-nav,
body.mm-landing-guest .topbar .mobile-menu-button,
body.mm-landing-guest .mobile-nav-panel {
  display: none !important;
}

body.mm-landing-guest .footer {
  display: none !important;
}

body.mm-landing-guest .desktop-account-actions {
  display: flex !important;
  gap: 8px;
}

body.mm-landing-guest .topbar {
  justify-content: space-between;
}

body.mm-landing-guest .header-tools {
  margin-left: auto;
}

/* Short How it works */
.simple-how-it-works { padding: clamp(24px,4vw,44px); }
.simple-how-grid { display:grid; gap:14px; margin-top:26px; }
.simple-how-step {
  display:grid;
  grid-template-columns:48px 1fr;
  gap:16px;
  align-items:start;
  padding:18px;
  border:1px solid rgba(15,81,50,.12);
  border-radius:18px;
  background:#f8fbf8;
}
.simple-how-step > strong {
  width:42px; height:42px; border-radius:50%; display:grid; place-items:center;
  background:#0f6847; color:#fff; font-size:18px;
}
.simple-how-step h2 { margin:0 0 5px; font-size:18px; }
.simple-how-step p { margin:0; color:#65766d; line-height:1.65; }
.simple-how-note { margin:18px 0 0; padding:15px 17px; border-radius:14px; background:#f3f0e5; color:#48584f; }

/* Tablet: keep comfortable spacing; touch devices will use swipe instead of hover edges. */
@media (min-width: 761px) and (max-width: 1100px) {
  body.mm-home-carousel .app-shell > main.mm-carousel-root {
    padding-bottom: 68px;
  }
  #mm-home-dots { bottom: 14px; }
}

@media (max-width: 760px) {
  body.mm-landing-guest .topbar {
    flex-wrap: wrap;
    gap: 9px;
    padding-bottom: 10px;
  }

  body.mm-landing-guest .brand { flex:1 1 auto; min-width:0; }

  body.mm-landing-guest .header-tools {
    width:100%;
    display:flex;
    flex-wrap:wrap;
    justify-content:space-between;
    gap:8px;
  }

  body.mm-landing-guest .desktop-account-actions {
    flex:1 1 100%;
    display:grid !important;
    grid-template-columns:repeat(3,minmax(0,1fr));
  }

  body.mm-landing-guest .desktop-account-actions .btn {
    width:100%;
    min-height:42px;
    padding:8px 7px;
    font-size:12px;
    white-space:nowrap;
  }

  body.mm-home-carousel .app-shell > main.mm-carousel-root {
    min-height: calc(100vh - 150px);
    padding-bottom: 62px;
    touch-action: pan-y pinch-zoom;
  }

  body.mm-home-carousel .app-shell > main.mm-carousel-root > section.mm-carousel-slide {
    min-height: calc(100vh - 210px);
    overflow-y:auto;
    max-height: calc(100vh - 150px);
    -webkit-overflow-scrolling: touch;
  }

  body.mm-home-carousel .mm-home-hero,
  body.mm-home-carousel .mm-hero-grid {
    min-height:auto;
  }

  body.mm-home-carousel .mm-hero-grid {
    padding-top:34px;
    padding-bottom:38px;
  }

  #mm-home-dots {
    bottom:10px;
    max-width: calc(100vw - 24px);
  }

  .simple-how-step { grid-template-columns:40px 1fr; padding:15px; }
  .simple-how-step > strong { width:36px; height:36px; }
}

@media (prefers-reduced-motion: reduce) {
  body.mm-home-carousel .app-shell > main.mm-carousel-root > section.mm-carousel-slide,
  body.mm-home-carousel.mm-slide-back .app-shell > main.mm-carousel-root > section.mm-carousel-slide.is-active,
  .mm-carousel-edge-button,
  .mm-carousel-edge::before,
  #mm-home-dots button {
    animation: none !important;
    transition: none !important;
  }
}

/* =========================================================
   Muallim Match v3.3 — mobile guest header refinement
   Keep the language switch on the first row beside the brand,
   while the guest account CTAs remain on the second row.
   ========================================================= */
@media (max-width: 760px) {
  body.mm-landing-guest .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 10px;
    row-gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  body.mm-landing-guest .topbar .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    margin-right: 0;
  }

  /* Let the controls inside header-tools participate directly
     in the topbar grid on the guest landing page. */
  body.mm-landing-guest .topbar .header-tools {
    display: contents !important;
    width: auto;
    margin-left: 0;
  }

  body.mm-landing-guest .topbar .language-switch {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    margin: 0;
    flex: none;
    white-space: nowrap;
  }

  body.mm-landing-guest .topbar .desktop-account-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    margin: 0;
  }

  /* These controls are already hidden for guest landing,
     keep them out of the grid if future markup changes. */
  body.mm-landing-guest .topbar .mobile-menu-button,
  body.mm-landing-guest .topbar .notification-bell {
    display: none !important;
  }
}

@media (max-width: 430px) {
  body.mm-landing-guest .topbar .language-switch {
    padding: 2px;
  }

  body.mm-landing-guest .topbar .language-switch button {
    padding: 7px 8px;
    font-size: 11px;
  }
}
