/* =========================================================
   Events Filters v2 – desktop-first (one row)
   ========================================================= */

/* ---- Container ---- */
.events-filters-v2{
  background:#fff;
  border:1px solid #e6e6e6;
  border-radius:14px;
  padding:0.75rem;
  box-shadow:0 10px 26px rgba(0,0,0,0.06);

  display:grid;
  grid-template-columns: 1fr;
  gap:0.6rem;
}

/* Mobile: 2-col grid
   Row 1: Search | Date
   Row 2: County | Vineyard
   Row 3: Type (full width)
   Row 4: Actions (full width)
*/
@media (max-width: 1024px){
  .events-filters-v2{
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.6rem 0.6rem;
    align-items: start;
  }

  /* Let the children participate in the parent grid */
  .events-filters-v2 .events-filters-v2__row1,
  .events-filters-v2 .events-filters-v2__row2{
    display: contents;
  }

  .events-filters-v2 .events-filters-v2__search{ grid-column: 1; grid-row: 1; min-width: 0; }
  .events-filters-v2 .events-filters-v2__date{ grid-column: 2; grid-row: 1; min-width: 0; }

  /* Dropdowns */
  .events-filters-v2 details.dd[data-filter="county"]{ grid-column: 1; grid-row: 2; }
  .events-filters-v2 details.dd[data-filter="vineyard"]{ grid-column: 2; grid-row: 2; }
  .events-filters-v2 details.dd[data-filter="type"]{ grid-column: 1 / -1; grid-row: 3; }

  /* County pages: county filter is hidden, so pull Vineyard into the left slot
     and move Type into the right slot (prevents the blank gap on 2-col layouts). */
  .events-filters--county .events-filters-v2 details.dd[data-filter="vineyard"]{
    grid-column: 1;
    grid-row: 2;
  }

  .events-filters--county .events-filters-v2 details.dd[data-filter="type"]{
    grid-column: 2;
    grid-row: 2;
  }

  .events-filters--county .events-filters-v2 .events-filters-v2__actions{
    grid-column: 1 / -1;
    grid-row: 3;
  }

  /* Fallback: if the County <details> is not rendered at all,
     auto-pack Vineyard + Type into row 2 on 2-col layouts.
     (Works even if the wrapper modifier class isn't present.) */
  @supports selector(:has(*)){
    .events-filters-v2:not(:has(details.dd[data-filter="county"])) details.dd[data-filter="vineyard"]{
      grid-column: 1;
      grid-row: 2;
    }

    .events-filters-v2:not(:has(details.dd[data-filter="county"])) details.dd[data-filter="type"]{
      grid-column: 2;
      grid-row: 2;
    }

    .events-filters-v2:not(:has(details.dd[data-filter="county"])) .events-filters-v2__actions{
      grid-column: 1 / -1;
      grid-row: 3;
    }
  }

  /* Actions full width under filters */
  .events-filters-v2 .events-filters-v2__actions{
    grid-column: 1 / -1;
    grid-row: 4;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
  }

  /* Make Reset usable on mobile if it’s already styled as a big button */
  .events-filters-v2 .events-filters-v2__reset{
    width: 100%;
  }
}

/* Tablet: simple 2-col until we do mobile properly later */
@media (min-width:1025px){
  .events-filters-v2{
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap:0.75rem 0.9rem;
    align-items:center;
  }
}

/* Desktop: ONE ROW
   Search | Date | County | Vineyard | Type | Actions */
@media (min-width:1100px){
  .events-filters-v2{
    grid-template-columns:
      minmax(320px, 2.4fr)  /* search (wider) */
      minmax(160px, 0.9fr)  /* date */
      minmax(170px, 1fr)    /* county */
      minmax(200px, 1fr)    /* vineyard */
      minmax(170px, 1fr)    /* type */
      max-content;          /* actions */
    gap:0.75rem 0.9rem;
    align-items:start;
  }

  /* The markup uses wrapper rows; on desktop we want the *children* to be grid items */
  .events-filters-v2 .events-filters-v2__row1,
  .events-filters-v2 .events-filters-v2__row2{
    display: contents;
  }

  /* Place the existing elements into the grid columns */
  .events-filters-v2 .events-filters-v2__search{ grid-column: 1; }
  .events-filters-v2 .events-filters-v2__date{ grid-column: 2; }

  /* Keep dropdowns in the next columns in DOM order */
  .events-filters-v2 details.dd{ grid-column: auto; min-width: 0; align-self: start; }

  /* Actions pinned to the end */
  .events-filters-v2 .events-filters-v2__actions{
    grid-column: 6;
    justify-self: end;
    align-self: center;
    display: inline-flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: nowrap;
  }

  /* Allow the favourites label to wrap to two lines if needed */
  .events-filters-v2 .events-filters-v2__fav{
    white-space: normal;
    line-height: 1.15;
    max-width: 140px; /* tweakable */
  }

  /* Keep the reset button text from wrapping */
  .events-filters-v2 .events-filters-v2__reset{
    white-space: nowrap;
  }
}

/* ---- Base pill look (search, select, summary) ---- */
.events-filters-v2 input[type="search"],
.events-filters-v2 select,
.events-filters-v2 summary{
  appearance:none;
  width:100%;
  box-sizing:border-box;

  padding:0.48rem 0.75rem; /* keep snug */
  border-radius:999px;
  border:1px solid rgba(0,0,0,0.14);
  background:#fff;

  font-size:0.85rem;
  line-height:1.1;
  min-height:40px;
  height:40px;
}

/* Summary needs to behave like a button/pill */
.events-filters-v2 summary{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  list-style:none;
}

/* Native select chevron (date) */
.events-filters-v2 select{
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(0,0,0,0.55) 50%),
    linear-gradient(135deg, rgba(0,0,0,0.55) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size:6px 6px, 6px 6px;
  background-repeat:no-repeat;
  padding-right:2.4rem;
  background-clip:padding-box;
}

/* ---- Details dropdown triggers ---- */
.events-filters-v2 details{ position:relative; min-width:0; }

/* Ensure the <details> wrapper itself adds ZERO spacing (fixes 4px vertical misalignment) */
.events-filters-v2 details.dd{
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.events-filters-v2 details.dd > summary{
  margin: 0 !important;
}

/* Remove native marker/triangle (surgical + strong) */
.events-filters-v2 details > summary::-webkit-details-marker{ display:none !important; }
.events-filters-v2 details > summary::marker{ content:"" !important; display:none !important; }

/* Hide inline ▾ if present in markup */
.events-filters-v2 .dd__chev{ display:none !important; }

/* Some global styles add their own dropdown arrows via pseudo-elements.
   Kill them inside v2 so we only ever see ONE chevron (our background-image). */
.events-filters-v2 details.dd > summary::before,
.events-filters-v2 details.dd > summary::after,
.events-filters-v2 summary.dd__btn::before,
.events-filters-v2 summary.dd__btn::after{
  content: none !important;
  display: none !important;
}

/* Chevron matches date select */
.events-filters-v2 details > summary{
  cursor:pointer;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;

  background-image:
    linear-gradient(45deg, transparent 50%, rgba(0,0,0,0.55) 50%),
    linear-gradient(135deg, rgba(0,0,0,0.55) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size:6px 6px, 6px 6px;
  background-repeat:no-repeat;
  padding-right:2.4rem;
  background-clip:padding-box;
  border-radius:999px;
}

/* Keep pill shape identical when open (mobile Safari + global rules can override) */
.events-filters-v2 details.dd > summary.dd__btn,
.events-filters-v2 details.dd[open] > summary.dd__btn{
  border-radius: 999px !important;
  background-clip: padding-box;
  overflow: hidden; /* prevents weird corner clipping on small screens */
}

/* Ensure the dropdown panel never “attaches” to the trigger and changes its corner shape */
.events-filters-v2 details.dd[open] > .events-filters-v2__panel{
  margin-top: 8px; /* visual gap from the pill */
}

/* ---- Dropdown panel ---- */
.events-filters-v2__panel{
  display: none;
  position: absolute !important;
  top: calc(100% + 8px) !important;
  left: 0 !important;
  right: 0 !important;

  background:#fff;
  border:1px solid rgba(0,0,0,0.12);
  border-radius:14px;
  box-shadow:0 10px 30px rgba(0,0,0,0.12);

  padding:0.35rem;
  z-index:1000;
  max-height:280px;
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}

.events-filters-v2 details[open] > .events-filters-v2__panel{ display:block; }

/* ---- Actions (non-desktop) ---- */
@media (max-width:1099px){
  .events-filters-v2 .events-filters-v2__actions{
    grid-column:1 / -1;
    display:flex;
    gap:0.75rem;
    align-items:center;
    flex-wrap:wrap;
  }
}

/* Focus ring (no geometry change) */
.events-filters-v2 input[type="search"]:focus,
.events-filters-v2 select:focus,
.events-filters-v2 summary:focus{ outline:none; box-shadow:none; }

.events-filters-v2 input[type="search"]:focus-visible,
.events-filters-v2 select:focus-visible,
.events-filters-v2 summary:focus-visible{
  outline:none;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.14);
}
 
/* =========================================================
   Events – Cards (match l90-card look & feel)
   Scoped to .event-card only
   ========================================================= */

.event-card{
  list-style: none;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 1.25rem 1.25rem 1.1rem;
  position: relative;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.event-card::after{
  content: "";
  display: block;
  clear: both;
}

/* If cards are stacked list items */
.event-card + .event-card{
  margin-top: 1rem;
}

.event-card:hover{
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* Title/link styling (safe: only affects links inside the card) */
.event-card a{
  color: #1a1a1a;
  text-decoration: none;
}

.event-card a:hover{
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Common text bits (only apply if these elements/classes exist in markup) */
.event-card__top{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.event-card__title{
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.event-card__link{
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1a1a;
}

.event-card__meta,
.event-card__sub,
.event-card__county{
  font-size: 0.85rem;
  color: #666;
}

/* Optional thumbnail/media block (banner on mobile, side thumbnail on desktop)
   Only applies if you use .event-card__media */
.event-card__media{
  position: relative;
  margin-top: 0.55rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #ededed;
  background: #fafafa;
  aspect-ratio: 21 / 9;
  max-height: 140px;
}

@media (min-width: 820px){
  .event-card__media{
    float: right;
    width: 280px;
    max-width: 40%;
    max-height: none;
    aspect-ratio: 4 / 3;
    margin: 0.15rem 0 0.75rem 1rem;
  }
}

.event-card__media img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Optional date/time badge (only applies if you use .event-card__time) */
.event-card__time{
  align-self: flex-start;
  height: fit-content;
  background: #f7f7f7;
  border: 1px solid #e6e6e6;
  color: #111;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  padding: 0.22rem 0.5rem;
  line-height: 1;
  font-size: 0.9rem;
  white-space: nowrap;
}

@media (max-width: 520px){
  .event-card__time{
    padding: 0.18rem 0.45rem;
    font-size: 0.85rem;
  }
}

/* Optional chips row (only applies if you use .event-card__chips / .event-chip) */
.event-card__chips{
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.event-chip{
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #f2f2f2;
  color: #333;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

/* Optional summary/blurb text */
.event-card__summary,
.event-card__blurb{
  font-size: 0.85rem;
  color: #555;
  margin-top: 0.4rem;
  line-height: 1.4;
}

.event-line .event-vineyard{
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}