/* ==========================================================
   BLOGZINE — site-wide responsive layer
   Loaded last from main.tpl. Desktop / tablet / mobile.
   Does not alter DLE form names, action URLs or JS handlers.
   ========================================================== */

:root {
  --bz-mobile-gutter: 16px;
  --bz-mobile-radius: 14px;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-width: 320px; overflow-x: clip; }
#main-content, main, .page-shell, .obs-container,
.container, .container-fluid, .row, [class*="col-"] { min-width: 0; }
img, svg, video, canvas, iframe { max-width: 100%; }
img, video { height: auto; }
iframe { border: 0; }
pre, code { overflow-wrap: anywhere; }
pre { max-width: 100%; overflow: auto; }
.table-responsive, .article-content table, .fullstory table,
.pm_navigation, .pm_navigation table { max-width: 100%; }
.article-content table, .fullstory table { display: block; overflow-x: auto; }
input, select, textarea, button { max-width: 100%; }
input, select, textarea { min-width: 0; }

/* Header, masthead and navigation */
.top-masthead__inner { min-width: 0; }
.brand-lockup, .top-masthead__meta { min-width: 0; }
.mobile-ad-banner { max-width: 100%; }
.mobile-ad-banner__art { pointer-events: none; }
.site-header, .site-header .container { min-width: 0; }
.obs-navbar { min-width: 0; }
.obs-navbar .navbar-collapse { min-width: 0; }
.obs-nav-list { min-width: 0; }
.obs-nav-list .nav-link { white-space: normal; }
.obs-navbar .recent-menu-dropdown { max-width: calc(100vw - 32px); }
.obs-navbar .recent-menu-dropdown > .row { min-width: 0; }
.obs-navbar .recent-menu-dropdown .recent-menu__item { min-width: 0; }

/* General page layout and content blocks */
.page-shell { width: 100%; }
.bz-home-top-news, .bz-home-content-layout,
.category-feed, .category-sidebar,
.inner-page-main, .inner-page-sidebar,
.article-layout, .article-page, .article-content,
.sidebar-card, .listing-card, .blogzine-news-card { min-width: 0; }
.bz-home-content-layout, .category-layout, .inner-page-layout { min-width: 0; }
.feature-card, .horizontal-card, .compact-card,
.listing-card, .blogzine-news-card { max-width: 100%; }
.feature-card__body, .horizontal-card__body,
.listing-card__body, .blogzine-news-card__body { min-width: 0; }
.feature-card h2, .feature-card h3,
.horizontal-card h2, .horizontal-card h3,
.compact-card h2, .compact-card h3,
.listing-card h2, .listing-card h3,
.blogzine-news-card h2, .blogzine-news-card h3 { overflow-wrap: anywhere; }

/* Article media and long content */
.article-cover img, .article-content img,
.article-content video, .article-content iframe,
.fullstory img, .fullstory video, .fullstory iframe {
  max-width: 100%;
}
.article-content iframe, .fullstory iframe { width: 100%; }
.article-content figure, .fullstory figure { max-width: 100%; }
.article-content pre, .fullstory pre { white-space: pre; }
.article-content blockquote, .fullstory blockquote { overflow-wrap: anywhere; }
.article-content table, .fullstory table { width: 100%; }
.article-page, .article-header, .article-body-grid { min-width: 0; }

/* Forms and user/account pages */
.form-control, .form-input, .addnews-control,
.bz-auth-input input, .bz-comment-form input,
.bz-comment-form textarea, .bz-comment-form select {
  max-width: 100%; min-width: 0;
}
.form-grid, .form-body, .form-row, .form-actions,
.addnews-page, .addnews-panel, .bz-auth-card,
.bz-profile-card, .bz-submit-card, .bz-feedback-card { min-width: 0; }
.form-actions, .pm-actions, .bz-submit-actions { flex-wrap: wrap; }
.bz-auth-card img, .bz-system-field img,
.c-captcha img, .sec-code img { max-width: 100%; height: auto; }

/* Comments, DLE widgets, pagination and sidebars */
.comment, .comments-tree-item, .comment-item,
.bz-comment-form, .comment-form, .sidebar-card,
.sidebar-column, .article-sidebar { min-width: 0; }
.comment-text, .comment-content, .comment-message,
.bz-comment-form, .sidebar-card { overflow-wrap: anywhere; }
.pagination, .navigation, .pm_navigation { max-width: 100%; }
.pagination, .navigation { flex-wrap: wrap; }

/* Footer */
.site-footer, .footer-main, .footer-bottom,
.footer-column-brand, .footer-column-navigation,
.footer-column-posts { min-width: 0; }
.footer-description { max-width: 100%; }
.footer-counters { flex-wrap: wrap; }

/* Large tablets and compact laptops */
@media (max-width: 1199.98px) {
  .obs-container { max-width: 100%; }
  .obs-navbar { padding-inline: 16px; }
  .obs-nav-list { gap: 1px; }
  .obs-nav-list .nav-link { padding-inline: 8px !important; font-size: 12px; }
  .header-search { width: 160px; }
  .article-body-grid { grid-template-columns: 42px minmax(0, 1fr); gap: 18px; }
}

/* Tablets: 768–991 px */
@media (max-width: 991.98px) {
  :root { --bz-mobile-gutter: 20px; }
  .top-masthead { min-height: 124px; }
  .top-masthead__inner { min-height: 124px; gap: 16px; }
  .top-masthead__meta { font-size: 11px; text-align: right; }
  .site-header { margin-top: -18px; }
  .obs-navbar { border-radius: 13px; padding: 9px 14px; }
  .obs-navbar .navbar-toggler { display: inline-flex; align-items: center; justify-content: center; }
  .obs-navbar .navbar-collapse { padding-top: 12px; }
  .obs-nav-list { align-items: stretch; gap: 0; }
  .obs-nav-list .nav-item { width: 100%; }
  .obs-nav-list .nav-link { padding: 10px 12px !important; border-radius: 8px; }
  .obs-navbar .dropdown-fullwidth { position: relative; }
  .obs-navbar .dropdown-fullwidth > .recent-menu-dropdown {
    position: static !important; inset: auto !important; transform: none !important;
    width: 100% !important; min-width: 0 !important; max-width: 100% !important;
    margin: 4px 0 10px !important; padding: 12px !important;
  }
  .obs-navbar .recent-menu-dropdown > .row { flex-wrap: wrap !important; }
  .obs-navbar .recent-menu-dropdown .recent-menu__item {
    flex: 0 0 50% !important; width: 50% !important; max-width: 50% !important;
  }
  .nav-tools { justify-content: flex-start; padding: 10px 8px 4px; }
  .header-search { width: min(320px, 60vw); }
  .page-shell { padding-top: 18px; padding-bottom: 38px; }
  .hero-carousel, .hero-carousel .carousel-inner,
  .hero-carousel .carousel-item, .hero-slide { height: 340px; }
  .hero-slide__content { max-width: 62%; }
  .content-section:has(.feature-card) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-section:has(.compact-card) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bz-home-content-layout .row, .category-layout, .inner-page-layout { min-width: 0; }
  .category-sidebar, .inner-page-sidebar { margin-top: 24px; }
  .sidebar-card { padding: 17px; }
  .site-footer { padding-top: 34px; }
  .footer-main { row-gap: 26px; }
}

/* Phones and small tablets */
@media (max-width: 767.98px) {
  :root { --bz-mobile-gutter: 16px; }
  body { font-size: 14px; }
  .container, .container-fluid, .obs-container { padding-left: var(--bz-mobile-gutter); padding-right: var(--bz-mobile-gutter); }
  .top-masthead { min-height: 104px; }
  .top-masthead__inner { min-height: 104px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 5px; padding-top: 12px; padding-bottom: 12px; }
  .brand-lockup__logo { max-width: min(230px, 72vw); height: auto; }
  .brand-lockup__tagline { font-size: 10px; letter-spacing: .06em; }
  .top-masthead__meta { display: none; }
  .site-header { margin-top: -12px; }
  .mobile-toolbar { display: flex; align-items: center; gap: 7px; min-height: 48px; }
  .mobile-toolbar__spacer { flex: 1 1 auto; }
  .mobile-toolbar__menu-label { min-height: 40px; }
  .mobile-tool { flex: 0 0 40px; width: 40px; height: 40px; display: inline-grid; place-items: center; }
  .mobile-search { width: 100%; margin: 8px 0 10px; }
  .mobile-search input { min-width: 0; width: 100%; }
  .obs-navbar { min-height: 0; padding: 6px 10px; }
  .obs-navbar > .navbar-toggler { min-height: 42px; }
  .obs-navbar .navbar-collapse { max-height: min(72vh, 560px); overflow-y: auto; overscroll-behavior: contain; }
  .obs-navbar .recent-menu-dropdown .recent-menu__item { flex-basis: 100% !important; width: 100% !important; max-width: 100% !important; }
  .mobile-menu-panel { width: min(88vw, 390px); max-width: 100%; }
  .mobile-menu-body { overflow-y: auto; overscroll-behavior: contain; }
  .mobile-menu-link, .mobile-menu-heading { min-height: 46px; }
  .mobile-ad-wrap { padding-top: 8px; padding-bottom: 8px; }
  .mobile-ad-banner { min-height: 118px; padding: 16px; border-radius: 13px; }
  .mobile-ad-banner__art { opacity: .55; transform: scale(.78); transform-origin: right center; }
  .page-shell { padding-top: 14px; padding-bottom: 30px; }
  .hero-carousel, .hero-carousel .carousel-inner,
  .hero-carousel .carousel-item, .hero-slide { height: clamp(280px, 68vw, 360px); }
  .hero-slide__content { left: 6%; right: 6%; max-width: 88%; }
  .hero-slide__shade { background: linear-gradient(90deg, rgba(20,19,17,.88), rgba(20,19,17,.42)), linear-gradient(0deg,rgba(0,0,0,.35),transparent 55%); }
  .hero-slide h1 { font-size: clamp(1.55rem, 6vw, 2.15rem); }
  .hero-slide p { font-size: 13px; }
  .hero-carousel .carousel-control-prev, .hero-carousel .carousel-control-next { width: 34px; height: 34px; margin: 0 6px; }
  .content-section:has(.feature-card), .content-section:has(.compact-card) { grid-template-columns: minmax(0, 1fr); }
  .feature-card__image { height: auto; aspect-ratio: 16 / 9; }
  .compact-card__image { height: auto; aspect-ratio: 16 / 9; }
  .horizontal-card { gap: 12px; padding: 10px; }
  .horizontal-card__image { width: 38%; flex-basis: 38%; height: auto; min-height: 112px; align-self: stretch; }
  .horizontal-card h3 { font-size: 15px; }
  .horizontal-card p { display: none; }
  .section-heading { align-items: flex-start; gap: 10px; }
  .section-heading h2 { font-size: 20px; }
  .section-heading > a { white-space: normal; text-align: right; }
  .article-page { padding: 16px 0; }
  .article-header h1 { font-size: clamp(1.7rem, 7vw, 2.35rem); }
  .article-body-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .article-share-rail { position: static; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; }
  .article-share-rail__label { writing-mode: horizontal-tb; transform: none; }
  .article-content { font-size: 15px; line-height: 1.75; }
  .article-content img, .article-cover img { border-radius: 10px; }
  .article-author-box { align-items: flex-start; padding: 14px; }
  .article-related .tns-controls { top: -44px; }
  .article-sidebar { grid-template-columns: minmax(0, 1fr); }
  .category-feed, .inner-page-main { width: 100%; }
  .category-sidebar, .inner-page-sidebar { margin-top: 22px; }
  .sidebar-card { margin-bottom: 14px; }
  .site-footer { padding-top: 28px; }
  .footer-main { row-gap: 22px; }
  .footer-column-brand, .footer-column-navigation, .footer-column-posts { width: 100%; }
  .footer-description, .footer-main p { max-width: none; }
  .footer-bottom { justify-content: center; text-align: center; gap: 12px; padding: 15px 0; }
  .footer-bottom__credits { width: 100%; align-items: center; }
  .footer-counters { width: 100%; justify-content: center; margin: 0; }
  .cookie-notice, #gdpr-cookie-message { width: calc(100vw - 24px); max-width: 420px; margin: 12px !important; }
}

/* Narrow phones */
@media (max-width: 575.98px) {
  .mobile-ad-banner__eyebrow { font-size: 9px; }
  .mobile-ad-banner strong { font-size: 20px; }
  .mobile-ad-banner small { max-width: 68%; font-size: 11px; }
  .mobile-ad-banner__cta { font-size: 11px; }
  .hero-meta { gap: 8px 12px; font-size: 10px; }
  .post-meta { gap: 7px 10px; }
  .horizontal-card { align-items: flex-start; }
  .horizontal-card__image { flex-basis: 35%; width: 35%; min-height: 92px; }
  .horizontal-card h3 { font-size: 13px; }
  .horizontal-card .post-meta { font-size: 9px; }
  .section-heading { padding-left: 9px; border-left-width: 3px; }
  .section-heading h2 { font-size: 18px; }
  .article-byline { gap: 8px; }
  .article-byline > span, .article-byline > a { white-space: normal; }
  .article-bottom-meta { align-items: flex-start; flex-direction: column; }
  .article-tools { gap: 10px; }
  .article-content h2 { font-size: 1.4rem; }
  .article-content h3 { font-size: 1.2rem; }
  .article-content blockquote { padding: 14px 16px; margin-inline: 0; }
  .sidebar-card { padding: 15px; border-radius: 13px; }
  .pagination, .navigation { gap: 5px; }
  .pagination a, .pagination span, .navigation a, .navigation span { min-width: 34px; min-height: 34px; }
}

@media (max-width: 380px) {
  :root { --bz-mobile-gutter: 12px; }
  .container, .container-fluid, .obs-container { padding-left: 12px; padding-right: 12px; }
  .mobile-toolbar { gap: 4px; }
  .mobile-tool { flex-basis: 36px; width: 36px; height: 36px; }
  .mobile-toolbar__menu-label { padding-inline: 9px; }
  .hero-slide__content { left: 5%; right: 5%; max-width: 90%; }
  .hero-slide h1 { font-size: 1.45rem; }
  .horizontal-card { gap: 9px; }
  .horizontal-card__image { flex-basis: 32%; width: 32%; min-height: 82px; }
  .horizontal-card h3 { font-size: 12px; }
}

/* Respect reduced motion and touch targets */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (hover: none) and (pointer: coarse) {
  .nav-link, .dropdown-item, .mobile-menu-link,
  .mobile-menu-heading, .btn, button, .pagination a { touch-action: manipulation; }
  .mobile-tool, .mobile-menu-link, .mobile-menu-heading { min-height: 44px; }
}
