/* ============================================
   BOXMAR GLOBAL LOGISTICS — Base Design System
   Design tokens, CSS reset, typography,
   layout primitives, utility classes,
   and responsive breakpoints.

   Color palette extracted from the BOXMAR logo:
   LOGO GOLD    #C8922A / #D4A030 / #E0B050  (camel hump, "GLOBAL LOGISTICS")
   LOGO SILVER  #8FA4B8 / #A8B8C8 / #C4D0DC  ("BOXMAR" text, camel legs)
   CIRCUIT BLUE #3A87C8 / #4A9FD4 / #5BB0E0  (PCB lines on camel body)
   DARK NAVY    #050E1C / #0A1628 / #0F2340  (backgrounds)
   ============================================ */

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
    /* ── LOGO GOLD PALETTE ── */
    --gold-900: #3D2800;
    --gold-800: #6B4600;
    --gold-700: #8C5E00;
    --gold-600: #A87818;
    --gold-500: #C8922A;
    --gold-400: #D4A030;
    --gold-300: #E0B050;
    --gold-200: #EDCB88;
    --gold-100: #F7E8CC;
    --gold-50: #FDF5E8;

    /* ── LOGO SILVER PALETTE ── */
    --silver-900: #1A2330;
    --silver-800: #2E3E50;
    --silver-700: #4A5E70;
    --silver-600: #627888;
    --silver-500: #7E94A6;
    --silver-400: #8FA4B8;
    --silver-300: #A8B8C8;
    --silver-200: #C4D0DC;
    --silver-100: #DFE8F0;
    --silver-50: #F2F6FA;

    /* ── CIRCUIT BLUE PALETTE ── */
    --blue-900: #0A1E36;
    --blue-800: #122E50;
    --blue-700: #1E4A78;
    --blue-600: #2B6BA8;
    --blue-500: #3A87C8;
    --blue-400: #4A9FD4;
    --blue-300: #5BB0E0;
    --blue-200: #8CCEF0;
    --blue-100: #C0E8F8;
    --blue-50: #E8F6FD;

    /* ── DARK NAVY PALETTE ── */
    --navy-950: #020810;
    --navy-900: #050E1C;
    --navy-800: #0A1628;
    --navy-700: #0F2340;
    --navy-600: #152F56;
    --navy-500: #1B3B6C;
    --navy-400: #224882;

    /* ── NEUTRAL GRAYS ── */
    --white: #FFFFFF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* ── SEMANTIC ALIASES ── */
    --primary: var(--gold-500);
    --primary-light: var(--gold-400);
    --primary-dark: var(--gold-600);
    --accent: var(--blue-500);
    --accent-light: var(--blue-400);
    --accent-dark: var(--blue-600);
    --surface: var(--navy-800);
    --surface-deep: var(--navy-900);
    --text-light: rgba(255, 255, 255, 0.85);
    --text-muted: rgba(255, 255, 255, 0.55);

    /* ── GRADIENTS ── */
    --grad-gold: linear-gradient(135deg, var(--gold-600), var(--gold-400), var(--gold-300));
    --grad-silver: linear-gradient(135deg, var(--silver-500), var(--silver-300));
    --grad-blue: linear-gradient(135deg, var(--blue-700), var(--blue-500), var(--blue-300));
    --grad-dark: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-800) 100%);
    --grad-hero: linear-gradient(145deg, #010408 0%, #020A14 12%, #040E1C 25%, #060F22 40%, #081428 60%, #0A1A30 80%, #0C2038 100%);
    --grad-card: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
    --grad-cta: linear-gradient(135deg, var(--navy-900), #061525, var(--navy-800));

    /* ── SPACING ── */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* ── TYPOGRAPHY ── */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-accent: 'Outfit', sans-serif;

    /* ── TRANSITIONS ── */
    --t-fast: 0.18s ease;
    --t-base: 0.3s ease;
    --t-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --t-spring: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* ── SHADOWS ── */
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.28);
    --shadow-xl: 0 16px 56px rgba(0, 0, 0, 0.36);
    --shadow-2xl: 0 24px 80px rgba(0, 0, 0, 0.45);
    --shadow-gold: 0 4px 24px rgba(200, 146, 42, 0.35);
    --shadow-blue: 0 4px 24px rgba(58, 135, 200, 0.35);
    --glow-gold: 0 0 40px rgba(200, 146, 42, 0.3), 0 0 80px rgba(200, 146, 42, 0.1);
    --glow-blue: 0 0 40px rgba(58, 135, 200, 0.3);

    /* ── BORDERS ── */
    --border-gold: 1px solid rgba(200, 146, 42, 0.25);
    --border-silver: 1px solid rgba(168, 184, 200, 0.2);
    --border-blue: 1px solid rgba(58, 135, 200, 0.25);
    --border-white: 1px solid rgba(255, 255, 255, 0.08);

    /* ── BORDER RADIUS ── */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-2xl: 40px;
    --radius-full: 9999px;

    /* ── Z-INDEX SCALE (Fix #11) ── */
    --z-float: 50;
    --z-chat: 80;
    --z-nav: 100;
    --z-mobile-menu: 150;
    --z-modal: 200;
    --z-top: 9999;
}

/* ============================================
   CSS RESET
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    color: var(--gray-700);
    line-height: 1.7;
    background: var(--white);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--t-fast);
}

ul,
ol {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

/* ── Fix #1.5: Visible Focus States (WCAG 2.4.7) ── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--gold-400);
    outline-offset: 3px;
    border-radius: var(--radius-xs);
    box-shadow: 0 0 0 4px rgba(200, 146, 42, 0.2);
}

/* Dark section focus variant */
.section--dark a:focus-visible,
.section--dark button:focus-visible,
.hero a:focus-visible,
.hero button:focus-visible,
.navbar a:focus-visible,
.navbar button:focus-visible {
    outline-color: var(--gold-300);
    box-shadow: 0 0 0 4px rgba(200, 146, 42, 0.3);
}

input,
textarea,
select {
    font-family: inherit;
    font-size: 1rem;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--gray-900);
}

h1 {
    font-size: clamp(1.75rem, 4vw + 0.5rem, 3.6rem);
    letter-spacing: -0.03em;
}

h2 {
    font-size: clamp(1.5rem, 3vw + 0.5rem, 2.6rem);
    letter-spacing: -0.02em;
}

h3 {
    font-size: clamp(1.1rem, 2vw + 0.3rem, 1.5rem);
}

h4 {
    font-size: 1.15rem;
}

p {
    margin-bottom: 1rem;
    max-width: 75ch; /* Fix #1.1: Cap line lengths for readability on ultra-wide */
}

p:last-child {
    margin-bottom: 0;
}

.section-label {
    text-transform: uppercase;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: var(--gold-500);
    margin-bottom: var(--space-sm);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.section-label::before {
    content: '';
    display: inline-block;
    width: 28px;
    height: 2px;
    background: linear-gradient(90deg, var(--gold-400), var(--gold-600));
    border-radius: 2px;
    flex-shrink: 0;
}

/* Camel icon after section label */
.section-label::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 24' fill='none'%3E%3Cpath d='M3 20 C3 20 2 17 3 14 C4 11 6 9 8 8.5 C8.8 8.2 9 7.5 9 6.5 C9 5 8 3.5 8.5 2.5 C9 1.5 10.5 1 12 1.5 C13.5 2 14 4 13.5 5.5 C13 7 12 7.8 12.5 9 C13 10.2 14.5 10.5 16 10 C17.5 9.5 18.5 8.5 19 7.5 C19.5 6.5 19 5 19.5 4 C20 3 21.5 2.5 23 3 C24.5 3.5 25 5 24.5 6.5 C24 8 23 8.8 23.5 10 C24 11.2 25.5 12 26.5 13 C27.5 14 27.8 15.5 27.5 17 C27.2 18.5 26.5 19.5 26 20 L3 20 Z' fill='%23C8922A' opacity='0.8'/%3E%3Cline x1='6' y1='20' x2='5.5' y2='23' stroke='%238FA4B8' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='9' y1='20' x2='8.5' y2='23' stroke='%238FA4B8' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='17' y1='20' x2='16.5' y2='23' stroke='%238FA4B8' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='20' y1='20' x2='20.5' y2='23' stroke='%238FA4B8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.7;
    flex-shrink: 0;
}

.section-title {
    margin-bottom: var(--space-lg);
}

.section-subtitle {
    color: var(--gray-500);
    font-size: 1.05rem;
    max-width: 600px;
    line-height: 1.8;
}

/* Gradient text utilities */
.text-gradient {
    background: var(--grad-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-gold {
    background: linear-gradient(135deg, var(--gold-300), var(--gold-400), var(--gold-200));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-silver {
    background: linear-gradient(135deg, var(--silver-300), var(--silver-200), var(--silver-100));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-blue {
    background: linear-gradient(135deg, var(--blue-300), var(--blue-400), var(--blue-200));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================================
   LAYOUT PRIMITIVES
   ============================================ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

.section {
    padding: var(--space-4xl) 0;
    position: relative;
}

.grid {
    display: grid;
    gap: var(--space-xl);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.flex {
    display: flex;
    align-items: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.text-center {
    text-align: center;
}

/* ── Section colour variants ── */
.section--dark {
    background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 50%, var(--navy-900) 100%);
    color: var(--white);
    position: relative;
    overflow: hidden;
}

.section--dark::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(200, 146, 42, 0.05) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 80%, rgba(58, 135, 200, 0.05) 0%, transparent 55%);
    pointer-events: none;
    z-index: 0;
}

.section--dark>.container {
    position: relative;
    z-index: 1;
}

.section--dark h2,
.section--dark h3,
.section--dark h4 {
    color: var(--white);
}

.section--dark .section-subtitle {
    color: rgba(255, 255, 255, 0.6);
}

.section--dark .section-label {
    color: var(--gold-400);
}

.section--dark .section-label::before {
    background: var(--grad-gold);
}

.section--dark .section-subtitle {
    color: rgba(168, 184, 200, 0.7);
}

.section--gray {
    background: var(--silver-50);
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   GPU-composited: only opacity + transform
   ============================================ */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    /* Fix #3.3: Removed will-change — only needed during active animation */
}

/* Fix #2.2: If JS fails or IntersectionObserver is unavailable, show content */
.no-js .reveal,
html:not(.js-ready) .reveal {
    opacity: 1;
    transform: none;
    transition: none;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 {
    transition-delay: 0.1s;
}

.reveal-delay-2 {
    transition-delay: 0.2s;
}

.reveal-delay-3 {
    transition-delay: 0.3s;
}

.reveal-delay-4 {
    transition-delay: 0.4s;
}

.reveal-delay-5 {
    transition-delay: 0.5s;
}

.reveal-delay-6 {
    transition-delay: 0.6s;
}

/* ============================================
   GLASS UTILITY CLASSES
   ============================================ */
.glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
}

.glass-gold {
    background: rgba(200, 146, 42, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(200, 146, 42, 0.2);
    border-radius: var(--radius-lg);
}

.glass-light {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
}

/* ============================================
   TAG / BADGE UTILITIES
   ============================================ */
/* Fix #1.6: Improved contrast for WCAG AA compliance */
.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(200, 146, 42, 0.16);
    color: var(--gold-800);
    border: 1px solid rgba(200, 146, 42, 0.3);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tag-blue {
    background: rgba(58, 135, 200, 0.1);
    color: var(--blue-500);
    border-color: rgba(58, 135, 200, 0.2);
}

.tag-silver {
    background: rgba(143, 164, 184, 0.1);
    color: var(--silver-500);
    border-color: rgba(143, 164, 184, 0.2);
}

/* ============================================
   UTILITY: Hidden (Fix #14 — chatbot trigger)
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   UTILITY: Glassmorphism Base (Fix #15)
   ============================================ */
.glass-base {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(3, 9, 18, 0.7);
    border: 1px solid rgba(200, 146, 42, 0.15);
}

/* ============================================
   FORM TOAST NOTIFICATIONS (Fix #8)
   ============================================ */
.form-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: var(--z-top);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--white);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    max-width: 90vw;
    text-align: center;
    line-height: 1.5;
}

.form-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.form-toast--error {
    background: rgba(220, 38, 38, 0.85);
    border: 1px solid rgba(248, 113, 113, 0.4);
}

.form-toast--warning {
    background: rgba(180, 120, 20, 0.85);
    border: 1px solid rgba(200, 146, 42, 0.5);
}

.form-toast strong {
    color: var(--gold-200);
}

/* ============================================
   FIX #2.8: FORM FIELD VALIDATION ERROR STYLE
   ============================================ */
.field-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ============================================
   SKIP-TO-CONTENT — Accessibility
   ============================================ */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 10000;
    padding: var(--space-sm) var(--space-lg);
    background: var(--gold-500);
    color: var(--navy-900);
    font-weight: 700;
    font-size: 0.88rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 8px;
}

/* ============================================
   TOP BAR DIVIDER — for mobile Fix #1.3
   ============================================ */
.top-bar-divider {
    width: 1px;
    height: 14px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 var(--space-sm);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* ── ≤1024px: Small laptops ── */
@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .specs-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ── ≤768px: Tablets ── */
@media (max-width: 768px) {
    .section {
        padding: var(--space-2xl) 0;
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .stat-ring {
        width: 100px;
        height: 100px;
    }

    .stat-ring svg {
        width: 100px;
        height: 100px;
    }

    /* Reduce blur intensity on mobile for performance */
    .glass,
    .glass-gold,
    .glass-light,
    .glass-base {
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    /* Fix #12: Minimum touch targets on mobile */
    .footer a,
    .nav-links a,
    .btn-sm {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* ── ≤576px: Large phones ── */
@media (max-width: 576px) {
    .container {
        padding: 0 var(--space-md);
    }

    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        gap: var(--space-xl);
    }

    .footer-bottom {
        font-size: 0.75rem;
        flex-direction: column;
        gap: var(--space-sm);
        text-align: center;
    }

    .contact-info-card {
        padding: var(--space-xl);
    }

    .specs-table,
    table {
        font-size: 0.78rem;
    }

    .specs-table th,
    .specs-table td {
        padding: var(--space-sm) var(--space-md);
    }
}

/* ============================================
   PREFERS-REDUCED-MOTION — Accessibility
   Respects OS-level "reduce animations" setting.
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.15s !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}