:root {
    --primary-color: #9fbeff;
    --secondary-color: #8dce83;
    --accent-color: #7ab870;
    --bg-color: #f9f9f9;
    --text-color: #333;
    --text-muted: #6b7280;
    --text-light: #fff;
    --link-color: #2563eb;
    --link-hover-color: #1d4ed8;
    --font-serif: 'Crimson Pro', serif;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 0.5rem;
    --max-width: 72rem; /* ~1152px */
}

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

body {
    font-family: var(--font-serif);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utility */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

.hidden { display: none !important; }
.block { display: block; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }

/* Header */
header {
    background-color: var(--primary-color);
    box-shadow: var(--shadow);
    color: var(--text-light);
    padding: 1.5rem 0;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* Navigation */
nav {
    background-color: var(--secondary-color);
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

nav .nav-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 4rem;
}

nav .desktop-menu {
    display: none;
}

nav .mobile-menu-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
}

nav .mobile-menu-btn:hover {
    background-color: var(--accent-color);
}

nav .mobile-menu-btn svg {
    width: 1.5rem;
    height: 1.5rem;
}

nav .mobile-menu {
    padding: 0.5rem;
    background-color: var(--secondary-color);
}

nav a {
    color: var(--text-light);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    font-weight: 500;
    display: block;
}

nav a:hover {
    background-color: var(--accent-color);
    transform: translateY(-1px);
}

@media (min-width: 1024px) {
    nav .desktop-menu {
        display: flex;
        justify-content: center;
        gap: 1rem;
        flex: 1;
    }
    
    nav a {
        display: inline-block;
    }

    nav .mobile-menu-btn, nav .mobile-menu {
        display: none;
    }
}

/* Main Content */
main {
    padding: 2rem 0;
    flex: 1;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .content-grid {
        grid-template-columns: 3fr 1fr;
    }
}

.card {
    background-color: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

/* Typography inside content */
.prose {
    max-width: none;
}

.prose h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #2d3748;
    position: relative;
    display: inline-block;
}

.prose h2::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.prose h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #4a5568;
}

.prose p {
    margin-bottom: 1.5rem;
    color: #4a5568;
    font-size: 1.1rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.prose blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    font-style: italic;
    color: #555;
    margin: 2rem 0;
    background-color: #f8fbff;
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 0 0.5rem 0.5rem 0;
}

.prose cite {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-style: normal;
    color: #718096;
}

.prose a {
    color: var(--link-color);
    text-decoration: underline;
    transition: color 0.2s;
}

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

/* Images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 0.25rem;
}

.sidebar-img-container {
    text-align: center;
}

.cursor-pointer {
    cursor: pointer;
}

/* Tables (for random sonnet) */
table.sonnet-lines {
    width: 100%;
    border-collapse: collapse;
}

td.number {
    width: 60px;
    text-align: center;
    vertical-align: middle;
    padding: 0.5rem;
    color: #a0aec0;
    font-size: 0.9rem;
    font-family: monospace;
}

td.sonnet-line {
    padding: 0.5rem;
    text-indent: 2rem;
    font-size: 1.15rem;
    color: #2d3748;
}

/* Footer */
footer {
    background-color: white;
    margin-top: 4rem;
    padding: 3rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid #e2e8f0;
}

footer a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

/* Button */
.btn {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    box-shadow: var(--shadow);
}

.btn:hover {
    background-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    padding: 2rem;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--primary-color);
}
