.img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.img-card {
    display: flex;
    flex-direction: column;
    background: #f6e7d0;
    border: 1px solid #e5d7c3;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(74, 46, 20, 0.12);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.img-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(74, 46, 20, 0.18);
}

.img-card__media img {
    width: 100%;
    height: auto;
    display: block;
}

.img-card__body {
    padding: 18px 20px 20px;
    color: #4a2e14;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.img-card__title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: #4a2e14;
}

.img-card__title a {
    color: inherit;
    text-decoration: none;
}

.img-card__title a:hover,
.img-card__title a:focus {
    text-decoration: underline;
}

.img-card__meta {
    font-size: 0.9rem;
    color: rgba(74, 46, 20, 0.8);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.img-card__excerpt {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #4a2e14;
    margin: 0;
}

.img-card__excerpt:empty {
    display: none !important;
}

.mh-excerpt:empty{display:none!important;}
.mh-excerpt .mh-excerpt:empty{display:none!important;}

.img-card__actions {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.mhg-course-student-link {
    font-size: 0.85rem;
    margin-bottom: 8px;
    flex-basis: 100%;
}

.mhg-course-student-link a {
    color: inherit;
    text-decoration: none;
}

.mhg-course-student-link a:hover,
.mhg-course-student-link a:focus {
    text-decoration: underline;
}

.img-card__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid #4a2e14;
    color: #4a2e14;
    background: #e5d7c3;
    font-weight: 600;
    text-decoration: none;
}

.img-card__button:hover,
.img-card__button:focus {
    background: #4a2e14;
    color: #f6e7d0;
}

.img-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e5d7c3;
    color: #4a2e14;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
}

.img-pill:hover,
.img-pill:focus {
    background: #4a2e14;
    color: #f6e7d0;
}

.img-archive-search {
    margin: 0 0 20px 0;
    padding: 0 16px;
}

.img-archive-search__input {
    width: 100%;
    max-width: 420px;
    padding: 10px 14px;
    font-size: 15px;
    line-height: 1.4;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    background: #fff;
    color: #222;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.img-archive-search__input::placeholder {
    color: rgba(0, 0, 0, 0.45);
}

.img-archive-search__input:focus {
    outline: none;
    border-color: #BA8225;
    box-shadow: 0 0 0 2px rgba(186, 130, 37, 0.15);
}

@media (min-width: 900px) {
    /* // Option 1: prevent oversized cards when few items */
    .img-grid {
        justify-content: center;
        grid-template-columns: repeat(auto-fit, minmax(280px, 420px));
    }

    .img-grid .img-card {
        width: 100%;
        max-width: 420px;
    }
}

@media (max-width: 480px) {
    .img-archive-search {
        padding: 0 12px;
    }

    .img-archive-search__input {
        max-width: 100%;
    }
}

/* Shortcode archive alignment with student archive pages */
.img-my-courses.cours-archive {
    padding-inline: 16px;
}

.img-my-courses.cours-archive .img-archive-search__input {
    width: 100%;
    max-width: 420px;
    padding: 10px 14px;
    font-size: 15px;
    line-height: 1.4;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    background: #fff;
    color: #222;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.img-my-courses.cours-archive .img-archive-search__input::placeholder {
    color: rgba(0, 0, 0, 0.45);
}

.img-my-courses.cours-archive .img-archive-search__input:focus {
    outline: none;
    border-color: #BA8225;
    box-shadow: 0 0 0 2px rgba(186, 130, 37, 0.15);
}

.img-my-courses.cours-archive .mh-excerpt,
.img-my-courses.cours-archive p {
    margin: 0;
}

.img-my-courses.cours-archive .img-card__media {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.img-my-courses.cours-archive .img-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Admin-only student link: force it to bottom of card, full width row --- */
.img-card {
  position: relative;
}

/* Keep actions layout but allow pushing the student line to the end */
.img-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Put the student link as the LAST row inside actions */
.img-card__actions .mhg-course-student-link {
  order: 99;            /* force last in flex order */
  flex-basis: 100%;     /* full row */
  width: 100%;
  margin: 10px 0 0;     /* spacing above (not below) */
  font-size: 0.85rem;
}

/* Optional: make it visually quieter */
.img-card__actions .mhg-course-student-link a {
  opacity: 0.85;
}

/* Page 49007 only: stack action/footer items vertically on all students courses list */
body.page-id-49007 .img-my-courses.cours-archive .img-card__actions {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 10px !important;
}

body.page-id-49007 .img-my-courses.cours-archive .img-card__actions > * {
  width: 100%;
}

body.page-id-49007 .img-my-courses.cours-archive a.img-card__button {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

body.page-id-49007 .img-my-courses.cours-archive .img-course-status-readonly,
body.page-id-49007 .img-my-courses.cours-archive .img-course-status-teacher-toggle {
  display: block;
  width: 100%;
}
