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

/* CSS Variables - Apple Notes Colors */
:root {
    --background: #fefefe;
    --foreground: #1d1d1f;
    --note-bg: #fffef5;
    --note-border: #e8e8e0;
    --sidebar-bg: #f5f5f7;
    --sidebar-hover: #e8e8ea;
    --sidebar-selected: #ffd60a;
    --muted: #86868b;
    --link: #007aff;
    --divider: #e5e5e5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #1d1d1f;
        --foreground: #f5f5f7;
        --note-bg: #2c2c2e;
        --note-border: #3a3a3c;
        --sidebar-bg: #2c2c2e;
        --sidebar-hover: #3a3a3c;
        --sidebar-selected: #ffd60a;
        --muted: #98989d;
        --link: #0a84ff;
        --divider: #3a3a3c;
    }
}

/* Base Styles */
html {
    -webkit-text-size-adjust: 100%;
    tab-size: 4;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    color: var(--foreground);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100dvh;
}

/* Layout */
.min-h-dvh {
    min-height: 100dvh;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.py-12 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.pt-4 {
    padding-top: 1rem;
}

.pt-14 {
    padding-top: 3.5rem;
}

.mt-0\.5 {
    margin-top: 0.125rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mt-20 {
    margin-top: 5rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.ml-4 {
    margin-left: 1rem;
}

.my-4 {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.my-6 {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.my-8 {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.mr-3 {
    margin-right: 0.75rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

/* Text */
.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.text-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.text-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
}

.text-4xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

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

/* Colors */
.text-\[var\(--muted\)\] {
    color: var(--muted);
}

.text-\[var\(--foreground\)\] {
    color: var(--foreground);
}

.text-\[var\(--background\)\] {
    color: var(--background);
}

.bg-\[var\(--sidebar-bg\)\] {
    background-color: var(--sidebar-bg);
}

.bg-\[var\(--sidebar-hover\)\] {
    background-color: var(--sidebar-hover);
}

.bg-\[var\(--foreground\)\] {
    background-color: var(--foreground);
}

.bg-\[var\(--sidebar-selected\)\] {
    background-color: var(--sidebar-selected);
}

/* Width & Height */
.w-72 {
    width: 18rem;
}

.w-full {
    width: 100%;
}

.max-w-md {
    max-width: 28rem;
}

.max-w-2xl {
    max-width: 42rem;
}

.max-w-4xl {
    max-width: 56rem;
}

.max-w-none {
    max-width: none;
}

.min-w-0 {
    min-width: 0;
}

.h-dvh {
    height: 100dvh;
}

.h-full {
    height: 100%;
}

/* Borders */
.border {
    border-width: 1px;
}

.border-t {
    border-top-width: 1px;
}

.border-r {
    border-right-width: 1px;
}

.border-b {
    border-bottom-width: 1px;
}

.border-\[var\(--divider\)\] {
    border-color: var(--divider);
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-xl {
    border-radius: 0.75rem;
}

.rounded-full {
    border-radius: 9999px;
}

.ring-4 {
    --tw-ring-offset-shadow: 0 0 #0000;
    --tw-ring-shadow: 0 0 0 calc(4px + 0px) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), 0 0 #0000;
}

.ring-\[var\(--divider\)\] {
    --tw-ring-color: var(--divider);
}

/* Position */
.fixed {
    position: fixed;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.top-0 {
    top: 0;
}

.left-0 {
    left: 0;
}

.right-0 {
    right: 0;
}

.z-40 {
    z-index: 40;
}

.z-50 {
    z-index: 50;
}

/* Display */
.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.inline-flex {
    display: inline-flex;
}

.hidden {
    display: none;
}

/* Scrollbar */
.overflow-y-auto {
    overflow-y: auto;
}

.overflow-x-auto {
    overflow-x: auto;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--muted);
    border-radius: 4px;
}

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

/* Selection */
::selection {
    background: #ffd60a4d;
}

/* Transform */
.transform {
    transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.-translate-x-full {
    --tw-translate-x: -100%;
}

.translate-x-0 {
    --tw-translate-x: 0;
}

.transition-colors {
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-opacity {
    transition-property: opacity;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-transform {
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.duration-200 {
    transition-duration: 200ms;
}

.ease-in-out {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Cursor */
.cursor-pointer {
    cursor: pointer;
}

/* Note Item */
.note-item {
    background: transparent;
    border-radius: 8px;
    transition: background-color 0.15s;
}

.note-item:hover {
    background: var(--sidebar-hover);
}

.note-item.active {
    background: var(--sidebar-selected);
    border-left: 3px solid var(--foreground);
}

.note-item.active .note-preview,
.note-item.active .note-date {
    color: #1d1d1f;
}

/* Note Paper */
.note-paper {
    background: var(--note-bg);
    position: relative;
}

.note-paper::before {
    content: "";
    background: var(--note-border);
    width: 1px;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
}

/* Note Content */
.note-content {
    line-height: 1.6;
}

.note-content a {
    color: var(--link);
    text-decoration: none;
}

.note-content a:hover {
    text-decoration: underline;
}

.note-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.note-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.note-content ul,
.note-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

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

.note-content hr {
    margin: 1.5rem 0;
    border: 0;
    border-top: 1px solid var(--divider);
}

.note-content em {
    font-style: italic;
}

.note-content strong {
    font-weight: 600;
}

/* Note Title */
.note-title {
    letter-spacing: -0.02em;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Note Date */
.note-date {
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 400;
}

/* Note Preview */
.note-preview {
    color: var(--muted);
}

/* Prose */
.prose {
    max-width: 65ch;
}

.prose-lg {
    font-size: 1.125rem;
    line-height: 1.75;
}

/* Hover States */
.hover\:text-\[var\(--foreground\)\]:hover {
    color: var(--foreground);
}

.hover\:text-black:hover {
    color: #000;
}

.hover\:bg-\[var\(--sidebar-hover\)\]:hover {
    background-color: var(--sidebar-hover);
}

.hover\:opacity-90:hover {
    opacity: 0.9;
}

/* Mobile Header */
.mobile-header {
    display: flex;
}

@media (min-width: 768px) {
    .mobile-header {
        display: none;
    }
    
    .md\:block {
        display: block;
    }
    
    .md\:hidden {
        display: none;
    }
    
    .md\:sticky {
        position: sticky;
    }
    
    .md\:translate-x-0 {
        --tw-translate-x: 0;
    }
    
    .md\:pt-0 {
        padding-top: 0;
    }
    
    .md\:pt-2 {
        padding-top: 0.5rem;
    }
    
    .md\:py-12 {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
    
    .md\:text-5xl {
        font-size: 3rem;
        line-height: 1;
    }
}

/* Antialiased */
.antialiased {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* GitHub Chart */
.github-chart {
    width: 100%;
    max-width: 100%;
    height: auto;
}

@media (prefers-color-scheme: dark) {
    .github-chart {
        filter: invert(1) hue-rotate(180deg);
    }
}

/* Prevent horizontal overflow on mobile */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
    .github-chart {
        min-width: unset;
        max-width: 100%;
    }
    
    .note-paper::before {
        display: none;
    }
    
    .max-w-2xl {
        max-width: 100%;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    main {
        padding-top: 3.5rem;
    }
}
