:root {
    /* iOS 18 Color Palette - Dark Mode (Default) */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --bg-elevated: #1c1c1e;
    
    --text-primary: #ffffff;
    --text-secondary: rgba(235, 235, 245, 0.6);
    --text-tertiary: rgba(235, 235, 245, 0.3);
    
    --accent: #0a84ff;
    --accent-secondary: #5e5ce6;
    --accent-tertiary: #ff375f;
    --accent-green: #30d158;
    --accent-orange: #ff9f0a;
    --accent-yellow: #ffd60a;
    
    --separator: rgba(84, 84, 88, 0.65);
    --separator-light: rgba(84, 84, 88, 0.3);
    
    --glass-bg: rgba(28, 28, 30, 0.72);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-float: 0 20px 60px rgba(0, 0, 0, 0.6);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    
    --font-stack: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Monaco, 'Cascadia Mono', monospace;
    
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    
    --nav-height: 64px;
    --tabbar-height: 80px;
}

/* Light mode */
@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #f5f5f7;
        --bg-secondary: #ffffff;
        --bg-tertiary: #e8e8ed;
        --bg-elevated: #ffffff;
        
        --text-primary: #000000;
        --text-secondary: rgba(60, 60, 67, 0.6);
        --text-tertiary: rgba(60, 60, 67, 0.3);
        
        --separator: rgba(60, 60, 67, 0.29);
        --separator-light: rgba(60, 60, 67, 0.15);
        
        --glass-bg: rgba(255, 255, 255, 0.72);
        --glass-border: rgba(0, 0, 0, 0.06);
        --glass-highlight: rgba(255, 255, 255, 0.8);
        
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
        --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
        --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
        --shadow-float: 0 20px 60px rgba(0, 0, 0, 0.15);
    }
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-stack);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--separator);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* App container */
#app {
    min-height: 100vh;
    position: relative;
}

.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom));
}

/* Main content area */
.main-content {
    flex: 1;
    position: relative;
    overflow-x: hidden;
}

/* Page container */
.page-container {
    min-height: 100%;
    padding: 1rem;
    padding-top: calc(var(--nav-height) + 1rem + var(--safe-top));
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 768px) {
    .page-container {
        padding: 2rem;
        padding-top: calc(var(--nav-height) + 2rem + var(--safe-top));
        max-width: 900px;
    }
}

/* Section styling */
.section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.section-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

p {
    color: var(--text-secondary);
    line-height: 1.7;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

a:hover {
    opacity: 0.8;
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Gradient backgrounds */
.gradient-bg-1 {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
}

.gradient-bg-2 {
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-orange));
}

.gradient-bg-3 {
    background: linear-gradient(135deg, var(--accent-green), var(--accent));
}

/* Mesh gradient background */
.mesh-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.mesh-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    opacity: 0.08;
    filter: blur(80px);
    animation: meshFloat1 20s ease-in-out infinite;
}

.mesh-gradient::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -20%;
    width: 70%;
    height: 70%;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    opacity: 0.06;
    filter: blur(80px);
    animation: meshFloat2 25s ease-in-out infinite;
}

@keyframes meshFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

@keyframes meshFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-30px, 20px) scale(1.05); }
    66% { transform: translate(20px, -30px) scale(0.9); }
}

/* Grid patterns */
.grid-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.03;
    background-image: 
        linear-gradient(var(--separator) 1px, transparent 1px),
        linear-gradient(90deg, var(--separator) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* Utility classes */
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

/* Responsive utilities */
@media (min-width: 768px) {
    .md-flex-row { flex-direction: row; }
    .md-text-2xl { font-size: 1.5rem; }
    .md-text-3xl { font-size: 1.875rem; }
    .md-text-4xl { font-size: 2.25rem; }
    .md-text-5xl { font-size: 3rem; }
}

/* Selection styling */
::selection {
    background: var(--accent);
    color: white;
}

/* ============================================
   Blog Content Styles
   ============================================ */

.blog-content {
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 1rem;
}

.blog-content p {
    margin-bottom: 1.25rem;
}

.blog-content h2,
.blog-content h3,
.blog-content h4 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.blog-content h2 {
    font-size: 1.5rem;
}

.blog-content h3 {
    font-size: 1.25rem;
}

.blog-content h4 {
    font-size: 1.125rem;
}

.blog-content code {
    background: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: var(--accent);
}

.blog-content pre {
    background: var(--bg-tertiary);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    margin-bottom: 1.25rem;
    border: 1px solid var(--glass-border);
}

.blog-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

.blog-content ul,
.blog-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.blog-content li {
    margin-bottom: 0.5rem;
}

.blog-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.3s ease;
}

.blog-content a:hover {
    text-decoration-color: var(--accent);
}

.blog-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1.25rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.blog-content img {
    max-width: 100%;
    border-radius: var(--radius-lg);
    margin: 1.5rem 0;
}

.blog-content hr {
    border: none;
    height: 1px;
    background: var(--separator);
    margin: 2rem 0;
}

.blog-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
}

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

.blog-content th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.blog-content tr:hover {
    background: var(--bg-tertiary);
}

/* Timeline last item fix */
.timeline-item:last-child {
    border-left: 2px solid transparent !important;
}

/* Grid utilities */
.grid {
    display: grid;
}

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

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

.gap-4 {
    gap: 1rem;
}

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

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
