/*
Theme Name: SwiftPress News
Description: A fast, mobile-first, authoritative news theme for independent UK publishers. Focuses on speed, scanability, and trust signals.
Version: 1.0.1
Author: Andrew Hill
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: swiftpress-news
License: GPL-2.0-or-later
Tags: news, responsive-layout, custom-logo, accessibility-ready, dark-mode, custom-menu, threaded-comments, translation-ready
*/

:root {
    --sp-color-brand: #b30000;
    --sp-color-brand-hover: #800000;
    --sp-color-bg: #ffffff;
    --sp-color-surface: #f3f4f6;
    --sp-color-surface-hover: #e5e7eb;
    --sp-color-text-main: #111827;
    --sp-color-text-muted: #4b5563;
    --sp-color-border: #e5e7eb;
    
    --sp-font-ui: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --sp-font-heading: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    --sp-font-body: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    
    --sp-space-1: 0.25rem;
    --sp-space-2: 0.5rem;
    --sp-space-3: 0.75rem;
    --sp-space-4: 1rem;
    --sp-space-6: 1.5rem;
    --sp-space-8: 2rem;
    --sp-space-12: 3rem;
    --sp-space-16: 4rem;

    --sp-container-width: 1200px;
    --sp-article-width: 680px;
}

[data-theme="dark"] {
    --sp-color-brand: #ff4c4c;
    --sp-color-brand-hover: #ff7373;
    --sp-color-bg: #121212;
    --sp-color-surface: #1e1e1e;
    --sp-color-surface-hover: #2a2a2a;
    --sp-color-text-main: #f9fafb;
    --sp-color-text-muted: #9ca3af;
    --sp-color-border: #374151;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--sp-font-ui);
    background-color: var(--sp-color-bg);
    color: var(--sp-color-text-main);
    line-height: 1.5;
    transition: background-color 0.2s ease, color 0.2s ease;
}
img, video, iframe { max-width: 100%; height: auto; display: block; }
a { color: var(--sp-color-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { font-family: var(--sp-font-heading); font-weight: 700; line-height: 1.2; margin-top: 0; margin-bottom: var(--sp-space-4); }

/* Accessibility */
.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;
}
.screen-reader-text:focus {
    background-color: var(--sp-color-bg); border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0,0,0,0.6); clip: auto !important;
    clip-path: none; color: var(--sp-color-text-main); display: block;
    font-size: 14px; font-weight: bold; height: auto;
    left: 5px; line-height: normal; padding: 15px 23px 14px;
    text-decoration: none; top: 5px; width: auto; z-index: 100000;
}
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Layout */
.container {
    max-width: var(--sp-container-width);
    margin: 0 auto;
    padding: 0 var(--sp-space-4);
}
.site-header {
    border-bottom: 4px solid var(--sp-color-brand);
    padding: var(--sp-space-4) 0;
    background: var(--sp-color-bg);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--sp-space-4);
}
.site-branding .custom-logo { max-height: 50px; width: auto; }
.site-title { font-size: 2rem; margin: 0; font-family: var(--sp-font-ui); text-transform: uppercase; font-weight: 900; letter-spacing: -0.05em; }
.site-title a { color: var(--sp-color-text-main); text-decoration: none; }
.site-title::first-letter { color: var(--sp-color-brand); }

.breaking-strip { background: var(--sp-color-text-main); color: var(--sp-color-bg); }
.breaking-strip-inner { display: flex; align-items: center; gap: var(--sp-space-3); min-height: 42px; }
.breaking-strip strong { flex: 0 0 auto; padding: 0 var(--sp-space-2); background: var(--sp-color-brand); color: #fff; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.breaking-strip a { overflow: hidden; color: var(--sp-color-bg); font-family: var(--sp-font-heading); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

/* Navigation */
.main-navigation { display: flex; align-items: center; gap: var(--sp-space-4); }
.main-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--sp-space-4); flex-wrap: wrap; }
.main-navigation a { color: var(--sp-color-text-main); font-weight: 600; font-size: 0.9rem; text-transform: uppercase; }
.main-navigation a:hover { color: var(--sp-color-brand); }
.menu-toggle { display: none; background: none; border: 1px solid var(--sp-color-border); color: var(--sp-color-text-main); padding: var(--sp-space-2) var(--sp-space-3); font-weight: bold; cursor: pointer; }
.theme-toggle { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--sp-color-text-main); display: flex; align-items: center; justify-content: center; padding: var(--sp-space-2); }

/* Search Form */
.search-form { display: flex; gap: var(--sp-space-2); }
.search-form input[type="search"] { padding: var(--sp-space-2); border: 1px solid var(--sp-color-border); background: var(--sp-color-bg); color: var(--sp-color-text-main); border-radius: 2px; }
.search-form button { padding: var(--sp-space-2) var(--sp-space-4); background: var(--sp-color-brand); color: #fff; border: none; font-weight: bold; cursor: pointer; border-radius: 2px; }

/* Ads */
.sp-ad-label { display: block; font-size: 0.7rem; color: var(--sp-color-text-muted); text-transform: uppercase; text-align: center; margin-bottom: var(--sp-space-1); letter-spacing: 0.05em; }
.sp-ad-wrapper { background: var(--sp-color-surface); border: 1px solid var(--sp-color-border); padding: var(--sp-space-2); text-align: center; margin: var(--sp-space-6) auto; }
.header-ad { margin: 0 auto var(--sp-space-6) auto; max-width: 728px; }
.inline-ad { margin: var(--sp-space-6) auto; max-width: 300px; }
@media(min-width: 768px) { .inline-ad { max-width: 728px; } }

/* Grid & Cards */
.front-page-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-space-6); margin-top: var(--sp-space-6); }
@media(min-width: 1024px) {
    .front-page-grid { grid-template-columns: 2fr 1fr; }
}
.hero-story { border-bottom: 1px solid var(--sp-color-border); padding-bottom: var(--sp-space-6); }
.hero-story .entry-title { font-size: 2.5rem; }
@media(min-width: 768px) { .hero-story .entry-title { font-size: 3.5rem; } }
.hero-story img { width: 100%; aspect-ratio: 16/9; object-fit: cover; margin-bottom: var(--sp-space-4); }

.story-card { display: flex; flex-direction: column; gap: var(--sp-space-2); border-bottom: 1px solid var(--sp-color-border); padding-bottom: var(--sp-space-4); }
.story-card:last-child { border-bottom: none; }
.story-card img { width: 100%; aspect-ratio: 3/2; object-fit: cover; }
.story-card .entry-title { font-size: 1.25rem; margin: 0; }
.story-meta { font-size: 0.8rem; color: var(--sp-color-text-muted); display: flex; gap: var(--sp-space-2); align-items: center; flex-wrap: wrap; text-transform: uppercase; font-family: var(--sp-font-ui); font-weight: 600; }
.story-meta .category-label { color: var(--sp-color-brand); }
.live-indicator { background: var(--sp-color-brand); color: #fff; padding: 2px 6px; border-radius: 2px; font-size: 0.7rem; font-weight: bold; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }

/* Section Shelves */
.section-shelf { margin-top: var(--sp-space-8); padding-top: var(--sp-space-6); border-top: 4px solid var(--sp-color-brand); }
.section-title { font-size: 1.5rem; text-transform: uppercase; margin-bottom: var(--sp-space-4); font-family: var(--sp-font-ui); }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--sp-space-6); }

/* Article */
.single-layout { display: grid; grid-template-columns: 1fr; gap: var(--sp-space-8); margin-top: var(--sp-space-8); }
@media(min-width: 1024px) {
    .single-layout { grid-template-columns: 1fr 300px; }
}
.article-header { margin-bottom: var(--sp-space-6); }
.article-header .entry-title { font-size: 2.5rem; margin-bottom: var(--sp-space-4); }
.article-header-digest { max-width: var(--sp-article-width); margin-bottom: var(--sp-space-6); }
.article-header-digest .ap-story-digest { margin-bottom: 0; }
.byline { display: flex; align-items: center; gap: var(--sp-space-4); padding: var(--sp-space-4) 0; border-top: 1px solid var(--sp-color-border); border-bottom: 1px solid var(--sp-color-border); margin-bottom: var(--sp-space-6); }
.byline-avatar img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.byline-info { display: flex; flex-direction: column; }
.byline-author { font-weight: bold; color: var(--sp-color-text-main); font-family: var(--sp-font-ui); }
.byline-date { font-size: 0.85rem; color: var(--sp-color-text-muted); font-family: var(--sp-font-ui); }

.article-content { font-family: var(--sp-font-body); font-size: 1.15rem; line-height: 1.7; max-width: var(--sp-article-width); }
.article-content p { margin-bottom: var(--sp-space-4); }
.article-content a { text-decoration: underline; text-underline-offset: 2px; font-weight: bold; }
.article-content h2, .article-content h3 { font-family: var(--sp-font-ui); margin-top: var(--sp-space-8); }
.article-content blockquote { border-left: 4px solid var(--sp-color-brand); margin: var(--sp-space-6) 0; padding-left: var(--sp-space-4); font-style: italic; font-size: 1.25rem; color: var(--sp-color-text-muted); }

/* Trust Signals / Author Box */
.author-box { margin-top: var(--sp-space-12); padding: var(--sp-space-6); background: var(--sp-color-surface); border-left: 4px solid var(--sp-color-border); }
.author-box-header { display: flex; align-items: center; gap: var(--sp-space-4); margin-bottom: var(--sp-space-4); }
.author-box-header img { width: 64px; height: 64px; border-radius: 50%; }
.author-box-title { margin: 0; font-size: 1.25rem; font-family: var(--sp-font-ui); }
.trust-links { margin-top: var(--sp-space-4); display: flex; gap: var(--sp-space-4); flex-wrap: wrap; font-size: 0.85rem; font-family: var(--sp-font-ui); }
.trust-links a { display: inline-flex; align-items: center; gap: 4px; color: var(--sp-color-text-muted); }
.trust-links a:hover { color: var(--sp-color-brand); }
.related-stories { margin-top: var(--sp-space-12); padding-top: var(--sp-space-6); border-top: 4px solid var(--sp-color-brand); }

/* Sidebar */
.sidebar { position: sticky; top: 100px; display: flex; flex-direction: column; gap: var(--sp-space-6); }
.widget { border-top: 2px solid var(--sp-color-text-main); padding-top: var(--sp-space-4); }
.widget-title { font-size: 1.2rem; text-transform: uppercase; font-family: var(--sp-font-ui); margin-bottom: var(--sp-space-4); }
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget ul li { margin-bottom: var(--sp-space-2); border-bottom: 1px solid var(--sp-color-border); padding-bottom: var(--sp-space-2); }
.widget ul li:last-child { border-bottom: none; margin-bottom: 0; }

/* Footer */
.site-footer { background: var(--sp-color-surface); padding: var(--sp-space-8) 0; margin-top: var(--sp-space-12); border-top: 1px solid var(--sp-color-border); font-family: var(--sp-font-ui); font-size: 0.9rem; }
.footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-space-6); margin-bottom: var(--sp-space-8); }
.footer-bottom { display: flex; flex-direction: column; gap: var(--sp-space-4); text-align: center; border-top: 1px solid var(--sp-color-border); padding-top: var(--sp-space-6); color: var(--sp-color-text-muted); }
.footer-menu ul { list-style: none; padding: 0; margin: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: var(--sp-space-4); }
.footer-menu a { color: var(--sp-color-text-main); }
.footer-legal p { margin: 0; }

/* Mobile Menu */
@media(max-width: 767px) {
    .menu-toggle { display: block; }
    .main-navigation { display: none; width: 100%; order: 3; }
    .main-navigation.is-open { display: block; margin-top: var(--sp-space-4); }
    .main-navigation ul { flex-direction: column; gap: var(--sp-space-2); }
    .main-navigation a { display: block; padding: var(--sp-space-2) 0; border-bottom: 1px solid var(--sp-color-border); }
    .site-header-inner { justify-content: space-between; }
    .search-form { width: 100%; order: 4; margin-top: var(--sp-space-4); display: none; }
    .main-navigation.is-open + .search-form, .search-form.is-open { display: flex; }
}

/* Comments */
.comments-area { margin-top: var(--sp-space-12); border-top: 2px solid var(--sp-color-text-main); padding-top: var(--sp-space-6); }
.comments-title { font-family: var(--sp-font-ui); text-transform: uppercase; font-size: 1.5rem; }
.comment-list { list-style: none; padding: 0; }
.comment-body { background: var(--sp-color-surface); padding: var(--sp-space-4); margin-bottom: var(--sp-space-4); border-radius: 4px; }
.comment-meta { font-size: 0.85rem; color: var(--sp-color-text-muted); margin-bottom: var(--sp-space-2); }
.comment-reply-title { font-family: var(--sp-font-ui); }
.comment-form input, .comment-form textarea { width: 100%; padding: var(--sp-space-2); border: 1px solid var(--sp-color-border); background: var(--sp-color-bg); color: var(--sp-color-text-main); border-radius: 2px; margin-bottom: var(--sp-space-2); font-family: var(--sp-font-ui); }
.comment-form input[type="submit"] { width: auto; background: var(--sp-color-text-main); color: var(--sp-color-bg); font-weight: bold; cursor: pointer; border: none; padding: var(--sp-space-2) var(--sp-space-6); }

/* Pages */
.page-header { margin: var(--sp-space-8) 0; }
.page-title { font-size: 2.5rem; text-transform: uppercase; }
