/* ==========================================================================
   Photo gallery (/gallery, /gallery/{id}) and videos (/video_gallery).
   Views: global/gallery.blade.php, global/gallery/{gallery_view,album_cards,
   video_gallery_view}.blade.php. Phone first; colours from site-chrome.css.
   Media boxes use padding-top ratios (older iOS has no aspect-ratio).
   ========================================================================== */
.mp {
    --mp-green: #119c4d;
    --mp-green-ink: #0f7a3e;
    --mp-green-soft: #e8f5ee;
    --mp-ink: #1d2b23;
    --mp-muted: #6b7a71;
    --mp-line: #e3ebe6;
    --mp-surface: #f4f7f5;
    --mp-radius: 14px;
    --mp-ease: cubic-bezier(.2, .7, .2, 1);
    background: var(--mp-surface);
    padding: 16px 0 28px;
    color: var(--mp-ink);
}
.mp svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.mp a { text-decoration: none; }
.mp [hidden] { display: none !important; }
.mp img { display: block; }

/* ---------- page head ---------- */
.mp-head { margin-bottom: 16px; }
.mp-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 12.5px; color: var(--mp-muted); }
.mp-crumb a { color: var(--mp-green-ink); }
.mp-crumb svg { width: 12px; height: 12px; }
body.rtl .mp-crumb svg { transform: scaleX(-1); }
.mp-title { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.5; color: var(--mp-ink); }
.mp-sub { margin: 4px 0 0; font-size: 13.5px; line-height: 1.9; color: var(--mp-muted); }
.mp-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mp-chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 12px;
    border: 1px solid var(--mp-line); border-radius: 16px;
    background: #fff; color: var(--mp-ink); font-size: 12.5px; white-space: nowrap;
}
.mp-chip svg { width: 15px; height: 15px; color: var(--mp-green); }
button.mp-chip { cursor: pointer; font-family: inherit; }
.mp-chip.is-on { border-color: var(--mp-green); background: var(--mp-green); color: #fff; }
.mp-chip.is-on svg { color: #fff; }

.mp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.mp-search { position: relative; flex: 1 1 260px; max-width: 520px; margin: 0; }
.mp-search input {
    width: 100%; height: 44px; padding: 0 44px 0 40px;
    border: 1px solid var(--mp-line); border-radius: 22px;
    background: #fff; color: var(--mp-ink); font-size: 16px; /* 16px: no zoom on iOS */
    font-family: inherit; box-shadow: none; -webkit-appearance: none;
    transition: border-color .2s, box-shadow .2s;
}
.mp-search input:focus { outline: 0; border-color: var(--mp-green); box-shadow: 0 0 0 3px rgba(17, 156, 77, .14); }
.mp-search input::-webkit-search-cancel-button { display: none; }
.mp-search-icon { position: absolute; top: 13px; right: 15px; color: var(--mp-muted); pointer-events: none; }
.mp-search-clear {
    position: absolute; top: 6px; left: 6px;
    display: none; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
    background: var(--mp-surface); color: var(--mp-muted); cursor: pointer;
}
.mp-search.has-value .mp-search-clear { display: inline-flex; }
body.ltr .mp-search input { padding: 0 40px 0 44px; }
body.ltr .mp-search-icon { right: auto; left: 15px; }
body.ltr .mp-search-clear { left: auto; right: 6px; }

/* ---------- grids ---------- */
.mp-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 576px) { .mp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .mp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1200px) { .mp-grid.is-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.mp-ratio { position: relative; display: block; overflow: hidden; padding-top: 66.666%; background: #dfe8e2; }
.mp-ratio.is-16x9 { padding-top: 56.25%; }
.mp-ratio > img, .mp-ratio > iframe {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    border: 0; object-fit: cover;
}

.mp-empty {
    display: none; padding: 40px 16px; border: 1px dashed var(--mp-line); border-radius: var(--mp-radius);
    background: #fff; color: var(--mp-muted); text-align: center; line-height: 2;
}
.mp-empty.is-shown { display: block; }
.mp-empty svg { width: 34px; height: 34px; margin: 0 auto 6px; display: block; color: #b6c6bc; }

.mp-more-wrap { margin-top: 22px; text-align: center; }
.mp-more {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-width: 200px; height: 46px; padding: 0 22px;
    border: 1px solid var(--mp-green); border-radius: 23px;
    background: #fff; color: var(--mp-green-ink) !important; font-weight: 700; cursor: pointer;
    transition: background-color .2s, color .2s;
}
.mp-more:hover { background: var(--mp-green); color: #fff !important; }
.mp-more.is-loading { pointer-events: none; opacity: .7; }
.mp-more.is-loading svg { animation: mp-spin .8s linear infinite; }
@keyframes mp-spin { to { transform: rotate(360deg); } }

/* ---------- album card ---------- */
.alb {
    display: flex; flex-direction: column; overflow: hidden;
    border-radius: var(--mp-radius); background: #fff; color: var(--mp-ink) !important;
    box-shadow: 0 1px 2px rgba(16, 40, 26, .06);
    transition: box-shadow .25s, transform .25s var(--mp-ease);
}
.alb:hover { box-shadow: 0 10px 24px rgba(16, 40, 26, .12); transform: translateY(-2px); }
.alb .mp-ratio > img { transition: transform .5s var(--mp-ease); }
.alb:hover .mp-ratio > img { transform: scale(1.04); }
.alb-count {
    position: absolute; bottom: 10px; left: 10px;
    display: inline-flex; align-items: center; gap: 5px;
    height: 26px; padding: 0 9px; border-radius: 13px;
    background: rgba(10, 24, 16, .72); color: #fff; font-size: 12px;
}
.alb-count svg { width: 14px; height: 14px; }
.alb-body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
.alb-title {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.8;
}
.alb-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mp-muted); }
.alb-meta svg { width: 14px; height: 14px; }

/* ---------- album page ---------- */
.mp-album-desc { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: #fff; font-size: 13.5px; line-height: 2.1; color: #3a4a41; }
.mp-album-desc p:last-child { margin-bottom: 0; }
.mp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mp-btn {
    display: inline-flex; align-items: center; gap: 7px;
    height: 38px; padding: 0 14px; border: 1px solid var(--mp-line); border-radius: 19px;
    background: #fff; color: var(--mp-ink) !important; font-size: 13px; font-family: inherit; cursor: pointer;
    transition: border-color .2s, background-color .2s;
}
.mp-btn:hover { border-color: var(--mp-green); background: var(--mp-green-soft); }
.mp-btn.is-primary { border-color: var(--mp-green); background: var(--mp-green); color: #fff !important; }
.mp-btn.is-primary:hover { background: var(--mp-green-ink); }

.ph-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 768px) {
    .ph-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    /* first photo large only with 5+ photos: fewer can't fill the cells beside it */
    .ph-grid.has-feature > .ph:first-child { grid-column: span 2; grid-row: span 2; }
}
@media (min-width: 1200px) { .ph-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ph { position: relative; display: block; overflow: hidden; border-radius: 10px; background: #dfe8e2; }
.ph .mp-ratio { padding-top: 75%; }
.ph .mp-ratio > img { transition: transform .5s var(--mp-ease), opacity .3s; }
.ph:hover .mp-ratio > img { transform: scale(1.05); }
.ph:focus-visible { outline: 3px solid var(--mp-green); outline-offset: 2px; }
.ph-zoom {
    position: absolute; top: 8px; left: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(10, 24, 16, .55); color: #fff; opacity: 0; transition: opacity .2s;
}
.ph-zoom svg { width: 15px; height: 15px; }
.ph:hover .ph-zoom { opacity: 1; }

.mp-section-title { display: flex; align-items: center; gap: 8px; margin: 30px 0 14px; font-size: 17px; font-weight: 800; }
.mp-section-title:before { content: ""; width: 4px; height: 20px; border-radius: 2px; background: var(--mp-green); }

/* ---------- videos ---------- */
.vcard { display: flex; flex-direction: column; gap: 10px; color: var(--mp-ink) !important; }
.vcard-thumb { position: relative; border-radius: 12px; }
.vcard-thumb .mp-ratio { border-radius: 12px; }
.vcard-thumb .mp-ratio > img { transition: transform .4s var(--mp-ease); }
.vcard:hover .vcard-thumb .mp-ratio > img { transform: scale(1.03); }
.vcard-noposter {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f7a3e 0%, #0b2e1e 100%); color: rgba(255, 255, 255, .85);
}
.vcard-noposter svg { width: 46px; height: 46px; stroke-width: 1.4; }
.vcard-dur {
    position: absolute; bottom: 8px; left: 8px;
    padding: 1px 6px; border-radius: 5px;
    background: rgba(0, 0, 0, .78); color: #fff; font-size: 12px; font-weight: 600; line-height: 20px;
    direction: ltr;
}
.vcard-play {
    position: absolute; top: 50%; left: 50%;
    display: flex; align-items: center; justify-content: center;
    width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
    background: rgba(17, 156, 77, .92); color: #fff;
    opacity: 0; transform: scale(.85); transition: opacity .2s, transform .25s var(--mp-ease);
}
.vcard-play svg { width: 22px; height: 22px; fill: currentColor; stroke: none; margin-left: 3px; }
.vcard:hover .vcard-play, .vcard:focus-visible .vcard-play { opacity: 1; transform: none; }
.vcard-now {
    position: absolute; top: 8px; right: 8px; display: none;
    padding: 2px 8px; border-radius: 5px; background: var(--mp-green); color: #fff; font-size: 11.5px; font-weight: 700;
}
.vcard.is-playing .vcard-now { display: block; }
.vcard.is-playing .vcard-thumb .mp-ratio { box-shadow: 0 0 0 3px var(--mp-green); }
.vcard-body { display: flex; gap: 10px; min-width: 0; padding: 0 2px; }
.vcard-avatar {
    flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%;
    background: #fff url('../../images/favicon.png') center / 24px no-repeat;
    box-shadow: inset 0 0 0 1px var(--mp-line);
}
.vcard-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.vcard-title {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font-size: 14.5px; font-weight: 700; line-height: 1.75;
}
.vcard-meta { font-size: 12px; color: var(--mp-muted); }
.vcard:focus-visible { outline: 3px solid var(--mp-green); outline-offset: 4px; border-radius: 12px; }

@media (max-width: 575px) {
    .mp > .container { padding-left: 12px; padding-right: 12px; }
}
/* phones: a YouTube-style list (cover on the side, title and meta next to it), in browse
   mode and under the player alike; the newest video stays a big playable box on top */
@media (max-width: 767px) {
    .vg .mp-grid { grid-template-columns: 1fr; gap: 14px; }
    .vg .vcard { flex-direction: row; align-items: flex-start; gap: 10px; }
    .vg .vcard-thumb { flex: 0 0 44%; max-width: 210px; }
    .vg .vcard-thumb, .vg .vcard-thumb .mp-ratio { border-radius: 10px; }
    .vg .vcard-body { flex: 1 1 auto; padding: 0; }
    .vg .vcard-avatar { display: none; }
    .vg .vcard-title { font-size: 13.5px; line-height: 1.7; }
    .vg .vcard-meta { font-size: 11.5px; line-height: 1.7; }
    .vg .vcard-dur { bottom: 5px; left: 5px; padding: 0 5px; font-size: 11px; line-height: 18px; }
    .vg .vcard-now { top: 5px; right: 5px; padding: 1px 6px; font-size: 10.5px; }
    .vg .vcard-play { width: 36px; height: 36px; margin: -18px 0 0 -18px; }
    .vg .vcard-play svg { width: 16px; height: 16px; margin-left: 2px; }
    .vg .vcard.is-playing .vcard-thumb .mp-ratio { box-shadow: 0 0 0 2px var(--mp-green); }
    .vg .mp-more { min-width: 0; width: 100%; }
}

/* watch mode: the player on top; from 1200px the list runs down the side */
.vg-watch { display: none; margin-bottom: 22px; }
.vg.is-watch .vg-watch { display: block; }
.vg-player { overflow: hidden; border-radius: 14px; background: #000; }
.vg-player .mp-ratio { background: #000; }
.vg-info { padding: 12px 2px 0; }
.vg-info h1 { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.7; color: var(--mp-ink); }
.vg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 6px; font-size: 12.5px; color: var(--mp-muted); }
.vg-desc { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: #fff; font-size: 13.5px; line-height: 2; white-space: pre-line; }
.vg-desc:empty { display: none; }
.vg-side-title { display: none; margin: 0 0 12px; font-size: 15px; font-weight: 800; }
.vg.is-watch .vg-side-title { display: block; }
@media (max-width: 575px) {
    .vg-player { margin: 0 calc(50% - 50vw); border-radius: 0; }
}
@media (min-width: 1200px) {
    .vg.is-watch .vg-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
    .vg.is-watch .vg-watch { margin-bottom: 0; }
    .vg.is-watch .mp-grid { grid-template-columns: 1fr; gap: 12px; }
    .vg.is-watch .vcard { flex-direction: row; gap: 10px; }
    .vg.is-watch .vcard-thumb { flex: 0 0 168px; }
    .vg.is-watch .vcard-avatar { display: none; }
    .vg.is-watch .vcard-title { font-size: 13.5px; }
    .vg.is-watch .vcard-play { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
}

/* the newest video, playable in place above the grid */
.vg-hero {
    display: grid; grid-template-columns: 1fr; overflow: hidden;
    margin-bottom: 26px; border-radius: 16px; background: #fff;
    box-shadow: 0 1px 2px rgba(16, 40, 26, .06), 0 10px 30px rgba(16, 40, 26, .06);
}
.vg.is-watch .vg-hero, .vg.is-searching .vg-hero { display: none; }
.vg:not(.is-watch):not(.is-searching) .vcard.is-hero { display: none; }
.vg-hero-media { position: relative; background: #000; }
.vg-hero-media .mp-ratio { background: #000; }
.vg-hero-play {
    position: absolute; top: 50%; left: 50%;
    display: flex; align-items: center; justify-content: center;
    width: 72px; height: 72px; margin: -36px 0 0 -36px; padding: 0;
    border: 0; border-radius: 50%;
    background: rgba(17, 156, 77, .94); color: #fff; cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
    transition: transform .25s var(--mp-ease), background-color .2s;
}
.vg-hero-play svg { width: 30px; height: 30px; fill: currentColor; stroke: none; margin-left: 4px; }
.vg-hero-media:hover .vg-hero-play { transform: scale(1.08); background: var(--mp-green); }
.vg-hero-play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.vg-hero.is-playing .vcard-dur { display: none; }
.vg-hero-info { display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 18px; }
.vg-hero-badge {
    align-self: flex-start; padding: 2px 10px; border-radius: 12px;
    background: var(--mp-green-soft); color: var(--mp-green-ink); font-size: 12px; font-weight: 700;
}
.vg-hero-title { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.7; color: var(--mp-ink); }
.vg-hero-info .vg-meta { margin-top: 0; }
.vg-hero-desc {
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
    margin: 0; font-size: 13.5px; line-height: 2; color: #3a4a41; white-space: pre-line;
}
.vg-hero .mp-actions { margin-top: 4px; }
@media (max-width: 575px) {
    .vg-hero { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); border-radius: 0; box-shadow: none; }
}
@media (min-width: 992px) {
    .vg-hero { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
    .vg-hero-info { justify-content: center; padding: 24px 26px; }
    .vg-hero-title { font-size: 21px; }
}

/* desktop watch mode: the list scrolls inside its own box next to the player */
@media (min-width: 1200px) {
    .vg.is-watch .vg-list {
        position: -webkit-sticky; position: sticky; top: 76px;
        max-height: calc(100vh - 96px); overflow-y: auto; overscroll-behavior: contain;
        padding: 0 4px 0 2px; scrollbar-width: thin; scrollbar-color: #c9d6ce transparent;
    }
    .vg.is-watch .vg-list::-webkit-scrollbar { width: 6px; }
    .vg.is-watch .vg-list::-webkit-scrollbar-thumb { border-radius: 3px; background: #c9d6ce; }
    .vg.is-watch .vg-side-title { position: -webkit-sticky; position: sticky; top: 0; z-index: 2; margin: 0 0 8px; padding: 0 0 8px; background: var(--mp-surface); }
    .vg.is-watch .mp-more-wrap { margin-top: 12px; }
    .vg.is-watch .mp-more { min-width: 0; width: 100%; }
}

@media (min-width: 768px) {
    .mp { padding-top: 26px; }
    .mp-title { font-size: 26px; }
    .vg-info h1 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .mp *, .mp *:before { transition: none !important; animation: none !important; }
}
