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

:root {
    /* Refactoring UI inspired color system */
    --bg-primary: #fafaf9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8fafc;
    --bg-white-smoke: #F5F5F4;
    
    /* Borders - subtle hierarchy */
    --border-light: #f1f5f9;
    --border-medium: #e2e8f0;
    --border-strong: #cbd5e1;
    
    /* Text hierarchy */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-quaternary: #94a3b8;
    
    /* Functional colors */
    --accent-primary: #3b82f6;
    --accent-secondary: #6366f1;
    --success: #059669;
    --warning: #d97706;
    --blob: #F0F6FA;
    
    /* Shadows - layered depth */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    font-size: 16px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 672px;
    margin: 0 auto;
    padding: 48px 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header - Clean hierarchy with logo */
.header {
    margin-bottom: 56px;
}

.header-top {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
    /* Align logo visually with text, not baseline */
    align-self: center;
    margin-bottom: 2px; /* optical tweak for vertical balance */
}

.title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.025em;
    line-height: 1.1;
    display: flex;
    align-items: center;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
    text-align: center;
    max-width: 480px;
    margin: 0 auto;
}

/* Main content */
.main-content {
    flex: 1;
}

/* Loading state */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    color: var(--text-tertiary);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-medium);
    border-top: 2px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Reading lists - Refactoring UI list design */
.reading-lists {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.week-item {
    background: var(--bg-secondary);
    margin-bottom: 20px;
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    transition: all 0.15s ease;
    cursor: pointer;
    position: relative;
}

.week-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.week-item.expanded {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
}

.week-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    gap: 16px;
    cursor: pointer;
}

.week-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    line-height: 1.4;
}

.week-date {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    background: var(--blob);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid var(--border-light);
}

.week-description {
    color: var(--text-secondary);
    padding: 0 24px 20px;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.expand-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.15s ease;
    color: var(--text-quaternary);
    flex-shrink: 0;
    margin-top: 2px;
}

.expand-icon polyline {
    pointer-events: none;
}

.week-item.expanded .expand-icon {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

/* Articles list - Clean list design */
.articles-list {
    display: none;
    border-top: 1px solid var(--border-light);
    padding: 0 16px 8px 16px;
    background-color: var(--bg-white-smoke);
}

.week-item.expanded .articles-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: center;
}

.article-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 24px;
    margin: 18px 0 0 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
    box-shadow: none;
    max-width: 600px;
    width: 100%;
}

.article-item:last-child {
    margin-bottom: 18px;
}

.article-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.article-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 0px;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-title::after {
    content: '\2197'; /* North East Arrow */
    font-size: 0.9em;
    color: var(--text-tertiary);
    opacity: 0.6;
    margin-left: 4px;
}

.article-description {
    font-size: 0.96rem;
    color: var(--text-tertiary);
    line-height: 1.6;
    margin-bottom: 0px;
}

.article-url {
    font-size: 0.81rem;
    color: var(--text-quaternary);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    background: none;
    padding: 0;
    border: none;
    display: inline;
    margin-top: 2px;
}

/* Error state */
.error {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    margin-top: 64px;
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid var(--border-light);
}

.footer p {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

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

/* Mobile responsiveness - Refactoring UI approach */
@media (max-width: 768px) {
    .container {
        padding: 32px 20px;
    }
    
    .header {
        margin-bottom: 40px;
    }
    
    .header-top {
        justify-content: center;
        gap: 12px;
    }
    
    .logo {
        width: 40px;
        height: 40px;
    }
    
    .title {
        font-size: 1.875rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .week-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 20px;
    }
    
    .week-description {
        padding: 0 20px 20px;
    }
    
    .expand-icon {
        position: absolute;
        top: 20px;
        right: 20px;
    }
    
    .article-item {
        padding: 16px 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 24px 16px;
    }
    
    .title {
        font-size: 1.75rem;
    }
    
    .week-header {
        padding: 16px;
    }
    
    .week-description {
        padding: 0 16px 16px;
    }
    
    .expand-icon {
        top: 16px;
        right: 16px;
    }
    
    .article-item {
        padding: 14px 16px;
    }
}
