/* ==========================================================================
   Starfish Coaching — Upcoming Events grid
   Scoped under .sf-events so it cannot leak into the rest of the Elementor page.
   Brand tokens mirror the live Starfish look (Poppins / Rubik, teal #2E5B73, green #338854).
   ========================================================================== */

.sf-events {
  /* --- brand tokens ------------------------------------------------------ */
  --sf-primary:      #2E5B73;
  --sf-primary-lift: #3B7491;
  --sf-navy:        #0F2436;   /* deep navy, scrim base, never neutral grey */
  --sf-mist:           #F2F7F9;
  --sf-sky:            #B8D9E6;
  --sf-green:            #338854;   /* Starfish green, free pills and the calendar's today marker */

  --sf-ink:             #14303F;
  --sf-ink-soft:        #4A6272;

  /* --- type -------------------------------------------------------------- */
  --sf-font-head: "Poppins", system-ui, sans-serif;
  --sf-font-body: "Rubik", system-ui, sans-serif;

  /* --- geometry ---------------------------------------------------------- */
  --sf-gap:    clamp(14px, 1.8vw, 28px);
  --sf-radius: 4px;
  /* Eventbrite art is 2:1 landscape. A tall card centre-crops it to ribbons,
     so the card stays close to square and the crop bias sits above centre,
     where faces and flyer titles actually live. */
  --sf-card-h: clamp(370px, 42vw, 440px);

  /* --- motion ------------------------------------------------------------ */
  --sf-ease: cubic-bezier(0.22, 1, 0.36, 1);   /* ease-out-quint */
  --sf-dur:  0.5s;

  container-type: inline-size;
  font-family: var(--sf-font-body);
}

/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */

.sf-events__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sf-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

@container (min-width: 620px) {
  .sf-events__grid { grid-template-columns: repeat(2, 1fr); }
}
@container (min-width: 980px) {
  .sf-events__grid { grid-template-columns: repeat(3, 1fr); }
}

/* Fallback for browsers without container queries. */
@supports not (container-type: inline-size) {
  @media (min-width: 700px)  { .sf-events__grid { grid-template-columns: repeat(2, 1fr); } }
  @media (min-width: 1060px) { .sf-events__grid { grid-template-columns: repeat(3, 1fr); } }
}

/* The next event up gets width and a bigger voice — the grid is never
   seven identical rectangles. */
@container (min-width: 620px) {
  .sf-events__item--featured { grid-column: span 2; }
}
@supports not (container-type: inline-size) {
  @media (min-width: 700px) { .sf-events__item--featured { grid-column: span 2; } }
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */

.sf-ev {
  position: relative;
  display: flex;
  min-height: var(--sf-card-h);
  overflow: hidden;
  border-radius: var(--sf-radius);
  /* An event with no artwork on Eventbrite still has to look deliberate,
     not like a broken image. */
  background:
    radial-gradient(120% 90% at 20% 0%, #1C4A63 0%, rgba(28, 74, 99, 0) 62%),
    var(--sf-navy);
  isolation: isolate;
}

.sf-ev__link {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  padding: 0;
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;                 /* no 300ms double-tap delay */
  -webkit-tap-highlight-color: rgba(44, 110, 155, 0.18);
}

.sf-ev__link:focus-visible {
  outline: 3px solid var(--sf-sky);
  outline-offset: -3px;
}

/* Photo ------------------------------------------------------------------- */

.sf-ev__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  transform: scale(1.001);          /* avoids a 1px seam while scaling */
  transition: transform 0.7s var(--sf-ease);
}

/* Warm scrim. Espresso, not black — black over a warm photo goes muddy.
   Two layers on purpose:
     1. a text bed that is heavy enough to hold 12px type at 4.5:1 even when the
        photo underneath is blown out (a bright market shot, a white wall);
     2. a flat veil so the date stamp and price pill always land on something.
   A single soft gradient measured under 3:1 on light photography. */
.sf-ev__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.94;
  background:
    linear-gradient(
      180deg,
      rgba(15, 36, 54, 0.00) 24%,
      rgba(15, 36, 54, 0.62) 50%,
      rgba(15, 36, 54, 0.92) 72%,
      rgba(15, 36, 54, 0.97) 100%
    ),
    linear-gradient(rgba(15, 36, 54, 0.22), rgba(15, 36, 54, 0.22));
  transition: opacity 0.45s var(--sf-ease);
}

/* Date stamp -------------------------------------------------------------- */

.sf-ev__stamp {
  position: absolute;
  top: 0;
  left: clamp(16px, 3cqi, 28px);
  z-index: 2;
  padding: 12px 14px 10px;
  background: var(--sf-primary);
  color: var(--sf-mist);
  text-align: center;
  line-height: 1;
  box-shadow: 0 6px 20px rgba(15, 36, 54, 0.28);
}

.sf-ev__day {
  display: block;
  font-family: var(--sf-font-head);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;   /* 01 and 18 occupy the same width */
}

.sf-ev__mon {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sf-sky);
}

/* Price / status pill ----------------------------------------------------- */

.sf-ev__pill {
  position: absolute;
  top: clamp(14px, 2.4cqi, 20px);
  right: clamp(14px, 2.4cqi, 20px);
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(242, 247, 249, 0.92);
  color: var(--sf-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.sf-ev__pill--free     { background: var(--sf-green); color: #fff; }
.sf-ev__pill--soldout  { background: rgba(15, 36, 54, 0.86); color: var(--sf-sky); }

/* Body -------------------------------------------------------------------- */

.sf-ev__body {
  position: relative;
  z-index: 1;
  padding: 0 clamp(18px, 3cqi, 28px) 22px;
  margin-bottom: 56px;              /* clears the action bar */
}

.sf-ev__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sf-sky);
}

.sf-ev__tag-dot {
  font-size: 7px;
  opacity: 0.65;
  transform: translateY(-1px);
}

.sf-ev__title {
  margin: 0 0 8px;
  font-family: var(--sf-font-head);
  font-size: clamp(20px, 2.4cqi, 23px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: #FFFFFF;
  text-wrap: balance;
}

.sf-ev__when {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--sf-sky);
}

/* "+9 more dates" on a recurring series. */
.sf-ev__repeat {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(184, 217, 230, 0.16);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: 1px;
}

.sf-ev__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.88);   /* 4.5:1+ over the 93% espresso scrim */
  text-wrap: pretty;
}

/* Featured card gets room to actually say something. */
.sf-events__item--featured .sf-ev__title   { font-size: clamp(24px, 3.2cqi, 34px); }
.sf-events__item--featured /* "+9 more dates" on a recurring series. */
.sf-ev__repeat {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(184, 217, 230, 0.16);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: 1px;
}

.sf-ev__excerpt { -webkit-line-clamp: 3; line-clamp: 3; }
.sf-events__item--featured .sf-ev__body    { max-width: 60ch; }

/* Action bar -------------------------------------------------------------- */

.sf-ev__bar {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px clamp(18px, 3cqi, 28px);
  background: rgba(15, 36, 54, 0.72);
  color: var(--sf-mist);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background-color 0.35s var(--sf-ease), color 0.35s var(--sf-ease);
}

.sf-ev__bar svg {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform 0.4s var(--sf-ease);
}

/* Hover / focus ----------------------------------------------------------- */

@media (hover: hover) {
  .sf-ev:hover .sf-ev__img,
  .sf-ev:focus-within .sf-ev__img { transform: scale(1.055); }

  .sf-ev:hover .sf-ev__scrim,
  .sf-ev:focus-within .sf-ev__scrim { opacity: 1; }

  .sf-ev:hover .sf-ev__bar,
  .sf-ev:focus-within .sf-ev__bar {
    background: var(--sf-primary-lift);
    color: #FFFFFF;
  }

  .sf-ev:hover .sf-ev__bar svg,
  .sf-ev:focus-within .sf-ev__bar svg { transform: translateX(5px); }
}

/* --------------------------------------------------------------------------
   Entrance — enhances an already-visible default. If JS never runs, or the
   page is rendered headless, every card is simply visible.
   -------------------------------------------------------------------------- */

.sf-events__grid.is-armed .sf-events__item {
  opacity: 0;
  transform: translateY(18px);
}

.sf-events__item.is-in {
  animation: sf-ev-in 0.62s var(--sf-ease) forwards;
  animation-delay: var(--sf-stagger, 0ms);
}

@keyframes sf-ev-in {
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sf-events__grid.is-armed .sf-events__item { opacity: 1; transform: none; }
  .sf-events__item.is-in { animation: none; }
  .sf-ev__img,
  .sf-ev__bar,
  .sf-ev__bar svg,
  .sf-ev__scrim { transition-duration: 0.01ms; }
  .sf-ev:hover .sf-ev__img { transform: none; }
}

/* --------------------------------------------------------------------------
   Empty state — what shows when there is genuinely nothing on the calendar.
   Never "We found no events."
   -------------------------------------------------------------------------- */

.sf-events__empty {
  padding: clamp(36px, 6vw, 64px) clamp(24px, 5vw, 56px);
  border: 1px solid rgba(44, 110, 155, 0.22);
  border-radius: var(--sf-radius);
  background: rgba(44, 110, 155, 0.05);
  text-align: center;
}

.sf-events__empty h3 {
  margin: 0 0 10px;
  font-family: var(--sf-font-head);
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 600;
  color: var(--sf-primary);
}

.sf-events__empty p {
  margin: 0 auto 22px;
  max-width: 54ch;
  font-size: 16px;
  line-height: 1.65;
  color: var(--sf-ink-soft);
  text-wrap: pretty;
}

.sf-events__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  padding: 14px 26px;
  border-radius: 2px;
  background: var(--sf-primary);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  touch-action: manipulation;
  transition: background-color 0.3s var(--sf-ease), transform 0.3s var(--sf-ease);
}

.sf-events__cta:hover,
.sf-events__cta:focus-visible {
  background: var(--sf-primary-lift);
  color: #FFFFFF;
  transform: translateY(-2px);
}

/* Inline SVGs must be sized in CSS, not left to the viewBox — an unsized
   arrow inherits the font-size box and shoves the label onto three lines. */
.sf-events__cta svg,
.sf-events__more a svg {
  width: 15px;
  height: 15px;
  flex: none;
  transition: transform 0.35s var(--sf-ease);
}

.sf-events__cta:hover svg,
.sf-events__cta:focus-visible svg { transform: translateX(4px); }

/* Footer link under the grid ---------------------------------------------- */

.sf-events__more {
  margin-top: clamp(22px, 3vw, 34px);
  text-align: center;
}

.sf-events__more a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(44, 110, 155, 0.4);
  color: var(--sf-primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  touch-action: manipulation;
  transition: border-color 0.3s var(--sf-ease), gap 0.3s var(--sf-ease);
}

.sf-events__more a:hover { border-color: var(--sf-primary); gap: 15px; }


/* ==========================================================================
   Calendar  ([starfish_events view="calendar"] or view="both")
   Wide containers: a month table. Narrow containers: the same month as an
   agenda list, because a 7-column table cannot show an event title at 40px.
   ========================================================================== */

.sf-cal { margin: 0 0 calc(var(--sf-gap) * 1.5); }

.sf-cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}
.sf-cal__title {
  margin: 0;
  font-family: var(--sf-font-head);
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 600;
  line-height: 1.2;
  color: var(--sf-ink);
}
.sf-cal__nav {
  display: none;            /* shown only once the script has armed the calendar */
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--sf-sky);
  border-radius: 3px;
  background: #fff;
  color: var(--sf-primary);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.sf-cal.is-armed .sf-cal__nav { display: inline-flex; }
.sf-cal__nav svg { width: 20px; height: 20px; }
.sf-cal__nav:hover:not(:disabled) { background: var(--sf-primary); border-color: var(--sf-primary); color: #fff; }
.sf-cal__nav:focus-visible { outline: 3px solid var(--sf-sky); outline-offset: 2px; }
.sf-cal__nav:disabled { opacity: 0.35; cursor: default; }

/* Without the script every month is shown, so each needs its own heading. */
.sf-cal:not(.is-armed) .sf-cal__sr { position: static; width: auto; height: auto; clip: auto; margin: 18px 0 6px; font: 600 18px var(--sf-font-head); text-align: left; caption-side: top; color: var(--sf-ink); }
.sf-cal.is-armed .sf-cal__month[hidden] { display: none; }
.sf-cal__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.sf-cal__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid var(--sf-sky);
  background: #fff;
}
.sf-cal__table th {
  padding: 10px 6px;
  background: var(--sf-mist);
  border-bottom: 1px solid var(--sf-sky);
  font: 600 12px/1 var(--sf-font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sf-ink-soft);
  text-align: left;
}
.sf-cal__table th abbr { text-decoration: none; }
.sf-cal__cell {
  height: 112px;
  padding: 8px;
  vertical-align: top;
  border: 1px solid #E3EEF3;
  font-family: var(--sf-font-body);
}
.sf-cal__cell--pad { background: #FAFCFD; }
.sf-cal__cell--past .sf-cal__num { color: #9DB0BC; }
.sf-cal__num { display: block; margin: 0 0 6px; font: 500 14px/1 var(--sf-font-body); color: var(--sf-ink); }
.sf-cal__cell--today { background: #F4FAF6; }
.sf-cal__cell--today .sf-cal__num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; margin-bottom: 4px; padding: 0 6px;
  border-radius: 12px; background: var(--sf-green); color: #fff; font-weight: 600;
}

.sf-cal__ev {
  display: block;
  margin: 0 0 4px;
  padding: 5px 7px;
  border-radius: 3px;
  background: var(--sf-primary);
  color: #fff;
  text-decoration: none;
  font: 500 12px/1.3 var(--sf-font-body);
  overflow: hidden;
  transition: background 0.2s;
}
.sf-cal__ev:hover { background: var(--sf-primary-lift); color: #fff; }
.sf-cal__ev:focus-visible { outline: 3px solid var(--sf-sky); outline-offset: 1px; }
.sf-cal__ev--soldout { background: var(--sf-ink-soft); }
.sf-cal__ev-time { display: block; font-weight: 600; opacity: 0.85; }
.sf-cal__ev-name { display: block; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.sf-cal__agenda { display: none; margin: 0; padding: 0; list-style: none; }
.sf-cal__agenda li { margin: 0 0 10px; }
.sf-cal__agenda a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--sf-sky);
  border-left: 4px solid var(--sf-primary);
  border-radius: 3px;
  background: #fff;
  text-decoration: none;
  color: var(--sf-ink);
}
.sf-cal__agenda a:hover { border-left-color: var(--sf-green); }
.sf-cal__ag-when { display: block; margin: 0 0 4px; font: 500 13px/1.3 var(--sf-font-body); color: var(--sf-ink-soft); }
.sf-cal__ag-name { display: block; font: 600 16px/1.3 var(--sf-font-head); }
.sf-cal__none { display: none; margin: 0; color: var(--sf-ink-soft); }

/* Below ~720px of container width: agenda instead of the month table. */
@container (max-width: 719px) {
  .sf-cal__table { display: none; }
  .sf-cal__agenda { display: block; }
  .sf-cal__none { display: block; }
  .sf-cal:not(.is-armed) .sf-cal__sr { display: none; }
}
@supports not (container-type: inline-size) {
  @media (max-width: 719px) {
    .sf-cal__table { display: none; }
    .sf-cal__agenda { display: block; }
    .sf-cal__none { display: block; }
  }
}


/* --------------------------------------------------------------------------
   Compact cards (compact="yes"): topic and date only, ruled not boxed
   -------------------------------------------------------------------------- */
.sf-events__grid--compact { gap: 0 var(--sf-gap); }
.sf-evc {
  display: flex; flex-direction: column; gap: .55rem;
  min-height: 11rem; padding: 1.1rem 0 1.2rem;
  border-top: 2px solid var(--sf-green);
  color: var(--sf-ink); text-decoration: none;
}
.sf-evc__date {
  font: 500 .78rem/1.3 var(--sf-font-body); letter-spacing: .08em; text-transform: uppercase;
  color: var(--sf-primary);
}
.sf-evc__title {
  margin: 0; font: 600 1.25rem/1.3 var(--sf-font-head); color: var(--sf-ink); text-wrap: balance;
}
.sf-evc__go {
  margin-top: auto; display: inline-flex; align-items: center; gap: .4rem;
  font: 500 .95rem/1 var(--sf-font-body); color: var(--sf-green); min-height: 44px;
}
.sf-evc__go svg { width: 1.1rem; height: 1.1rem; transition: transform .25s var(--sf-ease); }
.sf-evc:hover .sf-evc__title, .sf-evc:focus-visible .sf-evc__title { color: var(--sf-primary); }
.sf-evc:hover .sf-evc__go svg, .sf-evc:focus-visible .sf-evc__go svg { transform: translateX(4px); }
.sf-evc:focus-visible { outline: 3px solid var(--sf-primary); outline-offset: 3px; }


/* --------------------------------------------------------------------------
   Empty state under a calendar (1.4.0). The empty month is already the picture, so no box: a heading,
   a line and a link, left-aligned under the grid like the rest of the page.
   -------------------------------------------------------------------------- */

.sf-events__empty--compact {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  text-align: left;
  margin-top: clamp(18px, 2.4vw, 30px);
}
.sf-events__empty--compact h3 { margin: 0 0 6px; font-size: clamp(19px, 2.1vw, 24px); }
.sf-events__empty--compact p  { margin: 0 0 16px; max-width: 62ch; }


/* --------------------------------------------------------------------------
   1.4.1  The theme colours every link, and a single-class "color: #fff" loses to it. The calendar chips and the
   call-to-action button sit on a coloured ground, so they were teal on teal. Say white at a specificity the theme
   cannot beat.
   -------------------------------------------------------------------------- */

.sf-events a.sf-cal__ev,
.sf-events a.sf-cal__ev:hover,
.sf-events a.sf-cal__ev:focus-visible,
.sf-events a.sf-events__cta,
.sf-events a.sf-events__cta:hover,
.sf-events a.sf-events__cta:focus-visible { color: #fff; }
