/* ================================================================
   Qalem News Pro v5 - Complete CSS
================================================================ */

/* ── VARIABLES ── */
:root {
  --primary:   #e63946;
  --primary-d: #c1121f;
  --navy:      #1d3557;
  --amber:     #f4a261;
  --bg:        #f4f6fb;
  --card:      #ffffff;
  --text:      #1a1a2e;
  --text-2:    #374151;
  --muted:     #64748b;
  --border:    #e2e8f0;
  --topbar:    #0f172a;

  --font-main: 'Cairo', system-ui, sans-serif;
  --font-size: 16px;

  --fs-h1: 2rem;
  --fs-h2: 1.5rem;
  --fs-h3: 1.25rem;
  --fs-body: 1rem;
  --fs-small: .875rem;
  --fs-xs: .75rem;

  --fw-normal: 400;
  --fw-medium: 600;
  --fw-bold:   700;
  --fw-black:  900;

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow:    0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 36px rgba(0,0,0,.13);

  --trans: .2s ease;

  --wrap:    1260px;
  --sidebar: 290px;
  --hh:      64px;

  --widget-style: 1;
}

/* Dark mode */
[data-theme=dark] {
  --bg:     #0f172a;
  --card:   #1e293b;
  --text:   #e2e8f0;
  --text-2: #cbd5e1;
  --muted:  #94a3b8;
  --border: #334155;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: var(--font-size);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden; /* hide scroll on html */
}
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  direction: rtl;
  overflow-x: hidden;
  /* Do NOT set max-width on body - breaks AdSense width calculation */
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; transition: color var(--trans); }
/* ── UNIVERSAL OVERFLOW CONTAINMENT ──
   This is the single most important rule for mobile.
   Every direct child of body is clamped to viewport width.
── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Prevent any element from creating horizontal scroll */
  min-width: 0;
}

/* All block-level elements respect their container */
div, section, article, aside, nav, header, footer, main,
figure, figcaption, form, fieldset, details, summary {
  max-width: 100%;
}

/* Media: never wider than container, EVER */
img, svg, video, canvas, audio {
  max-width: 100%;
  height: auto;
  display: block;
}
iframe, embed, object {
  max-width: 100%;
}
/* AdSense specific - these set their own inline width */
ins.adsbygoogle {
  max-width: 100% !important;
  width: 100% !important;
}
ul, ol { list-style: none; }
button { cursor: pointer; background: none; border: none; font: inherit; padding: 0; }
input, textarea, select { font: inherit; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-main); line-height: 1.3; color: var(--text); }
h1 { font-size: var(--fs-h1); font-weight: var(--fw-black); }
h2 { font-size: var(--fs-h2); font-weight: var(--fw-bold); }
h3 { font-size: var(--fs-h3); font-weight: var(--fw-bold); }

/* ── LAYOUT ── */
.qn-wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
  /* Prevent wrap from exceeding viewport */
  box-sizing: border-box;
  max-width: min(var(--wrap), 100%);
}
.qn-site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: clip; /* clip is stronger than hidden - doesn't create scroll context */
  max-width: 100vw;
  width: 100%;
  position: relative;
}
#qn-main { flex: 1; }

/* Page grid */
.qn-page-grid {
  display: grid;
  grid-template-columns: 1fr var(--sidebar);
  gap: 24px;
  padding: 24px 0;
  align-items: start;
}
.qn-page-grid.no-sidebar { grid-template-columns: 1fr; }
.qn-page-grid.sidebar-left { direction: ltr; }
.qn-page-grid.sidebar-left > * { direction: rtl; }
.qn-main-col { min-width: 0; }
.qn-side-col  { min-width: 0; }

/* ── POST GRID SYSTEMS ── */
.qn-grid { display: grid; gap: 20px; width: 100%; }
.qn-grid.g1  { grid-template-columns: 1fr; }
.qn-grid.g2  { grid-template-columns: repeat(2, 1fr); }
.qn-grid.g3  { grid-template-columns: repeat(3, 1fr); }
.qn-grid.g4  { grid-template-columns: repeat(4, 1fr); }

/* Masonry-style */
.qn-grid.masonry { columns: 3; gap: 20px; display: block; }
.qn-grid.masonry .qn-card { break-inside: avoid; margin-bottom: 20px; }

/* Magazine style - big + small */
.qn-grid.magazine { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
.qn-grid.magazine .qn-card:first-child { grid-row: span 2; }

/* Featured style */
.qn-grid.featured { grid-template-columns: 2fr 1fr; }
.qn-grid.featured .qn-card:first-child { grid-row: span 2; }

/* ── TOPBAR ── */
.qn-topbar { background: var(--topbar); height: 36px; font-size: var(--fs-xs); width: 100%; max-width: 100vw; overflow: hidden; }
.qn-topbar .qn-wrap { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 12px; }
.qn-topbar-date { display: flex; align-items: center; gap: 5px; color: rgba(255,255,255,.45); font-size: var(--fs-xs); }
.qn-topbar-menu ul { display: flex; gap: 16px; }
.qn-topbar-menu a { color: rgba(255,255,255,.5); font-size: 12px; transition: color var(--trans); }
.qn-topbar-menu a:hover { color: #fff; }
.qn-social { display: flex; gap: 4px; }
.qn-social a {
  width: 26px; height: 26px; border-radius: 4px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.45); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans);
}
.qn-social a:hover { background: var(--primary); color: #fff; }

/* ── BREAKING NEWS STYLES ── */
.qn-breaking { overflow: hidden; width: 100%; max-width: 100vw; }

/* Style 1: Default ticker */
.qn-breaking.style-1 { background: var(--card); border-bottom: 1px solid var(--border); height: 36px; }
.qn-breaking.style-1 .qn-wrap { display: flex; align-items: stretch; height: 100%; }
.qn-break-tag { background: var(--primary); color: #fff; padding: 0 14px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; display: flex; align-items: center; gap: 5px; flex-shrink: 0; white-space: nowrap; }
.qn-ticker-box { flex: 1; overflow: hidden; display: flex; align-items: center; position: relative; }
.qn-ticker { display: flex; white-space: nowrap; will-change: transform; flex-shrink: 0; }
@keyframes qnTickerRTL { 0%{transform:translateX(0)} 100%{transform:translateX(100%)} }
.qn-tick-a { display: inline-flex; align-items: center; gap: 10px; padding: 0 18px; font-size: 13.5px; color: var(--text); transition: color var(--trans); }
.qn-tick-a:hover { color: var(--primary); }
.qn-tick-dot { color: var(--primary); font-size: 7px; }

/* Style 2: Scrolling banner */
.qn-breaking.style-2 { background: var(--primary); height: 40px; }
.qn-breaking.style-2 .qn-wrap { display: flex; align-items: center; height: 100%; }
.qn-breaking.style-2 .qn-break-tag { background: rgba(0,0,0,.2); }
.qn-breaking.style-2 .qn-tick-a { color: #fff; }

/* Style 3: Highlighted boxes */
.qn-breaking.style-3 { background: var(--card); border-bottom: 3px solid var(--primary); padding: 8px 0; }
.qn-breaking.style-3 .qn-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qn-breaking.style-3 .qn-break-tag { border-radius: var(--r-sm); }
.qn-breaking.style-3 .qn-tick-a { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 4px 12px; font-size: 13px; display: inline-flex; animation: none; }
.qn-breaking.style-3 .qn-ticker { gap: 8px; animation: none; flex-wrap: wrap; }
.qn-breaking.style-3 .qn-tick-dot { display: none; }

/* Style 4: Full-width alert */
.qn-breaking.style-4 { background: #fef3cd; border-bottom: 2px solid #f59e0b; padding: 8px 0; }
.qn-breaking.style-4 .qn-wrap { display: flex; align-items: center; gap: 12px; }
.qn-breaking.style-4 .qn-break-tag { background: #f59e0b; color: #1a1a2e; border-radius: var(--r-sm); }
.qn-breaking.style-4 .qn-tick-a { color: #1a1a2e; }
[data-theme=dark] .qn-breaking.style-4 { background: #1a1500; border-color: #f59e0b; }
[data-theme=dark] .qn-breaking.style-4 .qn-tick-a { color: #fef3cd; }

/* ── HEADER ── */
.qn-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--trans), transform var(--trans);
  /* Must span full viewport, never wider */
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}
.qn-header.scrolled { box-shadow: var(--shadow); }
.qn-header.hidden { transform: translateY(-100%); }

.qn-header-inner { display: flex; align-items: center; height: var(--hh); gap: 14px; }

/* Logo */
.qn-logo { flex-shrink: 0; }
.qn-logo a { display: flex; align-items: center; gap: 8px; color: var(--text); }
.qn-logo img { max-height: 44px; width: auto; }
.qn-logo-name { display: block; font-size: 22px; font-weight: var(--fw-black); color: var(--text); line-height: 1.1; }
.qn-logo-name span { color: var(--primary); }
.qn-logo-desc { display: block; font-size: 11px; color: var(--muted); font-weight: var(--fw-normal); }
.qn-header-ad { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; }
.qn-header-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.qn-hbtn {
  width: 38px; height: 38px; border: 1.5px solid var(--border);
  border-radius: var(--r-sm); color: var(--text); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans);
}
.qn-hbtn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.qn-hbtn-menu { display: none; flex-direction: column; justify-content: center; gap: 5px; padding: 9px; }
.qn-bar { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: all var(--trans); }
.icon-sun { display: none; }
[data-theme=dark] .icon-moon { display: none; }
[data-theme=dark] .icon-sun  { display: block; }

/* ── MAIN NAV ── */
.qn-nav-bar { background: var(--navy); width: 100%; max-width: 100vw; overflow: hidden; }
.qn-nav-bar .qn-wrap { display: flex; }
.qn-nav { display: flex; list-style: none; align-items: stretch; }
.qn-nav > li { position: relative; }
.qn-nav > li > a {
  display: flex; align-items: center; gap: 4px;
  padding: 0 15px; height: 44px;
  color: rgba(255,255,255,.78); font-size: 13px; font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
  transition: all var(--trans);
}
.qn-nav > li > a:hover,
.qn-nav > li.current-menu-item > a,
.qn-nav > li.current-menu-ancestor > a { color: #fff; background: rgba(255,255,255,.1); }
.qn-nav-arrow { font-size: 9px; opacity: .5; transition: transform var(--trans); }
.qn-nav > li:hover .qn-nav-arrow { transform: rotate(180deg); }
.qn-dropdown {
  position: absolute; top: 100%; right: 0; min-width: 200px;
  background: var(--card); border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: all var(--trans); z-index: 200; overflow: hidden;
}
.qn-nav > li:hover .qn-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.qn-dropdown li a { display: block; padding: 10px 16px; font-size: 13.5px; color: var(--text); border-bottom: 1px solid var(--border); transition: all var(--trans); }
.qn-dropdown li:last-child a { border-bottom: none; }
.qn-dropdown li a:hover { background: var(--bg); color: var(--primary); }

/* ── MOBILE NAV ── */
.qn-mob-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); z-index: 300; opacity: 0; visibility: hidden; transition: all var(--trans); }
.qn-mob-overlay.on { opacity: 1; visibility: visible; }
.qn-mob-nav {
  position: fixed;
  top: 0;
  bottom: 0;
  /* Position FAR off the right edge - works in all RTL browsers */
  right: -100%;
  width: min(280px, 85vw);
  background: var(--navy);
  z-index: 9999;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  transition: right .3s cubic-bezier(.4,0,.2,1), visibility 0s .3s;
}
/* Slide in from right */
.qn-mob-nav.on {
  right: 0;
  visibility: visible;
  transition: right .3s cubic-bezier(.4,0,.2,1), visibility 0s 0s;
}
body.qn-nav-open { overflow: hidden; }
.qn-mob-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: rgba(0,0,0,.2); flex-shrink: 0; }
.qn-mob-logo { color: #fff; font-size: 18px; font-weight: var(--fw-black); }
.qn-mob-close { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); font-size: 16px; display: flex; align-items: center; justify-content: center; transition: background var(--trans); }
.qn-mob-close:hover { background: var(--primary); color: #fff; }
.qn-mob-menu { flex: 1; padding: 8px 0; list-style: none; }
.qn-mob-menu li { border-bottom: 1px solid rgba(255,255,255,.07); }
.qn-mob-menu a { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; color: rgba(255,255,255,.82); font-size: 15px; font-weight: var(--fw-medium); transition: all var(--trans); }
.qn-mob-menu a:hover { color: #fff; background: rgba(255,255,255,.07); }
.qn-mob-sub { display: none; background: rgba(0,0,0,.2); list-style: none; }
.qn-mob-sub li { border-bottom: 1px solid rgba(255,255,255,.05); }
.qn-mob-sub a { padding-right: 28px; font-size: 14px; color: rgba(255,255,255,.6); }
.qn-mob-toggle { color: rgba(255,255,255,.4); font-size: 12px; padding: 4px; flex-shrink: 0; }
.qn-mob-menu li.sub-open > .qn-mob-sub { display: block; }
.qn-mob-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); flex-shrink: 0; }

/* ── SEARCH OVERLAY ── */
.qn-search-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.95); z-index: 500; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; opacity: 0; visibility: hidden; transition: all var(--trans); }
.qn-search-overlay.on { opacity: 1; visibility: visible; }
.qn-search-box { width: 100%; max-width: 660px; padding: 0 16px; position: relative; }
.qn-search-close { position: absolute; top: -52px; left: 16px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); font-size: 18px; display: flex; align-items: center; justify-content: center; transition: all var(--trans); }
.qn-search-close:hover { background: var(--primary); color: #fff; }
.qn-search-form { display: flex; align-items: center; border-bottom: 2px solid rgba(255,255,255,.2); }
.qn-search-form:focus-within { border-color: var(--primary); }
.qn-search-input { flex: 1; background: none; border: none; outline: none; color: #fff; font-size: 22px; font-family: var(--font-main); padding: 12px 0; caret-color: var(--primary); }
.qn-search-input::placeholder { color: rgba(255,255,255,.25); }
.qn-search-go { color: var(--primary); font-size: 20px; padding: 8px; }
.qn-search-results { margin-top: 10px; max-height: 340px; overflow-y: auto; border-radius: 8px; }
.qn-s-item { display: flex; align-items: center; gap: 12px; padding: 10px; color: rgba(255,255,255,.85); border-radius: 8px; transition: background var(--trans); }
.qn-s-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.qn-s-item img { width: 56px; height: 42px; object-fit: cover; border-radius: 5px; flex-shrink: 0; }
.qn-s-title { font-size: 14px; font-weight: var(--fw-medium); }
.qn-s-cat { font-size: 11px; color: var(--primary); }

/* ── AD ZONES ── */
.qn-ad-zone {
  display: block;           /* block not flex — flex can prevent AdSense rendering */
  text-align: center;
  min-height: 50px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;        /* visible so AdSense can render correctly */
}
.qn-ad-zone.bordered { background: var(--bg); border: 1px dashed var(--border); border-radius: var(--r); }
.qn-ad-full  { width: 100%; }
/* min() clamps to 100% on narrow screens — prevents overflow */
.qn-ad-728   { max-width: min(728px, 100%); width: 100%; margin: 0 auto; }
.qn-ad-300   { max-width: min(300px, 100%); width: 100%; }
/* Contain ad iframe/script children */
.qn-ad-zone iframe,
.qn-ad-zone ins,
.qn-ad-zone > * { max-width: 100% !important; }
.ad-before-header { padding: 8px 0; background: var(--card); border-bottom: 1px solid var(--border); }
.ad-after-header  { padding: 8px 0; }
.ad-before-content, .ad-after-content { padding: 12px 0; }
.ad-in-content { padding: 16px; background: var(--bg); border-radius: var(--r); margin: 20px 0; }
/* AdSense-safe wrapper — never overflow, never block ad rendering */
.qn-ad-wrapper {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-align: center;
  box-sizing: border-box;
}
.qn-ad-wrapper ins,
.qn-ad-wrapper iframe {
  max-width: 100% !important;
  display: block !important;
  margin: 0 auto !important;
}

/* ── SECTION HEADING ── */
.qn-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding-bottom: 11px; border-bottom: 2px solid var(--border); position: relative; }
.qn-sec-head::after { content: ''; position: absolute; bottom: -2px; right: 0; width: 48px; height: 2px; background: var(--primary); border-radius: 2px; }
.qn-sec-head h2 { font-size: 18px; font-weight: var(--fw-black); margin: 0; }
.qn-see-all { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: var(--fw-bold); color: var(--primary); white-space: nowrap; transition: gap var(--trans); }
.qn-see-all:hover { gap: 7px; }

/* ── CARDS ── */
.qn-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform var(--trans), box-shadow var(--trans);
}
.qn-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.qn-thumb { position: relative; overflow: hidden; background: var(--navy); flex-shrink: 0; }
.qn-thumb a { display: block; height: 100%; }
.qn-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s ease; }
.qn-card:hover .qn-thumb img { transform: scale(1.05); }
.qn-no-img { width: 100%; height: 100%; background: linear-gradient(135deg, var(--navy), #2a4a7a); display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.12); font-size: 32px; }

.qn-badge { display: inline-block; background: var(--primary); color: #fff; font-size: 11px; font-weight: var(--fw-black); text-transform: uppercase; letter-spacing: .06em; padding: 3px 10px; border-radius: 99px; margin-bottom: 8px; transition: opacity var(--trans); }
.qn-badge:hover { color: #fff; opacity: .85; }

.qn-card-body { padding: 13px; flex: 1; display: flex; flex-direction: column; }
.qn-card-title { font-size: var(--fs-h3); font-weight: var(--fw-bold); line-height: 1.45; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qn-card-title a { color: var(--text); transition: color var(--trans); }
.qn-card-title a:hover { color: var(--primary); }
.qn-card-excerpt { font-size: var(--fs-small); color: var(--muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 10px; flex: 1; }
.qn-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: var(--fs-xs); color: var(--muted); margin-top: auto; padding-top: 8px; }
.qn-meta span { display: flex; align-items: center; gap: 3px; }
.qn-meta a { color: var(--muted); font-weight: var(--fw-medium); transition: color var(--trans); }
.qn-meta a:hover { color: var(--primary); }

/* ── CARD STYLES ── */

/* Overlay */
.qn-card-ov { position: relative; border: none; background: transparent; }
.qn-card-ov .qn-thumb { aspect-ratio: unset; height: 260px; }
.qn-card-ov .qn-card-body {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.92) 0%, rgba(0,0,0,.5) 60%, transparent 100%);
  color: #fff; padding: 40px 13px 13px;
}
.qn-card-ov .qn-card-title a { color: #fff; }
.qn-card-ov .qn-card-title a:hover { color: var(--amber); }
.qn-card-ov .qn-meta { color: rgba(255,255,255,.65); border-top: 1px solid rgba(255,255,255,.15); }
.qn-card-ov .qn-meta a { color: rgba(255,255,255,.65); }
.qn-card-ov:hover { transform: translateY(-4px); }

/* Classic card */
.qn-card-classic .qn-thumb { aspect-ratio: 16/9; height: auto; }

/* Horizontal card */
.qn-card-h { flex-direction: row; }
.qn-thumb-h { width: 170px; height: auto; min-height: 125px; flex-shrink: 0; aspect-ratio: unset; }
.qn-card-h .qn-card-body { padding: 12px 13px; }

/* Horizontal large card */
.qn-card-hl { flex-direction: row; }
.qn-thumb-hl { width: 240px; height: auto; min-height: 160px; flex-shrink: 0; aspect-ratio: unset; }
.qn-card-hl-body { padding: 16px; }
.qn-card-hl-title { font-size: var(--fs-h2); -webkit-line-clamp: 3; }

/* Mini */
.qn-mini { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.qn-mini:last-child { border-bottom: none; }
.qn-mini-thumb { width: 68px; height: 52px; border-radius: var(--r-sm); overflow: hidden; flex-shrink: 0; background: var(--navy); }
.qn-mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.qn-mini-body { flex: 1; min-width: 0; }
.qn-mini-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-small); font-weight: var(--fw-medium); color: var(--text); line-height: 1.4; margin-bottom: 3px; transition: color var(--trans); }
.qn-mini-title:hover { color: var(--primary); }
.qn-mini-date { font-size: var(--fs-xs); color: var(--muted); display: flex; align-items: center; gap: 3px; }

/* Text only */
.qn-card-text { border: none; background: transparent; border-bottom: 1px solid var(--border); border-radius: 0; padding: 12px 0; }
.qn-card-text:hover { transform: none; box-shadow: none; }
.qn-card-text .qn-card-body { padding: 0; }

/* ── HERO SLIDER ── */
.qn-hero { position: relative; overflow: hidden; background: var(--topbar); }
.qn-slides { display: flex; will-change: transform; transition: transform .55s ease; }
.qn-slide { min-width: 100%; height: 460px; position: relative; overflow: hidden; flex-shrink: 0; }
.qn-slide-bg { position: absolute; inset: 0; background-size: cover; background-position: center; transition: transform 8s ease; }
.qn-slide.active .qn-slide-bg { transform: scale(1.05); }
.qn-slide-ov { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.9) 0%, rgba(0,0,0,.25) 55%, rgba(0,0,0,.05) 100%); }
.qn-slide-content { position: absolute; bottom: 0; left: 0; right: 0; padding: 46px 24px 22px; z-index: 2; }
.qn-slide-title { font-size: clamp(17px, 3vw, 26px); color: #fff; line-height: 1.3; margin-bottom: 8px; }
.qn-slide-title a { color: #fff; }
.qn-slide-title a:hover { color: var(--amber); }
.qn-slide-meta { display: flex; gap: 14px; font-size: 12px; color: rgba(255,255,255,.6); }
.qn-slide-meta span { display: flex; align-items: center; gap: 4px; }
.qn-sl-prev, .qn-sl-next { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.12); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.2); color: #fff; font-size: 15px; display: flex; align-items: center; justify-content: center; z-index: 5; transition: all var(--trans); }
.qn-sl-prev:hover, .qn-sl-next:hover { background: var(--primary); border-color: var(--primary); }
.qn-sl-prev { right: 16px; } .qn-sl-next { left: 16px; }
.qn-sl-dots { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 5; }
.qn-dot { width: 7px; height: 7px; border-radius: 99px; background: rgba(255,255,255,.4); border: none; cursor: pointer; padding: 0; transition: all .2s; }
.qn-dot.active { background: #fff; width: 22px; }

/* Slider counters (show page numbers) */
.qn-slide-counter { position: absolute; bottom: 18px; right: 18px; z-index: 5; background: rgba(0,0,0,.5); color: #fff; font-size: 13px; font-weight: var(--fw-bold); padding: 4px 12px; border-radius: 99px; backdrop-filter: blur(4px); }

/* Slider style: thumbnails at bottom */
.qn-hero.thumb-nav .qn-slide { height: 380px; }
.qn-thumb-nav-strip { display: flex; gap: 8px; padding: 8px; background: var(--topbar); }
.qn-thumb-nav-item { flex: 1; height: 60px; cursor: pointer; border-radius: var(--r-sm); overflow: hidden; opacity: .5; transition: opacity var(--trans); border: 2px solid transparent; }
.qn-thumb-nav-item.active { opacity: 1; border-color: var(--primary); }
.qn-thumb-nav-item img { width: 100%; height: 100%; object-fit: cover; }

/* ── PAGINATION ── */
.qn-pagination { display: flex; justify-content: center; align-items: center; gap: 5px; padding: 26px 0; flex-wrap: wrap; }
.qn-pagination a, .qn-pagination span { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 38px; height: 38px; padding: 0 10px; border: 1.5px solid var(--border); border-radius: var(--r); font-size: 14px; font-weight: var(--fw-medium); color: var(--text); background: var(--card); transition: all var(--trans); text-decoration: none; }
.qn-pagination a:hover, .qn-pagination span.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.qn-pagination span.dots { background: transparent; border: none; cursor: default; }

/* ── BREADCRUMBS ── */
.qn-breadcrumbs { padding: 11px 0; margin-bottom: 18px; border-bottom: 1px solid var(--border); font-size: var(--fs-small); color: var(--muted); }
.qn-breadcrumbs a { color: var(--muted); transition: color var(--trans); }
.qn-breadcrumbs a:hover { color: var(--primary); }
.qn-bc-sep { margin: 0 5px; font-size: 9px; }

/* ── BOXED POST CONTENT ── */
.qn-post-box {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
}
.qn-post-box .qn-feat-img {
  margin-left: -32px;
  margin-right: -32px;
  margin-top: -28px;
  margin-bottom: 24px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  overflow: hidden;
}
.qn-post-box .qn-feat-img img { border-radius: 0; }

.qn-feat-img { border-radius: var(--r-lg); overflow: hidden; margin-bottom: 20px; box-shadow: var(--shadow); }
.qn-feat-img img { width: 100%; max-height: 460px; object-fit: cover; display: block; }
.qn-feat-caption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 6px; font-style: italic; }

/* ── SINGLE STYLING ── */
.qn-single-hd { margin-bottom: 20px; }
.qn-single-title { font-size: clamp(20px, 4vw, 30px); line-height: 1.3; margin-bottom: 12px; }
.qn-single-lead { font-size: 16px; color: var(--muted); line-height: 1.7; padding: 12px 16px; border-right: 4px solid var(--primary); background: var(--bg); border-radius: 0 var(--r) var(--r) 0; margin-bottom: 18px; }
[data-theme=dark] .qn-single-lead { background: rgba(255,255,255,.04); }

/* Entry content */
.qn-entry { font-size: var(--fs-body); line-height: 1.9; color: var(--text); }
.qn-entry > * + * { margin-top: 16px; }
.qn-entry h2 { font-size: var(--fs-h2); padding-bottom: 8px; border-bottom: 2px solid var(--border); margin-top: 30px; }
.qn-entry h3 { font-size: var(--fs-h3); margin-top: 24px; }
.qn-entry a { color: var(--primary); text-decoration: underline; }
.qn-entry img { border-radius: var(--r); max-width: 100%; }
.qn-entry ul { list-style: disc; padding-right: 20px; }
.qn-entry ol { list-style: decimal; padding-right: 20px; }
.qn-entry li { margin-bottom: 5px; }
.qn-entry blockquote { border-right: 4px solid var(--primary); padding: 12px 16px; background: var(--bg); border-radius: 0 var(--r) var(--r) 0; font-style: italic; font-size: 17px; color: var(--muted); }
[data-theme=dark] .qn-entry blockquote { background: rgba(255,255,255,.04); }
.qn-entry pre { background: #1e293b; color: #e2e8f0; padding: 18px; border-radius: var(--r); overflow-x: auto; font-size: 14px; direction: ltr; text-align: left; }
.qn-entry code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.qn-entry table { width: 100%; border-collapse: collapse; }
.qn-entry table th, .qn-entry table td { border: 1px solid var(--border); padding: 9px 12px; text-align: right; }
.qn-entry table th { background: var(--bg); font-weight: var(--fw-bold); }
.alignleft { float: right; margin-left: 16px; margin-bottom: 8px; }
.alignright { float: left; margin-right: 16px; margin-bottom: 8px; }
.aligncenter { margin: 0 auto; display: block; }

.qn-post-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 16px; }
.qn-post-tags > span { font-size: var(--fs-small); font-weight: var(--fw-bold); color: var(--muted); }
.qn-tag-a { background: var(--bg); color: var(--muted); border: 1px solid var(--border); padding: 3px 11px; border-radius: 99px; font-size: var(--fs-small); transition: all var(--trans); }
.qn-tag-a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.qn-share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 16px; }
.qn-share-lbl { font-size: var(--fs-small); font-weight: var(--fw-bold); color: var(--muted); white-space: nowrap; }
.qn-sh { display: inline-flex; align-items: center; gap: 4px; padding: 6px 13px; border-radius: 99px; font-size: var(--fs-small); font-weight: var(--fw-bold); color: #fff; transition: all var(--trans); }
.qn-sh:hover { opacity: .88; transform: translateY(-2px); }
.sh-fb{background:#1877f2} .sh-tw{background:#000} .sh-wa{background:#25d366} .sh-tg{background:#0088cc} .sh-cp{background:var(--muted)}

.qn-shortlink { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); padding: 9px 13px; margin-bottom: 16px; flex-wrap: wrap; }
[data-theme=dark] .qn-shortlink { background: rgba(255,255,255,.04); }
.qn-sl-lbl { font-size: var(--fs-small); font-weight: var(--fw-bold); color: var(--muted); white-space: nowrap; }
.qn-sl-url { flex: 1; font-size: var(--fs-small); color: var(--primary); font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.qn-copy-btn { background: var(--primary); color: #fff; padding: 4px 12px; border-radius: 99px; font-size: var(--fs-xs); font-weight: var(--fw-bold); transition: background var(--trans); flex-shrink: 0; }
.qn-copy-btn:hover { background: var(--primary-d); }
.qn-views-bar { display: flex; align-items: center; gap: 5px; font-size: var(--fs-small); color: var(--muted); margin-bottom: 16px; }
.qn-views-bar strong { color: var(--text); font-weight: var(--fw-bold); }
.qn-author-box { display: flex; gap: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; margin: 24px 0; }
[data-theme=dark] .qn-author-box { background: rgba(255,255,255,.04); }
.qn-author-box img { width: 68px; height: 68px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 3px solid var(--border); }
.qn-author-name { font-size: 15px; font-weight: var(--fw-black); margin-bottom: 4px; }
.qn-author-name a { color: var(--text); transition: color var(--trans); }
.qn-author-name a:hover { color: var(--primary); }
.qn-author-bio { font-size: var(--fs-small); color: var(--muted); line-height: 1.65; margin-bottom: 6px; }
.qn-author-lnk { font-size: var(--fs-small); font-weight: var(--fw-bold); color: var(--primary); display: inline-flex; align-items: center; gap: 4px; transition: gap var(--trans); }
.qn-author-lnk:hover { gap: 7px; }
.qn-post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 20px 0; }
.qn-pnav { display: flex; flex-direction: column; gap: 4px; padding: 13px; background: var(--card); border: 1.5px solid var(--border); border-radius: var(--r-lg); transition: all var(--trans); color: var(--text); }
.qn-pnav:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.qn-pnav-dir { font-size: 11px; font-weight: var(--fw-bold); color: var(--primary); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 3px; }
.qn-pnav-title { font-size: var(--fs-small); font-weight: var(--fw-medium); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qn-related { margin: 24px 0; }
.qn-related-title { font-size: 17px; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 3px solid var(--primary); display: inline-block; padding-left: 22px; }

/* ── SIDEBAR & WIDGETS ── */
.qn-sidebar { display: flex; flex-direction: column; gap: 20px; }

/* Widget Style 1: Card */
.qn-widget {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.qn-wt, .qn-widget .widget-title {
  font-size: var(--fs-xs); font-weight: var(--fw-black); text-transform: uppercase; letter-spacing: .06em;
  padding: 11px 14px; margin: 0; background: var(--bg);
  border-bottom: 1px solid var(--border); color: var(--text);
  display: flex; align-items: center; gap: 7px;
}
[data-theme=dark] .qn-wt,[data-theme=dark] .qn-widget .widget-title { background: rgba(255,255,255,.04); }
.qn-wt::before, .qn-widget .widget-title::before { content: ''; display: block; width: 3px; height: 16px; background: var(--primary); border-radius: 99px; flex-shrink: 0; }
.qn-wb { padding: 12px 14px; }
.qn-widget ul { list-style: none; }
.qn-widget ul li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-small); display: flex; align-items: center; justify-content: space-between; }
.qn-widget ul li:last-child { border-bottom: none; }
.qn-widget ul li a { color: var(--text); transition: color var(--trans); flex: 1; }
.qn-widget ul li a:hover { color: var(--primary); }

/* Widget Style 2: Minimal */
.qn-widget.style-2 { border: none; background: transparent; border-radius: 0; box-shadow: none; border-bottom: 2px solid var(--border); padding-bottom: 16px; }
.qn-widget.style-2 .qn-wt,.qn-widget.style-2 .widget-title { background: transparent; border: none; padding: 0 0 10px; border-bottom: 3px solid var(--primary); font-size: 16px; }
.qn-widget.style-2 .qn-wt::before,.qn-widget.style-2 .widget-title::before { display: none; }
.qn-widget.style-2 .qn-wb { padding: 12px 0 0; }

/* Widget Style 3: Dark */
.qn-widget.style-3 { background: var(--navy); border: none; }
.qn-widget.style-3 .qn-wt,.qn-widget.style-3 .widget-title { background: rgba(0,0,0,.2); color: #fff; border-color: rgba(255,255,255,.1); }
.qn-widget.style-3 .qn-wt::before,.qn-widget.style-3 .widget-title::before { background: var(--amber); }
.qn-widget.style-3 .qn-wb { color: rgba(255,255,255,.7); }
.qn-widget.style-3 ul li { border-color: rgba(255,255,255,.1); }
.qn-widget.style-3 ul li a { color: rgba(255,255,255,.7); }
.qn-widget.style-3 ul li a:hover { color: #fff; }
.qn-widget.style-3 .qn-mini-title { color: rgba(255,255,255,.85); }
.qn-widget.style-3 .qn-mini-date { color: rgba(255,255,255,.4); }
.qn-widget.style-3 .qn-mini { border-color: rgba(255,255,255,.1); }

/* Widget Style 4: Accent border */
.qn-widget.style-4 { border-top: 3px solid var(--primary); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.qn-widget.style-4 .qn-wt,.qn-widget.style-4 .widget-title { border: none; background: transparent; }
.qn-widget.style-4 .qn-wt::before,.qn-widget.style-4 .widget-title::before { display: none; }

/* Category widget styled */
.qn-cat-widget a { display: flex; align-items: center; justify-content: space-between; }
.qn-cat-count { background: var(--bg); color: var(--muted); font-size: 11px; font-weight: var(--fw-bold); padding: 2px 7px; border-radius: 99px; flex-shrink: 0; }
[data-theme=dark] .qn-cat-count { background: rgba(255,255,255,.08); }
.qn-widget.style-3 .qn-cat-count { background: rgba(255,255,255,.1); color: rgba(255,255,255,.6); }
.qn-cat-badge-item { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px; }
.qn-cat-badge-link { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 99px; background: var(--bg); border: 1px solid var(--border); font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--text); transition: all var(--trans); }
.qn-cat-badge-link:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Tag cloud styled */
.qn-tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px; }
.tag-cloud-link { display: inline-block; background: var(--bg); color: var(--muted); border: 1px solid var(--border); padding: 4px 12px; border-radius: 99px; font-size: var(--fs-small) !important; transition: all var(--trans); }
.tag-cloud-link:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.qn-widget.style-3 .tag-cloud-link { background: rgba(255,255,255,.08); color: rgba(255,255,255,.7); border-color: rgba(255,255,255,.1); }
.qn-widget.style-3 .tag-cloud-link:hover { background: var(--primary); color: #fff; }

/* Ranked list */
.qn-rank-list { display: flex; flex-direction: column; }
.qn-rank-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.qn-rank-item:last-child { border-bottom: none; }
.qn-rank-n { font-size: 22px; font-weight: var(--fw-black); color: var(--border); line-height: 1; min-width: 30px; text-align: center; flex-shrink: 0; }
.qn-rank-body { flex: 1; min-width: 0; }
.qn-rank-link { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-small); font-weight: var(--fw-medium); color: var(--text); line-height: 1.4; margin-bottom: 3px; transition: color var(--trans); }
.qn-rank-link:hover { color: var(--primary); }
.qn-rank-views { font-size: var(--fs-xs); color: var(--muted); display: flex; align-items: center; gap: 3px; }

/* ── ARCHIVE BANNER ── */
.qn-arch-banner { background: var(--navy); color: #fff; padding: 24px; border-radius: var(--r-lg); margin-bottom: 20px; text-align: center; }
.qn-arch-icon { font-size: 30px; opacity: .5; margin-bottom: 8px; }
.qn-arch-banner h1 { color: #fff; font-size: clamp(18px, 3vw, 24px); margin-bottom: 5px; }
.qn-arch-banner p { color: rgba(255,255,255,.65); font-size: 14px; }
.qn-arch-author { display: flex; align-items: center; gap: 16px; text-align: right; }
.qn-arch-author img { width: 70px; height: 70px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 3px solid rgba(255,255,255,.25); }

/* ── COMMENTS ── */
.qn-comments { margin-top: 28px; padding-top: 20px; border-top: 2px solid var(--border); }
.qn-comments h3 { font-size: 18px; margin-bottom: 18px; }
.comment-list { list-style: none; }
.comment-list .children { list-style: none; padding-right: 28px; }
.qn-comment { margin-bottom: 12px; }
.qn-comment-wrap { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 13px; }
.qn-comment-wrap img { border-radius: 50%; }
.qn-comment-body { flex: 1; min-width: 0; }
.qn-comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.qn-comment-author { font-size: 14px; font-weight: var(--fw-bold); }
.qn-comment-date { font-size: 12px; color: var(--muted); }
.qn-comment-text p { font-size: 14px; margin-bottom: 5px; }
.comment-reply-link { font-size: 12px; font-weight: var(--fw-bold); color: var(--primary); display: inline-flex; align-items: center; gap: 3px; margin-top: 6px; }
#respond { margin-top: 22px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; }
[data-theme=dark] #respond { background: rgba(255,255,255,.03); }
#respond h3 { font-size: 16px; margin-bottom: 14px; }
.comment-form p { margin-bottom: 11px; }
.comment-form label { display: block; font-size: 13px; font-weight: var(--fw-bold); margin-bottom: 4px; }
.comment-form input[type=text],.comment-form input[type=email],.comment-form input[type=url],.comment-form textarea { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--r); background: var(--card); color: var(--text); font-size: 14px; font-family: var(--font-main); outline: none; transition: border-color var(--trans); }
.comment-form input:focus,.comment-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(230,57,70,.1); }
.comment-form textarea { min-height: 110px; resize: vertical; }
.comment-form input[type=submit] { background: var(--primary); color: #fff; border: none; padding: 10px 26px; border-radius: 99px; font-size: 14px; font-weight: var(--fw-black); cursor: pointer; font-family: var(--font-main); transition: all var(--trans); }
.comment-form input[type=submit]:hover { background: var(--primary-d); transform: translateY(-2px); }

/* ── FOOTER ── */
.qn-footer { background: #0f172a; color: rgba(255,255,255,.5); width: 100%; max-width: 100vw; overflow: hidden; }
.qn-foot-widgets { padding: 42px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.qn-foot-grid { display: grid; gap: 26px; grid-template-columns: repeat(4,1fr); }
.qn-foot-grid.fc3 { grid-template-columns: repeat(3,1fr); }
.qn-foot-grid.fc2 { grid-template-columns: repeat(2,1fr); }
.qn-foot-ct { font-size: 13px; font-weight: var(--fw-black); text-transform: uppercase; letter-spacing: .07em; color: #fff; padding-bottom: 10px; border-bottom: 2px solid var(--primary); margin-bottom: 14px; }
.qn-foot-col p { font-size: 14px; line-height: 1.75; color: rgba(255,255,255,.5); }
.qn-foot-col ul { list-style: none; }
.qn-foot-col ul li { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 14px; }
.qn-foot-col ul li:last-child { border-bottom: none; }
.qn-foot-col ul li a { color: rgba(255,255,255,.55); transition: color var(--trans); }
.qn-foot-col ul li a:hover { color: #fff; }
.qn-foot-social { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.qn-foot-social a { width: 33px; height: 33px; border-radius: 7px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center; font-size: 13px; transition: all var(--trans); }
.qn-foot-social a:hover { background: var(--primary); border-color: var(--primary); color: #fff; transform: translateY(-2px); }
.qn-foot-bottom { padding: 13px 0; background: rgba(0,0,0,.3); }
.qn-foot-bottom .qn-wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.qn-copyright { font-size: 13px; color: rgba(255,255,255,.35); }
.qn-copyright a { color: rgba(255,255,255,.35); transition: color var(--trans); }
.qn-copyright a:hover { color: #fff; }
.qn-foot-menu { display: flex; gap: 14px; list-style: none; }
.qn-foot-menu a { color: rgba(255,255,255,.4); font-size: 13px; transition: color var(--trans); }
.qn-foot-menu a:hover { color: #fff; }

/* ── HOMEPAGE LAYOUTS ── */
/* Layout 1: Default */
/* Layout 2: Magazine */
.qn-home-layout-2 .qn-hero { margin-bottom: 0; }
/* Layout 3: Bold */
.qn-home-layout-3 .qn-sec-head h2 { font-size: 22px; }
.qn-home-layout-3 .qn-card { border-radius: var(--r-xl); }
/* Layout 4: Minimal */
.qn-home-layout-4 .qn-card { border: none; box-shadow: none; border-radius: 0; border-bottom: 1px solid var(--border); }
.qn-home-layout-4 .qn-card:hover { transform: none; box-shadow: none; }

/* ── UTILITIES ── */
.qn-reading-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999; pointer-events: none; }
.qn-reading-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--amber)); transition: width .1s linear; }
.qn-back-top { position: fixed; bottom: 24px; left: 24px; width: 42px; height: 42px; background: var(--primary); color: #fff; border-radius: var(--r); display: flex; align-items: center; justify-content: center; font-size: 16px; opacity: 0; visibility: hidden; transform: translateY(14px); transition: all var(--trans); z-index: 99; box-shadow: var(--shadow-lg); }
.qn-back-top.on { opacity: 1; visibility: visible; transform: translateY(0); }
.qn-back-top:hover { background: var(--primary-d); transform: translateY(-3px); }
.qn-toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(54px); background: #1e293b; color: #fff; padding: 9px 20px; border-radius: 99px; font-size: 13px; z-index: 9999; transition: transform var(--trans); box-shadow: var(--shadow-lg); white-space: nowrap; pointer-events: none; }
.qn-toast.on { transform: translateX(-50%) translateY(0); }
.qn-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--primary); color: #fff; padding: 9px 22px; border-radius: 99px; font-size: 14px; font-weight: var(--fw-black); transition: all var(--trans); }
.qn-btn:hover { background: var(--primary-d); transform: translateY(-2px); color: #fff; }
.qn-no-posts { text-align: center; padding: 42px 20px; color: var(--muted); }
.qn-no-posts i { font-size: 36px; color: var(--border); display: block; margin-bottom: 12px; }
.qn-no-posts h2 { font-size: 18px; color: var(--text); margin-bottom: 8px; }
.qn-404 { text-align: center; padding: 48px 20px; }
.qn-err { font-size: 100px; font-weight: var(--fw-black); color: var(--primary); opacity: .12; line-height: 1; letter-spacing: -.05em; }
.qn-404 h1 { font-size: 22px; margin-bottom: 8px; margin-top: -6px; }
.qn-404 p { color: var(--muted); margin-bottom: 18px; }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  :root { --sidebar: 260px; }
  .qn-foot-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 900px) {
  .qn-page-grid {
    grid-template-columns: 1fr !important; /* Force single column */
  }
  .qn-side-col { order: 2; }
  .qn-grid.g4 { grid-template-columns: repeat(2,1fr); }
  .qn-slide { height: 340px; }
  .qn-grid.masonry { columns: 2; }
  .qn-grid.magazine { grid-template-columns: 1fr; }
  .qn-grid.magazine .qn-card:first-child { grid-row: auto; }
  .qn-grid.featured { grid-template-columns: 1fr; }
  .qn-grid.featured .qn-card:first-child { grid-row: auto; }
}

/* ── MOBILE: 768px and below ── */
@media (max-width: 768px) {
  /* Force no horizontal overflow */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
  }

  /* Kill sidebar completely on mobile */
  .qn-side-col {
    display: none !important;
  }

  /* Full-width single column always */
  .qn-page-grid,
  .qn-page-grid.no-sidebar {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    padding: 14px 0 !important;
  }

  /* Wrap padding for breathing room */
  .qn-wrap { padding: 0 12px; }

  /* Navigation */
  .qn-nav-bar { display: none !important; }
  /* Hide header banner ad on mobile - it's too wide */
  .ad-before-header,
  .ad-after-header,
  .qn-header-ad { display: none !important; }
  .qn-hbtn-menu { display: flex !important; }
  .qn-header-ad { display: none !important; }

  /* Cards - prevent fixed widths from causing overflow */
  .qn-card-h,
  .qn-card-hl {
    flex-direction: column !important;
  }
  .qn-thumb-h,
  .qn-thumb-hl,
  .qn-card-h .qn-thumb,
  .qn-card-hl .qn-thumb {
    width: 100% !important;
    height: auto !important;
    min-height: unset !important;
    aspect-ratio: 16/9 !important;
    max-width: 100% !important;
  }

  /* Grids */
  .qn-grid.g2,
  .qn-grid.g3,
  .qn-grid.g4 { grid-template-columns: 1fr; }

  /* Slider */
  .qn-slide { height: 220px; }
  .qn-slide-title { font-size: 15px; }
  .qn-slide-content { padding: 30px 12px 14px; }

  /* Post box */
  .qn-post-box { padding: 14px; border-radius: var(--r); }
  .qn-post-box .qn-feat-img {
    margin-left: -14px;
    margin-right: -14px;
    margin-top: -14px;
    border-radius: var(--r) var(--r) 0 0;
  }

  /* Misc */
  .qn-post-nav { grid-template-columns: 1fr; }
  .qn-author-box { flex-direction: column; }
  .qn-arch-author { flex-direction: column; text-align: center; }
  .qn-foot-grid,
  .qn-foot-grid.fc3,
  .qn-foot-grid.fc2 { grid-template-columns: 1fr; }
  .qn-foot-bottom .qn-wrap { flex-direction: column; text-align: center; }
  .qn-sh span { display: none; }
  .qn-grid.masonry { columns: 1; }

  /* Single post meta wrap */
  .qn-single-title { font-size: 20px; }
  .qn-entry { font-size: 15px; }
  .qn-entry pre { font-size: 12px; padding: 12px; }
  .qn-related .qn-grid { grid-template-columns: 1fr; }

  /* Header height */
  :root { --hh: 54px; }
}

/* ── SMALL PHONES ── */
@media (max-width: 380px) {
  .qn-wrap { padding: 0 10px; }
  .qn-slide { height: 180px; }
  .qn-card-ov .qn-thumb { height: 200px; }
  .qn-share-bar { gap: 5px; }
  .qn-sh { padding: 5px 10px; font-size: 12px; }
}

/* ── BULLETPROOF OVERFLOW PREVENTION ──
   Final safety layer. overflow-x:hidden on all containers.
── */
.qn-entry,
.qn-post-box,
.qn-main-col,
.qn-card-body,
.qn-page-grid,
.qn-wrap,
.qn-ad-zone,
.qn-hero,
#qn-main {
  overflow-x: hidden;
}

/* ALL media inside entry content stays contained */
.qn-entry img,
.qn-entry video,
.qn-entry iframe,
.qn-entry embed,
.qn-entry object,
.qn-entry figure,
.qn-entry .wp-block-embed,
.qn-entry .wp-block-video,
.qn-entry [class*="wp-block"] {
  max-width: 100% !important;
  width: auto !important;
}
.qn-entry iframe,
.qn-ad-zone iframe,
iframe.wp-embedded-content {
  max-width: 100% !important;
}
.wp-block-embed__wrapper,
.embed-responsive,
.video-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* ── MOBILE-ONLY HARD RESET ──
   On small screens, use !important to override ANY plugin/theme
   inline styles that could cause horizontal overflow.
── */
@media (max-width: 768px) {
  /* Contain overflow without breaking AdSense */
  html, body {
    overflow-x: hidden !important;
  }
  .qn-site {
    overflow-x: clip !important; /* clip not hidden - doesn't affect layout box */
    width: 100% !important;
  }

  /* Force all structural elements full-width */
  .qn-header,
  .qn-topbar,
  .qn-breaking,
  .qn-nav-bar,
  .qn-footer,
  .ad-before-header,
  .ad-after-header {
    width: 100% !important;
    max-width: 100vw !important;
    overflow: hidden !important;
    left: 0 !important;
    right: 0 !important;
  }

  /* Force ALL images, iframes, ads to stay inside */
  img, video, svg {
    max-width: 100% !important;
    height: auto !important;
  }
  /* AdSense: let it control its own width, just cap at 100% */
  ins.adsbygoogle {
    max-width: 100% !important;
    display: block !important;
  }

  /* Images that are direct children of links (ad images) */
  a > img,
  a > picture > img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }

  /* Ad containers - overflow:visible so AdSense can render */
  .qn-ad-zone,
  .qn-ad-728,
  .qn-ad-300,
  .qn-ad-wrapper {
    max-width: 100% !important;
    width: 100% !important;
  }
  /* Ticker */
  .qn-ticker-box {
    max-width: 100% !important;
    overflow: hidden !important;
  }
}

@media print {
  .qn-topbar,.qn-breaking,.qn-header,.qn-nav-bar,.qn-side-col,.qn-footer,.qn-share-bar,.qn-post-nav,.qn-back-top,.qn-reading-bar,.qn-search-overlay { display: none !important; }
  .qn-page-grid { grid-template-columns: 1fr !important; }
  .qn-post-box { box-shadow: none; border: none; }
}
