/*
Theme Name: FinCRIS
Theme URI: https://fincris.com
Author: FinCRIS Market Risk Intelligence
Description: Professional financial news theme with M logo (Market Up/Down), real-time market data tracking
Version: 3.0.0
Text Domain: fincris
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=IBM+Plex+Mono:wght@400;600&display=swap');

:root {
  /* Primary Colors */
  --primary:        #1a1a2e;     /* Dark navy blue */
  --primary-light:  #16213e;     /* Lighter navy */
  --accent:         #00d4ff;     /* Bright cyan - for UP */
  --danger:         #ff4757;     /* Red - for DOWN */
  --success:        #2ed573;     /* Green - for positive */
  --warning:        #ffa502;     /* Orange - for warning */
  
  /* Neutral Colors */
  --white:          #ffffff;
  --gray-50:        #f9fafb;
  --gray-100:       #f3f4f6;
  --gray-200:       #e5e7eb;
  --gray-300:       #d1d5db;
  --gray-400:       #9ca3af;
  --gray-500:       #6b7280;
  --gray-600:       #4b5563;
  --gray-700:       #374151;
  --gray-800:       #1f2937;
  --gray-900:       #111827;
  
  /* Background */
  --bg-primary:     #f0f2f5;
  --bg-secondary:   #ffffff;
  --bg-dark:        #1a1a2e;
  
  /* Text */
  --text-primary:   #111827;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;
  
  /* Typography */
  --font-sans:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:      'IBM Plex Mono', monospace;
  
  /* Shadows */
  --shadow-sm:      0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:      0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:      0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl:      0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ══════════════════════════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #00b8d4;
}

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

button {
  cursor: pointer;
  font-family: var(--font-sans);
  border: none;
  background: none;
  padding: 0;
}

/* ══════════════════════════════════════════════════════════════
   HEADER & LOGO
   ══════════════════════════════════════════════════════════════ */

.site-header {
  background: var(--white);
  border-bottom: 2px solid var(--gray-100);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 15px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

/* M LOGO WITH UP/DOWN */
.logo-icon::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  background: linear-gradient(to top left, var(--accent) 48%, transparent 49%, transparent 51%, var(--danger) 52%);
  clip-path: polygon(
    0% 100%,   /* Left point */
    35% 50%,   /* Left peak (up) */
    50% 65%,   /* Middle valley */
    65% 30%,   /* Right peak (up) */
    100% 100%  /* Right point */
  );
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-text-main {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.logo-text-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  gap: 30px;
  align-items: center;
}

.site-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transition: color 0.2s ease;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════════ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  padding: 60px 20px;
  border-radius: 12px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-lg);
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 24px;
}

/* ══════════════════════════════════════════════════════════════
   POSTS GRID
   ══════════════════════════════════════════════════════════════ */

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.post-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  border-left: 4px solid var(--gray-200);
}

.post-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-left-color: var(--accent);
}

.post-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--gray-100);
}

.post-body {
  padding: 24px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.post-category {
  display: inline-block;
  background: var(--accent);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-date {
  font-size: 12px;
  color: var(--text-muted);
}

.post-risk {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.post-risk.critical {
  background: rgba(255, 71, 87, 0.1);
  color: var(--danger);
}

.post-risk.high {
  background: rgba(255, 165, 2, 0.1);
  color: var(--warning);
}

.post-risk.medium {
  background: rgba(255, 193, 7, 0.1);
  color: #f9a825;
}

.post-risk.low {
  background: rgba(46, 213, 115, 0.1);
  color: var(--success);
}

.post-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-title a {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.post-title a:hover {
  color: var(--accent);
}

.post-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}

.post-read-more {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  transition: gap 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.post-read-more:hover {
  gap: 10px;
}

/* ══════════════════════════════════════════════════════════════
   SINGLE POST PAGE
   ══════════════════════════════════════════════════════════════ */

.single-post {
  background: var(--white);
  border-radius: 12px;
  padding: 40px;
  box-shadow: var(--shadow-md);
  margin-bottom: 40px;
}

.single-post-header {
  margin-bottom: 40px;
  border-bottom: 2px solid var(--gray-100);
  padding-bottom: 30px;
}

.single-post-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.single-post-title {
  font-size: 42px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
  margin-bottom: 16px;
}

.single-post-featured {
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 40px 0;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

.single-post-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-primary);
}

.single-post-content h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 40px 0 20px;
  color: var(--primary);
}

.single-post-content h3 {
  font-size: 22px;
  font-weight: 600;
  margin: 30px 0 15px;
  color: var(--primary);
}

.single-post-content p {
  margin-bottom: 20px;
}

.single-post-content a {
  color: var(--accent);
  text-decoration: underline;
}

.single-post-content a:hover {
  text-decoration: none;
}

.single-post-content strong {
  font-weight: 600;
  color: var(--primary);
}

.single-post-content code {
  background: var(--gray-100);
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
}

.single-post-content blockquote {
  border-left: 4px solid var(--accent);
  margin: 20px 0;
  padding: 20px;
  background: var(--gray-50);
  border-radius: 4px;
  font-style: italic;
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════ */

.site-footer {
  background: var(--primary);
  color: var(--white);
  padding: 40px 20px;
  margin-top: 60px;
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-content p {
  margin-bottom: 10px;
  opacity: 0.9;
}

.footer-content a {
  color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .header-container {
    min-height: 70px;
  }

  .logo-text-main {
    font-size: 18px;
  }

  .site-nav {
    gap: 15px;
    font-size: 13px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .single-post {
    padding: 24px;
  }

  .single-post-title {
    font-size: 28px;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .logo-text-sub {
    display: none;
  }

  .site-nav {
    gap: 10px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .single-post-title {
    font-size: 22px;
  }
}

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════════ */

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

.post-card,
.single-post {
  animation: fadeIn 0.3s ease;
}

/* Auto-refresh indicator */
.refresh-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent);
  color: var(--primary);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
