/* =========================================================
   TechFoxUSA.com — Base Stylesheet (WCAG-minded)
   Brand: Tech Blue + Fox Orange
   Font: Montserrat (brand) with system fallbacks
   ========================================================= */

/* ---------- Design Tokens ---------- */
:root {
    /* Brand Colors */
    --color-primary: #1E88E5;         /* Bright Tech Blue */
    --color-primary-alt: #1976D2;     /* Deep Tech Blue (alternate) */
    --color-accent: #F57C00;          /* Fox Orange */
    --color-accent-warm: #FFB300;     /* Warm Golden Orange */

    /* Neutrals */
    --color-white: #FFFFFF;
    --color-charcoal: #2B2B2B;
    --color-gray-900: #333333;

    /* Semantic UI Colors */
    --color-bg: var(--color-white);
    --color-surface: #F7FAFF;         /* subtle cool surface */
    --color-text: var(--color-gray-900);
    --color-text-muted: #4A5568;      /* accessible muted text */
    --color-border: #D7E3F4;          /* soft cool border */
    --color-link: var(--color-primary-alt);
    --color-link-hover: #155AA6;

    /* Focus (high visibility) */
    --focus-ring: 0 0 0 3px rgba(30, 136, 229, 0.35);
    --focus-ring-strong: 0 0 0 4px rgba(245, 124, 0, 0.35);

    /* Typography */
    --font-sans: "Montserrat", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";

    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;

    /* Type scale (clamp keeps it responsive) */
    --text-xs: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
    --text-sm: clamp(0.88rem, 0.86rem + 0.12vw, 0.95rem);
    --text-md: clamp(1.00rem, 0.98rem + 0.18vw, 1.10rem);
    --text-lg: clamp(1.15rem, 1.08rem + 0.35vw, 1.35rem);
    --text-xl: clamp(1.35rem, 1.20rem + 0.75vw, 1.75rem);
    --text-2xl: clamp(1.60rem, 1.35rem + 1.20vw, 2.20rem);

    --line-height: 1.55;

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.50rem;
    --space-3: 0.75rem;
    --space-4: 1.00rem;
    --space-5: 1.50rem;
    --space-6: 2.00rem;
    --space-7: 3.00rem;
    --space-8: 4.00rem;

    /* Layout */
    --container-max: 72rem; /* ~1152px */
    --container-pad: clamp(1rem, 3vw, 1.5rem);

    /* Radius & Shadows */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    --shadow-sm: 0 2px 10px rgba(25, 118, 210, 0.10);
    --shadow-md: 0 10px 25px rgba(43, 43, 43, 0.12);

    /* Motion */
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --dur-1: 140ms;
    --dur-2: 220ms;

    color-scheme: light;
}

/* Optional dark mode foundation (enable later if desired) */
/*
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0B1220;
    --color-surface: #0F1A30;
    --color-text: #F1F5F9;
    --color-text-muted: #CBD5E1;
    --color-border: #24324A;
    --color-link: #7BB8FF;
    --color-link-hover: #A8D2FF;
    color-scheme: dark;
  }
}
*/

/* ---------- Base / Reset ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font-sans);
    line-height: var(--line-height);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: var(--text-md);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Media defaults */
img, svg, video {
    display: block;
    max-width: 100%;
    height: auto;
}

p {
    margin: 0 0 var(--space-4);
}

strong { font-weight: 700; }

/* Headings */
h1, h2, h3, h4 {
    margin: 0 0 var(--space-3);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

/* Links (high-contrast, clear hover/focus) */
a {
    color: var(--color-link);
    text-decoration: underline;
    text-decoration-thickness: 0.10em;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--color-link-hover);
}

a:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: 0.25rem;
}

/* ---------- Layout Helpers ---------- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding-left: var(--container-pad);
    padding-right: var(--container-pad);
}

.section {
    padding: var(--space-7) 0;
}

.surface {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

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

/* Responsive columns you can reuse for service cards, etc. */
.grid.cols-2 { grid-template-columns: 1fr; }
.grid.cols-3 { grid-template-columns: 1fr; }

@media (min-width: 48rem) {
    .grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
    .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Buttons ---------- */
/* Ensure button text stays readable (blue/orange backgrounds use white text). */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;

    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 2px solid transparent;

    font-weight: 700;
    font-size: var(--text-sm);
    letter-spacing: 0.01em;

    cursor: pointer;
    user-select: none;
    text-decoration: none;

    transition:
            transform var(--dur-1) var(--ease),
            box-shadow var(--dur-2) var(--ease),
            background-color var(--dur-2) var(--ease),
            border-color var(--dur-2) var(--ease),
            color var(--dur-2) var(--ease);
}

.btn:active { transform: translateY(1px); }

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring-strong);
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
}

.btn-primary:hover {
    background: var(--color-primary-alt);
}

.btn-accent {
    background: var(--color-accent);
    color: var(--color-white);
}

.btn-accent:hover {
    background: #E26F00; /* slightly darker for hover */
}

.btn-outline {
    background: transparent;
    color: var(--color-primary-alt);
    border-color: var(--color-primary-alt);
}

.btn-outline:hover {
    background: rgba(30, 136, 229, 0.08);
}

/* ---------- Forms (Accessible defaults) ---------- */
label {
    display: inline-block;
    font-weight: 700;
    font-size: var(--text-sm);
    margin-bottom: var(--space-2);
}

.input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-white);
    color: var(--color-text);

    font: inherit;
}

.input::placeholder,
textarea::placeholder {
    color: #6B7280;
}

.input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

/* Helper text / errors (use in markup with aria-describedby) */
.help-text {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-2);
}

.error-text {
    font-size: var(--text-xs);
    color: #B91C1C;
    margin-top: var(--space-2);
}

/* ---------- Cards ---------- */
.card {
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: var(--color-white);
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: var(--text-xs);
    font-weight: 700;
    background: rgba(30, 136, 229, 0.12);
    color: var(--color-primary-alt);
}

/* ---------- Accessibility Utilities ---------- */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Skip link (add <a class="skip-link" href="#main">Skip to content</a>) */
.skip-link {
    position: absolute;
    left: -999px;
    top: var(--space-3);
    background: var(--color-white);
    color: var(--color-text);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 2px solid var(--color-primary);
    box-shadow: var(--shadow-sm);
    z-index: 9999;
}

.skip-link:focus {
    left: var(--space-3);
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ---------- Small utility spacing ---------- */
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }

.site-header {
    position: sticky;
    top: 0;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--container-pad);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--color-text);
    min-width: 12rem;
}

.brand-mark {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: rgba(30, 136, 229, 0.12);
    border: 1px solid var(--color-border);
    font-size: 1.25rem;
}

.brand-text {
    display: grid;
    line-height: 1.1;
}

.brand-name {
    font-weight: 800;
    letter-spacing: -0.01em;
}

.brand-sub {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 0.15rem;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.nav-list a:not(.btn) {
    text-decoration: none;
    font-weight: 700;
    color: var(--color-text);
}

.nav-list a:not(.btn):hover {
    color: var(--color-primary-alt);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.nav-cta {
    padding: 0.65rem 0.9rem;
    font-size: var(--text-xs);
}

/* Mobile nav behavior */
@media (max-width: 52rem) {
    .nav-list {
        position: absolute;
        right: var(--container-pad);
        top: 4.1rem;
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-2);
        padding: var(--space-3);
        width: min(18rem, calc(100vw - 2 * var(--container-pad)));
        background: var(--color-white);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-md);
    }

    .nav-list[data-collapsed="true"] {
        display: none;
    }

    .nav-list li a {
        display: block;
        padding: 0.6rem 0.6rem;
        border-radius: var(--radius-md);
    }

    .nav-list li a:not(.btn):hover {
        background: rgba(30, 136, 229, 0.08);
        text-decoration: none;
    }
}

@media (min-width: 52.01rem) {
    .nav-toggle { display: none; }
    .nav-list { position: static; }
}

/* Hero */
.hero {
    background:
            radial-gradient(900px 400px at 15% 15%, rgba(30,136,229,0.18), transparent 60%),
            radial-gradient(900px 400px at 85% 10%, rgba(255,179,0,0.16), transparent 55%),
            linear-gradient(180deg, var(--color-surface), var(--color-white));
    border-bottom: 1px solid var(--color-border);
}

.hero-inner {
    display: grid;
    gap: var(--space-6);
    padding: var(--space-8) var(--container-pad);
}

@media (min-width: 60rem) {
    .hero-inner {
        grid-template-columns: 1.25fr 0.9fr;
        align-items: start;
    }
}

.hero-lede {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    max-width: 46ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin: var(--space-5) 0;
}

.hero-highlights {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--color-text);
}

.hero-card-inner {
    padding: var(--space-5);
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-4);
    margin-bottom: var(--space-3);
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    padding: var(--space-5) 0;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-3);
    align-items: center;
}

/* =========================================================
   In-page Subnavigation (under <main>)
   Usage idea:
     <nav class="subnav" aria-label="On this page">...</nav>
   ========================================================= */

:root {
    --subnav-top-offset: 4.5rem; /* header height-ish; adjust if needed */
}

/* Ensure anchor jumps don't hide headings behind sticky header/subnav */
[id] { scroll-margin-top: calc(var(--subnav-top-offset) + 3.5rem); }

.subnav-wrap {
    position: sticky;
    top: var(--subnav-top-offset);
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
}

@supports not (backdrop-filter: blur(10px)) {
    .subnav-wrap { background: var(--color-white); }
}

.subnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) var(--container-pad);
}

.subnav-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--color-text);
    margin: 0;
}

.subnav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
}

.subnav-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
}

/* Link chips */
.subnav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;

    text-decoration: none;
    font-weight: 800;
    font-size: var(--text-xs);
    color: var(--color-primary-alt);

    border: 1px solid var(--color-border);
    background: rgba(30, 136, 229, 0.06);

    transition:
            background-color var(--dur-2) var(--ease),
            border-color var(--dur-2) var(--ease),
            transform var(--dur-1) var(--ease);
}

.subnav-link:hover {
    background: rgba(30, 136, 229, 0.12);
    border-color: rgba(30, 136, 229, 0.35);
}

.subnav-link:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring-strong);
}

/* Optional active state (JS can toggle aria-current="true") */
.subnav-link[aria-current="true"] {
    background: rgba(245, 124, 0, 0.14);
    border-color: rgba(245, 124, 0, 0.45);
    color: var(--color-charcoal);
}

/* Mobile: collapse the list behind a button (JS later can toggle data-collapsed) */
@media (max-width: 52rem) {
    .subnav { flex-wrap: wrap; }
    .subnav-list {
        width: 100%;
        padding-top: var(--space-2);
    }
    .subnav-list[data-collapsed="true"] { display: none; }
}

/* Desktop: keep toggle hidden */
@media (min-width: 52.01rem) {
    .subnav-toggle { display: none; }
}

/* =========================================================
   Floating "Fox Chat" UI (WCAG-friendly shell)
   JS later will toggle [data-open="true"].
   ========================================================= */

:root {
    --chat-z: 999;
    --chat-width: 22rem;
    --chat-height: 28rem;
    --chat-gap: 1rem;
}

/* Wrapper for the whole feature */
.foxchat {
    position: fixed;
    right: var(--chat-gap);
    bottom: var(--chat-gap);
    z-index: var(--chat-z);
}

/* Launcher button (bubble) */
.foxchat-launcher {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.65);
    background: linear-gradient(180deg, var(--color-accent), #E26F00);
    color: var(--color-white);
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.foxchat-launcher:hover {
    transform: translateY(-1px);
}

.foxchat-launcher:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring-strong), var(--shadow-md);
}

.foxchat-launcher .foxchat-emoji {
    font-size: 1.35rem;
    line-height: 1;
}

/* Chat panel (hidden by default) */
.foxchat-panel {
    position: absolute;
    right: 0;
    bottom: calc(3.25rem + 0.75rem);

    width: min(var(--chat-width), calc(100vw - 2 * var(--chat-gap)));
    height: min(var(--chat-height), calc(100vh - 7rem));

    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);

    overflow: hidden;

    opacity: 0;
    transform: translateY(8px) scale(0.98);
    pointer-events: none;

    transition:
            opacity var(--dur-2) var(--ease),
            transform var(--dur-2) var(--ease);
}

/* Open state (JS will toggle) */
.foxchat[data-open="true"] .foxchat-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Reduced motion: no animation */
@media (prefers-reduced-motion: reduce) {
    .foxchat-panel {
        transition: none;
        transform: none;
    }
    .foxchat-launcher:hover { transform: none; }
}

/* Panel header */
.foxchat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.foxchat-title {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    font-weight: 900;
    font-size: var(--text-sm);
}

.foxchat-subtitle {
    margin: 0.2rem 0 0;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.foxchat-close {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-white);
    color: var(--color-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.foxchat-close:hover {
    background: rgba(30, 136, 229, 0.06);
}

.foxchat-close:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Messages area (scrollable) */
.foxchat-body {
    height: calc(100% - 3.5rem - 3.75rem); /* header + composer */
    padding: var(--space-4);
    overflow: auto;
    background:
            radial-gradient(600px 240px at 20% 0%, rgba(30,136,229,0.10), transparent 55%),
            radial-gradient(600px 240px at 80% 0%, rgba(255,179,0,0.10), transparent 55%),
            var(--color-white);
}

/* “SMS-like” bubbles */
.foxchat-msg {
    display: grid;
    gap: 0.35rem;
    margin-bottom: var(--space-3);
    max-width: 85%;
}

.foxchat-msg[data-from="fox"] { margin-right: auto; }
.foxchat-msg[data-from="user"] { margin-left: auto; }

.foxchat-bubble {
    padding: 0.7rem 0.85rem;
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--text-sm);
}

.foxchat-msg[data-from="user"] .foxchat-bubble {
    background: rgba(30, 136, 229, 0.10);
    border-color: rgba(30, 136, 229, 0.25);
}

.foxchat-meta {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.foxchat-meta .foxchat-avatar {
    margin-right: 0.35rem;
}

/* Composer (disabled for now, but styled) */
.foxchat-composer {
    display: flex;
    gap: var(--space-2);
    align-items: center;

    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
    background: var(--color-white);
}

.foxchat-input {
    flex: 1;
    min-height: 2.6rem;
    padding: 0.65rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-white);
    font: inherit;
}

.foxchat-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

.foxchat-send {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    border: 2px solid transparent;
    background: var(--color-primary);
    color: var(--color-white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.foxchat-send:hover { background: var(--color-primary-alt); }

.foxchat-send:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring-strong);
}

/* Mobile: panel becomes a bottom sheet */
@media (max-width: 36rem) {
    .foxchat {
        right: var(--chat-gap);
        left: var(--chat-gap);
    }

    .foxchat-panel {
        right: 0;
        left: 0;
        width: auto;
        height: min(70vh, 32rem);
        bottom: calc(3.25rem + 0.75rem);
    }
}

