/* The coffeemug-style theme (fonts, buttons, cards, forms). Bump ?v= after editing theme.css. */
@import url("theme.css?v=2");

/*
 * Phones: a compact, app-like layout. Loaded after the other stylesheets (layouts/wrapper), only
 * on screens up to 767px. Everything sized in rem gets smaller with the root font size; the rest
 * (px heights, big icons, section spacing) is tightened here. Long card lists become rows that
 * swipe sideways, and a tab bar sits at the bottom (shared/bottom-nav).
 */
@media (max-width: 767.98px) {
    html { font-size: var(--text-base); }
    body { -webkit-tap-highlight-color: transparent; }

    .container, .container-fluid { padding-left: 14px; padding-right: 14px; }
    .row { margin-left: -7px; margin-right: -7px; }
    .row > [class*="col"] { padding-left: 7px; padding-right: 7px; }

    /* Header */
    .ms-header .navbar { padding-top: .45rem; padding-bottom: .45rem; }
    .ms-header-logo { max-height: 30px; }
    .ms-theme-toggle { width: 34px; height: 34px; }

    /* Buttons and fields */
    .ms-btn { height: 42px; padding: 0 1.2rem; border-radius: 6px; font-size: var(--text-xl); }
    .ms-btn-sm { height: 34px; padding: 0 .9rem; border-radius: 4px; font-size: var(--text-lg); }
    .btn { border-radius: 4px; }
    .form-control, .custom-select { border-radius: 4px; }
    .form-control:not(textarea), .custom-select { height: 42px; }

    /* Sections and titles */
    .ms-section { padding: 2.1rem 0; }
    .ms-hero { padding: 1.4rem 0 1.6rem; }
    .ms-hero h1 { font-size: var(--text-6xl); margin: .8rem 0 .6rem; }
    .ms-lead { font-size: var(--text-xl); line-height: 1.55; }
    .ms-section-title, .ms-title-lg { font-size: var(--text-4xl); line-height: 1.2; }
    .ms-pill { font-size: var(--text-sm); }
    .ms-news { padding: .3rem .4rem .3rem .3rem; font-size: var(--text-base); }
    .ms-analyze-box .ms-btn, .ms-analyze-input, .ms-analyze-mode select { height: 44px; }
    .ms-checks { gap: .4rem .9rem; font-size: var(--text-lg); }
    .ms-mockup-wrap { margin-top: 1.8rem; }
    .ms-cta { padding: 2rem 0; }
    .ms-cta h2 { font-size: var(--text-4xl); }

    /* Home: the four features as small tiles, two per row */
    .ms-features { padding: .6rem 0 1.4rem; }
    .ms-features .row > [class*="col"] { flex: 0 0 50%; max-width: 50%; margin-bottom: 14px; }
    .ms-feature { padding: .9rem .7rem; border: 1px solid var(--ms-line); border-radius: 6px; background: var(--ms-card); box-shadow: var(--ms-shadow); }
    .ms-icon-circle { width: 44px; height: 44px; }
    .ms-icon-circle svg { width: 20px; height: 20px; }
    .ms-feature h3 { margin: .55rem 0 .2rem; font-size: var(--text-xl); }
    .ms-feature p { font-size: var(--text-base); line-height: 1.4; }

    /* Long card lists: one row that swipes sideways */
    .ms-audit-grid, .ms-steps, .ms-spotlight, .ms-plans {
        display: flex; gap: 12px; margin-left: -14px; margin-right: -14px; padding: 16px 14px 10px;
        overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    .ms-audit-grid::-webkit-scrollbar, .ms-steps::-webkit-scrollbar, .ms-spotlight::-webkit-scrollbar, .ms-plans::-webkit-scrollbar { display: none; }
    .ms-audit-grid > *, .ms-steps > *, .ms-spotlight > *, .ms-plans > * { flex: 0 0 84%; max-width: 84%; scroll-snap-align: start; }
    .ms-audit-grid, .ms-steps, .ms-spotlight { margin-top: 1.2rem; }
    .ms-plans { padding-top: 20px; }
    .ms-audit-card, .ms-step, .ms-plan { padding: 1.1rem 1rem; border-radius: 6px; }
    .ms-steps { padding-top: 30px; }
    .ms-step { padding-top: 2.4rem; }
    .ms-step-number { top: -24px; width: 48px; height: 48px; font-size: var(--text-4xl); }
    .ms-plan:hover, .ms-plan.is-featured { transform: none; }
    .ms-plan-features { margin: .8rem 0 1rem; padding-top: .8rem; }
    .ms-plan-features li { font-size: var(--text-lg); padding: .2rem 0; }
    .ms-icon-round, .ms-icon-square { width: 44px; height: 44px; }
    .ms-icon-round svg, .ms-icon-square svg { width: 20px; height: 20px; }
    .ms-spot-visual { min-height: 0; }

    /* Home: the tools as a two-column grid of small tiles */
    .ms-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 1.2rem; }
    .ms-tool-icon { width: 30px; height: 30px; }
    .ms-split-gap { margin-top: 1.8rem; }
    .ms-engines { gap: 1rem 1.4rem; }

    /* Tools list: one card of rows, like an app's settings list */
    .tl-hero { padding: 1rem 0 1.4rem; }
    .tl-hero-inner { padding-top: .4rem; }
    .tl-title { font-size: var(--text-5xl); }
    .tl-search-input, .tl-search-btn { height: 42px; }
    .tl-tabs-wrap { padding: .55rem 0; }
    .tl-tab { padding: .4rem .85rem; font-size: var(--text-lg); }
    .tl-grid { gap: 0; border: 1px solid var(--ms-line); border-radius: 6px; background: var(--ms-card); overflow: hidden; box-shadow: var(--ms-shadow); }
    .tl-card, .tl-card:hover { transform: none; padding: .7rem .8rem; border: 0; border-bottom: 1px solid var(--ms-line); border-radius: 0; box-shadow: none; }
    .tl-card:last-child { border-bottom: 0; }
    .tl-card-text b { font-size: var(--text-xl); }
    .tl-card-text small { -webkit-line-clamp: 1; line-clamp: 1; font-size: var(--text-base); }
    .tl-group-head h2, .tl-section h2, .tl-related-head h2 { font-size: var(--text-3xl); }
    .tl-hero h1 { font-size: var(--text-4xl); }
    .tl-tool { margin-top: 0; }

    /* Blog: the lead post stacks like the others */
    .ms-post-card.is-lead .ms-post-thumb { flex: 0 0 auto; }
    .ms-post-card.is-lead h2 { font-size: var(--text-4xl); }
    .ms-post-card:not(.is-lead) { flex-direction: row; align-items: stretch; border-radius: 6px; }
    .ms-post-card:not(.is-lead) { align-items: center; }
    .ms-post-card:not(.is-lead) .ms-post-thumb { flex: 0 0 120px; align-self: center; margin-left: .65rem; border-radius: 6px; aspect-ratio: 1200 / 630; }
    .ms-post-card:not(.is-lead) .ms-post-body { gap: .3rem; padding: .7rem .8rem; min-width: 0; }
    .ms-post-card:not(.is-lead) .ms-post-body p { display: none; }
    .ms-post-card:not(.is-lead) .ms-post-cat { font-size: var(--text-xs); padding: .1rem .5rem; }
    .ms-post-card:not(.is-lead) h2, .ms-post-card:not(.is-lead) h3 { font-size: var(--text-xl); display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    .ms-post-card:not(.is-lead) .ms-post-meta { font-size: var(--text-sm); padding-top: 0; }
    .ms-post-card, .ms-post-card:hover { transform: none; }

    /* Dashboard, legal, blog and other page headings */
    .ms-app-main h1.h2, .ms-dash-hello h1 { font-size: var(--text-4xl); }
    .ms-legal-hero h1, .ms-pro-welcome h1 { font-size: var(--text-4xl); }
    .ms-box, .ms-panel { padding: 1rem; border-radius: 6px; }

    /* Grouped lists, like a phone's settings: one card, rows split by lines */
    .ms-list-group { margin: .9rem 0 0; border: 1px solid var(--ms-line); border-radius: 6px; background: var(--ms-card); overflow: hidden; box-shadow: var(--ms-shadow); }
    .ms-list-group > [class*="col"] { margin-top: 0 !important; padding: 0; }
    .ms-list-group .card { border-radius: 0; box-shadow: none !important; background: transparent; }
    .ms-list-group > [class*="col"] + [class*="col"] .card { border-top: 1px solid var(--ms-line) !important; }
    .ms-list-group .card-body { padding: .8rem .9rem; }
    .ms-dash-quick { gap: 0; border: 1px solid var(--ms-line); border-radius: 6px; background: var(--ms-card); overflow: hidden; box-shadow: var(--ms-shadow); }
    .ms-dash-quick .ms-quick, .ms-dash-quick .ms-quick:hover { transform: none; padding: .7rem .9rem; border: 0; border-radius: 0; box-shadow: none; }
    .ms-dash-quick .ms-quick + .ms-quick { border-top: 1px solid var(--ms-line); }
    .ms-quick-icon { width: 36px; height: 36px; border-radius: 6px; }
    .ms-app-bar-btn { padding: .35rem .8rem; font-size: var(--text-lg); }

    /* Admin: the figures two by two */
    .ms-admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .ms-admin-stat { padding: .8rem .85rem; border-radius: 6px; }
    .ms-admin-stat b { font-size: var(--text-3xl); }
    .ms-admin-stat .ms-quick-icon { display: none; }
    .ms-page-head h1 { font-size: var(--text-4xl); }

    /* Footer: lighter, and clear of the tab bar */
    .ms-footer-brand img { height: 26px; }
    .ms-footer .nav-link { font-size: var(--text-lg); padding-left: 1rem; padding-right: 0; }

    /* The tab bar at the bottom (shared/bottom-nav) */
    body.has-bottom-nav { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
    .ms-bottom-nav {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: flex;
        height: calc(62px + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom);
        border-top: 1px solid var(--ms-line); background: rgba(236, 232, 223, .94);
        backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    }
    .dark .ms-bottom-nav { background: rgba(13, 34, 55, .94); }
    .ms-bottom-nav a {
        flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
        color: var(--ms-muted); font-size: var(--text-xs); font-weight: 600; text-decoration: none !important;
    }
    .ms-bottom-nav svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .ms-bottom-nav span { padding: 3px 14px; border-radius: 99px; transition: background-color .2s; display: flex; }
    .ms-bottom-nav a.active { color: var(--ms-ink); }
    .ms-bottom-nav a.active span { background: var(--ms-red-soft); }
    .ms-bottom-nav a:active span { background: var(--ms-red-soft); }

    /* Popups open just above the tab bar (sheets sit on it) instead of under it; it stays visible */
    body.has-bottom-nav { --ms-bnav-h: calc(62px + env(safe-area-inset-bottom)); }
    body.has-bottom-nav .modal,
    body.has-bottom-nav .modal-backdrop,
    body.has-bottom-nav .msa-overlay,
    body.has-bottom-nav .ms-limit,
    body.has-bottom-nav .ms-pricing-modal,
    body.has-bottom-nav .mn-palette,
    body.has-bottom-nav .qr-progress { bottom: var(--ms-bnav-h); }
    body.has-bottom-nav .modal-backdrop { height: auto; }
    body.has-bottom-nav .msa-card { max-height: calc(100dvh - var(--ms-bnav-h) - 1rem); }
    /* QR studio: its tool bar sits on the tab bar, and the page leaves room for both */
    body.has-bottom-nav .qr-app .qr-dock { bottom: var(--ms-bnav-h); padding-bottom: .4rem; }
    body.has-bottom-nav.qr-app-on { padding-bottom: calc(var(--ms-bnav-h) + 76px); }
    body.has-bottom-nav .qr-mini { bottom: calc(var(--ms-bnav-h) + 12px); }
}

@media (min-width: 768px) {
    .ms-bottom-nav { display: none; }
}
