/* ===== Materia Medica Archive ===== */

.materia-medica-archive {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.mm-header-inner {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mm-title {
    font-size: 2.4rem;
    font-weight: 700;
    margin: 0;
}

/* Search */

.mm-search-form {
    display: flex;
    gap: 0.75rem;
    width: 100%;
  /*  max-width: 640px; */
}

.mm-search-input {
    flex: 1;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    border: 1px solid #d3dde6;
    font-size: 0.95rem;
}

.mm-search-btn {
    border-radius: 999px;
    border: none;
    padding: 0 1.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    background: #1a7ff0;
    color: #fff;
    transition: background 0.2s ease;
}

.mm-search-btn:hover {
    background: #0a66c2;
}

/* Kingdom buttons */

.mm-kingdom-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mm-kingdom-btn {
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
  /*  font-size: 0.8rem; */
    border: 1px solid #d3dde6;
    background: #f5f7fb;
    color: #495469;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mm-kingdom-btn.is-active,
.mm-kingdom-btn:hover {
    background: #1a7ff0;
    color: #fff;
    border-color: #1a7ff0;
}

/* Top slider */

.mm-slider-wrapper {
    position: relative;
    margin-top: 0.5rem;
}

.mm-slider {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scroll-behavior: smooth;
}

.mm-slider::-webkit-scrollbar {
    height: 6px;
}
.mm-slider::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 999px;
}

.mm-slider-item {
    min-width: 240px;
    height: 140px;
    background-size: cover;
    background-position: center;
    border-radius: 14px;
    position: relative;
    flex-shrink: 0;
}

.mm-slider-link {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.mm-slider-link::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

.mm-slider-title {
    position: absolute;
    left: 0;
    bottom: 0;
    padding: 0.6rem 0.9rem;
    font-size: 0.85rem;
    color: #fff;
    font-weight: 600;
}

.mm-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: rgba(255,255,255,0.9);
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 1.1rem;
    z-index: 5;
}

.mm-slider-prev { left: -10px; }
.mm-slider-next { right: -10px; }

/* Letter nav row */

.mm-letter-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 1.5rem;
}

.mm-letter-nav-link {
    min-width: 28px;
    text-align: center;
    padding: 0.25rem 0.6rem;
   /* font-size: 0.75rem; */
    border-radius: 999px;
    border: 1px solid #e1e6ef;
    color: #495469;
    text-decoration: none;
    background: #f8fafc;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.mm-letter-nav-link:hover {
    background: #e6f0ff;
    border-color: #c0d5ff;
}

.mm-letter-nav-link.is-active {
    background: #1a7ff0;
    color: #fff;
    border-color: #1a7ff0;
}

.mm-letter-nav-all {
    margin-left: auto;
}

/* === LETTER GRID (unfiltered) === */

.materia-medica-archive .mm-letter-grid {
    display: grid;
    grid-template-columns: 1fr;   /* mobile */
    gap: 1.5rem;
    margin-top: 2rem;
}

.materia-medica-archive .mm-letter-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(15,23,42,0.05);
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.mm-letter-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.mm-letter-heading {
    font-weight: 700;
    font-size: 0.95rem;
}

.mm-letter-see-more {
  /*  font-size: 0.75rem; */
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    border: 1px solid #d3dde6;
    text-decoration: none;
    color: #495469;
    background: #f4f6fb;
}

.mm-letter-see-more:hover {
    background: #e2ebff;
}

.mm-letter-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mm-letter-remedy-link {
    /* font-size: 0.8rem; */
    text-decoration: none;
    color: #1c365e;
}

.mm-letter-remedy-link:hover {
    text-decoration: underline;
}

.mm-letter-empty {
    margin: 0;
    font-size: 0.8rem;
    color: #9ca3af;
}

/* === FILTERED GRID – remedy cards === */

.mm-filtered-results-wrapper {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mm-filtered-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.mm-filtered-title {
    font-size: 1.3rem;
    margin: 0;
}

.materia-medica-archive .mm-remedy-card-grid {
    display: grid;
    grid-template-columns: 1fr;   /* mobile */
    gap: 1.5rem;
    margin-top: 2rem;
}

.mm-remedy-card {
    background: #0f172a;
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: #fff;
    position: relative;
    box-shadow: 0 16px 40px rgba(15,23,42,0.35);
}

/* Card image – shorter height, still uniform */
.materia-medica-archive .mm-remedy-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 3;      /* shorter than portrait */
    max-height: 210px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.mm-remedy-card-title-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.7rem 0.9rem 0.9rem;
    background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
}

.mm-remedy-card-title-text {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
}

/* Card body */

.mm-remedy-card-body {
    padding: 0.9rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.mm-remedy-short-name {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    opacity: 0.8;
    color:#ffffff;
}

.mm-remedy-common-names {
    font-size: 0.8rem;
    opacity: 0.85;
}

.mm-remedy-essence-box {
    margin-top: 0.3rem;
    padding: 0.6rem 0.7rem;
    background: #ffffff;
    color: #111827;
    border-radius: 12px;
    font-size: 0.78rem;
    line-height: 1.4;
    max-height: 10rem;
    overflow: hidden;
}

.mm-remedy-open-btn {
    margin-top: 0.7rem;
    align-self: flex-start;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #f9fafb;
    color: #0f172a;
    background: #f9fafb;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.mm-remedy-open-btn:hover {
    background: #ffffff;
    color: #020617;
    box-shadow: 0 8px 24px rgba(15,23,42,0.4);
    transform: translateY(-1px);
}

.mm-no-results {
    margin: 0;
    font-size: 0.95rem;
}

/* Back to top */

.mm-back-to-top {
    margin-top: 1.5rem;
    align-self: flex-end;
    font-size: 0.8rem;
    text-decoration: none;
    color: #1a7ff0;
}

.mm-back-to-top:hover {
    text-decoration: underline;
}

/* Responsive tweaks + column counts */

@media (max-width: 768px) {
    .materia-medica-archive {
        padding: 2rem 1rem 3rem;
    }

    .mm-search-form {
        flex-direction: column;
        max-width: 100%;
    }

    .mm-slider-item {
        min-width: 200px;
        height: 120px;
    }

    .mm-slider-prev {
        left: -4px;
    }

    .mm-slider-next {
        right: -4px;
    }
}

/* ≥ 768px: 2 columns for both grids */
@media (min-width: 768px) {
    .materia-medica-archive .mm-letter-grid,
    .materia-medica-archive .mm-remedy-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* ≥ 1024px: 3 columns for both grids */
@media (min-width: 1024px) {
    .materia-medica-archive .mm-letter-grid,
    .materia-medica-archive .mm-remedy-card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        justify-items: stretch;
    }
}

/* Search layout tweak for autocomplete */

.mm-search-form {
    display: flex;
    gap: 0.75rem;
    width: 100%;
   /* max-width: 640px; */
    position: relative;
}

.mm-search-input-wrapper {
    position: relative;
    flex: 1;
}

.mm-search-input {
    width: 100%;
}

/* Autocomplete dropdown */

.mm-search-suggestions {
    position: absolute;
    z-index: 50;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
    padding: 0.25rem 0;
    max-height: 320px;
    overflow-y: auto;
    display: none;
}

.mm-suggestions-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mm-suggestion-item {
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mm-suggestion-item:hover {
    background: #eff6ff;
}

.mm-suggestion-title {
    font-weight: 600;
    color: #111827;
}

.mm-suggestion-short {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.7;
}

.mm-suggestion-common {
    font-size: 0.8rem;
    color: #4b5563;
}

/* Keep dropdown full-width on mobile as well */
@media (max-width: 768px) {
    .mm-search-form {
        flex-direction: column;
        max-width: 100%;
    }
}