/* Perennial 5 weekly brief popup, in the Perennial design system (light theme: pale mint haze on #f4f8f7, white glass,
   Evergreen accent, Jost / Public Sans / IBM Plex Mono, Perennial Ink pill button, as on the site's light pages). One file for both homes:
   - static site: <dialog class="brief-modal"> (src/build.py brief_modal)
   - perennialmarkets.com: Popup Maker popup #pum-163 + Contact Form 7 form with html_class "bm-form"
   Content rules are scoped to .pbm / .bm-form so they work in either container. */

/* ---------- containers ---------- */
.brief-modal, #pum-163 .pum-container {
  --bm-ink: #0a1d24; --bm-surface: #0f2a33; --bm-mint: #86e3c0; --bm-mint-hi: #a9efd5; --bm-teal: #35aab6;
  --bm-text: #0f2a33; --bm-muted: #4a6570; --bm-line: rgba(15, 42, 51, .10); --bm-ever: #127481;
  --bm-display: var(--font-display, "Jost", "Futura", system-ui, sans-serif);
  --bm-sans: var(--font-sans, "Public Sans", "Helvetica Neue", Arial, sans-serif);
  --bm-mono: var(--font-mono, "IBM Plex Mono", ui-monospace, Menlo, monospace);
  box-sizing: border-box; padding: 0; border: 1px solid rgba(255, 255, 255, .9); border-radius: 20px; color: var(--bm-text); font-family: var(--bm-sans);
  background:
    radial-gradient(55% 45% at 10% 0%, rgba(134, 227, 192, .45), transparent 70%),
    radial-gradient(50% 55% at 100% 30%, rgba(53, 170, 182, .22), transparent 70%),
    radial-gradient(60% 45% at 40% 105%, rgba(233, 255, 247, .9), transparent 70%),
    linear-gradient(180deg, #f7fbfa, #eef4f3);
  box-shadow: 0 50px 120px -30px rgba(10, 29, 36, .55), inset 0 1px 0 #fff;
  overflow-x: hidden; overflow-y: auto;
}
.brief-modal { width: min(880px, calc(100% - 32px)); max-height: calc(100dvh - 32px); }
.brief-modal::backdrop, #pum-163.pum-overlay { background: rgba(10, 29, 36, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.brief-modal[open] { animation: bmIn .55s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes bmIn { from { opacity: 0; transform: translateY(24px) scale(.98); } }
#pum-163 .pum-container { max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); }
/* Popup Maker's custom size is a fixed 900px and positions the box from that width, so on phones it ran off-screen.
   Let the box follow the screen: full width minus a small margin, centred, capped at 900px. */
#pum-163 .pum-container.popmake { box-sizing: border-box; width: min(900px, calc(100vw - 24px)) !important; max-width: none !important; min-width: 0 !important; left: 0 !important; right: 0 !important; margin-left: auto !important; margin-right: auto !important; }
@media (max-width: 680px) { #pum-163 .pum-container.popmake { top: 12px !important; max-height: calc(100dvh - 24px); border-radius: 16px; } }
#pum-163 .pum-title { display: none; }
#pum-163 .pum-content { padding: 0; }
#pum-163 .pum-content p { margin: 0; }

/* close: frosted round button */
.bm-x-form { position: sticky; top: 0; height: 0; z-index: 3; display: flex; justify-content: flex-end; }
.bm-x, #pum-163 .pum-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; padding: 0; border: 1px solid rgba(15, 42, 51, .12); border-radius: 50%; background: rgba(255, 255, 255, .7); color: #0f2a33; font-size: 22px; line-height: 36px; text-align: center; cursor: pointer; box-shadow: none; text-shadow: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .2s, border-color .2s; }
.bm-x:hover, #pum-163 .pum-close:hover { background: #fff; border-color: rgba(18, 116, 129, .45); }
#pum-163 .pum-close { font-size: 0; }
#pum-163 .pum-close::after { content: "×"; font-size: 22px; line-height: 36px; }

/* ---------- head ---------- */
.pbm .bm-head { display: grid; justify-items: center; gap: 14px; padding: 52px 48px 0; text-align: center; }
.pbm .bm-eyebrow { font-family: var(--bm-mono); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--bm-ever); }
.pbm .bm-title { margin: 0; font-family: var(--bm-display); font-size: clamp(26px, 3.6vw, 38px); font-weight: 500; line-height: 1.12; letter-spacing: -.005em; color: var(--bm-ink); max-width: 22ch; }
.pbm .bm-pitch { max-width: 58ch; font-size: 16px; line-height: 1.6; color: var(--bm-muted); }
.pbm .bm-sections { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0 0; padding: 0; list-style: none; }
.pbm .bm-sections li { margin: 0; padding: 5px 12px; border: 1px solid rgba(18, 116, 129, .18); border-radius: 999px; background: rgba(255, 255, 255, .7); font-family: var(--bm-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--bm-ever); }

/* ---------- evergreen preview tiles (frosted glass) ---------- */
.pbm .bm-pages { position: relative; height: 270px; margin: 30px 48px 4px; }
.pbm .bm-page { position: absolute; box-sizing: border-box; padding: 16px 18px; border-radius: 14px; border: 1px solid #fff; background: linear-gradient(160deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .6)); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 26px 50px -28px rgba(15, 42, 51, .45), inset 0 1px 0 #fff; overflow: hidden; }
.pbm .bm-p1 { left: 0; top: 10px; width: 38%; height: 190px; transform: rotate(-3deg); }
.pbm .bm-p3 { right: 0; top: 10px; width: 38%; height: 190px; transform: rotate(3deg); }
.pbm .bm-p2 { left: 50%; top: 40px; width: 34%; height: 220px; transform: translateX(-50%); z-index: 1; border-color: rgba(15, 42, 51, .9); background: linear-gradient(160deg, #14404b, #0f2a33 45%, #0a1d24); box-shadow: 0 30px 60px -26px rgba(10, 29, 36, .7); }
.brief-modal[open] .bm-p1, .pum-active .pbm .bm-p1 { animation: bmTile .8s .15s cubic-bezier(.2, .7, .2, 1) both; }
.brief-modal[open] .bm-p2, .pum-active .pbm .bm-p2 { animation: bmTile .8s .3s cubic-bezier(.2, .7, .2, 1) both; }
.brief-modal[open] .bm-p3, .pum-active .pbm .bm-p3 { animation: bmTile .8s .45s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes bmTile { from { opacity: 0; translate: 0 22px; } }
.pbm .bmp-kicker { font-family: var(--bm-mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--bm-ever); }
.pbm .bm-p2 .bmp-kicker { color: var(--bm-mint); }
.pbm .bmp-h { margin-top: 6px; font-family: var(--bm-display); font-size: 15px; font-weight: 500; line-height: 1.2; color: var(--bm-ink); }
.pbm .bmp-bars { display: grid; gap: 6px; margin-top: 10px; }
.pbm .bmp-bars i, .pbm .bmp-five i { display: block; height: 6px; border-radius: 3px; background: rgba(15, 42, 51, .10); }
.pbm .bmp-five i { background: rgba(255, 255, 255, .16); }
.pbm .bmp-view { margin-top: 12px; padding: 8px 10px; border-left: 2px solid var(--bm-mint); border-radius: 0 6px 6px 0; background: rgba(134, 227, 192, .16); }
.pbm .bmp-view b { font-size: 10px; font-weight: 600; color: var(--bm-ever); }
.pbm .bmp-view .bmp-bars { margin-top: 6px; gap: 5px; }
.pbm .bmp-view .bmp-bars i { background: rgba(18, 116, 129, .22); }
.pbm .bmp-cover { position: relative; min-height: 70px; padding-right: 64px; }
.pbm .bmp-cover img { position: absolute; right: -6px; top: -8px; width: 68px; height: auto; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .55)); animation: bmFloat 6s ease-in-out infinite; }
@keyframes bmFloat { 50% { transform: translateY(-4px) rotate(-3deg); } }
.pbm .bmp-subject { margin-top: 4px; font-family: var(--bm-display); font-size: 20px; font-weight: 500; line-height: 1.1; color: #fff; }
.pbm .bmp-five { list-style: none; margin: 10px 0 0; padding: 10px 0 0; display: grid; gap: 9px; border-top: 1px solid var(--bm-line); }
.pbm .bmp-five li { display: flex; align-items: center; gap: 8px; margin: 0; }
.pbm .bmp-five span { flex: 0 0 auto; font-family: var(--bm-mono); font-size: 9px; color: var(--bm-mint); }
.pbm .bmp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.pbm .bmp-up, .pbm .bmp-down { font-size: 10px; font-weight: 600; }
.pbm .bmp-up { color: var(--bm-ever); }
.pbm .bmp-down { color: #c0574e; }
.pbm .bmp-chips { display: grid; gap: 5px; margin-top: 6px; }
.pbm .bmp-chips i { display: block; height: 14px; border-radius: 4px; background: rgba(192, 87, 78, .10); }
.pbm .bmp-cols > div:first-child .bmp-chips i { background: rgba(134, 227, 192, .35); }
.pbm .bmp-ahead { margin-top: 12px; }
.pbm .bmp-week { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 6px; }
.pbm .bmp-week span { padding: 5px 0; border-radius: 4px; background: rgba(15, 42, 51, .06); font-family: var(--bm-mono); font-size: 8px; text-align: center; color: var(--bm-muted); }
.pbm .bmp-week span:nth-child(2), .pbm .bmp-week span:nth-child(4) { background: rgba(134, 227, 192, .4); color: var(--bm-ink); }

/* ---------- form (static <form class="bm-form"> or CF7 form with html_class bm-form) ---------- */
#pum-163 .wpcf7 { padding: 0; }
.bm-form { display: grid; gap: 16px; margin: 0; padding: 22px 48px 44px; background: none; border: 0; box-shadow: none; }
.bm-form .bm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.bm-form .bm-wide { grid-column: 1 / -1; }
.bm-form .wpcf7-form-control-wrap { display: block; }
.bm-form br { display: none; }
.bm-form input[type="text"], .bm-form input[type="email"], .bm-form input[type="tel"] { box-sizing: border-box; width: 100%; height: 52px; margin: 0; padding: 0 18px; border: 1px solid rgba(15, 42, 51, .14); border-radius: 10px; background: rgba(255, 255, 255, .85); color: var(--bm-ink); font-family: var(--bm-sans); font-size: 16px; box-shadow: none; transition: border-color .2s, background .2s; }
.bm-form input::placeholder { color: #6b8088; }
.bm-form input[type="text"]:focus, .bm-form input[type="email"]:focus, .bm-form input[type="tel"]:focus { outline: none; border-color: var(--bm-ever); background: #fff; box-shadow: 0 0 0 3px rgba(134, 227, 192, .35); }
.bm-form [aria-invalid="true"], .bm-form .wpcf7-not-valid { border-color: #c0392b !important; }
.bm-form .wpcf7-not-valid-tip { margin-top: 4px; font-size: 13px; color: #c0392b; }
.bm-form .bm-consent { margin: 0; font-size: 12px; line-height: 1.55; color: var(--bm-muted); }
.bm-form .bm-consent a { color: var(--bm-ever); }
.bm-form .bm-submit { display: flex; justify-content: center; align-items: center; gap: 8px; }
.bm-form .bm-send { height: 52px; margin: 0; padding: 0 32px; border: 0; border-radius: 999px; background: var(--bm-surface); color: #fff; font-family: var(--bm-sans); font-size: 16px; font-weight: 600; cursor: pointer; box-shadow: 0 14px 30px -14px rgba(15, 42, 51, .6); transition: background .2s, transform .2s; }
.bm-form .bm-send:hover { background: var(--bm-ever); transform: translateY(-1px); }
.bm-form .form-status { text-align: center; color: var(--bm-text); }
.bm-form .wpcf7-spinner { background-color: var(--bm-ever); }
.bm-form .wpcf7-response-output { margin: 0 !important; padding: 10px 14px !important; border: 1px solid rgba(18, 116, 129, .4) !important; border-radius: 10px; background: rgba(134, 227, 192, .18); color: var(--bm-ink); text-align: center; font-size: 14px; }
.bm-form.invalid .wpcf7-response-output, .bm-form.failed .wpcf7-response-output, .wpcf7-form.invalid .wpcf7-response-output { border-color: rgba(192, 57, 43, .45) !important; background: #fdf1f0; }

.bm-form .pn-iti { display: block; width: 100%; }
.bm-form .iti__selected-dial-code { color: #0f2a33; }

/* ---------- phones ---------- */
@media (max-width: 680px) {
  .pbm .bm-head { gap: 10px; padding: 34px 20px 0; }
  .pbm .bm-eyebrow { font-size: 11px; }
  .pbm .bm-title { font-size: 24px; line-height: 1.15; max-width: 16ch; }
  .pbm .bm-pitch { font-size: 14px; line-height: 1.5; }
  .pbm .bm-sections { display: none; }
  /* preview: one card in normal flow, never clipped */
  .pbm .bm-pages { position: static; height: auto; margin: 16px 20px 0; }
  .pbm .bm-p1, .pbm .bm-p3 { display: none; }
  .pbm .bm-p2 { position: relative; left: auto; top: auto; transform: none; width: 100%; height: auto; padding: 14px 16px; }
  .pbm .bmp-cover { min-height: 52px; padding-right: 56px; }
  .pbm .bmp-cover img { width: 54px; top: -4px; }
  .pbm .bmp-subject { font-size: 18px; }
  .pbm .bmp-five { gap: 7px; margin-top: 8px; padding-top: 8px; }
  .brief-modal[open] .bm-p2, .pum-active .pbm .bm-p2 { animation: none; }
  /* form: names side by side, compact fields, full-width button */
  .bm-form { gap: 12px; padding: 16px 20px 22px; }
  .bm-form .bm-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .bm-form input[type="text"], .bm-form input[type="email"], .bm-form input[type="tel"] { height: 46px; padding: 0 14px; font-size: 16px; }
  .bm-form .bm-consent { font-size: 11px; line-height: 1.45; }
  .bm-form .bm-send { width: 100%; height: 48px; }
  .bm-x, #pum-163 .pum-close { top: 10px; right: 10px; width: 34px; height: 34px; line-height: 32px; }
}
@media (max-width: 680px) and (max-height: 700px) {
  .pbm .bm-pages { display: none; }
  .pbm .bm-head { padding-top: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .brief-modal[open], .pbm .bm-page, .pbm .bmp-cover img { animation: none !important; }
}

/* ---------- Perennial Weekly Brief plugin (dialog #pnwb-modal) ---------- */
#pnwb-modal[hidden] { display: none; }
#pnwb-modal .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#pnwb-modal .pnwb-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#pnwb-modal .pnwb-status { margin: 12px 0 0; font-size: 15px; }
#pnwb-modal .bm-form.failed .pnwb-status { color: #c0392b; }
#pnwb-modal .bm-form.sent .pnwb-status { margin: 4px 0 0; padding: 16px 18px; border: 1px solid rgba(18, 116, 129, .4); border-radius: 12px; background: rgba(134, 227, 192, .2); color: #0a1d24; font-size: 16px; }
#pnwb-modal .bm-send:disabled { opacity: .6; cursor: progress; }
html.pnwb-open { overflow: hidden; }
