/* ==========================================================================
   Hope Chapel calendar -- Variant B (month grid / mobile day picker)
   Everything is scoped under .hopecal so it cannot leak into the rt-hope theme
   and the theme cannot leak into it. No web fonts: we inherit the page's.
   ========================================================================== */

.hopecal {
  --hc-ink:      #23301c;
  --hc-green:    #3f5233;
  --hc-sage:     #6b7d5e;
  --hc-sage-2:   #a9b89c;
  --hc-line:     #d9e0d1;
  --hc-line-2:   #e8ede3;
  --hc-wash:     #f2f5ee;
  --hc-paper:    #fff;
  --hc-paper-2:  #fbfcf9;
  --hc-gold:     #b58a2e;
  --hc-radius:   10px;
  --hc-tap:      44px;              /* minimum touch target, everywhere */
  --hc-dot:      var(--hc-sage-2);

  color: var(--hc-ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

/* The mockup relied on `hidden` alone; a class rule like `.hc-grid{display:block}`
   out-specifies the UA [hidden] style and the panel stayed on screen. */
.hopecal [hidden] { display: none !important; }

.hopecal *, .hopecal *::before, .hopecal *::after { box-sizing: border-box; }

.hopecal button { font: inherit; color: inherit; }

.hopecal :focus-visible {
  outline: 3px solid var(--hc-gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------------------------------------------ audience
   Colour is ALWAYS accompanied by the ministry name in text. Never colour alone. */
.hopecal [data-aud="community"]  { --hc-dot: #7a9a5e; }
.hopecal [data-aud="kids"]       { --hc-dot: #e0913f; }
.hopecal [data-aud="students"]   { --hc-dot: #4e8fa8; }
.hopecal [data-aud="women"]      { --hc-dot: #b2688f; }
.hopecal [data-aud="men"]        { --hc-dot: #4a6b8a; }
.hopecal [data-aud="groups"]     { --hc-dot: #8a6fae; }
.hopecal [data-aud="arts"]       { --hc-dot: #c2603f; }
.hopecal [data-aud="serve"]      { --hc-dot: #4f9184; }
.hopecal [data-aud="rentals"]    { --hc-dot: #97a08d; }
.hopecal [data-aud="observance"] { --hc-dot: #b58a2e; }

/* ================================================================== toolbar */
.hc-toolbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--hc-line);
  padding: 8px 0;
  margin-bottom: 14px;
}
@supports (backdrop-filter: blur(8px)) {
  .hc-toolbar { backdrop-filter: saturate(150%) blur(10px); }
}

.hc-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.hc-month {
  margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em;
  flex: 1 1 auto; min-width: 0;
}
.hc-month span { color: var(--hc-sage); font-weight: 400; }

.hc-pager { display: flex; gap: 4px; flex: 0 0 auto; order: -1; }
.hc-pgbtn {
  width: var(--hc-tap); height: var(--hc-tap); border-radius: 50%;
  border: 1.5px solid var(--hc-line); background: var(--hc-paper);
  cursor: pointer; display: grid; place-items: center; font-size: 18px;
  color: var(--hc-green);
}
.hc-pgbtn:hover { background: var(--hc-wash); }
.hc-pgbtn[disabled] { opacity: .3; cursor: not-allowed; }

.hc-today {
  min-height: var(--hc-tap); padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--hc-sage-2); background: var(--hc-paper);
  color: var(--hc-green); font-size: 13px; font-weight: 700; cursor: pointer;
  flex: 0 0 auto;
}
.hc-today:hover { background: var(--hc-wash); }

.hc-views {
  display: inline-flex; background: var(--hc-wash); border-radius: 999px;
  padding: 3px; gap: 2px; flex: 0 0 auto;
}
.hc-views button {
  min-height: 38px; padding: 0 16px; border: 0; border-radius: 999px;
  background: transparent; cursor: pointer; color: var(--hc-sage);
  font-size: 13px; font-weight: 700;
}
.hc-views button[aria-selected="true"] { background: var(--hc-ink); color: #fff; }

/* ---- filters ------------------------------------------------------------
   Ten ministries wrap to four rows on a phone and push the calendar off screen.
   On mobile this is a single swipeable row; on desktop it wraps freely. */
.hc-filterbar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

.hc-filters {
  display: flex; gap: 6px; flex: 1 1 auto; min-width: 0;
  overflow-x: auto; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding-bottom: 2px;
  /* Fade the right edge so a phone user can SEE there are more ministries.
     A hard clip at the viewport edge reads as "that is all of them". */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent);
}
.hc-filters::-webkit-scrollbar { display: none; }

.hc-chip {
  display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto;
  scroll-snap-align: start;
  min-height: 38px; padding: 0 13px; border-radius: 999px;
  border: 1.5px solid var(--hc-line); background: var(--hc-paper);
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--hc-green);
  white-space: nowrap;
}
.hc-chip .hc-sw {
  width: 10px; height: 10px; border-radius: 3px; background: var(--hc-dot);
  flex: 0 0 auto;
}
.hc-chip[aria-pressed="false"] { opacity: .45; background: var(--hc-paper-2); }
.hc-chip[aria-pressed="true"]  { border-color: var(--hc-sage-2); background: var(--hc-wash); }
.hc-chip:hover { border-color: var(--hc-sage); }

.hc-reset {
  flex: 0 0 auto; min-height: 38px; padding: 0 12px; border-radius: 999px;
  border: 0; background: none; color: var(--hc-sage); cursor: pointer;
  font-size: 12.5px; font-weight: 700; text-decoration: underline;
}

@media (min-width: 900px) {
  .hc-month  { font-size: 27px; flex: 0 0 auto; }
  .hc-pager  { order: 0; }
  .hc-views  { margin-left: auto; }
  .hc-filters {
    flex-wrap: wrap; overflow: visible;
    -webkit-mask-image: none; mask-image: none;
  }
}

/* ============================================================ desktop grid */
.hc-grid { display: none; }

@media (min-width: 900px) {
  .hc-grid { display: block; }
  .hc-gh {
    display: grid; grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--hc-line);
  }
  .hc-gh div {
    padding: 8px 10px; font-size: 11px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase; color: var(--hc-sage);
  }
  .hc-gb {
    display: grid; grid-template-columns: repeat(7, 1fr);
    border-left: 1px solid var(--hc-line-2); border-top: 1px solid var(--hc-line-2);
  }
  .hc-cell {
    min-height: 128px; padding: 6px 6px 8px;
    border-right: 1px solid var(--hc-line-2); border-bottom: 1px solid var(--hc-line-2);
  }
  .hc-cell.is-out { background: var(--hc-paper-2); }
  .hc-cell.is-out .hc-dn { opacity: .4; }
  .hc-cell.is-today { background: #fffdf3; box-shadow: inset 0 0 0 2px var(--hc-gold); }
  .hc-dn {
    font-size: 12.5px; font-weight: 700; color: var(--hc-sage); margin-bottom: 4px;
    display: flex; justify-content: space-between; align-items: baseline;
  }
  .hc-cell.is-today .hc-dn { color: var(--hc-gold); }
  .hc-cell.is-today .hc-dn::after { content: "TODAY"; font-size: 8.5px; letter-spacing: .1em; }

  .hc-ev {
    display: block; width: 100%; text-align: left; margin-bottom: 3px;
    padding: 4px 6px 5px; border: 0; border-left: 3px solid var(--hc-dot);
    border-radius: 4px; background: var(--hc-wash); cursor: pointer;
  }
  .hc-ev:hover { background: #e7ede0; }
  .hc-ev .hc-t {
    display: block; font-size: 10.5px; font-weight: 700; color: var(--hc-green);
    font-variant-numeric: tabular-nums;
  }
  .hc-ev .hc-n {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; font-size: 13px; line-height: 1.25;
  }
  .hc-more {
    border: 0; background: none; cursor: pointer; padding: 3px 5px;
    font-size: 10.5px; font-weight: 700; color: var(--hc-sage);
  }
  .hc-more:hover { color: var(--hc-ink); text-decoration: underline; }
}

/* ============================================== mobile month -> day picker */
.hc-strip { margin-bottom: 4px; }
@media (min-width: 900px) { .hc-strip { display: none; } }

.hc-sh { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 4px; }
.hc-sh div {
  text-align: center; font-size: 10px; font-weight: 700;
  letter-spacing: .06em; color: var(--hc-sage);
}
.hc-sb { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }

/* No `aspect-ratio` here. Paired with `min-height`, the box derives its WIDTH
   from its height and ignores the 1fr grid track -- 7 cells then measured 327px
   inside a 320px iPhone SE and panned the whole page sideways. Height alone
   keeps the tap target and lets the track decide the width. */
.hc-day {
  min-height: var(--hc-tap); min-width: 0; padding: 0;
  border: 0; border-radius: 10px; background: var(--hc-paper-2);
  cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  font-size: 15px; font-weight: 600; color: var(--hc-green);
}
.hc-day.is-out { color: var(--hc-sage-2); background: transparent; }
.hc-day.is-today { box-shadow: inset 0 0 0 2px var(--hc-gold); }
.hc-day[aria-pressed="true"] { background: var(--hc-ink); color: #fff; }
.hc-day[disabled] { cursor: default; opacity: .55; }

.hc-dots { display: flex; gap: 2px; height: 6px; align-items: center; }
.hc-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--hc-dot); }
.hc-dots b {
  font-size: 8.5px; font-weight: 700; font-style: normal;
  color: var(--hc-sage); line-height: 1;
}
.hc-day[aria-pressed="true"] .hc-dots i { box-shadow: 0 0 0 1px rgba(255,255,255,.75); }
.hc-day[aria-pressed="true"] .hc-dots b { color: rgba(255,255,255,.8); }

/* ==================================================== day heading + cards */
.hc-picked {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 10px; font-size: 12px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--hc-sage);
}
.hc-picked::after { content: ""; flex: 1; height: 1px; background: var(--hc-line); }

.hc-cards { display: flex; flex-direction: column; gap: 10px; }

.hc-card {
  background: var(--hc-paper); border: 1px solid var(--hc-line);
  border-left: 4px solid var(--hc-dot); border-radius: var(--hc-radius);
  padding: 13px 14px;
}
.hc-card h3 { margin: 0 0 5px; font-size: 18px; font-weight: 600; line-height: 1.25; }
/* A single-line title is a 22px-tall link -- the most obvious thing to tap on a
   card and the easiest to miss with a thumb. Padding gets it over the 32px
   floor without moving the text. */
.hc-card h3 a {
  color: inherit; text-decoration: none;
  display: inline-block; padding: 5px 0; margin: -5px 0;
}
.hc-card h3 a:hover { text-decoration: underline; }

.hc-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--hc-sage);
}
.hc-eyebrow::before {
  content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--hc-dot);
}
.hc-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: #7a5c12; background: #fdf3dc; border-radius: 4px; padding: 3px 7px;
}
.hc-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }

.hc-when  { font-size: 13.5px; font-weight: 700; color: var(--hc-green); }
.hc-where { font-size: 13px; color: var(--hc-sage); }
.hc-blurb {
  margin: 8px 0 0; font-size: 14.5px; color: var(--hc-sage); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hc-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.hc-act {
  min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px;
  border-radius: 7px; border: 1px solid var(--hc-line); background: var(--hc-paper-2);
  font-size: 13px; font-weight: 600; color: var(--hc-green);
  cursor: pointer; text-decoration: none;
}
.hc-act:hover { background: var(--hc-wash); border-color: var(--hc-sage-2); }
.hc-act.is-primary { background: var(--hc-ink); border-color: var(--hc-ink); color: #fff; }
.hc-act.is-primary:hover { background: var(--hc-green); }

.hc-empty { color: var(--hc-sage); padding: 22px 2px; }
.hc-empty button {
  border: 0; background: none; padding: 0; color: var(--hc-green);
  text-decoration: underline; cursor: pointer; font-weight: 600;
}

.hc-loadmore {
  display: block; width: 100%; min-height: var(--hc-tap); margin-top: 14px;
  border: 1.5px solid var(--hc-line); border-radius: 999px; background: var(--hc-paper);
  cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--hc-green);
}
.hc-loadmore:hover { background: var(--hc-wash); }

/* ============================================================ detail sheet */
.hc-sheet {
  border: 0; padding: 0; background: transparent; max-width: 540px; width: 100%;
  margin: auto auto 0;                   /* bottom sheet on phones */
}
.hc-sheet::backdrop { background: rgba(27, 35, 21, .55); }
.hc-sheetin {
  background: #fff; border-radius: 16px 16px 0 0; padding: 20px;
  border-top: 5px solid var(--hc-dot); position: relative;
  max-height: 88vh; overflow-y: auto;
}
@media (min-width: 720px) {
  .hc-sheet   { margin: auto; }
  .hc-sheetin { border-radius: 14px; }
}
.hc-sheetin h2 { margin: 10px 0; font-size: 24px; font-weight: 600; line-height: 1.22; }
.hc-row {
  display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hc-line-2);
  font-size: 14px;
}
.hc-row b {
  flex: 0 0 74px; color: var(--hc-sage); font-size: 11px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; padding-top: 3px;
}
.hc-sheetin p { margin: 12px 0 0; font-size: 15.5px; color: var(--hc-green); }
.hc-close {
  position: absolute; right: 12px; top: 12px;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--hc-wash); cursor: pointer; font-size: 20px; color: var(--hc-green);
}

/* Older Safari has no <dialog>; the JS adds .hc-fallback and we hand-build it. */
.hc-sheet.hc-fallback {
  display: none; position: fixed; inset: 0; z-index: 1000;
  margin: 0; max-width: none; background: rgba(27, 35, 21, .55);
  align-items: flex-end; justify-content: center;
}
.hc-sheet.hc-fallback[open] { display: flex; }
.hc-sheet.hc-fallback .hc-sheetin { max-width: 540px; width: 100%; }
@media (min-width: 720px) { .hc-sheet.hc-fallback { align-items: center; } }

/* =================================================================== misc */
.hc-skip {
  position: absolute; left: -9999px;
  background: var(--hc-ink); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.hc-skip:focus { left: 0; top: 0; z-index: 100; }

.hc-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.hc-noscript {
  padding: 14px 16px; background: var(--hc-wash); border-radius: var(--hc-radius);
  margin-bottom: 16px; color: var(--hc-green);
}

@media (prefers-reduced-motion: reduce) {
  .hopecal *, .hopecal *::before, .hopecal *::after {
    animation-duration: .001ms !important; transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .hc-toolbar, .hc-filterbar, .hc-actions, .hc-loadmore, .hc-sheet { display: none !important; }
  .hc-card { break-inside: avoid; border-left-width: 2px; }
}

/* ------------------------------------------------------------------
   Host-template width correction.
   rt-hope's default page.php renders content inside .grid_8 (two-thirds,
   floated left) next to an empty .grid_4 sidebar, which leaves the
   calendar narrow and visually off-centre. The body class is only added
   on pages that actually contain the [hope_calendar] shortcode, so this
   cannot affect any other page on the site.
   ------------------------------------------------------------------ */
body.hopecal-fullwidth .col1_wrap > .grid_8.hcc {
    float: none;
    width: auto;
}
body.hopecal-fullwidth .col1_wrap > .grid_4.hcc {
    display: none;
}

/* ------------------------------------------------------------------
   Escape hatch on a ministry-filtered calendar page.
   The per-ministry pages (/calendar/jr-high/, /calendar/men/, …) show a
   subset, so they always need a way back to everything. Only rendered
   when the shortcode was given a `cats` list.
   ------------------------------------------------------------------ */
.hc-allcal {
  margin: 18px 0 0;
  font-size: 15px;
  line-height: var(--hc-tap);
}
.hc-allcal a {
  color: var(--hc-green);
  text-decoration: none;
  border-bottom: 1px solid var(--hc-line);
  padding-bottom: 2px;
}
.hc-allcal a:hover,
.hc-allcal a:focus {
  color: var(--hc-ink);
  border-bottom-color: var(--hc-sage);
}
