/* Simple app-style layout for phones. Loaded only under 768 px (media attribute on the link), and only when
   Settings > "Simple app-style layout on phones" is on. Markup: includes/mobile_app.php, behaviour: assets/js/mobile-app.js */

:root { --m-bar-h: 56px; --m-safe: env(safe-area-inset-bottom, 0px);
  /* the look: set from Page Builder > Mobile app look (includes/mobile_app.php writes these; the values here are the Classic Navy defaults) */
  --m-head-bg: #0b1426; --m-head-fg: #ffffff; --m-float-bg: rgba(22,28,43,.94); --m-float-fg: #ffffff; --m-pages-bg: #ffffff; --m-pages-fg: var(--primary);
  --m-edge-bg: var(--primary); --m-accent: var(--primary); --m-radius: 20px; --m-pill-radius: 12px; --m-plate-bg: #ffffff; --m-plate-pad: 3px 8px; --m-blur: none; }

/* ---- the desktop furniture goes away: one slim header replaces top bar, masthead and menu bar */
body.mobile-app .topbar,
body.mobile-app .site-header .masthead,
body.mobile-app .site-header .main-nav { display: none !important; }
body.mobile-app .site-header { border: 0; box-shadow: none; background: transparent; }

/* ---- slim header */
.m-appbar { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: .25rem; height: var(--m-bar-h);
  padding: 0 .5rem; background: var(--m-head-bg); color: var(--m-head-fg); box-shadow: 0 1px 0 rgba(128,128,128,.18);
  -webkit-backdrop-filter: var(--m-blur); backdrop-filter: var(--m-blur); }
.m-appbar .m-brand { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-start; height: 100%; padding: 8px .25rem; color: inherit; text-decoration: none; }
.m-appbar .m-brand img { max-height: 100%; max-width: 100%; object-fit: contain; filter: none; }
.m-appbar .m-brand span { font-family: var(--font-head); font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-ic { width: 44px; height: 44px; flex: 0 0 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 12px;
  background: transparent; color: inherit; font-size: 1.15rem; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.m-ic:active { background: color-mix(in srgb, currentColor 14%, transparent); }
.m-ic-user { background: color-mix(in srgb, currentColor 14%, transparent); width: 38px; height: 38px; flex-basis: 38px; border-radius: 50%; font-size: 1rem; margin-left: .15rem; }
/* a white logo on the dark bar: logos with a dark / coloured design sit on a white plate */

.m-appbar .m-brand img, .m-drawer-title img { filter: var(--m-logo-dark, none); }
.m-drawer-title img { display: block; max-height: 34px; max-width: 100%; object-fit: contain; }
.m-appbar .m-brand img { background: var(--m-plate-bg); border-radius: 8px; padding: var(--m-plate-pad); box-sizing: content-box; max-height: calc(var(--m-bar-h) - 22px); }

/* ---- date / edition / page bar */
.m-subbar { position: sticky; top: var(--m-bar-h); z-index: 1020; display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem;
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 6px 14px -10px rgba(15,23,42,.35); }
.m-pill { display: inline-flex; align-items: center; gap: .4rem; max-width: 52vw; padding: 0 .75rem; height: 38px; border: 1px solid var(--line); border-radius: var(--m-pill-radius);
  background: var(--surface-low); color: var(--ink); font: 600 .86rem/1 var(--font); white-space: nowrap; position: relative; }
.m-pill i:first-child { color: var(--m-accent); font-size: .9rem; }
.m-pill .m-caret { font-size: .62rem; color: var(--muted); }
.m-pill-sel select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: inherit; max-width: 34vw; padding: 0 .1rem; outline: 0; text-overflow: ellipsis; }
.m-count { margin-left: auto; font: 600 .8rem/1 var(--font-mono); color: var(--muted); white-space: nowrap; }
.m-count b { color: var(--ink); font-size: .95rem; }
.m-ic-soft { width: 38px; height: 38px; flex-basis: 38px; border: 1px solid var(--line); background: var(--surface-low); color: var(--ink); font-size: 1rem; }
.m-ic-soft:active { background: var(--surface-mid); }

/* ---- the menu drawer */
.m-drawer { position: fixed; inset: 0; z-index: 2000; visibility: hidden; pointer-events: none; }
.m-drawer.open { visibility: visible; pointer-events: auto; }
.m-drawer-shade { position: absolute; inset: 0; background: rgba(8,12,24,.55); opacity: 0; transition: opacity .2s; }
.m-drawer.open .m-drawer-shade { opacity: 1; }
.m-drawer-panel { position: absolute; top: 0; bottom: 0; left: 0; width: min(86vw, 340px); background: var(--surface); color: var(--ink); overflow-y: auto;
  transform: translateX(-100%); transition: transform .24s ease; padding-bottom: calc(1rem + var(--m-safe)); box-shadow: 8px 0 30px rgba(0,0,0,.3); }
.m-drawer.open .m-drawer-panel { transform: none; }
.m-drawer-head { display: flex; align-items: center; justify-content: space-between; height: var(--m-bar-h); padding: 0 .5rem 0 1rem; background: var(--m-head-bg); color: var(--m-head-fg); }
.m-drawer-title { font: 800 1.15rem var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-drawer-list, .m-drawer-list ul { list-style: none; margin: 0; padding: 0; }
.m-drawer-list > li > a { display: flex; align-items: center; gap: .75rem; padding: .85rem 1.1rem; color: var(--ink); text-decoration: none; font-weight: 600; border-bottom: 1px solid var(--line); }
.m-drawer-list > li > a i { width: 1.1rem; text-align: center; color: var(--primary); }
.m-drawer-list ul a { display: block; padding: .6rem 1.1rem .6rem 3.1rem; color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--line); font-size: .92rem; }
.m-drawer-label { padding: 1rem 1.1rem .35rem; font: 700 .72rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.m-drawer-chips { display: flex; flex-wrap: wrap; gap: .45rem; padding: 0 1.1rem; }
.m-chip { padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-low); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .85rem; }
.m-chip.on { background: var(--m-accent); border-color: var(--m-accent); color: #fff; }
.m-drawer-tools { display: grid; gap: .5rem; padding: 1.1rem; }
.m-drawer-tools button { display: flex; align-items: center; gap: .6rem; height: 46px; padding: 0 .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-low); color: var(--ink); font-weight: 600; }
.m-drawer-tools button[hidden] { display: none; }

/* ---- the viewer: the newspaper page is the screen */
body.mobile-app.viewer-page { padding-bottom: calc(92px + var(--m-safe)); }
body.mobile-app .viewer-toolbar,
body.mobile-app .viewer-page .crumbs, body.mobile-app .viewer-content .crumbs,
body.mobile-app .page-foot,
body.mobile-app .page-nav { display: none !important; }
body.mobile-app .viewer-wrap { padding: 0 !important; max-width: none; }
body.mobile-app .viewer-wrap > .row { --bs-gutter-x: 0; --bs-gutter-y: 0; margin: 0; }
body.mobile-app .viewer-wrap > .row > * { padding: 0; }
body.mobile-app .viewer-content { padding: 0; }
body.mobile-app .page-stage { margin: 0; }
body.mobile-app .page-wrap { border-radius: 0; border: 0; box-shadow: none; background: var(--bg); }
body.mobile-app .page-wrap.zoomed { max-height: calc(100vh - var(--m-bar-h) - 64px - 90px); }
body.mobile-app .map-layer img { background: #fff; }
body.mobile-app .viewer-sidebar { padding: .75rem !important; }
body.mobile-app .issue-nav { padding: .6rem .75rem; }

/* clip tool: the banner sits above the floating toolbar */
body.mobile-app .clip-banner { position: fixed; top: auto; bottom: calc(86px + var(--m-safe)); left: .6rem; right: .6rem; z-index: 1060; border-radius: 14px; padding: .55rem .7rem; box-shadow: 0 10px 28px rgba(0,0,0,.35); }
body.mobile-app .clip-banner .container-x { padding: 0; flex-wrap: wrap; gap: .4rem; }

/* ---- floating toolbar */
.m-float { position: fixed; left: 50%; bottom: calc(14px + var(--m-safe)); transform: translateX(-50%); z-index: 1040; display: flex; align-items: center; gap: .15rem;
  padding: .4rem .5rem; border-radius: var(--m-radius); background: var(--m-float-bg); color: var(--m-float-fg);
  -webkit-backdrop-filter: var(--m-blur); backdrop-filter: var(--m-blur); border: 1px solid color-mix(in srgb, var(--m-float-fg) 12%, transparent);
  box-shadow: 0 12px 30px -6px rgba(0,0,0,.5); }
.m-fb { width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: calc(var(--m-radius) * .7); background: transparent; color: inherit; font-size: 1.15rem; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.m-fb:active { background: color-mix(in srgb, currentColor 16%, transparent); }
.m-fb[disabled] { opacity: .35; }
.m-sep { width: 1px; height: 28px; background: color-mix(in srgb, currentColor 28%, transparent); margin: 0 .3rem; }
.m-fb-pages { background: var(--m-pages-bg); color: var(--m-pages-fg); width: 50px; }
.m-fb-pages:active { filter: brightness(.94); }
body.clipping .m-float { opacity: .0; pointer-events: none; }

/* next / previous page tabs on the screen edges */
.m-edge { position: fixed; top: 46%; z-index: 1035; width: 34px; height: 66px; display: flex; align-items: center; justify-content: center;
  background: var(--m-edge-bg); color: #fff; opacity: .9; text-decoration: none; box-shadow: 0 6px 18px rgba(0,0,0,.28); -webkit-backdrop-filter: var(--m-blur); backdrop-filter: var(--m-blur); -webkit-tap-highlight-color: transparent; }
.m-edge-next { right: 0; border-radius: 16px 0 0 16px; }
.m-edge-prev { left: 0; border-radius: 0 16px 16px 0; }
.m-edge:active { opacity: 1; filter: brightness(1.12); }
body.clipping .m-edge, body.m-zoomed .m-edge { display: none; }

/* ---- all pages: bottom sheet */
.m-sheet { position: fixed; inset: 0; z-index: 2050; visibility: hidden; pointer-events: none; }
.m-sheet.open { visibility: visible; pointer-events: auto; }
.m-sheet-shade { position: absolute; inset: 0; background: rgba(8,12,24,.55); opacity: 0; transition: opacity .2s; }
.m-sheet.open .m-sheet-shade { opacity: 1; }
.m-sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh; display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border-radius: 22px 22px 0 0; transform: translateY(102%); transition: transform .26s ease; padding-bottom: var(--m-safe); box-shadow: 0 -12px 40px rgba(0,0,0,.35); }
.m-sheet.open .m-sheet-panel { transform: none; }
.m-sheet-head { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem .35rem 1.1rem; border-bottom: 1px solid var(--line); }
.m-sheet-head b { font: 800 1.05rem var(--font-head); }
.m-sheet-head span { margin-right: auto; font: 600 .78rem var(--font-mono); color: var(--muted); }
.m-sheet-head .m-ic { color: var(--ink); }
.m-sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; padding: .9rem 1rem 1.1rem; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.m-thumb { position: relative; display: block; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; text-decoration: none; }
.m-thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; }
.m-thumb span { position: absolute; left: 0; right: 0; bottom: 0; padding: .2rem 0; text-align: center; background: rgba(15,23,42,.78); color: #fff; font: 700 .78rem var(--font-mono); }
.m-thumb.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.m-thumb.on span { background: var(--accent); }

/* ---- the home page and other pages get the same calm header; the breaking strip stays, the rest is tidier */
body.mobile-app .live-strip .live-pill, body.mobile-app .live-strip .live-links { display: none; }
/* breaking-news ticker: a fixed LIVE badge on the left, headlines scroll beside it */
body.mobile-app .live-strip { background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(15,23,42,.04); }
body.mobile-app .live-strip:not(:has(.tk-item)) { display: none; }
body.mobile-app .live-strip .container-x { padding: 0; margin: 0; max-width: none; gap: 0; flex-wrap: nowrap; min-height: 30px; align-items: stretch; }
body.mobile-app .live-strip .tk-live { display: inline-flex; align-items: center; gap: .4rem; flex: 0 0 auto; padding: 0 .85rem 0 .75rem; background: #dc2626; color: #fff; font: 800 .74rem/1 var(--font-mono, monospace); letter-spacing: .14em; position: relative; z-index: 2; clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%); padding-right: 1.3rem; }
body.mobile-app .live-strip .tk-live i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
body.mobile-app .live-strip .ticker { min-width: 0; flex: 1; display: flex; align-items: center; font-size: .92rem; line-height: 1.3; color: var(--ink); -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 18px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 18px), transparent 100%); }
body.mobile-app .live-strip .ticker .ticker-move { padding-left: 100%; animation-duration: 38s; font-weight: 600; }
body.mobile-app .live-strip .ticker:active .ticker-move, body.mobile-app .live-strip .ticker:focus-within .ticker-move { animation-play-state: paused; }
body.mobile-app .live-strip .ticker strong { display: none; }
body.mobile-app .live-strip .ticker .tk-item a { padding: .5rem 0; display: inline-block; }
@media (prefers-reduced-motion: reduce) { body.mobile-app .live-strip .ticker .ticker-move { animation: none; padding-left: .75rem; overflow-x: auto; } }
body.mobile-app .site-main { min-height: 40vh; }
body.mobile-app .toast-container { bottom: calc(96px + var(--m-safe)) !important; }
body.mobile-app .push-prompt { bottom: calc(96px + var(--m-safe)); }
body.mobile-app .push-prompt:not(.show) { visibility: hidden; }

@media (prefers-reduced-motion: reduce) { .m-drawer-panel, .m-sheet-panel, .m-drawer-shade, .m-sheet-shade { transition: none; } }

/* v1.14: saved link, text size row, magnifier + bookmark on phones */
.m-drawer-list .saved-count { margin-left: auto; }
.m-textsize { display: flex; align-items: center; gap: .4rem; padding: .2rem .2rem 0; font-weight: 600; font-size: .9rem; }
.m-textsize span { flex: 1; }
.m-drawer-tools .m-textsize button { height: 40px; min-width: 44px; padding: 0 .5rem; justify-content: center; font-weight: 800; }
.m-drawer-tools .m-textsize button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.m-drawer-tools [data-night-toggle][aria-pressed="true"] { border-color: var(--primary); color: var(--primary); }
body.lens-active .m-fb[data-m-click="btnLens"] { background: color-mix(in srgb, currentColor 22%, transparent); }
.m-ic-soft[data-bookmark].active { color: var(--accent); border-color: var(--accent); }
/* v1.14.3: the date / edition bar now also holds a bookmark button: let the edition pill give way so nothing is pushed off screen */
.m-subbar { gap: .35rem; padding-left: .5rem; padding-right: .5rem; overflow: hidden; }
.m-subbar > * { flex-shrink: 0; }
.m-subbar .m-pill { padding: 0 .55rem; gap: .3rem; }
.m-subbar .m-pill-sel { flex: 1 1 0; min-width: 0; max-width: none; flex-shrink: 1; }
.m-subbar .m-pill-sel select { flex: 1 1 0; min-width: 0; max-width: none; width: 100%; }
.m-subbar .m-ic-soft { width: 36px; height: 36px; flex-basis: 36px; }
.m-subbar .m-count { margin-left: .1rem; }