/* =========================================================
   CCC Events Widget — full stylesheet (cards + details)
   Notes:
   - Keep selectors low-specificity so WordPress themes don’t fight us.
   - All layout/spacing uses CSS variables for consistency.
   ========================================================= */

/* -------------------- Theme variables -------------------- */
:root{
  --ccc-font: "Open Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  --ccc-text: #111;
  --ccc-muted: #6b7280;

  --ccc-blue: #003E7E;
  --ccc-blue-600: #0b2e59;
  --ccc-blue-700: #0b2e59;

  --ccc-accent: #ef9021;

  --ccc-pill-bg: #ecf0f4;
  --ccc-pill-text: #003e7e;

  --ccc-card-bg: #fff;
  --ccc-panel-bg: #f9f9f9;   /* shared with left menu */

  --ccc-card-br: 20px;
  --ccc-shadow: 0 2px 6px rgba(0,0,0,.10);

  --ccc-gap: 20px;
  --ccc-pad: 20px;
  
  --ccc-hover-bg: var(--ccc-panel-bg); /* #f9f9f9 */
  --ccc-active-bg: #eef6ff;            /* subtle blue tint when selected */
  --ccc-active-accent: #0b5fff;        /* left bar color on selection */
  --ccc-active-border: #90b9ff;        /* selected border */  
}

/* ------------------------ Utilities ---------------------- */
.is-hidden{ display:none !important; }

/* =========================================================
   Grid container
   ========================================================= */
#ccc-events-widget,
#events-widget,
.ccc-events-grid{
  font-family: var(--ccc-font);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ccc-gap);
  align-items: stretch;
}
@media (max-width: 900px){
  #ccc-events-widget,
  #events-widget,
  .ccc-events-grid{
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Card
   ========================================================= */
.event-card{
  position: relative;	
  background: var(--ccc-card-bg);
  border: 1px solid #e5e7eb;
  border-radius: var(--ccc-card-br);
  box-shadow: var(--ccc-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Card title: force ONE line with (…) */
.event-card .event-title{
  display: block;              /* override any -webkit-box from earlier */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}

.event-card .event-subtitle{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
  margin-bottom: 8px;
}

/* When JS marks a long title, nudge the size down a bit */
.event-card .event-title.is-long{
  font-size: clamp(1.05rem, 0.9rem + 0.45vw, 1.35rem);
}

/* Optional: allow 2 title lines on wider screens */
@media (min-width: 1024px){
  .event-card .event-title{ -webkit-line-clamp: 2; }
}

/* image wrapper uses aspect-ratio and crops the child <img> */
.event-image{
  margin: var(--ccc-pad);
  border-radius: 12px;
  background: #e6eef6;
  aspect-ratio: 3 / 2;
  overflow: hidden;
}
.event-image > img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Card body */
.card-body{
  display: flex;
  flex-direction: column;
  flex: 1;
  margin: 0 var(--ccc-pad);
  padding-left: var(--ccc-pad);
  padding-right: var(--ccc-pad);
  padding-bottom: 10px;
}

/* Title */
.event-title{
  font-size: clamp(1.1rem, 0.95rem + 0.55vw, 1.55rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 10px;
  color: var(--ccc-blue);
}

/* Subtitles (after ":" or "|") */
.event-subtitle{
  margin-top: 4px;
  margin-bottom: 8px;
  font-size: .95rem;
  line-height: 1.35;
  color: var(--ccc-muted);
  font-weight: 700;
}

.details-title .details-subtitle{
  display: block; /* force onto new line under the H2 */
  margin-top: 4px;
  font-weight: 700;
  font-size: clamp(1rem, .9rem + .35vw, 1.125rem);
  color: var(--ccc-muted);
}

/* Meta (ul reset + row items) */
.event-card .event-meta{
  margin: 0 0 8px 0;
  padding-left: 0 !important;
  list-style: none !important;
}
.event-card .event-meta li{
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 6px 0;
}
.event-card .event-meta li::marker{ content: none; }

.event-date,
.event-time,
.event-location,
.event-description{
  font-size: 1rem;
  margin: 0 0 10px 0;
  color: var(--ccc-text);
}
.event-location{ margin-bottom: 20px; }

.event-date i,
.event-time i,
.event-location i{
  margin-right: 3px;
  color: var(--ccc-blue-600);
}

/* Tag row on cards */
.event-tags{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 6px 0;
}

.event-tags:empty{ display:none; }

.event-tag{
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 4px 12px;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.2;
  border-radius: 999px;
  background: var(--ccc-pill-bg);
  color: var(--ccc-pill-text);
}

/* Card tags: force one line; hide extras via .is-hidden */
.event-card .event-tags{
  display: flex;
  flex-wrap: nowrap;       /* no wrapping */
  overflow: hidden;        /* clip overflow */
  white-space: nowrap;     /* keep chips on one line */
  gap: 10px;
}

.event-card .event-tag{
  flex: 0 0 auto;          /* don't shrink; stay their width */
  white-space: nowrap;
}

.event-tag.is-hidden{
  display: none !important;
}

/* Single-day square badge */
.event-card .date-badge{
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: #fff;
  color: #0a2a4a;
  box-shadow: 0 2px 10px rgba(0,0,0,.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;                /* no vertical gap */
  padding: 6px;
  line-height: 1;
  text-align: center;
  pointer-events: none;  /* let clicks pass through to the card */
  user-select: none;
}

.date-badge .badge-mon{
  display: block;
  font-size: clamp(.72rem, .65rem + .25vw, .92rem);
  letter-spacing: .08em;
  font-weight: 600;
  opacity: .95;
  line-height: 1;
  margin: 0;
}

.date-badge .badge-day{
  display: block;
  font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2rem); /* DAY dominates */
  font-weight: 800;        /* 700 is fine; 800–900 is punchier */
  line-height: .85;
  margin-top: 2px;        /* tighten month↔day */
}

/* Multi-day range badge (wider pill with 2 columns) */
.event-card .date-badge-range{
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  min-width: 132px;        /* space for two stacks + dash */
  height: 72px;
  border-radius: 16px;
  background: #fff;
  color: #0a2a4a;
  box-shadow: 0 2px 10px rgba(0,0,0,.14);
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* start | dash | end */
  align-items: center;
  gap: 6px;                /* tightened from 8–10px */
  padding: 8px 12px;
  pointer-events: none;
  user-select: none;
}

.date-badge-range .col{
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  row-gap: 2px;            /* month↔day spacing */
  line-height: 1.05;
}

.date-badge-range .mon{
  font-size: clamp(.68rem, .6rem + .25vw, .9rem);
  letter-spacing: .08em;
  font-weight: 700;
  opacity: .95;
  line-height: 1;
  margin: 0;
}

.date-badge-range .day{
  font-size: clamp(1.4rem, 1.05rem + 1vw, 1.9rem);
  font-weight: 800;
  line-height: .95;
  margin: 0;
}

.date-badge-range .sep{
  font-weight: 800;
  opacity: .6;
  transform: translateY(-2px);
}

/* Ensure the image wrapper leaves room for overlay */
.event-card .event-image{
  position: relative;
  overflow: hidden;
  border-radius: 16px;
}

/* =========================================================
   Clickable card (whole-card opens details)
   ========================================================= */
.event-card.clickable{
  cursor: pointer;
  transition:
    background-color .18s ease,
    border-color .18s ease,
    box-shadow .2s ease,
    transform .12s ease,
    outline-color .2s ease;
}
.event-card.clickable:hover{
  transform: translateY(-2px);
  background-color: var(--ccc-hover-bg); /* fades to #f9f9f9 */
  border-color: #e3e7ee;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.event-card.clickable:active{
  transform: translateY(0);
}
.event-card.clickable:focus-visible{
  outline: 3px solid #9cc3ff;
  outline-offset: 2px;
}
.event-card.is-active{
  background-color: var(--ccc-active-bg);
  border-color: var(--ccc-active-border);
  box-shadow: 0 6px 18px rgba(0,0,0,.12); /* a touch more lift */
}

/* slim accent bar on the left when selected (clipped by card radius) */
.event-card.is-active::after{
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: var(--ccc-active-accent);
  border-top-left-radius: var(--ccc-card-br);
  border-bottom-left-radius: var(--ccc-card-br);
  pointer-events: none;
}

/* focus remains obvious for keyboard users */
.event-card.clickable:focus-visible{
  outline: 3px solid #9cc3ff;
  outline-offset: 2px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .event-card.clickable{ transition: none; }
  .event-card.clickable:hover,
  .event-card.clickable:active{ transform:none; }
}

/* =========================================================
   Detail view
   ========================================================= */

/* remove the tiny gap above the hero */
#event-details-view{
  margin: 0;
  font-family: var(--ccc-font);
}

/* Clickable hero */
.details-hero-wrap{
  position: relative;
  cursor: pointer;                 /* whole image is tappable */
}
#event-details-view .details-hero{
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #e6eef6;
  border-radius: 20px;             /* unified radius */
  margin: 0 0 16px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
}

/* Small badge like the card date box */
.details-close-badge{
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    width: 175px;
    height: 48px;
    border-radius: 14px;
    background: #fff;
    color: var(--ccc-blue);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    text-align: center;
    pointer-events: none;
}

/* Gray panel behind details grid */
#event-details-view .details-card{
  background: var(--ccc-panel-bg);   /* #f9f9f9 */
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,.10);
  padding: 20px 20px 24px;
  margin: 12px 0 0;
  position: relative;
}

/* Base layout (mobile first) */
.details-card .details-grid{
  padding: 0 20px;
}

/* Title */
.details-card .details-title{
  color: var(--ccc-blue);
  font-weight: 700;
  margin: 4px 0 6px;
  line-height: 1.2;
  font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem);
}

/* Meta list */
.details-card .details-meta{
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--ccc-text);
}
.details-card .details-meta li{
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 4px 0;
}
.details-card .details-meta i{
  color: var(--ccc-blue-600);
}

/* Body text */
.details-card .details-body{ min-height: 40px; }
.details-card .details-text{
  line-height: 1.7;
  /*white-space: pre-line;*/        /* keep line breaks in plain text */
  margin: 20px 0 20px;
  color: var(--ccc-text);
}

/* CTA under the time/meta on all screens (grid area set on desktop) */
.event-actions.under-meta{ margin: 14px 0 18px 0; }

/* Tags: ensure only one row shows per breakpoint */
.details-card .details-tags-mobile{ display: none !important; }
.details-card .details-tags-desktop{
  display: flex !important;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 0 0;              /* sits right above the body text */
}

/* Mobile: tags ABOVE date; single column flow */
@media (max-width: 900px){
  .details-card .details-grid{ display: block; }
  .details-card .details-tags-mobile{
    display: flex !important;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0 20px 0;          /* just under the title */
  }
  .details-card .details-tags-desktop{ display: none !important; }
}

/* Desktop/tablet: two-column grid like the mock */
@media (min-width: 901px){
  .details-card .details-grid{
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(460px, 2fr);
    grid-template-areas:
      "title title"
      "meta  body"
      "meta  cta";      /* 👈 CTA row under the description (right column) */
    column-gap: 40px;
    row-gap: 14px;
    align-items: start;
  }

  .details-card .details-title{ grid-area: title; }
  .details-card .details-meta { grid-area: meta;  margin: 0; }
  .details-card .details-body { grid-area: body;  margin: 0; }
  .event-actions.under-meta   { grid-area: cta;   margin: 12px 0 0 0; }

  .event-pill-button.is-cta{ width: 100%; max-width: 420px; }
}
#event-details-view .event-actions.under-meta .event-pill-button{
  display:inline-flex; align-items:center; justify-content:center;
  text-decoration:none !important;
}
#event-details-view .event-pill-button .btn-icon{ margin-right:.6em; }

.event-pill-button .btn-icon{ margin-right: .6em; }

/* Force CTA styling inside details view */
#event-details-view .event-actions.under-meta .event-pill-button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 800;
  line-height: 1.1;
}

#event-details-view .event-pill-orange{
  background: #f09a2a;           /* your orange */
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
#event-details-view .event-pill-orange:hover{
  filter: brightness(.97);
  transform: translateY(-1px);
}

#event-details-view .event-pill-button .btn-icon{ margin-right: .6em; }

/* ensure desktop places CTA under time */
@media (min-width: 901px){
  .details-card .details-grid{
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(460px, 2fr);
    grid-template-areas:
      "title title"
      "meta  body"
      "meta  cta";   /* CTA row beneath the body, same right column */
    column-gap: 40px;
    row-gap: 14px;
    align-items: start;
  }

  .details-card .details-title{ grid-area: title; }
  .details-card .details-meta { grid-area: meta; }
  .details-card .details-body { grid-area: body; }
  .event-actions.under-meta   { grid-area: cta;  margin: 12px 0 0 0; }
}




/* =========================================================
   Responsive tweaks
   ========================================================= */
@media (max-width: 1024px){
  .event-card{ border-radius: 18px; }
}
@media (max-width: 600px){
  .event-image{ margin: 0; border-radius: 0; }
  .event-card .event-tags{
    margin: 20px 0 6px 0 !important; /* top 20px, keep 6px below */
  }
  .event-card .card-body{
    margin: 0 10px;        /* left/right 10px */
    padding-left: 10px;    /* left 10px  */
    padding-right: 10px;   /* right 10px */
  }  
}

/* =========================================================
   Accessibility extras
   ========================================================= */
@media (prefers-reduced-motion: reduce){
  * { animation: none !important; transition: none !important; }
}
@media (forced-colors: active){
  .event-card{ border: 1px solid CanvasText; }
  .event-pill-button{ border: 1px solid CanvasText; }
}
