/* WCIS Open Days — Universal Event Card (Sitewide)
   Clean premium cards for: calendar agenda/week/day + shortcode widgets.
   Scope: only .wcis- classes.
*/

:root{
  --wcis-card-bg:#fff;
  --wcis-text:#0f172a;
  --wcis-muted:#64748b;
  --wcis-border:#e5e7eb;
  --wcis-border-strong:#d1d5db;
  --wcis-soft:#f8fafc;

  --wcis-radius:16px;
  --wcis-pad:18px;

  --wcis-primary:#0b5cff;
  --wcis-primary-2:#0a46c9;
  --wcis-focus:rgba(11,92,255,.25);

  --wcis-grid-gap:14px;
  /* Card max width (prevents 1–2 cards stretching to full width).
     Note: The card can shrink to fit a fixed 4-column grid, but never grow past this.
     Can be overridden by the Open Days settings (UI) via inline CSS vars. */
  --wcis-card-min:300px;
  --wcis-card-min-t:280px;
  --wcis-card-min-m:320px;
}

/* Responsive fixed card widths (can be overridden via inline CSS variables) */
@media (max-width: 980px){
  :root{ --wcis-card-min: var(--wcis-card-min-t); }
}
@media (max-width: 560px){
  :root{ --wcis-card-min: var(--wcis-card-min-m); }
}

/* Wrappers (layouts only — cards remain identical)
   Goal:
   - Desktop shows 4 cards per row
   - Cards never stretch wider than --wcis-card-min
   - A single card never expands to fill the row
*/
.wcis-cards{
  display:grid;
  gap:var(--wcis-grid-gap);
  grid-template-columns:repeat(4, minmax(0, 1fr));
  justify-content:start;
  justify-items:start;
  align-items:start;
  /* Prevent 5+ columns on ultra-wide containers */
  max-width:calc((4 * var(--wcis-card-min)) + (3 * var(--wcis-grid-gap)));
  width:100%;
  margin:10px 0 20px;
}

@media (max-width: 1280px){
  .wcis-cards{ grid-template-columns:repeat(3, minmax(0, 1fr)); max-width:calc((3 * var(--wcis-card-min)) + (2 * var(--wcis-grid-gap))); }
}
@media (max-width: 980px){
  .wcis-cards{ grid-template-columns:repeat(2, minmax(0, 1fr)); max-width:calc((2 * var(--wcis-card-min)) + (1 * var(--wcis-grid-gap))); }
}
@media (max-width: 560px){
  /* Mobile: single column should use the full available width.
     A fixed max-width here makes cards appear shifted left with empty
     space on the right. */
  .wcis-cards{
    grid-template-columns:1fr;
    max-width:100%;
    width:100%;
    justify-content:stretch;
    justify-items:stretch;
  }

  /* For non-carousel lists/grids, let cards expand to container width on mobile. */
  .wcis-cards:not(.wcis-cards--scroll) > .wcis-event-card,
  .wcis-cards:not(.wcis-cards--scroll) > article.wcis-event-card,
  .wcis-cards:not(.wcis-cards--scroll) > a{
    max-width:100%;
  }
  .wcis-cards:not(.wcis-cards--scroll) > a > .wcis-event-card,
  .wcis-cards:not(.wcis-cards--scroll) > .wcis-event-card{
    max-width:100%;
  }
  .wcis-cards:not(.wcis-cards--scroll) .wcis-event-card{ max-width:100%; }
}

/* ===== Global size contract (prevents single/low-count cards stretching) =====
   Some themes/plugins may override .wcis-cards to flex or grid with 1fr tracks.
   We hard-lock the card and its possible wrappers to the configured width var.
*/
.wcis-cards{
  align-items:flex-start;
}
.wcis-cards > .wcis-event-card,
.wcis-cards > article.wcis-event-card{
  width:100%;
  max-width:var(--wcis-card-min);
  min-width:0;
  flex:0 0 auto;
}
/* If a wrapper element is used (e.g. <a> wrapping the card), lock it too.
   IMPORTANT: do NOT target generic > div here (it can match non-card children and break layouts). */
.wcis-cards > a{
  width:100%;
  max-width:var(--wcis-card-min);
  flex:0 0 auto;
}
.wcis-cards > a > .wcis-event-card{ width:100%; max-width:100%; }
.wcis-cards--list{ grid-template-columns:1fr; }
.wcis-cards--list > .wcis-event-card,
.wcis-cards--list > article.wcis-event-card,
.wcis-cards--list > a,
.wcis-cards--list > li{
  width:100% !important;
  max-width:none !important;
  min-width:0 !important;
  flex:1 1 auto !important;
}
.wcis-cards--list > a > .wcis-event-card,
.wcis-cards--list > li > .wcis-event-card{
  width:100% !important;
  max-width:none !important;
}
.wcis-cards--scroll{
  display:flex;
  overflow:auto;
  gap:var(--wcis-grid-gap);
  padding-bottom:6px;
  scroll-snap-type:x mandatory;
}
.wcis-cards--scroll > .wcis-event-card,
.wcis-cards--scroll > a > .wcis-event-card{ scroll-snap-align:start; }

.wcis-cards--scroll > .wcis-event-card{ flex:0 0 auto; min-width:var(--wcis-card-min); }

/* Card */
.wcis-event-card{
  background:var(--wcis-card-bg);
  color:var(--wcis-text);
  border:1px solid var(--wcis-border);
  border-radius:var(--wcis-radius);
  overflow:hidden;
  box-shadow:0 1px 0 rgba(15,23,42,.03);
  /* Ensure the card itself never expands beyond the size contract */
  width:100%;
  max-width:var(--wcis-card-min);
}
/* calm hover (no animation “destruction”) */
.wcis-event-card:hover{
  border-color:var(--wcis-border-strong);
  box-shadow:0 6px 18px rgba(15,23,42,.06);
}

/* Featured image */
.wcis-event-media{
  /* Keep media proportional so cards stay visually uniform */
  aspect-ratio: 16 / 9;
  height:auto;
  background:var(--wcis-soft);
  border-bottom:1px solid var(--wcis-border);
  overflow:hidden;
}
.wcis-event-media img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

/* When no featured image exists, show a premium blue gradient instead of a blank block */
.wcis-event-media--placeholder{
  position:relative;
  background:linear-gradient(135deg, #7fb3ff 0%, var(--wcis-primary) 70%);
}

/* If the browser supports color-mix, derive a softer gradient from the accent colour */
@supports (background: color-mix(in srgb, white 50%, black)){
  .wcis-event-media--placeholder{
    background:linear-gradient(
      135deg,
      color-mix(in srgb, var(--wcis-primary) 30%, white 70%) 0%,
      var(--wcis-primary) 70%
    );
  }
}

.wcis-event-media--placeholder::after{
  content:"";
  position:absolute;
  inset:0;
  background:radial-gradient(600px 220px at 20% 30%, rgba(255,255,255,.35), transparent 60%);
  opacity:.7;
  pointer-events:none;
}

.wcis-event-head{ padding:var(--wcis-pad) var(--wcis-pad) 10px; }
.wcis-event-topline{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
}
.wcis-event-org{
  font-size:13px;
  color:var(--wcis-muted);
  line-height:1.25;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.wcis-event-pill{
  font-size:12px;
  color:var(--wcis-text);
  background:var(--wcis-soft);
  border:1px solid var(--wcis-border);
  padding:5px 10px;
  border-radius:999px;
  line-height:1;
  flex:0 0 auto;
}
.wcis-event-title{
  font-size:16.5px;
  line-height:1.25;
  font-weight:650;
  margin:0;
  letter-spacing:-.01em;
}

.wcis-event-body{ padding:0 var(--wcis-pad) var(--wcis-pad); }
.wcis-event-meta{
  list-style:none;
  margin:10px 0 12px;
  padding:0;
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
}
.wcis-meta-item{
  display:flex;
  align-items:flex-start;
  gap:10px;
  color:var(--wcis-muted);
  font-size:13.5px;
  line-height:1.35;
}
.wcis-meta-text strong{ color:var(--wcis-text); font-weight:650; }
.wcis-ico{
  width:18px;
  height:18px;
  color:var(--wcis-icon-color, var(--wcis-muted));
  flex:0 0 auto;
  margin-top:1px;
}
.wcis-ico svg{ width:18px; height:18px; display:block; }

.wcis-event-excerpt{
  margin:0;
  color:var(--wcis-muted);
  font-size:13.5px;
  line-height:1.45;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.wcis-event-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  padding:12px var(--wcis-pad);
  border-top:1px solid var(--wcis-border);
  background:linear-gradient(to bottom, rgba(248,250,252,.6), rgba(248,250,252,1));
}

/* Keep primary CTA safely inside narrow cards */
.wcis-event-actions .wcis-btn-primary{ margin-left:auto; }

/* Buttons */
.wcis-btn{
  appearance:none;
  border:1px solid transparent;
  border-radius:12px;
  padding:10px 12px;
  font-size:13.5px;
  line-height:1;
  font-weight:650;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  cursor:pointer;
  white-space:nowrap;
  user-select:none;
}
.wcis-btn:focus,
.wcis-btn:focus-visible{ outline:none; box-shadow:0 0 0 4px var(--wcis-focus); }

.wcis-btn-primary{ background:var(--wcis-primary); color:#fff; }
.wcis-btn-primary:hover{ background:var(--wcis-primary-2); }

.wcis-btn-soft{
  background:var(--wcis-soft);
  border-color:var(--wcis-border);
  color:var(--wcis-text);
}
.wcis-btn-soft:hover{ border-color:var(--wcis-border-strong); }

/* Saved state */
.wcis-btn-soft.is-saved{
  border-color:rgba(11,92,255,.35);
  background:rgba(11,92,255,.08);
  color:var(--wcis-text);
}

.wcis-btn.is-busy{ opacity:.75; cursor:wait; }

.wcis-btn-ghost{
  background:transparent;
  border-color:var(--wcis-border);
  color:var(--wcis-text);
}
.wcis-btn-ghost:hover{ border-color:var(--wcis-border-strong); }

/* --- Save auth modal (Login / Sign up choice) --- */
.wcis-od-auth-modal{
  position:fixed;
  inset:0;
  z-index:99999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}
.wcis-od-auth-backdrop{
  position:absolute;
  inset:0;
  background:rgba(15, 23, 42, .55);
}
.wcis-od-auth-panel{
  position:relative;
  width:min(420px, 92vw);
  background:#fff;
  border:1px solid var(--wcis-border);
  border-radius:16px;
  padding:18px;
  box-shadow:0 20px 60px rgba(15, 23, 42, .25);
}
.wcis-od-auth-title{
  font-size:16px;
  font-weight:700;
  color:var(--wcis-text);
  margin:0 0 6px;
}
.wcis-od-auth-text{
  font-size:13.5px;
  color:var(--wcis-muted);
  line-height:1.45;
  margin:0 0 14px;
}
.wcis-od-auth-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.wcis-od-auth-close{
  position:absolute;
  top:8px;
  right:10px;
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid var(--wcis-border);
  background:#fff;
  color:var(--wcis-muted);
  font-size:20px;
  line-height:1;
  cursor:pointer;
}
.wcis-od-auth-close:hover{ border-color:var(--wcis-border-strong); }

@media (min-width: 640px){
  .wcis-event-title{ font-size:17px; }
  .wcis-event-meta{ grid-template-columns:1fr 1fr; column-gap:14px; }
  /* Location often wraps; let it span full row to keep cards visually uniform */
  .wcis-meta-item--location{ grid-column:1 / -1; }
}

/* Optional status hooks */
.wcis-event-card[data-status="started"] .wcis-event-pill{
  background:#ecfeff;
  border-color:#a5f3fc;
}
.wcis-event-card[data-status="ended"]{ opacity:.92; }

/* Prevent default link styles when card is wrapped by <a> */
.wcis-cardlink{ text-decoration:none; color:inherit; }


/* --- WCIS: Widget grids should NOT stretch (force fixed columns) --- */
.wcis-cards--widget{
  justify-content:start;
}
/* Responsive sizing uses the same variable; the variable itself is adjusted by inline CSS / media rules. */

/* Related rows on single event: show 4-up without stretching */
.wcis-od-event-related .wcis-cards--scroll{
  overflow-x:auto;
}
.wcis-od-event-related .wcis-cards--scroll > .wcis-event-card,
.wcis-od-event-related .wcis-cards--scroll > a > .wcis-event-card{
  flex:0 0 280px;
  width:280px;
}

/* Ensure buttons footer never clips */
.wcis-event-actions{flex-wrap:wrap}
