/* ============================================================
   SMIFID — Shared UI Refinement Layer
   Loaded LAST on every page so it wins on equal specificity.
   Refines the existing navy + blue corporate identity: it does
   not restyle from scratch. Safe, additive, brand-consistent.
   ============================================================ */

:root {
    --smf-navy-900: #0B1E33;
    --smf-navy-800: #0B2447;
    --smf-navy-700: #1A2F4F;
    --smf-blue-600: #2563eb;
    --smf-blue-500: #3b82f6;
    --smf-blue-400: #60a5fa;
    --smf-blue-300: #93c5fd;

    --smf-ring: rgba(37, 99, 235, 0.55);
    --smf-radius: 16px;

    --smf-shadow-sm: 0 1px 2px rgba(11, 30, 51, 0.06);
    --smf-shadow-md: 0 10px 30px -12px rgba(11, 30, 51, 0.18);
    --smf-shadow-lg: 0 26px 60px -24px rgba(11, 30, 51, 0.35);

    --smf-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Base polish ---------- */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 6rem; /* clear the sticky nav on anchor jumps */
    -webkit-text-size-adjust: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Tighten & balance display headings for a more premium feel */
h1, h2, h3 {
    text-wrap: balance;
    letter-spacing: -0.02em;
}

/* Brand text selection */
::selection {
    background: var(--smf-blue-500);
    color: #fff;
}

/* Crisper logo/photo edges */
img {
    image-rendering: auto;
}

/* Keyboard accessibility — consistent focus ring everywhere */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--smf-ring);
    outline-offset: 3px;
    border-radius: 8px;
}

/* ---------- Custom scrollbar (brand navy) ---------- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--smf-blue-400) transparent;
}
::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--smf-navy-700), var(--smf-navy-900));
    border: 3px solid transparent;
    background-clip: content-box;
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(var(--smf-blue-600), var(--smf-navy-800));
    background-clip: content-box;
}

/* ---------- Navigation: unified frosted bar ---------- */
/* Targets the shared navy nav across every page via its arbitrary class. */
nav[class*="0B1E33"] {
    background: rgba(11, 30, 51, 0.82) !important;
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid rgba(96, 165, 250, 0.14) !important;
    box-shadow: 0 8px 30px -18px rgba(0, 0, 0, 0.9) !important;
    transition: background 0.35s var(--smf-ease), box-shadow 0.35s var(--smf-ease);
}
/* Mobile menu panel matches the frosted bar */
nav[class*="0B1E33"] #mobile-menu {
    background: rgba(11, 30, 51, 0.92) !important;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

/* Animated gradient underline for primary nav links */
nav[class*="0B1E33"] .nav-link {
    position: relative;
    transition: color 0.25s var(--smf-ease);
}
nav[class*="0B1E33"] .nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    height: 2px;
    width: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--smf-blue-400), var(--smf-blue-600));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s var(--smf-ease);
}
nav[class*="0B1E33"] .nav-link:hover::after,
nav[class*="0B1E33"] .nav-link:focus-visible::after {
    transform: scaleX(1);
}

/* ---------- Footer: subtle brand hairline on top ---------- */
footer {
    position: relative;
}
footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(96, 165, 250, 0.45),
        rgba(37, 99, 235, 0.55),
        rgba(96, 165, 250, 0.45),
        transparent);
}

/* ---------- Card refinement ---------- */
/* Opt-in polish for portfolio / feature cards. Adds a smoother lift
   and a soft brand ring without fighting existing Tailwind hovers. */
.smf-card {
    transition:
        transform 0.5s var(--smf-ease),
        box-shadow 0.5s var(--smf-ease),
        border-color 0.5s var(--smf-ease) !important;
    will-change: transform;
}
.smf-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--smf-shadow-lg);
    border-color: rgba(37, 99, 235, 0.35) !important;
}
.smf-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    opacity: 0;
    transition: opacity 0.5s var(--smf-ease);
    pointer-events: none;
}
.smf-card:hover::after {
    opacity: 1;
}

/* ---------- Button micro-interaction ---------- */
/* Dark pill CTAs (bg-gray-900 / bg-slate-900) get a soft sheen + lift. */
a[class*="bg-gray-900"],
a[class*="bg-slate-900"],
button[class*="bg-gray-900"],
button[class*="bg-slate-900"] {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s var(--smf-ease), box-shadow 0.3s var(--smf-ease), background-color 0.3s var(--smf-ease);
}
a[class*="bg-gray-900"]::before,
button[class*="bg-gray-900"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.18), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s var(--smf-ease);
    pointer-events: none;
}
a[class*="bg-gray-900"]:hover::before,
button[class*="bg-gray-900"]:hover::before {
    left: 130%;
}

/* ---------- Section accent line helper ---------- */
.smf-accent {
    background: linear-gradient(90deg, var(--smf-blue-400), var(--smf-blue-600)) !important;
}

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