/**
 * Service info pages — website (How It Works / FAQ / Terms tabs, /faq).
 * Components: .mm-svc__* (tabs, panels), .mm-hiw (How It Works, "menu" layout), .mm-faq__* (search + topic
 * filter; questions use the project accordion), .mm-terms__* (numbered clauses). Markup: templates/front/static/service/.
 * The app WebView has its own stylesheet (public/css/webview/webview.css) — nothing here is shared.
 */

.mm-lead-page {
  --svc-green: #378906;
  --svc-deep: #123d0b;
  --svc-wash: #edf5e6;
  --svc-ink: #1a1a1a;
  --svc-muted: #4a5058;
  --svc-line: #e2e6dc;
  --svc-leader: #b9cfb2;
}

/* Per-service accents inside a service panel: dotted leaders and tinted boxes.
   Text stays dark — gold and sage are too light to read as text. */
.mm-svc--rod {
  --svc-leader: #a8d39c;
  --svc-wash: #e9f5e6;
}

.mm-svc--ndn {
  --svc-leader: #f0cc3f;
  --svc-wash: #fff8d6;
}

.mm-svc--sld {
  --svc-leader: #a9cf8f;
  --svc-wash: #f1f8ec;
}

/* ----- Tabs ----- */
.mm-svc__tabs {
  position: relative;
  display: flex;
  gap: 2rem;
  margin: 1.5rem 0 1.75rem;
  border-bottom: 1px solid var(--svc-line);
  overflow-x: auto;
  scrollbar-width: none;
}

.mm-svc__tabs::-webkit-scrollbar {
  display: none;
}

.mm-lead-page .mm-svc__tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  padding: 0.9rem 0 0.85rem;
  color: var(--svc-muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

/* Service colour (--svc-rod/ndn/sld from mm-colors.css, same as the home page service tabs): a dot before
   the name and the active underline. Only lines and dots use it — gold and sage are too light for text. */
.mm-svc__tab--rod {
  --svc-tab-accent: var(--svc-rod);
}

.mm-svc__tab--ndn {
  --svc-tab-accent: var(--svc-ndn);
}

.mm-svc__tab--sld {
  --svc-tab-accent: var(--svc-sld);
  --svc-tab-line: #8dbf6e; /* brand sage is too pale to read as an underline on white */
}

.mm-svc__tab--rod::before,
.mm-svc__tab--ndn::before,
.mm-svc__tab--sld::before {
  content: "";
  flex: 0 0 auto;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--svc-tab-accent);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.mm-svc__tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--svc-tab-line, var(--svc-tab-accent));
  transform: scaleX(0);
  transition: transform 200ms ease;
}

.mm-lead-page .mm-svc__tab[aria-selected="true"] {
  color: var(--svc-deep);
}

.mm-svc__tab[aria-selected="true"]::after {
  transform: scaleX(1);
}

/* "Terms of Use" (not a service) shows no coloured line */
.mm-svc__tab--plain::after {
  display: none;
}

.mm-svc__tab:focus-visible {
  outline: 2px solid var(--svc-green);
  outline-offset: 4px;
  border-radius: 4px;
}

.mm-svc__panel {
  scroll-margin-top: 110px;
}

/* Panels get focus from hash links and Tab; the selected tab already shows where you are */
.mm-svc__panel:focus {
  outline: 0;
}

/* Links to the same service's other pages, under each tab */
.mm-svc__related {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.25rem;
  margin: 1.5rem 0 0;
  font-size: 0.95rem;
}

.mm-svc__related-label {
  color: var(--svc-muted);
  font-weight: 600;
}

.mm-lead-page .mm-svc__related a {
  color: var(--mm-orange);
  font-weight: 700;
  text-underline-offset: 3px;
}

/* ----- How It Works: lead, perks strip, menu-style courses ----- */
.mm-hiw p.mm-hiw__lead {
  font-size: 1.15rem;
}

/* Hairline grid: 1px gaps over the line colour draw the dividers for any column count */
.mm-hiw__perks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin: 1.75rem 0 1.5rem;
  border: 1px solid var(--svc-line);
  border-radius: 14px;
  background: var(--svc-line);
  overflow: hidden;
}

.mm-hiw__perk {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.1rem 1.15rem;
  background: #fff;
}

.mm-hiw__perk img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.mm-hiw__perk span {
  color: var(--svc-ink);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}

.mm-hiw__menu {
  margin: 0 0 1.75rem;
}

.mm-hiw__course {
  padding: 1.15rem 0 0.35rem;
}

/* Course name with a dotted leader, like a line on a restaurant menu */
.mm-lead-page .mm-hiw__course-name {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin: 0 0 0.45rem;
  color: var(--svc-ink);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.3;
}

.mm-lead-page .mm-hiw__course-name::after {
  content: "";
  flex: 1 1 2rem;
  min-width: 2rem;
  margin-bottom: 0.38em;
  border-bottom: 2px dotted var(--svc-leader);
}

.mm-hiw__course p {
  margin: 0;
}

.mm-hiw p.mm-hiw__next {
  margin: 0;
  padding: 1.1rem 1.25rem;
  border-radius: 14px;
  background: var(--svc-wash);
  color: var(--svc-ink);
}

/* ----- FAQ: search + topic filter (questions use the project accordion, .accordionFAQ) ----- */
.mm-faq__tools {
  display: grid;
  gap: 0.9rem;
  margin: 0 0 1.75rem;
}

/* Topic filter pills (oval); the selected one is filled orange */
.mm-faq__filters {
  gap: 0.4rem;
}

.mm-faq__filters .nav-link {
  padding: 0.25rem 0.75rem;
  border: 1px solid #d9d4cc;
  border-radius: 999px;
  background: #fff;
  color: var(--mm-text);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.mm-faq__filters .nav-link.active {
  border-color: var(--mm-orange);
  background: var(--mm-orange);
  color: #fff;
}

/* Project accordion (.accordionFAQ) with white cards and a "+" that turns into "×" when open */
.mm-lead-page .accordionFAQ--plus .accordion-button,
.mm-lead-page .accordionFAQ--plus .accordion-button:not(.collapsed) {
  background: #fff !important;
  color: var(--svc-ink) !important;
}

.mm-lead-page .accordionFAQ--plus .accordion-button::after {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #edf5e6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23378906' stroke-width='2.4' stroke-linecap='round' viewBox='0 0 12 12'%3E%3Cpath d='M6 1v10M1 6h10'/%3E%3C/svg%3E") no-repeat center / 12px;
}

.mm-lead-page .accordionFAQ--plus .accordion-button:not(.collapsed)::after {
  transform: rotate(45deg);
}

/* Answer follows the question directly (no extra gap under an open question) */
.mm-lead-page .accordionFAQ--plus .accordion-button:not(.collapsed) {
  padding-bottom: 0.5rem;
}

.mm-lead-page .accordionFAQ--plus .accordion-body {
  padding: 0 1.25rem 1rem; /* same side padding as the question, so the text lines up */
}

.mm-faq__group {
  margin: 0 0 1.5rem;
  scroll-margin-top: 110px;
}

.mm-lead-page .mm-faq__group-title {
  margin: 0 0 0.75rem;
  color: var(--svc-ink);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.3;
}

/* ----- Terms: numbered clauses ----- */
.mm-lead-page .mm-terms__intro {
  margin: 0 0 1.25rem;
  color: var(--svc-ink);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
}

.mm-terms__list {
  counter-reset: mm-term;
  border-top: 1px solid var(--svc-line);
}

.mm-terms__item {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  column-gap: 0.75rem;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--svc-line);
  counter-increment: mm-term;
}

.mm-terms__item::before {
  content: counter(mm-term);
  grid-row: 1 / span 2;
  color: var(--svc-ink);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  padding-top: 0.05rem;
}

.mm-lead-page .mm-terms__title {
  margin: 0 0 0.4rem;
  color: var(--svc-ink);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
}

.mm-lead-page .mm-terms__body {
  margin: 0;
  color: var(--svc-muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.mm-terms__body a,
.mm-terms__ack a,
.mm-terms__note a {
  color: var(--mm-orange);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.mm-lead-page .mm-terms__ack {
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: var(--svc-wash);
  color: var(--svc-ink);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.55;
}

.mm-lead-page .mm-terms__note {
  margin: 0.9rem 0 0;
  color: var(--svc-muted);
  font-size: 0.9rem;
}

/* ----- /faq page: general block + service switch ----- */
.mm-faq-page__section + .mm-faq-page__section {
  margin-top: 2.5rem;
}

.mm-lead-page .mm-faq-page__heading {
  margin: 0 0 0.35rem;
  color: var(--svc-ink);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.3;
}

.mm-lead-page .mm-faq-page__sub {
  margin: 0 0 1rem;
  color: var(--svc-muted);
  font-size: 0.95rem;
}

.mm-faq-page .mm-svc__tabs {
  margin-top: 0.5rem;
}

@media (max-width: 575.98px) {
  .mm-svc__tabs {
    gap: 1.35rem;
    margin: 1rem 0 1.25rem;
  }

  .mm-lead-page .mm-svc__tab {
    font-size: 0.95rem;
  }

  .mm-hiw p.mm-hiw__lead {
    font-size: 1.08rem;
  }

  .mm-hiw__perks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Three items (NDN, SLD): one row of three instead of 2 + 1 */
  .mm-hiw__perks:has(> .mm-hiw__perk:nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mm-hiw__perk {
    align-items: center;
    padding: 0.9rem 0.5rem;
    text-align: center;
  }

  .mm-hiw__perk span {
    font-size: 0.8rem;
  }

  .mm-lead-page .mm-hiw__course-name {
    font-size: 1.05rem;
  }

  .mm-terms__item {
    grid-template-columns: 2rem minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mm-svc__tab::after {
    transition: none;
  }
}
