/* ==========================================================================
   BoatPortal MOBILE tokens — the phone app's design layer (Mobile M0).
   --------------------------------------------------------------------------
   SOURCE: every colour here is a var() onto static/app/tokens.css — the
   owner's palette (CLAUDE.md §6) — and this file introduces NO new hue.
   The ONE exception, added at the sign-in wave, is the `--bpm-brand-*` group:
   Apple's and Google's own button colours, which are trademark values and not
   ours to derive. They are literal, they live here and nowhere else, and they
   are never used for anything of the owner's.
   Loaded after tokens.css by templates/app/mobile/_base.html.

   What IS new is geometry for a phone, and each value cites its platform
   source:
     Apple Human Interface Guidelines (HIG) — Layout, Typography (Dynamic
       Type "Large" default sizes), Tab bars, Navigation bars, Sheets.
     Material Design 3 (M3) — Type scale, Navigation bar, Top app bar,
       Bottom sheets, Motion (emphasized easing), Accessibility.

   Platform variants key off the class stamped on <html>:
     html.bpm-ios      — from ?platform=ios, or Capacitor.getPlatform()
     html.bpm-android  — from ?platform=android, or Capacitor.getPlatform()
   docs/mobile/platform-guidelines.md is the checklist these implement.
   ========================================================================== */

:root {
  /* ------------------------------------------------------------- colour */
  /* Grounds. The grouped/inset background is the owner's canvas grey; cells,
     cards, bars and sheets are the owner's card white. */
  --bpm-bg: var(--bp-canvas);
  --bpm-surface: var(--bp-surface);
  --bpm-surface-2: var(--bp-surface-muted);
  --bpm-surface-sunken: var(--bp-canvas-sunken);

  /* THE ADMIN THEME ON A PHONE (owner, 2026-09-11: "i want the theme of the
     admin page"). Two chrome families, both already the owner's:
       · the top app bar wears the desktop TOP BAR's four-band navy->teal
         stripe, white ink, carried up through the status-bar safe area;
       · the bottom tab bar wears the desktop SIDEBAR's dark family (#2C3539),
         white labels, muted-white inactive icons, teal active over the
         sidebar's own translucent teal tint.
     The body between them stays the owner's canvas grey with white cards, so
     the phone reads as the same product as the desktop admin. */
  --bpm-bar-bg: var(--bp-topbar-bg);          /* OWNER — the four-band stripe */
  /* THE SHIFT BAND's own surface (2026-11-13). The owner asked for the
     clocked-in strip to be *"an actual different bar, dark grey preferablly,
     not apart of the already existing top bar"* — so it does not share the
     top bar's navy->teal stripe. It is the platform's one dark chrome,
     #2C3539, which the sidebar and the tab bar already wear, with the same
     solved-not-blended muted ink (`--bp-sidebar-ink-muted`) rather than a
     new hue or an alpha. */
  --bpm-shiftband-bg: var(--bp-sidebar-bg);
  --bpm-shiftband-ink: var(--bp-sidebar-ink);
  --bpm-shiftband-ink-muted: var(--bp-sidebar-ink-muted);
  /* The lift under the band's chevron disc — solved over the same surface
     as the ink, in the platform palette where every colour in this app's
     layer comes from (`--bp-sidebar-lift`). This file holds no hex of its
     own; the two brand marks below are the one exception and a test keeps
     it that wide. */
  --bpm-shiftband-lift: var(--bp-sidebar-lift);
  --bpm-bar-ink: var(--bp-topbar-ink);
  --bpm-bar-ink-muted: var(--bp-topbar-ink-muted);
  --bpm-bar-press: var(--bp-topbar-hover);
  --bpm-tabbar-bg: var(--bp-sidebar-bg);      /* OWNER — the dark app UI      */
  --bpm-tabbar-ink: var(--bp-sidebar-ink);
  --bpm-tabbar-ink-muted: var(--bp-sidebar-ink-muted);
  --bpm-tabbar-active-ink: var(--bp-sidebar-active-ink);
  --bpm-tabbar-active-bg: var(--bp-sidebar-active-bg);
  --bpm-tabbar-edge: var(--bp-sidebar-border);
  --bpm-tabbar-press: var(--bp-sidebar-hover);

  /* A control that SINKS INTO THE STRIPE. Owner, 2026-11-11: *"buttons above
     parts search bar need to be darker, not lighter."* They were white pills
     and jumped off the bar; a control that belongs to the bar is drawn BELOW
     its bands, not above them.
       · the fill is BAND 1 of the owner's own four-band top bar — the darkest
         of the four — so a button sitting over bands 2-3 reads as sunken
         without a single new hue entering the layer;
       · the edge is the stripe's own muted white ink, because a dark control
         on a dark bar is a control only if its boundary is visible: at the
         bar's 18% hover white the ring measured 1.5:1 against the bands,
         under WCAG 1.4.11's 3:1 for a non-text boundary. The muted ink
         (white at 84%) measures 10.7:1 and is the hairline, not the fill — a
         dark pill in a crisp outline, which is still a quieter thing than the
         white pill it replaces.
     White ink on band 1 measures 17.2:1. */
  --bpm-bar-sink: var(--bp-band-1);
  --bpm-bar-edge: var(--bp-topbar-ink-muted);

  /* Ink. Secondary text is grey-ramp 700 (#495057), NOT the owner's #6C757D:
     #6C757D measures 4.69:1 on white but only 4.18:1 on the canvas grey, so it
     fails WCAG AA the moment it sits on a grouped background. #495057 is
     7.3:1 on canvas, 8.0:1 on white. --bpm-ink-3 is the owner's grey, for
     white grounds only. */
  --bpm-ink: var(--bp-text-color);
  --bpm-ink-strong: var(--bp-text-strong);
  --bpm-ink-2: var(--bp-neutral-ink);
  --bpm-ink-3: var(--bp-text-muted);
  --bpm-ink-invert: var(--bp-text-invert);

  --bpm-hairline: var(--bp-border);
  --bpm-hairline-strong: var(--bp-border-strong);

  /* Action = the owner's primary blue. Teal is a STATE colour (active tab,
     progress, refresh spinner, snackbar timer) and never fills a button.
     --bp-accent-ink (#04788F) is 5.1:1 on white, 4.6:1 on canvas. */
  --bpm-primary: var(--bp-primary);
  --bpm-primary-pressed: var(--bp-primary-active);
  --bpm-primary-ink: var(--bp-primary-ink);
  --bpm-primary-tint: var(--bp-primary-tint);
  /* An unread count, and only that — see the note on --bp-notify. */
  --bpm-notify: var(--bp-notify);
  --bpm-notify-ink: var(--bp-notify-ink);
  --bpm-on-primary: var(--bp-on-primary);
  --bpm-state: var(--bp-accent);
  --bpm-state-ink: var(--bp-accent-ink);
  --bpm-state-tint: var(--bp-accent-tint);

  /* Secondary + destructive. The owner's #777D85 is 4.16:1 under white text,
     so a FILLED destructive button uses its darker step #5A6067 (6.4:1). A
     destructive action is told apart by its verb and a glyph, never a hue. */
  --bpm-secondary-bg: var(--bp-secondary-tint);
  --bpm-secondary-ink: var(--bp-secondary-ink);
  --bpm-destructive: var(--bp-secondary-ink);
  --bpm-on-destructive: var(--bp-text-invert);

  /* Status family: grey, told apart by GLYPH (CLAUDE.md §6). One ink for all
     five, because the -ink steps of success/warning fall under AA on their
     own tints (#6F7A83 on #EEF0F2 is 3.8:1). */
  --bpm-status-bg: var(--bp-neutral-tint);
  --bpm-status-ink: var(--bp-neutral-ink);

  --bpm-toast-bg: var(--bp-canvas-sunken);  /* OWNER — toast & alert grey */
  --bpm-scrim: var(--bp-scrim);
  --bpm-press: var(--bp-surface-hover);
  --bpm-press-strong: var(--bp-canvas-sunken);
  --bpm-focus: var(--bp-primary);
  --bpm-skeleton: var(--bp-skeleton-base);
  --bpm-skeleton-sheen: var(--bp-skeleton-sheen);
  --bpm-device: var(--bp-sidebar-bg);       /* OWNER dark UI — gallery bezel */
  --bpm-device-ink: var(--bp-sidebar-ink);

  /* ---------------------------------------- brand marks (NOT the palette)
     Two trademarks nobody here gets to restyle. Apple and Google both publish
     the exact button colours, and a sign-in button that misses them is a
     store rejection, not a difference of taste. These are the ONLY literal
     colours in the mobile layer; they are never reused for anything of ours,
     and they must STAY literal — a var() onto the owner's palette would drift
     the day the palette moves, and the trademark would move with it.
       Apple  — developer.apple.com, Human Interface Guidelines > Sign in with
                Apple > Buttons: black button with a white logo and title, or
                the inverse. Nothing else.
       Google — developers.google.com/identity/branding-guidelines, light
                theme: fill #FFFFFF, 1px inside stroke #747775, text #1F1F1F,
                font Google Sans Medium.
     The two marks themselves are FILES (static/app/mobile/brand/*.svg), not
     Lucide glyphs; see the note in each one. */
  --bpm-brand-apple-bg: #000000;
  --bpm-brand-apple-ink: #FFFFFF;
  --bpm-brand-apple-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
  --bpm-brand-google-bg: #FFFFFF;
  --bpm-brand-google-stroke: #747775;
  --bpm-brand-google-ink: #1F1F1F;
  --bpm-brand-google-font: 'Google Sans', 'Google Sans Text', Roboto, system-ui, sans-serif;

  /* --------------------------------------------------------------- type */
  /* Jost on both platforms (brand fonts are allowed by HIG and M3), falling
     back to the system face. Sizes are rem so the system text-size setting
     scales them: on iOS the root is -apple-system-body (Dynamic Type), on
     Android the WebView's text zoom. */
  --bpm-font: var(--bp-font-sans);
  --bpm-font-mono: var(--bp-font-mono);
  --bpm-fw-regular: var(--bp-fw-normal);
  --bpm-fw-medium: var(--bp-fw-medium);
  --bpm-fw-semibold: var(--bp-fw-semibold);
  --bpm-fw-bold: var(--bp-fw-bold);

  /* ------------------------------------------------------------ targets */
  /* 48px covers HIG's 44pt minimum and M3's 48dp. 8px between adjacent
     targets (M3 Accessibility: "at least 8dp of space"). */
  --bpm-target: 48px;
  --bpm-target-gap: 8px;

  /* ─────────────────────────── BUILT FOR OLDER EYES AND HANDS ───────────
     Owner, 2026-09-11: "everything is very bland ... a lot of the boating
     community is older people." These are not preferences, they are the
     floor every later screen inherits:

       · body text is 18px on BOTH platforms, expressed in rem so the
         system text-size setting still scales it;
       · nothing renders under 14px anywhere — tab labels and captions
         included (the old 12px tab label and 12px caption are gone);
       · the PRIMARY action is 56px tall with 18px medium text; every other
         control keeps the 48px floor;
       · an app-bar icon button keeps its 48px hit area but draws a 26px
         glyph, and a tab draws a 28px one, so the picture is findable;
       · weights stay regular/medium/semibold. Never light, never thin.

     Anything a person must READ IN ORDER TO ACT is full-contrast ink, never
     grey: cell titles, values, button labels, field labels, empty-state
     text. Grey is left for timestamps and subtitles. */
  --bpm-target-primary: 56px;   /* primary buttons, the thumb-zone action    */
  --bpm-glyph-bar: 26px;        /* app-bar icon button                       */
  --bpm-glyph-tab: 30px;        /* tab bar (CR1: 28px read as small on a phone) */
  --bpm-glyph-dock: 30px;       /* the raised centre action                  */
  --bpm-dock-size: 64px;        /* its disc                                  */

  /* ------------------------------------------------------------ spacing */
  --bpm-space-1: var(--bp-space-1);   /*  4 */
  --bpm-space-2: var(--bp-space-2);   /*  8 */
  --bpm-space-3: var(--bp-space-3);   /* 12 */
  --bpm-space-4: var(--bp-space-4);   /* 16 */
  --bpm-space-5: var(--bp-space-5);   /* 20 */
  --bpm-space-6: var(--bp-space-6);   /* 24 */
  --bpm-space-7: var(--bp-space-7);   /* 32 */
  --bpm-space-8: var(--bp-space-8);   /* 40 */
  --bpm-gutter: 16px;                 /* HIG layout margin 16pt; M3 compact 16dp */

  /* ---------------------------------------------------------- elevation */
  --bpm-elev-1: var(--bp-shadow-xs);
  --bpm-elev-2: var(--bp-shadow-md);
  --bpm-elev-3: var(--bp-shadow-lg);
  --bpm-elev-4: var(--bp-shadow-modal);

  /* ------------------------------------------------------------- motion */
  --bpm-ease-standard: var(--bp-ease);
  --bpm-dur-press: var(--bp-dur-fast);

  /* -------------------------------------------------------- safe areas */
  /* env() is the real inset (needs viewport-fit=cover, set in _base.html).
     --bpm-sim-* is non-zero only inside the gallery's phone frames, where an
     iframe has no insets of its own; see html.bpm-framed below. */
  --bpm-sim-top: 0px;
  --bpm-sim-bottom: 0px;
  --bpm-safe-top: max(env(safe-area-inset-top, 0px), var(--bpm-sim-top));
  --bpm-safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--bpm-sim-bottom));
  --bpm-safe-left: env(safe-area-inset-left, 0px);
  --bpm-safe-right: env(safe-area-inset-right, 0px);

  --bpm-z-bar: 20;
  --bpm-z-tabbar: 30;
  --bpm-z-overlay: 100;
  --bpm-z-snack: 120;
  --bpm-z-loading: 140;
}

/* ==========================================================================
   iOS — HIG
   ========================================================================== */
html.bpm-ios {
  /* The ROOT stays Dynamic Type: `font: -apple-system-body` below makes the
     root 17px at the default setting and follows the user's text-size slider.
     Every size here is a rem MULTIPLE of that root, so 1.059rem is 18px at
     the default and grows with the setting. Browsers that do not know
     -apple-system-body keep the 17px fallback. */
  font-size: 106.25%;
  --bpm-lh: 1.35;

  --bpm-type-largetitle: 2rem;        /* 34px  Large Title                */
  --bpm-type-title: 1.294rem;         /* 22px  Title 2                    */
  --bpm-type-headline: 1.059rem;      /* 18px  Headline                   */
  --bpm-type-body: 1.059rem;          /* 18px  BODY — the owner's floor   */
  --bpm-type-callout: 1rem;           /* 17px  Callout                    */
  --bpm-type-subhead: 0.941rem;       /* 16px  Subheadline                */
  --bpm-type-footnote: 0.882rem;      /* 15px  Footnote                   */
  --bpm-type-caption: 0.824rem;       /* 14px  Caption — nothing goes lower */
  --bpm-type-tab: 0.824rem;           /* 14px  tab label (HIG's own is 10pt) */
  --bpm-fw-largetitle: var(--bpm-fw-bold);
  --bpm-fw-title: var(--bpm-fw-semibold);
  --bpm-fw-headline: var(--bpm-fw-semibold);

  /* Owner, 2026-11-11: *"top bar needs to be thicker, for looks."* HIG's nav
     bar is 44pt and that is a FLOOR, not a target — the bar is the owner's
     stripe and it is meant to be seen. 60px = the 48px button plus a full
     --bpm-space-3 of slack above and below it. The safe-area inset is padding
     on .bpm-appbar, so a notch still pushes this row down; it never eats it. */
  --bpm-appbar-h: 60px;               /* was 52px (48px button + 4)             */
  /* Wave CR1 — 72px was measured on a phone as cramped: a 28px glyph and a
     13px label with no room between them, on a bar a technician taps with
     wet or gloved hands. 84px gives each of the five tabs a 56px target
     (the mobile-simplicity floor this project already set for buttons). */
  --bpm-tabbar-h: 84px;
  --bpm-radius-cell-group: 12px;      /* inset grouped list                     */
  --bpm-radius-card: 12px;
  --bpm-radius-btn: 12px;             /* HIG large filled button                */
  --bpm-radius-field: 10px;
  --bpm-radius-sheet: 14px;           /* HIG sheet corner                       */
  --bpm-radius-dialog: 14px;

  /* HIG push: the new screen slides in from the trailing edge, the old one
     parallaxes ~30% and dims. Spring-like curve ≈ UIKit's default. */
  --bpm-dur-push: 380ms;
  --bpm-dur-tab: 0ms;                 /* tab switches are instant on iOS        */
  --bpm-dur-sheet: 380ms;
  --bpm-ease-push: cubic-bezier(0.32, 0.72, 0, 1);
}

@supports (font: -apple-system-body) {
  html.bpm-ios { font: -apple-system-body; }
}

/* ==========================================================================
   Android — Material 3
   ========================================================================== */
html.bpm-android {
  font-size: 100%;                    /* 16sp body; WebView text zoom scales it */
  --bpm-lh: 1.5;

  /* M3's Body Large is 16sp. The owner's floor is 18, so the whole scale
     steps up one notch and nothing lands under 14. */
  --bpm-type-largetitle: 1.75rem;     /* 28px  Headline Medium            */
  --bpm-type-title: 1.375rem;         /* 22px  Title Large                */
  --bpm-type-headline: 1.125rem;      /* 18px  Title Medium               */
  --bpm-type-body: 1.125rem;          /* 18px  BODY — the owner's floor   */
  --bpm-type-callout: 1.0625rem;      /* 17px                             */
  --bpm-type-subhead: 1rem;           /* 16px  Label Large                */
  --bpm-type-footnote: 0.9375rem;     /* 15px                             */
  --bpm-type-caption: 0.875rem;       /* 14px — nothing goes lower        */
  --bpm-type-tab: 0.875rem;           /* 14px  Navigation bar label       */
  --bpm-fw-largetitle: var(--bpm-fw-medium);
  --bpm-fw-title: var(--bpm-fw-medium);
  --bpm-fw-headline: var(--bpm-fw-medium);

  /* The same +8 of presence iOS just took (owner, 2026-11-11). M3's small top
     app bar is 64dp and its medium one is 112dp; 72dp is the small bar with
     room for the bigger title, still nowhere near the medium bar's two rows. */
  --bpm-appbar-h: 72px;               /* was 64px, M3 small top app bar         */
  --bpm-tabbar-h: 80px;               /* M3 navigation bar                      */
  --bpm-radius-cell-group: 16px;
  --bpm-radius-card: 12px;            /* M3 card                                */
  --bpm-radius-btn: 999px;            /* M3 buttons are fully rounded           */
  --bpm-radius-field: 4px;            /* M3 outlined text field                 */
  --bpm-radius-sheet: 28px;           /* M3 bottom sheet top corners            */
  --bpm-radius-dialog: 28px;          /* M3 dialog                              */

  /* M3 shared-axis X for a push, fade-through for a tab switch, emphasized
     decelerate easing. */
  --bpm-dur-push: 300ms;
  --bpm-dur-tab: 200ms;
  --bpm-dur-sheet: 300ms;
  --bpm-ease-push: cubic-bezier(0.05, 0.7, 0.1, 1);
}

/* ==========================================================================
   Gallery phone frames. An iframe has no safe-area insets, so the gallery
   passes ?frame=1 and these stand in for them. Numbers are the devices the
   gallery draws: iPhone 393x852 (59pt status/Dynamic Island, 34pt home
   indicator); Android 412x915 (status bar with cutout, gesture bar).
   ========================================================================== */
html.bpm-framed.bpm-ios { --bpm-sim-top: 59px; --bpm-sim-bottom: 34px; }
html.bpm-framed.bpm-android { --bpm-sim-top: 32px; --bpm-sim-bottom: 24px; }

@media (prefers-reduced-motion: reduce) {
  html.bpm-ios, html.bpm-android {
    --bpm-dur-push: 0ms;
    --bpm-dur-tab: 0ms;
    --bpm-dur-sheet: 0ms;
  }
}
