/* Alien Keyboard website: the blog (BLOG). Loaded only on /blog/ pages, after styles.css, ak-core.css and
   rtl.css. Uses the site's tokens (colours, radius, gutter, fonts) from styles.css; no external files.
   Left/right are written as logical properties (inline-start/end), so Urdu pages mirror by themselves. */

/* ---------- Shared ---------- */
.blog .icon-back { transform: scaleX(-1); }
[dir="rtl"] .blog .icon-back { transform: none; }
[dir="rtl"] .blog .icon-fwd { transform: scaleX(-1); }

.crumbs { margin-bottom: clamp(22px, 3vw, 34px); font-size: .9rem; color: var(--dim); }
/* one line: the current page's title shrinks with an ellipsis instead of wrapping */
.crumbs ol { display: flex; flex-wrap: nowrap; align-items: center; list-style: none; }
.crumbs li { display: flex; align-items: center; flex: none; }
.crumbs li:last-child { flex: 0 1 auto; min-width: 0; }
.crumbs li + li::before { content: "/"; flex: none; margin-inline: 10px; color: color-mix(in srgb, var(--dim) 55%, transparent); }
.crumbs a { color: var(--dim); text-decoration: none; display: inline-flex; align-items: center; min-height: 32px; }
.crumbs a:hover { color: var(--brand-ink); text-decoration: underline; }
.crumbs [aria-current] { display: block; min-width: 0; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .88rem; color: var(--dim); }
.post-meta-sep { color: color-mix(in srgb, var(--dim) 60%, transparent); }

/* ---------- The list page ---------- */
.blog-top { padding-top: clamp(28px, 4vw, 48px); }
.blog-head { margin-bottom: clamp(28px, 4vw, 44px); }
.blog-head h1 { font-size: clamp(2.1rem, 1.45rem + 2.9vw, 3.6rem); }
.blog-pageno { margin-top: 12px; font-weight: 600; color: var(--brand-ink); }

.post-grid { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.2vw, 28px); }
.post-grid > li { display: flex; min-width: 0; }
@media (max-width: 980px) { .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .post-grid { grid-template-columns: minmax(0, 1fr); } }

.post-card {
  position: relative; display: flex; flex-direction: column; width: 100%;
  background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius); overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 35%, var(--edge)); }
.post-card-cover { aspect-ratio: 4 / 3; background: var(--surface-2); border-bottom: 1px solid var(--edge); overflow: hidden; }
.post-card-cover picture { display: contents; }
.post-card-cover img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.post-card-cover.is-empty {
  display: grid; place-items: center;
  background: radial-gradient(70% 90% at 50% 0%, rgba(63, 182, 206, 0.28), transparent 70%), linear-gradient(160deg, #006078, #003e4e);
}
.post-card-mark { width: 64px; height: 64px; color: #ffffff; opacity: .92; }
.post-card-body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 20px 22px 22px; }
.post-card-title { font-size: clamp(1.16rem, 1.05rem + .45vw, 1.38rem); line-height: 1.25; letter-spacing: -0.015em; }
.post-card-title a { color: var(--text); text-decoration: none; }
.post-card-title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.post-card:hover .post-card-title a { color: var(--brand-ink); }
.post-card-title a:focus-visible { outline: none; }
.post-card-title a:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 3px; }
.post-card-excerpt {
  color: var(--dim); font-size: .97rem;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden;
}
.post-card-more { margin-top: auto; padding-top: 6px; display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: .95rem; color: var(--brand-ink); }
.post-card-more .icon { width: 1em; height: 1em; transition: translate .15s ease; }
.post-card:hover .post-card-more .icon { translate: 3px 0; }
[dir="rtl"] .post-card:hover .post-card-more .icon { translate: -3px 0; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin-top: clamp(28px, 4vw, 44px); }
.pager-status { color: var(--dim); font-size: .95rem; margin-inline: auto; }
.pager-link { border: 1px solid var(--edge); background: var(--surface); color: var(--text); font-weight: 600; }
.pager-link:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--edge)); color: var(--brand-ink); }
.pager-link .icon { width: 1.05em; height: 1.05em; }
.pager-newer { order: -1; }
.pager-older { order: 1; }

.blog-empty { display: grid; justify-items: start; gap: 18px; padding: clamp(24px, 4vw, 40px); border: 1px dashed var(--edge); border-radius: var(--radius); background: var(--surface); }
.blog-empty p { color: var(--dim); }

.blog-feed { margin-top: clamp(24px, 3vw, 36px); font-size: .9rem; }
.blog-feed a { color: var(--dim); }
.blog-feed a:hover { color: var(--brand-ink); }

/* ---------- The article ---------- */
.post-wrap { max-width: calc(780px + 2 * var(--gutter)); }
.post { padding-block: clamp(28px, 4vw, 48px) 0; }
.post-head .post-meta { margin-bottom: 14px; }
.post-head h1 { font-size: clamp(2rem, 1.3rem + 2.7vw, 3.15rem); line-height: 1.08; }
.post-lead { max-width: none; }
.post-langs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; font-size: .92rem; color: var(--dim); }
.post-langs a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 4px 14px; border-radius: 999px;
  border: 1px solid var(--edge); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none;
}
.post-langs a:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--edge)); color: var(--brand-ink); }
.post-langs a[lang="ur"] { font-family: var(--font-ur-keys); letter-spacing: 0; }

.post-cover {
  margin: clamp(26px, 4vw, 40px) 0 0; display: flex; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--edge); border-radius: var(--radius); overflow: hidden;
}
.post-cover picture { display: contents; }
.post-cover img { width: auto; max-width: 100%; height: auto; max-height: min(64vh, 560px); object-fit: contain; }

/* Reading text: a comfortable line length and rhythm */
.prose { margin-top: clamp(28px, 4vw, 44px); font-size: clamp(1.04rem, 0.99rem + 0.25vw, 1.15rem); line-height: 1.75; overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.95rem); line-height: 1.2; margin-top: 1.9em; letter-spacing: -0.02em; }
.prose h3 { font-size: clamp(1.2rem, 1.1rem + .5vw, 1.45rem); line-height: 1.25; margin-top: 1.7em; letter-spacing: -0.015em; }
.prose h4 { font-size: 1.08rem; margin-top: 1.5em; letter-spacing: -0.01em; }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: .6em; }
.prose ul, .prose ol { padding-inline-start: 1.5em; }
.prose li { padding-inline-start: .2em; }
.prose li + li, .prose li > ul, .prose li > ol { margin-top: .45em; }
.prose li > p + p { margin-top: .7em; }
.prose li::marker { color: var(--brand-ink); font-weight: 700; }
.prose a { font-weight: 550; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose strong { font-weight: 700; }
.prose blockquote {
  margin-inline: 0; padding: 14px 20px; background: var(--surface); border: 1px solid var(--edge);
  border-inline-start: 4px solid var(--accent); border-radius: 12px; color: var(--text);
}
.prose blockquote > * + * { margin-top: .7em; }
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: .88em;
  background: var(--surface-2); border: 1px solid var(--edge); border-radius: 6px; padding: .08em .35em;
}
.prose pre {
  direction: ltr; text-align: left; overflow-x: auto; padding: 16px 18px; line-height: 1.55;
  background: var(--surface-2); border: 1px solid var(--edge); border-radius: 12px;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: .9rem; }
.prose hr { border: 0; height: 1px; background: var(--edge); margin-block: 2.2em; }
.prose img { height: auto; border-radius: 12px; }
.prose figure { margin-inline: 0; }
.prose figure img { margin-inline: auto; border: 1px solid var(--edge); }
.prose figcaption { margin-top: 10px; font-size: .9rem; color: var(--dim); text-align: center; }

/* ---------- Download box ---------- */
.blog-cta { padding-bottom: var(--section-y); }
.blog-cta:not(.blog-cta-wide) { padding-top: clamp(40px, 6vw, 64px); padding-bottom: 0; }
.blog-cta:not(.blog-cta-wide) .cta-card { padding: clamp(30px, 5vw, 52px) clamp(18px, 4vw, 44px); border-radius: 26px; }
.blog-cta:not(.blog-cta-wide) h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.15rem); }
.blog-cta:not(.blog-cta-wide) .cta-icon { width: 64px; margin-bottom: 16px; }
.blog-cta:not(.blog-cta-wide) .store-row { margin-top: 22px; }

/* ---------- After the article ---------- */
.post-after { padding-block: clamp(28px, 4vw, 44px) var(--section-y); }
.post-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.post-nav-link {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 20px; min-height: 44px;
  border: 1px solid var(--edge); border-radius: 16px; background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.post-nav-link:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--edge)); box-shadow: var(--shadow); }
.post-nav-next { grid-column: 2; text-align: end; align-items: flex-end; }
.post-nav-label { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-ink); }
.post-nav-label .icon { width: 1.1em; height: 1.1em; }
.post-nav-title { font-weight: 650; line-height: 1.35; }
.post-all { margin-top: 22px; }
.post-all a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; text-decoration: none; }
.post-all a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .post-nav { grid-template-columns: minmax(0, 1fr); }
  .post-nav-next { grid-column: auto; }
}

/* ---------- Urdu: Nastaliq needs more room above and below each line ---------- */
html[lang="ur"] .blog { font-family: var(--font-ur); }
html[lang="ur"] .blog h1, html[lang="ur"] .blog h2, html[lang="ur"] .blog h3, html[lang="ur"] .blog h4 { letter-spacing: 0; line-height: 1.85; }
html[lang="ur"] .blog h1 { line-height: 2.05; }
html[lang="ur"] .post-lead { margin-top: 10px; }
html[lang="ur"] .blog-head h1 { font-size: clamp(1.8rem, 1.3rem + 2.2vw, 2.9rem); }
html[lang="ur"] .post-head h1 { font-size: clamp(1.7rem, 1.25rem + 2vw, 2.6rem); }
html[lang="ur"] .blog .lead { line-height: 2; }
html[lang="ur"] .blog .eyebrow, html[lang="ur"] .post-nav-label { letter-spacing: 0; text-transform: none; font-size: .95rem; }
html[lang="ur"] .prose { font-size: clamp(1.1rem, 1.04rem + .3vw, 1.24rem); line-height: 2.15; }
html[lang="ur"] .prose h2 { font-size: clamp(1.35rem, 1.15rem + .9vw, 1.75rem); }
html[lang="ur"] .prose h3 { font-size: clamp(1.18rem, 1.08rem + .5vw, 1.4rem); }
html[lang="ur"] .post-card-title { font-size: clamp(1.1rem, 1rem + .4vw, 1.28rem); line-height: 1.95; }
html[lang="ur"] .post-card-excerpt { line-height: 2; }
html[lang="ur"] .post-meta, html[lang="ur"] .crumbs { line-height: 2; }
html[lang="ur"] .blog-cta h2 { line-height: 1.7; }
html[lang="ur"] .prose blockquote { border-radius: 12px; }
html[lang="ur"] .prose code, html[lang="ur"] .prose pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- Motion and print ---------- */
@media (prefers-reduced-motion: reduce) {
  .post-card, .post-card:hover { transform: none; }
  .post-card:hover .post-card-more .icon { translate: none; }
}
@media print {
  .blog-cta, .post-nav, .post-all, .pager, .blog-feed, .crumbs { display: none; }
  .post-card { break-inside: avoid; }
  .prose a::after { content: " (" attr(href) ")"; font-size: .85em; color: var(--dim); }
}

/* styles.css ("Laptop screens", from 1100px wide and 600px tall) tightens every .section to a screen and
   snaps sections under the header. That is for the home page: the blog keeps its own spacing and never snaps. */
@media (min-width: 1100px) and (min-height: 600px) {
  .blog-top { padding-bottom: var(--section-y); }
  .blog-cta-wide { padding-top: var(--section-y); }
}
.blog-top, .blog-cta { scroll-snap-align: none; }
