/* The blog (/blog and every post under templates/blog/) in the homepage
   look: the same tokens as static/css/marketing.css, Inter, the lavender
   background, white cards with the homepage's corners, purple buttons and
   the yellow underline accent. Mobile first.

   blog/_post_base.html loads this file on every post and blog/index.html
   loads it on the index. The pages' own <style> blocks come after this
   file, so every rule starts with "body" to win over them. The posts'
   in-body boxes that are styled inline (the "Ready to create your QR
   code?" box, its button, the tables) are matched by those inline styles
   and restyled with !important. Only the look changes: no text, link or
   heading is added or removed by this file. */

:root {
  --mk-purple: #4F46E5;
  --mk-purple-dark: #4338CA;
  --mk-purple-soft: #EEF2FF;
  --mk-bg: #F7F6FF;
  --mk-bg-alt: #EFEDFC;
  --mk-ink: #16133A;
  --mk-yellow: #FBBF24;
  --mk-muted: #4B4A63;
  --mk-line: #E4E1F5;
  --mk-card: #FFFFFF;
  --mk-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body { background: var(--mk-bg); }
body main#main-content { font-family: var(--mk-font); color: var(--mk-ink); }
body main#main-content :focus-visible { outline: 3px solid var(--mk-purple); outline-offset: 3px; border-radius: 6px; }

/* ── Post: the column ── */
body .post-wrap { max-width: 760px; margin: 0 auto; padding: 36px 20px 64px; overflow-wrap: break-word; }

body .post-tag {
  display: inline-block; font: 800 14px/1.3 var(--mk-font); letter-spacing: .02em; text-transform: none;
  color: var(--mk-ink); background: var(--mk-yellow); padding: 4px 12px; border-radius: 999px; margin-bottom: 16px;
}
body .post-wrap h1 {
  font-family: var(--mk-font); font-weight: 900; letter-spacing: -.03em; line-height: 1.06;
  font-size: clamp(32px, 8.4vw, 52px); color: var(--mk-ink); margin: 0 0 14px; text-wrap: balance;
}
/* The homepage's yellow underline accent, as a short bar under the title. */
body .post-wrap h1::after {
  content: ""; display: block; width: 72px; height: 6px; margin-top: 16px; border-radius: 3px; background: var(--mk-yellow);
}
body .post-subtitle { font-size: 19px; line-height: 1.55; color: var(--mk-muted); margin: 0 0 14px; text-wrap: pretty; }
body .post-meta { font-size: 16px; color: var(--mk-muted); margin-bottom: 32px; text-wrap: pretty; }

/* ── Post: the text ── */
body .post-body { font-family: var(--mk-font); font-size: 18px; line-height: 1.7; color: var(--mk-muted); }
body .post-body p, body .post-body li { text-wrap: pretty; }
body .post-body p { margin: 0 0 22px; }
body .post-body strong { color: var(--mk-ink); }
body .post-body h2 {
  font-family: var(--mk-font); font-weight: 900; letter-spacing: -.025em; line-height: 1.12;
  font-size: clamp(26px, 6.2vw, 34px); color: var(--mk-ink); margin: 48px 0 16px; text-wrap: balance;
}
body .post-body h3 {
  font-family: var(--mk-font); font-weight: 800; letter-spacing: -.01em; line-height: 1.25;
  font-size: 21px; color: var(--mk-ink); margin: 32px 0 10px; text-wrap: balance;
}
body .post-body ul, body .post-body ol { padding-left: 24px; margin: 0 0 24px; }
body .post-body li { margin-bottom: 8px; }
body .post-body a:not([class]):not([style]) {
  color: var(--mk-purple); font-weight: 700; text-decoration: underline; text-decoration-color: var(--mk-yellow);
  text-decoration-thickness: 3px; text-underline-offset: 4px;
}
body .post-body a:not([class]):not([style]):hover { color: var(--mk-purple-dark); }
body .post-body code { background: var(--mk-purple-soft); color: var(--mk-ink); border-radius: 6px; padding: 1px 6px; font-size: .9em; }
body .post-snippet {
  background: var(--mk-card); border: 1px solid var(--mk-line); border-left: 6px solid var(--mk-yellow);
  border-radius: 18px; padding: 20px 22px; color: var(--mk-ink) !important;
}

/* ── Post: tables (wrapped in an overflow box inline) ── */
body .post-body [style*="overflow-x:auto"] {
  background: var(--mk-card); border: 1px solid var(--mk-line); border-radius: 18px; margin: 32px 0 !important;
  -webkit-overflow-scrolling: touch;
}
body .post-body table { border-collapse: collapse; font-family: var(--mk-font); color: var(--mk-ink); }
body .post-body th, body .post-body td { vertical-align: top; }
body .post-body th[style*="padding:10px 12px"], body .post-body td[style*="padding:10px 12px"] { padding: 10px 8px !important; }
body .post-body th[style*="padding:10px 12px"]:first-child, body .post-body td[style*="padding:10px 12px"]:first-child { padding-left: 14px !important; }
/* Wide tables keep their minimum width and scroll inside their card on
   phones, as before; the page itself never scrolls sideways. */
body .post-body [style*="overflow-x:auto"] table { font-size: 15px !important; line-height: 1.5 !important; }
body .post-body thead tr, body .post-body tr[style*="border-bottom:2px"] { background: var(--mk-purple-soft); border-bottom: 1px solid var(--mk-line) !important; }
body .post-body tr[style*="border-bottom:1px solid #f3f4f6"] { border-bottom: 1px solid var(--mk-line) !important; }
body .post-body tbody tr:last-child { border-bottom: 0 !important; }
@media (min-width: 600px) {
  body .post-body [style*="overflow-x:auto"] table { font-size: 16px !important; }
  body .post-body th[style*="padding:10px 12px"], body .post-body td[style*="padding:10px 12px"] { padding: 12px 16px !important; }
}

/* ── Post: the "Ready to create your QR code?" box (styled inline) ── */
body .post-body [style*="background:#f0f0ff"] {
  background: var(--mk-card) !important; border: 1px solid var(--mk-line) !important; border-radius: 18px !important;
  padding: 24px 20px !important; margin: 36px 0 !important;
}
body .post-body [style*="background:#f0f0ff"] p:first-child { color: var(--mk-ink); font-size: 21px !important; font-weight: 900 !important; letter-spacing: -.02em; }
body .post-body [style*="background:#f0f0ff"] p[style*="color:#555"] { color: var(--mk-muted) !important; font-size: 17px; }
body .post-body a[style*="background:#4F46E5"], body .post-cta a, body .post-cta-btn {
  display: inline-flex !important; align-items: center; justify-content: center; min-height: 52px; padding: 0 26px !important;
  border-radius: 14px !important; background: var(--mk-purple) !important; color: #fff !important;
  font: 800 17px/1.2 var(--mk-font) !important; text-decoration: none !important; text-align: center;
  box-shadow: 0 12px 26px -12px rgba(79,70,229,.8);
}
body .post-body a[style*="background:#4F46E5"]:hover, body .post-cta a:hover, body .post-cta-btn:hover {
  background: var(--mk-purple-dark) !important; color: #fff !important;
}

/* ── Post: the closing box at the end of the text ── */
body .post-cta {
  background: var(--mk-bg-alt); border: 1px solid var(--mk-line); border-left: 0; border-radius: 18px;
  padding: 24px 22px; margin-top: 48px;
}
body .post-cta p { color: var(--mk-ink); font-size: 18px; line-height: 1.55; }
body .post-faq h3 { margin-top: 24px; }

/* ── End of post: Related posts, Make a free QR code, Share ── */
body .post-end { margin-top: 56px; display: grid; gap: 40px; }
body .post-end-h {
  font-family: var(--mk-font); font-weight: 900; letter-spacing: -.025em; line-height: 1.1;
  font-size: clamp(26px, 6.2vw, 34px); color: var(--mk-ink); margin: 0 0 18px; text-wrap: balance;
}
body .post-related-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
body .post-related-card {
  display: flex; flex-direction: column; gap: 6px; min-height: 44px; height: 100%; padding: 18px 20px;
  background: var(--mk-card); border: 1px solid var(--mk-line); border-radius: 18px; text-decoration: none;
  color: var(--mk-ink); transition: border-color .15s ease, transform .15s ease;
}
body .post-related-card:hover { border-color: rgba(79,70,229,.45); transform: translateY(-1px); color: var(--mk-ink); text-decoration: none; }
body .post-related-tag { font-size: 14px; font-weight: 800; color: var(--mk-purple-dark); }
body .post-related-title { font-size: 18px; font-weight: 800; letter-spacing: -.01em; line-height: 1.3; text-wrap: pretty; }
body .post-related-more {
  margin-top: auto; padding-top: 4px; font-size: 16px; font-weight: 700; color: var(--mk-ink);
  text-decoration: underline; text-decoration-color: var(--mk-yellow); text-decoration-thickness: 3px; text-underline-offset: 5px;
}

body .post-make {
  background: var(--mk-ink); color: #fff; border-radius: 22px; padding: 30px 22px; text-align: center;
}
body .post-make .post-end-h { color: #fff; margin-bottom: 10px; }
body .post-make p { color: #C7D2FE; font-size: 18px; line-height: 1.5; margin: 0 auto 22px; max-width: 36ch; text-wrap: pretty; }
body .post-make-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 0 28px;
  border-radius: 14px; background: var(--mk-purple); color: #fff; font: 800 18px/1.2 var(--mk-font); text-decoration: none;
  box-shadow: 0 12px 26px -12px rgba(79,70,229,.8); transition: background .15s ease, transform .15s ease;
}
body .post-make-btn:hover { background: var(--mk-purple-dark); color: #fff; transform: translateY(-1px); text-decoration: none; }
body .post-make-btn svg { width: 20px; height: 20px; flex: none; }

body .post-share-h { font-size: 16px; font-weight: 800; color: var(--mk-ink); margin: 0 0 12px; }
body .post-share-list { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0; }
body .post-share-list li { flex: 1 1 200px; }
body .post-share-list a {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 14px;
  border-radius: 14px; border: 1px solid var(--mk-line); background: var(--mk-card); color: var(--mk-ink);
  font: 700 15px/1.2 var(--mk-font); text-decoration: none; white-space: nowrap;
}
body .post-share-list a:hover { border-color: rgba(79,70,229,.45); color: var(--mk-ink); text-decoration: none; }

@media (min-width: 700px) {
  body .post-wrap { padding: 56px 24px 88px; }
  body .post-body [style*="background:#f0f0ff"] { padding: 30px 28px !important; }
  body .post-cta { padding: 28px 30px; }
  body .post-related-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body .post-make { padding: 40px 32px; }
}
@media (max-width: 699px) {
  body .post-cta a { display: flex !important; width: 100%; }
}

/* ── Index (/blog) ── */
body .blog-hero {
  position: relative; isolation: isolate; overflow: hidden; background: var(--mk-bg); border-bottom: 1px solid var(--mk-line);
  padding: 44px 20px 40px; text-align: center;
}
body .blog-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url("../img/qr-pattern.svg") 0 0 / 320px 320px repeat; opacity: .05;
  -webkit-mask-image: linear-gradient(90deg, #000 0, transparent 14%, transparent 86%, #000 100%);
          mask-image: linear-gradient(90deg, #000 0, transparent 14%, transparent 86%, #000 100%);
}
body .blog-hero h1 {
  font-family: var(--mk-font); font-weight: 900; letter-spacing: -.03em; line-height: 1.04;
  font-size: clamp(38px, 10vw, 72px); color: var(--mk-ink); margin: 0 0 14px; text-wrap: balance;
}
body .blog-hero h1 em {
  font-style: normal; color: var(--mk-purple);
  background: linear-gradient(transparent 78%, var(--mk-yellow) 78%, var(--mk-yellow) 92%, transparent 92%);
}
body .blog-hero p { font-size: 19px; line-height: 1.5; color: var(--mk-muted); margin: 0 auto; max-width: 40ch; }
body .blog-section { max-width: 1180px; padding: 36px 20px 72px; }
body .blog-grid { grid-template-columns: 1fr; gap: 14px; }
body .blog-card {
  background: var(--mk-card); border: 1px solid var(--mk-line); border-radius: 18px; padding: 22px 20px; box-shadow: none;
  color: var(--mk-ink); font-family: var(--mk-font);
}
body .blog-card:hover { border-color: rgba(79,70,229,.45); box-shadow: none; transform: translateY(-1px); }
body .blog-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 12px; }
body .blog-card-tag {
  font-size: 14px; font-weight: 800; letter-spacing: .01em; text-transform: none; color: var(--mk-purple-dark);
  background: var(--mk-purple-soft); padding: 3px 10px; border-radius: 999px; margin: 0;
}
body .blog-card-date { font-size: 15px; color: var(--mk-muted); margin: 0; }
body .blog-card h2 {
  font-family: var(--mk-font); font-size: 21px; font-weight: 800; letter-spacing: -.015em; line-height: 1.25;
  color: var(--mk-ink); margin: 0 0 10px; text-wrap: balance;
}
body .blog-card p { font-size: 16px; line-height: 1.55; color: var(--mk-muted); margin: 0 0 18px; text-wrap: pretty; }
body .blog-card .blog-card-top p { margin: 0; flex: none; }
body .blog-card-link {
  display: inline-block; font-size: 16px; font-weight: 700; color: var(--mk-ink); min-height: 24px;
  text-decoration: underline; text-decoration-color: var(--mk-yellow); text-decoration-thickness: 3px; text-underline-offset: 5px;
}
body .blog-card-link::after { content: "\2192"; color: var(--mk-purple); display: inline-block; margin-left: 6px; text-decoration: none; }
@media (min-width: 700px) {
  body .blog-hero { padding: 64px 24px 56px; }
  body .blog-section { padding: 48px 24px 88px; }
  body .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  body .blog-card { padding: 28px 26px; }
}
@media (min-width: 1100px) {
  body .blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* No word alone on the last line: short headings and table cells wrap in
   balanced lines, paragraphs and list items avoid a lone last word. */
body .post-wrap :is(h1, h2, h3, h4, th, td) { text-wrap: balance; }
body .post-wrap :is(p, li, dd, figcaption, blockquote) { text-wrap: pretty; }
