/* ============================================
   FlinDB Base Styles
   Reset, body defaults, focus-visible, utilities
   ============================================ */

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

/* Prevent any element from causing horizontal scroll */
*, *::before, *::after {
    max-width: 100vw;
}

/* ========== HTML & Body ========== */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--bg-deep);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========== Focus-Visible Styling ========== */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--accent-violet);
    outline-offset: 2px;
}

/* Remove focus outline on click for buttons/links */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* ========== Links ========== */
a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

/* ========== Images ========== */
img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ========== Form Elements ========== */
button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

/* ========== Lists ========== */
ul, ol {
    list-style: none;
}

/* ========== Tables ========== */
table {
    border-collapse: collapse;
    width: 100%;
}

/* ========== Selection ========== */
::selection {
    background: var(--accent-violet);
    color: var(--text-primary);
}

/* ========== Scrollbar Styling ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) var(--bg-surface);
}

/* ========== Text Utilities ========== */
.gradient-text {
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-violet {
    background: var(--gradient-violet);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== Inline Icons ========== */
.icon-inline {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ========== Code Syntax Highlighting ========== */
.code-keyword { color: var(--accent-violet); }
.code-type { color: var(--accent-cyan); }
.code-string { color: var(--accent-emerald); }
.code-comment { color: var(--text-muted); font-style: italic; }
.code-function { color: var(--accent-gold); }
.code-operator { color: var(--accent-rose); }
.code-number { color: var(--accent-rose); }

/* ========== Screen Reader Only ========== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========== Skip Link ========== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-violet);
    color: white;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    z-index: var(--z-tooltip);
    transition: top var(--duration-fast);
}

.skip-link:focus {
    top: var(--space-4);
}
