/*
 * SPN Engine — Main Stylesheet
 * SPN Publishing Engine
 * Theme colours are injected as CSS variables by layout.php from site config.
 * Do not hardcode theme colours here — always use var(--spn-*).
 */

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--spn-bg, #f8fafc);
    color: var(--spn-text, #1a2433);
    line-height: 1.7;
}

a { color: var(--spn-accent, #2979ff); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── Layout Containers ── */
.spn-header-inner,
.spn-footer-inner,
#spn-main,
.spn-section-inner {
    max-width: var(--spn-max-width, 1100px);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ── Header ── */
.spn-header {
    background: var(--spn-primary, #1a3a5c);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.spn-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
    gap: 1rem;
}

.spn-logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
    text-decoration: none;
    flex-shrink: 0;
}

.spn-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.spn-nav ul li a {
    color: rgba(255,255,255,0.9);
    font-size: 0.93rem;
    font-weight: 500;
    transition: color 0.15s;
}

.spn-nav ul li a:hover {
    color: #fff;
    text-decoration: none;
}

/* CSS-only hamburger */
.spn-nav-toggle { display: none; }
.spn-nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
}
.spn-nav-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s;
}

@media (max-width: 768px) {
    .spn-nav-hamburger { display: flex; }
    .spn-nav {
        display: none;
        width: 100%;
        padding-bottom: 0.75rem;
    }
    .spn-nav-toggle:checked ~ .spn-nav { display: block; }
    .spn-nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }
    .spn-header-inner { flex-wrap: wrap; }
}

/* ── Hero ── */
.spn-hero {
    background: var(--spn-primary, #1a3a5c);
    color: #fff;
    padding: 3.5rem 1.25rem 3rem;
    text-align: center;
}

.spn-hero h1 {
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    font-weight: 800;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.spn-hero p {
    font-size: 1.1rem;
    opacity: 0.88;
    max-width: 600px;
    margin: 0 auto;
}

/* ── Topic Cards on Home ── */
.spn-topic-cards {
    padding: 2.5rem 1.25rem;
    max-width: var(--spn-max-width, 1100px);
    margin: 0 auto;
}

.spn-topic-cards h2 {
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
    color: var(--spn-primary, #1a3a5c);
}

/* ── Card Grid ── */
.spn-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.spn-card {
    background: #fff;
    border: 1px solid #dce4ef;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: box-shadow 0.15s;
}

.spn-card:hover { box-shadow: 0 4px 16px rgba(26,58,92,0.1); }

.spn-card-tag, .spn-article-tag {
    display: inline-block;
    background: var(--spn-accent, #2979ff);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2em 0.6em;
    border-radius: 4px;
}

.spn-card-title { font-size: 1.05rem; font-weight: 700; margin-top: 0.25rem; }
.spn-card-title a { color: var(--spn-primary, #1a3a5c); }
.spn-card-title a:hover { color: var(--spn-accent, #2979ff); text-decoration: none; }

.spn-card-summary { font-size: 0.91rem; color: #4a5568; }
.spn-card-date { font-size: 0.82rem; color: #718096; margin-top: auto; }

.spn-card-cta {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--spn-accent, #2979ff);
}

/* ── Latest Articles Section ── */
.spn-latest-articles {
    background: #fff;
    padding: 2.5rem 1.25rem;
}

.spn-latest-articles-inner {
    max-width: var(--spn-max-width, 1100px);
    margin: 0 auto;
}

.spn-latest-articles h2 {
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
    color: var(--spn-primary, #1a3a5c);
}

.spn-latest-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.spn-latest-list li a {
    font-size: 1rem;
    font-weight: 500;
    color: var(--spn-primary, #1a3a5c);
}

.spn-latest-list li a:hover { color: var(--spn-accent, #2979ff); }

/* ── Site Description Strip ── */
.spn-site-desc {
    padding: 2rem 1.25rem;
    max-width: var(--spn-max-width, 1100px);
    margin: 0 auto;
    color: #4a5568;
    font-size: 0.97rem;
    border-top: 1px solid #e2e8f0;
}

/* ── Article Page ── */
.spn-article {
    max-width: var(--spn-article-width, 780px);
    margin: 2.5rem auto;
    padding: 0 1.25rem;
}

.spn-article-header { margin-bottom: 1.5rem; }

.spn-article-header h1 {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--spn-primary, #1a3a5c);
    margin-top: 0.5rem;
    line-height: 1.25;
}

.spn-article-date { font-size: 0.85rem; color: #718096; margin-top: 0.4rem; }

.spn-article-body h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--spn-primary, #1a3a5c);
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

.spn-article-body h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
}

.spn-article-body p { margin-bottom: 1rem; }

.spn-article-body ul, .spn-article-body ol {
    margin: 0.75rem 0 1rem 1.5rem;
}

.spn-article-body li { margin-bottom: 0.35rem; }

/* ── AdSense Slots ── */
.spn-adsense-wrapper { margin: 1.75rem 0; }

.spn-adsense-placeholder {
    background: #f0f4f8;
    border: 2px dashed #cbd5e0;
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
    color: #718096;
    font-size: 0.82rem;
}

/* ── Ops Note Block ── */
.spn-ops-note {
    background: #eef4ff;
    border-left: 4px solid var(--spn-accent, #2979ff);
    border-radius: 0 6px 6px 0;
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
}

.spn-ops-note h3 {
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--spn-accent, #2979ff);
    margin-bottom: 0.5rem;
}

.spn-ops-note p { font-size: 0.94rem; color: #2d3748; }

/* ── Sources ── */
.spn-sources { margin: 2rem 0; padding-top: 1rem; border-top: 1px solid #e2e8f0; }
.spn-sources h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.5rem; }
.spn-sources ul { list-style: none; }
.spn-sources li { margin-bottom: 0.3rem; font-size: 0.88rem; }
.spn-sources a { word-break: break-all; }

/* ── FAQ ── */
.spn-faq { margin: 2.5rem 0; }
.spn-faq h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; color: var(--spn-primary, #1a3a5c); }
.spn-faq-item { margin-bottom: 1.25rem; }
.spn-faq-item h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.35rem; }
.spn-faq-item p { font-size: 0.94rem; color: #4a5568; }

/* ── Related Articles ── */
.spn-related-articles { margin: 2rem 0; border-top: 1px solid #e2e8f0; padding-top: 1rem; }
.spn-related-articles h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; }
.spn-related-articles ul { list-style: none; }
.spn-related-articles li { margin-bottom: 0.35rem; font-size: 0.93rem; }

/* ── Article Index ── */
.spn-article-index {
    max-width: var(--spn-max-width, 1100px);
    margin: 2rem auto;
    padding: 0 1.25rem;
}

.spn-article-index h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--spn-primary, #1a3a5c);
    margin-bottom: 0.5rem;
}

.spn-index-intro { color: #4a5568; margin-bottom: 1.75rem; }

/* ── Category Page ── */
.spn-category-page {
    max-width: var(--spn-max-width, 1100px);
    margin: 2rem auto;
    padding: 0 1.25rem;
}

.spn-category-page h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--spn-primary, #1a3a5c);
    margin-bottom: 0.5rem;
}

.spn-category-intro { color: #4a5568; margin-bottom: 1.75rem; }

/* ── Policy Pages ── */
.spn-policy {
    max-width: var(--spn-article-width, 780px);
    margin: 2.5rem auto;
    padding: 0 1.25rem;
}

.spn-policy h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--spn-primary, #1a3a5c);
    margin-bottom: 0.25rem;
}

.spn-policy-date { font-size: 0.85rem; color: #718096; margin-bottom: 1.5rem; }

.spn-policy-body h2 { font-size: 1.1rem; font-weight: 700; margin: 1.75rem 0 0.5rem; color: var(--spn-primary); }
.spn-policy-body h3 { font-size: 1rem; font-weight: 700; margin: 1.25rem 0 0.35rem; }
.spn-policy-body p { margin-bottom: 0.85rem; font-size: 0.94rem; }
.spn-policy-body ul, .spn-policy-body ol { margin: 0.5rem 0 0.85rem 1.5rem; font-size: 0.94rem; }
.spn-policy-body li { margin-bottom: 0.25rem; }

/* ── Footer ── */
.spn-footer {
    background: var(--spn-primary, #1a3a5c);
    color: rgba(255,255,255,0.82);
    margin-top: 3rem;
    padding-top: 2.5rem;
}

.spn-footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    padding-bottom: 2rem;
}

@media (max-width: 768px) {
    .spn-footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .spn-footer-grid { grid-template-columns: 1fr; }
}

.spn-footer-col h3 {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #fff;
    margin-bottom: 0.85rem;
}

.spn-footer-col ul { list-style: none; }
.spn-footer-col li { margin-bottom: 0.45rem; }
.spn-footer-col a { color: rgba(255,255,255,0.75); font-size: 0.88rem; }
.spn-footer-col a:hover { color: #fff; text-decoration: none; }

.spn-footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.12);
    padding: 1.25rem 0;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.55);
}

.spn-footer-bottom p + p { margin-top: 0.25rem; }
.spn-footer-note { font-size: 0.78rem; }

/* ── Utility ── */
.spn-guide-section {
    max-width: var(--spn-article-width, 780px);
    margin: 2rem auto;
    padding: 0 1.25rem;
}

.spn-guide-section h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--spn-primary, #1a3a5c);
    margin-bottom: 0.5rem;
}

.spn-guide-section h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--spn-primary, #1a3a5c);
    margin: 1.75rem 0 0.5rem;
}

.spn-guide-section p { margin-bottom: 0.9rem; font-size: 0.96rem; }
.spn-guide-section ul, .spn-guide-section ol { margin: 0.5rem 0 1rem 1.5rem; }
.spn-guide-section li { margin-bottom: 0.35rem; font-size: 0.94rem; }

.spn-checklist { list-style: none; margin-left: 0 !important; }
.spn-checklist li::before { content: '✓ '; color: var(--spn-accent, #2979ff); font-weight: 700; }

.spn-sitemap-section {
    max-width: var(--spn-article-width, 780px);
    margin: 2rem auto;
    padding: 0 1.25rem;
}

.spn-sitemap-section h1 { font-size: 1.6rem; font-weight: 800; color: var(--spn-primary); margin-bottom: 1rem; }
.spn-sitemap-section h2 { font-size: 1.05rem; font-weight: 700; color: var(--spn-primary); margin: 1.5rem 0 0.4rem; }
.spn-sitemap-section ul { list-style: none; }
.spn-sitemap-section li { margin-bottom: 0.3rem; font-size: 0.93rem; }

/* ── News/Tips placeholder ── */
.spn-coming-soon {
    max-width: var(--spn-max-width, 1100px);
    margin: 3rem auto;
    padding: 0 1.25rem;
    text-align: center;
}

.spn-coming-soon h1 { font-size: 1.5rem; font-weight: 800; color: var(--spn-primary); margin-bottom: 0.75rem; }
.spn-coming-soon p { color: #4a5568; font-size: 0.97rem; }
