/* ==========================================================================
   me-download-cards.css - one look for every MakeThumbLink / makeFlipBookLink card

   Applies to all  div.me-thumb.me-c-dl  cards on every page (legacy global-content.css pages
   and Bootstrap pages that use me-photo-tiles.css / .me-thumb-card):
     - PDF card (me-c-dl-pdf) and flipbook cards (me-c-dl-fbp, me-c-dl-fbp-pdf) share the same
       194px box, 158x245 cover area, title row and round download button, so they line up
     - the hover hint ("Open PDF (1,499 KB)", "View Publication") is the .me-hover-tip element
       made by /js/me-download-cards.js

   Loaded from global.master.vb and bs-global.master.vb. Selectors start with "html div.me-thumb.me-c-dl"
   so they win over global-content.css and me-photo-tiles.css whatever the load order.
   ASCII only.
   ========================================================================== */

/* ---- card wrapper ---- */
html div.me-thumb.me-c-dl {
    float: left;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: auto;
    margin: 0 20px 20px 0;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: center;
}

html .me-thumb-card div.me-thumb.me-c-dl {
    margin: 0;
    float: none;
}

/* ---- the card itself (a for PDF cards, span for flipbook cards) ---- */
html div.me-thumb.me-c-dl .me-c-dl-btn {
    position: relative;
    box-sizing: border-box !important;  /* legacy pages set content-box on everything inside #m_main */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 194px;
    margin: 0;
    padding: 10px 10px;
    overflow: hidden;
    background: #f6f6f6;
    background-image: none;
    filter: none;
    border: 1px solid #ddd;
    border-radius: .4em;
    color: #333;
    font-size: 14.4px;
    font-weight: 400;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

html div.me-thumb.me-c-dl a.me-c-dl-btn:hover {
    background: #f6f6f6;
    text-decoration: none;
}

html div.me-thumb.me-c-dl .me-c-dl-btn > br {
    display: none;
}

/* ---- cover area: 158 x 245, image centred ---- */
html div.me-thumb.me-c-dl-pdf img.me-c-dl-cover {
    display: block;
    flex: 0 0 auto;
    width: 158px;
    height: 245px;
    margin: 0 0 7px;
    padding: 0;                 /* the cover img also carries the .me-thumb class, which me-photo-tiles.css pads and frames */
    border: 0;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
    box-shadow: none;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
}

/* flipbook cover (built by the flipbook embed script) - same 245px box */
html div.me-thumb.me-c-dl-fbp-pdf .me-c-dl-btn > div:not(.me-c-dl-links),
html div.me-thumb.me-c-dl-fbp .me-c-dl-btn > div:not(.me-c-dl-links) {
    /* !important: the flipbook embed script writes an inline height / display on this box */
    display: flex !important;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 158px;
    height: 245px !important;
    margin: 0;                  /* me-photo-tiles.css gives every div in a .me-btn margins that push the footer down */
}

/* ---- title row ---- */
html div.me-thumb.me-c-dl-pdf .me-c-dl-btn .me-c-dl-title {
    /* The footer row fills all the space under the cover, so every card in a row has the same footer box
       (cards in a row are the same height). The title text and the round button are centred in it together. */
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 1 1 auto;
    align-self: stretch;
    box-sizing: border-box !important;
    min-height: 52px;
    margin: 0;
    padding: 0 0 0 2px;
    color: #333;
    font-size: 14.4px;
    font-weight: 400;
    line-height: 1.3;
    text-align: center;
}

/* me-download-cards.js wraps the title text in this span so it can take the free width */
html div.me-thumb.me-c-dl-pdf .me-c-dl-btn .me-c-dl-title .me-c-dl-title-text {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;                /* legacy ".me-btn span" in global-content.css forces 22 x 22 and a negative margin */
    height: auto;
    margin: 0;
    text-align: center;
}

html div.me-thumb.me-c-dl .me-c-dl-links {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box !important;
    width: 100%;
    min-height: 52px;
    margin: 7px 0 0;
    padding: 0;
}

html div.me-thumb.me-c-dl .me-c-dl-links a.me-c-dl-title {
    flex: 0 0 130px;
    box-sizing: border-box !important;
    margin: 0 0 0 2px;
    padding: 0;
    color: #333;
    font-size: 14.4px;
    font-weight: 400;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
}

/* ---- round download button ---- */
html div.me-thumb.me-c-dl .me-c-dl-links a.me-c-dl-download {
    display: block;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    min-width: 30px;
    margin: 0 0 0 auto;
    border-radius: 100%;
    background: #666 url(/images/fa-icons/download-white.svg) no-repeat center center;
    background-size: 15px 15px;
    transition: none;
}

/* the PDF card is one link, so its button is drawn with ::after on the title row (last item, centred with the text) */
html div.me-thumb.me-c-dl-pdf .me-c-dl-btn .me-c-dl-title::after {
    content: "";
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    margin: 0 0 0 8px;
    border-radius: 100%;
    background: #666 url(/images/fa-icons/download-white.svg) no-repeat center center;
    background-size: 15px 15px;
}

/* ---- hover: title and button go red ---- */
html div.me-thumb.me-c-dl-pdf .me-c-dl-btn:hover .me-c-dl-title,
html div.me-thumb.me-c-dl .me-c-dl-links a.me-c-dl-title:hover {
    color: red;
}

html div.me-thumb.me-c-dl-pdf .me-c-dl-btn:hover .me-c-dl-title::after,
html div.me-thumb.me-c-dl .me-c-dl-links a.me-c-dl-download:hover {
    background-color: red;
}

/* ---- mouse-following hover hint ----
   One element added to <body> by me-download-cards.js, position:fixed so no card or group
   (overflow:auto) can clip it near an edge. */
.me-hover-tip {
    position: fixed;
    top: 0;
    left: 0;
    padding: 3px 8px;
    border-radius: 4px;
    background: #333;
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.3;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 100000;
}

    .me-hover-tip.on {
        opacity: 1;
    }

/* ---- phones ---- */
@media (max-width: 450px) {
    html div.me-thumb.me-c-dl {
        float: none;
        display: block;
        width: 100%;
        margin: 1em 0;
    }

    html div.me-thumb.me-c-dl .me-c-dl-btn {
        width: 100%;
    }

    html .me-thumb-card div.me-thumb.me-c-dl {
        margin: 0;
    }
}
