/*
 * App-style layout on phones (Admin › Settings › Layout › “App-style layout on phones”).
 * The website on a phone looks like the mobile app: search · logo · account on top, the sections in a white strip
 * on red, stories in rows (picture left, headline right), grey section headings with a coloured line, a bar of tabs
 * at the bottom, and the charts (exchange rates, bill rates, league tables, weather…) after the news.
 * Tablets and computers are not touched: every rule sits inside the phone media query.
 */
.m-band, .m-tabs, .m-search { display: none; }

@media (max-width: 767.98px) {
    body.site-public.m-app {
        --ma-accent: var(--brand-accent, #d90429);
        --ma-ink: var(--nd-ink, #111317);
        --ma-muted: var(--nd-muted, #8a8f98);
        --ma-line: var(--nd-line, #e6e7ea);
        --ma-card: var(--nd-surface, #ffffff);
        --ma-head: #ededee;
        --ma-tabs: 60px;
        --ma-bottom: env(safe-area-inset-bottom, 0px);
        background: #f0f0f1 !important;
        padding-bottom: calc(var(--ma-tabs) + var(--ma-bottom));
        -webkit-tap-highlight-color: transparent;
    }
    [data-bs-theme="dark"] body.site-public.m-app { --ma-head: #22252b; background: #0f1013 !important; }

    /* ------------------------------------------------------------ header: search · logo · account */
    body.site-public.m-app .site-header { position: sticky; top: 0; z-index: 1030; }
    body.site-public.m-app .site-topbar { border-bottom: 0 !important; }
    body.site-public.m-app .site-topbar > .container { min-height: 58px; padding-top: 0 !important; padding-bottom: 0 !important; padding-left: 6px; padding-right: 6px; }
    body.site-public.m-app .site-topbar .topbar-hamburger, body.site-public.m-app .site-topbar .topbar-search { display: none !important; }
    body.site-public.m-app .m-search, body.site-public.m-app .site-topbar .topbar-auth-icon { display: grid !important; place-items: center; width: 44px; height: 44px; margin: 0; border-radius: 50%; color: var(--ma-ink) !important; font-size: 1.55rem; }
    body.site-public.m-app .m-search svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
    body.site-public.m-app .m-search:active, body.site-public.m-app .site-topbar .topbar-auth-icon:active { background: rgba(127, 127, 127, .16); }
    body.site-public.m-app .site-topbar .site-logo { height: 38px; }

    /* The sections strip: a white bar, half on the header and half on red, dragged sideways. */
    body.site-public.m-app .m-band { display: block; position: relative; padding: 0 10px; overflow: hidden; color: #fff;
        background: linear-gradient(var(--ma-card) 0, var(--ma-card) 26px, var(--ma-accent) 26px, var(--ma-accent) 100%); }
    body.site-public.m-app .m-band__menu { position: relative; z-index: 1; display: flex; height: 54px; padding: 0 10px; border-radius: 14px; background: var(--ma-card);
        box-shadow: 0 2px 10px rgba(0, 0, 0, .1); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    body.site-public.m-app .m-band__menu::-webkit-scrollbar { display: none; }
    body.site-public.m-app .m-band__menu a { flex: none; position: relative; display: flex; align-items: center; padding: 0 14px; font-size: 18px; font-weight: 500; line-height: 1; color: var(--ma-ink); text-decoration: none; white-space: nowrap; }
    body.site-public.m-app .m-band__menu a.is-on { font-weight: 800; }
    body.site-public.m-app .m-band__menu a.is-on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 12px; height: 3px; border-radius: 2px; background: var(--ma-accent); opacity: .55; }
    body.site-public.m-app .m-band__row { position: relative; display: flex; align-items: center; justify-content: flex-end; height: 50px; }
    body.site-public.m-app .m-band__name { position: absolute; left: -4px; bottom: -10px; font-size: 64px; font-style: italic; font-weight: 900; line-height: 1; color: rgba(255, 255, 255, .16); white-space: nowrap; pointer-events: none; }
    body.site-public.m-app .m-band__more { position: relative; display: flex; align-items: center; gap: 6px; height: 34px; padding-left: 18px; border-left: 1px solid rgba(255, 255, 255, .7); font-size: 18px; color: #fff !important; text-decoration: none; }

    /* ------------------------------------------------------------ bottom tabs */
    body.site-public.m-app .m-tabs { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
        padding-bottom: var(--ma-bottom); background: var(--ma-card); border-top: 1px solid var(--ma-line); }
    body.site-public.m-app .m-tabs__item { display: flex; flex-direction: column; align-items: center; justify-content: center; height: var(--ma-tabs); font-size: 11.5px; font-weight: 600; color: var(--ma-muted); text-decoration: none; }
    body.site-public.m-app .m-tabs__item svg { width: 23px; height: 23px; margin-bottom: 2px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
    body.site-public.m-app .m-tabs__item.is-on { color: var(--ma-accent); }
    body.site-public.m-app .m-tabs__item.is-on svg { stroke-width: 2.3; }
    /* Things pinned to the bottom of the screen sit above the tabs. */
    body.site-public.m-app .cookie-consent { bottom: calc(var(--ma-tabs) + var(--ma-bottom)) !important; }
    body.site-public.m-app .site-footer, body.site-public.m-app footer.site-footer { margin-bottom: 0; }

    /* ------------------------------------------------------------ page frame: white blocks on light grey */
    body.site-public.m-app #main-content { margin-top: 10px !important; padding-left: 6px; padding-right: 6px; }

    /* ------------------------------------------------------------ home: the app's order, the charts last */
    body.site-public.m-app .home-portal { display: flex; flex-direction: column; }
    body.site-public.m-app .home-portal > .pt-top { order: 1; }
    body.site-public.m-app .home-portal > .pt-body { order: 2; }
    body.site-public.m-app .home-portal > .nd-writers { order: 3; margin: 0 0 10px; }
    body.site-public.m-app .home-portal > .pt-charts { order: 9; margin-top: 10px; }
    body.site-public.m-app .home-page { display: flex; flex-direction: column; }
    body.site-public.m-app .home-page > .home-charts { order: 9; }
    body.site-public.m-app .home-page > .home-faq { order: 10; }
    body.site-public.m-app .pt-side__extras { display: flex; flex-direction: column; }
    body.site-public.m-app .pt-side__extras > .sidebar-charts { order: 9; margin: 0 !important; }
    /* Exchange rates, bill rates, inflation and league tables first, the weather at the very end. */
    body.site-public.m-app .dc-list .dc-card--weather { order: 5; }
    body.site-public.m-app .dc-list { gap: 10px; }
    body.site-public.m-app .dc-card { border-radius: 0; }

    /* Top of home: the headline slider edge to edge, then Trending and Editor's Picks as blocks. */
    body.site-public.m-app .pt-top { display: block; margin: 0; }
    body.site-public.m-app .pt-top__col { margin: 0 0 10px; padding: 8px 6px 10px; background: var(--ma-card); }
    body.site-public.m-app .pt-top__col--lead { margin: -10px -6px 10px; padding: 0; }
    body.site-public.m-app .pt-slider { flex: none; aspect-ratio: auto; height: 68vw; min-height: 0; }
    body.site-public.m-app .pt-slide, body.site-public.m-app .pt-overlay { border-radius: 0; }
    body.site-public.m-app .pt-slide__body { padding: 70px 18px 16px; }
    body.site-public.m-app .pt-slide__title { font-size: 23px; line-height: 1.3; font-weight: 800; -webkit-line-clamp: 4; }
    body.site-public.m-app .pt-top__col--lead > .pt-head { display: none !important; }

    /* Section headings: a grey bar with a coloured line under it and a coloured arrow at the end. */
    body.site-public.m-app .pt-head { position: relative; display: flex; align-items: stretch; justify-content: space-between; height: 56px; min-height: 0; margin: 0 0 8px;
        padding: 0; background: var(--ma-head); border-bottom: 4px solid var(--ma-accent); }
    body.site-public.m-app .pt-head__title { display: flex; align-items: center; margin: 0; padding: 0 14px; border-left: 0; font-size: 25px; font-weight: 900; line-height: 1; letter-spacing: -.01em; }
    body.site-public.m-app .pt-head__more { display: grid; place-items: center; width: 56px; padding: 0; background: var(--ma-accent); color: #fff !important; font-size: 0; }
    body.site-public.m-app .pt-head__more i { font-size: 26px; -webkit-text-stroke: 1px; }

    /* Blocks of stories */
    body.site-public.m-app .pt-body { display: block; }
    body.site-public.m-app .pt-block, body.site-public.m-app .pt-side__box { margin: 0 0 10px; padding: 8px 6px 10px; background: var(--ma-card); border: 0; border-radius: 0; box-shadow: none; }
    body.site-public.m-app .pt-side { gap: 0; }
    body.site-public.m-app .pt-labels, body.site-public.m-app .pt-lead__excerpt, body.site-public.m-app .pt-date .pt-author, body.site-public.m-app .pt-date .pt-sep { display: none !important; }

    /* The first story of a block: a big picture with its headline on it. */
    body.site-public.m-app .pt-lead, body.site-public.m-app .pt-stack > .pt-overlay:first-child { position: relative; display: block; height: 62vw; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; overflow: hidden; background: var(--nd-media-fallback, #e4e5e8); }
    body.site-public.m-app .pt-lead__media { position: absolute; inset: 0; min-height: 0; aspect-ratio: auto; }
    body.site-public.m-app .pt-lead__body, body.site-public.m-app .pt-stack > .pt-overlay:first-child .pt-overlay__body { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 60px 18px 16px;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .82) 70%); pointer-events: none; }
    body.site-public.m-app .pt-lead__body a { pointer-events: auto; }
    body.site-public.m-app .pt-lead__title, body.site-public.m-app .pt-stack > .pt-overlay:first-child .pt-overlay__title { margin: 0 0 8px; font-size: 23px; line-height: 1.3; font-weight: 800; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
    body.site-public.m-app .pt-lead__title a { color: #fff !important; text-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
    body.site-public.m-app .pt-lead .pt-date { color: rgba(255, 255, 255, .85); }
    body.site-public.m-app .pt-lead--text { height: auto; background: var(--ma-card); }
    body.site-public.m-app .pt-lead--text .pt-lead__body { position: static; padding: 4px 0 12px; background: none; }
    body.site-public.m-app .pt-lead--text .pt-lead__title a { color: var(--ma-ink) !important; text-shadow: none; }

    /* The other stories: picture on the left, headline on the right, a thin line between them. */
    body.site-public.m-app .pt-stack { display: block; }
    body.site-public.m-app .pt-grid { display: block; margin: 0; }
    body.site-public.m-app .pt-item, body.site-public.m-app .pt-stack > .pt-overlay:not(:first-child) { position: static; display: flex; gap: 0; height: auto; aspect-ratio: auto; margin: 0; padding: 14px 0;
        background: none; border: 0; border-top: 1px solid var(--ma-line); border-radius: 0; box-shadow: none; overflow: visible; }
    body.site-public.m-app .pt-lead + .pt-grid > .pt-item:first-child, body.site-public.m-app .pt-stack > .pt-overlay:nth-child(2) { border-top: 0; }
    body.site-public.m-app .pt-item__media, body.site-public.m-app .pt-stack > .pt-overlay:not(:first-child) .pt-overlay__media { position: static; flex: none; width: 40%; height: 29vw; max-height: 200px; aspect-ratio: auto; margin-right: 14px; border-radius: 0; }
    body.site-public.m-app .pt-stack > .pt-overlay:not(:first-child) .pt-overlay__body { position: static; flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 0 4px 0 0; background: none; color: inherit; pointer-events: auto; }
    body.site-public.m-app .pt-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; padding-right: 4px; }
    body.site-public.m-app .pt-item__title, body.site-public.m-app .pt-stack > .pt-overlay:not(:first-child) .pt-overlay__title { margin: 0 0 8px; font-size: 18.5px; line-height: 1.35; font-weight: 500; -webkit-line-clamp: 3; }
    body.site-public.m-app .pt-stack > .pt-overlay:not(:first-child) .pt-overlay__title a { color: var(--ma-ink) !important; text-shadow: none; }
    body.site-public.m-app .pt-stack > .pt-overlay:not(:first-child) .pt-date { color: var(--ma-muted); }
    body.site-public.m-app .pt-overlay:hover img, body.site-public.m-app .pt-slide:hover img { transform: none; }

    /* Time under a headline, with a small coloured clock, as in the app. */
    body.site-public.m-app .pt-date { display: flex; align-items: center; margin: 0; font-size: 15px; color: var(--ma-muted); }
    body.site-public.m-app .pt-date time::before { content: ""; display: inline-block; vertical-align: -3px; width: 17px; height: 17px; margin-right: 7px; background: var(--ma-accent);
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E") center / contain no-repeat; }
    body.site-public.m-app .pt-slide .pt-date, body.site-public.m-app .pt-lead .pt-date, body.site-public.m-app .pt-stack > .pt-overlay:first-child .pt-date { color: rgba(255, 255, 255, .85); }

    /* “More on Business”: the app's round button under each section. */
    body.site-public.m-app .pt-more-btn { display: flex; align-items: center; justify-content: center; height: 54px; margin: 12px 0 2px; border-radius: 999px; background: var(--ma-accent); color: #fff !important; font-size: 18px; font-weight: 500; text-decoration: none; }
    body.site-public.m-app .pt-more-btn:active { filter: brightness(.92); }

    /* Most read: big coloured numbers. */
    body.site-public.m-app .pt-rank li { padding: 14px 0; }
    body.site-public.m-app .pt-rank__n { font-size: 28px; font-weight: 900; color: var(--ma-accent); opacity: 1; }
    body.site-public.m-app .pt-rank__title { font-size: 18px; line-height: 1.35; font-weight: 500; }

    /* ------------------------------------------------------------ section, latest and search pages */
    body.site-public.m-app .category-page { background: var(--ma-card); margin: -10px -6px 0; padding: 0 6px 10px; }
    body.site-public.m-app .category-header { padding: 14px 8px 4px; margin: 0; border: 0; }
    body.site-public.m-app .category-header__title { font-size: 28px; font-weight: 900; }
    body.site-public.m-app .category-header__subnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    body.site-public.m-app .category-header__subnav::-webkit-scrollbar { display: none; }
    body.site-public.m-app .category-header__subnav a { flex: none; white-space: nowrap; }
    body.site-public.m-app .category-page .row.article-grid-gap { --bs-gutter-y: 0; margin-top: 0 !important; }
    body.site-public.m-app .category-card, body.site-public.m-app .category-headline, body.site-public.m-app .category-rail-item { margin: 0 !important; border: 0 !important; border-top: 1px solid var(--ma-line) !important; border-radius: 0; box-shadow: none; background: none; }
    body.site-public.m-app .category-hero-card { position: relative; height: 62vw; border-top: 0 !important; overflow: hidden; background: var(--nd-media-fallback, #e4e5e8); }
    body.site-public.m-app .category-hero-card .category-card__media { position: absolute; inset: 0; height: 100%; }
    body.site-public.m-app .category-hero-card .category-card__media img { width: 100%; height: 100%; object-fit: cover; }
    body.site-public.m-app .category-hero-card .category-card__body { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 18px 16px; background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .82) 70%); }
    body.site-public.m-app .category-hero-card .category-card__title { font-size: 23px; line-height: 1.3; font-weight: 800; margin: 0; }
    body.site-public.m-app .category-hero-card .category-card__title a { color: #fff !important; }
    body.site-public.m-app .category-hero-card .category-meta, body.site-public.m-app .category-hero-card .category-card__excerpt { display: none; }
    body.site-public.m-app .category-card--compact, body.site-public.m-app .category-card--wide { display: flex; flex-direction: row; padding: 14px 0; }
    body.site-public.m-app .category-card--compact .category-card__media, body.site-public.m-app .category-card--wide .category-card__media { flex: none; width: 40%; height: 29vw; aspect-ratio: auto; margin-right: 14px; overflow: hidden; background: none; }
    body.site-public.m-app .category-card--compact .category-card__media img, body.site-public.m-app .category-card--wide .category-card__media img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
    body.site-public.m-app .category-card--compact .category-card__body, body.site-public.m-app .category-card--wide .category-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column-reverse; justify-content: space-between; padding: 0 4px 0 0; }
    body.site-public.m-app .category-card__excerpt { display: none; }
    body.site-public.m-app .category-card--compact .category-card__title, body.site-public.m-app .category-card--wide .category-card__title, body.site-public.m-app .category-headline .category-card__title, body.site-public.m-app .category-rail-item .category-card__title { font-size: 18.5px; line-height: 1.35; font-weight: 500; margin: 0 0 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    body.site-public.m-app .category-headline, body.site-public.m-app .category-rail-item { display: flex; flex-direction: column-reverse; padding: 14px 4px !important; }
    body.site-public.m-app .category-meta { font-size: 15px; color: var(--ma-muted); }
    body.site-public.m-app .category-meta .text-uppercase, body.site-public.m-app .category-meta .text-uppercase + .text-muted { display: none; }
    body.site-public.m-app .category-section__title { margin: 10px -6px 8px; padding: 0 14px; height: 56px; display: flex; align-items: center; background: var(--ma-head); border-bottom: 4px solid var(--ma-accent); font-size: 25px; font-weight: 900; }
}
