:root {
    --color-bg: #E9E9E9;
    --color-white: #fff;
    --color-text: #717171;
    --color-text-dark: #535353;
    --color-border: #D9D9D9;
    --color-border-dark: #CDCDCD;
    --color-link: #7DA1BC;
    --color-link-hover: #EF4034;
    --width-container: 1000px;
    --width-sidebar: 249px;
    --color-menu-border: #333;
    --color-aside-text: #535353;
}

body {
    background: var(--color-bg) url(images/background.png) repeat;
    margin: 0;
}

#container,
#footer {
    margin: 0 auto;
    width: var(--width-container);
    
    font-size: 0.75rem;
    line-height: 1.5em;
    letter-spacing: 0.5px;
    color: var(--color-text);
    font-family: "Istok Web", sans-serif;
}

#mobile-menu-toggle,
#mobile-menu-panel {
    display: none;
}

#container > header {
    height: 240px;
    overflow: hidden;
    margin-top: 20px;
    position: relative;
}

#container > header h1 {
    font-size: 2.25rem;
    font-style: normal;
    font-weight: bold;
    letter-spacing: 2px;
    line-height: 1em;
    margin: 100px 0 0 50px;
    position: absolute;
    z-index: 100;
}

#container h1 a {
    color: #909090;
    text-decoration: none;
    text-shadow: 1px 1px 1px #ccc;
    transition: color 0.2s ease-in-out;
}

#container h1 a:hover {
    color: #000;
}

#header-image {
    width: var(--width-container);
    height: 240px;
    display: block;
}

#mobile-menu-toggle,
#mobile-menu-panel {
    display: none;
}

#menu {
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    height: 40px;
    margin-bottom: 20px;
}

.no-menu-top #menu {
    border: none;
    height: 0;
}
    
#menu .placeholder {
    height: 40px;
}

#navigation-main .block,
#navigation-sec .block {
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border-dark);
    border-right: 1px solid var(--color-border-dark);
    margin-bottom: 20px;
    padding: 20px;
}

#menu h3 {
    display: none;
}

#menu ul {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Top menu */
#menu a {
    display: block;
    color: #5C5C5C;
    height: 40px;
    line-height: 40px;
    padding: 0 15px;
    text-decoration: none;
    transition: background 0.2s ease-in-out, color 0.2s ease-in-out;
}

#menu a:hover {
    background: #333;
    color: var(--color-white);
}

#content .inner {
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 0;
}

article {
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border-dark);
    border-right: 1px solid var(--color-border-dark);
    margin: 0 20px 20px 20px;
    padding: 20px;
    order: 1;
}

.no-menu-main article {
    margin: 0 20px 20px 0;
}

.no-menu article {
    margin: 0 0 20px 0;
}

.no-menu-sec article {
    margin: 0 0 20px 20px;
}

article section h1,
article section h2,
article section h3,
article section h4 {
    color: var(--color-text-dark);
    font-weight: normal;
    line-height: 1.5em;
    text-shadow: 1px 1px 1px #ccc;
}

article section h1 a,
article section h2 a,
article section h3 a,
article section h4 a {
    color: var(--color-text-dark);
    transition: color 0.2s ease-in-out;
}

article section h1 a:hover,
article section h2 a:hover,
article section h3 a:hover,
article section h4 a:hover {
    color: var(--color-link);
    text-decoration: none;
}

article section h1,
article section h2 {
    margin-bottom: 5px;
    font-size: 1.125rem;
    line-height: 1.2em;
}

article section h3 {
    font-size: 1rem;
}

article p,
article dl {
    padding: 0 0 10px 0;
}

article a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

article a:hover {
    color: var(--color-link-hover);
    text-decoration: none;
}

article section h1 a,
article section h2 a,
article section h3 a {
    color: #696969;
}

article dt {
    color: #494949;
}

article dd {
    padding: 0 0 0 20px;
    line-height: 18px;
}

article table {
    border: 1px solid #696969;
    border-width: 1px 0 0 1px;
    width: 100%;
    margin: 30px 0;
    border-collapse: collapse;
}

article table td {
    border: 1px solid #696969;
    padding: 5px;
    border-width: 0 1px 1px 0;
}

article ul,
article ol {
    margin: 0 0 0 30px;
    padding: 0;
}

article ul li {
    padding: 2px 0;
    list-style-type: disc;
}

article ol li {
    padding: 1px 0;
    list-style-type: decimal;
}

article blockquote,
article pre {
    color: var(--color-white);
    margin: 10px 0;
    line-height: 18px;
    padding: 15px;
}

article blockquote {
    background: #141414;
    font-style: italic;
    border-left: 4px solid var(--color-link);
}

article pre {
    background: #696969;
    font-size: 0.75rem;
    line-height: 14px;
    overflow-x: auto;
}

article code {
    padding: 0;
    margin: 0;
}

article hr {
    background-color: var(--color-text-dark);
    border: none;
    height: 1px;
}

/* Blog specifics */
article .metadata {
    border-bottom: 1px dashed #C2C2C2;
    border-top: 1px dashed #C2C2C2;
    color: #999;
    font-size: 0.75rem;
    margin-bottom: 20px;
    margin-top: 10px;
    padding: 7px 0;
}

#navigation-main {
    order: 0;
}

#navigation-sec {
    order: 2;
}

aside {
    color: #a1a1a1;
}

aside .block {
    width: var(--width-sidebar);
}

aside h3 {
    border-bottom: 1px dashed #ccc;
    margin-bottom: 15px;
    margin-top: 0 !important;
    padding-bottom: 5px;
    font-size: 0.875rem;
    color: var(--color-text-dark);
    font-weight: normal;
    line-height: 1.5em;
    text-shadow: 1px 1px 1px #ccc;
}

aside li {
    margin-bottom: 5px;
}

aside a {
    color: #a1a1a1;
    transition: color 0.2s ease-in-out;
}

aside a:hover {
    text-decoration: underline;
}

aside .placeholder {
    width: 290px;
}

aside .search input[type="text"],
aside .search input[type="email"] {
    background: #E8E8E8 !important;
    border: 1px solid #ccc;
    color: #666;
    outline: none;
    padding: 10px 30px 10px 10px !important;
    position: relative;
    text-shadow: 1px 1px 1px var(--color-white);
    width: 210px;
    border-radius: 3px;
}

aside .search .submit {
    background: url("images/search.png") no-repeat;
    border: none;
    cursor: pointer;
    height: 15px;
    outline: none;
    position: relative;
    right: -110px;
    text-indent: -9999px;
    top: -30px;
    width: 15px;
}

aside .search .buttons {
    height: 0;
}
        
#footer {
    background: var(--color-white);
    border-top: 1px solid #D7D7D7;
    margin-top: 5px;
    width: 100%;
}

#footer footer {
    margin: auto;
    max-width: var(--width-container);
    font-size: 0.625rem;
    padding: 10px 0;
    text-align: right;
}

#footer a {
    text-decoration: none;
    color: #999;
    transition: color 0.2s ease-in-out;
}

#footer a:hover {
    color: var(--color-text-dark);
}

/* Responsive improvements for smaller screens */
@media (max-width: 1024px) {
    #container,
    #footer {
        width: 100%;
        max-width: var(--width-container);
        padding: 0 10px;
		box-sizing: border-box;
    }
    
    #content .inner {
        grid-template-columns: 1fr;
    }
    
    article {
        margin: 0 0 20px 0;
    }
    
    aside .block {
        width: 100%;
        max-width: var(--width-sidebar);
    }
}

/* --- Styles Mobile (Breakpoint) --- */
@media (max-width: 950px) {
    #container {
        margin-top: 0;
    }

    #main-content {
        word-wrap: anywhere;
    }

	#container > header {
		margin-top: 10px;
	}

    #container > header h1 {
        margin: 20px 60px 0 20px;
        font-size: 1.8rem;
        letter-spacing: -1px;
    }

    #container > header h1 a {
        top: 0 !important;
        left: 0 !important;
    }

    #menu,
    #navigation-main,
    #navigation-sec {
        display: none;
    }

    #mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 15px;
        right: 15px;
        z-index: 1001;
        width: 40px;
        height: 40px;
        background: var(--color-menu-border);
        border: none;
        border-radius: 3px;
        cursor: pointer;
    }

    #mobile-menu-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        background: var(--color-white);
        margin: 5px auto;
        transition: transform 0.3s, opacity 0.3s;
    }

    body.nav-open #mobile-menu-toggle span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    body.nav-open #mobile-menu-toggle span:nth-child(2) {
        opacity: 0;
    }
    body.nav-open #mobile-menu-toggle span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    #mobile-menu-panel {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: var(--color-white);
        z-index: 1000;
        overflow-y: auto;
        padding: 70px 20px 20px;
        box-sizing: border-box;

        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }

    body.nav-open #mobile-menu-panel {
        transform: translateX(0);
    }

    body.nav-open {
        overflow: hidden;
    }

    #content .inner {
        grid-template-columns: 1fr;
    }

    article {
        order: 0; 
        margin: 10px 0 0 0 !important;
    }

    #mobile-menu-panel .block { margin-bottom: 20px; }
    #mobile-menu-panel .block h3 {
        font-size: 1rem;
        font-weight: bold;
        text-transform: uppercase;
        padding: 10px;
        background-color: #edf0f4;
        color: var(--color-aside-text);
    }
    #mobile-menu-panel ul { display: block; }
    #mobile-menu-panel li {
        display: block;
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    #mobile-menu-panel a {
        display: block;
        padding: 15px 10px;
        color: #3a3c3f;
        text-shadow: none;
    }
    
    #mobile-menu-panel > menu { display: none; }
}