/* ===================================
   PLANCK STANDARD - GLOBAL STYLES
   =================================== */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #13131a;
    --bg-tertiary: #1a1a24;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --accent-blue: #3b82f6;
    
    --physics: #8b5cf6;
    --science: #10b981;
    --tech: #3b82f6;
    --business: #f59e0b;
    --markets: #059669;
    --breaking: #ef4444;
    
    --container-max: 1400px;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
}

body.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===================================
   BREAKING TICKER
   =================================== */

.breaking-ticker {
    background: linear-gradient(90deg, var(--breaking), #dc2626);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
}

.ticker-label {
    background: white;
    color: var(--breaking);
    padding: 0.25rem 0.75rem;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.ticker-content {
    flex: 1;
    overflow: hidden;
}

.ticker-text {
    color: white;
    font-weight: 500;
    white-space: nowrap;
    animation: ticker-scroll 30s linear infinite;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ===================================
   HEADER
   =================================== */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.logo .tagline {
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

/* Desktop Nav */
.nav-desktop {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Mobile Category Dropdown */
.mobile-category-wrapper {
    display: none;
}

.mobile-category-select {
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.5rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-btn, .theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.search-btn:hover, .theme-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }
body.light-mode .theme-toggle .sun-icon { display: block; }
body.light-mode .theme-toggle .moon-icon { display: none; }

/* ===================================
   MAIN CONTENT
   =================================== */

.main-content {
    padding: 2rem 0;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
}

/* ===================================
   HERO ARTICLE
   =================================== */

.hero-article {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: transform 0.3s;
}

.hero-article:hover {
    transform: translateY(-4px);
}

.hero-image-container {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

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

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
}

.hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem;
}

.hero-content h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0.75rem 0;
    line-height: 1.3;
    color: white;
}

.hero-excerpt {
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.loading-placeholder {
    padding: 4rem;
    text-align: center;
    color: var(--text-secondary);
}

/* ===================================
   CATEGORY BADGES
   =================================== */

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.category-badge.physics { background: var(--physics); color: white; }
.category-badge.science { background: var(--science); color: white; }
.category-badge.tech { background: var(--tech); color: white; }
.category-badge.business { background: var(--business); color: white; }
.category-badge.markets { background: var(--markets); color: white; }
.category-badge.breaking { background: var(--breaking); color: white; font-weight: 700; }

.logo {
    text-decoration: none;
    color: inherit;
}

.category-badge.small {
    padding: 0.15rem 0.5rem;
    font-size: 0.65rem;
}

/* ===================================
   ARTICLE META
   =================================== */

.article-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.hero-content .article-meta {
    color: rgba(255,255,255,0.7);
}

.source-name {
    font-weight: 500;
}

/* ===================================
   ARTICLES GRID
   =================================== */

.articles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.article-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.article-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-blue);
}

.article-image-container {
    aspect-ratio: 16/10;
    overflow: hidden;
}

.article-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.article-card:hover .article-img {
    transform: scale(1.05);
}

.article-content {
    padding: 1.25rem;
}

.article-content h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    margin: 0.5rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.no-articles {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* ===================================
   SIDEBAR
   =================================== */

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.25rem;
}

.sidebar-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--bg-tertiary);
}

/* Trending */
.trending-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bg-tertiary);
    transition: opacity 0.2s;
}

.trending-item:last-child {
    border-bottom: none;
}

.trending-item:hover {
    opacity: 0.8;
}

.trending-rank {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-blue);
    width: 24px;
    flex-shrink: 0;
}

.trending-content h4 {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.trending-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* Newsletter */
.newsletter-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.newsletter-form input {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--bg-tertiary);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.newsletter-form button {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--accent-blue);
    color: white;
    font-weight: 600;
    transition: opacity 0.2s;
}

.newsletter-form button:hover {
    opacity: 0.9;
}

/* ===================================
   FOOTER
   =================================== */

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-tertiary);
    padding: 3rem 0 1.5rem;
    margin-top: 3rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.footer-brand p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    gap: 3rem;
}

.footer-column h4 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    color: var(--text-tertiary);
}

.footer-column a {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.25rem 0;
    transition: color 0.2s;
}

.footer-column a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--bg-tertiary);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* ===================================
   ANIMATIONS
   =================================== */

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.4rem 0;
    }
    
    .nav-desktop {
        display: none;
    }
    
    .mobile-category-wrapper {
        display: block;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .sidebar {
        grid-template-columns: 1fr;
    }
    
    .hero-content h2 {
        font-size: 1.1rem;
    }
    
    .hero-content {
        padding: 1rem;
    }
    
    .hero-excerpt {
        font-size: 0.85rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .logo h1 {
        font-size: 0.9rem;
    }
    
    .logo .tagline {
        display: none;
    }
    
    .search-btn, .theme-toggle {
        width: 32px;
        height: 32px;
    }
    
    .footer-content {
        flex-direction: column;
    }
    
    .footer-links {
        gap: 2rem;
    }
    
    .breaking-ticker {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .ticker-label {
        padding: 0.15rem 0.5rem;
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        gap: 0.5rem;
    }
    
    .hero-content h2 {
        font-size: 1.1rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 1.5rem;
    }
}

/* ===================================
   ARTICLE DETAIL VIEW
   =================================== */

.article-detail {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin-bottom: 2rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

.back-btn:hover {
    background: var(--accent-blue);
    color: white;
}

.article-header {
    margin-bottom: 2rem;
}

.article-header h1 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 1rem 0;
}

.article-subhead {
    font-size: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.article-meta-full {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

.article-meta-full .tags {
    color: var(--accent-blue);
}

.article-hero-image {
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
}

.article-hero-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.article-body {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
}

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

.article-body p:first-child::first-letter {
    font-size: 3.5rem;
    font-weight: 700;
    float: left;
    line-height: 1;
    margin-right: 0.5rem;
    color: var(--accent-blue);
}

.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--bg-tertiary);
}

.source-credit {
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

.source-credit a {
    color: var(--accent-blue);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .article-header h1 {
        font-size: 1.5rem;
    }
    
    .article-subhead {
        font-size: 1rem;
    }
    
    .article-body {
        font-size: 1rem;
    }
    
    .article-body p:first-child::first-letter {
        font-size: 2.5rem;
    }
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Better image handling */
.hero-img, .article-img {
    background-color: var(--bg-tertiary);
    transition: opacity 0.3s;
}

.hero-img[src=""], .article-img[src=""] {
    opacity: 0;
}

/* Polish */
.nav-link.active {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

.article-card {
    will-change: transform;
}

/* Better mobile */
@media (max-width: 480px) {
    .hero-content h2 {
        font-size: 1rem;
        line-height: 1.3;
    }
    
    .article-content h3 {
        font-size: 0.9rem;
    }
    
    .category-badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.5rem;
    }
}
