/* =========================================================
   UiSoftech — Blog styles (listing, cards, single post)
   ========================================================= */

/* ---------- Listing hero ---------- */
.blog-hero { padding-bottom: 60px; }
.blog-hero .badge { margin-bottom: 18px; }
.blog-search {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 620px;
  padding: 8px 8px 8px 18px; border-radius: 999px; margin-bottom: 26px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border-strong);
  backdrop-filter: blur(14px); transition: border-color var(--transition), box-shadow var(--transition);
}
.blog-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(124,92,255,0.18); }
.blog-search > .i { color: var(--text-dim); }
.blog-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 15.5px; padding: 8px 0; }
.blog-search input::placeholder { color: var(--text-dim); }
.blog-search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }
.blog-search .btn { border-radius: 999px; }

.cat-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 900px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--glass-border); transition: all var(--transition);
}
.cat-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--primary)); box-shadow: 0 0 10px var(--c, var(--primary)); }
.cat-chip small { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,0.07); color: var(--text-dim); }
.cat-chip:hover { color: var(--text); border-color: var(--c, var(--primary)); transform: translateY(-2px); }
.cat-chip.active { color: #fff; background: var(--gradient-1); border-color: transparent; box-shadow: var(--shadow-glow); }
.cat-chip.active small { background: rgba(255,255,255,0.2); color: #fff; }

.blog-section { padding-top: 40px; }
.search-info { color: var(--text-muted); margin-bottom: 28px; }
.search-info a { color: var(--secondary); }

/* ---------- Cards ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.post-card {
  position: relative; display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border: 1px solid var(--glass-border); transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.post-card:hover { transform: translateY(-6px); border-color: rgba(124,92,255,0.4); box-shadow: 0 30px 60px -30px rgba(124,92,255,0.45); }
.post-card-media { display: block; overflow: hidden; aspect-ratio: 1200 / 630; background: var(--dark-3); }
.post-cover { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.post-card:hover .post-cover { transform: scale(1.05); }
.post-card-body { display: flex; flex-direction: column; flex: 1; padding: 24px 24px 22px; }
.post-meta-row { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-dim); margin-bottom: 14px; flex-wrap: wrap; }
.cat-pill {
  display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  transition: background var(--transition);
}
.cat-pill:hover { background: color-mix(in srgb, var(--c) 24%, transparent); }
.post-card-title { font-size: 20px; font-weight: 800; line-height: 1.3; letter-spacing: -0.02em; margin-bottom: 10px; }
.post-card-title a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; transition: background-size .45s var(--ease); }
.post-card:hover .post-card-title a { background-size: 100% 2px; }
.post-card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* whole card clickable */
.post-card .cat-pill { position: relative; z-index: 2; }
.post-card-excerpt { color: var(--text-muted); font-size: 14.5px; line-height: 1.65; margin-bottom: 20px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 16px; border-top: 1px solid var(--glass-border); font-size: 13px; color: var(--text-dim); }
.author-mini { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; color: var(--text-muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; background: var(--gradient-1); flex-shrink: 0; text-transform: uppercase; }
.avatar-lg { width: 64px; height: 64px; font-size: 26px; }

/* featured */
.post-card.featured { display: grid; grid-template-columns: 1.15fr 1fr; margin-bottom: 36px; }
.post-card.featured .post-card-media { aspect-ratio: auto; min-height: 100%; }
.post-card.featured .post-cover { object-position: left center; }
.post-card.featured .post-card-body { padding: 44px 44px 36px; justify-content: center; }
.post-card.featured .post-card-title { font-size: clamp(24px, 2.6vw, 34px); }
.post-card.featured .post-card-excerpt { font-size: 16px; -webkit-line-clamp: 4; }
.post-card.featured::before {
  content: "★ Featured"; position: absolute; top: 18px; left: 18px; z-index: 2; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 800; color: #fff; background: rgba(6,6,12,0.7); border: 1px solid var(--glass-border-strong); backdrop-filter: blur(8px);
}

/* fallback cover (no image) */
.cover-fallback {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 26px; overflow: hidden; isolation: isolate;
  aspect-ratio: 1200 / 630; height: 100%;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--c) 55%, transparent), transparent 60%),
    radial-gradient(90% 80% at 0% 100%, rgba(34,211,238,0.25), transparent 60%),
    linear-gradient(135deg, #12121f, #0a0a14);
}
.cf-grid { position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px); background-size: 32px 32px; -webkit-mask-image: linear-gradient(180deg, #000, transparent); mask-image: linear-gradient(180deg, #000, transparent); }
.cf-cat { align-self: flex-start; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,0.12); color: #fff; }
.cf-title { font-size: clamp(16px, 1.6vw, 22px); font-weight: 800; line-height: 1.25; color: #fff; letter-spacing: -0.02em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cf-brand { position: absolute; top: 20px; right: 22px; font-size: 13px; font-weight: 800; color: rgba(255,255,255,0.6); }

/* pagination & empty */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 56px; flex-wrap: wrap; }
.pg-num, .pg-btn { min-width: 44px; height: 44px; padding: 0 14px; display: inline-grid; place-items: center; border-radius: 12px; font-weight: 700; font-size: 14.5px; background: var(--surface); border: 1px solid var(--glass-border); transition: all var(--transition); }
.pg-num:hover, .pg-btn:hover { border-color: var(--primary); color: #fff; }
.pg-num.active { background: var(--gradient-1); border-color: transparent; color: #fff; box-shadow: var(--shadow-glow); }
.pg-gap { color: var(--text-dim); padding: 0 4px; }
.empty-state { text-align: center; padding: 70px 20px; border-radius: var(--radius-lg); border: 1px dashed var(--glass-border-strong); }
.empty-state > .i { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--primary-2); }
.empty-state h2 { font-size: 24px; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 22px; }

/* ---------- Single post ---------- */
.preview-bar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1200; padding: 12px 20px; text-align: center; font-size: 14px; background: #fbbf24; color: #1a1300; }
.preview-bar a { text-decoration: underline; font-weight: 700; margin-left: 8px; }
.post-hero { padding-bottom: 50px; }
.post-hero .cat-pill { margin-bottom: 20px; }
.post-title { font-size: clamp(32px, 4.6vw, 56px); }
.post-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; font-size: 14px; color: var(--text-muted); }
.post-meta > span { display: inline-flex; align-items: center; gap: 7px; }
.post-meta .i { width: 16px; height: 16px; color: var(--text-dim); }
.post-cover-wrap { max-width: 1080px; }
.post-cover-lg { width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--glass-border); aspect-ratio: 1200 / 630; object-fit: cover; box-shadow: 0 40px 100px -40px rgba(124,92,255,0.5); }
.post-cover-wrap .cover-fallback { padding: 50px; }
.post-cover-wrap .cf-title { font-size: clamp(22px, 3.4vw, 42px); }
.post-section { padding-top: 70px; }
.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 64px; max-width: 1160px; align-items: start; }

/* article typography */
.post-content { font-size: 18px; line-height: 1.85; color: #c9c9db; }
.post-content > * + * { margin-top: 1.15em; }
.post-content h2 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.25; color: var(--text); font-weight: 800; letter-spacing: -0.025em; margin-top: 2em; scroll-margin-top: 100px; }
.post-content h3 { font-size: clamp(20px, 2vw, 24px); line-height: 1.3; color: var(--text); font-weight: 800; margin-top: 1.6em; scroll-margin-top: 100px; }
.post-content h4 { font-size: 19px; color: var(--text); font-weight: 700; margin-top: 1.4em; }
.post-content a { color: var(--secondary); text-decoration: underline; text-decoration-color: rgba(34,211,238,0.4); text-underline-offset: 3px; transition: text-decoration-color .2s; }
.post-content a:hover { text-decoration-color: var(--secondary); }
.post-content strong { color: var(--text); font-weight: 700; }
.post-content ul, .post-content ol { padding-left: 1.4em; }
.post-content ul { list-style: none; padding-left: 0; }
.post-content ul > li { position: relative; padding-left: 1.6em; }
.post-content ul > li::before { content: ""; position: absolute; left: 4px; top: .72em; width: 8px; height: 8px; border-radius: 50%; background: var(--gradient-1); }
.post-content ol { list-style: decimal; }
.post-content ol > li::marker { color: var(--primary-2); font-weight: 800; }
.post-content li + li { margin-top: .5em; }
.post-content blockquote { margin-left: 0; padding: 22px 26px; border-left: 4px solid var(--primary); border-radius: 0 var(--radius) var(--radius) 0; background: rgba(124,92,255,0.08); font-size: 19px; color: var(--text); font-style: italic; }
.post-content img { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--glass-border); }
.post-content figure figcaption { text-align: center; font-size: 14px; color: var(--text-dim); margin-top: 10px; }
.post-content pre { padding: 20px 22px; border-radius: var(--radius-sm); background: #0b0b16; border: 1px solid var(--glass-border); overflow-x: auto; font-size: 14.5px; line-height: 1.6; }
.post-content code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .88em; padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,0.07); color: #e9d5ff; }
.post-content pre code { padding: 0; background: none; color: #c9c9db; }
.post-content hr { border: 0; height: 1px; background: var(--glass-border-strong); margin: 2.4em 0; }
.post-content mark { background: rgba(251,191,36,0.25); color: var(--text); padding: 0 4px; border-radius: 4px; }
.post-content .table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--glass-border); }
.post-content table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.post-content th, .post-content td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--glass-border); }
.post-content th { background: rgba(124,92,255,0.1); color: var(--text); font-weight: 700; }
.post-content tr:last-child td { border-bottom: 0; }
.post-content .embed { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--glass-border); }
.post-content .embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* TOC */
.toc { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--glass-border); }
.toc ol { list-style: none; padding: 0; margin: 0; counter-reset: toc; }
.toc li a { display: block; padding: 7px 12px; border-radius: 9px; font-size: 14px; color: var(--text-muted); line-height: 1.45; border-left: 2px solid transparent; transition: all .2s; }
.toc li.lvl-3 a { padding-left: 26px; font-size: 13.5px; }
.toc li a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.toc li a.active { color: #fff; background: rgba(124,92,255,0.14); border-left-color: var(--primary); }
.toc-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); padding: 4px 12px 12px; }
.toc-title .i { width: 16px; height: 16px; }
.toc-desktop { padding: 18px 10px; max-height: calc(100vh - 360px); overflow-y: auto; }
.toc-mobile { display: none; margin-bottom: 30px; }
.toc-mobile summary { display: flex; align-items: center; gap: 10px; padding: 16px 20px; font-weight: 700; cursor: pointer; list-style: none; }
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile ol { padding: 0 10px 14px; }

/* sidebar */
.sidebar-sticky { position: sticky; top: 100px; display: grid; gap: 20px; }
.side-cta { --c: #7c5cff; padding: 26px; border-radius: var(--radius); text-align: left; position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 18%, transparent), rgba(255,255,255,0.02)); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.side-cta::after { content: ""; position: absolute; width: 220px; height: 220px; right: -90px; top: -90px; z-index: -1; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 45%, transparent), transparent 70%); }
.side-cta-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 16px; color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); }
.side-cta h3 { font-size: 19px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.02em; }
.side-cta p { font-size: 14px; color: var(--text-muted); margin-bottom: 18px; }
.side-cta .btn + .btn { margin-top: 10px; }

/* tags, share, author, nav */
.post-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 48px; }
.post-tags > .i { color: var(--text-dim); width: 18px; height: 18px; }
.post-tags a { padding: 6px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--text-muted); background: var(--surface); border: 1px solid var(--glass-border); transition: all .2s; }
.post-tags a:hover { color: var(--text); border-color: var(--primary); }
.share-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 30px; padding: 20px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--glass-border); }
.share-bar > span { font-weight: 700; }
.share-btns { display: flex; gap: 10px; }
.sh { position: relative; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); color: var(--text); transition: all var(--transition); }
.sh .i { width: 19px; height: 19px; }
.sh:hover { transform: translateY(-3px); }
.sh-wa:hover { background: #25d366; border-color: #25d366; }
.sh-fb:hover { background: #1877f2; border-color: #1877f2; }
.sh-x:hover { background: #000; border-color: #444; }
.sh-in:hover { background: #0a66c2; border-color: #0a66c2; }
.sh-copy:hover, .sh-copy.copied { background: var(--primary); border-color: var(--primary); }
.sh-copy.copied::after { content: "Copied!"; position: absolute; transform: translateY(-38px); font-size: 12px; padding: 4px 8px; border-radius: 6px; background: var(--primary); }
.author-box { display: flex; gap: 20px; align-items: flex-start; margin-top: 30px; padding: 28px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(124,92,255,0.1), rgba(34,211,238,0.05)); border: 1px solid var(--glass-border); }
.ab-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); font-weight: 700; }
.ab-name { font-size: 20px; font-weight: 800; margin: 2px 0 8px; }
.author-box p { font-size: 14.5px; color: var(--text-muted); }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 30px; }
.pn { padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--glass-border); transition: all var(--transition); }
.pn:hover { border-color: rgba(124,92,255,0.4); transform: translateY(-3px); }
.pn span { display: block; font-size: 12.5px; color: var(--text-dim); font-weight: 700; margin-bottom: 6px; }
.pn b { font-size: 15.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pn.next { text-align: right; }
.related-posts .section-head { margin-bottom: 48px; }

/* home: latest posts */
.home-blog .section-head { margin-bottom: 52px; }
.home-blog-more { text-align: center; margin-top: 44px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .post-layout { grid-template-columns: 1fr; gap: 40px; }
  .post-sidebar { order: 2; }
  .sidebar-sticky { position: static; }
  .toc-desktop { display: none; }
  .toc-mobile { display: block; }
}
@media (max-width: 1024px) {
  .post-card.featured { grid-template-columns: 1fr; }
  .post-card.featured .post-card-media { aspect-ratio: 1200 / 630; }
  .post-card.featured .post-card-body { padding: 26px; }
}
@media (max-width: 640px) {
  .post-grid { grid-template-columns: 1fr; gap: 22px; }
  .post-content { font-size: 16.5px; }
  .post-nav { grid-template-columns: 1fr; }
  .author-box { flex-direction: column; }
  .share-bar { justify-content: center; text-align: center; }
  .blog-search .btn { padding: 10px 14px; }
  .post-cover-wrap .cover-fallback { padding: 24px; }
}

/* Homepage 'Latest from blog' */
.blog-more { text-align: center; margin-top: 40px; }

