/* Warta Kini — Gaya editorial berdasarkan styles.refero.design */

:root {
  /* Tema lalai: Refero Putih */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-subtle: #f8f9fb;
  --ink: #1e2a4a;
  --ink-strong: #0f172a;
  --muted: #475569;
  --placeholder: #64748b;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --accent-ink: #1d4ed8;
  --submit-bg: #8b8fa8;
  --submit-hover: #2563eb;
  --green: #10b981;
  --amber: #d97706;
  --radius-card: 16px;
  --radius-btn: 10px;
  --radius-pill: 9999px;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --reader-size: 18px;
}

html[data-theme="paper"] {
  /* Gaya Kertas Akhbar (Steep / Perplexity dari katalog Refero) */
  --bg: #faf7f2;
  --surface: #fffdf9;
  --surface-subtle: #f3ede2;
  --ink: #1c1917;
  --ink-strong: #0c0a09;
  --muted: #57534e;
  --placeholder: #78716c;
  --border: #e7dfd1;
  --border-strong: #d6cbb9;
  --accent: #b45309;
  --accent-soft: #fef3c7;
  --accent-ink: #92400e;
  --submit-bg: #44403c;
  --submit-hover: #b45309;
}

html[data-theme="dark"] {
  /* Gaya Editorial Gelap (ORYZO / Raycast dari katalog Refero) */
  --bg: #0b0e14;
  --surface: #121722;
  --surface-subtle: #181f2e;
  --ink: #e5eaf5;
  --ink-strong: #f8fafc;
  --muted: #94a3b8;
  --placeholder: #94a3b8;
  --border: #232c3f;
  --border-strong: #33415c;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --accent-ink: #93c5fd;
  --submit-bg: #3b82f6;
  --submit-hover: #60a5fa;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  min-width: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.brand-sep {
  color: var(--border-strong);
  font-weight: 400;
}

.brand-sub {
  color: var(--accent-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
}

.theme-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  transition: background 0.15s, color 0.15s;
}

.theme-btn.active {
  background: var(--surface);
  color: var(--ink-strong);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  transition: border-color 0.15s, background 0.15s;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}

.icon-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

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

/* Main Shell */
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

/* Hero — gaya Refero tengah bersih */
.hero {
  max-width: 720px;
  margin: 0 auto 28px;
  text-align: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 16px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  flex-shrink: 0;
}

.live-dot.stale {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

.hero-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(34px, 5.2vw, 56px);
  line-height: 1.06;
  letter-spacing: -0.015em;
  color: var(--ink-strong);
}

.hero-sub {
  margin: 0 auto 22px;
  max-width: 540px;
  font-size: 15px;
  color: var(--muted);
}

/* Search Pill */
.search-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 600px;
  margin: 0 auto 16px;
  padding: 6px 6px 6px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-pill:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-pill input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-strong);
  font-family: inherit;
  font-size: 15px;
  padding: 8px 0;
}

.search-pill input::placeholder {
  color: var(--placeholder);
}

.clear-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
}

.search-submit {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: var(--submit-bg);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.12s;
}

.search-submit:hover {
  background: var(--submit-hover);
}

/* Quick bar: Bahasa + Kategori */
.quick-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lang-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
}

.cat-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
  padding-bottom: 2px;
}

.cat-strip::-webkit-scrollbar {
  display: none;
}

.chip {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.cat-strip .chip {
  border-color: var(--border);
  background: var(--surface);
}

.chip:hover {
  color: var(--ink-strong);
  border-color: var(--border-strong);
}

.chip.active {
  background: var(--ink-strong);
  color: var(--bg);
  border-color: var(--ink-strong);
}

/* New news banner */
.new-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto 20px;
  max-width: 600px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 500;
}

.new-banner[hidden] {
  display: none;
}

.new-banner button {
  border: 0;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
}

/* Sources Strip */
.sources-bar {
  margin-bottom: 22px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.sources-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.micro-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta-stats {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.source-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 2px;
}

.source-strip::-webkit-scrollbar {
  display: none;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.source-pill:hover {
  border-color: var(--border-strong);
}

.source-pill.active {
  background: var(--ink-strong);
  color: var(--bg);
  border-color: var(--ink-strong);
}

.source-pill.down {
  opacity: 0.55;
}

.src-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.src-count {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.72;
}

/* Feed Grid */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
  min-width: 0;
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.card-source {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
}

.card-source-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.card-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 23px;
  line-height: 1.22;
  color: var(--ink-strong);
  overflow-wrap: anywhere;
}

.card-summary {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.tag-full {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-ink);
}

.tag-cluster {
  font-family: var(--font-mono);
  color: var(--ink);
}

.card-read-cta {
  color: var(--accent-ink);
  font-weight: 600;
  white-space: nowrap;
}

/* Skeleton */
.skeleton-card {
  height: 210px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--surface-subtle) 25%, var(--surface) 50%, var(--surface-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.empty-title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 26px;
  color: var(--ink-strong);
}

.empty-sub {
  margin: 0 0 18px;
  color: var(--muted);
}

.reset-btn {
  border: 1px solid var(--ink-strong);
  background: var(--ink-strong);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}

.mono {
  font-family: var(--font-mono);
}

/* Clean Reader Modal / Drawer */
.reader-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
  overflow-y: auto;
}

.reader-backdrop[hidden] {
  display: none;
}

.reader-sheet {
  width: 100%;
  max-width: 760px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.reader-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.reader-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.reader-source-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.reader-source {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-mode-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-ink);
  white-space: nowrap;
}

.reader-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.reader-ctrl-btn, .reader-ext-btn, .reader-close {
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.reader-close {
  font-size: 18px;
  line-height: 1;
  width: 32px;
  height: 30px;
  padding: 0;
}

.reader-body {
  padding: 28px 34px 40px;
}

.reader-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.reader-cat {
  color: var(--accent-ink);
  font-weight: 600;
}

.reader-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.15;
  color: var(--ink-strong);
}

.reader-author {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
}

.reader-img-wrap {
  margin: 18px 0 22px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
}

.reader-img-wrap img {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: cover;
}

.reader-content {
  font-size: var(--reader-size);
  line-height: 1.8;
  color: var(--ink);
  max-width: 66ch;
}

.reader-content p {
  margin: 0 0 1.05em;
}

.reader-loading {
  color: var(--muted);
  font-size: 15px;
}

.reader-notice {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-size: 13px;
  color: var(--muted);
}

.reader-also {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.reader-also-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.reader-also-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-subtle);
  font-size: 13px;
  text-align: left;
  color: var(--ink);
}

.reader-also-item:hover {
  border-color: var(--border-strong);
}

/* Responsive */
@media (max-width: 980px) {
  .feed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    padding: 10px 14px;
  }
  .btn-label {
    display: none;
  }
  .theme-btn {
    padding: 4px 8px;
    font-size: 11.5px;
  }
  .shell {
    padding: 18px 14px 48px;
  }
  .hero {
    margin-bottom: 18px;
  }
  .hero-sub {
    font-size: 14px;
    margin-bottom: 16px;
  }
  .search-pill {
    padding: 5px 5px 5px 16px;
  }
  .quick-bar {
    justify-content: flex-start;
  }
  .cat-strip, .source-strip {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    padding-right: 24px;
    -webkit-mask-image: linear-gradient(to right, #000 86%, transparent 100%);
    mask-image: linear-gradient(to right, #000 86%, transparent 100%);
  }
  .meta-stats {
    font-size: 11px;
  }
  .feed-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .card {
    padding: 15px 16px;
  }
  .card-title {
    font-size: 21px;
  }
  .reader-backdrop {
    padding: 0;
  }
  .reader-sheet {
    border-radius: 0;
    min-height: 100vh;
    border: 0;
  }
  .reader-body {
    padding: 20px 18px 42px;
  }
  .reader-mode-badge {
    display: none;
  }
}
