/* --- 1. GENERAL RESET --- */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { line-height: 1.6; color: #333; background-color: #f4f4f9; display: flex; flex-direction: column; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
html { scroll-behavior: smooth; }

/* --- 2. HEADER --- */
header { background-color: #2c3e50; color: #fff; padding: 1rem 5%; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); position: sticky; top: 0; z-index: 1000; }
.logo { font-size: 1.8rem; font-weight: bold; letter-spacing: 1px; color: #ecf0f1; }
nav ul { list-style: none; display: flex; gap: 20px; }
nav a { color: #ecf0f1; font-weight: 500; transition: color 0.3s; }
nav a:hover { color: #3498db; }

/* --- 3. FOOTER --- */
footer { background-color: #222; color: #aaa; padding: 40px 20px; text-align: center; margin-top: auto; }
.footer-nav { margin-bottom: 20px; }
.footer-nav a { margin: 0 15px; font-size: 0.9rem; }
.footer-nav a:hover { color: white; }
.copyright { font-size: 0.8rem; border-top: 1px solid #444; padding-top: 20px; margin-top: 20px; }

/* --- 4. HOMEPAGE & LAYOUT --- */
.hero { background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d); color: white; text-align: center; padding: 80px 20px; }
.hero h1 { font-size: 3rem; margin-bottom: 10px; }
.hero p { font-size: 1.2rem; max-width: 600px; margin: 0 auto; opacity: 0.9; }

.container { max-width: 1200px; margin: 40px auto; padding: 0 20px; flex: 1; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; }

.card { background: white; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.3s; }
.card:hover { transform: translateY(-5px); }
.card-image { width: 100%; height: 180px; object-fit: cover; }
.card-content { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.card h3 { margin-bottom: 10px; color: #2c3e50; font-size: 1.3rem; }

/* --- 5. BUTTONS --- */
.button-group { display: flex; gap: 10px; margin-top: auto; }
.btn { flex: 1; padding: 10px; border-radius: 5px; text-align: center; font-size: 0.9rem; font-weight: 500; }
.btn-read { background-color: #3498db; color: white; }
.btn-share { background-color: #25D366; color: white; }

/* --- 6. ARTICLE PAGE LAYOUT --- */
.page-wrapper { max-width: 1200px; margin: 40px auto; padding: 0 20px; display: flex; gap: 40px; align-items: flex-start; }

.sidebar { flex: 0 0 250px; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); position: sticky; top: 100px; }
.sidebar h3 { font-size: 1.1rem; color: #2c3e50; margin-bottom: 15px; border-bottom: 2px solid #3498db; padding-bottom: 10px; }
.sidebar ul { list-style: none; }
.sidebar li { margin-bottom: 12px; }
.sidebar a { color: #555; font-size: 0.95rem; transition: color 0.2s; display: block; }
.sidebar a:hover { color: #3498db; padding-left: 5px; font-weight: 600; }

.article-content { flex: 1; background: white; padding: 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); min-width: 0; }
.article-content h1 { color: #2c3e50; font-size: 2.2rem; margin-bottom: 10px; }
.subtitle { color: #7f8c8d; font-size: 1.1rem; margin-bottom: 30px; border-bottom: 2px solid #3498db; padding-bottom: 20px; }

/* --- 7. ELEMENTS (Images, Code, Lists) --- */
figure { margin: 30px 0; text-align: center; }
img { max-width: 100%; height: auto; border-radius: 8px; }
figcaption { font-size: 0.9rem; color: #7f8c8d; margin-top: 10px; font-style: italic; }
pre { background-color: #2d3436; color: #dfe6e9; padding: 20px; border-radius: 8px; overflow-x: auto; margin: 20px 0; }
h2 { scroll-margin-top: 100px; color: #2c3e50; margin-top: 40px; margin-bottom: 15px; border-left: 5px solid #3498db; padding-left: 15px; }

/* --- 8. MOBILE --- */
@media (max-width: 768px) {
    header { flex-direction: column; text-align: center; }
    nav ul { margin-top: 15px; flex-direction: column; gap: 10px; }
    .page-wrapper { flex-direction: column; }
    .sidebar { width: 100%; position: relative; top: 0; margin-bottom: 20px; }
    .article-content { padding: 20px; }
}
