/* ==========================================================================
   RankCraft — Agency theme
   ========================================================================== */

:root {
  --ink: #0b1120;
  --ink-soft: #1e293b;
  --slate: #475569;
  --muted: #64748b;
  --bg: #ffffff;
  --bg-soft: #f6f8fc;
  --line: #e5e9f2;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --violet: #7c3aed;
  --cyan: #06b6d4;
  --grad: linear-gradient(120deg, #4f46e5 0%, #7c3aed 55%, #06b6d4 130%);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 12px 32px -12px rgba(15, 23, 42, .18);
  --shadow-lg: 0 24px 60px -20px rgba(79, 70, 229, .35);
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Poppins', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --maxw: 1160px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; color: var(--ink); margin: 0 0 .5rem; font-weight: 700; letter-spacing: -0.01em; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 820px; }
.section { padding: 72px 0; }
.section-alt { background: var(--bg-soft); }
.section-title { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: .4rem; }
.section-sub { color: var(--muted); font-size: 1.06rem; max-width: 640px; margin: 0 0 2rem; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.section-head .section-title { margin-bottom: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-lg); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 28px 70px -22px rgba(79, 70, 229, .55); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 9px 16px; font-size: .88rem; }

/* Badge */
.badge { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; font-size: .78rem; font-weight: 600; letter-spacing: .01em; background: rgba(79, 70, 229, .1); color: var(--primary); }
.badge-lg { font-size: .85rem; padding: 6px 14px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: var(--ink); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #fff; font-size: 1.05rem; box-shadow: var(--shadow-sm); }
.main-nav { display: flex; gap: 1.5rem; margin-left: .5rem; }
.main-nav a { color: var(--slate); font-weight: 500; font-size: .95rem; transition: color .15s ease; }
.main-nav a:hover { color: var(--primary); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 10px; font-size: 1.2rem; line-height: 1; padding: 8px 11px; color: var(--ink); cursor: pointer; }

/* Language switcher */
.lang-switcher { display: inline-flex; gap: 2px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang-link { padding: 5px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--slate); }
.lang-link.is-active { background: var(--ink); color: #fff; }

/* Hero */
.hero { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 80% -10%, rgba(124, 58, 237, .18), transparent 60%), radial-gradient(900px 500px at 10% 110%, rgba(6, 182, 212, .16), transparent 55%), var(--bg-soft); padding: 88px 0 72px; }
.hero-inner { max-width: 780px; }
.hero-badge { display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: .8rem; font-weight: 600; color: var(--primary); background: rgba(79, 70, 229, .1); border: 1px solid rgba(79, 70, 229, .2); margin-bottom: 1.25rem; }
.hero h1 { font-size: clamp(2.3rem, 5.5vw, 3.6rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 1rem; background: linear-gradient(120deg, var(--ink) 0%, var(--primary) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-sub { color: var(--slate); font-size: 1.18rem; max-width: 620px; margin: 0 0 2rem; }
.hero-cta { display: flex; gap: .85rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.hero-stats { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat-num { font-family: var(--font-head); font-size: 1.9rem; font-weight: 700; color: var(--ink); }
.stat-label { color: var(--muted); font-size: .88rem; }

/* Topics grid */
.topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.topic-card { display: block; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.topic-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.topic-card h3 { font-size: 1.15rem; margin-bottom: .35rem; }
.topic-card p { color: var(--muted); margin: 0; font-size: .92rem; }

/* Post cards */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.post-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); transition: transform .18s ease, box-shadow .18s ease; overflow: hidden; }
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.post-card-link { display: flex; flex-direction: column; height: 100%; padding: 24px; }
.post-card-top { margin-bottom: .9rem; }
.post-card-title { font-size: 1.16rem; margin-bottom: .6rem; line-height: 1.35; }
.post-card-excerpt { color: var(--slate); font-size: .95rem; margin: 0 0 1rem; flex: 1; }
.post-card-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; border-top: 1px solid var(--line); padding-top: .9rem; }
.post-date { color: var(--muted); font-size: .84rem; }
.post-card-more { color: var(--primary); font-weight: 600; font-size: .88rem; white-space: nowrap; }

/* Page head (section / term / taxonomy) */
.page-head { background: var(--bg-soft); border-bottom: 1px solid var(--line); padding: 56px 0 40px; }
.page-title { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 800; }

/* Single post */
.single { padding: 48px 0 80px; }
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; color: var(--muted); font-size: .88rem; margin-bottom: 1.75rem; }
.breadcrumb a { color: var(--slate); }
.breadcrumb a:hover { color: var(--primary); }
.crumb-current { color: var(--ink); font-weight: 500; }
.post-header { margin-bottom: 2rem; }
.post-title { font-size: clamp(1.9rem, 4.5vw, 2.9rem); font-weight: 800; letter-spacing: -0.02em; margin: .8rem 0; }
.post-description { color: var(--slate); font-size: 1.15rem; margin: 0 0 1.1rem; }
.post-meta { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .9rem; flex-wrap: wrap; }
.post-meta .dot { opacity: .5; }

/* Table of contents */
.toc { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 2rem; }
.toc-title { font-family: var(--font-head); font-weight: 700; margin-bottom: .6rem; }
.toc ul { margin: 0; padding-left: 1.1rem; }
.toc li { margin: .3rem 0; }
.toc a { color: var(--slate); font-size: .94rem; }
.toc a:hover { color: var(--primary); }

/* Post body */
.post-body { font-size: 1.05rem; color: var(--ink-soft); }
.post-body h2 { font-size: 1.6rem; margin: 2rem 0 .8rem; }
.post-body h3 { font-size: 1.25rem; margin: 1.6rem 0 .6rem; }
.post-body p { margin: 0 0 1.1rem; }
.post-body ul, .post-body ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
.post-body li { margin: .35rem 0; }
.post-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.post-body code { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: .9em; }
.post-body pre { background: var(--ink); color: #e2e8f0; border-radius: 12px; padding: 18px; overflow-x: auto; }
.post-body pre code { background: none; border: 0; color: inherit; padding: 0; }
.post-body blockquote { border-left: 4px solid var(--primary); margin: 1.2rem 0; padding: .4rem 1.2rem; color: var(--slate); background: var(--bg-soft); border-radius: 0 10px 10px 0; }

/* FAQ */
.faq { margin-top: 2.5rem; border-top: 1px solid var(--line); padding-top: 2rem; }
.faq h2 { font-size: 1.5rem; margin-bottom: 1.1rem; }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: .8rem; background: var(--bg); }
.faq-item summary { cursor: pointer; padding: 16px 20px; font-weight: 600; font-family: var(--font-head); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--primary); font-weight: 400; }
.faq-item[open] summary::after { content: "–"; }
.faq-answer { padding: 0 20px 18px; color: var(--slate); }
.faq-answer p { margin: 0; }

/* Pagination */
.post-pagination { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; flex-wrap: wrap; }

/* Footer */
.site-footer { background: var(--ink); color: #cbd5e1; padding: 64px 0 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; padding-bottom: 3rem; }
.footer-brand .brand { color: #fff; margin-bottom: .8rem; }
.footer-brand p { color: #94a3b8; font-size: .95rem; max-width: 320px; margin: 0; }
.footer-col h4 { color: #fff; font-size: .95rem; margin-bottom: 1rem; }
.footer-col a { display: block; color: #94a3b8; font-size: .92rem; margin: .45rem 0; transition: color .15s ease; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .08); padding: 1.5rem 0; color: #64748b; font-size: .86rem; }
.footer-bottom p { margin: 0; }

/* 404 */
.notfound { padding: 90px 0 110px; text-align: center; }
.notfound-code { font-family: var(--font-head); font-size: clamp(5rem, 18vw, 9rem); font-weight: 800; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.notfound h1 { font-size: 2rem; margin: .5rem 0 .8rem; }
.notfound p { color: var(--slate); max-width: 460px; margin: 0 auto 1.8rem; }
.notfound .hero-cta { justify-content: center; }
.notfound-langs { margin-top: 2rem; color: var(--muted); font-size: .92rem; }
.notfound-langs a { color: var(--primary); margin: 0 .4rem; font-weight: 600; }

/* Back to top */
.back-to-top { position: fixed; right: 22px; bottom: 22px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 1.1rem; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; box-shadow: var(--shadow); z-index: 40; }
.back-to-top.show { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-3px); }

.empty { color: var(--muted); padding: 2rem 0; }

/* Responsive */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .header-actions { display: none; }
  .main-nav { position: absolute; top: 68px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); flex-direction: column; padding: 1rem 24px; gap: .8rem; display: none; box-shadow: var(--shadow); }
  .main-nav.open { display: flex; }
  .post-grid { grid-template-columns: 1fr; }
  .topics-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .topics-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .section { padding: 48px 0; }
  .hero { padding: 60px 0 48px; }
}
