/*
 * Blog list and article pages (frontend/blogs, frontend/blog_detail, frontend/blog/_card).
 * The body already starts below the old 52px bar (site-header.css); pages add the
 * category links row (--sg-strip) on top.
 */
.sgb { --ink: #12161C; --ink-2: #3A424D; --muted: #5B6470; --line: #E3E7EC; --bg: #F4F6F8; --blue: #066CB5; --link: #0062A8; --green: #098342; --r: 12px;
  background: var(--bg); color: var(--ink); font: 14px/1.55 Poppins, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased;
  padding: calc(var(--sg-hdr-old, 52px) + var(--sg-strip, 0px)) 0 56px; }
.sgb *, .sgb *::before, .sgb *::after { box-sizing: border-box; }
.sgb li::before { font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif; }
.sgb :where(h1, h2, h3, p, ul, ol, li, figure) { margin: 0; padding: 0; list-style: none; font-family: inherit; text-transform: none; color: inherit; }
.sgb :where(a) { color: inherit; text-decoration: none; }
.sgb a::before, .sgb a::after { content: none; }
.sgb [hidden] { display: none !important; }
.sgb .i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sgb button, .sgb input, .sgb textarea { font-family: inherit; }
.sgb a:focus-visible, .sgb button:focus-visible, .sgb input:focus-visible, .sgb textarea:focus-visible { outline: 3px solid #4DA3E0; outline-offset: 2px; }
.sgb-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.sgb-wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

.sgb-crumb { font-size: 12px; color: var(--muted); padding: 18px 0 12px; }
.sgb-crumb a { color: var(--link); }
.sgb-crumb span { margin: 0 6px; }

/* List: head, search, topics */
.sgb-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; padding-bottom: 20px; }
.sgb-head h1 { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -.3px; }
.sgb-head p { color: var(--ink-2); margin-top: 6px !important; max-width: 640px; }
.sgb-safe { flex: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); max-width: 320px; font-size: 13px; color: var(--link); }
.sgb-safe b { display: block; color: var(--ink); font-size: 14px; font-weight: 600; }
.sgb-safe:hover { border-color: #9DBFDD; }
.sgb-safe-ic { width: 38px; height: 38px; border-radius: 10px; background: #E9F5EE; color: var(--green); display: grid; place-items: center; flex: none; }

.sgb-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); margin: 0; }
.sgb-find { position: relative; display: block; flex: 0 1 420px; margin: 0; font-weight: 400; }
.sgb-find .i { position: absolute; left: 14px; top: 50%; margin-top: -9px; color: var(--muted); }
.sgb-find input { width: 100%; height: 44px; border: 1px solid #CDD5DD; border-radius: 10px; padding: 0 14px 0 42px; font-size: 14px; background: #fff; color: var(--ink); margin: 0; box-shadow: none; }
.sgb-find input:focus { outline: 3px solid rgba(77, 163, 224, .5); border-color: #4DA3E0; }
.sgb-total { color: var(--muted); font-size: 13px; white-space: nowrap; }
.sgb-topics { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.sgb-topics::-webkit-scrollbar { display: none; }
.sgb-topics a { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-weight: 500; font-size: 13px; }
.sgb-topics a span { color: var(--muted); font-size: 12px; }
.sgb-topics a:hover { border-color: #9DBFDD; color: var(--ink); }
.sgb-topics a[aria-current] { background: var(--ink); border-color: var(--ink); color: #fff; }
.sgb-topics a[aria-current] span { color: #C3CBD4; }

.sgb-sec { padding-top: 28px; }
.sgb-title { font-size: 20px; font-weight: 700; margin-bottom: 14px !important; }
.sgb-found { color: var(--muted); margin-bottom: 14px !important; }
.sgb-found a { color: var(--link); font-weight: 600; }

/* Cards */
.sgb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.sgb-feat { display: grid; grid-template-columns: 1.5fr 1fr; grid-template-rows: auto auto; gap: 20px; }
.sgb-feat .is-big { grid-row: span 2; }
.sgb-feat .sgb-card:not(.is-big) { flex-direction: row; }
.sgb-feat .sgb-card:not(.is-big) .sgb-ph { width: 42%; aspect-ratio: auto; flex: none; }
.sgb-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: box-shadow .18s, border-color .18s; }
.sgb-card:hover { border-color: #d5dbe2; box-shadow: 0 10px 24px rgba(18, 22, 28, .08); }
.sgb-ph { display: block; aspect-ratio: 16 / 9; background: #DDE4EB; overflow: hidden; }
.sgb-ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.sgb-card:hover .sgb-ph img { transform: scale(1.03); }
.sgb-cbody { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.sgb-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sgb-tags a { font-size: 11px; font-weight: 600; color: var(--green); background: #EAF6E4; padding: 3px 9px; border-radius: 999px; }
.sgb-tags a:hover { background: #DCEFD3; }
.sgb-card h3 { font-size: 17px; font-weight: 700; line-height: 1.35; }
.sgb-card h3 a:hover { color: var(--link); }
.sgb-card.is-big h3 { font-size: 24px; line-height: 1.25; }
.sgb-ex { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sgb-card.is-big .sgb-ex { font-size: 15px; }
.sgb-meta { margin-top: auto !important; padding-top: 6px; font-size: 12px; color: var(--muted); }

.sgb-pages { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; }
.sgb-pages > a, .sgb-pages > span { height: 40px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 13px; color: var(--link); }
.sgb-pages > .is-off { color: #B5BEC8; }
.sgb-pnums { display: flex; gap: 4px; }
.sgb-pnums a, .sgb-pnums span { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.sgb-pnums a:hover { background: #fff; }
.sgb-pnums [aria-current] { background: var(--ink); color: #fff; }
.sgb-empty { padding: 40px 0; text-align: center; color: var(--muted); }
.sgb-empty b { display: block; color: var(--ink); font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.sgb-empty a { color: var(--link); font-weight: 600; }

/* Article */
.sgb-art-head { max-width: 820px; padding: 8px 0 22px; }
.sgb-art-head h1 { font-size: 36px; line-height: 1.2; font-weight: 700; letter-spacing: -.4px; margin: 12px 0 10px !important; }
.sgb-lead { font-size: 17px; color: var(--ink-2); line-height: 1.6; }
.sgb-byline { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.sgb-byline b { color: var(--ink); font-weight: 600; }
.sgb-byline span[aria-hidden] { margin: 0 8px; }
.sgb-share { display: flex; gap: 6px; flex-wrap: wrap; }
.sgb-share a, .sgb-share button { height: 34px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 500; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.sgb-share a:hover, .sgb-share button:hover { border-color: #9DBFDD; color: var(--ink); }
.sgb-cover { margin: 0 0 28px !important; border-radius: 16px; overflow: hidden; background: #DDE4EB; }
.sgb-cover img { display: block; width: 100%; max-height: 520px; object-fit: cover; }

.sgb-art { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; }
.sgb-main { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 32px 40px; }
.sgb-toc { background: var(--bg); border-radius: 10px; padding: 14px 18px; margin-bottom: 24px; }
.sgb-toc p { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 6px !important; }
.sgb-toc ol { counter-reset: toc; }
.sgb-toc li { padding: 3px 0; }
.sgb-toc li.is-sub { padding-left: 16px; font-size: 13px; }
.sgb-toc a { color: var(--link); }
.sgb-toc a:hover { text-decoration: underline; }

/* Admin-written article text: readable whatever the editor produced */
.sgb-prose { max-width: 720px; font-size: 16px; line-height: 1.75; color: var(--ink-2); overflow-wrap: break-word; }
.sgb-prose * { font-family: inherit !important; max-width: 100%; }
.sgb-prose p, .sgb-prose span { font-size: inherit !important; line-height: inherit !important; }
.sgb-prose p { margin: 0 0 18px; }
.sgb-prose h1, .sgb-prose h2, .sgb-prose h3, .sgb-prose h4 { color: var(--ink); font-weight: 700; line-height: 1.3; scroll-margin-top: 20px; }
.sgb-prose h1, .sgb-prose h2 { font-size: 24px !important; margin: 34px 0 12px; }
.sgb-prose h3 { font-size: 19px !important; margin: 26px 0 10px; }
.sgb-prose h4 { font-size: 17px !important; margin: 22px 0 8px; }
.sgb-prose ul, .sgb-prose ol { margin: 0 0 18px; padding-left: 24px; }
.sgb-prose ul li { list-style: disc; }
.sgb-prose ol li { list-style: decimal; }
.sgb-prose li { margin-bottom: 8px; }
.sgb-prose li::before { content: none; }
.sgb-prose a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.sgb-prose strong, .sgb-prose b { color: var(--ink); }
.sgb-prose img { height: auto; border-radius: 10px; margin: 8px 0 18px; }
.sgb-prose blockquote { margin: 0 0 18px; padding: 4px 0 4px 18px; border-left: 3px solid var(--blue); color: var(--ink); font-style: italic; }
.sgb-prose table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 14px; display: block; overflow-x: auto; }
.sgb-prose th, .sgb-prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.sgb-prose iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: 10px; }

/* Comments */
.sgb-comments { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); max-width: 720px; }
.sgb-comments h2 { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 14px !important; }
.sgb-comments h2 span { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 1px 9px; }
.sgb-comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.sgb-av { width: 38px; height: 38px; border-radius: 50%; background: #E4EFF9; color: #0B4F86; display: grid; place-items: center; font-weight: 700; flex: none; }
.sgb-cname { display: flex; gap: 10px; align-items: baseline; margin-bottom: 2px !important; }
.sgb-cname b { font-weight: 600; color: var(--ink); }
.sgb-cname span { font-size: 12px; color: var(--muted); }
.sgb-comment p:last-child { color: var(--ink-2); white-space: pre-line; }
.sgb-none { color: var(--muted); padding: 4px 0 8px; }
.sgb-cform { margin-top: 22px; display: grid; gap: 12px; }
.sgb-cform h3 { font-size: 16px; font-weight: 700; }
.sgb-note { font-size: 13px; color: var(--muted); margin-top: -8px !important; }
.sgb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sgb-cform label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); margin: 0; }
.sgb-cform input, .sgb-cform textarea { width: 100%; border: 1px solid #CDD5DD; border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 400; color: var(--ink); background: #fff; margin: 0; box-shadow: none; }
.sgb-cform input { height: 44px; }
.sgb-cform textarea { resize: vertical; min-height: 110px; }
.sgb-cform input:focus, .sgb-cform textarea:focus { outline: 3px solid rgba(77, 163, 224, .5); border-color: #4DA3E0; }
.sgb-cform button { justify-self: start; height: 44px; padding: 0 20px; border: 0; border-radius: 10px; background: var(--green); color: #fff; font-weight: 600; font-size: 14px; cursor: pointer; }
.sgb-cform button:hover { background: #07703A; }
.sgb-cform button:disabled { opacity: .6; cursor: default; }
.sgb-msg:empty { display: none; }
.sgb-msg { padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.sgb-msg.is-ok { background: #E9F5EE; color: #1E6B3A; }
.sgb-msg.is-err { background: #FDECEC; color: #A8292E; }

/* Sidebar */
.sgb-side { position: sticky; top: 16px; display: grid; gap: 16px; }
.sgb-box { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.sgb-box h2 { font-size: 15px; font-weight: 700; margin-bottom: 10px !important; }
.sgb-pop { counter-reset: p; }
.sgb-pop li { counter-increment: p; display: grid; grid-template-columns: 26px 1fr; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; font-weight: 500; line-height: 1.4; }
.sgb-pop li:first-child { border-top: 0; }
.sgb .sgb-pop li::before { content: counter(p); position: static; font-weight: 700; color: #B5BEC8; }
.sgb-pop a:hover { color: var(--link); }
.sgb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sgb-chips a { font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: 999px; background: var(--bg); color: var(--ink-2); }
.sgb-chips a span { color: var(--muted); }
.sgb-chips a:hover { background: #E4EFF9; color: var(--link); }
.sgb-safe-side { max-width: none; }

.sgb-related { padding-top: 44px; }
.sgb-rhead { display: flex; justify-content: space-between; align-items: baseline; }
.sgb-rhead a { color: var(--link); font-weight: 600; font-size: 14px; }

/* Tablets and phones */
@media (max-width: 991.98px) {
  .sgb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sgb-feat { grid-template-columns: 1fr; }
  .sgb-feat .is-big { grid-row: auto; }
  .sgb-art { grid-template-columns: 1fr; }
  .sgb-side { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sgb-safe-side { grid-column: 1 / -1; }
  .sgb-main { padding: 26px 28px; }
}
@media (max-width: 767.98px) {
  .sgb { padding-bottom: 96px; }
  .sgb-wrap { padding: 0 16px; }
  .sgb-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .sgb-head h1 { font-size: 24px; }
  .sgb-safe { max-width: none; }
  .sgb-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .sgb-find { flex-basis: auto; }
  .sgb-find input { font-size: 16px; }
  .sgb-topics { margin: 0 -16px; padding: 0 16px 4px; }
  .sgb-grid { grid-template-columns: 1fr; gap: 14px; }
  .sgb-feat .sgb-card:not(.is-big) { flex-direction: column; }
  .sgb-feat .sgb-card:not(.is-big) .sgb-ph { width: auto; aspect-ratio: 16 / 9; }
  .sgb-card.is-big h3 { font-size: 20px; }
  .sgb-pnums { display: none; }

  .sgb-art-head h1 { font-size: 26px; }
  .sgb-lead { font-size: 16px; }
  .sgb-cover { margin: 0 -16px 20px !important; border-radius: 0; }
  .sgb-main { padding: 20px 16px; margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .sgb-prose { font-size: 16px; }
  .sgb-prose h1, .sgb-prose h2 { font-size: 21px !important; }
  .sgb-side { grid-template-columns: 1fr; }
  .sgb-row { grid-template-columns: 1fr; }
  .sgb-cform input, .sgb-cform textarea { font-size: 16px; }
  .sgb-cform button { width: 100%; }
}
