/* ==========================================================================
   SEO SaaS Theme — Design System
   ========================================================================== */

:root {
  --color-bg: #ffffff;
  --color-bg-soft: #f7f9fc;
  --color-bg-muted: #eef2f7;
  --color-border: #e3e8ef;
  --color-text: #0f172a;
  --color-text-soft: #475569;
  --color-text-muted: #64748b;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-soft: #eff6ff;
  --color-accent: #7c3aed;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger: #dc2626;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 4px 14px rgba(15,23,42,.08);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.10);

  --container: 1180px;
  --gutter: 24px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dark); text-decoration: underline; }

h1,h2,h3,h4,h5,h6 {
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 .6em;
  color: var(--color-text);
}
h1 { font-size: clamp(1.9rem, 2.4vw + 1rem, 2.8rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.45rem, 1.2vw + 1rem, 2rem); letter-spacing: -.01em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1em; }

ul, ol { padding-left: 1.25em; }
ul li, ol li { margin-bottom: .35em; }

code {
  font-family: var(--font-mono);
  background: var(--color-bg-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .92em;
}
pre {
  font-family: var(--font-mono);
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: var(--radius);
  overflow: auto;
  font-size: .92em;
}

hr { border: 0; border-top: 1px solid var(--color-border); margin: 32px 0; }

/* ----------------------------- Layout ----------------------------- */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section { padding: 64px 0; }
.section-sm { padding: 36px 0; }

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section { padding: 44px 0; }
}

/* ----------------------------- Header ----------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.site-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.1rem; color: var(--color-text);
  text-decoration: none;
}
.site-brand:hover { text-decoration: none; color: var(--color-text); }
.site-brand .logo-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800;
}
.primary-nav ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; gap: 22px;
}
.primary-nav a {
  color: var(--color-text-soft); font-weight: 500; font-size: .95rem;
}
.primary-nav a:hover { color: var(--color-primary); text-decoration: none; }

.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--color-border);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
  font-size: 1rem;
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    position: absolute; top: 68px; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--color-border);
    display: none; padding: 14px var(--gutter);
  }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 12px; }
}

/* ----------------------------- Buttons ----------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius);
  font-weight: 600; font-size: .95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .05s ease, background .15s ease, color .15s ease, border-color .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--color-primary); color: #fff; border-color: var(--color-primary);
}
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; border-color: var(--color-primary-dark); }
.btn-secondary {
  background: #fff; color: var(--color-text); border-color: var(--color-border);
}
.btn-secondary:hover { background: var(--color-bg-soft); color: var(--color-text); }
.btn-ghost {
  background: transparent; color: var(--color-text-soft); border-color: transparent;
}
.btn-ghost:hover { background: var(--color-bg-soft); color: var(--color-text); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: .85rem; border-radius: var(--radius-sm); }

/* ----------------------------- Cards ----------------------------- */

.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.card:hover { box-shadow: var(--shadow); }

.tool-card {
  display: flex; flex-direction: column; gap: 8px;
  text-decoration: none; color: var(--color-text);
}
.tool-card:hover { text-decoration: none; color: var(--color-text); transform: translateY(-2px); border-color: #cdd6e3; }
.tool-card .badge { align-self: flex-start; }
.tool-card h3 { margin: 4px 0 0; font-size: 1.1rem; }
.tool-card p { color: var(--color-text-soft); font-size: .92rem; margin: 0; }

.category-card {
  display: flex; flex-direction: column; gap: 14px;
}
.category-card .icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.05rem;
}
.category-card h3 { margin: 0; font-size: 1.15rem; }
.category-card ul { margin: 0; padding-left: 18px; }
.category-card ul a { color: var(--color-text-soft); font-size: .92rem; }

/* ----------------------------- Hero ----------------------------- */

.hero {
  padding: 80px 0 56px;
  background:
    radial-gradient(1200px 400px at 50% -100px, #e0eaff 0%, transparent 60%),
    linear-gradient(180deg, #fbfcfe 0%, #ffffff 100%);
  text-align: center;
}
.hero h1 { max-width: 820px; margin: 0 auto .5em; }
.hero p.lead {
  max-width: 720px; margin: 0 auto 28px;
  font-size: 1.12rem; color: var(--color-text-soft);
}
.hero .cta { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hero .stats {
  display: flex; gap: 40px; justify-content: center; margin-top: 38px;
  color: var(--color-text-muted); font-size: .92rem;
}
.hero .stats strong { display: block; color: var(--color-text); font-size: 1.6rem; line-height: 1; margin-bottom: 4px; }

/* ----------------------------- Badges ----------------------------- */

.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--color-bg-muted);
  color: var(--color-text-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-primary { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.badge-ai { background: #f3e8ff; color: #6b21a8; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ----------------------------- Tool Page ----------------------------- */

.tool-hero {
  padding: 56px 0 24px;
  background: linear-gradient(180deg, #f7f9fc 0%, #ffffff 100%);
  border-bottom: 1px solid var(--color-border);
}
.tool-hero .container { display: flex; flex-direction: column; gap: 14px; max-width: 880px; }
.tool-hero h1 { margin: 0; }
.tool-hero p.lead { margin: 0; color: var(--color-text-soft); font-size: 1.08rem; }

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  margin-top: 32px;
}
@media (max-width: 1024px) {
  .tool-layout { grid-template-columns: 1fr; }
}

.tool-app {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.tool-app .field { margin-bottom: 16px; }
.tool-app label {
  display: block;
  font-weight: 600; font-size: .92rem;
  margin-bottom: 6px;
  color: var(--color-text);
}
.tool-app input[type="text"],
.tool-app input[type="url"],
.tool-app input[type="number"],
.tool-app input[type="email"],
.tool-app select,
.tool-app textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
  color: var(--color-text);
  transition: border-color .15s, box-shadow .15s;
}
.tool-app textarea { min-height: 180px; resize: vertical; line-height: 1.5; }
.tool-app input:focus,
.tool-app textarea:focus,
.tool-app select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.tool-app .actions {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px;
}

.tool-output {
  margin-top: 24px;
  border-top: 1px dashed var(--color-border);
  padding-top: 20px;
  display: none;
}
.tool-output.is-visible { display: block; }
.tool-output h3 { margin-top: 0; }
.tool-output .output-block {
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: .9rem;
}
.tool-output .output-text {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.tool-output .stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.tool-output .stat {
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
}
.tool-output .stat .label { color: var(--color-text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.tool-output .stat .value { font-size: 1.4rem; font-weight: 700; margin-top: 4px; color: var(--color-text); }
.tool-output table {
  width: 100%; border-collapse: collapse; margin: 8px 0 16px;
  font-size: .92rem;
}
.tool-output table th, .tool-output table td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.tool-output table th { background: var(--color-bg-soft); font-weight: 600; }
.tool-output mark.kw {
  background: #fff3a3; padding: 1px 3px; border-radius: 3px;
}

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid #fff; border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-right: 6px;
  vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tool-sidebar { display: flex; flex-direction: column; gap: 18px; }
.tool-sidebar .card h4 { margin-top: 0; }
.tool-sidebar .related-list { list-style: none; padding: 0; margin: 0; }
.tool-sidebar .related-list li { margin-bottom: 8px; }
.tool-sidebar .related-list a { color: var(--color-text); font-size: .94rem; }
.tool-sidebar .related-list a:hover { color: var(--color-primary); }

/* ----------------------------- SEO Content ----------------------------- */

.seo-content {
  padding: 48px 0 24px;
  background: #fff;
}
.seo-content .container { max-width: 880px; }
.seo-content h2 { margin-top: 1.6em; }
.seo-content h3 { margin-top: 1.4em; }
.seo-content ul li, .seo-content ol li { margin-bottom: .4em; }

/* FAQ */
.faq details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
  background: #fff;
}
.faq details[open] { background: var(--color-bg-soft); }
.faq summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; font-size: 1.2rem; color: var(--color-text-muted); }
.faq details[open] summary::after { content: "−"; }

/* ----------------------------- Posts (entry-content) ----------------------------- */

.entry {
  padding: 48px 0;
}
.entry .container { max-width: 760px; }
.entry-header { margin-bottom: 24px; }
.entry-header h1.entry-title { margin: 0 0 12px; }
.entry-meta {
  color: var(--color-text-muted); font-size: .9rem;
}
.entry-thumbnail { margin: 16px 0 24px; }
.entry-thumbnail img { border-radius: var(--radius-lg); }

.entry-content {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--color-text);
}
.entry-content > * { margin-top: 0; margin-bottom: 1.1em; }
.entry-content h1, .entry-content h2, .entry-content h3,
.entry-content h4, .entry-content h5, .entry-content h6 {
  margin-top: 1.6em; margin-bottom: .55em;
}
.entry-content p { margin: 0 0 1.1em; }
.entry-content img,
.entry-content .wp-block-image img {
  border-radius: var(--radius);
}
.entry-content figure { margin: 1.2em 0; }
.entry-content figure figcaption {
  font-size: .88rem; color: var(--color-text-muted); text-align: center; margin-top: 6px;
}
.entry-content blockquote {
  margin: 1.4em 0;
  padding: 14px 20px;
  border-left: 4px solid var(--color-primary);
  background: var(--color-bg-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--color-text-soft);
}
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content table {
  width: 100%; border-collapse: collapse; margin: 1em 0;
}
.entry-content table th, .entry-content table td {
  padding: 10px 12px; border: 1px solid var(--color-border);
}
.entry-content code { font-size: .94em; }
.entry-content .alignleft { float: left; margin: 0 1em 1em 0; }
.entry-content .alignright { float: right; margin: 0 0 1em 1em; }
.entry-content .aligncenter { display: block; margin: 0 auto 1em; }
.entry-content .wp-caption { max-width: 100%; }
.entry-content::after { content: ""; display: block; clear: both; }

/* ----------------------------- Breadcrumbs ----------------------------- */

.breadcrumbs {
  font-size: .88rem;
  color: var(--color-text-muted);
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
}
.breadcrumbs a { color: var(--color-text-soft); }
.breadcrumbs a:hover { color: var(--color-primary); }
.breadcrumbs .sep { margin: 0 8px; color: #cbd5e1; }

/* ----------------------------- Ad Slots ----------------------------- */

.ad-slot {
  background: var(--color-bg-soft);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  text-align: center;
  padding: 16px;
  color: var(--color-text-muted);
  font-size: .82rem;
  margin: 24px 0;
}

/* ----------------------------- Footer ----------------------------- */

.site-footer {
  background: #0b1220;
  color: #cbd5e1;
  padding: 56px 0 24px;
  margin-top: 64px;
}
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 32px;
}
@media (max-width: 820px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.footer-grid h4 { color: #fff; font-size: .98rem; margin-bottom: 14px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid ul li { margin-bottom: 8px; font-size: .92rem; }
.footer-bottom {
  margin-top: 36px; padding-top: 18px;
  border-top: 1px solid #1f2a44;
  font-size: .85rem; color: #94a3b8;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}

/* ----------------------------- Pagination ----------------------------- */

.pagination {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 36px;
}
.pagination a, .pagination span {
  padding: 8px 14px; border: 1px solid var(--color-border); border-radius: var(--radius);
  color: var(--color-text-soft); text-decoration: none; font-size: .92rem;
}
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination a:hover { background: var(--color-bg-soft); color: var(--color-text); }

/* ----------------------------- Utility ----------------------------- */

.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }
.mt-3 { margin-top: 24px; } .mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.notice {
  padding: 12px 14px; border-radius: var(--radius);
  font-size: .92rem; margin-bottom: 14px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-soft);
  color: var(--color-text-soft);
}
.notice-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.notice-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.notice-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }

/* SERP preview */
.serp-preview {
  border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 18px; background: #fff;
  font-family: arial, sans-serif;
  max-width: 600px;
}
.serp-preview .serp-url { color: #202124; font-size: .82rem; }
.serp-preview .serp-title { color: #1a0dab; font-size: 1.25rem; margin: 4px 0; line-height: 1.3; }
.serp-preview .serp-desc { color: #4d5156; font-size: .88rem; line-height: 1.5; }
