/* =========================================================
   HEADER
   ========================================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 8px var(--color-shadow);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: var(--space-l);
}

/* Logo */
.site-logo {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    flex-shrink: 0;
}
.site-logo img {
    height: 32px;
    width: auto;
}
.site-logo__text {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-m);
}

/* Search */
.header-search {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}
.header-search__input {
    display: none;
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    font-size: 14px;
    outline: none;
    width: 200px;
    transition: border-color var(--transition);
}
.header-search__input:focus { border-color: var(--color-text); }
.header-search.is-open .header-search__input { display: block; }

.header-search__btn,
.header-lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    color: var(--color-text);
    transition: background var(--transition);
}
.header-search__btn:hover,
.header-lang-btn:hover { background: var(--color-surface); }

/* Header Buttons */
.header-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-s);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn--outline {
    border: 1.5px solid var(--color-border);
    color: var(--color-text);
}
.btn--outline:hover {
    border-color: var(--color-text);
    background: var(--color-surface);
}
.btn--primary {
    background: var(--color-text);
    color: var(--color-bg);
}
.btn--primary:hover {
    background: #444;
}
.btn--accent {
    background: var(--color-accent);
    color: #fff;
}
.btn--accent:hover {
    background: var(--color-accent-hover);
}

/* Main Navigation */
.header-nav {
    border-top: 1px solid var(--color-border);
    overflow-x: auto;
    scrollbar-width: none;
}
.header-nav::-webkit-scrollbar { display: none; }

.header-nav__list {
    display: flex;
    align-items: center;
    height: var(--header-nav-height);
    gap: 0;
}

.header-nav__item a,
.header-nav__item button {
    display: flex;
    align-items: center;
    height: var(--header-nav-height);
    padding: 0 var(--space-m);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    transition: color var(--transition);
    position: relative;
}
.header-nav__item a::after,
.header-nav__item button::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--space-m);
    right: var(--space-m);
    height: 2px;
    background: var(--color-text);
    transform: scaleX(0);
    transition: transform var(--transition);
}
.header-nav__item a:hover,
.header-nav__item button:hover { color: var(--color-text); }
.header-nav__item a:hover::after,
.header-nav__item button:hover::after,
.header-nav__item.current-menu-item a::after { transform: scaleX(1); }

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-pill);
    color: var(--color-text);
    transition: background var(--transition);
}
.mobile-menu-toggle:hover { background: var(--color-surface); }
.mobile-menu-toggle svg { pointer-events: none; }

/* =========================================================
   LOADER BAR
   ========================================================= */
.loader-bar {
    height: 3px;
    background: var(--color-surface);
    overflow: hidden;
}
.loader-bar__progress {
    height: 100%;
    background: var(--color-accent);
    width: 0;
    transition: width 0.3s ease;
}

/* =========================================================
   BLOG FEED HEADER (Hero)
   ========================================================= */
.feed-hero {
    position: relative;
    overflow: hidden;
    background: #1a1a2e;
    min-height: 220px;
    display: flex;
    align-items: flex-end;
}

.feed-hero__bg {
    position: absolute;
    inset: 0;
    object-fit: cover;
    width: 100%;
    height: 100%;
    opacity: 0.5;
}

.feed-hero__content {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: var(--space-3xl) 0 var(--space-xl);
}

.feed-hero__title {
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 700;
    color: #fff;
    margin-bottom: var(--space-xl);
}

/* Feed Controls */
.feed-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-m);
}

.feed-search {
    position: relative;
    flex: 1 1 240px;
    max-width: 340px;
}
.feed-search__input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1.5px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 14px;
    backdrop-filter: blur(4px);
    outline: none;
    transition: border-color var(--transition), background var(--transition);
}
.feed-search__input::placeholder { color: rgba(255,255,255,0.6); }
.feed-search__input:focus {
    border-color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.2);
}
.feed-search__icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.7);
    pointer-events: none;
}

.feed-select {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 10px 16px;
    border: 1.5px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(4px);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    min-width: 140px;
    user-select: none;
}
.feed-select:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.6);
}
.feed-select select {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    cursor: pointer;
}
.feed-select svg { flex-shrink: 0; }

.btn--saved {
    display: inline-flex;
    align-items: center;
    gap: var(--space-s);
    padding: 10px 18px;
    border: 1.5px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(4px);
    transition: all var(--transition);
    white-space: nowrap;
}
.btn--saved:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.6);
}

/* =========================================================
   POSTS GRID
   ========================================================= */
.posts-section {
    padding: var(--space-3xl) 0;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
}

/* =========================================================
   POST CARD
   ========================================================= */
.post-card {
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    border-radius: var(--radius-l);
    overflow: hidden;
    box-shadow: 0 2px 12px var(--color-shadow);
    transition: box-shadow var(--transition), transform var(--transition);
    text-decoration: none;
    color: var(--color-text);
}
.post-card:hover {
    box-shadow: 0 8px 32px rgba(0,0,0,0.14);
    transform: translateY(-3px);
}

.post-card__image {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: var(--color-surface);
    display: block;
}

.post-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: var(--space-l);
    gap: var(--space-m);
}

.post-card__tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-card__title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    flex: 1;
}

.post-card__excerpt {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-m);
    border-top: 1px solid var(--color-border);
    gap: var(--space-s);
    flex-wrap: wrap;
}

.post-card__meta {
    display: flex;
    align-items: center;
    gap: var(--space-m);
}

.post-card__date,
.post-card__read-time {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 13px;
    color: var(--color-text-muted);
}

.post-card__save {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    color: var(--color-text-muted);
    transition: all var(--transition);
    border: 1px solid transparent;
}
.post-card__save:hover {
    border-color: var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}
.post-card__save.is-saved {
    color: var(--color-accent);
}

/* =========================================================
   PAGINATION
   ========================================================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-s);
    padding: var(--space-2xl) 0;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
}

.pagination a {
    border: 1.5px solid var(--color-border);
    color: var(--color-text);
}
.pagination a:hover {
    border-color: var(--color-text);
    background: var(--color-surface);
}
.pagination .current {
    background: var(--color-text);
    color: var(--color-bg);
    border: 1.5px solid var(--color-text);
}

/* =========================================================
   SIDEBAR (if used)
   ========================================================= */
.site-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3xl);
    padding: var(--space-3xl) 0;
}
.site-content.has-sidebar {
    grid-template-columns: 1fr 320px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.widget {
    background: var(--color-surface);
    border-radius: var(--radius-l);
    padding: var(--space-l);
}

.widget-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: var(--space-m);
    padding-bottom: var(--space-m);
    border-bottom: 2px solid var(--color-border);
}

/* =========================================================
   SINGLE POST
   ========================================================= */
.post-header {
    padding: var(--space-3xl) 0 var(--space-2xl);
}

.post-category {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: var(--space-m);
}

.post-title {
    font-size: clamp(28px, 4vw, 48px);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-l);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: var(--space-l);
    flex-wrap: wrap;
    color: var(--color-text-muted);
    font-size: 14px;
}

.post-author {
    display: flex;
    align-items: center;
    gap: var(--space-s);
}
.post-author__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.post-featured-image {
    width: 100%;
    border-radius: var(--radius-l);
    aspect-ratio: 16/6;
    object-fit: cover;
    margin-bottom: var(--space-3xl);
}

.post-content {
    max-width: 720px;
    margin: 0 auto;
    font-size: 17px;
    line-height: 1.75;
}

.post-content h2 { font-size: 28px; margin: var(--space-2xl) 0 var(--space-m); }
.post-content h3 { font-size: 22px; margin: var(--space-xl) 0 var(--space-m); }
.post-content p  { margin-bottom: var(--space-m); }
.post-content ul, .post-content ol { margin: var(--space-m) 0 var(--space-m) var(--space-xl); }
.post-content li { margin-bottom: var(--space-s); }
.post-content a  { color: var(--color-accent); text-decoration: underline; }
.post-content img { border-radius: var(--radius-m); margin: var(--space-xl) 0; }
.post-content blockquote {
    border-left: 4px solid var(--color-accent);
    padding-left: var(--space-l);
    margin: var(--space-xl) 0;
    color: var(--color-text-muted);
    font-style: italic;
}
.post-content code {
    background: var(--color-surface);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.post-content pre {
    background: var(--color-text);
    color: var(--color-bg);
    padding: var(--space-l);
    border-radius: var(--radius-m);
    overflow-x: auto;
    margin: var(--space-xl) 0;
}
.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
    background: var(--color-text);
    color: #fff;
    padding: var(--space-3xl) 0 var(--space-xl);
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: var(--space-xl);
    padding-bottom: var(--space-2xl);
    border-bottom: 1px solid rgba(255,255,255,0.12);
    margin-bottom: var(--space-xl);
}

.footer-brand .site-logo__text { color: #fff; }
.footer-brand .site-logo img { filter: brightness(0) invert(1); }

.footer-social {
    display: flex;
    gap: var(--space-m);
    margin: var(--space-l) 0;
}
.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    transition: all var(--transition);
}
.footer-social a:hover {
    border-color: #fff;
    background: rgba(255,255,255,0.1);
}

.footer-subscription p {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    margin-bottom: var(--space-m);
}

.footer-subscription__form {
    display: flex;
    gap: var(--space-s);
}

.footer-subscription__input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,0.07);
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition);
}
.footer-subscription__input::placeholder { color: rgba(255,255,255,0.45); }
.footer-subscription__input:focus { border-color: rgba(255,255,255,0.7); }

.footer-subscription__btn {
    padding: 10px 20px;
    border: 1.5px solid rgba(255,255,255,0.45);
    border-radius: var(--radius-pill);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}
.footer-subscription__btn:hover {
    border-color: #fff;
    background: rgba(255,255,255,0.1);
}

.footer-col-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-m);
}

.footer-col ul { display: flex; flex-direction: column; gap: var(--space-s); }
.footer-col a {
    font-size: 14px;
    color: rgba(255,255,255,0.75);
    transition: color var(--transition);
}
.footer-col a:hover { color: #fff; }

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-m);
    font-size: 13px;
    color: rgba(255,255,255,0.45);
}

.footer-bottom-links {
    display: flex;
    align-items: center;
    gap: var(--space-m);
    flex-wrap: wrap;
}
.footer-bottom-links a {
    color: rgba(255,255,255,0.45);
    transition: color var(--transition);
}
.footer-bottom-links a:hover { color: rgba(255,255,255,0.8); }

/* =========================================================
   MOBILE MENU (Slide-in)
   ========================================================= */
.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.mobile-overlay.is-open { visibility: visible; opacity: 1; }

.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: min(320px, 85vw);
    height: 100%;
    background: var(--color-bg);
    z-index: 201;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.mobile-menu.is-open { left: 0; }

.mobile-menu__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-m) var(--space-l);
    border-bottom: 1px solid var(--color-border);
}

.mobile-menu__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    font-size: 20px;
    color: var(--color-text);
    transition: background var(--transition);
}
.mobile-menu__close:hover { background: var(--color-surface); }

.mobile-menu__nav {
    flex: 1;
    padding: var(--space-m) 0;
}
.mobile-menu__nav a,
.mobile-menu__nav button {
    display: block;
    width: 100%;
    padding: 14px var(--space-l);
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text);
    text-align: left;
    transition: background var(--transition);
}
.mobile-menu__nav a:hover,
.mobile-menu__nav button:hover { background: var(--color-surface); }

.mobile-menu__buttons {
    padding: var(--space-m) var(--space-l) var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
}
.mobile-menu__buttons .btn { justify-content: center; }

/* =========================================================
   UTILITIES
   ========================================================= */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

.no-posts {
    text-align: center;
    padding: var(--space-3xl);
    color: var(--color-text-muted);
    font-size: 16px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
    .posts-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
    .site-content.has-sidebar { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}

@media (max-width: 768px) {
    :root { --container-pad: 16px; }
    .posts-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .header-buttons,
    .header-search,
    .header-lang-btn { display: none; }
    .mobile-menu-toggle { display: flex; }
    .header-nav { display: none; }
    .feed-controls { flex-direction: column; align-items: stretch; }
    .feed-search { max-width: 100%; }
    .footer-grid { grid-template-columns: 1fr; }
    .footer-subscription__form { flex-direction: column; }
}

@media (max-width: 480px) {
    .feed-hero__title { font-size: 30px; }
    .post-title { font-size: 24px; }
    .pagination { flex-wrap: wrap; }
}

/* =========================================================
   PRINT
   ========================================================= */
@media print {
    .site-header, .site-footer, .mobile-overlay, .mobile-menu { display: none; }
}
