/* ============================================
   J&D Vantage Quant - Base & Reset Styles
   ============================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    /* only hide horizontal overflow on body, not html — avoids dual-overflow spec issue */
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--text-primary);
    line-height: var(--leading-normal);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    position: relative;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(124, 58, 237, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 90% 40%, rgba(34, 211, 238, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 10% 70%, rgba(16, 185, 129, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse 70% 50% at 50% 100%, rgba(124, 58, 237, 0.05) 0%, transparent 60%);
    background-attachment: fixed;
}

/* Subtle noise texture overlay — adds depth without weight */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 50;
    opacity: 0.4;
    mix-blend-mode: overlay;
}

/* ---- Sections ---- */
.snap-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}



/* Compact padding on snap-panel sections — centering handles vertical placement */
.section.snap-panel {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
}

.snap-panel .section-header {
    margin-bottom: var(--space-8);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.3);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.5);
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
}

a {
    color: var(--color-purple-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--color-purple);
}

ul, ol {
    list-style: none;
}

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

button {
    cursor: pointer;
    font-family: var(--font-family);
    border: none;
    background: none;
    outline: none;
}

input, textarea, select {
    font-family: var(--font-family);
    outline: none;
}

strong {
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

/* ---- Selection ---- */
::selection {
    background: rgba(124, 58, 237, 0.3);
    color: var(--text-white);
}

/* ---- Container ---- */
.container {
    width: 100%;
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-sm {
    max-width: var(--container-md);
}

.container-lg {
    max-width: var(--container-2xl);
}

/* ---- Section ---- */
.section {
    padding: var(--space-24) 0;
    position: relative;
    z-index: var(--z-base);
    overflow: clip;
}

.section-sm {
    padding: var(--space-16) 0;
    position: relative;
    z-index: var(--z-base);
}

.section-lg {
    padding: var(--space-32) 0;
    position: relative;
    z-index: var(--z-base);
}

/* ---- Section Headers ---- */
.section-header {
    text-align: center;
    margin-bottom: var(--space-16);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.section-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-purple-light);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    margin-bottom: var(--space-4);
    padding: var(--space-2) var(--space-4);
    background: var(--color-purple-subtle);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: var(--radius-full);
    position: relative;
    overflow: hidden;
}

.section-label::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: labelShine 4s ease-in-out infinite;
}

@keyframes labelShine {
    0%, 100% { left: -100%; }
    50% { left: 150%; }
}

.section-title {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-4);
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* ---- Grids ---- */
.grid {
    display: grid;
    gap: var(--space-6);
}

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

/* ---- Flexbox Utilities ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ---- Text Utilities ---- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-purple { color: var(--color-purple-light); }
.text-cyan { color: var(--color-cyan); }
.text-green { color: var(--color-green); }
.text-amber { color: var(--color-amber); }
.text-red { color: var(--color-red); }
.text-gold { color: var(--color-gold-light); }
.text-muted { color: var(--text-muted); }

/* ---- Cards ---- */
.card {
    background: var(--color-bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    z-index: var(--z-base);
}

.card:hover {
    background: var(--color-bg-card-hover);
    border-color: var(--border-color-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-glass {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    z-index: var(--z-base);
}

.card-glow-purple:hover {
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: var(--shadow-glow-purple);
}

.card-glow-cyan:hover {
    border-color: rgba(34, 211, 238, 0.3);
    box-shadow: var(--shadow-glow-cyan);
}

.card-glow-green:hover {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: var(--shadow-glow-green);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-white);
    border: none;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    pointer-events: none;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 25px rgba(124, 58, 237, 0.5);
    color: var(--text-white);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--color-bg-card);
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.btn-outline-purple {
    background: transparent;
    color: var(--color-purple-light);
    border: 1px solid rgba(124, 58, 237, 0.3);
}
.btn-outline-purple:hover {
    background: var(--color-purple-subtle);
    border-color: var(--color-purple);
    color: var(--color-purple-light);
}

.btn-outline-cyan {
    background: transparent;
    color: var(--color-cyan);
    border: 1px solid rgba(34, 211, 238, 0.3);
}
.btn-outline-cyan:hover {
    background: var(--color-cyan-subtle);
    border-color: var(--color-cyan);
    color: var(--color-cyan);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
    border-radius: var(--radius-xl);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.badge-purple {
    background: var(--color-purple-subtle);
    color: var(--color-purple-light);
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.badge-cyan {
    background: var(--color-cyan-subtle);
    color: var(--color-cyan);
    border: 1px solid rgba(34, 211, 238, 0.2);
}

.badge-green {
    background: var(--color-green-subtle);
    color: var(--color-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-amber {
    background: var(--color-amber-subtle);
    color: var(--color-amber);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-red {
    background: var(--color-red-subtle);
    color: var(--color-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-gold {
    background: rgba(184, 149, 90, 0.1);
    color: var(--color-gold-light);
    border: 1px solid rgba(184, 149, 90, 0.2);
}

/* ---- Live Pulse Dot ---- */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-green);
    position: relative;
    display: inline-block;
}
.pulse-dot::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--color-green);
    animation: pulse 2s ease-in-out infinite;
    opacity: 0.4;
}

/* ---- Dividers ---- */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-8) 0;
}

.divider-gradient {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-purple), transparent);
    margin: var(--space-8) 0;
}

/* ---- Tables ---- */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    background: rgba(124, 58, 237, 0.1);
    padding: var(--space-4) var(--space-5);
    text-align: left;
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.table td {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: rgba(124, 58, 237, 0.04);
    transition: background 0.2s ease;
}

.table .highlight-row td {
    background: rgba(124, 58, 237, 0.05);
    color: var(--text-primary);
    font-weight: var(--font-semibold);
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--text-base);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--color-purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

/* ---- Stat Cards ---- */
.stat-item {
    text-align: center;
    padding: var(--space-6);
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-2);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

/* ---- Icon Box ---- */
.icon-box {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-box-purple {
    background: var(--color-purple-subtle);
    color: var(--color-purple-light);
}

.icon-box-cyan {
    background: var(--color-cyan-subtle);
    color: var(--color-cyan);
}

.icon-box-green {
    background: var(--color-green-subtle);
    color: var(--color-green);
}

.icon-box-amber {
    background: var(--color-amber-subtle);
    color: var(--color-amber);
}

.icon-box-red {
    background: var(--color-red-subtle);
    color: var(--color-red);
}

.icon-box-lg {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-xl);
}

/* ---- Feature List ---- */
.feature-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.feature-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-green-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.feature-check svg {
    width: 12px;
    height: 12px;
    color: var(--color-green);
}

/* ---- Page Wrapper ---- */
.page {
    display: none;
    min-height: calc(100vh - 80px);
    padding-top: var(--space-8);
}

.page.active {
    display: block;
    animation: pageEnter 0.5s ease forwards;
}

/* ---- Back to Top ---- */
.back-to-top {
    position: fixed;
    bottom: var(--space-8);
    right: var(--space-8);
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    z-index: var(--z-fixed);
    box-shadow: var(--shadow-glow-purple);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-3px);
}

/* ---- Misc ---- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relative { position: relative; }
.overflow-hidden { overflow: hidden; }

/* ---- Glow Accent Orbs — Static ---- */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: var(--z-behind);
}

.glow-orb-purple {
    background: radial-gradient(circle, rgba(124, 58, 237, 0.15) 0%, rgba(124, 58, 237, 0) 70%);
}

.glow-orb-cyan {
    background: radial-gradient(circle, rgba(34, 211, 238, 0.10) 0%, rgba(34, 211, 238, 0) 70%);
}

.glow-orb-green {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0) 70%);
}

/* ---- Decorated Sections ---- */
.section-decorated {
    overflow: hidden;
}

/* ---- Skip to Content (Accessibility) ---- */
.skip-to-content {
    position: fixed;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    padding: var(--space-3) var(--space-6);
    background: var(--color-purple);
    color: var(--text-white);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    text-decoration: none;
    transition: top 0.2s ease;
    outline: none;
}

.skip-to-content:focus {
    top: 0;
}

/* ---- Focus Visible (Keyboard Navigation) ---- */
:focus-visible {
    outline: 2px solid var(--color-purple-light);
    outline-offset: 2px;
}

/* Remove outline on mouse focus */
:focus:not(:focus-visible) {
    outline: none;
}

.nav-link:focus-visible,
.nav-cta:focus-visible,
.mega-item:focus-visible,
.nav-dropdown-item:focus-visible {
    outline: 2px solid var(--color-purple-light);
    outline-offset: -2px;
    border-radius: var(--radius-lg);
}

.btn:focus-visible,
.footer-link:focus-visible,
.footer-social-link:focus-visible {
    outline: 2px solid var(--color-purple-light);
    outline-offset: 2px;
}
