/* ================= ROOT VARIABLES ================= */
:root {
  --primary: #1877F2;
  --civic: #004a99;
  --event: #2e7d32;
  --bg: #f0f2f5;
  --text-main: #1c1e21;
  --text-sub: #65676b;
  --card-shadow: 0 1px 2px rgba(0,0,0,0.1);
  --pop-shadow: 0 4px 12px rgba(24, 119, 242, 0.15);
}

/* ================= BASE & PWA SETTINGS ================= */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  
  /* PWA FIXES: Disables double-tap zoom & improves touch response */
  touch-action: manipulation; 
  overflow-x: hidden; 
  width: 100%;
}

a, a:visited, a:hover, a:active {
  color: inherit;
  text-decoration: none;
}

/* ================= HEADER (GLOBAL) ================= */
header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,.05);
}

.header-left { display: flex; align-items: center; }
.back-slot { width: 35px; display: flex; align-items: center; }

/* BACK BUTTON FIX: Force Blue */
.back-link { 
  font-size: 2.2rem; 
  margin-top: -4px; 
  color: var(--primary) !important; 
  font-weight: 700; 
  line-height: 1; 
}

/* LOGO FIX: Force Blue */
.logo { 
  font-weight: 800; 
  font-size: 1.6rem; 
  color: var(--primary) !important; 
  letter-spacing: -1px; 
}

/* Weather Stack */
.weather-stack { text-align: right; line-height: 1.1; }
.weather-city { font-size: .95rem; font-weight: 700; }
.header-date { font-size: .7rem; font-weight: 600; color: var(--text-sub); text-transform: uppercase; }

/* ================= HUB LAYOUT (CARDS) ================= */
.container { max-width: 600px; margin: auto; padding: 15px; }
section { margin-top: 25px; }

.card {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #ddd;
  margin-bottom: 15px;
  display: block;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.article-img { width: 100%; height: 250px; background-size: cover; background-position: center; }
.article-body { padding: 16px; }

/* HERO TYPOGRAPHY UPDATES */
.hero-title { 
  font-size: 1.4rem; 
  font-weight: 700; 
  line-height: 1.2; 
  margin: 0 0 10px 0; 
  color: #000;
}

.hero-summary {
  font-size: 0.95rem;
  color: #4b4f56;
  line-height: 1.4;
  margin: 0 0 15px 0;
}

.section-header { font-size: .8rem; text-transform: uppercase; color: #606770; font-weight: 700; margin-bottom: 10px; }
.section-footer { text-align: center; margin-top: 8px; margin-bottom: 25px; }

/* Buttons & Lists */
.btn-outline { display: inline-block; padding: 6px 14px; border-radius: 14px; border: 1.5px solid var(--primary); font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--primary); }
.btn-text { font-size: .85rem; font-weight: 700; color: var(--primary); }
.civic-block { background: #fff; border-radius: 8px; border: 1px solid #ddd; padding: 15px; margin-bottom: 12px; }
.item-row { display: flex; justify-content: space-between; align-items: center; background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 12px; margin-bottom: 8px; }

/* AGENDA LIST UPDATES (WRAPPING TEXT) */
.agenda-row { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  gap: 10px; 
  padding: 10px 0; 
  border-bottom: 1px solid #eee; 
}
.agenda-row:last-child { border-bottom: none; }

.agenda-title { 
  flex: 1; 
  font-weight: 600; 
  font-size: .9rem; 
  white-space: normal; /* Allow wrap */
  overflow: visible;
  line-height: 1.3;
  padding-right: 10px;
}

.badge-opening { background: #fff9c4; color: #f57f17; font-size: .65rem; font-weight: 800; padding: 4px 8px; border-radius: 4px; }
.text-sub { color: var(--text-sub); }

/* ================= STORY LAYOUT (THREAD) ================= */
.hero-container { 
  width: 100%; 
  height: 45vh; 
  max-height: 500px; 
  background-color: #eee; 
  background-position: center; 
  background-size: cover; 
  background-repeat: no-repeat;
}

.story-container { max-width: 680px; margin: 0 auto; padding: 25px 20px; }

.story-h1 { 
  font-size: 2.2rem; 
  font-weight: 800; 
  line-height: 1.1; 
  margin: 0 0 15px 0; 
  letter-spacing: -1px; 
  color: #050505; 
}

.meta-bar { 
  color: var(--text-sub); 
  font-size: 0.9rem; 
  margin-bottom: 30px; 
  border-bottom: 1px solid #ddd; 
  padding-bottom: 15px; 
  font-weight: 500; 
}

/* THE POPPING AI CARD */
.ai-summary-card { 
  background: #f0f7ff; 
  border-left: 5px solid var(--primary); 
  padding: 25px; 
  border-radius: 6px; 
  margin-bottom: 35px; 
  box-shadow: var(--pop-shadow);
}

.ai-badge { 
  font-size: 0.75rem; 
  font-weight: 900; 
  color: var(--primary); 
  text-transform: uppercase; 
  margin-bottom: 10px; 
  letter-spacing: 1px; 
  display: flex; align-items: center; gap: 6px;
}

.ai-header {
  font-size: 1.2rem;
  font-weight: 900;
  color: #050505;
  margin-bottom: 8px;
  line-height: 1.2;
}

.ai-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: #1c1e21;
  line-height: 1.6;
}

.story-body { font-size: 1.15rem; line-height: 1.7; color: #1c1e21; word-wrap: break-word; }
.story-footer { margin-top: 60px; padding: 40px 20px; background: #f9f9f9; text-align: center; border-top: 1px solid #eee; border-radius: 8px; }

/* Mobile Tweaks */
@media (max-width: 600px) { 
  .story-h1 { font-size: 1.8rem; } 
  .hero-container { height: 35vh; } 
}
