/* Blog styles for hamzakhalil.pk — matches the site's dark theme */
.blog {
  --bg: #07090e;
  --surface: #0e131f;
  --surface-border: #243044;
  --text: #f8fafc;
  --text-muted: #a8b5c8;
  --accent: #38bdf8;
  --success: #10b981;
  --font-mono: ui-monospace, monospace;
}

/* ---------- Listing cards ---------- */
.post-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.post-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--surface-border);
}
.post-card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.post-tag {
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 700;
}
.post-card h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.4;
}
.post-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  flex: 1;
}
.post-readmore {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ---------- Article ---------- */
.blog-article {
  max-width: 780px;
  margin: 0 auto;
}
.blog-article .post-meta {
  margin: 18px 0 8px;
  font-size: 0.85rem;
}
.blog-hero-img {
  width: 100%;
  border-radius: 20px;
  border: 1px solid var(--surface-border);
  margin: 26px 0 8px;
  display: block;
}
.blog-article h2 {
  margin: 44px 0 14px;
  font-size: 1.5rem;
  line-height: 1.35;
}
.blog-article h3 {
  margin: 32px 0 10px;
  font-size: 1.15rem;
}
.blog-article p,
.blog-article li {
  color: #dbe4f0;
  line-height: 1.75;
  font-size: 1.02rem;
}
.blog-article ul,
.blog-article ol {
  padding-left: 22px;
  display: grid;
  gap: 10px;
  margin: 16px 0;
}
.blog-article a {
  color: var(--accent);
}
.blog-article blockquote {
  margin: 28px 0;
  padding: 18px 22px;
  border-left: 3px solid var(--success);
  background: rgba(16, 185, 129, 0.06);
  border-radius: 0 14px 14px 0;
  color: var(--text);
}
.blog-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
}
.blog-article th,
.blog-article td {
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--surface-border);
}
.blog-article th {
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.blog-article td {
  color: #dbe4f0;
}
.blog-cta {
  margin: 52px 0 10px;
  padding: 34px 30px;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.07) 0%, var(--surface) 100%);
  text-align: center;
}
.blog-cta h2 {
  margin: 0 0 10px;
  font-size: 1.4rem;
}
.blog-cta p {
  color: var(--text-muted);
  margin: 0 0 20px;
}
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 40px 0 10px;
  flex-wrap: wrap;
}
.post-nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

/* ---------- Listing: featured layout + tag filter ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 10px;
}
/* Newest (first visible) card becomes the featured story */
.blog-grid .post-card.is-featured {
  grid-column: 1 / -1;
  flex-direction: row;
}
.blog-grid .post-card.is-featured img {
  width: 46%;
  aspect-ratio: 16 / 10;
  border-bottom: none;
  border-right: 1px solid var(--surface-border);
}
.blog-grid .post-card.is-featured .post-card-body {
  padding: 36px;
  justify-content: center;
}
.blog-grid .post-card.is-featured h2 {
  font-size: 1.7rem;
}
.post-card img {
  transition: transform 0.35s ease;
}
.post-card:hover img {
  transform: scale(1.04);
}
.post-latest {
  color: #07111b !important;
  background: var(--success) !important;
}
.blog-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 4px;
}
.blog-filter button {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.blog-filter button:hover {
  color: var(--text);
  border-color: var(--accent);
}
.blog-filter button.active {
  color: #07111b;
  background: var(--success);
  border-color: var(--success);
  font-weight: 700;
}
.blog-empty {
  color: var(--text-muted);
  padding: 30px 0;
}
@media (max-width: 760px) {
  .blog-grid .post-card.is-featured {
    flex-direction: column;
  }
  .blog-grid .post-card.is-featured img {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--surface-border);
  }
  .blog-grid .post-card.is-featured .post-card-body {
    padding: 24px;
  }
  .blog-grid .post-card.is-featured h2 {
    font-size: 1.35rem;
  }
}

/* ---------- Blog hero + toolbar (v2) ---------- */
.blog .page-title {
  background: linear-gradient(115deg, #f8fafc 20%, #38bdf8 62%, #10b981 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.blog-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 32px 0 2px;
}
.blog-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 220px;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 10px 18px;
  transition: border-color 0.2s ease;
}
.blog-search:focus-within {
  border-color: var(--accent);
}
.blog-search svg {
  width: 17px;
  height: 17px;
  fill: var(--text-muted);
  flex: none;
}
.blog-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
}
.blog-search input::placeholder {
  color: var(--text-muted);
}
.blog-search input::-webkit-search-cancel-button {
  cursor: pointer;
}
.blog-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}
.blog-empty {
  color: var(--text-muted);
  padding: 34px 0;
  text-align: center;
}


/* Editorial layout polish */
.blog{
  width:min(1120px,calc(100% - 40px));
  margin:0 auto;
  padding:54px 0 88px;
  color:#f8fafc;
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
}
.blog .page-header{
  position:relative;
  overflow:hidden;
  margin:0 0 30px;
  padding:clamp(30px,6vw,62px);
  border:1px solid rgba(56,189,248,.18);
  border-radius:28px;
  background:
    radial-gradient(ellipse at 86% 12%,rgba(16,185,129,.13),transparent 34%),
    radial-gradient(ellipse at 4% 100%,rgba(56,189,248,.12),transparent 40%),
    linear-gradient(145deg,#101827 0%,#0b111c 72%);
  box-shadow:0 24px 70px rgba(0,0,0,.24);
}
.blog .page-header::after{
  content:"";
  position:absolute;
  top:0;
  right:0;
  width:220px;
  height:3px;
  background:linear-gradient(90deg,transparent,#38bdf8,#10b981);
}
.blog .section-tag{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin:0 0 16px;
  color:#7dd3fc;
  font:700 .76rem/1.4 ui-monospace,SFMono-Regular,monospace;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.blog .section-tag::before{
  content:"";
  width:7px;
  height:7px;
  border-radius:50%;
  background:#10b981;
  box-shadow:0 0 14px rgba(16,185,129,.7);
}
.blog .page-title{
  max-width:850px;
  margin:0;
  font-size:clamp(2.1rem,5.3vw,4rem);
  line-height:1.08;
  letter-spacing:-.055em;
  text-wrap:balance;
}
.blog .page-desc{
  max-width:680px;
  margin:18px 0 0;
  color:#a8b5c8;
  font-size:clamp(1rem,1.6vw,1.12rem);
  line-height:1.75;
}
.blog-toolbar{
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin:0 0 18px;
}
.blog-search{
  min-height:50px;
  max-width:520px;
  padding:0 18px;
  border-radius:14px;
  background:rgba(14,19,31,.9);
  border-color:#263449;
  box-shadow:inset 0 1px rgba(255,255,255,.025);
}
.blog-search:focus-within{
  border-color:#38bdf8;
  box-shadow:0 0 0 3px rgba(56,189,248,.12);
}
.blog-search input{min-height:46px}
.blog-count{
  margin-left:auto;
  padding:8px 12px;
  border:1px solid #243044;
  border-radius:999px;
  background:#0e131f;
}
.blog-filter{margin:8px 0 22px}
.blog-filter button{min-height:40px}
.blog-filter button.active{box-shadow:0 5px 20px rgba(16,185,129,.2)}
.blog-grid{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));
  gap:22px;
  margin-top:0;
}
.blog-grid .post-card{
  min-width:0;
  border:1px solid #243044;
  border-radius:24px;
  background:linear-gradient(155deg,rgba(17,26,41,.98),rgba(11,16,26,.98));
  box-shadow:0 16px 42px rgba(0,0,0,.2);
  transition:transform .22s ease,border-color .22s ease,box-shadow .22s ease;
}
.blog-grid .post-card:hover{
  transform:translateY(-4px);
  border-color:rgba(56,189,248,.55);
  box-shadow:0 22px 54px rgba(0,0,0,.34);
}
.blog-grid .post-card:focus-visible{
  outline:3px solid #38bdf8;
  outline-offset:4px;
}
.blog-grid .post-card img{
  aspect-ratio:16/9;
  object-fit:cover;
  border:0;
}
.blog-grid .post-card.is-featured{
  min-height:350px;
  border-color:rgba(56,189,248,.28);
  background:
    radial-gradient(ellipse at 100% 0%,rgba(56,189,248,.08),transparent 45%),
    linear-gradient(145deg,#111b2b,#0d131f);
}
.blog-grid .post-card.is-featured img{
  width:44%;
  min-height:350px;
  aspect-ratio:auto;
  border:0;
  object-fit:cover;
}
.blog-grid .post-card.is-featured .post-card-body{
  padding:clamp(26px,4vw,48px);
  gap:17px;
}
.blog-grid .post-card.is-featured h2{
  max-width:580px;
  font-size:clamp(1.55rem,3.1vw,2.35rem);
  line-height:1.2;
  letter-spacing:-.035em;
}
.blog-grid .post-card h2{color:#f8fafc}
.blog-grid .post-card p{color:#a8b5c8;line-height:1.75}
.blog-grid .post-meta{gap:9px;font-size:.72rem}
.blog-grid .post-tag{
  color:#8ce6bf;
  background:rgba(16,185,129,.12);
  border:1px solid rgba(16,185,129,.18);
}
.blog-grid .post-latest{
  color:#07111b!important;
  background:#10b981!important;
  border-color:#10b981;
}
.blog-grid .post-readmore{
  display:inline-flex;
  align-items:center;
  gap:7px;
  margin-top:4px;
  color:#7dd3fc;
}
.blog-empty{
  padding:42px 24px;
  border:1px dashed #334155;
  border-radius:18px;
  background:rgba(14,19,31,.55);
  text-align:center;
}
.blog-article{
  max-width:820px;
}
.blog-article .page-header{
  margin-bottom:24px;
  padding:clamp(26px,5vw,52px);
}
.blog-article .page-title{
  font-size:clamp(2rem,4.8vw,3.4rem);
}
.blog-article .post-meta{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  color:#a8b5c8;
}
.blog-hero-img{
  margin:0 0 32px;
  border-radius:22px;
  aspect-ratio:16/9;
  object-fit:cover;
}
.blog-article > p,
.blog-article > ul,
.blog-article > ol,
.blog-article > blockquote,
.blog-article > table{
  max-width:760px;
  margin-right:auto;
  margin-left:auto;
}
.blog-article > p{
  margin-top:0;
  margin-bottom:22px;
  color:#cbd5e1;
  font-size:1.06rem;
  line-height:1.85;
}
.blog-article h2{
  max-width:760px;
  margin:48px auto 16px;
  color:#f8fafc;
  font-size:clamp(1.45rem,3.2vw,1.9rem);
  letter-spacing:-.025em;
}
.blog-article h3{
  max-width:760px;
  margin:32px auto 12px;
  color:#e2e8f0;
}
.blog-article > ul,
.blog-article > ol{
  padding-left:24px;
  color:#cbd5e1;
  line-height:1.8;
}
.blog-article strong{color:#f8fafc}
.blog-article blockquote{
  border-left-color:#38bdf8;
  background:linear-gradient(110deg,rgba(56,189,248,.08),rgba(14,19,31,.7));
}
.blog-article table{
  display:block;
  max-width:100%;
  overflow-x:auto;
  border-radius:12px;
}
.blog-article th{color:#7dd3fc}
.blog-cta{
  padding:clamp(24px,5vw,42px);
  border-color:rgba(56,189,248,.3);
  background:
    radial-gradient(ellipse at 50% 0%,rgba(56,189,248,.1),transparent 62%),
    #0e131f;
}
.blog-cta .btn{min-height:48px}
.post-nav a{
  display:inline-flex;
  min-height:44px;
  align-items:center;
  padding:10px 14px;
  border:1px solid #243044;
  border-radius:12px;
  background:#0e131f;
}
@media(max-width:760px){
  .blog{width:calc(100% - 32px);padding:34px 0 72px}
  .blog .page-header{margin-bottom:22px;border-radius:22px}
  .blog .page-title{font-size:clamp(2rem,9vw,2.8rem)}
  .blog-toolbar{align-items:stretch;margin-bottom:14px}
  .blog-search{width:100%;max-width:none;flex:1 1 100%}
  .blog-count{align-self:flex-end;margin:0}
  .blog-grid{grid-template-columns:minmax(0,1fr);gap:16px}
  .blog-grid .post-card.is-featured{min-height:0;flex-direction:column}
  .blog-grid .post-card.is-featured img{width:100%;min-height:0;aspect-ratio:16/9;border:0}
  .blog-grid .post-card.is-featured .post-card-body{padding:22px;gap:14px}
  .blog-grid .post-card.is-featured h2{font-size:1.55rem}
  .blog-grid .post-card-body{padding:20px}
  .blog-article .page-header{padding:26px 22px}
  .blog-article .post-meta{font-size:.78rem}
  .blog-hero-img{margin:0 0 24px;border-radius:16px}
  .blog-article > p{font-size:1rem;line-height:1.8}
  .blog-article h2{margin-top:38px}
  .blog-article th,.blog-article td{padding:10px 12px}
}
@media(prefers-reduced-motion:reduce){
  .blog-grid .post-card{transition:none}
  .blog-grid .post-card:hover{transform:none}
}


/* Article call to action */
.blog-cta{
  position:relative;
  isolation:isolate;
  overflow:hidden;
  margin-top:56px;
  padding:clamp(30px,6vw,54px) clamp(22px,5vw,44px);
  border:1px solid rgba(56,189,248,.34);
  border-radius:26px;
  background:
    radial-gradient(ellipse at 50% 0%,rgba(56,189,248,.14),transparent 58%),
    radial-gradient(ellipse at 100% 100%,rgba(16,185,129,.09),transparent 50%),
    linear-gradient(145deg,#111b2b 0%,#0b111c 76%);
  box-shadow:0 22px 56px rgba(0,0,0,.3),inset 0 1px rgba(255,255,255,.035);
}
.blog-cta::before{
  content:"";
  position:absolute;
  z-index:-1;
  top:0;
  left:50%;
  width:min(420px,72%);
  height:2px;
  transform:translateX(-50%);
  background:linear-gradient(90deg,transparent,#38bdf8,#10b981,transparent);
}
.blog-cta h2{
  margin:0 0 14px;
  color:#f8fafc;
  font-size:clamp(1.55rem,3.6vw,2.15rem);
  line-height:1.2;
  letter-spacing:-.035em;
  text-wrap:balance;
}
.blog-cta p{
  max-width:640px;
  margin:0 auto 26px;
  color:#b5c1d1;
  font-size:1.02rem;
  line-height:1.75;
}
.blog-cta button.btn,
.blog-cta .btn-primary{
  appearance:none;
  display:inline-flex;
  min-height:52px;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:13px 24px;
  border:1px solid rgba(125,211,252,.55);
  border-radius:13px;
  background:linear-gradient(135deg,#38bdf8 0%,#7dd3fc 100%);
  color:#07111b!important;
  font:750 .98rem/1.2 system-ui,-apple-system,"Segoe UI",sans-serif;
  text-decoration:none;
  box-shadow:0 10px 26px rgba(56,189,248,.22),inset 0 1px rgba(255,255,255,.45);
  cursor:pointer;
  transition:transform .18s ease,box-shadow .18s ease,filter .18s ease;
}
.blog-cta button.btn:hover,
.blog-cta .btn-primary:hover{
  transform:translateY(-2px);
  filter:brightness(1.06);
  box-shadow:0 14px 32px rgba(56,189,248,.3),inset 0 1px rgba(255,255,255,.5);
}
.blog-cta button.btn:active,
.blog-cta .btn-primary:active{transform:translateY(0)}
.blog-cta button.btn:focus-visible,
.blog-cta .btn-primary:focus-visible{
  outline:3px solid #f8fafc;
  outline-offset:4px;
}
@media(max-width:760px){
  .blog-cta{margin-top:42px;padding:30px 20px;border-radius:22px}
  .blog-cta p{font-size:.98rem;margin-bottom:22px}
  .blog-cta button.btn,
  .blog-cta .btn-primary{width:100%;max-width:360px;min-height:54px;padding:14px 18px}
}
@media(prefers-reduced-motion:reduce){
  .blog-cta button.btn,.blog-cta .btn-primary{transition:none}
  .blog-cta button.btn:hover,.blog-cta .btn-primary:hover{transform:none}
}


/* Related articles at the end of each blog post */
.related-posts{
  margin:56px 0 34px;
  padding:38px 0 0;
  border-top:1px solid #243044;
}
.related-posts>h2{
  margin:0 0 8px;
  color:#f8fafc;
  font-size:clamp(1.45rem,3vw,1.8rem);
  line-height:1.25;
  letter-spacing:-.03em;
}
.related-posts-intro{
  margin:0 0 22px;
  color:#a8b5c8;
  line-height:1.65;
}
.related-post-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));
  gap:16px;
}
.related-post-card{
  min-width:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  border:1px solid #243044;
  border-radius:18px;
  color:inherit;
  text-decoration:none;
  background:linear-gradient(155deg,#111a29,#0b101a);
  box-shadow:0 12px 30px rgba(0,0,0,.18);
  transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease;
}
.related-post-card:hover{
  transform:translateY(-3px);
  border-color:rgba(56,189,248,.5);
  box-shadow:0 18px 38px rgba(0,0,0,.28);
}
.related-post-card:focus-visible{
  outline:3px solid #38bdf8;
  outline-offset:4px;
}
.related-post-card>img{
  display:block;
  width:100%;
  height:auto;
  aspect-ratio:16/9;
  object-fit:cover;
  border-bottom:1px solid #243044;
}
.related-post-card-body{
  display:flex;
  flex:1;
  flex-direction:column;
  align-items:flex-start;
  gap:10px;
  padding:17px;
}
.related-post-meta{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:7px;
  color:#a8b5c8;
  font: .68rem/1.45 ui-monospace,SFMono-Regular,monospace;
}
.related-post-tag{
  padding:3px 8px;
  border:1px solid rgba(16,185,129,.2);
  border-radius:999px;
  color:#8ce6bf;
  background:rgba(16,185,129,.1);
  font-weight:700;
}
.related-post-card h3{
  margin:0;
  color:#f8fafc;
  font-size:1rem;
  line-height:1.4;
  letter-spacing:-.015em;
}
.related-post-card p{
  display:-webkit-box;
  overflow:hidden;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:3;
  margin:0;
  color:#a8b5c8;
  font-size:.88rem;
  line-height:1.65;
}
.related-post-read{
  margin-top:auto;
  padding-top:4px;
  color:#7dd3fc;
  font-size:.84rem;
  font-weight:750;
}
@media(max-width:760px){
  .related-posts{margin-top:42px;padding-top:28px}
  .related-post-grid{grid-template-columns:minmax(0,1fr);gap:14px}
  .related-post-card{display:flex;flex-direction:column;align-items:stretch}
  .related-post-card>img{width:100%;height:auto;min-height:0;aspect-ratio:16/9;object-fit:cover;border:0;border-bottom:1px solid #243044}
  .related-post-card-body{gap:8px;padding:14px}
  .related-post-card h3{font-size:.95rem}
}
@media(prefers-reduced-motion:reduce){
  .related-post-card{transition:none}
  .related-post-card:hover{transform:none}
}


/* Keep wide comparison tables readable on narrow screens without stretching the page. */
.blog-article .table-scroll{width:100%;max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain;margin:24px 0;-webkit-overflow-scrolling:touch}
.blog-article .table-scroll table{width:100%;min-width:560px;margin:0}

/* Reserve the article hero image space before it finishes loading. */
.blog-hero-img{aspect-ratio:16/9;object-fit:cover}


/* Give the text contrast checker and users an explicit dark page canvas. */
body{background-color:#07090e}


/* Prevent native image height attributes from stretching listing thumbnails. */
.blog-grid .post-card img {
  height: auto;
  aspect-ratio: 16 / 9;
}
.blog-grid .post-card.is-featured img {
  height: auto;
  max-height: 460px;
}
@media (max-width: 760px) {
  .blog-grid .post-card.is-featured img {
    max-height: none;
  }
}


/* Article feature images: preserve the full source image on every screen. */
.blog-article > .blog-hero-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center;
  background: #0e131f;
}
