* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light mode colors */
    --bg-color: #f8f9fa;
    --text-color: #2c3e50;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.08);
    --card-shadow-hover: rgba(0, 0, 0, 0.15);
    --border-color: #e0e0e0;
    --secondary-text: #5a6c7d;
    --link-card-text: #444;
}

body.dark-mode {
    /* Dark mode colors */
    --bg-color: #1a1a2e;
    --text-color: #eaeaea;
    --card-bg: #16213e;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --card-shadow-hover: rgba(0, 0, 0, 0.5);
    --border-color: #0f3460;
    --secondary-text: #b8c1db;
    --link-card-text: #d0d4e0;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.8;
    color: var(--text-color);
    background-color: var(--bg-color);
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

header {
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    margin-bottom: 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.theme-toggle .sun-icon {
    display: inline;
}

.theme-toggle .moon-icon {
    display: none;
}

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

body.dark-mode .theme-toggle .moon-icon {
    display: inline;
}

.theme-toggle:focus {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    font-weight: normal;
    letter-spacing: 2px;
}

.tagline {
    font-size: 1.2em;
    font-style: italic;
    opacity: 0.9;
}

.home-link {
    color: white;
    text-decoration: none;
    font-style: normal;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.home-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.home-link:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

main {
    padding: 20px;
}

/* Home Page Styles */
.about-me {
    background: var(--card-bg);
    padding: 40px;
    margin-bottom: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--card-shadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.about-content {
    display: flex;
    gap: 40px;
    align-items: center;
}

.about-text {
    flex: 1;
}

.about-image {
    flex: 0 0 300px;
}

.about-image img {
    width: 100%;
    height: auto;
    display: block;
}

.about-me h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #667eea;
    font-weight: normal;
}

.about-me p {
    font-size: 1.1em;
    margin-bottom: 15px;
}

.portfolio-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.link-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--card-shadow);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s ease;
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px var(--card-shadow-hover);
}

.link-card h2 {
    font-size: 2em;
    margin-bottom: 15px;
    color: #667eea;
    font-weight: normal;
}

.link-card p {
    font-size: 1.05em;
    margin-bottom: 25px;
    color: var(--link-card-text);
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1.1em;
    transition: opacity 0.3s;
}

.btn:hover {
    opacity: 0.9;
}

.btn:focus {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

/* Writing Piece Styles */
.writing-piece {
    background: var(--card-bg);
    padding: 40px;
    margin-bottom: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--card-shadow);
    border-left: 4px solid #667eea;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.writing-piece h2 {
    font-size: 2em;
    margin-bottom: 15px;
    color: #667eea;
    font-weight: normal;
    text-align: center;
}

/* Piece Dates */
.piece-dates {
    text-align: center;
    margin-bottom: 25px;
    font-size: 0.95em;
    color: var(--secondary-text);
}

/* Version Tabs */
.versions {
    margin-top: 20px;
}

/* Version Selector (Mobile Dropdown) */
.version-selector {
    display: none;
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 25px;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1em;
    color: var(--text-color);
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.version-selector:hover {
    border-color: #667eea;
}

.version-selector:focus {
    outline: none;
    border-color: #667eea;
}

.version-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border-color);
}

.version-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1em;
    color: var(--secondary-text);
    transition: all 0.3s;
    margin-bottom: -2px;
}

.version-tab:hover {
    color: #667eea;
}

.version-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.version-tab:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.version-content {
    display: none;
}

.version-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

/* Poem Content */
.poem-content {
    font-size: 1.1em;
    line-height: 2;
    margin-bottom: 20px;
}

.poem-content p {
    margin-bottom: 20px;
}

/* Story Content */
.story-content {
    font-size: 1.05em;
    line-height: 1.9;
    margin-bottom: 20px;
    text-align: justify;
}

.story-content p {
    margin-bottom: 18px;
    text-indent: 2em;
}

.story-content p:first-child {
    text-indent: 0;
}

.version-note {
    text-align: right;
    font-style: italic;
    color: var(--secondary-text);
    font-size: 0.9em;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--secondary-text);
    font-size: 0.9em;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.footer-link {
    color: var(--secondary-text);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-link:hover {
    color: #667eea;
    text-decoration: underline;
}

.footer-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .about-content {
        flex-direction: column;
    }

    .about-image {
        flex: 0 0 auto;
        max-width: 250px;
        margin: 0 auto;
    }

    /* Show dropdown, hide tabs on mobile */
    .version-selector {
        display: block;
    }

    .version-tabs {
        display: none;
    }
}

@media (max-width: 600px) {
    header h1 {
        font-size: 2em;
    }

    .writing-piece, .about-me, .link-card {
        padding: 25px;
    }

    .writing-piece h2, .about-me h2, .link-card h2 {
        font-size: 1.5em;
    }

    .portfolio-links {
        grid-template-columns: 1fr;
    }

    .about-image {
        max-width: 200px;
    }
}
