/*
Theme Name: usfans Spreadsheet
Theme URI: https://sheetcn.com/
Author: usfans Spreadsheet Team
Author URI: https://sheetcn.com/
Description: A fast, SEO-optimized WordPress theme built for the usfans Spreadsheet brand. Includes a product-category dropdown, Guides dropdown, hero CTAs linking to the main sheetcn.com site, auto-generated SEO articles, internal linking, Open Graph, Twitter Cards, and JSON-LD structured data.
Version: 1.0.0
Requires at least: 5.8
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: usfans-spreadsheet
Tags: seo, blog, one-column, two-columns, right-sidebar, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ===== Design tokens ===== */
:root {
    --color-bg: #ffffff;
    --color-surface: #f8fafc;
    --color-surface-2: #f1f5f9;
    --color-border: #e2e8f0;
    --color-text: #0f172a;
    --color-text-soft: #475569;
    --color-text-muted: #64748b;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-accent: #f59e0b;
    --color-accent-dark: #d97706;
    --color-success: #10b981;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.18);
    --container: 1180px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--color-primary-dark); }
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-text);
    margin: 0 0 .6em;
    letter-spacing: -0.015em;
}
h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }
p { margin: 0 0 1.1em; color: var(--color-text-soft); }
ul, ol { padding-left: 1.4em; margin: 0 0 1.2em; color: var(--color-text-soft); }
li { margin-bottom: .35em; }
hr { border: 0; border-top: 1px solid var(--color-border); margin: 2em 0; }
blockquote {
    margin: 1.5em 0;
    padding: 1em 1.4em;
    border-left: 4px solid var(--color-primary);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-style: italic;
}
code {
    background: var(--color-surface-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .92em;
}

/* ===== Layout ===== */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.section { padding: 72px 0; }
.section-tight { padding: 48px 0; }
.section-alt { background: var(--color-surface); }

/* ===== Header ===== */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    background: rgba(255, 255, 255, 0.92);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    gap: 20px;
}
.site-branding { display: flex; align-items: center; gap: 10px; }
.site-logo {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #7c3aed 100%);
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-family: var(--font-display);
    box-shadow: var(--shadow-sm);
}
.site-title { font-size: 1.2rem; font-weight: 800; margin: 0; letter-spacing: -0.015em; }
.site-title a { color: var(--color-text); }
.site-tagline { font-size: .78rem; color: var(--color-text-muted); margin: 0; }

/* Main nav */
.main-nav { display: flex; align-items: center; }
.main-nav > ul {
    list-style: none;
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 0;
}
.main-nav li { position: relative; margin: 0; }
.main-nav a {
    display: inline-block;
    padding: 10px 14px;
    color: var(--color-text);
    font-weight: 600;
    font-size: .95rem;
    border-radius: var(--radius-md);
    transition: background .2s ease, color .2s ease;
}
.main-nav a:hover { background: var(--color-surface); color: var(--color-primary); }

/* Dropdown */
.menu-item-has-children > a::after {
    content: "";
    display: inline-block;
    width: 8px; height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    margin-left: 8px;
    opacity: .7;
}
.main-nav .sub-menu {
    list-style: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 8px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
    margin: 0;
    z-index: 50;
}
.main-nav li:hover > .sub-menu,
.main-nav li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.main-nav .sub-menu li { margin: 0; }
.main-nav .sub-menu a {
    padding: 9px 12px;
    display: block;
    font-size: .92rem;
    font-weight: 500;
    color: var(--color-text-soft);
    border-radius: var(--radius-sm);
}
.main-nav .sub-menu a:hover {
    background: var(--color-surface);
    color: var(--color-primary);
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--color-border);
    width: 42px; height: 42px;
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 0;
    align-items: center; justify-content: center;
}
.menu-toggle span {
    display: block;
    width: 20px; height: 2px;
    background: var(--color-text);
    position: relative;
}
.menu-toggle span::before, .menu-toggle span::after {
    content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: var(--color-text);
}
.menu-toggle span::before { top: -6px; }
.menu-toggle span::after { top: 6px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .15s ease, background .2s ease, box-shadow .2s ease, color .2s ease;
    line-height: 1.1;
    letter-spacing: -0.01em;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; box-shadow: 0 10px 24px rgba(37, 99, 235, 0.42); }
.btn-accent {
    background: var(--color-accent);
    color: #1a1a1a;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}
.btn-accent:hover { background: var(--color-accent-dark); color: #1a1a1a; box-shadow: 0 10px 24px rgba(245, 158, 11, 0.45); }
.btn-outline {
    background: #fff;
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-lg { padding: 16px 30px; font-size: 1.08rem; }
.btn-sm { padding: 8px 14px; font-size: .9rem; }

/* ===== Hero ===== */
.hero {
    position: relative;
    padding: 90px 0 80px;
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(37, 99, 235, 0.12), transparent 60%),
        radial-gradient(900px 500px at 100% 10%, rgba(124, 58, 237, 0.12), transparent 60%),
        linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    overflow: hidden;
}
.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-primary);
    font-weight: 600;
    font-size: .82rem;
    border-radius: 999px;
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.hero-eyebrow::before {
    content: ""; width: 8px; height: 8px; background: var(--color-success); border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
}
.hero h1 { margin: 0 0 20px; max-width: 820px; }
.hero p.hero-lede {
    font-size: clamp(1.05rem, 1.8vw, 1.22rem);
    color: var(--color-text-soft);
    max-width: 720px;
    margin: 0 0 32px;
    line-height: 1.6;
}
.hero-actions {
    display: flex; flex-wrap: wrap; gap: 14px;
    margin-bottom: 36px;
}
.hero-stats {
    display: flex; flex-wrap: wrap; gap: 36px;
    padding-top: 28px;
    border-top: 1px solid var(--color-border);
}
.hero-stat strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: 4px;
}
.hero-stat span { font-size: .9rem; color: var(--color-text-muted); }

/* ===== Section headings ===== */
.section-head { text-align: center; max-width: 740px; margin: 0 auto 48px; }
.section-head p { font-size: 1.05rem; color: var(--color-text-soft); }

/* ===== Category grid ===== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}
.category-card {
    display: block;
    padding: 24px 20px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    text-align: left;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    color: var(--color-text);
    position: relative;
    overflow: hidden;
}
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
    color: var(--color-text);
}
.category-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), #7c3aed);
    opacity: 0; transition: opacity .2s ease;
}
.category-card:hover::before { opacity: 1; }
.category-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--color-surface);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 14px;
}
.category-card h3 {
    font-size: 1.1rem;
    margin: 0 0 6px;
}
.category-card p {
    font-size: .9rem;
    color: var(--color-text-muted);
    margin: 0;
}
.category-card .cat-link {
    display: inline-flex; align-items: center; gap: 4px;
    margin-top: 12px;
    font-size: .88rem;
    color: var(--color-primary);
    font-weight: 600;
}
.category-card .cat-link::after {
    content: "→"; transition: transform .2s ease;
}
.category-card:hover .cat-link::after { transform: translateX(3px); }

/* ===== Article grid ===== */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}
.article-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
    height: 100%;
}
.article-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.article-thumb {
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #e0e7ff 0%, #fef3c7 100%);
    position: relative;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    color: #475569;
    font-size: 1.1rem;
    padding: 20px;
    text-align: center;
}
.article-thumb-1 { background: linear-gradient(135deg, #dbeafe 0%, #ede9fe 100%); }
.article-thumb-2 { background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%); }
.article-thumb-3 { background: linear-gradient(135deg, #d1fae5 0%, #cffafe 100%); }
.article-thumb-4 { background: linear-gradient(135deg, #fce7f3 0%, #fecaca 100%); }
.article-thumb-5 { background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 100%); }
.article-thumb-6 { background: linear-gradient(135deg, #fef9c3 0%, #d9f99d 100%); }
.article-body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.article-tag {
    display: inline-flex;
    align-self: flex-start;
    padding: 4px 10px;
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 999px;
    margin-bottom: 10px;
}
.article-card h3 {
    font-size: 1.15rem;
    margin: 0 0 10px;
}
.article-card h3 a { color: var(--color-text); }
.article-card h3 a:hover { color: var(--color-primary); }
.article-excerpt {
    color: var(--color-text-muted);
    font-size: .94rem;
    margin: 0 0 16px;
    flex-grow: 1;
}
.article-meta {
    display: flex; align-items: center; justify-content: space-between;
    font-size: .85rem;
    color: var(--color-text-muted);
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
}
.article-meta a { font-weight: 600; }

/* ===== Main article (homepage long-form) ===== */
.longform {
    max-width: 760px;
    margin: 0 auto;
    font-size: 1.05rem;
    line-height: 1.75;
}
.longform h2 {
    margin-top: 2em;
    padding-top: .4em;
}
.longform h3 { margin-top: 1.6em; }
.longform p, .longform ul, .longform ol { color: var(--color-text); }
.longform .toc {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin: 24px 0 40px;
}
.longform .toc h4 { margin: 0 0 10px; font-size: 1rem; }
.longform .toc ol { margin: 0; padding-left: 1.2em; }
.longform .toc a { font-weight: 500; }

/* ===== CTA band ===== */
.cta-band {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    border-radius: var(--radius-xl);
    padding: 48px 36px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.cta-band::before {
    content: "";
    position: absolute;
    top: -50%; right: -20%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.3), transparent 60%);
}
.cta-band h2 { color: #fff; margin: 0 0 12px; position: relative; }
.cta-band p { color: #cbd5e1; font-size: 1.05rem; margin: 0 0 24px; position: relative; }
.cta-band .btn-group { position: relative; display: inline-flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ===== Single post / page ===== */
.post-hero {
    padding: 60px 0 20px;
    background: var(--color-surface);
}
.post-hero .container { max-width: 820px; }
.breadcrumbs {
    font-size: .88rem;
    color: var(--color-text-muted);
    margin-bottom: 14px;
}
.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-primary); }
.breadcrumbs .sep { margin: 0 6px; opacity: .6; }
.post-category {
    display: inline-block;
    padding: 5px 12px;
    background: var(--color-primary);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 999px;
    margin-bottom: 14px;
}
.post-hero h1 { margin: 0 0 16px; }
.post-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
    color: var(--color-text-muted);
    font-size: .92rem;
    padding: 10px 0 30px;
}
.single-content, .page-content {
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 0 60px;
    font-size: 1.05rem;
    line-height: 1.78;
}
.single-content h2, .page-content h2 { margin-top: 1.8em; }
.single-content h3, .page-content h3 { margin-top: 1.4em; }
.single-content p, .page-content p { color: var(--color-text); }

/* Internal-link block */
.internal-link-box {
    background: var(--color-surface);
    border-left: 4px solid var(--color-primary);
    padding: 18px 22px;
    border-radius: var(--radius-md);
    margin: 28px 0;
}
.internal-link-box strong { display: block; color: var(--color-text); margin-bottom: 4px; }
.internal-link-box a { font-weight: 600; }

/* Related posts */
.related-posts {
    background: var(--color-surface);
    padding: 56px 0;
    border-top: 1px solid var(--color-border);
}
.related-posts h2 { text-align: center; margin-bottom: 32px; }

/* ===== Footer ===== */
.site-footer {
    background: #0f172a;
    color: #cbd5e1;
    padding: 60px 0 20px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}
.footer-brand .site-title a { color: #fff; }
.footer-brand p { color: #94a3b8; font-size: .95rem; margin-top: 10px; }
.footer-col h4 {
    color: #fff;
    font-size: .9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 16px;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: #94a3b8; font-size: .94rem; }
.footer-col a:hover { color: #fff; }
.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid #1e293b;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    font-size: .88rem;
    color: #64748b;
}

/* ===== Pagination ===== */
.pagination {
    display: flex; justify-content: center; gap: 8px; margin: 40px 0 0;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-weight: 600;
}
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ===== Responsive ===== */
@media (max-width: 860px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .hero { padding: 60px 0; }
    .hero-stats { gap: 24px; }
    .hero-stat strong { font-size: 1.5rem; }
    .cta-band { padding: 36px 24px; }
    .section { padding: 56px 0; }
}

@media (max-width: 720px) {
    .menu-toggle { display: inline-flex; }
    .main-nav {
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: #fff;
        border-bottom: 1px solid var(--color-border);
        box-shadow: var(--shadow-md);
        display: none;
    }
    .main-nav.is-open { display: block; }
    .main-nav > ul {
        flex-direction: column;
        padding: 10px 16px 16px;
        gap: 2px;
    }
    .main-nav > ul > li { width: 100%; }
    .main-nav a { width: 100%; padding: 12px 10px; }
    .main-nav .sub-menu {
        position: static;
        box-shadow: none;
        border: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        padding: 0 0 8px 16px;
        min-width: 0;
    }
    .menu-item-has-children > a::after { float: right; margin-top: 8px; }
}

@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .btn { width: 100%; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; }
}

/* ===== Utilities ===== */
.screen-reader-text {
    border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
    height: 1px; margin: -1px; overflow: hidden; padding: 0;
    position: absolute; width: 1px; word-wrap: normal !important;
}
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
