/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --text-color: #000;
    --bg-color: #fff;
    --link-color: #0066cc;
    --link-hover: #0052a3;
    --border-color: #e5e5e5;
    --max-width: 650px;
}

html.dark {
    --text-color: #e5e5e5;
    --bg-color: #0e141b;
    --link-color: #66b3ff;
    --link-hover: #99ccff;
    --border-color: #2a3744;
}

html {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

body {
    margin: 0;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Login Screen Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0e141b 0%, #1a2332 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-container {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2.5rem;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.login-container h2 {
    color: #ffffff;
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.login-container > p {
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 0.875rem;
}

.form-group input {
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ffffff;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: #66b3ff;
    box-shadow: 0 0 0 2px rgba(102, 179, 255, 0.2);
}

.login-button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.login-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.login-button:active {
    transform: translateY(0);
}

.error-message {
    color: #ff6b6b;
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    min-height: 1.2rem;
}

/* Main App Layout */
#app {
    display: grid;
    grid-template-rows: 5rem minmax(0, 1fr) 5rem;
    grid-template-columns: 1fr;
    min-height: 100vh;
}

/* Header Styles */
header {
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 2rem;
}

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

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--link-color);
}

.nav-link.external {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

html.dark .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Main Content */
main {
    padding: 3rem 2rem;
    display: flex;
    justify-content: center;
}

.content {
    width: 100%;
    max-width: var(--max-width);
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

p {
    margin-bottom: 1.25rem;
    color: var(--text-color);
    line-height: 1.7;
}

ul {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.text-link {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.text-link:hover {
    color: var(--link-hover);
    border-bottom-color: var(--link-hover);
}

strong {
    font-weight: 700;
    color: var(--text-color);
}

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2rem;
}

footer p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-color);
    opacity: 0.7;
}

/* Section spacing */
.section {
    margin-top: 4rem;
}

.section:first-child {
    margin-top: 0;
}

/* Hero section */
.hero {
    text-align: center;
    margin-bottom: 4rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.cta-button, .secondary-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cta-button {
    background-color: var(--link-color);
    color: white;
}

.cta-button:hover {
    background-color: var(--link-hover);
    transform: translateY(-1px);
}

.secondary-button {
    background-color: transparent;
    color: var(--link-color);
    border: 2px solid var(--link-color);
}

.secondary-button:hover {
    background-color: var(--link-color);
    color: white;
}

/* Cards and grids */
.about-grid, .projects-grid, .interests-grid, .books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.card, .project-card, .interest-card, .book-card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.card:hover, .project-card:hover, .interest-card:hover, .book-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

html.dark .card:hover, 
html.dark .project-card:hover, 
html.dark .interest-card:hover, 
html.dark .book-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.project-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--border-color);
    color: var(--text-color);
    border-radius: 15px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    opacity: 0.7;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
    margin-top: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.5rem;
    top: 0.5rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--link-color);
    border: 2px solid var(--bg-color);
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.6;
    margin-bottom: 0.5rem;
}

.timeline-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* Interest cards */
.interest-card {
    text-align: center;
}

.interest-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 1rem;
}

/* Writings */
.writings-list {
    margin-top: 1.5rem;
}

.writing-item {
    padding: 1.5rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.writing-item:hover {
    transform: translateX(4px);
    border-color: var(--link-color);
}

.reading-time {
    font-size: 0.85rem;
    color: var(--link-color);
}

/* Life in Weeks */
.life-in-weeks-section {
    margin-top: 4rem;
}

.life-config {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.life-config input[type="date"] {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
}

.update-btn {
    padding: 0.5rem 1.5rem;
    background-color: var(--link-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.update-btn:hover {
    background-color: var(--link-hover);
}

.life-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
}

.life-in-weeks-grid {
    display: grid;
    grid-template-columns: repeat(52, 1fr);
    gap: 2px;
    padding: 1.5rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow-x: auto;
}

.week-box {
    width: 10px;
    height: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.week-box.lived {
    background-color: var(--link-color);
    border-color: var(--link-color);
}

.week-box:hover {
    transform: scale(1.3);
}

.year-marker {
    grid-column: span 52;
    font-size: 0.8rem;
    padding: 0.25rem 0;
    margin: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    opacity: 0.6;
}

/* Books */
.book-author {
    color: var(--link-color);
    font-size: 0.9rem;
    margin: 0.25rem 0;
}

.book-note {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    font-style: italic;
}

/* Games */
.game-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.tic-tac-toe {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2rem;
    text-align: center;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px);
    gap: 4px;
    margin: 1.5rem auto;
}

.game-cell {
    background-color: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.game-cell:hover:not(.taken) {
    background-color: var(--border-color);
}

.game-status {
    margin: 1rem 0;
    font-weight: 600;
}

.reset-btn {
    padding: 0.5rem 1.5rem;
    background-color: var(--link-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background-color: var(--link-hover);
}

/* Newsletter */
.newsletter-section {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2.5rem;
    text-align: center;
    margin-top: 4rem;
}

.newsletter-form {
    display: flex;
    gap: 1rem;
    max-width: 400px;
    margin: 1.5rem auto;
}

.newsletter-form input[type="email"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
}

.newsletter-form button {
    padding: 0.75rem 1.5rem;
    background-color: var(--link-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.newsletter-form button:hover {
    background-color: var(--link-hover);
}

.newsletter-note {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.7;
}

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

.contact-card {
    padding: 1.5rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    text-align: center;
    transition: all 0.2s ease;
}

.contact-card:hover {
    transform: translateY(-2px);
    border-color: var(--link-color);
}

.contact-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 1rem;
}

.contact-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

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

.consultation-offer {
    margin-top: 3rem;
    padding: 2rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
}

.consultation-btn {
    padding: 0.75rem 2rem;
    background-color: var(--link-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.consultation-btn:hover {
    background-color: var(--link-hover);
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 0 1rem;
    }
    
    nav {
        font-size: 0.875rem;
    }
    
    .nav-left {
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    
    main {
        padding: 2rem 1rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .hero-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .cta-button, .secondary-button {
        width: 100%;
    }
    
    .life-in-weeks-grid {
        grid-template-columns: repeat(26, 1fr);
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .newsletter-form button {
        width: 100%;
    }
}

/* Print styles */
@media print {
    .theme-toggle,
    .login-overlay {
        display: none !important;
    }
}