/**
 * Pencil Group Main Stylesheet
 */

/* Reset & Base Variables Fallback */
:root {
    --pencil-container-width: 1200px;
    --pencil-primary: #15803d;
    /* Màu xanh lá cây giống hình */
    --pencil-secondary: #166534;
    --pencil-accent: #ff5630;
    --pencil-background: #ffffff;
    --pencil-text: #333333;
    --pencil-border: #e5e7eb;
}

body {
    margin: 0;
    padding: 0;
    font-family: System-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--pencil-text);
    background-color: var(--pencil-background);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--pencil-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover,
a:focus {
    color: var(--pencil-secondary);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --------------------------------------
 * Screen Reader Text (Skip to content)
 * -------------------------------------- */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    clip-path: none;
    color: var(--pencil-primary);
    display: block;
    font-size: 14px;
    font-weight: 700;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* --------------------------------------
 * Layout System
 * -------------------------------------- */
.pencil-container {
    max-width: var(--pencil-container-width);
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
    box-sizing: border-box;
}

.site-main {
    padding: 40px 0;
}

/* --------------------------------------
 * Header Builder Layout
 * -------------------------------------- */
.pencil-header-row {
    padding: 10px 0;
    background-color: var(--pencil-background);
    border-bottom: 1px solid var(--pencil-border);
}

.pencil-header-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    min-height: 80px;
    /* Độ cao tối thiểu cho Header */
}

.pencil-header-column {
    display: flex;
    align-items: center;
    gap: 30px;
    /* Khoảng cách giữa các item (VD: Giữa menu, search, button) */
}

/* Left: Logo */
.pencil-header-left {
    justify-content: flex-start;
    flex: 0 0 auto;
}

.item-logo .site-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    color: var(--pencil-primary);
}

.item-logo .site-title a {
    color: var(--pencil-primary);
}

/* Center: Menu */
.pencil-header-center {
    justify-content: center;
    flex: 1;
    /* Chiếm không gian còn lại */
}

/* Right: Search + Action */
.pencil-header-right {
    justify-content: flex-end;
    flex: 0 0 auto;
}

/* --------------------------------------
 * Navigation Menu
 * -------------------------------------- */
.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 25px;
    align-items: center;
}

.main-navigation a {
    color: var(--pencil-text);
    font-weight: 600;
    font-size: 1rem;
    display: block;
    padding: 10px 0;
}

.main-navigation a:hover,
.main-navigation .current-menu-item>a {
    color: var(--pencil-primary);
}

.menu-toggle {
    display: none;
}

/* --------------------------------------
 * Header Search Form
 * -------------------------------------- */
.item-search form {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}

.item-search label {
    display: none;
    /* Ẩn label "Search for:" visually, still there for screen readers */
}

.item-search input[type="search"] {
    border: none;
    padding: 8px 15px;
    font-size: 14px;
    outline: none;
    min-width: 200px;
}

.item-search input[type="submit"] {
    background-color: #f3f4f6;
    border: none;
    border-left: 1px solid #ccc;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.item-search input[type="submit"]:hover {
    background-color: #e5e7eb;
}

/* --------------------------------------
 * Buttons
 * -------------------------------------- */
.pencil-btn {
    display: inline-block;
    padding: 10px 24px;
    background-color: var(--pencil-primary);
    color: #ffffff;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pencil-btn:hover {
    background-color: var(--pencil-secondary);
    color: #ffffff;
}

/* --------------------------------------
 * Footer
 * -------------------------------------- */
.pencil-footer-row {
    padding: 60px 0 30px;
    background-color: #f8f9fa;
    border-top: 1px solid var(--pencil-border);
}

.pencil-footer-grid {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
}

.pencil-footer-column {
    flex: 1;
    min-width: 250px;
}

.widget-title {
    font-size: 1.125rem;
    margin-bottom: 20px;
}

.pencil-copyright {
    text-align: center;
    margin-top: 40px;
    font-size: 0.875rem;
}

/* --------------------------------------
 * Responsive (Mobile/Tablet)
 * -------------------------------------- */
@media screen and (max-width: 991px) {
    .menu-toggle {
        display: block;
        background: transparent;
        border: 1px solid var(--pencil-text);
        padding: 8px 15px;
        border-radius: 4px;
        cursor: pointer;
    }

    .main-navigation ul {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background: var(--pencil-background);
        padding: 20px;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        z-index: 999;
    }

    .main-navigation.is-active ul {
        display: flex;
    }

    .pencil-header-grid {
        position: relative;
    }

    .pencil-header-column {
        gap: 15px;
    }

    .item-search {
        display: none;
        /* Ẩn search bar trên mobile để gọn, có thể kích hoạt qua popup sau */
    }
}