/* =========================================================
   Gaudau.lt – theme contrast hardening
   Production-readiness pass for dark/light theme parity.

   This stylesheet is loaded LAST so it can correct any
   contrast or focus-ring gaps that the per-section
   stylesheets miss, without touching their layout rules.

   Scope:
   - Light-theme overrides for surfaces that were tuned for
     the dark palette (header, hero card, map canvas, video
     overlays, article modal, competition table stripes).
   - Focus-visible rings for interactive controls that did
     not have an explicit ring yet (nav toggle, theme toggle
     fallback, map today/reset, competition submit/cancel,
     video submit, article modal close, catch submit/cancel,
     weather refresh fallback, storage banner close).
   - Contrast fixes for muted text on tinted surfaces in
     both themes.
   ========================================================= */

/* ---------- Light theme: header & sticky surfaces ---------- */
[data-theme="light"] .site-header {
  background-color: rgba(255, 255, 255, 0.92);
  border-bottom-color: var(--line);
}

[data-theme="light"] .site-nav {
  background-color: var(--bg-2);
}

[data-theme="light"] .nav-link.is-active {
  color: var(--green);
  background-color: var(--green-soft);
}

[data-theme="light"] .nav-link:hover {
  color: var(--text-strong);
  background-color: var(--surface-3);
}

/* ---------- Light theme: hero card ---------- */
[data-theme="light"] .hero-card {
  background-image: linear-gradient(160deg, #ffffff, #f4f9fb);
  border-color: var(--line-strong);
}

[data-theme="light"] .hero-card-head {
  background-color: var(--surface-2);
}

[data-theme="light"] .hero-card-dot {
  box-shadow: 0 0 0 4px var(--green-soft);
}

[data-theme="light"] .hero-recent-item {
  background-color: var(--surface-2);
}

[data-theme="light"] .hero-recent-item:hover {
  background-color: var(--surface-3);
}

[data-theme="light"] .hero-recent-empty {
  background-color: var(--surface-2);
}

[data-theme="light"] .hero-recent-loading {
  background-color: var(--surface-2);
}

[data-theme="light"] .hero-recent-loading-bar {
  background-color: var(--surface-3);
}

[data-theme="light"] .hero-recent-more {
  background-color: var(--surface-2);
}

[data-theme="light"] .hero-recent-more:hover {
  background-color: var(--green-soft);
}

[data-theme="light"] .hero-recent-toast {
  background-color: #ffffff;
  border-color: var(--green-line);
}

/* ---------- Light theme: map canvas & side list ---------- */
[data-theme="light"] .map-canvas {
  background-color: var(--surface-3);
}

[data-theme="light"] .map-side {
  background-color: var(--surface);
}

[data-theme="light"] .map-list-item {
  background-color: var(--surface-2);
}

[data-theme="light"] .map-list-item:hover {
  background-color: var(--surface-3);
}

[data-theme="light"] .map-seasonal {
  background-color: var(--surface-2);
}

[data-theme="light"] .map-seasonal-chip {
  background-color: var(--surface);
}

[data-theme="light"] .map-today {
  background-color: var(--surface-2);
}

[data-theme="light"] .map-today[aria-pressed="true"] {
  background-color: var(--green-soft);
  border-color: var(--green-line);
  color: var(--green);
}

[data-theme="light"] .map-reset {
  background-color: var(--surface-2);
}

/* ---------- Light theme: competition table ---------- */
[data-theme="light"] .competition-table tbody tr:nth-child(even) {
  background-color: var(--surface-2);
}

[data-theme="light"] .competition-table tbody tr:hover {
  background-color: var(--surface-3);
}

[data-theme="light"] .competition-table tbody tr.is-me {
  background-color: var(--green-soft);
}

[data-theme="light"] .competition-species-chip {
  background-color: var(--surface-2);
}

[data-theme="light"] .competition-species-chip.is-collected {
  background-color: var(--green-soft);
  border-color: var(--green-line);
}

[data-theme="light"] .competition-stats-tile {
  background-color: var(--surface-2);
}

/* ---------- Light theme: weather ---------- */
[data-theme="light"] .weather-day {
  background-color: var(--surface-2);
}

[data-theme="light"] .weather-day:hover {
  background-color: var(--surface-3);
}

[data-theme="light"] .weather-current {
  background-color: var(--surface-2);
}

[data-theme="light"] .weather-spot {
  background-color: var(--surface-2);
}

[data-theme="light"] .weather-spot:hover {
  background-color: var(--surface-3);
}

[data-theme="light"] .bite-index {
  background-color: var(--surface-2);
}

[data-theme="light"] .bite-index-meter {
  background-color: var(--surface-3);
}

/* ---------- Light theme: articles ---------- */
[data-theme="light"] .article-card {
  background-color: var(--surface);
  border-color: var(--line);
}

[data-theme="light"] .article-card:hover {
  border-color: var(--green-line);
}

[data-theme="light"] .article-cat {
  background-color: var(--surface-2);
}

[data-theme="light"] .article-cat.is-active {
  background-color: var(--green-soft);
  border-color: var(--green-line);
  color: var(--green);
}

[data-theme="light"] .article-modal-dialog {
  background-color: var(--surface);
  border-color: var(--line-strong);
}

[data-theme="light"] .article-modal-backdrop {
  background-color: var(--modal-backdrop);
}

/* ---------- Light theme: video ---------- */
[data-theme="light"] .video-card {
  background-color: var(--surface);
  border-color: var(--line);
}

[data-theme="light"] .video-card:hover {
  border-color: var(--green-line);
}

[data-theme="light"] .video-card-share {
  background-color: rgba(255, 255, 255, 0.9);
  border-color: rgba(15, 45, 60, 0.2);
  color: var(--text-strong);
}

[data-theme="light"] .video-card-share:hover {
  background-color: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

[data-theme="light"] .video-fav-filter {
  background-color: var(--surface-2);
}

[data-theme="light"] .video-fav-filter[aria-pressed="true"] {
  background-color: var(--fav-soft);
  border-color: var(--fav-line);
  color: var(--fav);
}

/* ---------- Light theme: catches ---------- */
[data-theme="light"] .catch-card {
  background-color: var(--surface);
  border-color: var(--line);
}

[data-theme="light"] .catch-card:hover {
  border-color: var(--green-line);
}

[data-theme="light"] .catches-search {
  background-color: var(--surface-2);
}

[data-theme="light"] .catches-select {
  background-color: var(--surface-2);
}

[data-theme="light"] .catches-filter-reset {
  background-color: var(--surface-2);
}

[data-theme="light"] .catches-empty,
[data-theme="light"] .catches-no-results {
  background-color: var(--surface-2);
}

/* ---------- Light theme: footer ---------- */
[data-theme="light"] .site-footer {
  background-color: var(--bg-2);
}

/* ---------- Light theme: storage banner ---------- */
[data-theme="light"] .zk-storage-banner {
  background-color: #ffffff;
  border-color: var(--danger);
}

/* =========================================================
   Focus-visible rings for controls that lacked an explicit
   ring. All use the same bright-green outline + soft halo
   pattern so keyboard focus is consistent across the site.
   ========================================================= */

/* ---------- Nav toggle (mobile menu) ---------- */
.nav-toggle:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-color: var(--green-line);
  background-color: var(--green-soft);
  color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

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

/* ---------- Theme toggle ---------- */
.theme-toggle:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-color: var(--green-line);
  background-color: var(--green-soft);
  color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

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

/* ---------- Brand link ---------- */
.brand:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-radius: 12px;
  box-shadow: 0 0 0 4px var(--green-soft);
}

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

/* ---------- Map today / reset buttons ---------- */
.map-today:focus-visible,
.map-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"] .map-today:focus-visible,
[data-theme="light"] .map-reset:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------- Map search clear button ---------- */
.map-search-clear:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 2px;
  background-color: var(--green-soft);
  border-color: var(--green-line);
  color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

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

/* ---------- Map empty-state reset ---------- */
.map-empty-reset:focus-visible,
.map-list-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"] .map-empty-reset:focus-visible,
[data-theme="light"] .map-list-empty-reset:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------- Map list empty CTA ---------- */
.map-list-empty-cta:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  background-color: var(--green);
  border-color: var(--green);
  color: #0b1418;
  box-shadow: 0 0 0 4px var(--green-soft);
}

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

/* ---------- Competition submit / cancel / find-me ---------- */
.competition-submit:focus-visible,
.competition-cancel:focus-visible,
.competition-find-me:focus-visible,
.competition-empty-cta: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"] .competition-submit:focus-visible,
[data-theme="light"] .competition-cancel:focus-visible,
[data-theme="light"] .competition-find-me:focus-visible,
[data-theme="light"] .competition-empty-cta:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------- Competition name input ---------- */
.competition-form input:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

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

/* ---------- Competition table "show more" toggle ---------- */
.competition-table-more-btn: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"] .competition-table-more-btn:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------- Catch submit / cancel / empty / no-results ---------- */
.catches-submit:focus-visible,
.catches-cancel:focus-visible,
.catches-empty-reset:focus-visible,
.catches-no-results-reset:focus-visible,
.catches-no-results-add:focus-visible,
.catches-more-btn: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"] .catches-submit:focus-visible,
[data-theme="light"] .catches-cancel:focus-visible,
[data-theme="light"] .catches-empty-reset:focus-visible,
[data-theme="light"] .catches-no-results-reset:focus-visible,
[data-theme="light"] .catches-no-results-add:focus-visible,
[data-theme="light"] .catches-more-btn:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------- Catch search input & sort select ---------- */
.catches-search input:focus-visible,
.catches-sort:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

[data-theme="light"] .catches-search input:focus-visible,
[data-theme="light"] .catches-sort:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------- Catch search clear button ---------- */
.catches-search-clear:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 2px;
  background-color: var(--green-soft);
  border-color: var(--green-line);
  color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

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

/* ---------- Weather refresh fallback ---------- */
.weather-refresh: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"] .weather-refresh:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------- Weather spot quick-pick ---------- */
.weather-spot: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"] .weather-spot:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------- Articles favorites filter ---------- */
.article-fav-filter:focus-visible {
  outline: 2px solid var(--fav);
  outline-offset: 3px;
  border-color: var(--fav-line);
  background-color: var(--fav-soft);
  color: var(--fav);
  box-shadow: 0 0 0 4px var(--fav-soft);
}

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

/* ---------- Article card favorite toggle ---------- */
.article-card-fav:focus-visible {
  outline: 2px solid var(--fav);
  outline-offset: 2px;
  background-color: var(--fav-soft);
  border-color: var(--fav-line);
  color: var(--fav);
  box-shadow: 0 0 0 4px var(--fav-soft);
}

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

/* ---------- Article "read more" / card link ---------- */
.article-card-link:focus-visible,
.article-card-open:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-radius: 10px;
  box-shadow: 0 0 0 4px var(--green-soft);
}

[data-theme="light"] .article-card-link:focus-visible,
[data-theme="light"] .article-card-open:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------- Article modal close ---------- */
.article-modal-close:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  background-color: var(--green-soft);
  border-color: var(--green-line);
  color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

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

/* ---------- Video submit / favorites filter ---------- */
.video-submit: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"] .video-submit:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.video-fav-filter:focus-visible {
  outline: 2px solid var(--fav);
  outline-offset: 3px;
  border-color: var(--fav-line);
  background-color: var(--fav-soft);
  color: var(--fav);
  box-shadow: 0 0 0 4px var(--fav-soft);
}

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

/* ---------- Video card favorite toggle ---------- */
.video-card-fav:focus-visible {
  outline: 2px solid var(--fav);
  outline-offset: 2px;
  background-color: var(--fav-soft);
  border-color: var(--fav-line);
  color: var(--fav);
  box-shadow: 0 0 0 4px var(--fav-soft);
}

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

/* ---------- Video card play / open link ---------- */
.video-card-play:focus-visible,
.video-card-open:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 3px;
  border-radius: 12px;
  box-shadow: 0 0 0 4px var(--green-soft);
}

[data-theme="light"] .video-card-play:focus-visible,
[data-theme="light"] .video-card-open:focus-visible {
  outline-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

/* ---------- Storage banner close ---------- */
.zk-storage-banner-close:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
  background-color: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

[data-theme="light"] .zk-storage-banner-close:focus-visible {
  outline-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

/* =========================================================
   Contrast fixes: muted text on tinted surfaces
   ========================================================= */

/* Dark theme: the muted token is intentionally low-contrast for
   decorative labels, but body copy inside tinted panels needs a
   slightly stronger tone to stay readable. */
.hero-recent-empty-hint,
.hero-recent-error-hint,
.catches-empty-hint,
.catches-no-results-hint,
.map-empty-hint,
.map-list-empty-hint,
.map-seasonal-empty-hint,
.competition-empty-hint,
.competition-species-empty-hint,
.articles-empty-hint,
.video-empty-hint {
  color: var(--text);
  opacity: 0.85;
}

[data-theme="light"] .hero-recent-empty-hint,
[data-theme="light"] .hero-recent-error-hint,
[data-theme="light"] .catches-empty-hint,
[data-theme="light"] .catches-no-results-hint,
[data-theme="light"] .map-empty-hint,
[data-theme="light"] .map-list-empty-hint,
[data-theme="light"] .map-seasonal-empty-hint,
[data-theme="light"] .competition-empty-hint,
[data-theme="light"] .competition-species-empty-hint,
[data-theme="light"] .articles-empty-hint,
[data-theme="light"] .video-empty-hint {
  color: var(--muted);
  opacity: 1;
}

/* Dark theme: the sand accent is used for warnings; on the dark
   surface it needs a touch more brightness to pass AA at small
   sizes. */
[data-theme="dark"] .footer-copy-noscript,
html:not([data-theme="light"]) .footer-copy-noscript {
  color: var(--sand-soft);
}

/* =========================================================
   Reduced motion: disable transitions on the new focus rings
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .nav-toggle:focus-visible,
  .theme-toggle:focus-visible,
  .brand:focus-visible,
  .map-today:focus-visible,
  .map-reset:focus-visible,
  .map-search-clear:focus-visible,
  .map-empty-reset:focus-visible,
  .map-list-empty-reset:focus-visible,
  .map-list-empty-cta:focus-visible,
  .competition-submit:focus-visible,
  .competition-cancel:focus-visible,
  .competition-find-me:focus-visible,
  .competition-empty-cta:focus-visible,
  .competition-form input:focus-visible,
  .competition-table-more-btn:focus-visible,
  .catches-submit:focus-visible,
  .catches-cancel:focus-visible,
  .catches-empty-reset:focus-visible,
  .catches-no-results-reset:focus-visible,
  .catches-no-results-add:focus-visible,
  .catches-more-btn:focus-visible,
  .catches-search input:focus-visible,
  .catches-sort:focus-visible,
  .catches-search-clear:focus-visible,
  .weather-refresh:focus-visible,
  .weather-spot:focus-visible,
  .article-fav-filter:focus-visible,
  .article-card-fav:focus-visible,
  .article-card-link:focus-visible,
  .article-card-open:focus-visible,
  .article-modal-close:focus-visible,
  .video-submit:focus-visible,
  .video-fav-filter:focus-visible,
  .video-card-fav:focus-visible,
  .video-card-play:focus-visible,
  .video-card-open:focus-visible,
  .zk-storage-banner-close:focus-visible {
    transition: none;
  }
}
