:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #66736f;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --line: #dfe5df;
  --green: #1f7a4d;
  --green-2: #dff3e8;
  --red: #c2413f;
  --gold: #b7791f;
  --blue: #2364aa;
  --shadow: 0 20px 55px rgba(25, 38, 33, 0.12);
  --hero-bg: radial-gradient(circle at 92% 12%, rgba(183, 121, 31, 0.17), transparent 28%), linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 247, 243, 0.92));
  --hero-panel-bg: rgba(255, 255, 255, 0.82);
  --header-bg: rgba(251, 250, 246, 0.86);
  --card-bg: rgba(255, 255, 255, 0.86);
  --search-bg: rgba(255, 255, 255, 0.72);
  font-family: "Inter", "Noto Sans Devanagari", system-ui, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8eee8;
  --muted: #a1b0ab;
  --paper: #0b110f;
  --panel: #16201c;
  --line: #2e3d36;
  --green: #4ade80;
  --green-2: #143625;
  --red: #f87171;
  --gold: #fbbf24;
  --blue: #60a5fa;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.4);
  --hero-bg: radial-gradient(circle at 92% 12%, rgba(183, 121, 31, 0.1), transparent 28%), linear-gradient(135deg, rgba(22, 32, 28, 0.94), rgba(22, 32, 28, 0.92));
  --hero-panel-bg: rgba(22, 32, 28, 0.82);
  --header-bg: rgba(11, 17, 15, 0.86);
  --card-bg: rgba(22, 32, 28, 0.86);
  --search-bg: rgba(22, 32, 28, 0.72);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(31, 122, 77, 0.12), transparent 34%),
    linear-gradient(230deg, rgba(194, 65, 63, 0.1), transparent 32%),
    var(--paper);
  overflow-x: hidden;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px clamp(18px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--blue));
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.hero-panel small,
.summary-strip small,
.source,
time {
  color: var(--muted);
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 122, 77, 0.5);
}

.icon-button.is-refreshing svg {
  animation: spin 850ms linear infinite;
}

.icon-button svg,
.search svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) minmax(250px, 340px);
  gap: 24px;
  align-items: center;
  min-height: 310px;
  padding: clamp(22px, 5vw, 52px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--hero-bg);
  box-shadow: var(--shadow);
  perspective: 1100px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.15rem, 6vw, 4.7rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-text {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.18rem);
  line-height: 1.7;
}

.hero-panel {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 92px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--hero-panel-bg);
  animation: floatPanel 5s ease-in-out infinite;
}

.status-dot {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(31, 122, 77, 0.12);
  animation: pulse 1.8s ease-in-out infinite;
}

.hero-visual {
  position: relative;
  display: grid;
  min-height: 210px;
  place-items: center;
  transform-style: preserve-3d;
}

.signal-stack {
  position: relative;
  width: 154px;
  height: 154px;
  transform: rotateX(58deg) rotateZ(-38deg);
  transform-style: preserve-3d;
  animation: tiltStack 7s ease-in-out infinite;
}

.signal-stack span {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(31, 122, 77, 0.25);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(31, 122, 77, 0.22), rgba(35, 100, 170, 0.2)),
    rgba(255, 255, 255, 0.7);
  box-shadow: 0 18px 42px rgba(25, 38, 33, 0.16);
}

.signal-stack span:nth-child(1) {
  transform: translateZ(0);
}

.signal-stack span:nth-child(2) {
  transform: translate3d(18px, -18px, 28px);
}

.signal-stack span:nth-child(3) {
  transform: translate3d(36px, -36px, 56px);
}

.signal-core {
  position: absolute;
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--blue));
  box-shadow: 0 24px 42px rgba(35, 100, 170, 0.22);
  font-size: 1.25rem;
  font-weight: 900;
  animation: coreLift 4.5s ease-in-out infinite;
}

.controls {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr);
  gap: 16px;
  margin: 24px 0 16px;
}

.tabs,
.search {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--search-bg);
}

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  padding: 5px;
}

.tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tab.active {
  color: #fff;
  background: var(--ink);
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.summary-strip div {
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--search-bg);
}

.summary-strip span {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.news-card {
  display: flex;
  min-height: 430px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.08);
  animation: cardIn 420ms ease both;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.news-card:hover {
  transform: translateY(-3px);
  border-color: rgba(31, 122, 77, 0.34);
  box-shadow: 0 18px 42px rgba(25, 38, 33, 0.12);
}

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

.region-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-2);
  font-size: 0.82rem;
  font-weight: 800;
}

.news-card h2 {
  margin: 18px 0 12px;
  font-size: 1.12rem;
  line-height: 1.38;
  letter-spacing: 0;
}

.summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

.card-footer {
  margin-top: auto;
  padding-top: 18px;
}

.card-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
}

.empty-state {
  padding: 42px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  background: rgba(255, 255, 255, 0.64);
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.topic-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.topic-chips::-webkit-scrollbar {
  display: none;
}
.topic-chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--search-bg);
  color: var(--ink);
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
}
.topic-chip.active {
  background: var(--ink);
  color: var(--panel);
}

.topic-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(35, 100, 170, 0.1);
  font-size: 0.82rem;
  font-weight: 800;
}

.save-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: all 160ms ease;
}
.save-button:hover {
  border-color: var(--green);
  color: var(--green);
}
.save-button.is-saved {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.save-button.is-saved svg {
  fill: currentColor;
}

.topbar-actions,
.card-top-tags,
.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.card-footer-source {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hidden {
  display: none;
}

.loading-card {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.85), transparent 58%),
    rgba(255, 255, 255, 0.58);
  background-size: 220% 100%;
  animation: shine 1.2s infinite;
}

@keyframes shine {
  to {
    background-position-x: -220%;
  }
}

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

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 10px rgba(31, 122, 77, 0.05);
  }
}

@keyframes floatPanel {
  50% {
    transform: translateY(-5px);
  }
}

@keyframes tiltStack {
  50% {
    transform: rotateX(54deg) rotateZ(-31deg) translateY(-5px);
  }
}

@keyframes coreLift {
  50% {
    transform: translateY(-8px) scale(1.03);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (max-width: 860px) {
  .hero,
  .controls,
  .news-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 0;
  }

  .hero-visual {
    min-height: 150px;
    order: -1;
  }

  .signal-stack {
    width: 118px;
    height: 118px;
  }
}

@media (max-width: 620px) {
  main {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
    padding-bottom: 40px;
  }

  .topbar {
    min-height: 64px;
    padding: 10px 12px;
  }

  .brand-mark,
  .icon-button {
    width: 40px;
    height: 40px;
  }

  .hero {
    padding: 18px;
    gap: 16px;
  }

  .hero-visual {
    min-height: 108px;
  }

  .signal-stack {
    width: 90px;
    height: 90px;
  }

  .signal-core {
    width: 54px;
    height: 54px;
    font-size: 1rem;
  }

  h1 {
    font-size: clamp(2rem, 12vw, 3.15rem);
    line-height: 1.02;
  }

  .hero-text {
    margin-top: 16px;
    font-size: 1rem;
    line-height: 1.58;
  }

  .hero-panel {
    min-height: 78px;
    padding: 14px;
    animation: none;
  }

  .controls {
    gap: 10px;
    margin: 16px 0 12px;
  }

  .summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .summary-strip div {
    min-height: 64px;
    padding: 10px;
  }

  .summary-strip span {
    font-size: 1.05rem;
  }

  .summary-strip small {
    font-size: 0.76rem;
  }

  .tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .card-top,
  .card-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .news-card {
    min-height: 0;
    padding: 16px;
  }

  .news-card h2 {
    margin: 14px 0 10px;
    font-size: 1.05rem;
    line-height: 1.42;
  }

  .summary {
    font-size: 0.98rem;
    line-height: 1.72;
  }

  .card-footer {
    padding-top: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
