/*
Theme Name: OnlyTopic Directory
Theme URI: https://onlytopic.com
Description: Custom business directory theme for OnlyTopic. Businesses get their own profile page with posts, logo, cover photo, contact info, and social links.
Version: 1.0.0
Author: Key-En-Lock
Author URI: https://keyenlock.com
Text Domain: onlytopic
*/

/* ── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:    #1a56db;
    --primary-dk: #1340a8;
    --accent:     #f59e0b;
    --dark:       #111827;
    --ink:        #374151;
    --muted:      #6b7280;
    --border:     #e5e7eb;
    --bg:         #f9fafb;
    --white:      #ffffff;
    --radius:     10px;
    --shadow:     0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg:  0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
    font-size: 16px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ── Layout ───────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-sm {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Header ───────────────────────────────────────── */
#site-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.site-logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.site-logo span { color: var(--accent); }

.header-nav { display: flex; align-items: center; gap: 24px; }
.header-nav a { font-size: 0.9rem; font-weight: 500; color: var(--ink); }
.header-nav a:hover { color: var(--primary); text-decoration: none; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); color: #fff; text-decoration: none; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ── Hero ─────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 60%, #7c3aed 100%);
    padding: 80px 0;
    text-align: center;
    color: #fff;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero p {
    font-size: 1.15rem;
    opacity: .88;
    max-width: 540px;
    margin: 0 auto 36px;
}

.hero-search {
    display: flex;
    max-width: 560px;
    margin: 0 auto;
    background: #fff;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.hero-search input {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px 20px;
    font-size: 1rem;
    color: var(--ink);
    background: transparent;
}

.hero-search button {
    background: var(--accent);
    border: none;
    padding: 14px 28px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--dark);
    transition: background .2s;
}

.hero-search button:hover { background: #d97706; }

/* ── Section ──────────────────────────────────────── */
.section { padding: 60px 0; }
.section-sm { padding: 40px 0; }

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

.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.5px;
}

/* ── Category Grid ────────────────────────────────── */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.cat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    transition: all .2s;
    cursor: pointer;
    text-decoration: none;
    color: var(--ink);
}

.cat-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--primary);
}

.cat-icon { font-size: 2rem; margin-bottom: 10px; }
.cat-name { font-size: 0.85rem; font-weight: 600; }
.cat-count { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

/* ── Business Card ────────────────────────────────── */
.biz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.biz-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all .2s;
    text-decoration: none;
    color: var(--ink);
    display: block;
}

.biz-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    text-decoration: none;
    border-color: #d1d5db;
}

.biz-card-cover {
    height: 140px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    position: relative;
    overflow: hidden;
}

.biz-card-cover img { width: 100%; height: 100%; object-fit: cover; }

.biz-card-logo {
    position: absolute;
    bottom: -20px;
    left: 20px;
    width: 52px;
    height: 52px;
    border-radius: 10px;
    border: 3px solid #fff;
    background: #fff;
    overflow: hidden;
    box-shadow: var(--shadow);
    z-index: 2;
}

.biz-card-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; background: #fff; }
.biz-card-logo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.biz-card-body { padding: 28px 20px 20px; }

.biz-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
}

.biz-card-cat {
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.biz-card-desc {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.biz-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.biz-card-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--muted);
}

.biz-card-meta-item svg {
    flex-shrink: 0;
    color: var(--muted);
}

/* ── Business Profile Page ────────────────────────── */
.biz-profile-cover {
    height: 340px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    position: relative;
    overflow: hidden;
}

.biz-profile-cover img { width: 100%; height: 100%; object-fit: cover; }

.biz-profile-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding-bottom: 24px;
}

.biz-profile-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: flex-end;
    gap: 24px;
    margin-top: -40px;
}

.biz-profile-logo {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    border: 4px solid #fff;
    background: #fff;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.biz-profile-logo img { width: 100%; height: 100%; object-fit: cover; }

.biz-profile-info { flex: 1; padding-top: 48px; }
.biz-profile-name { font-size: 1.8rem; font-weight: 800; color: var(--dark); letter-spacing: -0.5px; }
.biz-profile-cat { font-size: 0.9rem; color: var(--primary); font-weight: 600; margin: 4px 0 8px; }
.biz-profile-tagline { color: var(--muted); font-size: 0.95rem; }

.biz-profile-actions { display: flex; gap: 10px; align-items: center; padding-top: 48px; }

.biz-profile-body {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
}

.biz-sidebar { display: flex; flex-direction: column; gap: 20px; }

.sidebar-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.sidebar-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 14px;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--ink);
}

.contact-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }

/* ── Posts ────────────────────────────────────────── */
.post-list { display: flex; flex-direction: column; gap: 24px; }

.post-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .2s;
}

.post-card:hover { box-shadow: var(--shadow-md); }

.post-card-inner { padding: 24px; }

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--muted);
}

.post-author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.post-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
    line-height: 1.4;
}

.post-title a { color: inherit; }
.post-title a:hover { color: var(--primary); text-decoration: none; }

.post-excerpt { font-size: 0.9rem; color: var(--muted); line-height: 1.6; }

/* ── Single Post ─────────────────────────────────────────────────────── */
.single-post-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
    align-items: start;
}

.single-post-thumb { margin-bottom: 28px; }

.single-post-header { margin-bottom: 28px; }

.single-post-title {
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 800;
    color: var(--dark);
    line-height: 1.25;
    margin-bottom: 0;
}

.single-post-content {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--ink);
    margin-bottom: 32px;
}
.single-post-content h2 { font-size: 1.35rem; font-weight: 700; color: var(--dark); margin: 32px 0 12px; }
.single-post-content h3 { font-size: 1.1rem;  font-weight: 700; color: var(--dark); margin: 24px 0 10px; }
.single-post-content p  { margin-bottom: 18px; }
.single-post-content a  { color: var(--primary); }
.single-post-content ul,
.single-post-content ol { padding-left: 24px; margin-bottom: 18px; }
.single-post-content li { margin-bottom: 6px; }
.single-post-content img { max-width: 100%; border-radius: var(--radius); margin: 8px 0; }
.single-post-content blockquote {
    border-left: 4px solid var(--primary);
    margin: 24px 0;
    padding: 12px 20px;
    background: #eff6ff;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--ink);
}

/* Tags */
.single-post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.badge-secondary {
    background: var(--bg);
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 20px;
    text-decoration: none;
}
.badge-secondary:hover { background: var(--border); color: var(--ink); text-decoration: none; }

/* Attribution bar */
.single-post-attribution {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}
.attribution-logo {
    width: 60px; height: 60px; border-radius: 12px; overflow: hidden;
    flex-shrink: 0; background: var(--bg); border: 1px solid var(--border);
}
.attribution-logo img { width: 100%; height: 100%; object-fit: cover; }
.attribution-info { flex: 1; min-width: 160px; }
.attribution-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 2px; }
.attribution-name { font-size: 1rem; font-weight: 700; color: var(--dark); text-decoration: none; }
.attribution-name:hover { color: var(--primary); text-decoration: none; }
.attribution-tagline { font-size: 0.85rem; color: var(--muted); margin: 4px 0 0; }
.attribution-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Related posts */
.single-post-related { margin-top: 8px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.related-card { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--white); text-decoration: none; transition: box-shadow .2s; }
.related-card:hover { box-shadow: var(--shadow-md); text-decoration: none; }
.related-card-thumb { height: 120px; overflow: hidden; }
.related-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-card-thumb--blank { display: flex; align-items: center; justify-content: center; background: var(--bg); font-size: 1.8rem; }
.related-card-body { padding: 12px; }
.related-card-date { font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; }
.related-card-title { font-size: 0.88rem; font-weight: 700; color: var(--dark); line-height: 1.4; margin: 0; }

/* Sidebar — business card */
.sidebar-biz-card { text-align: center; }
.sidebar-biz-logo { width: 80px; height: 80px; border-radius: 14px; overflow: hidden; margin: 0 auto 14px; background: var(--bg); border: 1px solid var(--border); }
.sidebar-biz-logo img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-biz-name { font-size: 1.05rem; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
.sidebar-biz-cat { font-size: 0.8rem; color: var(--primary); font-weight: 600; margin-bottom: 8px; }
.sidebar-biz-tagline { font-size: 0.85rem; color: var(--muted); line-height: 1.5; margin-bottom: 16px; }
.sidebar-biz-actions { display: flex; flex-direction: column; gap: 8px; }

/* Sidebar — advertise CTA */
.sidebar-advertise-cta { background: linear-gradient(135deg, #1a56db 0%, #1340a8 100%); color: #fff; text-align: center; }
.advertise-cta-icon { font-size: 2rem; margin-bottom: 10px; }
.advertise-cta-title { font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: 8px; }
.advertise-cta-text { font-size: 0.85rem; color: rgba(255,255,255,.8); line-height: 1.6; margin-bottom: 16px; }
.sidebar-advertise-cta .btn-primary { background: #fff; color: var(--primary); }
.sidebar-advertise-cta .btn-primary:hover { background: #eff6ff; }

/* Responsive — single post */
@media (max-width: 900px) {
    .single-post-layout { grid-template-columns: 1fr; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
    .related-grid { grid-template-columns: 1fr; }
    .single-post-attribution { flex-direction: column; align-items: flex-start; }
}

/* ── Footer ───────────────────────────────────────── */
#site-footer {
    background: var(--dark);
    color: #9ca3af;
    padding: 48px 0 24px;
    margin-top: 80px;
}

.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 40px;
}

.footer-brand .site-logo { color: #fff; margin-bottom: 12px; display: block; }
.footer-tagline { font-size: 0.875rem; line-height: 1.7; }

.footer-col h4 { color: #fff; font-size: 0.85rem; font-weight: 700; margin-bottom: 14px; text-transform: uppercase; letter-spacing: 1px; }
.footer-col a { display: block; font-size: 0.875rem; color: #9ca3af; margin-bottom: 8px; }
.footer-col a:hover { color: #fff; text-decoration: none; }

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

/* ── Forms ────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--ink);
    background: #fff;
    transition: border-color .2s;
    outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ── Badges ───────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-primary { background: #eff6ff; color: var(--primary); }
.badge-accent  { background: #fef3c7; color: #92400e; }
.badge-green   { background: #ecfdf5; color: #065f46; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
    .biz-profile-body { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; gap: 32px; }
    .biz-grid { grid-template-columns: 1fr; }
    .header-nav .btn-outline { display: none; }
    .biz-profile-header-inner { flex-direction: column; align-items: flex-start; }
    .biz-profile-actions { padding-top: 0; }
}
