:root {
  --bg: #f4efe7;
  --bg-panel: rgba(255, 252, 247, 0.82);
  --surface: #fffaf3;
  --surface-strong: #fffdf9;
  --border: rgba(58, 45, 28, 0.12);
  --text: #1d1a16;
  --muted: #685f55;
  --accent: #b44f22;
  --accent-soft: #f2c18a;
  --ok: #1f7a52;
  --error: #b03a2e;
  --shadow: 0 18px 40px rgba(46, 33, 18, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 214, 153, 0.55), transparent 28%),
    radial-gradient(circle at right 20%, rgba(181, 79, 34, 0.18), transparent 24%),
    linear-gradient(180deg, #faf6ef 0%, #f1eadf 100%);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

a {
  color: inherit;
}

.page-shell {
  width: min(100% - 32px, 1240px);
  max-width: 1240px;
  margin: 32px auto 48px;
}

.hero {
  display: grid;
  gap: 24px;
  grid-template-columns: 1.4fr 1fr;
  align-items: end;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 248, 239, 0.92), rgba(250, 236, 218, 0.92));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.eyebrow,
.category-kicker,
.stat-label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero-copy {
  margin-bottom: 0;
  max-width: 56ch;
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--muted);
}

.hero-meta {
  display: grid;
  gap: 14px;
}

.hero-meta-compact {
  justify-items: end;
  align-content: start;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.hero-status-note {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid rgba(180, 79, 34, 0.18);
  border-radius: 999px;
  background: linear-gradient(180deg, #f5ca8f 0%, #efbb74 100%);
  color: #432512;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(180, 79, 34, 0.18);
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.refresh-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(180, 79, 34, 0.24);
}

.refresh-button:focus-visible {
  outline: 2px solid rgba(180, 79, 34, 0.28);
  outline-offset: 3px;
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.88;
}

.refresh-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(67, 37, 18, 0.24);
  border-top-color: #432512;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.refresh-button.is-loading .refresh-spinner {
  display: inline-block;
}

.refresh-button.is-loading .refresh-button-label::after {
  content: "ing";
}

.stat-card,
.status-panel,
.empty-state,
.footer-status-panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.stat-card {
  padding: 18px 20px;
}

.stat-card strong {
  display: block;
  font-size: 1rem;
}

.empty-state {
  margin-top: 24px;
  padding: 24px;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.filter-label {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.filter-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.filter-chip {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(180, 79, 34, 0.18);
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.78);
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.filter-chip:hover {
  transform: translateY(-1px);
  color: var(--text);
}

.filter-chip:focus-visible {
  outline: 2px solid rgba(180, 79, 34, 0.28);
  outline-offset: 3px;
}

.filter-chip.is-active {
  border-color: rgba(180, 79, 34, 0.38);
  background: linear-gradient(180deg, #f5ca8f 0%, #efbb74 100%);
  color: #432512;
  box-shadow: 0 10px 22px rgba(180, 79, 34, 0.18);
}

.article-feed {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 24px;
}

.status-panel {
  padding: 22px;
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
}

.category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(180, 79, 34, 0.1);
  font-size: 1.8rem;
  line-height: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(180, 79, 34, 0.1);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 700;
}

.article-card[hidden] {
  display: none !important;
}

.article-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(58, 45, 28, 0.08);
  background: var(--surface-strong);
}

.article-media {
  margin: -18px -18px 16px;
  background: linear-gradient(135deg, rgba(242, 193, 138, 0.45), rgba(180, 79, 34, 0.18));
}

.article-media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
}

.article-media-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

.article-placeholder-icon {
  width: 72px;
  height: 72px;
  font-size: 2.2rem;
}

.article-card h3 {
  margin-bottom: 10px;
  font-size: 1.08rem;
  line-height: 1.35;
}

.article-card h3 a {
  display: inline-block;
  text-decoration: none;
  padding: 6px 0;
}

.article-card h3 a:hover,
.article-footer a:hover {
  color: var(--accent);
}

.article-card p,
.empty-copy,
.status-header p,
.status-row span,
.article-footer time,
.article-meta {
  color: var(--muted);
}

.article-card p {
  margin-bottom: 14px;
  line-height: 1.55;
  flex: 1;
}

.article-meta,
.article-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
}

.article-meta {
  margin-bottom: 12px;
  align-items: center;
  font-weight: 600;
}

.article-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(180, 79, 34, 0.1);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.article-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.source-icon {
  font-size: 0.92rem;
}

.article-footer {
  align-items: center;
  margin-top: auto;
}

.article-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  text-decoration: none;
}

.status-panel {
  margin-top: 24px;
}

.footer-status-panel {
  margin-top: 24px;
  padding: 22px;
  border-top: 1px solid rgba(58, 45, 28, 0.18);
}

.footer-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.status-table {
  display: grid;
  gap: 12px;
}

.status-row {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid rgba(58, 45, 28, 0.08);
}

.status-row strong,
.status-row span {
  display: block;
}

.status-ok {
  border-left: 5px solid rgba(31, 122, 82, 0.45);
}

.status-error {
  border-left: 5px solid rgba(176, 58, 46, 0.45);
}

.status-note {
  word-break: break-word;
}

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

@media (min-width: 640px) {
  .article-feed {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .article-feed {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .status-row {
    grid-template-columns: 1fr;
  }

  .footer-status-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 639px) {
  .page-shell {
    width: min(100% - 20px, 1240px);
    margin-top: 12px;
  }

  .hero,
  .status-panel,
  .footer-status-panel {
    padding: 18px;
    border-radius: 20px;
  }

  .article-meta,
  .article-footer,
  .filter-bar,
  .status-header,
  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-chips {
    width: 100%;
    justify-content: flex-start;
  }

  .hero {
    gap: 18px;
  }

  .refresh-button {
    width: 100%;
  }

  h1 {
    font-size: clamp(2.1rem, 12vw, 3rem);
  }

  .article-media-placeholder {
    min-height: 160px;
  }
}
