/*
 * Community Clicker web app (templates/public/clicker/, assets/cep-clicker.js). CEP theme: tokens.css and the
 * community's colour (--cep-brand*, or the visitor's pick). Phone first; centred column on wider screens; safe areas
 * for the native apps' web view; dark mode with data-bs-theme="dark".
 */
body.cep-clicker {
  --cc-radius: 1rem;
  --cc-shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 4px 14px rgba(17, 24, 39, .06);
  --cc-surface: var(--cep-color-surface);
  --cc-page: var(--cep-color-page);
  --cc-text: var(--cep-color-text);
  --cc-muted: var(--cep-color-text-muted);
  --cc-border: var(--cep-color-border);
  --cc-soft: rgba(var(--cep-brand-rgb), .1);
  margin: 0;
  min-height: 100dvh;
  background: var(--cc-page);
  color: var(--cc-text);
  font-family: Inter, var(--cep-font-family);
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}
[data-bs-theme="dark"] body.cep-clicker {
  --cc-surface: #1b2129;
  --cc-page: #11161c;
  --cc-text: #e5e7eb;
  --cc-muted: #9aa4b2;
  --cc-border: #2a323c;
  --cc-shadow: none;
}
body.cep-clicker > .visually-hidden-focusable { display: none; }
body.cep-clicker.cc-has-nav { padding-bottom: 5.5rem; }
.cep-clicker .cc-page p a, .cep-clicker .cc-info-about a, .cep-clicker .cc-sponsors-title a { color: var(--cep-brand); }
.cep-clicker .btn-primary { --bs-btn-bg: var(--cep-brand); --bs-btn-border-color: var(--cep-brand); --bs-btn-hover-bg: var(--cep-brand-dark); --bs-btn-hover-border-color: var(--cep-brand-dark); --bs-btn-active-bg: var(--cep-brand-dark); --bs-btn-color: var(--cep-brand-on); --bs-btn-hover-color: var(--cep-brand-on); }
.cep-clicker .btn-outline-primary { --bs-btn-color: var(--cep-brand); --bs-btn-border-color: var(--cep-brand); --bs-btn-hover-bg: var(--cep-brand); --bs-btn-hover-border-color: var(--cep-brand); --bs-btn-hover-color: var(--cep-brand-on); }
.cep-clicker .text-primary { color: var(--cep-brand) !important; }
.cep-clicker .modal-content, .cep-clicker .offcanvas { background: var(--cc-surface); color: var(--cc-text); }

/* Top bar: transparent on the page; a light frosted background once the page scrolls. */
.cc-top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .35rem;
  min-height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) .5rem 0;
  background: transparent; color: var(--cc-text);
  border-bottom: 1px solid transparent;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.cc-top.is-scrolled {
  background: color-mix(in srgb, var(--cc-page) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom-color: var(--cc-border);
}
.cc-top-btn { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--cc-text); font-size: 1.2rem; text-decoration: none; }
.cc-top-btn:active { background: var(--cc-soft); }
.cep-clicker .cc-back { color: var(--cep-brand); }
.cc-top-actions { margin-left: auto; display: flex; align-items: center; }
.cep-clicker .cc-top-brand { display: flex; align-items: center; gap: .6rem; min-width: 0; padding-left: .5rem; color: var(--cc-text); text-decoration: none; }
.cc-top-logo { flex: none; width: 34px; height: 34px; border-radius: .55rem; object-fit: contain; background: #fff; border: 1px solid var(--cc-border); }
.cc-top-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 1.05rem; color: var(--cc-text); }

/* Menu */
.cc-menu { height: auto !important; max-height: 88dvh; border-radius: 1.2rem 1.2rem 0 0; }
.cc-menu .offcanvas-body { padding-top: 0; padding-bottom: max(1.2rem, env(safe-area-inset-bottom)); }
.cc-menu-head { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.cc-menu-logo { width: 34px; height: 34px; border-radius: .55rem; object-fit: contain; background: #fff; border: 1px solid var(--cc-border); }
.cep-clicker .cc-menu-row { display: flex; align-items: center; gap: .85rem; width: 100%; min-height: 48px; padding: .5rem .6rem; border: 0; border-radius: .7rem; background: transparent; color: var(--cc-text); font-weight: 500; text-align: left; text-decoration: none; }
.cc-menu-row > i:first-child { width: 1.4rem; text-align: center; color: var(--cep-brand); }
.cc-menu-row:active, .cep-clicker .cc-menu-row.is-on { background: var(--cc-soft); }
.cc-menu-go { margin-left: auto; color: var(--cc-muted); font-size: .8rem; }
.cc-settings-sub { margin: .25rem 0 .5rem; font-size: .9rem; color: var(--cc-muted); }

.cc-page { max-width: 640px; margin: 0 auto; padding: .25rem 1rem 1.5rem; }

/* Home */
.cc-hero { position: relative; border-radius: var(--cc-radius); overflow: hidden; background: #222 center / cover no-repeat; box-shadow: var(--cc-shadow); }
.cc-hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .25), rgba(0, 0, 0, .6)); }
.cc-hero-body { position: relative; display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 2rem 1.25rem 1.6rem; text-align: center; }
.cc-hero-logo { width: 96px; height: 96px; object-fit: contain; border-radius: 1rem; background: #fff; padding: .35rem; }
.cc-hero-name { margin: 0; color: #fff; font-size: 1.35rem; font-weight: 700; line-height: 1.25; text-shadow: 0 1px 8px rgba(0, 0, 0, .35); }
.cc-tagline { margin: 1.1rem .5rem 1.2rem; text-align: center; color: var(--cc-muted); font-size: .95rem; }
.cc-tagline strong { color: var(--cep-brand); }

.cc-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
@media (min-width: 560px) { .cc-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cep-clicker .cc-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .55rem;
  min-height: 7.2rem; padding: 1rem .6rem; text-align: center; text-decoration: none;
  background: var(--cc-surface); color: var(--cc-text); border: 1px solid var(--cc-border); border-radius: var(--cc-radius); box-shadow: var(--cc-shadow);
  transition: transform .12s ease;
}
.cc-tile:active { transform: scale(.97); }
.cc-tile-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--cep-brand); color: var(--cep-brand-on); font-size: 1.1rem; }
.cc-tile-label { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.cc-ext { font-size: .7rem; color: var(--cc-muted); }

.cc-sponsors { margin-top: 2rem; text-align: center; }
.cc-sponsors-title { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cc-muted); margin-bottom: 1rem; }
.cc-sponsor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.cc-sponsor { display: grid; place-items: center; padding: .75rem; background: #fff; border-radius: .8rem; border: 1px solid var(--cc-border); }
.cc-sponsor img { width: 100%; max-height: 80px; object-fit: contain; }

/* About and settings */
.cc-info-logo { width: 120px; height: 120px; object-fit: contain; margin: 1rem 0; }
.cc-info-name { color: var(--cep-brand); }
.cc-info-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 1rem 0; }
.cc-info-about { border-top: 1px solid var(--cc-border); padding-top: 1rem; }
.cc-info-about img { max-width: 100%; height: auto; }
.cc-settings-label { margin: 1.1rem 0 .4rem; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cc-muted); }
.cc-swatches { display: flex; gap: .6rem; flex-wrap: wrap; }
.cc-swatch { width: 42px; height: 42px; border-radius: 50%; border: 3px solid transparent; background: var(--sw); color: #fff; outline: 2px solid transparent; }
.cc-swatch.is-on { outline-color: var(--sw); border-color: var(--cc-surface); }
.cc-swatch i { font-size: .8rem; }

/* Bottom navigation (browsers) */
.cc-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; gap: .25rem; padding: .4rem .5rem max(.5rem, env(safe-area-inset-bottom)); background: var(--cc-surface); border-top: 1px solid var(--cc-border); border-radius: 15px 15px 0 0; box-shadow: 0 -4px 14px rgba(0, 0, 0, .06); }
.cep-clicker .cc-nav-btn { flex: 1; max-width: 7rem; display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .35rem 0; font-size: .72rem; font-weight: 600; color: var(--cc-muted); text-decoration: none; border-radius: .6rem; }
.cc-nav-btn i { font-size: 1.15rem; }
.cep-clicker .cc-nav-btn.is-active { color: var(--cep-brand); background: var(--cc-soft); }

/* Directory */
.cc-dir-head { min-width: 0; position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 5; margin: -1rem -1rem .5rem; padding: 1rem 1rem .6rem; background: var(--cc-page); }
.cc-dir-title { font-size: 1.3rem; font-weight: 700; margin: 0 0 .75rem; }
.cc-search { display: flex; align-items: center; gap: .6rem; margin: 0; padding: 0 .35rem 0 1rem; min-height: 50px; background: var(--cc-surface); border: 1.5px solid var(--cc-border); border-radius: 999px; }
.cc-search:focus-within { border-color: var(--cep-brand); }
.cc-search > i { color: var(--cep-brand); }
.cc-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--cc-text); font-size: 1rem; }
.cc-search input::-webkit-search-cancel-button { display: none; }
.cc-search-clear { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--cc-page); color: var(--cc-muted); }
.cc-chips { display: flex; gap: .45rem; overflow-x: auto; padding: .7rem 0 .1rem; scrollbar-width: none; }
.cc-chips::-webkit-scrollbar { display: none; }
.cc-chip { flex: none; padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--cc-border); background: var(--cc-surface); color: var(--cc-text); font-size: .85rem; font-weight: 500; white-space: nowrap; }
.cc-chip.is-on { background: var(--cep-brand); border-color: var(--cep-brand); color: var(--cep-brand-on); }
.cc-count { margin: 0 0 .6rem; font-size: .85rem; color: var(--cc-muted); min-height: 1.3em; }
.cc-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: .65rem; }
.cc-loading { display: grid; place-items: center; padding: 3rem 0; }
.cc-biz { display: flex; align-items: center; gap: .85rem; width: 100%; padding: .7rem; text-align: left; background: var(--cc-surface); color: var(--cc-text); border: 1px solid var(--cc-border); border-radius: var(--cc-radius); box-shadow: var(--cc-shadow); }
.cc-biz:active { transform: scale(.985); }
.cc-biz-pic { flex: none; width: 72px; height: 72px; border-radius: .8rem; overflow: hidden; display: grid; place-items: center; background: var(--cc-soft); color: var(--cep-brand); font-weight: 700; font-size: 1.3rem; }
.cc-biz-pic img { width: 100%; height: 100%; object-fit: cover; }
.cc-biz-pic img.is-logo { object-fit: contain; background: #fff; }
.cc-biz-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.cc-biz-name { font-weight: 700; line-height: 1.25; }
.cc-biz-meta { font-size: .82rem; color: var(--cc-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-biz-go { color: var(--cc-muted); font-size: .85rem; }
.cc-badge { display: inline-block; vertical-align: middle; margin-left: .3rem; padding: .1rem .45rem; border-radius: 999px; background: var(--cep-color-accent); color: #fff; font-size: .65rem; font-weight: 700; }
.cc-empty { text-align: center; padding: 2.5rem 1rem; color: var(--cc-muted); }
.cc-empty i { display: block; font-size: 2rem; margin-bottom: .75rem; opacity: .5; }

/* Business details */
.cc-biz-close { position: absolute; top: max(.75rem, env(safe-area-inset-top)); right: .75rem; z-index: 3; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #111; box-shadow: var(--cc-shadow); font-size: 1.2rem; }
.cc-gallery { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; scroll-snap-type: x mandatory; aspect-ratio: 16 / 10; background: var(--cc-soft); scrollbar-width: none; }
.cc-gallery img { width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; }
.cc-detail { padding: 1.2rem 1.1rem 1.6rem; }
.cc-detail-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; padding-right: 2.5rem; }
.cc-gallery + .cc-detail .cc-detail-head { padding-right: 0; }
.cc-detail-logo { width: 64px; height: 64px; object-fit: contain; border-radius: .8rem; background: #fff; border: 1px solid var(--cc-border); }
.cc-detail-name { margin: 0; font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.cc-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.cc-tag { padding: .15rem .55rem; border-radius: 999px; background: var(--cc-soft); color: var(--cep-brand); font-size: .75rem; font-weight: 600; }
.cc-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .5rem; margin-bottom: 1.1rem; }
.cep-clicker .cc-action { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .7rem .25rem; border: 0; border-radius: .9rem; background: var(--cc-soft); color: var(--cep-brand); font-size: .78rem; font-weight: 600; text-decoration: none; }
.cc-action i { font-size: 1.15rem; }
.cc-detail-line { display: flex; gap: .7rem; margin: 0 0 .55rem; }
.cc-detail-line i { width: 1.1rem; margin-top: .2rem; color: var(--cep-brand); text-align: center; }
.cc-detail-about { margin: 1rem 0 1.25rem; line-height: 1.6; }

/* Not available */
.cc-unavailable { padding: 3rem 1rem; text-align: center; }
.cc-unavailable-icon { display: grid; place-items: center; width: 84px; height: 84px; margin: 0 auto 1.5rem; border-radius: 50%; background: var(--cc-surface); color: var(--cep-brand); font-size: 2rem; box-shadow: var(--cc-shadow); }
.cc-unavailable p { color: var(--cc-muted); margin-bottom: 1.5rem; }

@media (prefers-reduced-motion: reduce) { .cc-tile, .cc-biz { transition: none; } }

/* Events */
.cc-event-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: .65rem; }
.cc-month { margin: .9rem 0 .1rem; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cc-muted); }
.cc-month:first-child { margin-top: 0; }
.cc-event { display: flex; align-items: center; gap: .85rem; width: 100%; padding: .75rem; text-align: left; background: var(--cc-surface); color: var(--cc-text); border: 1px solid var(--cc-border); border-radius: var(--cc-radius); box-shadow: var(--cc-shadow); }
.cc-event:active { transform: scale(.985); }
.cc-date { flex: none; width: 56px; border-radius: .7rem; overflow: hidden; text-align: center; border: 1px solid var(--cc-border); background: var(--cc-surface); }
.cc-date-m { display: block; padding: .15rem 0; background: var(--cep-brand); color: var(--cep-brand-on); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.cc-date-d { display: block; padding: .2rem 0 .3rem; font-size: 1.35rem; font-weight: 700; color: var(--cc-text); }
.cc-event .cc-biz-meta { white-space: normal; }
.cc-event .cc-biz-meta i { width: 1rem; color: var(--cep-brand); }
.cc-event-thumb { flex: none; width: 64px; height: 64px; border-radius: .7rem; object-fit: cover; }
.cc-event-hero { display: block; width: 100%; max-height: 42dvh; object-fit: cover; background: var(--cc-soft); }
.cc-detail-about { white-space: pre-line; }

/* Offers and marketplace cards */
.cc-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 560px) { .cc-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cc-card { display: flex; flex-direction: column; width: 100%; padding: 0; overflow: hidden; text-align: left; background: var(--cc-surface); color: var(--cc-text); border: 1px solid var(--cc-border); border-radius: var(--cc-radius); box-shadow: var(--cc-shadow); }
.cc-card:active { transform: scale(.98); }
.cc-card-pic { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--cc-soft); color: var(--cep-brand); font-weight: 700; font-size: 1.4rem; }
.cc-card-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cc-card-body { display: flex; flex-direction: column; gap: .2rem; padding: .65rem .7rem .8rem; min-width: 0; }
.cc-card-title { font-weight: 700; font-size: .92rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-card-sub { font-size: .8rem; font-weight: 700; color: var(--cep-brand); }
.cc-price { font-size: 1.35rem; font-weight: 700; color: var(--cep-brand); margin: 0 0 .75rem; }
.cc-html { margin: 1rem 0 1.25rem; line-height: 1.6; overflow-wrap: anywhere; }
.cc-html img { max-width: 100%; height: auto; }
.cc-fine { margin: 0 0 1.25rem; padding: .75rem .9rem; border-radius: .75rem; background: var(--cc-page); color: var(--cc-muted); font-size: .85rem; }
.cc-section .cc-biz-meta i { width: 1rem; color: var(--cep-brand); }
