/* Match the reading column while keeping a separate inset inside form cards. */
@media (max-width: 700px) {
    .rc-wp .rc-newsletter-shell,
    .rc-wp .story-layout--reading,
    .rc-wp .rc-contact-layout {
        padding-inline: 20px;
    }

    .rc-wp .rc-newsletter,
    .rc-wp .rc-conversation .comment-respond,
    .rc-wp .rc-form-panel {
        padding: 20px clamp(16px, 4.8vw, 20px);
        min-width: 0;
        border: 1px solid var(--line);
        border-radius: 12px;
    }

    .rc-wp .rc-contact-layout,
    .rc-wp .rc-contact-form,
    .rc-wp .rc-contact-two,
    .rc-wp .rc-conversation .comment-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .rc-wp .rc-contact-form > *,
    .rc-wp .rc-conversation .comment-form > * {
        min-width: 0;
    }

    /* Where sections meet, use one deliberate gap before the newsletter. */
    .rc-wp main:has(+ .rc-newsletter-shell) > :is(.related-section, .rc-archive-section, .rc-contact-layout, .culture-section):last-child {
        padding-bottom: 12px;
    }

    /* Let the verification alone use the card's side insets on narrow phones.
       An interaction-only frame can expand here without stretching the fields. */
    .rc-wp .rc-turnstile {
        display: grid;
        grid-template-columns: 100%;
        justify-items: center;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .rc-wp .rc-service-switcher label {
        flex: 1 1 185px;
        max-width: 210px;
        min-width: 0;
    }

    .rc-wp .rc-service-switcher select {
        font-size: 16px;
    }
}

@media (max-width: 400px) {
    .rc-wp .rc-service-switcher > a {
        flex: 0 1 auto;
        max-width: 34%;
    }
}

/* Keep every navigation destination within reach on shorter phones. */
@media (max-width: 700px) and (max-height: 740px) {
    .rc-wp .mobile-drawer {
        padding-block: 10px max(10px, env(safe-area-inset-bottom));
    }
    .rc-wp .drawer-head {
        top: -10px;
        padding-block: 0 5px;
        margin-bottom: 8px;
    }
    .rc-wp .drawer-search { margin-bottom: 10px; }
    .rc-wp .mobile-primary-grid,
    .rc-wp .mobile-drawer .mobile-category-grid { gap: 4px; }
    .rc-wp .mobile-drawer .mobile-category-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .rc-wp .mobile-drawer .mobile-category-grid a {
        padding: 4px;
        font-size: 13px;
        line-height: 1.3;
    }
    .rc-wp .mobile-drawer-subtitle { margin: 12px 0 4px; }
    .rc-wp .mobile-drawer > p { margin-top: 8px; padding-top: 6px; }
}

@media (max-width: 700px) and (max-height: 520px) {
    .rc-wp .mobile-drawer > p { display: none; }
}

@media (min-width: 520px) and (max-width: 700px) and (max-height: 480px) {
    .rc-wp .mobile-drawer { width: 100%; }
    .rc-wp .drawer-head { margin-bottom: 4px; padding-bottom: 0; }
    .rc-wp .drawer-search { margin-bottom: 6px; }
    .rc-wp .mobile-drawer nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 16px;
        align-items: start;
    }
    .rc-wp .mobile-primary-grid { grid-row: 1 / 3; }
    .rc-wp .mobile-drawer-subtitle { margin-top: 0; }
    .rc-wp .mobile-drawer .mobile-category-grid { grid-column: 2; }
}

@media (max-width: 600px) {
    .rc-wp .rc-newsletter form > .rc-consent { grid-row: 3; }
    .rc-wp .rc-newsletter-verification { grid-row: auto; }
    .rc-wp .rc-newsletter form .primary-btn { grid-column: 1; grid-row: auto; }
    .rc-wp .rc-newsletter-status { grid-row: auto; }
}

/* A 300px Cloudflare challenge needs the full card on a 320px screen.
   Keep a small outer margin only on the card that actually uses the widget. */
@media (max-width: 344px) {
    .rc-wp .rc-newsletter:has(.rc-turnstile),
    .rc-wp .rc-form-panel:has(.rc-turnstile),
    .rc-wp .rc-conversation .comment-respond:has(.rc-turnstile),
    .rc-wp .rc-reading-page .rc-prose:has(.rc-contact-form .rc-turnstile) {
        width: auto;
        margin-inline: min(0px, calc((100% - 304px) / 2));
    }
}
