/* =========================================================
   Gaudau.lt – articles toolbar & empty-state focus rings
   Visible keyboard focus styles for the articles empty-state
   reset button and the articles clear button so keyboard
   users see focus on every article toolbar and empty-state
   control.

   Matches the article favorites filter focus treatment
   (bright green outline plus a soft halo) so every control
   in the articles section has a consistent, clearly
   distinguishable focus indicator on both themes.
   ========================================================= */

/* ---------- Articles clear button ---------- */
.articles-clear:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-color: var(--green-line);
  background-color: var(--green-soft);
  color: var(--text-strong);
  box-shadow: 0 0 0 4px var(--green-soft);
}

[data-theme="light"] .articles-clear:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* Fallback focus ring for browsers that do not support :focus-visible.
   Uses :focus so keyboard users on older engines still see a clear
   indicator on the articles clear button. The :focus-visible rule above
   takes precedence in modern browsers. */
.articles-clear:focus {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-color: var(--green-line);
  background-color: var(--green-soft);
  color: var(--text-strong);
  box-shadow: 0 0 0 4px var(--green-soft);
}

[data-theme="light"] .articles-clear:focus {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* Suppress the fallback ring for mouse users in browsers that support
   :focus-visible, so the ring only appears for keyboard navigation. */
.articles-clear:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* ---------- Articles empty-state reset button ---------- */
.articles-empty-reset:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-color: var(--green-line);
  background-color: var(--green-soft);
  color: var(--text-strong);
  box-shadow: 0 0 0 4px var(--green-soft);
}

[data-theme="light"] .articles-empty-reset:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* Fallback focus ring for browsers that do not support :focus-visible.
   Uses :focus so keyboard users on older engines still see a clear
   indicator on the articles empty-state reset button. The :focus-visible
   rule above takes precedence in modern browsers. */
.articles-empty-reset:focus {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-color: var(--green-line);
  background-color: var(--green-soft);
  color: var(--text-strong);
  box-shadow: 0 0 0 4px var(--green-soft);
}

[data-theme="light"] .articles-empty-reset:focus {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* Suppress the fallback ring for mouse users in browsers that support
   :focus-visible, so the ring only appears for keyboard navigation. */
.articles-empty-reset:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* ---------- Articles clear button: active-filter count badge ---------- */
.articles-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background-color: var(--surface-3);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.articles-clear[hidden] {
  display: none;
}

.articles-clear:hover {
  background-color: var(--green-soft);
  border-color: var(--green-line);
  color: var(--text-strong);
}

.articles-clear svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Active-filter count badge. Hidden when no filters are active so the
   clear button stays clean. */
.articles-clear-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  border: 1px solid var(--green-line);
  background-color: var(--green-soft);
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.articles-clear-count[hidden] {
  display: none;
}

/* When filters are active, highlight the clear button so the user can
   see at a glance that the current view is filtered. */
.articles-clear.has-active-filters {
  border-color: var(--green-line);
  background-color: var(--green-soft);
  color: var(--text-strong);
}

.articles-clear.has-active-filters:hover {
  background-color: var(--green);
  border-color: var(--green);
  color: #0b1418;
}

.articles-clear.has-active-filters:hover .articles-clear-count {
  border-color: transparent;
  background-color: rgba(11, 20, 24, 0.18);
  color: #0b1418;
}

/* Screen-reader-only live region announcing the active filter count. */
.articles-clear-count-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .articles-clear:focus-visible,
  .articles-empty-reset:focus-visible,
  .articles-clear:focus,
  .articles-empty-reset:focus {
    transition: none;
  }

  .articles-clear {
    transition: none;
  }
}

@media (max-width: 480px) {
  .articles-clear-label {
    display: none;
  }

  .articles-clear {
    padding: 0.5rem 0.6rem;
  }
}
