/* ============================================================
   DORIA – Reset / Base
   Normalize browser defaults for a consistent baseline.
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
}

/* Text scale. Every text size in the app stylesheets is in rem, so this
   root size is the one dial for all of them; padding, gaps and widths
   stay in px. On touch tablets text goes one step up relative to the
   spacing around it: at 16px the app's 11px floor read small on an
   8-11 inch screen held at arm's length. min-height keeps phones turned
   sideways (about 390px tall) on the phone scale.
   tests/textScale.test.js keeps text sizes out of px. */
@media (pointer: coarse) and (min-width: 641px) and (min-height: 480px) {
    html { font-size: 18px; }
}

body {
    font-family: var(--font-sans);
    background-color: var(--clr-bg);
    color: var(--clr-text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* Grain texture overlay from the marketing pages: off in the app, whose
   surfaces are flat (variables.css header). Kept as a rule so a page
   can't reintroduce it by accident through body::before. */
body::before {
    display: none;
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.022;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

a {
    color: var(--clr-accent);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

@media (hover: hover) and (pointer: fine) {
    a:hover {
        opacity: 0.8;
    }
}

a:active {
    opacity: 0.8;
}

img,
video {
    display: block;
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}

/* Instant tap response (skip the double-tap-zoom wait) and no accidental
   text selection/callout on controls — content text stays selectable since
   this doesn't touch body/p/etc. */
button,
a,
[role="button"] {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

ul,
ol {
    list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--fw-semibold);
    line-height: 1.3;
}

/* ── Scrollbars — native scrollbars hidden; overlay provided by customScrollbar.js ── */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

::-webkit-scrollbar {
    display: none;
}

/* ── Map touch handling — every Leaflet map across the app (Ops Console,
   Site Analysis, Fire Monitoring, Forest Monitoring, Report Detail, Submit
   Report, dashboard widgets, sandbox/test pages) gets this class applied
   automatically by Leaflet itself on whatever container it's given, so one
   global rule here covers all of them without touching each page.

   Without it, a pinch gesture on a touchscreen is ambiguous: Leaflet's own
   touch handler tries to zoom the MAP, but the browser's native pinch-zoom
   gesture recognizer sees the same two-finger gesture and tries to zoom the
   whole PAGE — both fire, fighting each other (the "PWA zooms on itself
   instead of the map" report). touch-action: none tells the browser not to
   apply any of its own default touch gestures on this element at all,
   leaving Leaflet's JS-driven pan/zoom as the only thing responding to
   touch here — modern iOS Safari (13+) and Android honour this for pinch
   specifically, not just single-finger panning. */
.leaflet-container {
    touch-action: none;
}

/* A click on a clickable map shape gives it focus, and Chrome then draws
   its default focus outline around the shape's square bounding box. On the
   Ops Console that showed as a white box around bomas: their invisible,
   wider hit twin (map.js _makeEasyTarget) is the element that takes focus.
   Hidden for mouse and touch focus only; keyboard focus keeps its outline. */
.leaflet-container .leaflet-interactive:focus:not(:focus-visible) {
    outline: none;
}
