/*
Theme Name: Aimahdi
Theme URI: https://aimahdi.com/
Author: Amimul Ihsan
Author URI: https://aimahdi.com/
Description: WordPress theme for aimahdi.com/blog — Knowledge Base, Case Studies and Blog. Shares the exact design system (DM Serif Display / DM Sans / JetBrains Mono, Navy/Saddle palette) used by the static portfolio pages.
Version: 5.3.5
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: aimahdi
*/

/* ══════════════════════════════════════════════════════════════════
 * DESIGN SYSTEM — copied from assets/css/main.css (Phase 2 static pages).
 * Keep in sync: nav / footer / layout / typography / badges / buttons
 * must stay identical between the static site and this theme.
 * ══════════════════════════════════════════════════════════════════ */

:root {
  --canvas: #FFFFFF;
  --ink: #162331;
  --primary: #234E70;
  --primary-hover: #193B57;
  --saddle: #8A4F32;
  --muted: #596773;
  --surface: #E6EBEF;
  --border: #CCD5DC;
  --border-strong: #748490;
  --white: #FFFFFF;
  /* Status green — deliberate exception to the Navy/Saddle palette:
     used only where color communicates meaning (available/visited),
     never as a brand or decorative accent. */
  --success: #2E9E5B;
  --success-bg: #E8FFF0;
  --success-text: #1A7A42;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--canvas); color: var(--ink); font-family: 'DM Sans', sans-serif; -webkit-font-smoothing: antialiased; }
/* Keeps the footer pinned to the viewport bottom on short pages (e.g. a
   blocked contact form) instead of floating up with dead space beneath it. */
main { flex: 1 0 auto; }
::selection { background: rgba(35,78,112,0.15); }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, ul, ol { margin: 0; }
img { max-width: 100%; display: block; }

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.serif { font-family: 'DM Serif Display', serif; font-weight: 400; }
.mono { font-family: 'JetBrains Mono', monospace; }

/* Visually hidden but still announced by screen readers — for labels
   that would be visually redundant next to an icon/placeholder. */
.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; }

/* SKIP LINK — hidden until keyboard-focused */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--ink); color: var(--canvas) !important; padding: 12px 20px; border-radius: 0 0 8px 0; font-size: 14px; font-weight: 600; }
.skip-link:focus { left: 0; }

/* NAV */
.nav { position: sticky; top: 0; z-index: 50; background: var(--canvas); border-bottom: 1px solid var(--border); }
.nav-inner { position: relative; max-width: 1180px; margin: 0 auto; padding: 0 32px; height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.nav-logo { display: flex; align-items: center; gap: 10px; }
.nav-mark { font-family: 'DM Serif Display', serif; font-style: italic; font-size: 21px; line-height: 1; color: var(--primary); flex-shrink: 0; }
.nav-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.nav-links { display: flex; align-items: center; gap: 24px; font-size: 14px; font-weight: 500; color: var(--ink); flex-wrap: wrap; }
.nav-links a { transition: color .15s; }
.nav-links a:hover { color: var(--primary); }
.nav-links a.active { color: var(--primary); font-weight: 600; }
.nav-cta { background: var(--primary); color: var(--white) !important; padding: 9px 17px; border-radius: 7px; font-size: 13.5px; font-weight: 600; transition: background .15s; white-space: nowrap; }
.nav-cta:hover { background: var(--primary-hover) !important; }

/* Mobile nav toggle — hidden entirely above the breakpoint. */
.nav-toggle { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; gap: 5px; flex-direction: column; background: none; border: none; border-radius: 7px; cursor: pointer; padding: 0; flex-shrink: 0; }
.nav-toggle:hover { background: var(--surface); }
.nav-toggle-bar { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 1px; transition: transform .15s, opacity .15s; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 799px) {
  .nav-toggle { display: flex; }
  .nav-collapse { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 4px; background: var(--canvas); border-bottom: 1px solid var(--border); padding: 8px 32px 20px; box-shadow: 0 8px 24px rgba(22,35,49,0.08); }
  .nav-collapse.is-open { display: flex; }
  .nav-collapse .nav-links { flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 4px; width: 100%; }
  .nav-collapse .nav-links a { display: block; width: 100%; padding: 10px 0; }
  .nav-collapse .nav-cta { display: inline-block; margin-top: 8px; text-align: center; }
}
@media (min-width: 800px) {
  .nav-collapse { display: contents; }
}

/* FOOTER */
.footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 52px 32px 40px; }
.footer-top { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; margin-bottom: 32px; }
.footer-about { max-width: 280px; }
.footer-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.footer-tagline { font-size: 13px; color: var(--muted); line-height: 1.6; }
.footer-cols { display: flex; gap: 48px; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.footer-col-label { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 2px; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom { padding-top: 24px; border-top: 1px solid var(--border); font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--muted); }

/* LAYOUT */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
.wrap-narrow { max-width: 900px; margin: 0 auto; padding: 0 32px; }
.wrap-reading { max-width: 760px; margin: 0 auto; padding: 0 32px; }
.section { padding: 80px 0 72px; border-bottom: 1px solid var(--border); }

/* TYPOGRAPHY */
.label { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.07em; color: var(--saddle); margin-bottom: 16px; text-transform: uppercase; }
.section-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 40px; }

/* BADGE — forms/crm/smtp/wp are categorical product tags, unrelated to the
   brand accent; left as-is. Cart's badge previously reused the old orange
   accent directly, so it's recolored onto the saddle token instead. */
.badge { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; font-weight: 500; border-radius: 5px; padding: 3px 8px; display: inline-block; }
.badge-forms { background: #E8F3FF; color: #1A5FA8; }
.badge-crm { background: #F0EBFF; color: #6B3DAE; }
.badge-cart { background: var(--canvas); color: var(--saddle); border: 1px solid var(--saddle); }
.badge-smtp { background: #E8FFF0; color: #1A7A42; }
.badge-wp { background: #F0F0F0; color: #3A372F; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; padding: 12px 22px; border-radius: 8px; font-size: 15px; font-weight: 600; transition: background .15s, transform .12s; cursor: pointer; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--canvas); color: var(--ink); border: 1px solid var(--border-strong); }
.btn-secondary:hover { border-color: var(--ink); }

/* MISC */
.link-arrow { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--primary); font-weight: 600; white-space: nowrap; }
.link-arrow:hover { color: var(--primary-hover); }
.card-lift { transition: transform .18s, box-shadow .18s; }
.card-lift:hover { transform: translateY(-3px); box-shadow: 0 16px 36px -18px rgba(22,35,49,0.25); }

/* ══════════════════════════════════════════════════════════════════
 * WP-PAGE-SPECIFIC STYLES — extracted from new-design-system/ reference
 * files (kb.html, kb-article.html, case-studies.html, case-study.html,
 * blog.html, blog-post.html, contact.html).
 * ══════════════════════════════════════════════════════════════════ */

/* Breadcrumb (single KB / case study / blog post) */
.breadcrumb { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); padding: 28px 0 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .current { color: var(--ink); }

/* Code block (KB article / blog post) */
.code-block { background: var(--surface); border-radius: 10px; padding: 20px 22px; font-family: 'JetBrains Mono', monospace; font-size: 13px; line-height: 1.7; color: var(--ink); overflow-x: auto; margin: 12px 0; position: relative; }
.code-block .copy-btn, .entry-content pre .copy-btn { position: absolute; top: 8px; right: 8px; padding: 4px 8px; font-size: 11px; font-family: 'DM Sans', sans-serif; background: var(--ink); color: var(--white); border: none; border-radius: 4px; cursor: pointer; }

/* Search bar (KB archive) */
.search-bar { display: flex; align-items: center; gap: 12px; background: var(--canvas); border: 1px solid var(--border-strong); border-radius: 10px; padding: 14px 18px; transition: border-color .15s, box-shadow .15s; margin-bottom: 16px; }
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(35,78,112,0.12); }
.search-bar input { border: none; outline: none; background: transparent; font-family: 'DM Sans', sans-serif; font-size: 15px; color: var(--ink); width: 100%; }
.search-bar button { border: none; background: transparent; cursor: pointer; display: flex; }

/* Tabs / filter pills (KB product filter, blog category filter) — active
   state follows the same rule as active navigation: navy. */
.tab-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.tab { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border-strong); background: transparent; cursor: pointer; transition: all .15s; color: var(--ink); display: inline-block; }
.tab.active, .tab:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* Metric callout (case study) — stays a bold dark block; label text uses a
   translucent white rather than the old orange tint for hierarchy. */
.metric-callout { background: var(--ink); border-radius: 12px; padding: 22px 28px; display: flex; align-items: center; gap: 16px; margin-bottom: 40px; }
.metric-callout .num { font-family: 'JetBrains Mono', monospace; font-size: 28px; font-weight: 500; color: var(--white); }
.metric-callout .lbl { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: rgba(255,255,255,0.72); letter-spacing: 0.03em; }

/* ── Entry content typography (post / KB / case study body copy) ── */
.entry-content { font-size: 17px; line-height: 1.75; color: var(--ink); }
.entry-content > * + * { margin-top: 28px; }
.entry-content h2 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 30px; line-height: 1.2; color: var(--ink); margin-top: 48px; }
.entry-content h3 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 24px; line-height: 1.25; color: var(--ink); margin-top: 40px; }
.entry-content p { font-size: 17px; line-height: 1.75; }
.entry-content ul, .entry-content ol { padding-left: 22px; display: flex; flex-direction: column; gap: 12px; }
.entry-content li { font-size: 17px; line-height: 1.65; }
.entry-content a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.entry-content a:hover { color: var(--primary-hover); }
.entry-content code { background: var(--surface); border-radius: 4px; padding: 2px 6px; font-family: 'JetBrains Mono', monospace; font-size: 14px; }
.entry-content pre { background: var(--surface); border-radius: 10px; padding: 20px 22px; font-family: 'JetBrains Mono', monospace; font-size: 13px; line-height: 1.7; overflow-x: auto; }
.entry-content pre code { background: none; padding: 0; }
/* Embedded code snippets (e.g. GitHub Gist tables) render their own wide
   <table> markup that bypasses the pre/code rules above and was breaking
   the whole page's horizontal scroll on narrow screens. */
.entry-content table { display: block !important; max-width: 100% !important; overflow-x: auto !important; }
.entry-content blockquote { border-left: 3px solid var(--saddle); padding-left: 18px; color: var(--muted); font-style: italic; }
.entry-content img { border-radius: 10px; }
.entry-content hr { border: none; border-top: 1px solid var(--border); }

/* Featured image on single posts — let it render at its own aspect
   ratio scaled to full width, instead of the width/height attributes
   WordPress writes (from the registered image size) forcing a
   different box than the file the lazy-load plugin actually serves. */
.post-thumbnail img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

/* ── Post list row (blog index, archive.php, search.php fallback) ── */
.post-row { display: flex; flex-direction: column; gap: 10px; padding: 28px 0; border-top: 1px solid var(--border); transition: opacity .15s; }
.post-row:hover { opacity: .7; }
.post-row-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.post-row-cat { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--saddle); }
.post-row-date { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--saddle); }
.post-row-title { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 26px; line-height: 1.2; text-decoration: none; }
.post-row-excerpt { font-size: 15px; line-height: 1.55; color: var(--muted); max-width: 68ch; }

/* ── Blog index layout (index.php) ── */
.blog-layout { display: grid; grid-template-columns: 1fr 300px; gap: 56px; align-items: start; }
.blog-sidebar { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 20px; }
.side-card { padding: 26px; background: var(--surface); border-radius: 12px; }
.side-card-label { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 12px; }
.side-card p { font-size: 14px; line-height: 1.6; color: var(--ink); margin-bottom: 14px; }

@media (max-width: 900px) {
  .blog-layout { grid-template-columns: 1fr; }
  .blog-sidebar { position: static; }
}

/* ── KB archive: two-column article grid with product filter ── */
.kb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.kb-card { display: flex; flex-direction: column; gap: 9px; padding: 26px 28px 26px 0; border-top: 1px solid var(--border); transition: opacity .15s; }
.kb-card:hover { opacity: .7; }
.kb-card:nth-child(even) { padding: 26px 0 26px 28px; border-left: 1px solid var(--border); }
.kb-card-title { font-size: 16.5px; font-weight: 600; line-height: 1.3; text-decoration: none; }
.kb-card-excerpt { font-size: 14px; color: var(--muted); line-height: 1.5; }
.kb-severity { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--saddle); }

@media (max-width: 760px) {
  .kb-grid { grid-template-columns: 1fr; }
  .kb-card:nth-child(even) { padding: 26px 0; border-left: none; }
}

/* ── Case study cards (archive-case_study.php) ── */
.case-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.case-card { display: flex; flex-direction: column; gap: 16px; padding: 28px; background: var(--surface); border-radius: 12px; }
.case-card-title { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 22px; line-height: 1.2; text-decoration: none; }
.case-card-excerpt { font-size: 14px; line-height: 1.55; color: var(--muted); flex: 1; }
.case-card-footer { padding-top: 14px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.case-card-metric .num { font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 500; }
.case-card-metric .lbl { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--muted); margin-left: 8px; }

@media (max-width: 900px) {
  .case-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .case-grid { grid-template-columns: 1fr; }
}

/* ── Author card (single.php / single-kb_article.php / single-case_study.php) ── */
.author-card { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 22px 0; display: flex; gap: 18px; align-items: center; margin-bottom: 64px; }
.author-card-ava { font-family: 'DM Serif Display', serif; font-style: italic; font-size: 26px; line-height: 1; color: var(--primary); flex-shrink: 0; }
.author-card-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.author-card-role { font-size: 13.5px; line-height: 1.5; color: var(--muted); }

/* ── Related list (related articles / related posts / next case study) ── */
.related-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px 0; border-top: 1px solid var(--border); transition: opacity .15s; }
.related-row:hover { opacity: .7; }
.related-row-title { font-size: 15px; font-weight: 500; }

/* ── "Still stuck?" CTA callout (KB article) ── */
.cta-callout { background: var(--surface); border-radius: 12px; padding: 24px 28px; margin-bottom: 64px; }
.cta-callout-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.cta-callout p { font-size: 15px; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }

/* ── Pagination — current page follows the active-state rule: navy. ── */
.pagination { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 40px; margin-top: 8px; border-top: 1px solid var(--border); font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 7px; color: var(--ink); }
.pagination .page-numbers.current { background: var(--primary); color: var(--white); }
.pagination .page-numbers:hover:not(.current):not(.dots) { background: var(--surface); }

/* ── Comments ── */
.comments-section { padding-top: 56px; padding-bottom: 72px; margin-top: 56px; border-top: 1px solid var(--border); }
.comments-title { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 24px; margin-bottom: 24px; }
.comment-list { list-style: none; margin: 0 0 40px; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.comment-item { background: var(--surface); border-radius: 10px; padding: 20px 22px; }
.comment-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-author-name { font-weight: 600; font-size: 14.5px; }
.comment-date { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--muted); }
.comment-body { font-size: 15px; line-height: 1.65; color: var(--ink); }
.respond-title { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 22px; margin-bottom: 18px; }
.comment-form { display: flex; flex-direction: column; gap: 12px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-g { display: flex; flex-direction: column; gap: 6px; }
.form-g label { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); }
.form-g label span { color: var(--saddle); }
.form-g input, .form-g textarea, .comment-form textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border-strong); background: var(--canvas); border-radius: 8px; padding: 11px 13px; font-family: 'DM Sans', sans-serif; font-size: 14.5px; outline: none; transition: border-color .15s; }
.form-g input:focus, .form-g textarea:focus { border-color: var(--primary); }
.submit-btn { align-self: flex-start; background: var(--primary); color: var(--white); border: none; border-radius: 8px; padding: 11px 22px; font-family: 'DM Sans', sans-serif; font-size: 14.5px; font-weight: 600; cursor: pointer; transition: background .15s; }
.submit-btn:hover { background: var(--primary-hover); }

/* Fluent Forms (Contact page) — the plugin's own inputs and submit button
   don't inherit .form-g/.submit-btn, so the navy focus/button treatment is
   applied directly to its markup here rather than left as browser default. */
.ff-el-form-control { border-color: var(--border-strong) !important; }
.ff-el-form-control:focus { border-color: var(--primary) !important; box-shadow: 0 0 0 3px rgba(35,78,112,0.12); outline: none; }
.ff-btn-submit { background: var(--primary) !important; border-color: var(--primary) !important; }
.ff-btn-submit:hover { background: var(--primary-hover) !important; border-color: var(--primary-hover) !important; }

/* ── Generic page (page.php) ── */
.page-title { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 44px; line-height: 1.1; letter-spacing: -0.01em; margin-bottom: 32px; }

/* ── Search form (used in search.php no-results state) ── */
.search-form { display: flex; gap: 10px; }
.search-form input { flex: 1; border: 1px solid var(--border-strong); background: var(--canvas); border-radius: 8px; padding: 11px 14px; font-family: 'DM Sans', sans-serif; font-size: 14.5px; outline: none; }
.search-form button { background: var(--primary); color: var(--white); border: none; border-radius: 8px; padding: 11px 18px; font-family: 'DM Sans', sans-serif; font-size: 14.5px; font-weight: 600; cursor: pointer; }

/* ── 404 ── */
.error-page { padding: 100px 0 120px; text-align: center; }
.error-page-code { display: block; font-family: 'JetBrains Mono', monospace; font-size: 15px; color: var(--saddle); letter-spacing: 0.06em; margin-bottom: 18px; }
.error-page h1 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 36px; margin-bottom: 14px; }
.error-page p { font-size: 16px; color: var(--muted); margin-bottom: 32px; }
.error-page .btn-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.no-posts { padding: 40px 0; color: var(--muted); font-size: 15px; }
