/* Search results: one section per envelope, each with a photo carousel.
   Colors match the search bar (charcoal #3b3640, gold #ffd52d). */

.mp-results {
    --mp-ink: #2b2730;
    --mp-muted: #5f5a66;
    --mp-gold: #ffd52d;
    --mp-gold-dark: #8a6d00;
    --mp-card: #ffffff;
    --mp-photo-bg: #ebe8e3;
    --mp-line: #d9d5cf;
    --mp-gap: 16px;

    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 16px 48px;
    box-sizing: border-box;
    font-family: 'Source Sans Pro', system-ui, sans-serif;
    color: var(--mp-ink);
    text-align: left;
}
.mp-results *, .mp-results *::before, .mp-results *::after { box-sizing: border-box; }

.mp-summary {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 24px;
    color: var(--mp-ink);
}
.mp-summary small {
    display: block;
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 400;
    color: var(--mp-muted);
}
.mp-notice {
    padding: 16px 20px;
    border-radius: 10px;
    background: #fff8d6;
    border: 1px solid #f0dc7a;
    margin-bottom: 24px;
}

/* ---------- Envelope section ---------- */
.mp-envelope {
    background: var(--mp-card);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 6px 20px rgba(0,0,0,.06);
    margin-bottom: 28px;
    overflow: hidden;
}
.mp-envelope-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--mp-line);
    border-left: 6px solid var(--mp-gold);
}
.mp-envelope-label {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--mp-gold-dark);
    margin: 0 0 2px;
}
.mp-envelope-name {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    color: var(--mp-ink);
}
.mp-envelope-count {
    font-size: .95rem;
    color: var(--mp-muted);
    margin: 2px 0 0;
}
.mp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 999px;
    background: #3b3640;
    color: #fff !important;
    font-weight: 600;
    font-size: .95rem;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background .15s;
}
.mp-btn:hover, .mp-btn:focus-visible { background: #1f1c23; }

/* ---------- Carousel ---------- */
.mp-carousel {
    position: relative;
    padding: 20px 0 8px;
}
.mp-track {
    display: flex;
    gap: var(--mp-gap);
    margin: 0;
    padding: 4px 22px 16px;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 22px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    outline: none;
}
.mp-track::-webkit-scrollbar { display: none; }
.mp-track:focus-visible { outline: none; box-shadow: inset 0 0 0 3px #3b3640, inset 0 0 0 6px var(--mp-gold); }

.mp-slide {
    /* 4 across on desktop */
    flex: 0 0 calc((100% - 3 * var(--mp-gap)) / 4);
    scroll-snap-align: start;
    min-width: 0;
    cursor: default;
}
/* Undo the site-wide li hover/cursor rules for slides */
.mp-slide:hover { opacity: 1; }

.mp-photo {
    position: relative;
    display: block;
    /* square frame suits both landscape and portrait snapshots */
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: var(--mp-photo-bg);
}
.mp-photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform .25s ease;
}
.mp-photo:hover img, .mp-photo:focus-visible img { transform: scale(1.03); }
.mp-photo:focus-visible { outline: 3px solid #3b3640; outline-offset: 2px; box-shadow: 0 0 0 6px var(--mp-gold); }

.mp-photo-hint {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(43,39,48,.88);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .2s, transform .2s;
}
.mp-photo:hover .mp-photo-hint, .mp-photo:focus-visible .mp-photo-hint {
    opacity: 1;
    transform: none;
}

/* Shown when an image fails to load */
.mp-photo.is-broken img { display: none; }
.mp-photo.is-broken::before {
    content: "Image unavailable";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mp-muted);
    font-size: .95rem;
}

.mp-caption {
    padding: 10px 2px 0;
}
.mp-caption-title {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--mp-ink) !important;
    text-decoration: none !important;
    overflow-wrap: anywhere;
}
.mp-caption-title:hover { text-decoration: underline !important; }
.mp-caption-help {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 0;
    font-size: .9rem;
    font-weight: 600;
    color: var(--mp-gold-dark) !important;
    text-decoration: underline !important;
}

/* Prev / next buttons */
.mp-nav {
    position: absolute;
    /* roughly the middle of the photos (captions sit below them) */
    top: 40%;
    margin-top: -22px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--mp-ink);
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .2s, transform .15s;
}
.mp-nav:hover { transform: scale(1.06); }
.mp-nav:focus-visible { outline: 3px solid #3b3640; outline-offset: 2px; box-shadow: 0 0 0 6px var(--mp-gold); }
.mp-nav[disabled] { opacity: 0; pointer-events: none; }
.mp-prev { left: 8px; }
.mp-next { right: 8px; }

/* Position dots */
.mp-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 0 0 12px;
}
.mp-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mp-line);
    transition: background .2s, width .2s;
}
.mp-dots span.is-active {
    width: 20px;
    border-radius: 4px;
    background: var(--mp-gold-dark);
}
.mp-carousel.is-static .mp-nav,
.mp-carousel.is-static .mp-dots { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .mp-slide { flex-basis: calc((100% - 2 * var(--mp-gap)) / 3); }
}
@media (max-width: 700px) {
    .mp-results { padding: 20px 12px 32px; }
    .mp-envelope-head { padding: 16px; }
    .mp-envelope-name { font-size: 1.35rem; }
    .mp-btn { width: 100%; justify-content: center; }
    .mp-track { padding: 4px 16px 14px; scroll-padding: 0 16px; }
    /* Two across, with the next photo peeking in so it's obvious you can swipe */
    .mp-slide { flex-basis: 44%; }
}
@media (max-width: 420px) {
    .mp-slide { flex-basis: 72%; }
}
/* On touch screens, swiping replaces the arrows, and the "tell us" hint is always visible as a link */
@media (hover: none) {
    .mp-nav { display: none; }
    /* hidden visually, but still read out so the photo link says what it does */
    .mp-photo-hint { opacity: 1; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .mp-track { scroll-behavior: auto; }
    .mp-photo img, .mp-nav, .mp-photo-hint { transition: none; }
}
