/* ============================================================
   Maine Folk Music Co-op — Plugin Styles v1.1
   ============================================================ */

/* ── Shared buttons ── */
.mfmc-btn {
    display: inline-block;
    padding: .4rem 1rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: .85rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background .15s, color .15s;
    font-family: inherit;
}
.mfmc-btn-primary    { background: #4a7c2f; color: #fff; }
.mfmc-btn-primary:hover { background: #365c21; color: #fff; }
.mfmc-btn-secondary  { background: #eaf2e0; color: #2c3e1e; border: 1px solid #4a7c2f; }
.mfmc-btn-secondary:hover { background: #d4e8b8; }
.mfmc-btn-directions { background: #1a5276; color: #fff; }
.mfmc-btn-directions:hover { background: #123a58; color: #fff; }
.mfmc-icon { margin-right: .3rem; }

/* ============================================================
   EVENTS — Front Page
   ============================================================ */
.mfmc-events-section { margin: 1.5rem 0; }

.mfmc-section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c3e1e;
    border-bottom: 2px solid #4a7c2f;
    padding-bottom: .35rem;
    margin-bottom: 1.2rem;
}

.mfmc-events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
}

.mfmc-event-card {
    border: 1px solid #dde8cd;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,.07);
    transition: box-shadow .2s, transform .2s;
}
.mfmc-event-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); transform: translateY(-2px); }

.mfmc-event-poster-wrap img { width:100%; height:180px; object-fit:cover; display:block; }

.mfmc-event-body { padding: .9rem 1rem 1rem; }
.mfmc-event-title { font-size: 1rem; margin: 0 0 .5rem; }
.mfmc-event-title a { color: #2c3e1e; text-decoration: none; }
.mfmc-event-title a:hover { color: #4a7c2f; }
.mfmc-event-date,
.mfmc-event-time,
.mfmc-event-location { font-size: .83rem; color: #555; margin-bottom: .3rem; }
.mfmc-event-location small { color: #888; }
.mfmc-event-excerpt { font-size: .82rem; color: #555; margin: .5rem 0 .7rem; line-height: 1.5; }
.mfmc-event-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.mfmc-no-events { color: #777; font-style: italic; }

/* ============================================================
   EVENTS — Single Event Page
   ============================================================ */
.mfmc-event-detail { margin-bottom: 1.2rem; }
.mfmc-event-detail-meta {
    background: #f3f8eb;
    border-left: 4px solid #4a7c2f;
    border-radius: 4px;
    padding: .9rem 1.1rem;
    margin-bottom: 1rem;
}
.mfmc-detail-row { font-size: .9rem; margin-bottom: .45rem; }
.mfmc-detail-row:last-child { margin-bottom: 0; }

/* ============================================================
   EVENTS — Archive Sidebar Widget
   ============================================================ */
.mfmc-archive-list { list-style: none; margin: 0; padding: 0; }
.mfmc-archive-month { border-bottom: 1px solid #eee; }
.mfmc-archive-toggle {
    background: none; border: none; cursor: pointer;
    font-size: .88rem; font-weight: 600; color: #2c3e1e;
    padding: .4rem 0; text-align: left; width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    font-family: inherit;
}
.mfmc-archive-toggle:hover { color: #4a7c2f; }
.mfmc-arch-count { font-weight: 400; font-size: .78rem; color: #999; }
.mfmc-archive-events { list-style: none; margin: .2rem 0 .4rem .8rem; padding: 0; border-left: 2px solid #dde8cd; padding-left: .6rem; }
.mfmc-archive-events li { margin-bottom: .3rem; font-size: .82rem; }
.mfmc-archive-events a { color: #1a5276; text-decoration: none; }
.mfmc-archive-events a:hover { text-decoration: underline; }

/* ============================================================
   TUNES — Library Table
   ============================================================ */
.mfmc-tunes-library { margin: 0; }

/* Tune card grid — 2 columns */
.mfmc-tunes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 10px;
}

.mfmc-tune-card {
    background: #fff;
    border: 1px solid #dde8cd;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.13), 0 1px 4px rgba(0,0,0,0.08);
    transition: box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
    padding: 12px;
}
.mfmc-tune-card:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.18), 0 3px 8px rgba(0,0,0,0.10);
    transform: translateY(-3px);
}

.mfmc-tune-card-img-wrap {
    display: block;
    overflow: hidden;
    height: 180px;
    background: #eef3e8;
    border-radius: 7px;
    margin-bottom: 4px;
}
.mfmc-tune-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
    border-radius: 7px;
}
.mfmc-tune-card:hover .mfmc-tune-card-img {
    transform: scale(1.04);
}

.mfmc-tune-card-body {
    padding: 10px 4px 4px 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.mfmc-tune-card-footer {
    margin-top: auto;
    padding-bottom: 4px;
}

.mfmc-tune-title-link {
    font-weight: 700;
    font-size: .92rem;
    color: #1a5276;
    text-decoration: none;
}
.mfmc-tune-title-link:hover { text-decoration: underline; color: #2c3e1e; }

.mfmc-play-btn {
    background: #4a7c2f;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: .70rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* No CSS transition on transform — JS drives it at 60fps */
    transition: background .08s ease-out;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    transform-origin: center center;
    will-change: transform, background, box-shadow;
}
.mfmc-play-btn:hover:not(.mfmc-playing) { background: #2c3e1e; transform: scale(1.08); }

/* While playing — JS handles transform & box-shadow; just ensure overflow visible */
.mfmc-play-btn.mfmc-playing {
    overflow: visible;
}

/* CSS fallback: color-cycling pulse for browsers without Web Audio */
@keyframes mfmc-scale-pulse {
    0%   { transform: scale(1);    }
    40%  { transform: scale(1.45); }
    100% { transform: scale(1);    }
}
@keyframes mfmc-color-cycle {
    0%   { background: #4a7c2f; box-shadow: 0 0 0 0 rgba(74,124,47,.6),  0 3px 10px rgba(0,0,0,.2); }
    16%  { background: #2176ae; box-shadow: 0 0 0 12px rgba(33,118,174,0), 0 3px 10px rgba(0,0,0,.2); }
    33%  { background: #c1440e; box-shadow: 0 0 0 0 rgba(193,68,14,.6),  0 3px 10px rgba(0,0,0,.2); }
    49%  { background: #7b2d8b; box-shadow: 0 0 0 12px rgba(123,45,139,0),0 3px 10px rgba(0,0,0,.2); }
    66%  { background: #b5870b; box-shadow: 0 0 0 0 rgba(181,135,11,.6), 0 3px 10px rgba(0,0,0,.2); }
    83%  { background: #1a7a5e; box-shadow: 0 0 0 12px rgba(26,122,94,0), 0 3px 10px rgba(0,0,0,.2); }
    100% { background: #4a7c2f; box-shadow: 0 0 0 0 rgba(74,124,47,.6),  0 3px 10px rgba(0,0,0,.2); }
}
.mfmc-play-btn.mfmc-pulse-css {
    animation:
        mfmc-scale-pulse  0.85s ease-in-out infinite,
        mfmc-color-cycle  3.5s linear infinite;
}

.mfmc-no-audio { font-size: .78rem; color: #bbb; font-style: italic; }

/* Floating audio popup */
.mfmc-audio-popup {
    position: fixed;
    bottom: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e1e;
    border-radius: 8px;
    padding: .7rem 1.1rem;
    box-shadow: 0 6px 24px rgba(0,0,0,.3);
    z-index: 9999;
    min-width: 300px;
}
.mfmc-popup-inner { display: flex; align-items: center; gap: .8rem; }
.mfmc-popup-inner audio { flex: 1; height: 36px; }
.mfmc-close-audio {
    background: none; border: none; color: rgba(255,255,255,.6);
    cursor: pointer; font-size: .82rem; white-space: nowrap;
}
.mfmc-close-audio:hover { color: #fff; }

/* ============================================================
   TUNES — Single Tune Page
   ============================================================ */
.mfmc-tune-page { margin-bottom: 1.5rem; }

/* Sticky audio bar */
.mfmc-sticky-players {
    position: sticky;
    top: 0;
    z-index: 200;
    background: #2c3e1e;
    border-bottom: 3px solid #4a7c2f;
    box-shadow: 0 3px 10px rgba(0,0,0,.25);
    padding: .55rem .9rem;
    margin-bottom: .5rem;
}
.mfmc-sticky-inner {
    display: flex;
    align-items: center;
    gap: .8rem;
    flex-wrap: wrap;
}
.mfmc-sticky-label {
    color: #cfe8a0;
    font-weight: 700;
    font-size: .88rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.mfmc-player-grid {
    display: flex;
    gap: .7rem;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
}
.mfmc-player-wrap {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex: 1;
    min-width: 200px;
}
.mfmc-player-label {
    color: rgba(255,255,255,.75);
    font-size: .76rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.mfmc-audio-player {
    flex: 1;
    height: 34px;
    min-width: 140px;
    accent-color: #4a7c2f;
}

/* PDF section */
.mfmc-pdf-section { margin-bottom: 1.5rem; }
.mfmc-pdf-toolbar {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding: .45rem 0 .55rem;
    border-bottom: 1px solid #dde8cd;
    margin-bottom: .5rem;
}
.mfmc-pdf-toolbar-title {
    font-weight: 700;
    font-size: .9rem;
    color: #2c3e1e;
    flex: 1;
}
.mfmc-pdf-fullpage-wrap {
    border: 1px solid #dde8cd;
    border-radius: 5px;
    overflow: hidden;
    height: calc(100vh - 120px);
    min-height: 500px;
}
.mfmc-pdf-fullpage {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
}
.mfmc-pdf-fallback {
    display: none;
    text-align: center;
    padding: 1.2rem;
    font-size: .88rem;
    color: #666;
}

.mfmc-tune-notes { margin-top: 1.2rem; }
.mfmc-tune-notes h3 { font-size: 1rem; margin-bottom: .5rem; border-bottom: 1px solid #dde8cd; padding-bottom: .3rem; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 700px) {
    .mfmc-events-grid { grid-template-columns: 1fr; }
    .mfmc-sticky-label { display: none; }
    .mfmc-player-wrap { min-width: 160px; }
    .mfmc-pdf-fullpage-wrap { height: calc(100vh - 160px); min-height: 340px; }
    .mfmc-tune-thumb { width: 48px; height: 48px; }
    .mfmc-tunes-grid { grid-template-columns: 1fr; }
    .mfmc-tune-card-img-wrap { height: 140px; }
}

/* ============================================================
   TUNES — Live Search Bar
   ============================================================ */
.mfmc-search-wrap {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-bottom: 1.4rem;
    background: #f0f6e8;
    border: 2px solid #4a7c2f;
    border-radius: 10px;
    padding: .7rem 1rem;
}
.mfmc-tune-search {
    flex: 1;
    max-width: 420px;
    padding: .55rem 1rem .55rem 2.4rem;
    border: 2px solid #4a7c2f;
    border-radius: 25px;
    font-size: 1rem;
    font-family: inherit;
    color: #222;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234a7c2f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") .8rem center no-repeat;
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0,0,0,.06);
    transition: border-color .15s, box-shadow .15s;
}
.mfmc-tune-search:focus {
    border-color: #2c5c1a;
    box-shadow: 0 0 0 4px rgba(74,124,47,.18), inset 0 1px 3px rgba(0,0,0,.06);
}
.mfmc-tune-search::placeholder { color: #7a9e60; font-style: italic; }

.mfmc-search-label {
    font-weight: 700;
    color: #2c5c1a;
    font-size: .95rem;
    white-space: nowrap;
}

.mfmc-search-count {
    font-size: .85rem;
    color: #4a7c2f;
    font-weight: 600;
    white-space: nowrap;
    background: #d6ebbe;
    border-radius: 20px;
    padding: .2rem .7rem;
}

.mfmc-no-results {
    color: #888;
    font-style: italic;
    font-size: .9rem;
    padding: .6rem 0;
}

/* ============================================================
   TUNES — Sidebar Widget List
   ============================================================ */
.mfmc-tunes-widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.mfmc-tunes-widget-list li {
    border-bottom: 1px solid #eef3e8;
    padding: .3rem 0;
}
.mfmc-tunes-widget-list li:last-child {
    border-bottom: none;
}
.mfmc-tunes-widget-list a {
    font-size: .85rem;
    color: #1a5276;
    text-decoration: none;
    display: block;
    padding: .1rem 0;
    transition: color .15s, padding-left .15s;
}
.mfmc-tunes-widget-list a:hover {
    color: #2c3e1e;
    padding-left: .3rem;
}
/* Highlight the currently viewed tune */
.mfmc-tunes-widget-list li.mfmc-tune-active a {
    color: #2c3e1e;
    font-weight: 700;
    padding-left: .3rem;
    border-left: 3px solid #4a7c2f;
}
.mfmc-widget-empty {
    font-size: .83rem;
    color: #999;
    font-style: italic;
}

/* ============================================================
   TUNES — Auto-injected sidebar widget
   ============================================================ */
.mfmc-tunes-sidebar-widget .widget-title {
    font-size: 1rem;
    font-weight: 700;
    border-bottom: 1px solid #dde8cd;
    padding-bottom: 5px;
    margin-bottom: 8px;
    color: #2c3e1e;
}

/* ============================================================
   TUNES — Dedicated Tunes Sidebar wrapper
   ============================================================ */
.mfmc-tunes-sidebar-wrap {
    margin-bottom: 1rem;
}
.mfmc-tunes-sidebar-wrap .widget-title {
    font-size: 1rem;
    font-weight: 700;
    border-bottom: 1px solid #dde8cd;
    padding-bottom: 5px;
    margin-bottom: 8px;
    color: #2c3e1e;
}

/* ============================================================
   TUNES — AudioIgniter player wrapper
   ============================================================ */
.mfmc-ai-player-wrap {
    margin-bottom: 1.2rem;
}
.mfmc-ai-player-wrap .audioigniter-root {
    border-radius: 6px;
    overflow: hidden;
}

/* ============================================================
   TUNES — Sonaar player wrapper
   ============================================================ */
.mfmc-sonaar-player-wrap {
    margin-bottom: 1.2rem;
}

/* ============================================================
   TUNES — Grouped by type sections
   ============================================================ */
.mfmc-tune-group {
    margin-bottom: 2rem;
}
.mfmc-tune-group-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e1e;
    background: #eaf2e0;
    border-left: 4px solid #4a7c2f;
    padding: .45rem .85rem;
    margin: 0 0 0 0;
    border-radius: 3px 3px 0 0;
}
/* Remove top border-radius from grid when directly under heading */
.mfmc-tune-group .mfmc-tunes-grid {
    border-top: none;
}

/* ============================================================
   TUNES — Widget type headings
   ============================================================ */
.mfmc-widget-type-heading {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #4a7c2f;
    margin: .8rem 0 .2rem;
    padding-bottom: .2rem;
    border-bottom: 1px solid #dde8cd;
}
.mfmc-widget-type-heading:first-child {
    margin-top: 0;
}

/* ============================================================
   Hide AudioIgniter player from sidebar on Tunes pages
   (it belongs in Main Sidebar but not on /tunes or /tune/* )
   ============================================================ */
.mfmc-tunes-page .audioigniter-root,
.mfmc-tunes-page .widget_audioigniter_player,
.mfmc-tune-page-body .audioigniter-root,
.mfmc-tune-page-body .widget_audioigniter_player {
    display: none !important;
}

/* ============================================================
   EVENTS — Detail page featured image
   ============================================================ */
.mfmc-event-detail-image-wrap {
    margin-bottom: 1.2rem;
}
.mfmc-event-detail-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

/* ============================================================
   EVENTS — Posted by row + hide theme author line on events
   ============================================================ */
.mfmc-detail-posted {
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px solid #dde8cd;
    color: #666;
    font-size: .88rem;
}
.mfmc-detail-posted strong {
    color: #4a7c2f;
}
/* Hide the theme's "By Author / Date" line on single event pages */
.single-mfmc_event .entry-meta,
.single-mfmc_event .entry-footer,
.single-mfmc_event .post-meta,
.single-mfmc_event .post-header .meta,
.single-mfmc_event .byline,
.single-mfmc_event .posted-on,
.single-mfmc_event .author,
.single-mfmc_event span.posted-on,
.single-mfmc_event span.byline,
.single-mfmc_event .ast-post-meta,
.single-mfmc_event .ast-blog-single-element,
.single-mfmc_event .page-header-content .ast-blog-single-element {
    display: none !important;
}

/* Hide the theme's "By Author / Date" line on single tune pages */
.single-mfmc_tune .entry-meta,
.single-mfmc_tune .entry-footer,
.single-mfmc_tune .post-meta,
.single-mfmc_tune .post-header .meta,
.single-mfmc_tune .byline,
.single-mfmc_tune .posted-on,
.single-mfmc_tune .author,
.single-mfmc_tune span.posted-on,
.single-mfmc_tune span.byline,
.single-mfmc_tune .ast-post-meta,
.single-mfmc_tune .ast-blog-single-element,
.single-mfmc_tune .page-header-content .ast-blog-single-element {
    display: none !important;
}
