/* ==========================================================
   MELAJOO MOBILE HEADER ONLY
   Desktop is intentionally untouched.
   - CTA sits immediately before burger
   - Burger stays at the far right
   - Open mobile menu is compact and readable
   ========================================================== */

@media (max-width: 780px) {
  .site-header .nav-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    height: 62px;
  }

  .site-header .logo {
    order: 1;
    flex: 0 0 auto;
    margin: 0;
  }

  /* Daftar Gratis berada tepat di kiri burger */
  .site-header .nav-actions {
    order: 2;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0;
    margin-left: auto;
  }

  .site-header .nav-actions .search-pill,
  .site-header .nav-actions .btn-outline {
    display: none !important;
  }

  .site-header .nav-actions .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 10.5px;
    line-height: 1;
    white-space: nowrap;
  }

  /* Burger selalu paling kanan */
  .site-header .mobile-toggle {
    order: 3;
    flex: 0 0 34px;
    width: 34px;
    height: 38px;
    display: grid;
    place-content: center;
    margin: 0 !important;
    padding: 4px 0 4px 8px;
    background: transparent;
    border: 0;
  }

  .site-header .mobile-toggle span {
    width: 22px;
    height: 2px;
    margin: 3px 0;
    border-radius: 99px;
  }

  /* Menu drawer mobile: jangan melebar vertikal */
  .site-header .nav {
    position: absolute;
    z-index: 60;
    top: 62px;
    left: 0;
    right: 0;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100vh - 102px);
    flex: none !important;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 8px 14px 12px;
    overflow-y: auto;
    background: rgba(255,255,255,.985);
    border-top: 1px solid #edf3f8;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 28px rgba(7,52,96,.10);
  }

  .site-header .nav:not(.open) {
    display: none !important;
  }

  .site-header .nav.open {
    display: flex !important;
  }

  .site-header .nav a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    padding: 9px 10px !important;
    margin: 0;
    border-radius: 9px;
    color: #31506f;
    font-size: 12.5px;
    font-weight: 650;
    line-height: 1.25;
  }

  .site-header .nav a + a {
    margin-top: 1px;
  }

  .site-header .nav a:hover,
  .site-header .nav a.active {
    color: var(--navy);
    background: #f3fbff;
  }

  .site-header .nav a.active::after {
    display: none !important;
  }
}

@media (max-width: 390px) {
  .site-header .nav-wrap {
    gap: 6px;
  }

  .site-header .nav-actions .btn-primary {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 10px;
  }

  .site-header .mobile-toggle {
    flex-basis: 32px;
    width: 32px;
    padding-left: 6px;
  }

  .site-header .nav {
    padding-inline: 12px;
  }
}

/* ==========================================================
   MELAJOO MOBILE HOMEPAGE & FOOTER REFINEMENTS
   Desktop remains untouched.
   ========================================================== */

.mobile-slider-dots{display:none}

@media (max-width: 780px) {
  /* --- compact section spacing on mobile --- */
  .section-head {
    gap: 10px;
  }

  .section-head .section-link {
    margin-top: 0;
  }

  /* --- stats become 2 x 2, quote full width --- */
  .stats {
    background: #f8fbfd;
  }

  .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px;
    padding: 18px 0 8px !important;
  }

  .stats-grid .stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-height: 96px;
    padding: 16px 10px !important;
    text-align: center;
    background: #fff;
    border: 1px solid #dce8f3 !important;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(10, 72, 119, 0.06);
  }

  .stats-grid .stat b {
    font-size: 17px;
    line-height: 1.1;
  }

  .stats-grid .stat span {
    font-size: 11px;
    line-height: 1.45;
  }

  .stats-grid .stat-quote {
    grid-column: 1 / -1;
    min-height: auto;
    padding: 18px 16px !important;
    text-align: center;
    background: linear-gradient(180deg, #ffffff 0%, #f4fbff 100%);
  }

  .stats-grid .stat-quote p {
    margin: 0 0 6px;
    font-size: 12px;
    line-height: 1.6;
  }

  .stats-grid .stat-quote small {
    display: block;
    font-size: 11px;
    color: #6f88a2;
  }

  /* --- mobile carousel base --- */
  .mobile-carousel-ready {
    display: grid !important;
    grid-auto-flow: column;
    align-items: stretch;
    gap: 14px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    margin-inline: -2px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
  }

  .mobile-carousel-ready::-webkit-scrollbar {
    display: none;
  }

  .mobile-carousel-ready > * {
    min-width: 0;
    scroll-snap-align: start;
  }

  .mobile-carousel-ready[data-per-view="1"] {
    grid-auto-columns: 100%;
  }

  .mobile-carousel-ready[data-per-view="2"] {
    grid-auto-columns: calc((100% - 14px) / 2);
  }

  .mobile-slider-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
  }

  .mobile-slider-dots button {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #c8d9e7;
    transition: transform .2s ease, background-color .2s ease;
    cursor: pointer;
  }

  .mobile-slider-dots button.active {
    background: #19d7c2;
    transform: scale(1.2);
  }

  /* --- featured programs slider --- */
  .featured-programs .section-head {
    margin-bottom: 14px;
  }

  .featured-program-grid.mobile-carousel-ready .featured-program-card {
    width: 100%;
    margin: 0;
    border-radius: 18px;
    overflow: hidden;
  }

  .featured-program-grid.mobile-carousel-ready .featured-program-media {
    position: relative;
  }

  .featured-program-grid.mobile-carousel-ready .featured-program-media img {
    width: 100%;
    height: 182px;
    object-fit: cover;
    display: block;
  }

  .featured-program-grid.mobile-carousel-ready .course-chip {
    position: absolute;
    top: 12px;
    left: 12px;
    margin: 0;
    z-index: 2;
  }

  /* --- category cards become 2 columns, odd last full width --- */
  .category-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .category-grid .category-card {
    min-height: 110px;
    align-items: flex-start;
    padding: 14px 12px;
  }

  .category-grid .category-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  /* --- benefit cards become 2 columns --- */
  .benefit-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .benefit-grid .benefit {
    padding: 14px 12px;
    min-height: 138px;
    border-radius: 16px;
    text-align: center;
  }

  .benefit-grid .benefit:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .benefit-grid .benefit h4 {
    font-size: 13px;
    line-height: 1.35;
  }

  .benefit-grid .benefit p {
    font-size: 11px;
    line-height: 1.5;
  }

  /* --- mentor slider: 2 cards visible --- */
  .grid-4.mobile-carousel-ready .mentor-card {
    border-radius: 16px;
  }

  .grid-4.mobile-carousel-ready .mentor-card img {
    height: 150px;
  }

  .grid-4.mobile-carousel-ready .mentor-card .card-body {
    padding: 12px;
  }

  .grid-4.mobile-carousel-ready .mentor-card h3 {
    font-size: 13px;
    line-height: 1.35;
  }

  .grid-4.mobile-carousel-ready .mentor-card p {
    font-size: 10.5px;
    line-height: 1.45;
  }

  .grid-4.mobile-carousel-ready .mentor-tags {
    gap: 6px;
    flex-wrap: wrap;
  }

  .grid-4.mobile-carousel-ready .mentor-tags span {
    font-size: 10px;
    padding: 4px 8px;
  }

  /* --- testimonial slider --- */
  .grid-3.mobile-carousel-ready .quote-card {
    min-height: 100%;
  }

  .grid-3.mobile-carousel-ready .quote-card p {
    min-height: 0;
  }

  /* --- footer on mobile: centered and 3 columns for menu groups --- */
  .site-footer .footer-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 18px 12px !important;
    align-items: start;
  }

  .site-footer .footer-grid > div {
    text-align: center;
  }

  .site-footer .footer-grid > div:first-child,
  .site-footer .footer-grid > div:last-child {
    grid-column: 1 / -1 !important;
  }

  .site-footer .footer-grid > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .site-footer .footer-grid > div:first-child p,
  .site-footer .footer-grid > div:last-child p {
    max-width: 280px;
    margin-inline: auto;
  }

  .site-footer .footer-grid > div:nth-child(2),
  .site-footer .footer-grid > div:nth-child(3),
  .site-footer .footer-grid > div:nth-child(4) {
    grid-column: span 1;
  }

  .site-footer .footer-logo img {
    margin-inline: auto;
  }

  .site-footer .socials {
    justify-content: center;
  }

  .site-footer .footer-links {
    align-items: center;
  }

  .site-footer .footer-links a {
    justify-content: center;
    text-align: center;
  }

  .site-footer .newsletter {
    max-width: 320px;
    margin-inline: auto;
  }

  .site-footer .footer-bottom {
    text-align: center;
  }
}

@media (max-width: 390px) {
  .stats-grid .stat {
    min-height: 90px;
  }

  .featured-program-grid.mobile-carousel-ready .featured-program-media img {
    height: 170px;
  }

  .grid-4.mobile-carousel-ready .mentor-card img {
    height: 136px;
  }

  .site-footer .footer-grid {
    gap: 16px 10px !important;
  }
}

/* ==========================================================
   V19 MOBILE CARD HEIGHT + SLIDER ALIGNMENT FIX
   Desktop remains untouched.
   ========================================================== */
@media (max-width: 780px) {
  /* Prevent carousel items from being stretched to the tallest card */
  .mobile-carousel-ready {
    grid-template-columns: none !important;
    grid-template-rows: auto !important;
    align-items: start !important;
    align-content: start !important;
  }

  .mobile-carousel-ready > * {
    height: auto !important;
    min-height: 0 !important;
    align-self: start !important;
  }

  /* Program cards: content height only, footer follows content */
  .featured-program-grid.mobile-carousel-ready .featured-program-card,
  .featured-program-grid.mobile-carousel-ready .program-card {
    min-height: 0 !important;
    height: auto !important;
  }

  .featured-program-grid.mobile-carousel-ready .featured-program-body {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    height: auto !important;
  }

  .featured-program-grid.mobile-carousel-ready .featured-program-footer {
    margin-top: 12px !important;
  }

  /* Mentor cards: remove tall empty area beneath content */
  .grid-4.mobile-carousel-ready .mentor-card {
    min-height: 0 !important;
    height: auto !important;
    align-self: start !important;
  }

  .grid-4.mobile-carousel-ready .mentor-card .card-body {
    min-height: 0 !important;
    height: auto !important;
  }

  /* Testimonials: one clean card per slide, no overlap/peek */
  .grid-3.mobile-carousel-ready {
    column-gap: 14px !important;
    row-gap: 0 !important;
  }

  .grid-3.mobile-carousel-ready .quote-card {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    align-self: start !important;
    box-sizing: border-box;
  }

  .grid-3.mobile-carousel-ready .quote-card p {
    min-height: 0 !important;
    height: auto !important;
  }
}


/* ==========================================================
   V21 MOBILE FOOTER 3-COLUMN FORCE
   Only mobile footer is affected; desktop remains untouched.
   ========================================================== */
@media (max-width: 780px) {
  .site-footer .footer-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 18px 8px !important;
    text-align: center !important;
  }

  .site-footer .footer-grid > div:first-child {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    text-align: center !important;
  }

  .site-footer .footer-grid > div:nth-child(2) {
    grid-column: 1 / 2 !important;
    grid-row: auto !important;
  }

  .site-footer .footer-grid > div:nth-child(3) {
    grid-column: 2 / 3 !important;
    grid-row: auto !important;
  }

  .site-footer .footer-grid > div:nth-child(4) {
    grid-column: 3 / 4 !important;
    grid-row: auto !important;
  }

  .site-footer .footer-grid > div:last-child {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    text-align: center !important;
  }

  .site-footer .footer-grid > div:nth-child(2),
  .site-footer .footer-grid > div:nth-child(3),
  .site-footer .footer-grid > div:nth-child(4) {
    min-width: 0 !important;
    text-align: center !important;
  }

  .site-footer .footer-grid h4 {
    text-align: center !important;
    font-size: 11px !important;
    margin-bottom: 10px !important;
  }

  .site-footer .footer-links {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 7px !important;
  }

  .site-footer .footer-links a {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    font-size: 9.5px !important;
    line-height: 1.35 !important;
    white-space: normal !important;
  }
}

@media (max-width: 390px) {
  .site-footer .footer-grid {
    gap: 16px 6px !important;
  }

  .site-footer .footer-grid h4 {
    font-size: 10.5px !important;
  }

  .site-footer .footer-links a {
    font-size: 9px !important;
  }
}
