/* SPC Managed Missions — trip cards
   ------------------------------------------------------------------
   Designed to inherit the Shorepoint (Total / WPEX) theme's style guide.
   Colours and the eyebrow font are pulled from the theme's own
   CSS variables (--wpex-*), with safe fallbacks, so the cards match the
   site automatically and keep matching if the brand palette changes.
   Titles are <h3> and intentionally DO NOT override font-family, so they
   inherit the theme's heading font. Body text inherits the theme body font.
   ------------------------------------------------------------------ */

.spc-mm-wrap {
    /* Theme-linked tokens (fallbacks match Shorepoint's current brand) */
    --spc-mm-accent:        var(--wpex-accent, #127D63);
    --spc-mm-accent-hover:  var(--wpex-accent-alt, #0f6a54);
    --spc-mm-ink:           var(--wpex-palette-252-color, #272324);
    --spc-mm-title:         var(--spc-mm-ink);
    --spc-mm-date:          rgba(39, 35, 36, 0.62);
    --spc-mm-text:          rgba(39, 35, 36, 0.80);
    --spc-mm-card-bg:       #ffffff;
    --spc-mm-radius:        0px;
    --spc-mm-eyebrow-font:  var(--wpex-editorsnote-font, "Editors Note", Georgia, serif);
    --spc-mm-gap:           28px;
    --spc-mm-shadow:        0 1px 2px rgba(16, 24, 40, 0.05), 0 10px 28px rgba(16, 24, 40, 0.08);
    --spc-mm-shadow-hover:  0 2px 6px rgba(16, 24, 40, 0.08), 0 20px 46px rgba(16, 24, 40, 0.16);

    box-sizing: border-box;
    width: 100%;
    font-family: inherit;
    color: var(--spc-mm-text);
}
.spc-mm-wrap *,
.spc-mm-wrap *::before,
.spc-mm-wrap *::after { box-sizing: border-box; }

/* ---- Grid ---- */
.spc-mm-grid {
    display: grid;
    gap: var(--spc-mm-gap);
    grid-template-columns: repeat(1, minmax(0, 1fr));
}
@media (min-width: 600px) {
    .spc-mm-wrap.columns-2 .spc-mm-grid,
    .spc-mm-wrap.columns-3 .spc-mm-grid,
    .spc-mm-wrap.columns-4 .spc-mm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
    .spc-mm-wrap.columns-3 .spc-mm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .spc-mm-wrap.columns-4 .spc-mm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---- Eyebrow (country) — mirrors the theme's .spc-subtitle ---- */
.spc-mm-country {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--spc-mm-eyebrow-font);
    font-style: italic;
    font-size: 15px;
    line-height: 1;
    letter-spacing: 0.01em;
    text-transform: capitalize;
    color: var(--spc-mm-accent);
}
.spc-mm-country::before {
    content: "";
    width: 22px;
    height: 2px;
    background: var(--spc-mm-accent);
    flex: 0 0 auto;
}

/* ---- Title / date / description ---- */
.spc-mm-title {
    margin: 0;
    font-size: 21px;
    line-height: 1.15;
    font-weight: 800;              /* matches theme .spc-card-title */
    color: var(--spc-mm-title);
    /* font-family intentionally omitted -> inherits theme heading font */
}
.spc-mm-date {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--spc-mm-date);
}
.spc-mm-cost {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--spc-mm-ink);
}
.spc-mm-readmore {
    color: var(--spc-mm-accent);
    font-weight: 700;
    white-space: nowrap;
}
.spc-mm-desc {
    margin: 2px 0 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--spc-mm-text);
}

/* ---- Button — flat, sharp, theme accent ---- */
.spc-mm-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}
.spc-mm-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid var(--spc-mm-accent);
    border-radius: var(--spc-mm-radius);
    background: var(--spc-mm-accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    text-decoration: none !important;
    text-align: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.spc-mm-button:hover { background: var(--spc-mm-accent-hover); border-color: var(--spc-mm-accent-hover); color: #fff; }
.spc-mm-button:hover,
.spc-mm-button:focus,
.spc-mm-button:active { text-decoration: none !important; }
/* Learn More = secondary (outline); Apply = primary (solid accent) */
.spc-mm-btn-learn { background: transparent; color: var(--spc-mm-accent); }
.spc-mm-btn-learn:hover { background: var(--spc-mm-accent); color: #fff; }

/* ==================================================================
   Layout: CARDS (image on top, text below) — reskinned to the theme
   ================================================================== */
.spc-mm-wrap.layout-cards .spc-mm-card,
.spc-mm-wrap.layout-list  .spc-mm-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--spc-mm-card-bg);
    border-radius: var(--spc-mm-radius);
    overflow: hidden;
    box-shadow: var(--spc-mm-shadow);
    text-decoration: none;
    color: inherit;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.spc-mm-wrap.layout-cards .spc-mm-card:hover,
.spc-mm-wrap.layout-list  .spc-mm-card:hover { transform: translateY(-3px); box-shadow: var(--spc-mm-shadow-hover); }

.spc-mm-wrap.layout-cards .spc-mm-image,
.spc-mm-wrap.layout-list  .spc-mm-image {
    position: relative; width: 100%; aspect-ratio: 16 / 10; background: #eef1f4; overflow: hidden;
}
.spc-mm-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.spc-mm-wrap.layout-cards .spc-mm-body,
.spc-mm-wrap.layout-list  .spc-mm-body {
    display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
    padding: 20px 22px 22px; flex: 1 1 auto;
}

/* Overlay anchor makes the whole card clickable without nesting <a> tags */
.spc-mm-card-link { position: absolute; inset: 0; z-index: 2; text-indent: -9999px; overflow: hidden; }
.spc-mm-card-link:focus-visible { outline: 3px solid var(--spc-mm-accent); outline-offset: -3px; }

/* ---- List layout ---- */
.spc-mm-wrap.layout-list .spc-mm-grid { grid-template-columns: 1fr; gap: 14px; }
.spc-mm-wrap.layout-list .spc-mm-card { flex-direction: row; align-items: stretch; }
.spc-mm-wrap.layout-list .spc-mm-image { width: 190px; flex: 0 0 190px; aspect-ratio: auto; }
.spc-mm-wrap.layout-list .spc-mm-body { justify-content: center; }
@media (max-width: 560px) {
    .spc-mm-wrap.layout-list .spc-mm-card { flex-direction: column; }
    .spc-mm-wrap.layout-list .spc-mm-image { width: 100%; flex: none; aspect-ratio: 16 / 10; }
}

/* ==================================================================
   Layout: OVERLAY (portrait tile, dark scrim, white text on image)
   Mirrors the theme's .spc-card--serve / --smallgroups tiles.
   ================================================================== */
.spc-mm-wrap.layout-overlay .spc-mm-card {
    position: relative;
    display: block;
    border-radius: var(--spc-mm-radius);
    overflow: hidden;
    aspect-ratio: 3 / 4;                  /* portrait, like the theme cards */
    background: #000;
    text-decoration: none;
    color: #fff;
    box-shadow: var(--spc-mm-shadow);
    transition: box-shadow 0.18s ease;
}
.spc-mm-wrap.layout-overlay .spc-mm-image { position: absolute; inset: 0; }
.spc-mm-wrap.layout-overlay .spc-mm-image img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform 0.4s ease;
}
.spc-mm-wrap.layout-overlay a.spc-mm-card:hover .spc-mm-image img { transform: scale(1.05); }
.spc-mm-wrap.layout-overlay .spc-mm-card::before {
    content: "";
    position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.30) 46%, rgba(0,0,0,0) 74%);
}
.spc-mm-wrap.layout-overlay .spc-mm-body {
    position: absolute; inset: auto 0 0 0; z-index: 2;
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
    padding: 22px 22px 24px;
}
.spc-mm-wrap.layout-overlay .spc-mm-country { color: #fff; }
.spc-mm-wrap.layout-overlay .spc-mm-country::before { background: #fff; }
.spc-mm-wrap.layout-overlay .spc-mm-title { color: #fff; font-size: 23px; }
.spc-mm-wrap.layout-overlay .spc-mm-date { color: rgba(255,255,255,0.88); }
.spc-mm-wrap.layout-overlay .spc-mm-cost { color: #fff; }
.spc-mm-wrap.layout-overlay .spc-mm-readmore { color: #fff; text-decoration: underline; }
.spc-mm-wrap.layout-overlay .spc-mm-desc { color: rgba(255,255,255,0.9); }

/* Arrow badge, bottom-right — fills accent on hover, like the theme cards */
.spc-mm-wrap.layout-overlay a.spc-mm-card::after {
    content: "\2192";
    position: absolute; z-index: 3; top: 20px; right: 20px;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--spc-mm-radius);
    background: rgba(255, 255, 255, 0.22);
    color: #fff; font-size: 19px; line-height: 1;
    transition: background 0.18s ease, color 0.18s ease;
}
.spc-mm-wrap.layout-overlay a.spc-mm-card:hover::after { background: var(--spc-mm-accent); color: #fff; }
.spc-mm-wrap.layout-overlay a.spc-mm-card:focus-visible { outline: 3px solid var(--spc-mm-accent); outline-offset: 3px; }

/* ---- Footer / View all ---- */
.spc-mm-footer { margin-top: 32px; text-align: center; }
.spc-mm-viewall {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 13px 30px;
    border-radius: var(--spc-mm-radius);
    background: var(--spc-mm-accent);
    color: #fff;
    font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    text-decoration: none;
    transition: background 0.15s ease;
}
.spc-mm-viewall::after { content: "\2192"; font-size: 15px; }
.spc-mm-viewall:hover { background: var(--spc-mm-accent-hover); color: #fff; }

/* ---- Empty / error state ---- */
.spc-mm-empty {
    display: flex; flex-direction: column; gap: 6px;
    padding: 28px;
    border: 1px dashed #c7cdd4; border-radius: var(--spc-mm-radius);
    color: var(--spc-mm-text); background: #fafbfc;
}
.spc-mm-empty strong { font-size: 16px; color: var(--spc-mm-ink); }

/* ---- Text-style helpers (for placing cards on dark sections) ---- */
.spc-mm-wrap.spc-mm-style-light .spc-mm-title { color: #fff; }
.spc-mm-wrap.spc-mm-style-light .spc-mm-date  { color: rgba(255,255,255,0.85); }
.spc-mm-wrap.spc-mm-style-light .spc-mm-cost  { color: #fff; }
.spc-mm-wrap.spc-mm-style-light .spc-mm-desc  { color: rgba(255,255,255,0.9); }
.spc-mm-wrap.spc-mm-style-light.layout-cards .spc-mm-card,
.spc-mm-wrap.spc-mm-style-light.layout-list  .spc-mm-card { --spc-mm-card-bg: rgba(255,255,255,0.08); }

/* ==================================================================
   On-page trip detail modal (v1.5)
   The modal is appended to <body>, OUTSIDE .spc-mm-wrap, so it re-declares
   the theme-linked tokens it needs (accent and eyebrow font).
   ================================================================== */
.spc-mm-modal {
    --spc-mm-accent:       var(--wpex-accent, #127D63);
    --spc-mm-accent-hover: var(--wpex-accent-alt, #0f6a54);
    --spc-mm-ink:          var(--wpex-palette-252-color, #272324);
    --spc-mm-text:         rgba(39, 35, 36, 0.82);
    --spc-mm-muted:        rgba(39, 35, 36, 0.60);
    --spc-mm-radius:       0px;
    --spc-mm-eyebrow-font: var(--wpex-editorsnote-font, "Editors Note", Georgia, serif);

    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    box-sizing: border-box;
    font-family: inherit;
}
.spc-mm-modal *, .spc-mm-modal *::before, .spc-mm-modal *::after { box-sizing: border-box; }
.spc-mm-modal.is-open { display: block; }

/* scroll lock while open */
html.spc-mm-modal-lock, body.spc-mm-modal-lock { overflow: hidden; }

.spc-mm-modal-overlay {
    position: absolute; inset: 0;
    background: rgba(16, 20, 24, 0.62);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    animation: spc-mm-fade 0.18s ease;
}
.spc-mm-modal-dialog {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(920px, calc(100vw - 40px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    color: var(--spc-mm-text);
    border-radius: var(--spc-mm-radius);
    box-shadow: 0 24px 70px rgba(16, 24, 40, 0.35);
    outline: none;
    animation: spc-mm-pop 0.2s ease;
}
@keyframes spc-mm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spc-mm-pop {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.985); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.spc-mm-modal-close {
    position: absolute; top: 12px; right: 12px; z-index: 5;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: var(--spc-mm-radius);
    background: rgba(255, 255, 255, 0.92);
    color: #272324; font-size: 26px; line-height: 1; cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: background 0.15s ease, color 0.15s ease;
}
.spc-mm-modal-close:hover { background: var(--spc-mm-accent); color: #fff; }
.spc-mm-modal-close:focus-visible { outline: 3px solid var(--spc-mm-accent); outline-offset: 2px; }

.spc-mm-modal-hero { width: 100%; aspect-ratio: 16 / 7; background: #eef1f4; overflow: hidden; }
.spc-mm-modal-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

.spc-mm-modal-head { padding: 24px 30px 0; display: flex; flex-direction: column; gap: 10px; }
.spc-mm-modal-title { margin: 0; font-size: 30px; line-height: 1.12; font-weight: 800; color: var(--spc-mm-ink); }
.spc-mm-modal-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: baseline; }
.spc-mm-modal-when { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; color: var(--spc-mm-muted); }
.spc-mm-modal-cost { font-size: 17px; font-weight: 800; color: var(--spc-mm-accent); }

.spc-mm-modal-cols { display: grid; grid-template-columns: 1fr; gap: 26px; padding: 20px 30px 4px; }
/* Desktop: description 2/3 + sidebar (leader + goals) 1/3. Single column on small screens.
   `.has-side` is set server-side; the :has() fallback covers any markup edge case. */
@media (min-width: 760px) {
    .spc-mm-modal-cols.has-side,
    .spc-mm-modal-cols:has(.spc-mm-modal-side) { grid-template-columns: 2fr 1fr; align-items: start; }
}
.spc-mm-modal-desc { font-size: 15.5px; line-height: 1.62; color: var(--spc-mm-text); }
.spc-mm-modal-desc p { margin: 0 0 14px; }
.spc-mm-modal-desc p:last-child { margin-bottom: 0; }

.spc-mm-modal-side { display: flex; flex-direction: column; gap: 20px; }
.spc-mm-modal-block { border: 1px solid #e6e9ee; border-radius: var(--spc-mm-radius); padding: 16px 18px; background: #fafbfc; }
.spc-mm-modal-block h4 {
    margin: 0 0 10px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--spc-mm-muted);
}
.spc-mm-leader { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.spc-mm-leader:last-child { margin-bottom: 0; }
.spc-mm-leader-name { font-weight: 700; color: var(--spc-mm-ink); }
.spc-mm-leader-email { color: var(--spc-mm-accent); font-size: 14px; text-decoration: none; word-break: break-word; }
.spc-mm-leader-email:hover { text-decoration: underline; }
.spc-mm-goals-table { width: 100%; border: 0 !important; border-collapse: collapse; border-spacing: 0; box-shadow: none !important; font-size: 14px; }
.spc-mm-goals-table tbody,
.spc-mm-goals-table tr { border: 0 !important; background: transparent !important; }
.spc-mm-goals-table td {
    padding: 7px 0;
    border: 0 !important;
    border-bottom: 1px solid #eceef2 !important;
    background: transparent !important;
    color: var(--spc-mm-text);
}
.spc-mm-goals-table tr:last-child td { border-bottom: 0 !important; }
.spc-mm-goals-table td:last-child { text-align: right; font-weight: 700; color: var(--spc-mm-ink); white-space: nowrap; }

.spc-mm-modal-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px;
    padding: 18px 30px 28px; margin-top: 8px;
    border-top: 1px solid #eef0f3;
}
.spc-mm-modal-fullpage { color: var(--spc-mm-accent); font-size: 13.5px; font-weight: 700; text-decoration: none; }
.spc-mm-modal-fullpage:hover { text-decoration: underline; }

/* Eyebrow + button styles, re-scoped for the modal (outside .spc-mm-wrap) */
.spc-mm-modal .spc-mm-country {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: var(--spc-mm-eyebrow-font); font-style: italic; font-size: 15px; line-height: 1;
    text-transform: capitalize; color: var(--spc-mm-accent);
}
.spc-mm-modal .spc-mm-country::before { content: ""; width: 22px; height: 2px; background: var(--spc-mm-accent); flex: 0 0 auto; }
.spc-mm-modal .spc-mm-button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 30px;
    border: 2px solid var(--spc-mm-accent); border-radius: var(--spc-mm-radius);
    background: var(--spc-mm-accent); color: #fff;
    font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    line-height: 1; text-decoration: none; text-align: center;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.spc-mm-modal .spc-mm-button:hover { background: var(--spc-mm-accent-hover); border-color: var(--spc-mm-accent-hover); color: #fff; }

@media (max-width: 600px) {
    .spc-mm-modal-dialog {
        width: 100vw; max-width: 100vw; height: 100%; max-height: 100%;
        top: 0; left: 0; transform: none; border-radius: 0; animation: spc-mm-fade 0.2s ease;
    }
    .spc-mm-modal-head { padding: 22px 20px 0; }
    .spc-mm-modal-title { font-size: 25px; }
    .spc-mm-modal-cols { padding: 18px 20px 4px; }
    .spc-mm-modal-actions { padding: 18px 20px 24px; }
    .spc-mm-modal-actions .spc-mm-button { width: 100%; }
}

/* Cursor hint: modal-opening elements are interactive even with a # href */
.spc-mm-open { cursor: pointer; }

/* ---- "Upcoming" pill — shown instead of Apply when a trip isn't accepting applications yet ---- */
.spc-mm-upcoming {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    text-align: center;
    padding: 11px 18px;
    border: 1px dashed rgba(39, 35, 36, 0.30);
    border-radius: var(--spc-mm-radius, 2px);
    background: rgba(39, 35, 36, 0.04);
    color: var(--spc-mm-date, rgba(39, 35, 36, 0.62));
    font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1;
}
.spc-mm-wrap.layout-overlay .spc-mm-upcoming { border-color: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.16); color: #fff; }
.spc-mm-wrap.spc-mm-style-light .spc-mm-upcoming { border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.spc-mm-modal .spc-mm-upcoming { border-color: rgba(39, 35, 36, 0.28); background: rgba(39, 35, 36, 0.04); color: var(--spc-mm-muted); }
