/*
 * Front page hub: sections of cards rendered by local_enterhome.
 * Loaded only when the new layout is switched on, on top of neuro.css.
 * Palette variables come from neuro.css.
 */

/* ============================================================
   1. Hide what the hub replaces
   The old hand-written summary stays in Moodle untouched — it is
   only hidden while the new layout is on, so switching the layout
   off brings the previous page back exactly as it was.
   ============================================================ */

body#page-site-index #region-main-box,
body#page-site-index .sitetopic,
body#page-site-index .course-content {
  display: none !important;
}

body#page-site-index #page-content {
  margin-bottom: 0;
}

/* ============================================================
   2. Hub shell
   ============================================================ */

body#page-site-index .eh-hub {
  max-width: 1180px;
  margin: 0 auto;
  padding: 4px 16px 64px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ============================================================
   3. Quick sign-in strip
   ============================================================ */

body#page-site-index .eh-quick {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px 20px;
  margin-bottom: 40px;
  border-radius: var(--neu-radius-lg);
  background: linear-gradient(145deg, var(--neu-bg-primary), var(--neu-bg-secondary));
  box-shadow:
    8px 8px 16px var(--neu-shadow-dark),
    -8px -8px 16px var(--neu-shadow-light);
}

body#page-site-index .eh-quick__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--neu-text-muted);
  margin-right: 2px;
}

body#page-site-index .eh-quick__chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--neu-text);
  background: linear-gradient(145deg, var(--neu-bg-secondary), var(--neu-bg-primary));
  box-shadow:
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

body#page-site-index .eh-quick__chip svg {
  color: var(--neu-primary);
  flex: 0 0 auto;
}

body#page-site-index .eh-quick__btn {
  margin-left: auto;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(145deg, var(--neu-primary-soft), var(--neu-primary));
  box-shadow: 5px 5px 12px var(--neu-shadow-dark);
  transition: transform var(--neu-t-fast), box-shadow var(--neu-t-fast);
}

body#page-site-index .eh-quick__btn:hover {
  transform: translateY(-2px);
  color: #fff;
  text-decoration: none;
}

body#page-site-index .eh-quick__btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 3px 3px 6px rgba(0, 0, 0, 0.25),
    inset -2px -2px 5px rgba(255, 255, 255, 0.15);
}

/* ============================================================
   4. Section heading
   Replaces the full-width purple banners: a raised mark, the
   title, and a soft rule that carries the eye across the row.
   ============================================================ */

body#page-site-index .eh-section {
  margin-bottom: 52px;
}

body#page-site-index .eh-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

/* Recessed rather than raised: in this language a raised tile reads as
   something to press, and this mark is purely decorative. */
body#page-site-index .eh-head__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  color: var(--neu-primary);
  background: linear-gradient(145deg, var(--neu-bg-secondary), var(--neu-bg-primary));
  box-shadow:
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

body#page-site-index .eh-head__title {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--neu-text-strong);
  white-space: nowrap;
}

body#page-site-index .eh-head__rule {
  flex: 1 1 auto;
  height: 3px;
  border-radius: 2px;
  box-shadow:
    inset 0 2px 3px var(--neu-shadow-dark),
    inset 0 -1px 2px var(--neu-shadow-light);
}

/* ============================================================
   5. Card grid
   ============================================================ */

body#page-site-index .eh-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
}

body#page-site-index .eh-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  border-radius: var(--neu-radius-lg);
  background: linear-gradient(145deg, var(--neu-bg-primary), var(--neu-bg-secondary));
  box-shadow:
    8px 8px 16px var(--neu-shadow-dark),
    -8px -8px 16px var(--neu-shadow-light);
  transition: transform var(--neu-t-normal), box-shadow var(--neu-t-normal);
}

body#page-site-index .eh-card:hover,
body#page-site-index .eh-card:focus-visible {
  transform: translateY(-4px);
  text-decoration: none;
  color: inherit;
  box-shadow:
    12px 12px 24px var(--neu-shadow-dark),
    -12px -12px 24px var(--neu-shadow-light);
}

body#page-site-index .eh-card__media {
  padding: 14px 14px 0;
}

body#page-site-index .eh-card__media img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--neu-radius-md);
}

body#page-site-index .eh-card__body {
  padding: 16px 20px 22px;
}

/* A card without a cover fills the row height next to its neighbours,
   so its content sits centred rather than stranded at the top. */
body#page-site-index .eh-card__body--plain {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px 20px;
}

body#page-site-index .eh-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 12px;
  color: var(--neu-primary);
  background: linear-gradient(145deg, var(--neu-bg-secondary), var(--neu-bg-primary));
  box-shadow:
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

body#page-site-index .eh-card__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.32;
  color: var(--neu-text-strong);
}

body#page-site-index .eh-card__sub {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--neu-text-muted);
}

/* ============================================================
   5b. Rich cards: video, note, fold-out panel, buttons
   A card stops being one big link as soon as it owns controls,
   so the title carries the link instead.
   ============================================================ */

/* Subtitle sitting beside the title: same size and colour as when it is
   on its own line, just not bold and not on a line of its own. */
body#page-site-index .eh-card__inline {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--neu-text-muted);
  white-space: nowrap;
}

@media (max-width: 991.98px) {
  body#page-site-index .eh-card__inline {
    white-space: normal;
  }
}

body#page-site-index .eh-card--rich .eh-card__title a {
  color: var(--neu-text-strong);
  text-decoration: none;
}

body#page-site-index .eh-card--rich .eh-card__title a:hover {
  color: var(--neu-primary);
}

body#page-site-index .eh-card--wide {
  grid-column: span 2;
}

body#page-site-index .eh-video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--neu-radius-md);
  background: #000;
}

body#page-site-index .eh-card__note {
  margin: 12px 0 0;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--neu-text);
  border-radius: var(--neu-radius-sm);
  background: linear-gradient(145deg, var(--neu-bg-secondary), var(--neu-bg-primary));
  box-shadow:
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

body#page-site-index .eh-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--neu-text);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(145deg, var(--neu-bg-primary), var(--neu-bg-secondary));
  box-shadow:
    4px 4px 8px var(--neu-shadow-dark),
    -4px -4px 8px var(--neu-shadow-light);
  transition: transform var(--neu-t-fast);
}

body#page-site-index .eh-more:hover {
  transform: translateY(-1px);
}

body#page-site-index .eh-more svg {
  transition: transform var(--neu-t-normal);
}

body#page-site-index .eh-more[aria-expanded="true"] {
  box-shadow:
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

body#page-site-index .eh-more[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

body#page-site-index .eh-panel {
  margin-top: 12px;
}

body#page-site-index .eh-panel ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

body#page-site-index .eh-panel li {
  position: relative;
  margin: 0 0 8px;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--neu-text-muted);
}

body#page-site-index .eh-panel li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neu-primary);
}

body#page-site-index .eh-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

body#page-site-index .eh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  color: var(--neu-text);
  background: linear-gradient(145deg, var(--neu-bg-primary), var(--neu-bg-secondary));
  box-shadow:
    5px 5px 10px var(--neu-shadow-dark),
    -5px -5px 10px var(--neu-shadow-light);
  transition: transform var(--neu-t-fast), box-shadow var(--neu-t-fast), color var(--neu-t-fast);
}

body#page-site-index .eh-btn:hover {
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--neu-text);
}

body#page-site-index .eh-btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

body#page-site-index .eh-btn--primary,
body#page-site-index .eh-btn--primary:hover {
  color: #fff;
  background: linear-gradient(145deg, var(--neu-primary-soft), var(--neu-primary));
  box-shadow: 5px 5px 12px var(--neu-shadow-dark);
}

/* Locked until the video has been watched: still visible, clearly not ready. */
body#page-site-index .eh-btn--locked {
  color: var(--neu-text-muted);
  background: linear-gradient(145deg, var(--neu-bg-secondary), var(--neu-bg-primary));
  box-shadow:
    inset 3px 3px 6px var(--neu-shadow-dark),
    inset -3px -3px 6px var(--neu-shadow-light);
}

body#page-site-index .eh-btn--locked:hover {
  transform: none;
  color: var(--neu-text-muted);
}

body#page-site-index .eh-gate-hint {
  padding: 4px 2px;
  font: inherit;
  font-size: 13px;
  color: var(--neu-text-muted);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
}

body#page-site-index .eh-gate-hint:hover {
  color: var(--neu-primary);
}

/* ============================================================
   6. Tablet and phone
   ============================================================ */

@media (max-width: 991.98px) {
  body#page-site-index .eh-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
  }
}

@media (max-width: 639.98px) {
  body#page-site-index .eh-card--wide {
    grid-column: span 1;
  }
}

@media (max-width: 639.98px) {
  body#page-site-index .eh-hub {
    padding: 0 12px 48px;
  }

  body#page-site-index .eh-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  body#page-site-index .eh-section {
    margin-bottom: 38px;
  }

  body#page-site-index .eh-quick {
    padding: 14px 16px;
    margin-bottom: 30px;
    gap: 10px;
  }

  /* On a phone the button carries the action, so it takes the full
     width instead of hanging off the end of a wrapped row. */
  body#page-site-index .eh-quick__btn {
    margin-left: 0;
    width: 100%;
    text-align: center;
    padding: 13px 22px;
  }

  body#page-site-index .eh-head__title {
    font-size: 19px;
    white-space: normal;
  }

  body#page-site-index .eh-head__rule {
    display: none;
  }

  body#page-site-index .eh-card__title {
    font-size: 16px;
  }
}
