/* =====================================================================================================================
   Home section 3: events (partials/home_events.html)
   UPCOMING: light band; heading and links on the left, stacked date cards on the right (QMUL-style).
   PAST: heading with a rule, three soft cards with a monospaced kicker and an arrow (Google-events style).
   ================================================================================================================== */
.he-up, .he-past {
  --he-ink: #0b3a26;
  --he-text: #2b3530;
  --he-soft: #56605a;
  --he-green: #148154;
  --he-blue: #2c85b7;
  --he-band: #f3f6f4;
  --he-pcard: #e5ede8;
  --he-pcard-hover: #d9e5de;
  --he-display: "Lato", "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --he-body: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --he-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-family: var(--he-body);
}
/* The site-wide stylesheet sets `* { font-family: Poppins }`. This zero-specificity reset lets everything in these
   sections inherit the section font instead; any class below that sets a font still wins. */
:where(.he-up, .he-past) * { font-family: inherit; }
.he-shell { width: min(1280px, calc(100% - 56px)); margin-inline: auto; }
.he-up .sr-only, .he-past .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- upcoming ---------------- */
.he-up { background: var(--he-band); padding: clamp(56px, 7vw, 104px) 0; }
.he-up__grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.he-up__title { margin: 0; font-family: var(--he-display); font-weight: 700; font-size: clamp(2.1rem, 1.5rem + 2vw, 3.25rem); line-height: 1.08; letter-spacing: -0.01em; color: var(--he-ink); }
.he-links { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; gap: 0.9rem; }
.he-links a { display: inline-flex; align-items: center; gap: 0.75rem; font-size: 1.125rem; font-weight: 500; color: var(--he-ink); text-decoration: none; }
.he-links svg { flex: none; color: var(--he-green); transition: transform 0.2s ease; }
.he-links a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.he-links a:hover svg { transform: translateX(4px); }

.he-up__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.he-card {
  position: relative; display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) auto; align-items: center; gap: 0 1.75rem;
  padding: 1.75rem 2rem 1.75rem 1.75rem; background: #ffffff;
  box-shadow: 0 1px 2px rgba(11, 58, 38, 0.06), 0 14px 34px -14px rgba(11, 58, 38, 0.22);
}
.he-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, var(--he-green), var(--he-blue)); }
.he-card__date { display: grid; justify-items: start; line-height: 1; color: var(--he-ink); }
.he-card__day { font-family: var(--he-display); font-weight: 900; font-size: clamp(3.25rem, 2.4rem + 2.6vw, 4.5rem); letter-spacing: -0.02em; }
.he-card__month { margin-top: 0.35rem; font-family: var(--he-display); font-weight: 700; font-size: 1rem; letter-spacing: 0.08em; text-transform: uppercase; }
.he-card__body { min-width: 0; }
.he-card__title { margin: 0; font-family: var(--he-body); font-weight: 500; font-size: 1.15rem; line-height: 1.35; color: var(--he-text); text-wrap: pretty; }
.he-card__time { margin: 0.6rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; font-size: 1rem; font-weight: 600; color: var(--he-green); }
.he-card__place { font-weight: 500; color: var(--he-soft); }
.he-flag { display: inline-flex; align-items: center; height: 1.4rem; padding: 0 0.55rem; border-radius: 4px; font-size: 0.75rem; font-weight: 700; background: #e3f3ea; color: #0f6843; }
.he-flag--warn { background: #fdf1d8; color: #8a5a00; }
.he-card__more { display: inline-flex; align-items: center; gap: 0.4rem; justify-self: end; font-family: var(--he-display); font-size: 1.125rem; font-weight: 700; color: var(--he-ink); text-decoration: none; white-space: nowrap; }
.he-card__more::after { content: ""; position: absolute; inset: 0; }   /* the whole card opens the event */
.he-card__more svg { transition: transform 0.2s ease; }
.he-card:hover .he-card__more { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.he-card:hover .he-card__more svg { transform: translateX(4px); }
.he-card__more:focus-visible { outline: none; }
.he-card:has(.he-card__more:focus-visible) { outline: 3px solid var(--he-green); outline-offset: 3px; }
.he-card--empty { grid-template-columns: minmax(0, 1fr) auto; }

/* ---------------- past ---------------- */
.he-past { background: #ffffff; padding: clamp(56px, 7vw, 104px) 0; }
.he-past__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap;
  padding-bottom: 1.5rem; border-bottom: 1px solid #d5ddd8; }
.he-past__title { margin: 0; font-family: var(--he-display); font-weight: 400; font-size: clamp(2rem, 1.5rem + 1.6vw, 2.85rem); line-height: 1.1; color: #18201b; }
.he-past__all { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; font-weight: 600; color: var(--he-green); text-decoration: none; }
.he-past__all:hover { text-decoration: underline; text-underline-offset: 3px; }
.he-past__grid { list-style: none; margin: 1.75rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.he-pcard {
  position: relative; display: flex; flex-direction: column; gap: 1rem; min-height: 13rem;
  padding: 1.25rem 1.25rem 1.4rem; border-radius: 12px; background: var(--he-pcard);
  transition: background-color 0.2s ease;
}
.he-pcard:hover { background: var(--he-pcard-hover); }
.he-pcard__kicker { display: flex; align-items: center; gap: 0.7rem; margin: 0; padding-right: 2rem;
  font-family: var(--he-mono); font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: #1d2621; }
.he-pcard__kicker span { flex: none; width: 0.6rem; height: 0.6rem; background: var(--he-green); }
.he-pcard__arrow { position: absolute; top: 1.2rem; right: 1.2rem; color: var(--he-green); transition: transform 0.2s ease; }
.he-pcard:hover .he-pcard__arrow { transform: translate(2px, -2px); }
.he-pcard__title { margin: 0; font-family: var(--he-body); font-weight: 400; font-size: 1.2rem; line-height: 1.5; color: #2b3530; text-wrap: pretty;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.he-pcard__title a { color: inherit; text-decoration: none; }
.he-pcard__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.he-pcard__title a:focus-visible { outline: none; }
.he-pcard:has(a:focus-visible) { outline: 3px solid var(--he-green); outline-offset: 3px; }
.he-pcard__date { margin: auto 0 0; font-size: 0.85rem; color: var(--he-soft); }

.he-links a:focus-visible, .he-past__all:focus-visible { outline: 3px solid var(--he-green); outline-offset: 3px; border-radius: 2px; }

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) {
  .he-card { grid-template-columns: 7rem minmax(0, 1fr) auto; gap: 0 1.25rem; padding: 1.5rem 1.5rem 1.5rem 1.4rem; }
}
@media (max-width: 900px) {
  .he-up__grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .he-past__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .he-shell { width: calc(100% - 40px); }
  /* as on the QMUL phone layout: date on the left, title, time and "More details" stacked beside it */
  .he-card { grid-template-columns: 5.75rem minmax(0, 1fr); grid-template-rows: auto auto; align-items: start; gap: 0.75rem 1rem; padding: 1.5rem 1.25rem 1.35rem; }
  .he-card__date { grid-row: 1 / span 2; align-self: center; }
  .he-card__day { font-size: 3rem; }
  .he-card__month { font-size: 0.8125rem; }
  .he-card__title { font-size: 1.05rem; }
  .he-card__time { font-size: 0.9rem; margin-top: 0.4rem; }
  .he-card__more { grid-column: 2; justify-self: start; font-size: 1rem; }
  .he-card--empty { grid-template-columns: minmax(0, 1fr); }
  .he-card--empty .he-card__more { grid-column: 1; }
  .he-links a { font-size: 1.05rem; }
  .he-past__grid { grid-template-columns: minmax(0, 1fr); }
  .he-pcard { min-height: 0; }
  .he-pcard__title { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .he-links svg, .he-card__more svg, .he-pcard, .he-pcard__arrow { transition: none; }
}

/* Compact upcoming band: smaller heading, links, date and card. */
.he-up { padding: clamp(40px, 4.5vw, 64px) 0; }
.he-up__title { font-size: clamp(1.75rem, 1.35rem + 1.2vw, 2.4rem); }
.he-links { margin-top: 1.1rem; gap: 0.6rem; }
.he-links a { font-size: 0.975rem; gap: 0.6rem; }
.he-links svg { width: 18px; height: 18px; }
.he-up__list { gap: 0.75rem; }
.he-card { grid-template-columns: 6rem minmax(0, 1fr) auto; gap: 0 1.25rem; padding: 1.2rem 1.5rem 1.2rem 1.35rem; }
.he-card::before { height: 4px; }
.he-card__day { font-size: clamp(2.4rem, 1.9rem + 1.4vw, 3.1rem); }
.he-card__month { margin-top: 0.25rem; font-size: 0.8125rem; }
.he-card__title { font-size: 1rem; line-height: 1.4; }
.he-card__time { margin-top: 0.4rem; font-size: 0.875rem; }
.he-card__more { font-size: 0.975rem; }
.he-card__more svg { width: 17px; height: 17px; }
@media (max-width: 1100px) { .he-card { grid-template-columns: 5.5rem minmax(0, 1fr) auto; padding: 1.1rem 1.25rem; } }
@media (max-width: 640px) {
  .he-card { grid-template-columns: 4.75rem minmax(0, 1fr); padding: 1.15rem 1.1rem; gap: 0.5rem 0.9rem; }
  .he-card__day { font-size: 2.4rem; }
  .he-card__title { font-size: 0.95rem; }
  .he-card__time { font-size: 0.85rem; }
  .he-card__more { font-size: 0.925rem; }
  .he-links a { font-size: 0.95rem; }
}

/* Past events scaled to match the compact upcoming band (same heading size). */
.he-past { padding: clamp(40px, 4.5vw, 64px) 0; }
.he-past__head { padding-bottom: 1.1rem; }
.he-past__title { font-size: clamp(1.75rem, 1.35rem + 1.2vw, 2.4rem); }
.he-past__all { font-size: 0.875rem; }
.he-past__grid { margin-top: 1.25rem; gap: 1rem; }
.he-pcard { min-height: 10.5rem; gap: 0.75rem; padding: 1.1rem 1.1rem 1.15rem; }
.he-pcard__kicker { font-size: 0.75rem; }
.he-pcard__arrow { top: 1.05rem; right: 1.05rem; width: 16px; height: 16px; }
.he-pcard__title { font-size: 1.05rem; line-height: 1.45; }
.he-pcard__date { font-size: 0.8rem; }
@media (max-width: 640px) { .he-pcard { min-height: 0; } .he-pcard__title { font-size: 1rem; } }

/* No upcoming events: a calm note in a white card, a calendar icon, short text and a small square button. */
.he-empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 24px 26px;
  background: #ffffff;
  border: 1px solid #dfe6e1;
  border-left: 3px solid var(--he-green);
  border-radius: 2px;
}
.he-empty__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 2px;
  background: #e8f2ec;
  color: var(--he-green);
}
.he-empty__text h3 {
  margin: 2px 0 0;
  font-family: var(--he-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--he-ink);
}
.he-empty__text p { margin: 6px 0 0; max-width: 40rem; font-size: 14px; line-height: 1.55; color: var(--he-soft); }
.he-empty__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 16px; }
.he-empty__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 2px;
  background: var(--he-green);
  color: #ffffff;
  font-family: var(--he-display);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.18s ease;
}
.he-empty__btn:hover { background: #0f6843; color: #ffffff; }
.he-empty__link { font-family: var(--he-display); font-size: 14px; font-weight: 700; color: var(--he-ink); text-decoration: none; }
.he-empty__link:hover { text-decoration: underline; text-underline-offset: 3px; }
.he-empty__btn:focus-visible, .he-empty__link:focus-visible { outline: 2px solid var(--he-blue); outline-offset: 3px; }
@media (max-width: 640px) {
  .he-empty { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 20px; }
  .he-empty__icon { width: 42px; height: 42px; }
}
html[data-theme="dark"] .he-empty { background: #16221c; border-color: #24352c; border-left-color: #86d5b2; }
html[data-theme="dark"] .he-empty__icon { background: #1d2b24; color: #86d5b2; }
html[data-theme="dark"] .he-empty__text h3, html[data-theme="dark"] .he-empty__link { color: #e8f0ec; }
html[data-theme="dark"] .he-empty__text p { color: #a9bab1; }

/* "Explore all upcoming events" when nothing is scheduled: greyed out and not clickable */
.he-links__off { display: inline-flex; align-items: center; gap: 0.6rem; font-size: 0.975rem; font-weight: 500; color: #9aa6a0; cursor: not-allowed; }
.he-links__off svg { color: #b8c2bd; }
@media (max-width: 640px) { .he-links__off { font-size: 0.95rem; } }
html[data-theme="dark"] .he-links__off, html[data-theme="dark"] .he-links__off svg { color: #5d6e65; }
