/* 
   Zakazgid Design System - Strict implementation of design_code.json
   Tokens and components according to specification.
*/

:root {
    /* Colors */
    --color-primary: #5562B1;
    --color-secondary: #4F456C;
    --color-accent: #73AE00;
    --color-error: #F76144;

    /* Neutral */
    --color-white: #FFFFFF;
    --color-light-gray: #F0F0F0;
    --color-gray: #E3E3E3;
    --color-medium-gray: #B9B8BB;
    --color-dark-gray: #99989E;

    /* Text Colors */
    --text-primary: #4F456C;
    --text-secondary: #34313E;
    --text-light: #828491;
    --border-color: #E3E3E3;

    /* Gradients */
    --gradient-header: linear-gradient(to right, #F1503F, #FF754B);
    --gradient-sidebar-btn: linear-gradient(#FF754B, #F2513F);
    --gradient-sidebar-btn-hover: linear-gradient(#FF6334, #F13F2B);

    /* Typography */
    --font-primary: 'Ubuntu', sans-serif;
    --font-secondary: 'Fira Sans', sans-serif;
    --font-tertiary: 'PT Sans', sans-serif;

    --font-size-base: 14px;
    --font-size-small: 14px;
    --font-size-medium: 16px;
    --font-size-large: 18px;
    --font-size-xl: 30px;
    --font-size-xxl: 38px;

    --line-height-base: 1.214;
    --line-height-tight: 1.1;

    /* Layout */
    --container-width: 1280px;
    --sidebar-width: 350px;

    /* Effects */
    --transition-speed: 0.1s;
    --radius-small: 3px;
    --radius-medium: 20px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--color-white);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    -webkit-font-smoothing: antialiased;
}

body,
html {
    overflow-x: hidden;
    width: 100%;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

a {
    transition: color var(--transition-speed);
    text-decoration: none;
    color: var(--color-primary);
}

a:hover {
    color: var(--color-primary);
    opacity: 0.7;
}

/* Header Component */
.header {
    background: url('/images/bg.jpg') center/cover no-repeat;
    color: var(--color-white);
    padding: 20px 0;
    position: relative;
    z-index: 100;
}

.header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(79, 69, 108, 0.6);
    /* Using secondary color as overlay */
    z-index: -1;
}

.header__nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header__logo-img {
    height: 50px;
    display: block;
}

.header__nav-menu {
    display: flex;
    gap: 25px;
    list-style: none;
}

.header__nav-link {
    color: var(--color-white);
    font-family: var(--font-secondary);
    font-weight: bold;
    font-size: var(--font-size-medium);
}

.header__burger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 24px;
    position: relative;
    padding: 0;
}

.header__burger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--color-white);
    margin: 6px 0;
    transition: all 0.3s;
}

/* Search Form Component */
.search-form {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    background: var(--color-light-gray);
    padding: 20px;
    border-radius: var(--radius-medium);
}

.search-form__field {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-small);
    font-family: var(--font-tertiary);
    outline: none;
}

.search-form__button {
    background: var(--color-accent);
    color: var(--color-white);
    border: none;
    padding: 0 30px;
    border-radius: var(--radius-small);
    font-weight: bold;
    cursor: pointer;
    transition: background var(--transition-speed);
}

.search-form__button:hover {
    background: #689D00;
}

/* Layout Grid - Magazine Style */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: 40px;
    margin-top: 50px;
    /* More space from header */
    margin-bottom: 80px;
}

/* Post Block Component */
.post {
    /* No internal padding here if it's used as a wrapper for sections */
    margin-bottom: 30px;
}

.post>.post__entry:first-child {
    padding-top: 0;
}

.post__headline {
    font-size: var(--font-size-xxl);
    color: var(--text-primary);
    margin-bottom: 24px;
    /* More space after headline */
    font-family: var(--font-primary);
    line-height: var(--line-height-tight);
}

.post__entry {
    color: var(--text-secondary);
    font-family: var(--font-tertiary);
    padding: 0 0 30px;
    /* Bottom spacing for entries */
}

.post__entry p {
    margin-bottom: 22px;
}

/* Item Component */
.item {
    padding: 19px 19px 17px;
    background: var(--color-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-medium);
    transition: border-color var(--transition-speed);
    display: block;
    color: inherit;
    margin-bottom: 20px;
}

.item:hover {
    border-color: var(--color-primary);
    opacity: 1;
}

.item__image {
    width: 100%;
    height: 160px;
    background: var(--color-light-gray);
    border-radius: var(--radius-small);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    overflow: hidden;
}

.item__image img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.item__title {
    font-size: var(--font-size-large);
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.item__comments {
    font-size: var(--font-size-small);
    color: var(--text-light);
}

/* Brand Logo Component */
.brand-logo {
    width: 100%;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-small);
    background-color: var(--color-white);
    padding: 15px;
    overflow: hidden;
    margin-bottom: 15px;
    transition: all var(--transition-speed);
}

.brand-logo--large {
    width: 140px;
    height: 140px;
    border-radius: 24px;
    padding: 24px;
    margin: 0 auto 32px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.brand-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Small Item Component */
.small-item {
    background: var(--color-light-gray);
    border-radius: var(--radius-small);
    padding: 15px;
    text-align: center;
}

.small-item__image {
    font-size: var(--font-size-xl);
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 5px;
}

.stat-number {
    font-size: var(--font-size-xxl);
    font-weight: bold;
    color: var(--color-primary);
}

.small-item__text {
    font-size: var(--font-size-small);
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: bold;
}

/* Sidebar Component */
.sidebar>div {
    margin-bottom: 45px;
    /* Consistent spacing between sidebar blocks */
}

.sidebar__nav-title {
    font-size: var(--font-size-large);
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 10px;
}

.sidebar__button {
    display: block;
    width: 100%;
    background: var(--gradient-sidebar-btn);
    color: var(--color-white);
    padding: 15px;
    border-radius: var(--radius-small);
    text-align: center;
    font-weight: bold;
    margin-bottom: 10px;
    transition: background var(--transition-speed);
    border: none;
    cursor: pointer;
}

.sidebar__button:hover {
    background: var(--gradient-sidebar-btn-hover);
    color: var(--color-white);
    opacity: 1;
    transform: translateY(-1px);
}

.alphabet-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--gradient-sidebar-btn);
    color: var(--color-white);
    border-radius: var(--radius-small);
    font-weight: bold;
    font-size: var(--font-size-medium);
    transition: all var(--transition-speed);
}

.alphabet-link:hover {
    background: var(--gradient-sidebar-btn-hover);
    color: var(--color-white);
    transform: scale(1.1);
}

.pill-link {
    display: inline-block;
    padding: 8px 16px;
    background: var(--color-white);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: bold;
    transition: all var(--transition-speed);
}

.pill-link:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-light-gray);
}

/* Poll Component */
.poll {
    background: #F9F9F9;
    border: 1px solid var(--border-color);
    padding: 25px;
    border-radius: var(--radius-medium);
    margin: 30px 0;
}

.poll__question {
    font-size: var(--font-size-medium);
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: block;
    cursor: pointer;
}

.poll__options {
    margin-bottom: 20px;
}

.poll__options label {
    display: block;
    margin-bottom: 10px;
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    cursor: pointer;
}

.poll__options input {
    margin-right: 8px;
}

/* Recent Comment Component */
.recent-comment {
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
}

.recent-comment__title {
    color: var(--color-primary);
    font-weight: bold;
    margin-bottom: 5px;
    font-size: var(--font-size-small);
}

.recent-comment__text {
    font-size: var(--font-size-small);
    color: var(--text-light);
    font-style: italic;
}

/* Commented Component */
.commented {
    background-color: var(--color-light-gray);
    padding: 40px 30px;
    margin: 30px 0;
    border-radius: var(--radius-medium);
}

.commented--bottom {
    border-bottom: 5px solid var(--color-primary);
}

/* Grids */
.items-grid-magazine {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.brand-items-grid--limited .item:nth-child(n+9) {
    display: none;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

@media (max-width: 750px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Footer Component */
.footer {
    background: url('/images/bg.jpg') center/cover no-repeat;
    padding: 28px 0;
    border-top: 1px solid var(--border-color);
    color: var(--color-white);
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(79, 69, 108, 0.8);
    /* Darker overlay for footer */
    z-index: 1;
}

.footer .container {
    position: relative;
    z-index: 2;
}

.footer__nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer__copyright {
    font-size: var(--font-size-small);
    color: var(--color-white);
}

.footer__links {
    display: flex;
    gap: 20px;
}

.footer__link {
    color: rgba(255, 255, 255, 0.8);
    font-size: var(--font-size-small);
}

.footer__link:hover {
    color: var(--color-white);
}

.item-link {
    color: var(--color-primary);
    font-weight: bold;
    text-decoration: none;
    font-size: var(--font-size-small);
}

/* Breadcrumbs Component */
.breadcrumbs {
    margin: 20px auto;
    font-size: var(--font-size-small);
    color: var(--text-light);
}

.breadcrumbs__link {
    color: var(--color-primary);
}

.breadcrumbs__separator {
    margin: 0 8px;
    color: var(--color-medium-gray);
}

.breadcrumbs__current {
    color: var(--text-light);
}

/* Utilities */
.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.text-center {
    text-align: center;
}

.mt-40 {
    margin-top: 40px;
}

.mb-40 {
    margin-bottom: 40px;
}

.mt-48 {
    margin-top: 48px;
}

.gap-30 {
    gap: 30px;
}

.gap-8 {
    gap: 8px;
}

.flex {
    display: flex;
}

.flex-wrap {
    display: flex;
    flex-wrap: wrap;
}

.flex-center {
    justify-content: center;
    align-items: center;
}

/* Responsive Behvaiors */
@media (max-width: 999px) {
    .header__nav-menu {
        display: none;
    }

    .layout-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .header {
        height: auto;
    }

    .header__burger-btn {
        display: block;
    }

    .header__logo-img {
        height: 35px;
    }
}

@media (max-width: 750px) {
    .items-grid-magazine {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .brand-logo--large {
        width: 100px;
        height: 100px;
        padding: 15px;
    }
}

@media (max-width: 479px) {
    .search-form {
        flex-direction: column;
    }

    .search-form__button {
        padding: 12px;
    }

    .items-grid-magazine {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .post__headline {
        font-size: var(--font-size-xl);
    }

    .commented {
        padding: 30px 15px;
    }

    .brand-logo .item__title {
        font-size: 1.5rem !important;
    }
}

/* Mobile Menu Overlay */
.mobile-menu {
    position: fixed;
    inset: 0;
    background: var(--color-secondary);
    z-index: 2000;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu--active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu__content {
    width: 100%;
}

.mobile-menu__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--color-white);
    font-size: 40px;
    cursor: pointer;
    line-height: 1;
}

.mobile-menu__nav {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.mobile-menu__link {
    font-size: 24px;
    font-weight: bold;
    color: var(--color-white);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mobile-menu__link:hover {
    color: var(--color-accent);
}