/* Blog: hub /blog si paginile de categorie (generate de tools/build-blog.py).
   Se incarca si pe articole, pentru cardurile din „Citeste si”; regulile de layout ale paginii sunt sub .blog-page. */

/* overflow-x: hidden pe body (pages.css) strica position: sticky; clip taie la fel, fara sa creeze container de scroll */
@supports (overflow: clip) {
  body.blog-page { overflow-x: clip; }
}

/* culori pe categorie: --c (accent) si --cbg (fundal deschis) */
.cat-ghiduri-crm { --c: #0072C6; --cbg: #E6F4FC; }
.cat-vanzari { --c: #15803D; --cbg: #ECFDF3; }
.cat-clienti-si-date { --c: #7C3AED; --cbg: #F3F0FF; }
.cat-anaf-e-factura { --c: #B45309; --cbg: #FFF7E6; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---- hero */
.blog-hero { padding: 20px 0 24px; background: #fff; }
.blog-hero-inner { display: flex; align-items: center; gap: 20px; }
.blog-hero h1 { font-size: 40px; font-weight: 800; color: var(--heading); line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 8px; }
.blog-hero h1 .gradient-text { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.blog-intro { font-size: 17px; line-height: 1.55; color: var(--body); max-width: 680px; }
.blog-hero-icon { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; background: var(--cbg); color: var(--c); }
.blog-hero-icon .blog-cover-icon { width: 32px; height: 32px; background: none; box-shadow: none; }

/* ---- bara categorii + cautare, lipita sub navbar */
.blog-toolbar { position: -webkit-sticky; position: sticky; top: 72px; z-index: 50; background: rgba(255,255,255,0.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.blog-toolbar-inner { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.blog-chips { flex: 1 1 auto; min-width: 0; display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: none; }
.blog-chips::-webkit-scrollbar { display: none; }
.blog-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: 100px; background: #fff; color: var(--body); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; transition: border-color 0.15s, color 0.15s, background 0.15s; -webkit-tap-highlight-color: transparent; }
.blog-chip span { font-size: 12px; color: var(--muted); }
.blog-chip.active { background: var(--c, var(--primary)); border-color: var(--c, var(--primary)); color: #fff; }
.blog-chip.active span { color: rgba(255,255,255,0.85); }

.blog-hero-text { flex: 1 1 auto; min-width: 0; }
/* cautarea sta in hero, in dreapta titlului, ca sa se vada */
.blog-search { position: relative; flex: 0 0 380px; }
.blog-search svg { position: absolute; left: 18px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--primary); pointer-events: none; }
/* 16px: sub aceasta marime iOS Safari face zoom la focus */
.blog-search input { width: 100%; height: 54px; padding: 0 18px 0 50px; border: 1.5px solid var(--primary-100); border-radius: 100px; background: #fff; box-shadow: 0 6px 20px rgba(0,114,198,0.10); font: inherit; font-size: 16px; color: var(--heading); -webkit-appearance: none; appearance: none; }
.blog-search input::placeholder { color: #64748B; }
.blog-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50), 0 6px 20px rgba(0,114,198,0.10); }
.blog-search input::-webkit-search-cancel-button { cursor: pointer; }

/* ---- sectiuni */
.blog-section { padding: 48px 0 0; }
.blog-section + .cta-section { margin-top: 48px; }
.blog-h2 { font-size: 24px; font-weight: 800; color: var(--heading); letter-spacing: -0.01em; margin-bottom: 20px; }

/* ---- coperta (din CSS, culoarea categoriei) */
.blog-cover { position: relative; aspect-ratio: 2.1 / 1; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 85% 15%, #fff 0, transparent 45%), linear-gradient(135deg, var(--cbg) 0%, var(--cbg) 35%, #fff 100%); }
.blog-cover::before, .blog-cover::after { content: ''; position: absolute; border-radius: 50%; border: 1.5px solid var(--c); opacity: 0.18; }
.blog-cover::before { width: 70%; aspect-ratio: 1; right: -18%; bottom: -45%; }
.blog-cover::after { width: 40%; aspect-ratio: 1; left: -10%; top: -20%; }
.blog-cover-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: #fff; color: var(--c); box-shadow: 0 6px 16px rgba(15,23,42,0.08); }
.blog-cover-icon svg { width: 28px; height: 28px; }
/* ilustratia articolului (tools/blog_ilustratii.py): umple coperta, culorile vin din --c / --cbg */
.blog-cover.has-ill::before, .blog-cover.has-ill::after { display: none; }
.blog-ill { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.blog-ill text { font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-weight: 800; }
.i-sh { fill: #0F172A; opacity: 0.06; }
.i-p { fill: #fff; stroke: #E2E8F0; stroke-width: 1; }
.i-pw, .i-w { fill: #fff; }
.i-wr { fill: #fff; opacity: 0.7; }
.i-g { fill: #E2E8F0; }
.i-g2 { fill: #CBD5E1; }
.i-a, .i-t { fill: var(--c); }
.i-a2 { fill: var(--c); opacity: 0.45; }
.i-a2o { fill: var(--c); opacity: 0.22; }
.i-a3 { fill: var(--c); opacity: 0.14; }
.i-y { fill: #F59E0B; }
.i-tw { fill: #fff; }
.i-s, .i-as, .i-sl, .i-sd, .i-ws, .i-ring, .i-ring2, .i-ringw, .i-sw, .i-sb { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.i-s { stroke: var(--c); stroke-width: 3.5; }
.i-as { stroke: var(--c); stroke-width: 2; }
.i-sl { stroke: var(--c); stroke-width: 2; opacity: 0.35; stroke-dasharray: 4 6; }
.i-sd { stroke: var(--c); stroke-width: 2; opacity: 0.6; stroke-dasharray: 3 5; }
.i-ws { stroke: #fff; stroke-width: 3; }
.i-ring, .i-ring2 { stroke: var(--c); stroke-width: 2.5; }
.i-ringw { stroke: #fff; stroke-width: 1.5; opacity: 0.6; }
.i-sw { stroke: var(--c); stroke-width: 8; }
.i-sb { stroke: var(--c); stroke-width: 6; }

/* ---- articol principal + Incepe aici */
.blog-top-grid { display: grid; grid-template-columns: 7fr 5fr; gap: 24px; }
.blog-featured { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; transition: box-shadow 0.2s, border-color 0.2s; }
.blog-featured .blog-cover { aspect-ratio: 2.2 / 1; }
.blog-featured .blog-cover-icon { width: 72px; height: 72px; border-radius: 18px; }
.blog-featured .blog-cover-icon svg { width: 36px; height: 36px; }
.blog-featured-body { padding: 22px 24px 24px; }
.blog-featured-title { font-size: 26px; font-weight: 800; line-height: 1.25; color: var(--heading); letter-spacing: -0.01em; margin: 6px 0 8px; }
.blog-featured-title a { color: inherit; text-decoration: none; }
.blog-featured-title a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.blog-featured-body p { font-size: 15px; line-height: 1.6; color: var(--body); }

.blog-start { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; }
.blog-start h2 { font-size: 18px; font-weight: 800; color: var(--heading); margin-bottom: 8px; }
.blog-start ol { list-style: none; padding: 0; margin: 0; }
.blog-start li + li { border-top: 1px solid var(--border); }
.blog-start a { display: flex; align-items: center; gap: 14px; padding: 14px 0; text-decoration: none; color: var(--heading); -webkit-tap-highlight-color: transparent; }
.blog-start-n { flex: 0 0 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); font-size: 14px; font-weight: 700; }
.blog-start-t { flex: 1; font-size: 15px; font-weight: 600; line-height: 1.35; }
.blog-start-m { flex: 0 0 auto; font-size: 13px; color: var(--muted); }

/* ---- grila de carduri */
.blog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.blog-card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s; }
.blog-card-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 18px 20px 20px; }
.blog-card-cat { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--c); }
.blog-card-title { font-size: 17px; font-weight: 700; line-height: 1.35; color: var(--heading); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card-title a { color: inherit; text-decoration: none; }
/* tot cardul e clicabil prin linkul din titlu */
.blog-card-title a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.blog-card-excerpt { flex: 1; font-size: 14px; line-height: 1.55; color: var(--body); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card-meta { font-size: 13px; color: var(--muted); }
/* pe hub, articolul principal e deja sus; reapare in grila doar cand filtrezi */
.blog-grid [data-featured] { display: none; }
.is-filtering .blog-grid [data-featured] { display: flex; }
.is-filtering [data-top] { display: none; }
.blog-card[hidden] { display: none !important; }

.blog-empty { padding: 40px 20px; text-align: center; border: 1px dashed var(--border); border-radius: 14px; background: #fff; }
.blog-empty p { font-size: 15px; color: var(--body); }

/* ---- Citeste si (la finalul articolelor) */
.blog-related { padding: 48px 0; background: var(--bg); border-top: 1px solid var(--border); }
.blog-related-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.blog-related-head h2 { font-size: 24px; font-weight: 800; color: var(--heading); letter-spacing: -0.01em; }
.blog-related-head a { font-size: 14px; font-weight: 600; text-decoration: none; }
@media (hover: hover) { .blog-related-head a:hover { text-decoration: underline; } }

/* ---- unealta CUI */
.blog-resource { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 24px; border-radius: 14px; background: var(--gradient-soft); }
.blog-resource p { font-size: 15px; color: var(--body); }
.blog-resource strong { color: var(--heading); }
.blog-resource .btn { flex: 0 0 auto; }

/* ---- pagini de categorie */
.blog-about { max-width: 760px; }
.blog-about h2 { font-size: 18px; font-weight: 800; color: var(--heading); margin-bottom: 8px; }
.blog-about p { font-size: 15px; line-height: 1.7; color: var(--body); }
.blog-other { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.blog-other-card { display: flex; align-items: center; gap: 14px; padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: 14px; text-decoration: none; transition: border-color 0.2s, box-shadow 0.2s; }
.blog-other-icon { flex: 0 0 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--cbg); color: var(--c); }
.blog-other-icon .blog-cover-icon { width: 24px; height: 24px; background: none; box-shadow: none; }
.blog-other-icon svg { width: 22px; height: 22px; }
.blog-other-card strong { display: block; font-size: 15px; color: var(--heading); }
.blog-other-card small { font-size: 13px; color: var(--muted); }

/* hover doar pe dispozitive cu mouse; pe touch ramane doar :active */
@media (hover: hover) {
  .blog-card:hover, .blog-featured:hover { border-color: var(--c); box-shadow: 0 10px 28px rgba(15,23,42,0.08); }
  .blog-card:hover { transform: translateY(-2px); }
  .blog-card:hover .blog-card-title, .blog-featured:hover .blog-featured-title { color: var(--c); }
  .blog-start a:hover .blog-start-t { color: var(--primary); }
  .blog-chip:hover { border-color: var(--c, var(--primary)); color: var(--c, var(--primary)); }
  .blog-chip.active:hover { color: #fff; }
  .blog-other-card:hover { border-color: var(--c); box-shadow: 0 6px 18px rgba(15,23,42,0.06); }
}
.blog-card:active, .blog-featured:active, .blog-other-card:active { border-color: var(--c); }
.blog-card-title a:focus-visible, .blog-featured-title a:focus-visible { outline: none; }
.blog-card:focus-within, .blog-featured:focus-within { outline: 2px solid var(--c); outline-offset: 2px; }
.blog-chip:focus-visible, .blog-start a:focus-visible, .blog-other-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .blog-card, .blog-featured { transition: none; }
  .blog-card:hover { transform: none; }
}

@media (max-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .blog-top-grid { grid-template-columns: minmax(0, 1fr); }
  .blog-search { flex-basis: 300px; }
}

@media (max-width: 768px) {
  .blog-toolbar { top: 64px; }
  .blog-toolbar-inner { padding-top: 10px; padding-bottom: 10px; }
  .blog-hero-inner { flex-wrap: wrap; }
  .blog-hero-text { flex: 1 1 0; }
  .blog-search { flex: 1 1 100%; }
  .blog-search input { height: 50px; }
  .blog-other { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

@media (max-width: 640px) {
  .blog-page .container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .blog-hero { padding: 12px 0 16px; }
  .blog-hero-inner { gap: 14px; }
  .blog-hero h1 { font-size: 28px; margin-bottom: 4px; }
  .blog-intro { font-size: 15px; }
  .blog-hero-icon { flex-basis: 48px; width: 48px; height: 48px; border-radius: 12px; }
  .blog-hero-icon .blog-cover-icon, .blog-hero-icon svg { width: 24px; height: 24px; }
  .blog-chips { margin: 0 -16px; padding: 0 16px; scroll-padding: 0 16px; }
  .blog-section { padding-top: 28px; }
  .blog-section + .cta-section { margin-top: 32px; }
  .blog-h2 { font-size: 20px; margin-bottom: 14px; }

  .blog-featured .blog-cover { aspect-ratio: 2.4 / 1; }
  .blog-featured .blog-cover-icon { width: 56px; height: 56px; border-radius: 14px; }
  .blog-featured .blog-cover-icon svg { width: 28px; height: 28px; }
  .blog-featured-body { padding: 16px 18px 18px; }
  .blog-featured-title { font-size: 20px; }
  .blog-start { padding: 16px 18px; }
  .blog-start a { padding: 12px 0; }

  /* card orizontal compact: coperta mica la stanga, fara rezumat */
  .blog-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .blog-card { flex-direction: row; align-items: center; }
  .blog-card .blog-cover { flex: 0 0 76px; width: 76px; height: 76px; aspect-ratio: auto; margin: 12px 0 12px 12px; border-radius: 12px; }
  .blog-card .blog-cover::before, .blog-card .blog-cover::after { display: none; }
  .blog-card .blog-cover-icon { width: 36px; height: 36px; border-radius: 10px; box-shadow: none; }
  .blog-card .blog-cover-icon svg { width: 20px; height: 20px; }
  .blog-card-body { padding: 12px 14px; gap: 4px; }
  .blog-card-cat { font-size: 11px; }
  .blog-card-title { font-size: 15px; }
  .blog-card-excerpt { display: none; }
  .blog-card-meta { font-size: 12px; }

  .blog-resource { flex-direction: column; align-items: stretch; padding: 18px; }
  .blog-related { padding: 32px 0; }
  .blog-related-head h2 { font-size: 20px; }
  .blog-resource .btn { text-align: center; }
}
