/* Base styles and CSS variables */
:root {
    /* Light theme colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --accent-color: #3182ce;
    --border-color: #e2e8f0;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    
    /* System Fonts */
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2rem;
    --space-6: 3rem;
    
    /* Transitions */
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* Dark theme colors */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a202c;
        --bg-secondary: #2d3748;
        --text-primary: #f7fafc;
        --text-secondary: #e2e8f0;
        --border-color: #4a5568;
        --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
}

/* Manual dark mode class for JavaScript toggle */
.dark-mode {
    --bg-primary: #1a202c !important;
    --bg-secondary: #2d3748 !important;
    --text-primary: #f7fafc !important;
    --text-secondary: #e2e8f0 !important;
    --border-color: #4a5568 !important;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

/* Force immediate application of dark mode styles */
.dark-mode body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.dark-mode .site-header {
    background-color: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

.dark-mode .site-footer {
    background-color: var(--bg-secondary);
    border-top-color: var(--border-color);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-bottom: var(--space-3);
    font-weight: 700;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

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

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

a:hover {
    text-decoration: underline;
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-3);
}

/* Header and Navigation */
.site-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-3);
    position: relative;
}

.nav-brand {
    flex: 1;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: auto;
}

.nav-links {
    display: flex;
    gap: var(--space-4);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-normal);
}

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

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: var(--space-2);
    cursor: pointer;
    color: var(--text-primary);
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: currentColor;
    margin: 5px 0;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--space-2);
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

/* Slide Toggle for Theme */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-right: var(--space-2);
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--transition-normal);
    border-radius: 24px;
    box-shadow: inset 0 0 3px rgba(0,0,0,0.2);
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-normal);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

input:checked + .theme-slider {
    background-color: var(--accent-color);
}

input:checked + .theme-slider:before {
    transform: translateX(26px);
}

/* Remove the icon placement from the slider and handle it separately */
.theme-switch .moon-icon,
.theme-switch .sun-icon {
    display: none; /* Hide these icons to prevent conflicts */
}

/* Add sun/moon indicator colors instead */
.theme-slider:after {
    content: "☼";
    position: absolute;
    left: 7px;
    top: 1px;
    font-size: 14px;
    color: #fff;
    opacity: 0.8;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

input:checked + .theme-slider:after {
    content: "☾";
    left: auto;
    right: 7px;
}

/* Hide old theme toggle on smaller screens */
@media (max-width: 768px) {
    .theme-toggle {
        display: none;
    }
    
    .theme-switch {
        display: inline-block;
        margin-right: 0;
        margin-left: var(--space-2);
    }
    
    .theme-slider {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
}

/* Show old theme toggle on larger screens */
@media (min-width: 769px) {
    .theme-switch {
        display: none;
    }
    
    .theme-toggle {
        display: flex;
    }
}

.theme-toggle img {
    width: 24px;
    height: 24px;
}

.dark-mode .sun-icon {
    display: none;
}

.dark-mode .moon-icon {
    display: block;
}

:root:not(.dark-mode) .sun-icon {
    display: block;
}

:root:not(.dark-mode) .moon-icon {
    display: none;
}

/* Hero Section */
.hero {
    padding: var(--space-6) 0;
    text-align: center;
}

.avatar-container {
    margin-bottom: var(--space-4);
}

.avatar {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent-color);
}

.hero-bio {
    max-width: 600px;
    margin: 0 auto var(--space-4);
    color: var(--text-secondary);
}

/* Social Links */
.social-links {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
}

.social-links a {
    color: var(--text-secondary);
    transition: color var(--transition-normal);
}

.social-links a:hover {
    color: var(--accent-color);
}

/* Stories Page */
.stories-section {
    padding: var(--space-6) 0;
}

.category-nav {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.category-btn {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.category-btn:hover,
.category-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
    padding: var(--space-4) 0;
}

.story-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.story-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.story-content {
    padding: var(--space-4);
    flex: 1;
    display: flex;
    flex-direction: column;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.story-content::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* Prevent right-click context menu */
.story-content {
    pointer-events: auto;
}

.story-content * {
    pointer-events: none;
}

.story-content a,
.story-content button,
.story-content .theme-toggle,
.story-content .nav-links a {
    pointer-events: auto;
}

.category-tag {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    background-color: var(--accent-color);
    color: white;
    border-radius: 16px;
    font-size: 0.875rem;
    margin-bottom: var(--space-2);
    text-transform: capitalize;
}

.story-title {
    margin-bottom: var(--space-2);
    font-size: 1.5rem;
}

.story-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.story-title a:hover {
    color: var(--accent-color);
}

.story-excerpt {
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    flex: 1;
}

.story-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.story-meta time {
    display: inline-block;
}

/* Individual Story Page */
.story-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.story-meta {
    margin-bottom: var(--space-3);
}

.story-description {
    max-width: 600px;
    margin: 0 auto;
    color: var(--text-secondary);
}

.story-body {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

.story-body h2 {
    margin-top: var(--space-5);
}

.story-footer {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

/* Footer */
.site-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--space-4) 0;
    margin-top: var(--space-6);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.footer-links {
    display: flex;
    gap: var(--space-3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .theme-toggle {
        display: none;
    }
    
    .theme-switch {
        display: inline-block;
        margin-right: 0;
        margin-left: var(--space-2);
    }
    
    .theme-slider {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn var(--transition-slow);
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .site-header,
    .site-footer,
    .theme-toggle {
        display: none;
    }
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: var(--space-2);
    cursor: pointer;
    color: var(--text-primary);
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: currentColor;
    margin: 5px 0;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
        position: relative;
        z-index: 1001;
    }
    
    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--bg-primary);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: var(--space-6);
        padding: var(--space-6);
        z-index: 999;
        opacity: 0;
        transition: opacity var(--transition-normal);
    }
    
    .nav-links.active {
        display: flex;
        opacity: 1;
    }
    
    .nav-links a {
        font-size: 1.5rem;
        color: var(--text-primary);
        padding: var(--space-2) var(--space-4);
        display: block;
        width: 100%;
        text-align: center;
    }

    .nav-controls {
        gap: var(--space-2);
    }

    .theme-toggle {
        margin-right: 0;
    }
    
    /* Mobile menu animation */
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    /* When menu is open */
    body.menu-open {
        overflow: hidden;
    }

    .nav-links.active {
        display: flex;
        opacity: 1;
        background-color: var(--bg-primary);
    }

    .nav-links.active a {
        opacity: 1;
        transform: translateY(0);
    }

    /* Typography adjustments */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    /* Container padding */
    .container {
        padding: 0 var(--space-2);
    }
    
    /* Navigation */
    .mobile-menu-btn {
        display: block;
        position: relative;
        z-index: 1001;
    }
    
    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--bg-primary);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: var(--space-4);
        padding: var(--space-6);
        z-index: 999;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links a {
        font-size: 1.25rem;
        color: var(--text-primary);
    }
    
    .nav-controls {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        z-index: 1001;
    }
    
    /* Hero Section */
    .hero {
        padding: var(--space-4) 0;
    }
    
    .hero-bio {
        font-size: 1rem;
        padding: 0 var(--space-2);
        margin-bottom: var(--space-3);
    }
    
    .avatar {
        width: 150px;
        height: 150px;
    }
    
    /* Stories Grid */
    .stories-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
    
    .story-card {
        max-width: 100%;
    }
    
    .story-image {
        height: 180px;
    }
    
    .story-content {
        padding: var(--space-3);
    }
    
    .story-title {
        font-size: 1.25rem;
    }
    
    /* Category Navigation */
    .category-nav {
        justify-content: center;
        gap: var(--space-1);
    }
    
    .category-btn {
        padding: var(--space-1) var(--space-2);
        font-size: 0.875rem;
    }
    
    /* Footer */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: var(--space-3);
    }
    
    .footer-links {
        justify-content: center;
    }
}

/* Small phones */
@media (max-width: 480px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    
    .hero-bio {
        font-size: 0.9375rem;
    }
    
    .avatar {
        width: 120px;
        height: 120px;
    }
} 