/* ==========================================================================
   KNOWLEDGE BASE - BASE STYLES
   Reset, typography, and base element styles
   ========================================================================== */

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

/* Base */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--kb-font-sans);
    font-size: var(--kb-text-base);
    line-height: 1.6;
    color: var(--kb-text-primary);
    background: var(--kb-bg-primary);
    min-height: 100vh;
    margin: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--kb-space-md);
    color: var(--kb-charcoal);
}

h1 {
    font-size: var(--kb-text-4xl);
    font-weight: 700;
}

h2 {
    font-size: var(--kb-text-3xl);
}

h3 {
    font-size: var(--kb-text-2xl);
}

h4 {
    font-size: var(--kb-text-xl);
}

h5 {
    font-size: var(--kb-text-lg);
}

h6 {
    font-size: var(--kb-text-base);
}

p {
    margin-bottom: var(--kb-space-md);
    line-height: 1.7;
}

/* Links */
.kb-page main a,
.kb-page .kb-newsletter a,
.kb-page footer a {
    color: var(--kb-primary);
    text-decoration: none;
    transition: color var(--kb-transition-fast);
}

.kb-page main a:hover,
.kb-page .kb-newsletter a:hover,
.kb-page footer a:hover {
    color: var(--kb-primary-dark);
    text-decoration: underline;
}

/* Lists */
ul, ol {
    margin-bottom: var(--kb-space-md);
    padding-left: var(--kb-space-xl);
}

li {
    margin-bottom: var(--kb-space-xs);
}

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

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

input[type="text"],
input[type="email"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: var(--kb-space-sm) var(--kb-space-md);
    border: 1px solid var(--kb-border);
    border-radius: var(--kb-radius-md);
    background: var(--kb-white);
    transition: border-color var(--kb-transition-fast);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--kb-primary);
}

button {
    cursor: pointer;
    border: none;
    background: var(--kb-primary);
    color: var(--kb-white);
    padding: var(--kb-space-sm) var(--kb-space-lg);
    border-radius: var(--kb-radius-md);
    font-weight: 600;
    transition: all var(--kb-transition-fast);
}

button:hover {
    background: var(--kb-primary-dark);
    transform: translateY(-1px);
}

/* Code */
code {
    font-family: var(--kb-font-mono);
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background: var(--kb-gray-100);
    border-radius: var(--kb-radius-sm);
    color: var(--kb-primary);
}

pre {
    font-family: var(--kb-font-mono);
    font-size: 0.9rem;
    padding: var(--kb-space-md);
    background: var(--kb-gray-900);
    color: var(--kb-gray-100);
    border-radius: var(--kb-radius-md);
    overflow-x: auto;
    margin-bottom: var(--kb-space-md);
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Blockquote */
blockquote {
    padding: var(--kb-space-md) var(--kb-space-lg);
    margin: var(--kb-space-lg) 0;
    background: var(--kb-cream);
    border-left: 4px solid var(--kb-primary);
    font-style: italic;
    border-radius: var(--kb-radius-md);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--kb-space-lg);
}

th, td {
    padding: var(--kb-space-sm);
    text-align: left;
    border-bottom: 1px solid var(--kb-border);
}

th {
    background: var(--kb-gray-100);
    font-weight: 600;
}

/* HR */
hr {
    border: none;
    border-top: 1px solid var(--kb-border);
    margin: var(--kb-space-2xl) 0;
}

/* Selection */
::selection {
    background: var(--kb-primary-light);
    color: var(--kb-charcoal);
}

/* Focus States */
*:focus-visible {
    outline: 2px solid var(--kb-primary);
    outline-offset: 2px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--kb-gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--kb-gray-400);
    border-radius: var(--kb-radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--kb-gray-500);
}

/* Utilities */
.kb-container {
    max-width: var(--kb-container-max);
    margin: 0 auto;
    padding: 0 var(--kb-space-lg);
}

.kb-content-container {
    max-width: var(--kb-content-max);
    margin: 0 auto;
    padding: 0 var(--kb-space-lg);
}

.kb-section {
    padding: var(--kb-space-3xl) 0;
}

.kb-section-alt {
    background: var(--kb-bg-secondary);
}

/* Responsive Typography */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    h1 {
        font-size: var(--kb-text-3xl);
    }
    
    h2 {
        font-size: var(--kb-text-2xl);
    }
    
    h3 {
        font-size: var(--kb-text-xl);
    }
    
    .kb-section {
        padding: var(--kb-space-2xl) 0;
    }
}
