/* ============================================
   CSS Variables & Reset
   ============================================ */
:root {
    --bg: #ffffff;
    --bg-alt: #f8f9fb;
    --bg-card: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --text-hint: #9ca3af;
    --border: #e5e7eb;
    --border-hover: #d1d5db;
    --accent: #2563eb;
    --accent-soft: #eff4ff;
    --accent-text: #1d4ed8;
    --success: #059669;
    --success-soft: #ecfdf5;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 100px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --max-w: 1120px;
    --transition: 0.15s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; }

[x-cloak] { display: none !important; }

/* ============================================
   Layout
   ============================================ */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }
.container-narrow { max-width: 720px; }

/* ============================================
   HERO — Homepage Search Section
   ============================================ */
.hero {
    min-height: 52vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 3rem 1.25rem 2rem;
}

.hero-inner {
    width: 100%;
    max-width: 640px;
    text-align: center;
}

.hero-logo img {
    height: 48px;
    margin: 0 auto 2rem;
}

/* Search Box */
.search-form { width: 100%; }

.search-box { position: relative; }

.search-input-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg);
    padding: 4px 4px 4px 16px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-hint);
    flex-shrink: 0;
}

.search-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 10px 12px;
    background: transparent;
    color: var(--text);
    font-family: var(--font);
}

.search-input-wrap input::placeholder { color: var(--text-hint); }

.search-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 600;
    transition: background var(--transition), transform var(--transition);
}

.search-btn:hover { background: var(--accent-text); }
.search-btn:active { transform: scale(0.97); }

/* Autocomplete */
.suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 50;
    overflow: hidden;
}

.suggestion-item {
    display: block;
    padding: 10px 16px;
    font-size: 0.875rem;
    color: var(--text);
    transition: background var(--transition);
}

.suggestion-item:hover { background: var(--bg-alt); }

/* Engine Tabs */
.engine-tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.engine-tab {
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: transparent;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all var(--transition);
}

.engine-tab.active,
.engine-tab:hover {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.hero-tagline {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-hint);
}

/* ============================================
   Sections
   ============================================ */
.section { padding: 2.5rem 0; }
.section + .section { border-top: 1px solid var(--border); }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
}

.section-link:hover { text-decoration: underline; }

/* ============================================
   Trending Pills
   ============================================ */
.pill-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.trend-pill {
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    background: var(--bg-alt);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.trend-pill:hover {
    background: var(--accent-soft);
    color: var(--accent-text);
    border-color: var(--accent);
}

/* ============================================
   Keyword Cards Grid
   ============================================ */
.kw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.kw-grid-dense { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.kw-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    transition: all var(--transition);
}

.kw-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.kw-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text);
}

.kw-card:hover .kw-card-title { color: var(--accent-text); }

.kw-card-meta { display: flex; gap: 6px; align-items: center; }

.kw-tag {
    font-size: 0.6875rem;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--bg-alt);
    color: var(--text-muted);
    font-weight: 500;
}

.kw-badge {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kw-badge.trending { background: var(--success-soft); color: var(--success); }

/* ============================================
   Category Grid (Homepage)
   ============================================ */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    transition: all var(--transition);
}

.cat-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.cat-icon { font-size: 1.75rem; }
.cat-name { font-size: 0.875rem; font-weight: 600; }
.cat-count { font-size: 0.75rem; color: var(--text-muted); }

/* ============================================
   Category Page — Full Blocks
   ============================================ */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.category-block {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-block:hover { border-color: var(--accent); box-shadow: var(--shadow); }

.category-block-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.category-block-icon { font-size: 1.5rem; }
.category-block-name { font-size: 1.125rem; font-weight: 600; flex: 1; }
.category-block-count { font-size: 0.75rem; color: var(--text-muted); background: var(--bg-alt); padding: 2px 10px; border-radius: var(--radius-pill); }
.category-block-desc { font-size: 0.8125rem; color: var(--text-muted); }

.category-block-subs { display: flex; gap: 6px; flex-wrap: wrap; }

.sub-chip {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: var(--bg-alt);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
}

.sub-chip-count { font-weight: 600; }
.sub-chip-more { color: var(--accent); }

/* Subcategory pills */
.sub-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 2rem; }

.sub-pill {
    font-size: 0.8125rem;
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    transition: all var(--transition);
}

.sub-pill:hover, .sub-pill.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Sub section */
.sub-section { margin-bottom: 2.5rem; }
.sub-section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; }
.sub-section-title { font-size: 1rem; font-weight: 600; }
.sub-section-count { font-size: 0.75rem; color: var(--text-muted); }

/* ============================================
   Blog / Posts
   ============================================ */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.post-grid-full { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.post-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    transition: all var(--transition);
}

.post-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }

.post-img {
    height: 160px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-alt);
}

.post-body { padding: 16px; }

.post-cat {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
}

.post-title { font-size: 0.9375rem; font-weight: 600; margin-top: 4px; line-height: 1.4; }
.post-excerpt { font-size: 0.8125rem; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.post-date { font-size: 0.75rem; color: var(--text-hint); margin-top: 8px; display: block; }

/* Article */
.article-header { margin-bottom: 2rem; }
.article-title { font-size: 2rem; font-weight: 700; line-height: 1.3; margin-top: 8px; }
.article-meta { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--text-muted); margin-top: 12px; }
.meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-hint); }
.article-image { border-radius: var(--radius); overflow: hidden; margin-bottom: 2rem; }
.article-image img { width: 100%; }

/* Prose */
.prose { font-size: 1.0625rem; line-height: 1.8; color: var(--text); }
.prose h2 { font-size: 1.375rem; font-weight: 600; margin: 2rem 0 0.75rem; }
.prose h3 { font-size: 1.125rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.prose li { margin-bottom: 0.25rem; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose img { border-radius: var(--radius-sm); margin: 1.5rem 0; }
.prose blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; margin: 1.5rem 0; color: var(--text-muted); }

/* ============================================
   SERP — Search Results Page
   ============================================ */
.search-nav {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
}

.search-nav-inner { display: flex; align-items: center; gap: 16px; }

.search-nav-logo img { height: 28px; }

.search-nav-form { flex: 1; max-width: 600px; }

.search-nav-box {
    position: relative;
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 2px 2px 2px 14px;
    transition: border-color var(--transition);
}

.search-nav-box:focus-within { border-color: var(--accent); }

.search-nav-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.875rem;
    padding: 8px;
    background: transparent;
    font-family: var(--font);
    color: var(--text);
}

.search-nav-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.search-nav-btn:hover { background: var(--accent-text); }

.serp-suggestions { top: calc(100% + 4px); }

.engine-bar {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0;
}

.serp-tabs { justify-content: flex-start; margin-top: 0; gap: 0; }

.serp-tabs .engine-tab {
    border: none;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    font-size: 0.8125rem;
}

.serp-tabs .engine-tab.active {
    background: transparent;
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.serp-tabs .engine-tab:hover:not(.active) {
    background: transparent;
    color: var(--text);
    border-color: transparent;
}

.serp-main { padding: 1.5rem 0 3rem; min-height: 60vh; }
.serp-container { max-width: 780px; }

.gcse-results-wrap { min-height: 400px; }

.ad-unit { margin: 1rem 0; }

/* ============================================
   Navbar (inner pages)
   ============================================ */
.navbar {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 40;
}

.navbar-inner {
    display: flex;
    align-items: center;
    height: 56px;
    gap: 24px;
}

.navbar-logo img { height: 26px; }

.navbar-links { display: flex; gap: 4px; }

.navbar-links a {
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    transition: all var(--transition);
}

.navbar-links a:hover, .navbar-links a.active { background: var(--bg-alt); color: var(--text); }

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    margin-left: auto;
}

.navbar-mobile {
    display: none;
    flex-direction: column;
    padding: 0 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}

.navbar-mobile a {
    padding: 10px 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

/* ============================================
   Page Header
   ============================================ */
.main-content { padding: 2rem 0 3rem; }

.page-header { margin-bottom: 2rem; }
.page-heading { font-size: 1.75rem; font-weight: 700; }
.page-subtitle { font-size: 0.9375rem; color: var(--text-muted); margin-top: 6px; }

.breadcrumbs {
    font-size: 0.8125rem;
    color: var(--text-hint);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { color: var(--text-hint); }

/* ============================================
   Footer
   ============================================ */
.footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    background: var(--bg-alt);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
}

.footer-logo { font-weight: 700; font-size: 1rem; }
.footer-desc { font-size: 0.8125rem; color: var(--text-muted); }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.footer-links a { font-size: 0.8125rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: 0.75rem; color: var(--text-hint); }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 0; color: var(--text-muted); }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .hero { min-height: 44vh; padding: 2rem 1rem 1.5rem; }
    .hero-logo img { height: 36px; margin-bottom: 1.5rem; }

    .kw-grid { grid-template-columns: 1fr; }
    .cat-grid { grid-template-columns: repeat(2, 1fr); }
    .post-grid { grid-template-columns: 1fr; }
    .categories-grid { grid-template-columns: 1fr; }

    .navbar-links { display: none; }
    .navbar-toggle { display: block; }
    .navbar-mobile { display: flex; }

    .search-nav-inner { flex-wrap: wrap; }
    .search-nav-form { order: 3; flex-basis: 100%; max-width: 100%; }

    .article-title { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .cat-grid { grid-template-columns: 1fr; }
    .engine-tabs { gap: 4px; }
    .engine-tab { padding: 5px 12px; font-size: 0.75rem; }
}
