/* =====================================================================
   MEC Demos Showcase
   EVERY rule is scoped under .mecd (specificity >= 0,2,0) so active
   theme styles (Kata etc.) can never override the showcase.
   Fonts still inherit from the active WordPress theme.
   .mecd        = the shortcode wrapper element
   .mecd.mecd-x = same element also carrying .mecd-x (root / standalone search)
   .mecd .mecd-x = a descendant
   ===================================================================== */

.mecd{
  --mecd-brand:#008aff;
  --mecd-brand-2:#837af5;
  --mecd-cyan:#40d9f0;
  --mecd-ink:#1b1e2f;
  --mecd-muted:#69727d;
  --mecd-muted-2:#9aa1ab;
  --mecd-line:#e3e5e7;
  --mecd-line-soft:#eef0f4;
  --mecd-bg-soft:#f7f8fb;
  --mecd-bg-soft-2:#f1f3f8;
  --mecd-grad:linear-gradient(120deg,#008aff 0%,#837af5 100%);
  --mecd-grad-soft:linear-gradient(120deg,rgba(0,138,255,.12),rgba(131,122,245,.12));
  --mecd-shadow-sm:0 1px 2px rgba(27,30,47,.05);
  --mecd-shadow-md:0 4px 14px rgba(27,30,47,.07);
  --mecd-shadow-lg:0 10px 28px rgba(27,30,47,.10);
  --mecd-cols:4;
  /* offset for a fixed theme header; override e.g. .mecd{--mecd-sticky-top:90px} */
  --mecd-sticky-top:0px;

  font-family:inherit;
  color:var(--mecd-ink);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  box-sizing:border-box;
}
.mecd,.mecd *,.mecd *::before,.mecd *::after{box-sizing:border-box;font-family:inherit}
.mecd a{color:inherit;text-decoration:none}
.mecd ::selection{background:rgba(131,122,245,.25)}

.mecd.mecd-root{width:100%;max-width:100%;overflow:visible}

/* accessible visually-hidden label */
.mecd .mecd-sr-only{
  position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0
}

/* ===== Filter bar (tabs + optional inline search) — sticky ===== */
.mecd .mecd-filterbar{
  position:sticky;top:var(--mecd-sticky-top,0px);z-index:1;
  background:#fff;margin:0 0 4px;padding:12px 0;
  display:flex;align-items:center;justify-content:space-between;
  gap:18px;flex-wrap:wrap;
  border-bottom:1px solid var(--mecd-line-soft)
}
.mecd .mecd-filters{flex:1 1 auto;display:flex;gap:9px;padding:6px 0;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.mecd .mecd-filters::-webkit-scrollbar{display:none}
.mecd .mecd-chip{
  flex:0 0 auto;font:600 15px/1 inherit;color:var(--mecd-muted);
  margin:0;padding:10px 16px;border-radius:999px;border:1px solid var(--mecd-line);background:#fff;
  cursor:pointer;white-space:nowrap;text-transform:none;letter-spacing:normal;
  transition:color .16s,background .16s,border-color .16s
}
.mecd .mecd-chip:hover{background:var(--mecd-ink);color:#fff;border-color:var(--mecd-ink)}
.mecd .mecd-chip:focus-visible{outline:2px solid var(--mecd-brand-2);outline-offset:2px}
.mecd .mecd-chip.mecd-active{background:var(--mecd-ink);color:#fff;border-color:var(--mecd-ink)}

/* ===== Search box (clean, minimal — icon inside on the left) =====
   Dual form: descendant (inline in [mec_demos]) AND same element
   (standalone [mec_demos_search] wrapper). */
.mecd .mecd-search,
.mecd.mecd-search{position:relative;flex:0 0 auto;width:316px;max-width:100%}
.mecd .mecd-search>svg,
.mecd.mecd-search>svg{
  position:absolute;left:16px;top:50%;transform:translateY(-50%);
  width:18px;height:18px;color:var(--mecd-muted-2);pointer-events:none
}
.mecd .mecd-search input,
.mecd.mecd-search input{
  width:100%;height:60px;margin:0;padding:0 16px 0 46px;border:1px solid var(--mecd-line);border-radius:12px;
  font:400 15px/1.3 inherit;background:#fff;color:var(--mecd-ink);
  box-shadow:0 1px 2px rgba(27,30,47,.05);   /* explicit, non-inset, light */
  -webkit-appearance:none;appearance:none;
  transition:border-color .2s ease,box-shadow .2s ease
}
.mecd .mecd-search input::placeholder,
.mecd.mecd-search input::placeholder{color:var(--mecd-muted-2)}
.mecd .mecd-search input::-webkit-search-cancel-button,
.mecd.mecd-search input::-webkit-search-cancel-button{-webkit-appearance:none}
.mecd .mecd-search input:focus,
.mecd.mecd-search input:focus{outline:none;border-color:var(--mecd-brand);box-shadow:0 0 0 4px rgba(0,138,255,.14)}

/* hero variant: same 60px height, slightly larger radius */
.mecd .mecd-search--hero>svg,
.mecd.mecd-search--hero>svg{left:20px;width:19px;height:19px}
.mecd .mecd-search--hero input,
.mecd.mecd-search--hero input{padding:0 18px 0 52px;border-radius:14px;font-size:15.5px}

@media (max-width:620px){
  .mecd .mecd-filterbar .mecd-search{width:100%;order:-1}
}

/* ===== Section headings ===== */
.mecd .mecd-block{padding:46px 0 4px}
.mecd .mecd-sec-head{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:24px;gap:18px;flex-wrap:wrap}
.mecd .mecd-sec-head .mecd-t{display:flex;align-items:center;gap:13px}
.mecd .mecd-sec-ic{width:40px;height:40px;border-radius:11px;background:var(--mecd-grad-soft);display:grid;place-items:center;color:var(--mecd-brand);flex:0 0 auto}
.mecd .mecd-sec-ic svg{width:20px;height:20px}
.mecd .mecd-sec-head h2{font-size:22px;font-weight:800;letter-spacing:-.02em;margin:0;color:var(--mecd-ink)}
.mecd .mecd-sec-head .mecd-sub{font-size:13px;color:var(--mecd-muted);margin-top:2px}
.mecd .mecd-count-pill{font:600 12.5px/1 inherit;color:var(--mecd-muted);background:var(--mecd-bg-soft-2);padding:6px 12px;border-radius:999px;white-space:nowrap}

/* ===== Demo grid (no feature image, preview on hover) =====
   Responsive columns (mobile-first, unambiguous boundaries):
     < 480px          -> 1
     480px – 767px    -> 2
     768px – 1023px   -> 3
     >= 1024px        -> 4 (or the `columns` shortcode value)
*/
.mecd .mecd-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;margin:0;padding:0;list-style:none}
@media (min-width:480px){.mecd .mecd-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (min-width:768px){.mecd .mecd-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (min-width:1024px){.mecd .mecd-grid{grid-template-columns:repeat(var(--mecd-cols),minmax(0,1fr))}}

.mecd .mecd-card{
  position:relative;display:flex;align-items:center;gap:13px;margin:0;padding:15px 16px;
  border:1px solid var(--mecd-line);border-radius:14px;background:#fff;cursor:pointer;
  box-shadow:none;                    /* explicit: override theme inset shadow */
  transition:transform .18s cubic-bezier(.2,.7,.3,1),box-shadow .2s,border-color .2s
}
.mecd .mecd-card:hover,.mecd .mecd-card:focus-visible{transform:translateY(-3px);border-color:transparent;box-shadow:var(--mecd-shadow-md);z-index:5;outline:none}
.mecd .mecd-card-ic{flex:0 0 auto;width:42px;height:42px;border-radius:11px;background:var(--mecd-bg-soft);display:grid;place-items:center;color:var(--mecd-brand);transition:background .2s,color .2s}
.mecd .mecd-card:hover .mecd-card-ic,.mecd .mecd-card:focus-visible .mecd-card-ic{background:var(--mecd-grad);color:#fff}
.mecd .mecd-card-ic svg{width:20px;height:20px}
.mecd .mecd-card-tx{min-width:0;flex:1}
.mecd .mecd-nm{display:block;font-size:14.5px;font-weight:600;letter-spacing:-.01em;color:var(--mecd-ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mecd .mecd-ct{display:block;font-size:12px;color:var(--mecd-muted-2);font-weight:500;margin-top:2px}
.mecd .mecd-card-arrow{flex:0 0 auto;width:20px;height:20px;color:var(--mecd-muted-2);opacity:0;transform:translateX(-4px);transition:opacity .18s,transform .18s}
.mecd .mecd-card:hover .mecd-card-arrow,.mecd .mecd-card:focus-visible .mecd-card-arrow{opacity:1;transform:translateX(0);color:var(--mecd-brand)}

/* hover preview popover — opens UPWARD; z-index above the sticky bar */
.mecd .mecd-preview{
  position:absolute;left:50%;bottom:calc(100% + 12px);transform:translate(-50%,8px) scale(.96);
  width:300px;height:188px;border-radius:13px;background:#fff;border:1px solid var(--mecd-line);
  box-shadow:var(--mecd-shadow-lg);padding:0;opacity:0;pointer-events:none;
  transition:opacity .2s,transform .2s;overflow:hidden;z-index:40
}
.mecd .mecd-card:hover .mecd-preview,.mecd .mecd-card:focus-visible .mecd-preview{opacity:1;transform:translate(-50%,0) scale(1)}
.mecd .mecd-preview::after{content:"";position:absolute;left:50%;bottom:-7px;width:14px;height:14px;background:#fff;border-right:1px solid var(--mecd-line);border-bottom:1px solid var(--mecd-line);transform:translateX(-50%) rotate(45deg);z-index:2}
.mecd .mecd-preview-img{display:block;width:100%;height:100%;object-fit:cover;border-radius:13px;margin:0;max-width:none}

/* ===== Empty state ===== */
.mecd .mecd-empty{text-align:center;padding:64px 0;color:var(--mecd-muted)}
.mecd .mecd-empty[hidden]{display:none}
.mecd .mecd-empty svg{width:38px;height:38px;color:var(--mecd-muted-2);margin-bottom:12px}
.mecd .mecd-empty-t{font-weight:700;color:var(--mecd-ink);font-size:17px;margin-bottom:6px}

/* ===== Below 1024px (and on any touch device) =====
   Show the preview as a feature image ON TOP of the card content
   (grid-card style) instead of a hover popover. */
@media (max-width:1023.98px),(hover:none),(pointer:coarse){
  .mecd .mecd-card{flex-wrap:wrap;align-items:center;-webkit-tap-highlight-color:transparent}
  .mecd .mecd-preview,
  .mecd .mecd-card:hover .mecd-preview,
  .mecd .mecd-card:focus-visible .mecd-preview{
    position:static;order:-1;flex:0 0 100%;width:100%;height:auto;aspect-ratio:16/10;
    opacity:1;transform:none;pointer-events:none;box-shadow:none;border:0;border-radius:10px;
    margin:0 0 12px;overflow:hidden;z-index:auto
  }
  .mecd .mecd-preview::after{display:none}
  .mecd .mecd-preview-img{width:100%;height:100%}
  .mecd .mecd-card:active{transform:translateY(-1px);box-shadow:var(--mecd-shadow-sm)}
}

/* ===== Filtering state ===== */
.mecd .mecd-hidden{display:none!important}

/* ===== Motion / accessibility ===== */
@media (prefers-reduced-motion:reduce){
  .mecd *{transition:none!important;animation:none!important}
  .mecd .mecd-card:hover,.mecd .mecd-card:focus-visible{transform:none}
  .mecd .mecd-preview{transition:opacity .15s}
}
