:root {
    --font-size: 17px;
    --background: #fbfbfd;
    --foreground: #1d1d1f;
    --card: #ffffff;
    --primary: #2563eb;
    --primary-foreground: #ffffff;
    --secondary: #f5f5f7;
    --muted: #86868b;
    --border: #d2d2d7;
    --radius: 0.75rem;
    --content-width: 980px;
    --sidebar-width: 260px;
    --header-height: 4rem;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --transition-base: 0.2s ease-out;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #0a0a0a;
        --foreground: #ededed;
        --card: #1a1a1a;
        --secondary: #2a2a2a;
        --border: #333;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: var(--font-size);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(251, 251, 253, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 2rem;
}

@media (prefers-color-scheme: dark) {
    header {
        background: rgba(10, 10, 10, 0.8);
    }
}

.header-content {
    max-width: var(--content-width);
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--foreground);
    font-weight: 600;
    font-size: 1.1rem;
}

.logo svg {
    width: 28px;
    height: 28px;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-base);
}

.nav-links a:hover {
    color: var(--foreground);
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
    padding-top: var(--header-height);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 2rem 1.5rem;
    border-right: 1px solid var(--border);
    background: var(--background);
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--foreground);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all var(--transition-base);
}

.sidebar-nav a:hover {
    background: var(--secondary);
}

.sidebar-nav a.active {
    background: var(--primary);
    color: var(--primary-foreground);
}

/* Main Content */
main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 3rem;
    max-width: calc(var(--content-width) - var(--sidebar-width) + 3rem);
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    color: var(--foreground);
}

.lead {
    font-size: 1.2rem;
    color: var(--muted);
    margin-bottom: 2rem;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-base);
    text-decoration: none;
    color: inherit;
    display: block;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    text-decoration: none;
}

.card h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card p {
    color: var(--muted);
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Code */
code {
    background: var(--secondary);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'SF Mono', Monaco, monospace;
}

pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1rem 0;
}

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

/* Lists */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Callouts */
.callout {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin: 1.5rem 0;
    border-left: 4px solid;
}

.callout-info {
    background: #eff6ff;
    border-color: var(--primary);
}

.callout-warning {
    background: #fffbeb;
    border-color: #f59e0b;
}

.callout-tip {
    background: #f0fdf4;
    border-color: #22c55e;
}

@media (prefers-color-scheme: dark) {
    .callout-info { background: rgba(37, 99, 235, 0.1); }
    .callout-warning { background: rgba(245, 158, 11, 0.1); }
    .callout-tip { background: rgba(34, 197, 94, 0.1); }
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

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

th {
    font-weight: 600;
    background: var(--secondary);
}

/* Steps */
.steps {
    counter-reset: step;
    list-style: none;
    padding-left: 0;
}

.steps li {
    position: relative;
    padding-left: 3rem;
    margin-bottom: 1.5rem;
}

.steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Icons */
.icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.card-icon {
    width: 2rem;
    height: 2rem;
    padding: 0.4rem;
    background: var(--secondary);
    border-radius: 8px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    background: var(--primary);
    color: var(--primary-foreground);
}

.badge-success {
    background: #22c55e;
}

.badge-warning {
    background: #f59e0b;
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-base);
}

.btn:hover {
    opacity: 0.9;
    text-decoration: none;
}

.btn-secondary {
    background: var(--secondary);
    color: var(--foreground);
}

/* Footer */
footer {
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    main {
        margin-left: 0;
        padding: 2rem 1rem;
    }
    footer {
        margin-left: 0;
        padding: 2rem 1rem;
    }
    h1 {
        font-size: 2rem;
    }
}
