﻿@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --arctic-0: #f5f9ff;
  --arctic-1: #eaf2ff;
  --blue: #0f66ff;
  --ink: #0f172a;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-border: rgba(255, 255, 255, 0.92);
  --text-main: #0f172a;
  --text-soft: #475569;
  --chip-bg: rgba(255, 255, 255, 0.8);
  --chip-border: rgba(15, 102, 255, 0.2);
  --footer-bg: rgba(255, 255, 255, 0.72);
  --footer-border: rgba(255, 255, 255, 0.92);
  --good: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 102, 255, 0.4) transparent;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--arctic-1) 0%, var(--arctic-0) 45%, #f8fbff 100%);
  color: var(--text-main);
}

body.theme-dark {
  --surface: rgba(30, 32, 38, 0.84);
  --surface-border: rgba(115, 119, 130, 0.36);
  --text-main: #f3f4f6;
  --text-soft: #b9bec8;
  --chip-bg: rgba(37, 40, 47, 0.9);
  --chip-border: rgba(115, 119, 130, 0.38);
  --footer-bg: rgba(22, 24, 31, 0.9);
  --footer-border: rgba(115, 119, 130, 0.36);
  background: radial-gradient(circle at 15% -10%, #ffffff18 0%, transparent 34%),
    linear-gradient(180deg, #121317 0%, #181a20 50%, #1d2028 100%);
}

.line-clamp-2,
.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  -webkit-line-clamp: 2;
}

.line-clamp-3 {
  -webkit-line-clamp: 3;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 10%, rgba(15, 102, 255, 0.16) 0%, rgba(15, 102, 255, 0) 38%),
    radial-gradient(circle at 88% 22%, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0) 30%),
    radial-gradient(circle at 45% 90%, rgba(56, 189, 248, 0.1) 0%, rgba(56, 189, 248, 0) 35%);
}

body.theme-dark .page-bg {
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 36%),
    radial-gradient(circle at 88% 22%, rgba(203, 213, 225, 0.1) 0%, rgba(203, 213, 225, 0) 30%);
}

.app-header {
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--surface-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 95%, transparent), color-mix(in srgb, var(--surface) 78%, transparent));
}

.glass-chip {
  border: 1px solid var(--surface-border);
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  backdrop-filter: blur(8px);
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.controls-right {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filter-btn {
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--text-main);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.86rem;
  font-weight: 600;
  transition: all 0.28s ease;
}

.filter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 102, 255, 0.16);
}

.filter-btn.active {
  background: linear-gradient(130deg, #0f66ff, #3b82f6);
  color: #fff;
  border-color: transparent;
}

.sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
}

.sort-label {
  font-size: 0.78rem;
  color: var(--text-soft);
  letter-spacing: 0.03em;
}

.sort-select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 700;
}

.chip-btn {
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--text-main);
  border-radius: 999px;
  padding: 0.42rem 0.78rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

.news-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.25rem;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  box-shadow: 0 20px 35px rgba(18, 62, 120, 0.12);
  backdrop-filter: blur(10px);
}

.featured-shell {
  position: relative;
  border-radius: 1.2rem;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  overflow: hidden;
}

.featured-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  min-height: 17rem;
  max-height: 24rem;
}

.featured-media {
  background: linear-gradient(180deg, #dbe8ff, #f1f6ff);
}

body.theme-dark .featured-media {
  background: linear-gradient(180deg, #2f3340, #252933);
}

.featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

.featured-body {
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-body h2 {
  color: var(--text-main);
}

.featured-body p {
  color: var(--text-soft);
}

.headline-shell {
  border: 1px solid var(--surface-border);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border-radius: 0.95rem;
  overflow: hidden;
}

.headline-track {
  display: flex;
  width: max-content;
  animation: headline-slide 34s linear infinite;
}

.headline-track:hover {
  animation-play-state: paused;
}

.headline-item {
  flex: 0 0 auto;
  border-right: 1px solid color-mix(in srgb, var(--surface-border) 88%, transparent);
  padding: 0.62rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text-main);
  font-weight: 700;
  white-space: nowrap;
  background: transparent;
}

.headline-item:hover {
  background: color-mix(in srgb, var(--chip-bg) 75%, transparent);
}

@keyframes headline-slide {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.card-image-wrap {
  position: relative;
  height: 13.5rem;
  overflow: hidden;
  background: linear-gradient(180deg, #dbe8ff, #f1f6ff);
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 24%;
}

.card-readmore {
  position: absolute;
  right: 0.85rem;
  bottom: 0.85rem;
  border: 1px solid var(--surface-border);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  padding: 0.42rem 0.82rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--text-main) 80%, #2563eb 20%);
  opacity: 0;
  transform: translateY(10px);
}

.news-card:hover .card-readmore {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.28s ease;
}

.skeleton {
  border-radius: 1.2rem;
  min-height: 22rem;
  position: relative;
  overflow: hidden;
  background: #d8e5fb;
}

.skeleton::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(95deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  animation: shimmer 1.25s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.status-dot {
  width: 0.56rem;
  height: 0.56rem;
  border-radius: 999px;
}

.status-good {
  background: var(--good);
}

.status-warn {
  background: var(--warn);
}

.status-bad {
  background: var(--bad);
}

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 45;
  padding: 0.45rem 0.65rem 0.55rem;
}

.footer-shell {
  border: 1px solid var(--footer-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--footer-bg) 92%, transparent), color-mix(in srgb, var(--footer-bg) 74%, transparent));
  border-radius: 1.1rem;
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  padding: 0.35rem 0.55rem;
}

#pulseBar {
  border-radius: 0.8rem;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0.25rem;
}

.pulse-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.pulse-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--surface-border);
  padding: 0.42rem 0.72rem;
  color: var(--text-main);
}

.footer-links {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  font-size: 0.77rem;
  padding: 0.2rem 0.3rem 0.1rem;
}

.footer-link {
  color: color-mix(in srgb, var(--text-main) 88%, #3b82f6 12%);
  text-decoration: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
}

.footer-muted {
  color: var(--text-soft);
  font-weight: 600;
}

.site-footer,
.site-footer .footer-link,
.site-footer #appVersion,
.site-footer .pulse-chip {
  color: var(--text-main);
}

.modal-card {
  border: 1px solid var(--surface-border);
  box-shadow: 0 26px 56px rgba(15, 23, 42, 0.26);
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 97%, #ffffff 3%), color-mix(in srgb, var(--surface) 90%, #cbd5e1 10%));
  position: relative;
}

.modal-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 32%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.modal-image {
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
  background: linear-gradient(180deg, #dbe8ff, #f1f6ff);
  object-fit: contain;
  object-position: center top;
}

.modal-close {
  color: var(--text-main);
  border: 1px solid var(--surface-border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.modal-close:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
}

.close-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.theme-dark .text-slate-600,
body.theme-dark .text-slate-700,
body.theme-dark .text-slate-500 {
  color: #d1d5db !important;
}

body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3 {
  color: #f3f4f6;
}

body.theme-dark .sort-select option {
  color: #111827;
}

body.theme-dark #lastSync,
body.theme-dark #appVersion,
body.theme-dark .footer-link,
body.theme-dark .pulse-chip,
body.theme-dark .glass-chip,
body.theme-dark .headline-item,
body.theme-dark .featured-body p,
body.theme-dark .featured-body h2 {
  color: #f3f4f6;
}

body.theme-dark .footer-muted {
  color: #d1d5db;
}

body.theme-dark .modal-card {
  background: linear-gradient(135deg, rgba(34, 37, 45, 0.95), rgba(28, 31, 39, 0.94));
}

@media (max-width: 640px) {
  header .max-w-7xl {
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
  }

  .controls-row {
    align-items: stretch;
  }

  #filterBar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    width: 100%;
  }

  #filterBar::-webkit-scrollbar {
    height: 4px;
  }

  .filter-btn {
    white-space: nowrap;
    flex: 0 0 auto;
    padding: 0.4rem 0.78rem;
    font-size: 0.8rem;
  }

  .sort-wrap,
  .chip-btn {
    width: 100%;
    justify-content: space-between;
  }

  .controls-right {
    width: 100%;
  }

  #newsGrid,
  #skeletonGrid {
    gap: 0.95rem;
  }

  .featured-grid {
    grid-template-columns: 1fr;
    min-height: 0;
    max-height: none;
  }

  .featured-media {
    height: 13.5rem;
  }

  .card-image-wrap {
    height: 11rem;
  }

  .news-card .p-4 {
    padding: 0.85rem;
  }

  .news-card h3 {
    font-size: 1rem;
  }

  .site-footer {
    padding: 0.38rem 0.45rem 0.45rem;
  }

  .footer-shell {
    border-radius: 0.9rem;
    padding: 0.24rem 0.34rem;
  }

  .footer-links {
    gap: 0.55rem;
    font-size: 0.72rem;
    justify-content: flex-start;
  }

  #pulseBar {
    padding: 0.2rem;
  }
}
