/* --- FILE: style.css --- */

/* --- CSS VARIABLES & RESET --- */
:root {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --accent-color: #0065ff;
    --accent-hover: #0052cc;
    --code-bg: #1e1e1e;
    --code-text: #e0e0e0;
    --gray-light: #f5f5f7;
    --gray-medium: #888;
    --transition: all 0.3s ease;
    --container-width: 800px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
ul { list-style: none; }

/* --- HEADER --- */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--text-color);
}

/* Hamburger Menu Icon */
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 1002;
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background-color: var(--text-color);
    transition: var(--transition);
}

/* Hamburger Animation */
.nav-active .hamburger-line:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-active .hamburger-line:nth-child(2) { opacity: 0; }
.nav-active .hamburger-line:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Navigation Overlay */
.nav-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px; 
    height: 100vh;
    background-color: var(--bg-color);
    box-shadow: -5px 0 15px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    padding-top: 80px;
    transition: var(--transition);
    z-index: 1001;
}

.nav-overlay.active { right: 0; }

.nav-links li { margin-bottom: 20px; }
.nav-links a {
    display: block;
    padding: 10px 30px;
    font-size: 1.1rem;
    font-weight: 500;
}
.nav-links a:hover { color: var(--accent-color); background: var(--gray-light); }

/* Backdrop click to close */
.backdrop {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.3);
    opacity: 0; pointer-events: none;
    transition: var(--transition);
    z-index: 1000;
}
.backdrop.active { opacity: 1; pointer-events: auto; }

/* --- MAIN CONTENT --- */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center; 
    padding: 120px 20px 60px;
    max-width: var(--container-width);
    margin: 0 auto;
    width: 100%;
}

.content-container {
    width: 100%;
    text-align: left;
}

.content-container h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 30px;
    letter-spacing: -0.02em;
    line-height: 1.1;
    border-bottom: 2px solid var(--gray-light);
    padding-bottom: 10px;
}
.content-container h1 span { color: var(--accent-color); }

.content-container h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 40px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.content-container h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 25px;
    margin-bottom: 10px;
}

.content-container p {
    margin-bottom: 20px;
}

.content-container ul {
    list-style: disc;
    margin-left: 25px;
    margin-bottom: 20px;
}
.content-container li {
    margin-bottom: 8px;
}

.code-block {
    background-color: var(--code-bg);
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    overflow-x: auto;
}
.code-block code {
    font-family: 'JetBrains Mono', monospace;
    color: #4ade80; 
    font-size: 0.9rem;
    white-space: pre-wrap;
    display: block;
}

/* --- FOOTER --- */
footer {
    border-top: 1px solid var(--gray-light);
    padding: 40px 20px;
    text-align: center;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
}

.footer-nav a {
    font-size: 0.9rem;
    color: var(--gray-medium);
    font-weight: 500;
}

.footer-nav a:hover { color: var(--accent-color); }

.copyright {
    font-size: 0.8rem;
    color: #ccc;
}

.link-in-content {
    color: var(--accent-color);
}

/* --- BỔ SUNG: ẢNH VÀ FIGURE (RESPONSIVE) --- */

/* Định dạng cho ảnh nằm trực tiếp trong content */
.content-container img {
    display: block;           /* Biến ảnh thành khối để căn lề */
    max-width: 100%;          /* Quan trọng: Ảnh không bao giờ to hơn khung chứa */
    height: auto;             /* Giữ nguyên tỷ lệ khung hình, không bị méo */
    margin: 30px auto;        /* Canh giữa ảnh, cách trên dưới 30px */
    border-radius: 8px;       /* Bo góc 8px (giống khối code-block) */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); /* Đổ bóng nhẹ giúp ảnh nổi bật */
    border: 1px solid rgba(0,0,0,0.05); /* Viền mờ nhẹ phòng khi ảnh màu trắng trùng nền */
}

/* Định dạng cho thẻ Figure (bao gồm ảnh + chú thích) */
.content-container figure {
    margin: 30px 0;
    text-align: center;       /* Căn giữa toàn bộ nội dung trong figure */
}

/* Reset margin của ảnh khi nằm trong figure để figure lo phần căn lề */
.content-container figure img {
    margin-bottom: 12px;      /* Khoảng cách giữa ảnh và dòng chú thích */
}

/* Định dạng chú thích ảnh (Caption) */
.content-container figcaption {
    font-size: 0.9rem;        /* Cỡ chữ nhỏ hơn nội dung chính */
    color: var(--gray-medium);/* Màu xám nhạt */
    font-style: italic;       /* In nghiêng */
    line-height: 1.4;
    padding: 0 10px;          /* Đệm 2 bên để chữ không sát lề trên mobile */
}

/* Cách dùng */
/* 
<figure>
    <img src="duong-dan-anh.jpg" alt="Menu điều khiển wpsila">
    <figcaption>Hình 1: Menu điều khiển chính của wpsila trên Terminal</figcaption>
</figure>
*/

/* --- RESPONSIVE FIX --- */
@media (max-width: 600px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }

    main {
        padding: 110px 16px 40px; 
        width: 100%; 
    }

    .content-container h1 { 
        font-size: 1.8rem; 
    }
    
    .content-container h2 {
        font-size: 1.5rem;
        margin-top: 30px;
    }
    
    .content-container h3 {
        font-size: 1.2rem;
    }
}