/**
 * Chrome & Edge (Chromium) compatibility layer
 */

/* Stable font stacks when web fonts are blocked or slow */
:root {
    --font: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    --mono: Consolas, "Courier New", "Lucida Console", monospace;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    color-scheme: light;
}

body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Sticky header — WebKit prefix for older Chromium builds */
.site-header {
    position: -webkit-sticky;
    position: sticky;
}

/* Normalize form controls across Chrome / Edge */
button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

button {
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
}

.field input[type="text"],
.field input[type="date"] {
    width: 100%;
    min-height: 40px;
    line-height: 1.4;
    -webkit-appearance: none;
    appearance: none;
}

/* Keep native date picker working in Edge/Chrome */
.field input[type="date"] {
    min-width: 0;
}

.field input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.65;
}

.field input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Visible keyboard focus for both browsers */
a:focus-visible,
button:focus-visible,
input:focus-visible,
.page-btn:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.tool-btn:focus-visible {
    outline: 2px solid #667085;
    outline-offset: 2px;
}

/* Smooth scrolling where supported */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Table horizontal scroll on touch / narrow windows */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Flexbox gaps — margin fallback for legacy Edge (pre-Chromium) */
@supports not (gap: 1rem) {
    .site-logo > * + * {
        margin-left: 10px;
    }

    .site-nav > * + * {
        margin-left: 4px;
    }

    .row-actions > * + * {
        margin-left: 8px;
    }

    .pagination > * + * {
        margin-left: 6px;
    }

    .doc-toolbar > * + * {
        margin-left: 8px;
    }
}

/* Grid fallback for LPO document layout on very old engines */
@supports not (display: grid) {
    .info-grid {
        display: block;
    }

    .info-block {
        border-right: none;
        border-bottom: 1px solid #e4e7ec;
    }

    .terms-grid {
        display: block;
    }

    .term + .term {
        margin-top: 12px;
    }
}

/* Print color fidelity — Chrome & Edge */
@media print {
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
