* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #f5f9ff;
  --bg-dark: #0c1729;
  --surface: rgba(255,255,255,0.8);
  --surface-dark: rgba(18,30,48,0.85);
  --text: #1a2f44;
  --text-dark: #ecf3fd;
  --accent: #0f5fa8;
  --accent-light: #3282cf;
  --border-glass: rgba(70, 130, 200, 0.2);
  --shadow-card: 0 8px 24px rgba(0,35,70,0.08);
  --shadow-hover: 0 15px 35px rgba(10,70,130,0.15);
  --radius-card: 26px;
  --badge-gempa: #dc3545;
  --badge-libur: #28a745;
}

body.dark {
  --bg: #0c1729;
  --surface: rgba(20,38,60,0.85);
  --text: #ecf3fd;
  --border-glass: rgba(90, 150, 230, 0.3);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  transition: background 0.2s, color 0.2s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  padding: 0.7rem 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(145deg, #0f5fa8, #3a8fd0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
body.dark .logo h1 {
  background: linear-gradient(145deg, #b0d8ff, #ffffff);
  -webkit-background-clip: text;
}

.dark-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-glass);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dark-toggle:active { background: var(--accent); color: white; }

.container {
  max-width: 1300px;
  margin: 1.2rem auto;
  padding: 0 1.8rem;
  flex: 1;
  width: 100%;
}

.hero-section {
  margin-bottom: 2rem;
  border-radius: 32px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-card);
  transition: 0.2s;
  display: block;
  text-decoration: none;
  color: inherit;
}
.hero-section:active { transform: scale(0.99); }
.hero-card {
  display: flex;
  flex-direction: row;
}
.hero-img {
  flex: 1.2;
  background-size: cover;
  background-position: center;
  min-height: 260px;
  background-color: #123a60;
}
.hero-content {
  flex: 1;
  padding: 2rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero-content h2 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 1.5rem;
}
.hero-btn {
  background: var(--accent);
  color: white;
  padding: 0.8rem 2rem;
  border-radius: 60px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  text-decoration: none;
  font-size: 1rem;
  box-shadow: 0 6px 18px rgba(15,95,168,0.25);
  border: none;
  cursor: pointer;
}
.hero-btn:active { background: var(--accent-light); transform: scale(0.97); }

.refresh-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1.5rem 0 2rem;
}
.news-count {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.7;
  background: var(--surface);
  padding: 0.4rem 1rem;
  border-radius: 40px;
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(4px);
}
.news-count i {
  margin-right: 6px;
  color: var(--accent);
}
.refresh-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-glass);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}
.refresh-btn:active { background: var(--accent); color: white; transform: rotate(60deg); }

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.8rem;
  margin: 2rem 0;
}
.skeleton-card {
  background: var(--surface);
  border-radius: 26px;
  padding: 1.2rem;
  border: 1px solid var(--border-glass);
}
.skeleton-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(90deg, #cccccc30 25%, #eeeeee50 50%, #cccccc30 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 20px;
}
.skeleton-line {
  height: 1rem;
  background: linear-gradient(90deg, #cccccc30 25%, #eeeeee50 50%, #cccccc30 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 20px;
  margin: 0.8rem 0 0.5rem;
}
.skeleton-line.short { width: 60%; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem 1.8rem;
  margin: 2rem 0 3rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-glass);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: 0.2s;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }

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

.card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #1e3d5e;
}

.card-body {
  padding: 1.5rem 1.3rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.4;
  margin-bottom: 0.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  opacity: 0.7;
  margin: 0.3rem 0 1.2rem;
}
.card-meta i { width: 14px; margin-right: 4px; }

.badge {
  display: inline-block;
  padding: 0.25rem 0.8rem;
  border-radius: 30px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  width: fit-content;
}
.badge-gempa {
  background: var(--badge-gempa);
  color: white;
}
.badge-libur {
  background: var(--badge-libur);
  color: white;
}

.card-btn {
  display: block;
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.75rem 0.5rem;
  border-radius: 40px;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: 0.15s;
  min-height: 46px;
  line-height: 1.2;
  box-shadow: 0 4px 12px rgba(15,95,168,0.2);
  margin-top: 0.5rem;
}
.card-btn i { margin-left: 6px; }
.card-btn:active {
  background: var(--accent-light);
  transform: scale(0.97);
}

.cnn-actions {
  display: flex;
  gap: 8px;
  margin-top: 0.5rem;
}
.cnn-actions .card-btn {
  flex: 1;
  margin-top: 0;
}
.cnn-actions .card-btn:first-child i {
  margin-right: 4px;
  margin-left: 0;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-content {
  background: var(--surface);
  border-radius: 36px;
  max-width: 650px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2rem;
  border: 1px solid var(--border-glass);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2.2rem;
  cursor: pointer;
  line-height: 1;
}

.scroll-top {
  position: fixed;
  bottom: 1.8rem;
  right: 1.8rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 6px 20px var(--accent);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99;
}
.scroll-top.show { display: flex; }
.scroll-top:active { transform: scale(0.9); }

footer {
  background: #0f2338;
  color: #d3e4ff;
  text-align: center;
  padding: 2.2rem 1.5rem;
  border-radius: 40px 40px 0 0;
  margin-top: 2rem;
}

@media (max-width: 700px) {
  header { padding: 0.5rem 1rem; }
  .logo h1 { font-size: 1.5rem; }
  .hero-card { flex-direction: column; }
  .hero-img { min-height: 200px; }
  .hero-content { padding: 1.5rem; }
  .hero-content h2 { font-size: 1.5rem; }
  .news-grid { gap: 1.2rem; }
}
@media (max-width: 480px) {
  .news-grid { grid-template-columns: 1fr; }
  .cnn-actions { flex-direction: column; }
}
