/* ==========================================================================
   LTS MyTime Mobile — true full-screen mobile layer (fullscreen.css)
   Loaded AFTER style.css. CSS/meta only: no route, logic, or data changes.

   Goals:
   - Kill pull-to-refresh / rubber-band bounce without breaking in-page scroll
   - Brand-colored (LTS navy) edge reveal — never white
   - True 100dvh layout height with 100vh fallback
   - Safe-area insets honored by appbar / tabbar / sheets / drawer
   - No horizontal scroll at 360px widths
   - position:sticky (appbar, schedule strip, sheet header) left intact
   ========================================================================== */

/* ---------- Global touch behaviour ---------- */
*, *::before, *::after {
    -webkit-tap-highlight-color: transparent; /* no grey flash on tap (iOS) */
}

/* Interactive elements: kill the 300ms double-tap-zoom delay only.
   Does NOT disable pinch zoom or normal scrolling. */
a, button, input, select, textarea, summary, .tab, .iconbtn, .skd, .wday {
    touch-action: manipulation;
}

/* ---------- Root: navy canvas + no overscroll chaining ---------- */
html {
    background: #1F3A5F;              /* LTS navy — any edge reveal is brand-colored */
    overscroll-behavior: none;        /* kills pull-to-refresh bounce + rubber-banding */
    overflow-x: hidden;               /* legacy fallback */
    overflow-x: clip;                 /* clip (not hidden): creates NO scroll container,
                                         so position:sticky descendants keep working */
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    background: #1F3A5F;              /* matches html; content containers keep own bgs */
    overscroll-behavior-y: none;      /* vertical bounce off; normal in-page scroll intact */
    overflow-x: hidden;               /* legacy fallback */
    overflow-x: clip;                 /* sticky-safe: no new scroll container */
    min-height: 100vh;                /* fallback */
    min-height: 100dvh;               /* true mobile viewport height (URL bar aware) */
}

/* ---------- Main wrappers: full-height canvas ---------- */
.app, .page, .loginwrap, main {
    min-height: 100vh;                /* fallback */
    min-height: 100dvh;
}

/* ---------- Safe-area confirmation (existing env() usage verified intact) ----------
   .appbar      → padding-top includes env(safe-area-inset-top)
   .topbar      → padding-top includes env(safe-area-inset-top)
   .drawer-head / .drawer-x → top safe-area offsets
   .tabbar      → padding-bottom: env(safe-area-inset-bottom)
   body         → padding-bottom includes safe-area + tabbar height
   .sheet       → padding-bottom includes safe-area
   .drawer .verfoot → padding-bottom includes safe-area
   No additions needed; rules below only guard the sticky offsets. */

/* Sticky schedule strip pins below the sticky appbar. Keep z-index under the
   appbar (20) and above cards; do NOT give it an overflow ancestor. */
.skw-sticky {
    position: sticky;
    z-index: 15;
}

/* ---------- Inner scrollers: contain overscroll, keep smooth iOS scroll ----------
   `contain` stops a nested scroll from chaining/bouncing the page while the
   nested region itself still scrolls normally. */
.sheet, .drawer-rows, .errbox pre {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* ---------- Horizontal-scroll audit guards (360px) ---------- */
img, video, svg, iframe, canvas {
    max-width: 100%;
}
.card, .shift, .shiftcard, .bcard, .hero, .install-hero,
.notice, .lst, .restrict-card, .errbox, .sheet, .drawer {
    max-width: 100%;
}
/* Long values in key/value rows wrap instead of forcing horizontal scroll. */
.kv .v, .team-row .tname, .shiftcard .body, .grow {
    min-width: 0;
    overflow-wrap: anywhere;
}
/* Week strips / grids shrink to fit; flex children already flex:1 — belt only. */
.wkrow, .skw-strip, .weekstrip, .bcard, .clock-pair {
    max-width: 100%;
}

/* ---------- Form controls: no iOS auto-zoom, full-width contained ---------- */
input, select, textarea {
    max-width: 100%;
    font-size: 16px; /* >=16px prevents iOS focus-zoom on inputs */
}

/* ===== V1.0.0.4.1.0: dark mode =====
   Full dark theme for the entire app. html[data-theme="dark"] is set in
   <head> (partials/head.ejs) before any CSS paints, so there is no white
   flash on load. Toggle lives in the slide-over drawer (partials/drawer.ejs);
   the choice persists in localStorage; first visit honors prefers-color-scheme.
   Palette: dark navy/slate surfaces, LTS navy chrome kept, brightened accents.
   Appended here (loaded after style.css) so these rules win on conflicts. */
html[data-theme="dark"] { background: #0b1220; color-scheme: dark; }
html[data-theme="dark"] body {
    --bg: #0b1220;
    --card: #141e2e;
    --text: #e9eef5;
    --muted: #9fb0c3;
    --border: #2a3a4e;
    --navy-soft: #1b2c44;
    --line: #2a3a4e;
    --blue: #7fb0e8;
    --blue-bg: #152a45;
    --green: #6fd598;
    --green-bg: #12291a;
    --amber: #e8b84b;
    --amber-bg: #2e2410;
    --red: #f0887f;
    --red-bg: #331412;
    background: #0b1220;
    color: var(--text);
}

/* Surfaces that were hard-coded white. */
html[data-theme="dark"] .tabbar,
html[data-theme="dark"] .shift,
html[data-theme="dark"] .shiftcard,
html[data-theme="dark"] .wkrow .day,
html[data-theme="dark"] .wday,
html[data-theme="dark"] .skd,
html[data-theme="dark"] .sk-empty,
html[data-theme="dark"] .sheet,
html[data-theme="dark"] .sheet-h,
html[data-theme="dark"] .lst a,
html[data-theme="dark"] .lst button.lstrow,
html[data-theme="dark"] details.disc,
html[data-theme="dark"] .errbox,
html[data-theme="dark"] .bcard,
html[data-theme="dark"] .btn-outline,
html[data-theme="dark"] .btn.secondary,
html[data-theme="dark"] .seg button.on,
html[data-theme="dark"] .seg a.on { background: var(--card); }

/* Form controls: dark wells. */
html[data-theme="dark"] input[type=text],
html[data-theme="dark"] input[type=password],
html[data-theme="dark"] input[type=email],
html[data-theme="dark"] input[type=date],
html[data-theme="dark"] input[type=time],
html[data-theme="dark"] input[type=number],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .errbox pre { background: #0e1622; }

/* Navy text becomes a bright readable blue on dark surfaces. */
html[data-theme="dark"] .card h2,
html[data-theme="dark"] .card h3,
html[data-theme="dark"] .secttl,
html[data-theme="dark"] .greet,
html[data-theme="dark"] label.f,
html[data-theme="dark"] fieldset.days legend,
html[data-theme="dark"] .tab.on,
html[data-theme="dark"] .tabbar nav a.on,
html[data-theme="dark"] .shift .t,
html[data-theme="dark"] details.disc summary,
html[data-theme="dark"] .sheet-h,
html[data-theme="dark"] .sheet-h .iconbtn,
html[data-theme="dark"] .sheet-cancel,
html[data-theme="dark"] .skw-range,
html[data-theme="dark"] .skw-hours,
html[data-theme="dark"] .skw-nav,
html[data-theme="dark"] .bval,
html[data-theme="dark"] .oslabel,
html[data-theme="dark"] .loginlogo .t,
html[data-theme="dark"] .btn-outline,
html[data-theme="dark"] .btn.secondary,
html[data-theme="dark"] .shiftcard .time,
html[data-theme="dark"] .team-row .tclock b,
html[data-theme="dark"] .wday.has b,
html[data-theme="dark"] .skd.has b,
html[data-theme="dark"] .seg button,
html[data-theme="dark"] .seg a,
html[data-theme="dark"] .mlist .ico,
html[data-theme="dark"] .lst .ico { color: #8fb8ec; }

/* Chips + badges that pair navy text with a tinted pill. */
html[data-theme="dark"] .chip { background: var(--navy-soft); color: #8fb8ec; }
html[data-theme="dark"] .b-navy { background: var(--navy-soft); color: #8fb8ec; }
html[data-theme="dark"] .b-grey { background: #24344a; color: var(--muted); }

/* Notices: dimmed dark variants. */
html[data-theme="dark"] .notice.ok   { background: var(--green-bg); border-color: #245c38; color: #9fe0b4; }
html[data-theme="dark"] .notice.warn { background: var(--amber-bg); border-color: #6b551f; color: #f0cf7e; }
html[data-theme="dark"] .notice.err  { background: var(--red-bg);  border-color: #6e2b28; color: #f2a9a3; }
html[data-theme="dark"] .notice.info { background: var(--blue-bg); border-color: #2c4d78; color: #a9c9f2; }

/* AUP warning banner. */
html[data-theme="dark"] .aup { background: #2e2410; border-color: #8a6d1f; color: #f0d98a; }

/* Today's shift highlight. */
html[data-theme="dark"] .shift.today { background: #12291a; }

/* Filter chips (V1.0.0.4.1.0). */
html[data-theme="dark"] .fchip { background: var(--navy-soft); color: #8fb8ec; }
html[data-theme="dark"] .fchip.on { background: #2f5f9e; border-color: #2f5f9e; color: #fff; }

/* Pure-CSS clock illustration on the restricted screen. */
html[data-theme="dark"] .restrict-clock { background: var(--card); border-color: #8fb8ec; }
html[data-theme="dark"] .restrict-clock .rh,
html[data-theme="dark"] .restrict-clock .mh,
html[data-theme="dark"] .restrict-clock .cdot { background: #8fb8ec; }

/* Nav-tap spinner overlay. */
html[data-theme="dark"] #lts-navspin { background: rgba(8,12,20,.6); }
html[data-theme="dark"] #lts-navspin .spin { border-color: rgba(143,184,236,.25); border-top-color: #8fb8ec; }
