@layer pages {
  .articles-page {
    --article-ink: #f4f6fb;
    --article-muted: rgb(233 239 255 / 72%);
    --article-border: rgb(244 199 106 / 18%);
    --article-panel: linear-gradient(135deg, rgb(30 25 45 / 85%), rgb(18 14 28 / 95%));
    --article-accent: #f4c76a;
    --article-accent-soft: rgb(244 199 106 / 14%);
    --article-stage-bg: #f3f4f6;
    --article-shadow: 0 20px 45px rgb(5 4 11 / 45%);

    min-height: 80vh;
    margin-top: calc(-1 * var(--space-05));
    padding: 0.45rem 0 4rem;
    background: transparent;
  }

  .articles-landing-hero {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1.2rem 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--article-border);
    background: var(--article-panel);
    box-shadow: var(--article-shadow);
  }

  .articles-hero-topline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .articles-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--article-accent);
  }

  .articles-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--article-muted);
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
  }

  .articles-back-link:hover {
    color: var(--article-accent);
  }

  .articles-back-link svg,
  .articles-back-link i {
    width: 15px;
    height: 15px;
  }

  .articles-landing-copy h1 {
    margin: 0.2rem 0 0.4rem;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    line-height: 1.1;
    font-weight: 800;
    background: linear-gradient(90deg, #fff 0%, #c9a3ff 100%);
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .articles-landing-copy p {
    max-width: 76ch;
    margin: 0;
    color: var(--article-muted);
    font-size: 0.92rem;
    line-height: 1.6;
  }

  .articles-hero-controls {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
  }

  .articles-hero-search {
    width: 100%;
    margin: 0;
  }

  .articles-hero-metrics {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.65rem;
  }

  .articles-metric-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 46px;
    padding: 0.45rem 0.95rem;
    border-radius: 14px;
    border: 1px solid var(--article-border);
    background: rgb(255 255 255 / 3.5%);
    white-space: nowrap;
  }

  .articles-metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--article-ink);
  }

  .articles-metric-label {
    color: var(--article-muted);
    font-size: 0.82rem;
  }

  /* Filtros por categoria (1 linha + dropdown "Mais Categorias") */
  .articles-category-filters {
    margin-bottom: 1.4rem;
  }

  .articles-chips-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
  }

  .article-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1.05rem;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--article-muted);
    background: rgb(255 255 255 / 4%);
    border: 1px solid var(--article-border);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
  }

  .article-filter-chip:hover {
    color: var(--article-ink);
    border-color: var(--article-accent);
    background: var(--article-accent-soft);
  }

  .article-filter-chip.is-active {
    color: #fff;
    border-color: var(--article-accent);
    background: linear-gradient(135deg, rgb(244 199 106 / 26%), rgb(245 158 11 / 16%));
    box-shadow: 0 0 15px var(--article-accent-soft);
  }

  .article-category-dropdown {
    position: relative;
    display: inline-block;
  }

  .article-category-dropdown.is-open .article-dropdown-menu,
  .article-category-dropdown:focus-within .article-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .article-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    z-index: 50;
    min-width: 240px;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.45rem 0;
    background: rgb(18 14 28 / 96%);
    border: 1px solid var(--article-border);
    border-radius: 14px;
    backdrop-filter: blur(16px);
    box-shadow: var(--article-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  }

  .article-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.55rem 1rem;
    border: 0;
    background: transparent;
    color: var(--article-muted);
    font: inherit;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .article-dropdown-item:hover,
  .article-dropdown-item.is-active {
    color: #fff;
    background: var(--article-accent-soft);
  }

  .article-dropdown-count {
    font-size: 0.78rem;
    opacity: 0.75;
  }

  /* Grade única de artigos */
  .articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.35rem;
  }

  .article-card {
    position: relative;
  }

  .article-card.is-hidden {
    display: none;
  }

  .article-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid var(--article-border);
    background: var(--article-panel);
    box-shadow: var(--article-shadow);
    color: inherit;
    text-decoration: none;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  }

  .article-card-link:hover {
    transform: translateY(-6px);
    border-color: rgb(244 199 106 / 45%);
    box-shadow: 0 30px 64px rgb(4 8 18 / 50%);
  }

  .article-card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(135deg, rgb(244 199 106 / 10%), rgb(18 14 28 / 92%));
  }

  .article-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    transition: transform 0.35s ease;
  }

  .article-card-link:hover .article-card-media img {
    transform: scale(1.04);
  }

  .article-card-store {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgb(17 24 39 / 84%);
    color: #f9fafb;
    font-size: 0.72rem;
    font-weight: 600;
    backdrop-filter: blur(6px);
  }

  .article-card-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: var(--article-muted);
  }

  .article-card-placeholder svg,
  .article-card-placeholder i {
    width: 40px;
    height: 40px;
    opacity: 0.45;
  }

  .article-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem 1.1rem 1.1rem;
  }

  .article-card-tag {
    align-self: flex-start;
    padding: 0.24rem 0.6rem;
    border-radius: 999px;
    background: rgb(6 11 22 / 72%);
    border: 1px solid rgb(255 255 255 / 8%);
    color: var(--article-muted);
    font-size: 0.74rem;
    font-weight: 500;
  }

  .article-card-title {
    margin: 0;
    color: var(--article-ink);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.32;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

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

  .article-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgb(255 255 255 / 6%);
  }

  .article-card-price {
    color: var(--article-ink);
    font-size: 0.88rem;
    font-weight: 700;
  }

  .article-read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--article-accent);
    font-size: 0.84rem;
    font-weight: 600;
    transition: gap 0.2s ease;
  }

  .article-card-link:hover .article-read-more {
    gap: 0.55rem;
  }

  .article-read-more svg,
  .article-read-more i {
    width: 15px;
    height: 15px;
  }

  /* Empty state */
  .articles-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    padding: 3.5rem 1.5rem;
    border-radius: 20px;
    border: 1px dashed var(--article-border);
    background: rgb(255 255 255 / 2%);
    text-align: center;
  }

  .articles-empty-state.is-hidden {
    display: none;
  }

  .articles-empty-icon {
    width: 48px;
    height: 48px;
    color: var(--article-muted);
    opacity: 0.6;
  }

  .articles-empty-title {
    margin: 0;
    color: var(--article-ink);
    font-size: 1.1rem;
    font-weight: 600;
  }

  .articles-empty-text {
    margin: 0;
    color: var(--article-muted);
    font-size: 0.9rem;
  }

  .articles-reset-btn {
    margin-top: 0.5rem;
    padding: 0.55rem 1.2rem;
    border-radius: 999px;
    border: 1px solid var(--article-accent);
    background: var(--article-accent-soft);
    color: var(--article-ink);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
  }

  .articles-reset-btn:hover {
    background: rgb(0 217 255 / 28%);
  }

  @media (width <= 1080px) {
    .articles-hero-controls {
      grid-template-columns: 1fr;
    }

    .articles-hero-metrics {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
      gap: 0.75rem;
    }

    .articles-metric-card {
      white-space: normal;
    }
  }

  @media (width <= 640px) {
    .articles-page {
      padding-top: 1.25rem;
    }

    .articles-landing-hero {
      padding: 1rem 1.1rem;
      border-radius: 18px;
    }

    .articles-grid {
      grid-template-columns: 1fr;
    }
  }
}

@layer theme {
  .light-mode .articles-page {
    --article-ink: #111827;
    --article-muted: #4b5563;
    --article-border: rgb(180 83 9 / 20%);
    --article-panel: linear-gradient(135deg, rgb(255 255 255 / 96%), rgb(248 250 252 / 94%));
    --article-accent: #b45309;
    --article-accent-soft: rgb(217 119 6 / 12%);
    --article-stage-bg: #f8fafc;
    --article-shadow: 0 14px 32px rgb(15 23 42 / 8%);
  }

  .light-mode .articles-landing-copy h1 {
    background: linear-gradient(90deg, #111827 0%, #b45309 100%);
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .light-mode .articles-metric-card {
    background: rgb(255 255 255 / 72%);
    border-color: rgb(180 83 9 / 15%);
  }

  .light-mode .article-filter-chip {
    background: rgb(255 255 255 / 75%);
    color: var(--article-muted);
  }

  .light-mode .article-filter-chip.is-active {
    color: #0f172a;
    background: linear-gradient(135deg, rgb(217 119 6 / 18%), rgb(245 158 11 / 14%));
  }

  .light-mode .article-dropdown-menu {
    background: rgb(255 255 255 / 98%);
  }

  .light-mode .article-dropdown-item:hover,
  .light-mode .article-dropdown-item.is-active {
    color: #0f172a;
  }

  .light-mode .article-card-tag {
    background: rgb(15 23 42 / 6%);
    border-color: rgb(15 23 42 / 8%);
    color: #374151;
  }

  .light-mode .article-card-footer {
    border-top-color: rgb(15 23 42 / 8%);
  }
}
