/**
 * Component Styles
 * Production-ready styles built on a foundation of design tokens
 * Optimized for clarity, accessibility, and timeless visual harmony
 */

/* ============================================
   Base Reset & Foundation
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    color: var(--color-text-primary);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1, "liga" 1;
    padding-top: var(--nav-height);
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* ============================================
   Navigation - Floating, Pixel-Perfect Design
   ============================================ */
.nav {
    position: fixed;
    top: var(--space-4);
    left: var(--space-4);
    right: var(--space-4);
    height: 56px;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: 50px;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow: var(--shadow-md), 0 0 0 1px oklch(100% 0 0 / 0.02);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    gap: var(--space-3);
    transition: all var(--transition-base);
}

@media (min-width: 768px) {
    .nav {
        padding: 0 var(--space-6);
        gap: var(--space-4);
    }
}

/* Navigation Logo */
.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-weight: 600;
    font-size: var(--text-base);
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: -0.01em;
}

.nav-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--color-accent-500);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-bg);
    font-weight: 700;
    font-size: var(--text-sm);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.nav-logo-text {
    display: none;
}

@media (min-width: 380px) {
    .nav-logo-text {
        display: inline;
    }
}

/* ============================================
   Table of Contents Dropdown
   ============================================ */
.nav-toc {
    flex: 1;
    min-width: 0;
    margin: 0;
    position: relative;
}

@media (min-width: 768px) {
    .nav-toc {
        max-width: 440px;
        margin: 0 var(--space-4);
    }
}

@media (max-width: 767px) {
    .nav-toc {
        position: static;
    }
}

.toc-dropdown {
    position: relative;
}

.toc-trigger {
    width: 100%;
    height: 40px;
    padding: 0 var(--space-6) 0 var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
    overflow: hidden;
}

.toc-trigger:hover {
    background: var(--color-surface-elevated);
    border-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}

.toc-trigger:focus-visible {
    outline: none;
    border-color: var(--color-accent-500);
    box-shadow: 0 0 0 3px var(--color-accent-100);
}

.toc-trigger.active {
    border-color: var(--color-accent-500);
    background: var(--color-accent-50);
}

.toc-trigger-icon {
    width: 6px;
    height: 6px;
    background: var(--color-accent-500);
    border-radius: 50%;
    flex-shrink: 0;
}

.toc-trigger-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toc-trigger-arrow {
    flex-shrink: 0;
    font-size: 16px;
    color: var(--color-text-tertiary);
    transition: transform var(--transition-fast);
    position: absolute;
    right: var(--space-3);
}

.toc-trigger.active .toc-trigger-arrow {
    transform: rotate(180deg);
}

.toc-menu {
    position: absolute;
    top: calc(100% + var(--space-4));
    left: 0;
    right: 0;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 440px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    z-index: 110;
}

@media (max-width: 767px) {
    .toc-menu {
        position: fixed;
        left: var(--space-4);
        right: var(--space-4);
        top: 72px;
    }
}

.toc-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.toc-menu-item {
    width: 100%;
    height: 44px;
    padding: 0 var(--space-4);
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.toc-menu-item:first-child {
    border-radius: 12px 12px 0 0;
}

.toc-menu-item:last-child {
    border-radius: 0 0 12px 12px;
}

.toc-menu-item:hover {
    background: var(--color-surface);
    color: var(--color-accent-600);
}

.toc-menu-item:focus-visible {
    outline: none;
    background: var(--color-accent-50);
    color: var(--color-accent-700);
}

.toc-menu-item.active {
    background: var(--color-accent-50);
    color: var(--color-accent-700);
    font-weight: 600;
}

.toc-menu-number {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    min-width: 28px;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Navigation Actions
   ============================================ */
.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.nav-btn:hover {
    background: var(--color-surface);
    color: var(--color-text-primary);
    box-shadow: var(--shadow-sm);
}

.nav-btn:focus-visible {
    outline: none;
    background: var(--color-accent-50);
    color: var(--color-accent-600);
    box-shadow: 0 0 0 3px var(--color-accent-100);
}

.nav-btn:active {
    transform: scale(0.96);
}

.nav-btn i {
    font-size: 20px;
}

/* ============================================
   Layout Container
   ============================================ */
.container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-8) var(--space-4);
}

@media (min-width: 768px) {
    .container {
        padding: var(--space-16) var(--space-8);
    }
}

section[id] {
    scroll-margin-top: calc(var(--nav-height) + var(--space-8));
}

/* ============================================
   Header & Title Hierarchy
   ============================================ */
header {
    margin-bottom: var(--space-20);
    padding-bottom: var(--space-10);
    border-bottom: 1px solid var(--color-border-subtle);
}

h1 {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: var(--space-4);
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
}

@media (min-width: 768px) {
    h1 {
        font-size: var(--text-4xl);
        letter-spacing: -0.03em;
    }
}

.subtitle {
    color: var(--color-text-secondary);
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-8);
    max-width: var(--reading-max);
}

.meta {
    display: flex;
    gap: var(--space-6);
    flex-wrap: wrap;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
}

.meta-item i {
    font-size: 16px;
    color: var(--color-text-tertiary);
}

/* ============================================
   Table of Contents Box
   ============================================ */
.toc {
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 16px;
    padding-top: var(--space-0);
    padding: var(--space-8);
    margin-bottom: var(--space-16);
    box-shadow: var(--shadow-sm);
}

.toc h2 {
    font-size: var(--text-xl);
    font-weight: 600;
    line-height: var(--leading-snug);
    margin-bottom: var(--space-6);
    margin-top: var(--space-0);
}

.toc ol {
    list-style: none;
    counter-reset: toc-counter;
}

.toc li {
    counter-increment: toc-counter;
    margin-bottom: var(--space-3);
}

.toc li::before {
    content: counter(toc-counter) ". ";
    color: var(--color-text-tertiary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    display: inline-block;
}

.toc a {
    color: var(--color-text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
}

.toc a:hover {
    color: var(--color-accent-600);
}

.toc a:focus-visible {
    outline: 2px solid var(--color-accent-500);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ============================================
   Typography - Content Hierarchy
   ============================================ */
h2 {
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: var(--space-16) 0 var(--space-8);
    line-height: var(--leading-snug);
    color: var(--color-text-primary);
}

@media (min-width: 768px) {
    h2 {
        font-size: var(--text-3xl);
        letter-spacing: -0.025em;
    }
}

h3 {
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: -0.015em;
    margin: var(--space-12) 0 var(--space-6);
    line-height: var(--leading-snug);
    color: var(--color-text-primary);
}

@media (min-width: 768px) {
    h3 {
        font-size: var(--text-2xl);
    }
}

h4 {
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: var(--space-8) 0 var(--space-4);
    line-height: var(--leading-snug);
    color: var(--color-text-primary);
}

@media (min-width: 768px) {
    h4 {
        font-size: var(--text-xl);
    }
}

p {
    margin-bottom: var(--space-6);
    max-width: var(--reading-max);
    line-height: var(--leading-relaxed);
}

p + p {
    margin-top: var(--space-4);
}

/* ============================================
   Lists
   ============================================ */
ul, ol {
    margin: var(--space-6) 0;
    padding-left: var(--space-8);
}

li {
    margin-bottom: var(--space-3);
    line-height: var(--leading-relaxed);
}

li:last-child {
    margin-bottom: 0;
}

/* ============================================
   Code & Syntax
   ============================================ */
code {
    font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    background: var(--color-surface);
    padding: 2px var(--space-2);
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    color: var(--color-accent-700);
    font-weight: 500;
}

/* Code Block Wrapper with Copy Button */
.code-block-wrapper {
    position: relative;
    margin: var(--space-8) 0;
}

.code-copy-btn {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    width: 36px;
    height: 36px;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 2;
    opacity: 0;
}

.code-block-wrapper:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: var(--color-accent-50);
    border-color: var(--color-accent-300);
    color: var(--color-accent-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.code-copy-btn:focus-visible {
    outline: none;
    opacity: 1;
    border-color: var(--color-accent-500);
    box-shadow: 0 0 0 3px var(--color-accent-100);
}

.code-copy-btn:active {
    transform: scale(0.96);
}

.code-copy-btn i {
    font-size: 18px;
}

pre {
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 12px;
    padding: var(--space-5);
    overflow-x: auto;
    margin: 0;
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
}

.code-block-wrapper pre {
    margin: 0;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--color-text-primary);
    font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Courier New', monospace;
    font-weight: 400;
}

/* Syntax Highlighting */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: var(--color-text-tertiary);
    font-style: italic;
}

.token.punctuation {
    color: var(--color-text-secondary);
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
    color: var(--color-accent-600);
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: var(--color-success);
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: var(--color-accent-500);
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: var(--color-info);
}

.token.function,
.token.class-name {
    color: var(--color-warning);
}

.token.important,
.token.bold {
    font-weight: 600;
}

/* ============================================
   Callouts
   ============================================ */
.callout {
    border-left: 3px solid var(--color-accent-500);
    padding: var(--space-5) var(--space-6);
    margin: var(--space-8) 0;
    background: var(--color-surface);
    border-radius: 0 12px 12px 0;
}

.callout-title {
    font-weight: 600;
    font-size: var(--text-base);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-accent-700);
}

.callout-title i {
    font-size: 18px;
}

.callout p {
    font-size: var(--text-sm);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    _font-style: italic;
    line-height: var(--leading-relaxed);
    margin-bottom: 0;
    opacity: 80%;
}

.callout.callout-info {
    border-left-color: var(--color-info);
    background: var(--color-info-bg);
}

.callout.callout-info .callout-title {
    color: var(--color-info);
}

.callout.callout-success {
    border-left-color: var(--color-success);
    background: var(--color-success-bg);
}

.callout.callout-success .callout-title {
    color: var(--color-success);
}

.callout.callout-warning {
    border-left-color: var(--color-warning);
    background: var(--color-warning-bg);
}

.callout.callout-warning .callout-title {
    color: var(--color-warning);
}

.callout.callout-error {
    border-left-color: var(--color-error);
    background: var(--color-error-bg);
}

.callout.callout-error .callout-title {
    color: var(--color-error);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 16px;
    padding: var(--space-8);
    margin: var(--space-8) 0;
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    line-height: var(--leading-tight);
    margin-bottom: var(--space-4);
    color: var(--color-text-primary);
}

.card p {
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
}

.card p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Grid Layout
   ============================================ */
.grid {
    display: grid;
    gap: var(--space-6);
    margin: var(--space-8) 0;
}

@media (min-width: 640px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Section Dividers
   ============================================ */
.section-divider {
    height: 1px;
    background: var(--color-border-subtle);
    margin: var(--space-16) 0;
}

/* ============================================
   Links
   ============================================ */
a {
    color: var(--color-accent-600);
    text-decoration: none;
    transition: all var(--transition-fast);
}

a:hover {
    color: var(--color-accent-700);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:focus-visible {
    outline: 2px solid var(--color-accent-500);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ============================================
   Footer
   ============================================ */
footer {
    margin-top: var(--space-24);
    padding-top: var(--space-10);
    border-top: 1px solid var(--color-border-subtle);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
}

footer p {
    margin-bottom: var(--space-2);
}

/* ============================================
   Floating Action Button
   ============================================ */
.fab {
    position: fixed;
    bottom: var(--space-8);
    right: var(--space-8);
    width: 56px;
    height: 56px;
    background: var(--color-accent-500);
    color: var(--color-bg);
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
    transition: all var(--transition-base);
}

.fab:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    background: var(--color-accent-600);
}

.fab:focus-visible {
    outline: none;
    box-shadow: var(--shadow-xl), 0 0 0 4px var(--color-accent-200);
}

.fab:active {
    transform: translateY(0) scale(0.96);
}

.fab i {
    font-size: 24px;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: oklch(0% 0 0 / 0.5);
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    padding: var(--space-6);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: scale(0.94) translateY(20px);
    transition: transform var(--transition-base);
    overflow: hidden;
}

.modal-overlay.open .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: var(--color-surface-elevated);
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-title {
    margin: var(--space-0);
    font-size: var(--text-xl);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.modal-close:focus-visible {
    outline: none;
    background: var(--color-accent-50);
    color: var(--color-accent-600);
    box-shadow: 0 0 0 3px var(--color-accent-100);
}

.modal-body {
    padding: var(--space-8);
    overflow-y: auto;
    flex: 1;
}

/* ============================================
   Theme Controls
   ============================================ */
.theme-control {
    margin-bottom: var(--space-4);
}

.theme-control:last-child {
    margin-bottom: 0;
}

.theme-control-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-4);
}

.theme-control-label {
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
}

.theme-control-value {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Toggle Switch
   ============================================ */
.toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 12px;
    transition: all var(--transition-fast);
}

.toggle-wrapper:hover {
    border-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}

.toggle-label {
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: var(--leading-tight);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-primary);
}

.toggle-label i {
    font-size: 18px;
    color: var(--color-text-secondary);
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 28px;
    background: var(--color-border);
    border-radius: 14px;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.toggle-switch.active {
    background: var(--color-accent-500);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: var(--color-bg);
    border-radius: 50%;
    transition: transform var(--transition-fast);
    box-shadow: 0 2px 4px oklch(0% 0 0 / 0.2);
}

.toggle-switch.active .toggle-thumb {
    transform: translateX(20px);
}

/* ============================================
   Slider Controls
   ============================================ */
.slider-wrapper {
    position: relative;
}

.slider-track {
    position: relative;
    height: 48px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.slider-track:hover {
    border-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}

.slider-gradient {
    position: absolute;
    inset: 1px;
    border-radius: 11px;
    pointer-events: none;
}

.slider-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.slider-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 20px;
    height: 20px;
    background: var(--color-text-primary);
    border: 3px solid var(--color-bg);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    box-shadow: 0 2px 8px oklch(0% 0 0 / 0.16);
    transition: transform var(--transition-fast);
}

.slider-input:active + .slider-thumb {
    transform: translate(-50%, -50%) scale(1.2);
}

/* ============================================
   Preset Buttons
   ============================================ */
.preset-grid {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: var(--space-1) 0;
    margin-top: var(--space-4);
}

.preset-grid::-webkit-scrollbar {
    height: 4px;
}

.preset-grid::-webkit-scrollbar-track {
    background: transparent;
}

.preset-grid::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 2px;
}

.preset-btn {
    padding: var(--space-2) var(--space-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 24px;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

.preset-btn:hover {
    background: var(--color-surface-elevated);
    border-color: var(--color-accent-500);
    color: var(--color-accent-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.preset-btn:focus-visible {
    outline: none;
    border-color: var(--color-accent-500);
    box-shadow: 0 0 0 3px var(--color-accent-100);
}

.preset-btn:active {
    transform: scale(0.98) translateY(0);
}

/* ============================================
   Tables
   ============================================ */
.table-container {
    overflow-x: auto;
    margin: var(--space-8) 0;
    border: 1px solid var(--color-border-subtle);
    border-radius: 16px;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-sm);
}

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

thead {
    background: var(--color-surface);
    position: sticky;
    top: 0;
    z-index: 1;
}

th {
    text-align: left;
    font-weight: 600;
    line-height: var(--leading-tight);
    padding: var(--space-4) var(--space-5);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
    color: var(--color-text-primary);
}

th:last-child {
    width: 35%;
    min-width: 300px;
}

td {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-subtle);
    vertical-align: top;
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
}

tbody tr:hover {
    background: var(--color-surface);
}

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

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

.table-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-3);
    background: var(--color-accent-50);
    color: var(--color-accent-700);
    border-radius: 12px;
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: var(--leading-tight);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* ============================================
   Notifications
   ============================================ */
.notification {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    margin: var(--space-8) 0;
    background: var(--color-accent-50);
    border: 1px solid var(--color-accent-200);
    border-radius: 16px;
    position: relative;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.notification-icon {
    width: 36px;
    height: 36px;
    background: var(--color-accent-500);
    color: var(--color-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px oklch(0% 0 0 / 0.1);
}

.notification-icon i {
    font-size: 18px;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-size: var(--text-base);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--color-accent-700);
    margin-bottom: var(--space-2);
}

.notification-message {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
}

.notification-close {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--color-accent-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    opacity: 0.6;
}

.notification-close:hover {
    opacity: 1;
    background: var(--color-accent-100);
}

.notification-close:focus-visible {
    outline: none;
    opacity: 1;
    box-shadow: 0 0 0 3px var(--color-accent-200);
}

.notification-close i {
    font-size: 16px;
}

.notification-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.notification-btn {
    padding: var(--space-2) var(--space-4);
    background: var(--color-accent-500);
    color: var(--color-bg);
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: var(--leading-tight);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.notification-btn:hover {
    background: var(--color-accent-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.notification-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-accent-200);
}

.notification-btn:active {
    transform: scale(0.98);
}

.notification-btn-secondary {
    background: transparent;
    color: var(--color-accent-700);
    border: 1px solid var(--color-accent-300);
}

.notification-btn-secondary:hover {
    background: var(--color-accent-100);
    border-color: var(--color-accent-400);
}

/* ============================================
   Feature Grid - Horizontal Scroll
   ============================================ */
.feature-grid {
    display: flex;
    gap: var(--space-4);
    margin: var(--space-8) 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: var(--space-1) 0 var(--space-4) 0;
    position: relative;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
}

.feature-grid::after {
    content: '';
    position: sticky;
    right: 0;
    width: 48px;
    height: 100%;
    background: linear-gradient(to right, transparent, var(--color-bg));
    pointer-events: none;
    flex-shrink: 0;
}

.feature-grid::-webkit-scrollbar {
    height: 6px;
}

.feature-grid::-webkit-scrollbar-track {
    background: var(--color-surface);
    border-radius: 3px;
}

.feature-grid::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.feature-card {
    min-width: 256px;
    max-width: 288px;
    padding: var(--space-6);
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 16px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    scroll-snap-align: start;
}

.feature-card:hover {
    border-color: var(--color-accent-300);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    width: 44px;
    height: 44px;
    background: var(--color-accent-100);
    color: var(--color-accent-600);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.feature-icon i {
    font-size: 22px;
}

.feature-title {
    font-size: var(--text-lg);
    font-weight: 600;
    line-height: var(--leading-tight);
    margin-bottom: var(--space-0);
    color: var(--color-text-primary);
}

.feature-description {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
}

/* ============================================
   Step List
   ============================================ */
.step-list {
    list-style: none;
    counter-reset: step-counter;
    padding: 0;
    margin: var(--space-0) 0;
}

.step-item {
    counter-increment: step-counter;
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    position: relative;
}

.step-item:last-child {
    margin-bottom: 0;
}

.step-number {
    width: 36px;
    height: 36px;
    color: var(--color-accent-500);
    background: var(--color-accent-50);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-base);
    line-height: var(--leading-tight);
    flex-shrink: 0;
}

.step-number::before {
    content: counter(step-counter);
}

.step-content {
    flex: 1;
    min-width: 0;
}

.step-title {
    font-weight: 600;
    font-size: var(--text-base);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-2);
    color: var(--color-text-primary);
}

.step-description {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
}

/* ============================================
   Command Block
   ============================================ */
.command-block {
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 12px;
    padding: var(--space-4);
    margin: var(--space-6) 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.command-prompt {
    color: var(--color-accent-500);
    font-weight: 600;
    flex-shrink: 0;
}

.command-text {
    color: var(--color-text-primary);
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
}

/* ============================================
   Comparison Cards
   ============================================ */
.comparison {
    display: grid;
    gap: var(--space-6);
    margin: var(--space-8) 0;
}

@media (min-width: 768px) {
    .comparison {
        grid-template-columns: repeat(2, 1fr);
    }
}

.comparison-card {
    padding: var(--space-8);
    background: var(--color-surface);
    border: 2px solid var(--color-border-subtle);
    border-radius: 16px;
    transition: all var(--transition-fast);
}

.comparison-card:hover {
    border-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}

.comparison-card.highlight {
    border-color: var(--color-accent-500);
    background: var(--color-accent-50);
}

.comparison-label {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    background: var(--color-accent-500);
    color: var(--color-bg);
    border-radius: 16px;
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: var(--leading-tight);
    margin-bottom: var(--space-6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comparison-title {
    font-size: var(--text-xl);
    font-weight: 600;
    line-height: var(--leading-tight);
    margin-bottom: var(--space-0);
    margin-top: var(--space-0);
    color: var(--color-text-primary);
}

.comparison-list {
    list-style: none;
    padding: 0;
}

.comparison-list li {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
}

.comparison-list li:last-child {
    margin-bottom: 0;
}

.comparison-list li::before {
    content: "→";
    color: var(--color-accent-500);
    font-weight: 600;
    flex-shrink: 0;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-secondary {
    color: var(--color-text-secondary);
}

.text-tertiary {
    color: var(--color-text-tertiary);
}

.scroll-hint {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    display: flex;
    align-items: center;
    gap: var(--space-1);
    user-select: none;
}

.scroll-hint i {
    font-size: 16px;
}

@media (max-width: 640px) {
    .scroll-hint {
        display: none;
    }
}

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

/* ============================================
   Print Optimization
   ============================================ */
@media print {
    .nav,
    .fab,
    .toc-dropdown,
    .nav-actions,
    .notification-actions,
    .scroll-hint {
        display: none !important;
    }
    
    body {
        padding-top: 0;
    }
    
    .container {
        max-width: 100%;
    }
}
