/* Madbax Home — Material Design 3
 * Spec: docs/madbax-home-design.md + .cursor/rules/madbax-m3-design.mdc
 * Fonts: Inter Tight (brand) + Inter (plain) — same pairing as mini app
 * NOT EZ-shop — standalone package
 */

/* Awwwards Academy scale: Inter Tight 300–600 (hierarchy via size/weight) */
@import url("https://fonts.googleapis.com/css2?family=Inter+Tight:wght@300;400;500;600&family=Inter:wght@300;400;500;600&display=swap");

.mbx-home {
  --md-sys-color-primary: #00e599;
  --md-sys-color-on-primary: #0a0a0a;
  --md-sys-color-surface: #f2f2f2;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-high: #e8e8eb;
  --md-sys-color-surface-container-highest: #e2e2e6;
  --md-sys-color-secondary-container: #c8f5e4;
  --md-sys-color-on-secondary-container: #003826;
  --md-sys-color-on-surface: #17191a;
  --md-sys-color-on-surface-variant: #5c6570;
  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #c7c5d0;

  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 999px;

  --md-sys-state-hover: 0.08;
  --md-sys-state-pressed: 0.12;
  --md-sys-state-focus: 0.12;
  --md-sys-motion: 150ms cubic-bezier(0.2, 0, 0, 1);

  --md-sys-typescale-brand: "Inter Tight", system-ui, sans-serif;
  --md-sys-typescale-plain: Inter, system-ui, sans-serif;

  --mbx-card-title: var(--md-sys-color-on-surface);
  --mbx-card-cat: var(--md-sys-color-on-surface-variant);
  --mbx-card-date: #8b939c;
  --mbx-card-bg: transparent;
  --mbx-card-border: transparent;
  --mbx-grid-cols: 3;
  --mbx-grid-gap: 28px;

  color: var(--md-sys-color-on-surface);
  font-family: var(--md-sys-typescale-plain);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

.mbx-home *,
.mbx-home *::before,
.mbx-home *::after {
  box-sizing: border-box;
}

/* —— Type helpers —— */
.mbx-home-hero__eyebrow {
  margin: 0 0 4px;
  font-family: var(--md-sys-typescale-plain);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.5px;
  color: var(--md-sys-color-on-surface-variant);
}

.mbx-home-hero__title {
  margin: 0 !important;
  font-family: var(--md-sys-typescale-brand) !important;
  font-size: 28px !important;
  font-weight: 600 !important;
  line-height: 36px !important;
  letter-spacing: 0 !important;
  color: var(--md-sys-color-on-surface) !important;
}

.mbx-home-hero__support {
  margin: 0;
  max-width: 36em;
  font-family: var(--md-sys-typescale-plain);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  letter-spacing: 0.5px;
  color: var(--md-sys-color-on-surface-variant);
}

.mbx-home-hero__steps {
  margin: 8px 0 0;
  font-family: var(--md-sys-typescale-plain);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  letter-spacing: 0.4px;
  color: var(--md-sys-color-on-surface-variant);
}

/* —— Hero block —— */
.mbx-home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 0 8px;
  max-width: 640px;
  margin-inline: auto;
  width: 100%;
}

.mbx-home-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

/* —— M3 search bar —— */
.mbx-home-hero__eyebrow,
.mbx-home-hero__title,
.mbx-home-hero__support,
.mbx-home-hero__steps {
  text-align: center;
}

.mbx-home-search {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  margin-top: 8px;
  height: 56px;
  min-height: 56px;
  padding: 0 16px;
  gap: 16px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container-highest);
  border: 0;
  box-shadow: none;
  cursor: text;
}

.mbx-home-search__icon {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  background-color: var(--md-sys-color-on-surface);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5Zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14Z'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5Zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14Z'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
}

.mbx-home-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  font-family: var(--md-sys-typescale-plain);
  font-size: 16px !important;
  font-weight: 400 !important;
  line-height: 24px !important;
  letter-spacing: 0.5px;
  color: var(--md-sys-color-on-surface) !important;
  -webkit-appearance: none;
  appearance: none;
}

.mbx-home-search__input::placeholder {
  color: var(--md-sys-color-on-surface-variant);
  opacity: 1;
}

.mbx-home-search__input::-webkit-search-decoration,
.mbx-home-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.mbx-home-search:focus-within {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

/* —— Buttons —— */
.mbx-home-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 24px;
  border-radius: var(--md-sys-shape-corner-full);
  font-family: var(--md-sys-typescale-plain);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: 0.1px;
  text-decoration: none !important;
  cursor: pointer;
  border: 0;
  box-shadow: none;
  transition: background-color var(--md-sys-motion), color var(--md-sys-motion), border-color var(--md-sys-motion);
}

.mbx-home-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--md-sys-motion);
}

.mbx-home-btn:hover::before {
  opacity: var(--md-sys-state-hover);
}

.mbx-home-btn:active::before {
  opacity: var(--md-sys-state-pressed);
}

.mbx-home-btn:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.mbx-home-btn--filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary) !important;
}

.mbx-home-btn--outlined {
  background: transparent;
  color: var(--md-sys-color-primary) !important;
  border: 1px solid var(--md-sys-color-outline);
}

/* —— Filter chips —— */
.mbx-home-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  justify-content: center;
}

.mbx-home-chip {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  min-height: 32px;
  padding: 0 16px;
  border-radius: var(--md-sys-shape-corner-small);
  border: 1px solid var(--md-sys-color-outline);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant) !important;
  font-family: var(--md-sys-typescale-plain);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: 0.1px;
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--md-sys-motion), border-color var(--md-sys-motion), color var(--md-sys-motion), padding var(--md-sys-motion);
}

.mbx-home-chip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--md-sys-motion);
}

.mbx-home-chip:hover::before {
  opacity: var(--md-sys-state-hover);
}

.mbx-home-chip:active::before {
  opacity: var(--md-sys-state-pressed);
}

.mbx-home-chip:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.mbx-home-chip__check {
  display: none;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
}

.mbx-home-chip.is-selected,
.mbx-home-chip[aria-current="true"] {
  background: var(--md-sys-color-secondary-container);
  border-width: 0;
  padding-left: 8px;
  padding-right: 16px;
  color: var(--md-sys-color-on-secondary-container) !important;
}

.mbx-home-chip.is-selected .mbx-home-chip__check,
.mbx-home-chip[aria-current="true"] .mbx-home-chip__check {
  display: block;
}

/* —— Section label row: title + View All —— */
.mbx-home .mbx-home-label-row,
.mbx-home-label-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  width: 100% !important;
  max-width: 100% !important;
}

.mbx-home .mbx-home-label,
.mbx-home-label {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #17191a !important;
  -webkit-text-fill-color: #17191a !important;
  font-family: var(--md-sys-typescale-brand) !important;
  font-size: 22px !important;
  font-weight: 600 !important;
  line-height: 28px !important;
  letter-spacing: -0.01em !important;
  text-decoration: none !important;
  margin: 0 !important;
}

.mbx-home-label:hover {
  color: #17191a !important;
  -webkit-text-fill-color: #17191a !important;
}

.mbx-home .mbx-home-view-all,
.mbx-home-view-all {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  margin-left: auto !important;
  min-height: 40px !important;
  padding: 0 8px !important;
  border-radius: var(--md-sys-shape-corner-full) !important;
  font-family: var(--md-sys-typescale-plain) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 20px !important;
  letter-spacing: 0.1px !important;
  color: #5c6570 !important;
  -webkit-text-fill-color: #5c6570 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  background: transparent !important;
  box-shadow: none !important;
}

.mbx-home-view-all:hover,
.mbx-home-view-all:focus-visible {
  color: #00a86b !important;
  -webkit-text-fill-color: #00a86b !important;
  background: color-mix(in srgb, #00e599 12%, transparent) !important;
}

.mbx-home-view-all:focus-visible {
  outline: 2px solid var(--md-sys-color-primary) !important;
  outline-offset: 2px !important;
}

/* —— Card: Academy flush — rounded media, text below, no boxed chrome ——
 * Photos: 16:10 cover as-is (no zoom crop, no hover dim on media).
 */
.mbx-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--mbx-card-bg);
  border: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.mbx-card__media {
  position: relative;
  display: block;
  width: 100%;
  height: 0;
  padding-bottom: 62.5%; /* 16:10 — explicit box so img % height resolves */
  overflow: hidden;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-high);
}

.mbx-card__media img {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  object-fit: cover !important;
  object-position: center center !important;
  display: block !important;
  transform: none !important;
  inset: 0 !important;
}

.mbx-card__media:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.mbx-card__vip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-family: var(--md-sys-typescale-plain);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.4px;
}

.mbx-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 2px 0;
  flex: 1 1 auto;
  min-height: 0;
  background: transparent;
}

.mbx-card a.mbx-card__cat,
.mbx-card .mbx-card__cat {
  margin: 0 !important;
  padding: 0 !important;
  font-family: var(--md-sys-typescale-plain) !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 16px !important;
  letter-spacing: 0.2px !important;
  color: var(--mbx-card-cat) !important;
  text-decoration: none !important;
  width: fit-content;
  background: transparent !important;
  border: 0 !important;
}

.mbx-card a.mbx-card__cat:hover {
  color: var(--mbx-card-title) !important;
}

.mbx-card .mbx-card__title {
  margin: 0 !important;
  min-height: 0;
  max-height: none;
  font-family: var(--md-sys-typescale-brand) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 20px !important;
  letter-spacing: -0.01em !important;
  color: var(--mbx-card-title) !important;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.mbx-card .mbx-card__title a {
  color: inherit !important;
  text-decoration: none !important;
  background: transparent !important;
}

.mbx-card .mbx-card__title a:hover {
  text-decoration: underline !important;
  text-underline-offset: 2px;
}

.mbx-card .mbx-card__date {
  margin: 0 !important;
  font-family: var(--md-sys-typescale-plain) !important;
  font-size: 12px !important;
  font-weight: 300 !important;
  line-height: 16px !important;
  letter-spacing: 0.2px !important;
  color: var(--mbx-card-date) !important;
}

/* —— Course grid —— */
.mbx-home-grid {
  width: 100%;
}

.mbx-home-grid__list {
  display: grid;
  grid-template-columns: repeat(var(--mbx-grid-cols), minmax(0, 1fr));
  gap: var(--mbx-grid-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.mbx-home-grid__nav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.mbx-home-grid__btn {
  position: relative;
  overflow: hidden;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-lowest);
  color: #5c6570 !important;
  -webkit-text-fill-color: #5c6570 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
}

.mbx-home-grid__btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--md-sys-motion);
}

.mbx-home-grid__btn:hover {
  color: #17191a !important;
  -webkit-text-fill-color: #17191a !important;
}

.mbx-home-grid__btn:hover::before {
  opacity: var(--md-sys-state-hover);
}

.mbx-home-grid__btn:active::before {
  opacity: var(--md-sys-state-pressed);
}

.mbx-home-grid__btn:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.mbx-home-grid__btn[disabled] {
  opacity: 0.38;
  pointer-events: none;
}

.mbx-home-grid__btn svg {
  position: relative;
  z-index: 1;
  display: block !important;
  width: 24px !important;
  height: 24px !important;
  flex: 0 0 24px;
  fill: currentColor !important;
  stroke: none !important;
  color: inherit !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.mbx-home-grid__btn svg path {
  fill: currentColor !important;
  stroke: none !important;
  opacity: 1 !important;
}

.mbx-home-grid__empty {
  padding: 24px 16px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 14px;
  line-height: 20px;
}

/* —— Homepage Elementor rhythm (page 24241) —— */
.page-id-24241 .elementor-element-e04c0c5,
.page-id-24241 .elementor-element-7b3739b {
  max-width: 1120px !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 24px !important;
  padding-right: 24px !important;
  box-sizing: border-box !important;
}

.page-id-24241 .elementor-location-single,
.page-id-24241 .site-content,
.page-id-24241 .elementor-24241 {
  background: #f2f2f2;
}

.page-id-24241 .elementor-widget-madbax-home-hero {
  margin-bottom: 28px !important;
}

.page-id-24241 .elementor-widget-madbax-home-chips {
  margin-bottom: 12px !important;
}

.page-id-24241 .elementor-widget-madbax-home-label {
  margin-top: 48px !important;
  margin-bottom: 16px !important;
}

.page-id-24241 .elementor-widget-madbax-home-grid,
.page-id-24241 .elementor-widget-madbax-course-slider {
  margin-bottom: 8px !important;
}

/* Room for slider arrows — do not overlap cards */
.page-id-24241 .mbx-cs {
  padding-left: 48px;
  padding-right: 48px;
}

.page-id-24241 .mbx-cs__nav--prev {
  left: 0;
}

.page-id-24241 .mbx-cs__nav--next {
  right: 0;
}

/* Flush cards — no forced equal text block heights */
.page-id-24241 .mbx-card .mbx-card__title,
.page-id-24241 .mbx-cs .mbx-cs__title {
  min-height: 0 !important;
  max-height: none !important;
}

.page-id-24241 .mbx-card__body,
.page-id-24241 .mbx-cs__body {
  min-height: 0;
}

/* —— Adaptive layout (M3 compact → medium → expanded) ——
 * SUMMARY: mobile margins 16; one primary filled CTA; equal gutters;
 * touch targets ≥48dp for buttons; chips may stay 32dp height.
 */

/* Medium / tablet */
@media (max-width: 1024px) {
  .mbx-home-grid {
    --mbx-grid-cols: 2;
  }

  .page-id-24241 .mbx-cs {
    padding-left: 40px;
    padding-right: 40px;
  }
}

/* Compact phone — override Elementor inline --mbx-grid-cols */
@media (max-width: 599px) {
  .page-id-24241 .elementor-element-e04c0c5,
  .page-id-24241 .elementor-element-7b3739b {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .page-id-24241 .elementor-widget-madbax-home-label {
    margin-top: 28px !important;
    margin-bottom: 12px !important;
  }

  .page-id-24241 .mbx-cs {
    padding-left: 0;
    padding-right: 0;
  }

  .mbx-home-hero {
    gap: 16px;
    max-width: none;
    padding: 0;
  }

  .mbx-home-hero__title {
    font-size: 24px !important;
    line-height: 32px !important;
    font-weight: 600 !important;
  }

  .mbx-home-hero__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
  }

  /* One filled primary per view — full width 48dp */
  .mbx-home-hero__actions .mbx-home-btn--filled {
    width: 100%;
    min-height: 48px;
  }

  /* Secondary = text button (M3), not second fat CTA */
  .mbx-home-hero__actions .mbx-home-btn--outlined {
    width: 100%;
    min-height: 40px;
    border: 0;
    color: var(--md-sys-color-primary) !important;
    background: transparent;
  }

  /* Chip set: horizontal scroll, not crushed wrap */
  .mbx-home-chips {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -16px;
    padding: 4px 16px;
    gap: 8px;
  }

  .mbx-home-chips::-webkit-scrollbar {
    display: none;
  }

  .mbx-home-chip {
    flex: 0 0 auto;
  }

  .mbx-home-label {
    font-size: 18px;
    line-height: 24px;
  }

  .mbx-home-grid {
    --mbx-grid-cols: 1 !important;
    --mbx-grid-gap: 16px;
  }

  .mbx-card__body {
    padding: 10px 2px 0;
    min-height: 0;
    gap: 4px;
  }

  .page-id-24241 .mbx-card .mbx-card__title {
    min-height: 0 !important;
    max-height: none !important;
  }

  .mbx-home-grid__nav {
    margin-top: 12px;
    gap: 8px;
  }

  .mbx-home-grid__btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }
}

/* Large phones / small tablets: 2 columns still readable */
@media (min-width: 600px) and (max-width: 1024px) {
  .mbx-home-grid {
    --mbx-grid-cols: 2 !important;
  }
}
