/* Domyślny motyw (Jasny - "Stal taktyczna", przyciemniony) */
:root {
  --bg-color: #dbe0e5; /* Ciemniejszy, techniczny szary w tle */
  --surface: #e9ecef; /* Tło kart - złamana, szarawa biel */
  --text-main: #212529; /* Mocny grafit dla czytelności */
  --text-muted: #5c6b7a; /* Stalowy szary dla detali */
  --accent: #198754; /* Głęboka, militarna zieleń */
  --border-color: #adb5bd; /* Wyraźniejsze kontury kart */
  --grid-color: rgba(
    25,
    135,
    84,
    0.15
  ); /* Wyraźniejsza siatka (zwiększona widoczność) */
  --note-color: #b45309; /* Rdzawy pomarańcz na notatki */
  --radius: 4px;
  --font-mono: "Courier New", Courier, monospace;
}
/* Wzmocnienie kontrastu TYLKO w jasnym trybie na telefonach */
:root:not([data-theme="dark"]) {
  --text-main: #000000;
  --text-muted: #1a1a1a;
}
/* Motyw Ciemny (Stonowany grafit) */
[data-theme="dark"] {
  --bg-color: #2b3441;
  --surface: #373f48;
  --text-main: #dce2e8;
  --text-muted: #a8b5c2;
  --accent: #10b981;
  --border-color: #556274;
  --grid-color: rgba(
    16,
    185,
    129,
    0.08
  ); /* Wyraźniejsza siatka w trybie ciemnym */
  --note-color: #eab308; /* Jasny, ostrzegawczy żółty */
  --radius: 4px;
  --font-mono: "Courier New", Courier, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  padding: 30px 5%; /* Wyrównanie do siatki 30px (zamiast ~32px/2rem) */
  padding-top: 10px !important; /* Mniejszy odstęp od górnej krawędzi ekranu */
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh; /* Gwarancja, że tło pokryje cały ekran */
  /* Subtelna siatka radarowa w tle */
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 30px 30px;
  background-attachment: fixed; /* Siatka nieruchoma jak na monitorze */
}

/* Efekt Vignette (Przyciemnione rogi - styl monitora) */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle, transparent 60%, rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none; /* Pozwala klikać przez warstwę */
  z-index: 900; /* Poniżej modalu, ale powyżej treści */
}

/* Pasek górny */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px; /* Równo jedna kratka siatki */
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 26px; /* 29px + 1px border = 30px (idealnie na linii) */
  gap: 1rem;
}

.top-bar-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.fab-help {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: bold;
  transition: all 0.2s;
}

.fab-help:hover {
  background: rgba(16, 185, 129, 0.1);
}

.badge {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.5rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 1px;
}

/* Przycisk zmiany motywu - styl taktyczny */
#theme-toggle {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
}

#theme-toggle:hover {
  background: var(--accent);
  color: var(--surface);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.lang-switch button {
  border: 1px solid transparent;
  background: none;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.lang-switch button.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Pogrubienie tekstu poprawiające czytelność w obu trybach (jasnym i ciemnym) */
body,
#modal-description {
  font-weight: 500;
}

.hero p,
.element-latin,
.element-note,
.filter-btn {
  font-weight: 600;
}

/* Nagłówek główny */
.hero {
  text-align: left;
  margin-bottom: 1.5rem; /* ZMNIEJSZONY odstęp pod nagłówkiem (było 3rem) */
  border-left: 4px solid var(--accent);
  padding-left: 1.5rem;
}

.hero h1 {
  font-size: 2.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.2rem; /* Zmniejszony odstęp pod tytułem */
  line-height: 1.2;
}

.hero p {
  color: var(--text-muted);
  margin-bottom: 0.4rem; /* Zmniejszony odstęp pod opisem */
}

.supervisor {
  display: block; /* Wymusza nową linię */
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
}

/* Nawigacja kategorii */
.filter-nav {
  display: flex;
  justify-content: center; /* WYŚRODKOWANIE */
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-btn {
  padding: 0.6rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text-main);
}

.filter-btn.active {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2) inset;
}

/* Siatka elementów */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* --- Karta (Militarny interfejs HUD - bez ściętego rogu) --- */
.item-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  padding: 1rem;
  position: relative;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  /* Usunięto clip-path, rogi są teraz standardowe */
  border-radius: var(
    --radius
  ); /* Dodano delikatne zaokrąglenie dla spójności */
}

.item-card:hover {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.03);
  transform: translateY(-4px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

/* Animowane celowniki w rogach (Top-Left i Bottom-Right) */
.item-card::before,
.item-card::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  z-index: 2;
}

.item-card::before {
  top: 0;
  left: 0;
}

.item-card::after {
  bottom: 0;
  right: 0;
}

.item-card:hover::before {
  border-top-color: var(--accent);
  border-left-color: var(--accent);
  width: 20px;
  height: 20px;
}

/* Symbol chemiczny / Tag technologii */
.element-symbol {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(15, 20, 25, 0.85);
  border-left: 3px solid var(--accent);
  color: var(--accent);
  padding: 0.2rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: bold;
  backdrop-filter: blur(3px);
  z-index: 10;
}

/* Zmień ten fragment w style.css: */
.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  filter: none; /* <--- TUTAJ: zmień z grayscale(100%) contrast(120%) na none */
  transition: all 0.4s;
}

.item-card:hover .image-wrapper img {
  filter: grayscale(0%) contrast(100%);
  opacity: 1;
  transform: scale(1.05);
}

.item-card:hover .image-wrapper img {
  filter: grayscale(0%) contrast(100%);
  opacity: 1;
  transform: scale(1.05);
}

/* Typografia w karcie */
.element-name {
  font-weight: 600;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}

.element-latin {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.element-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  border-top: 1px solid rgba(173, 181, 189, 0.2);
  padding-top: 0.6rem;
  margin-top: 0.6rem;
}

/* ========== MODAL (Militarny HUD) ========== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 14, 18, 0.92);
  backdrop-filter: blur(8px);
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-box {
  background: var(--surface);
  border: 2px solid var(--accent);
  max-width: 1050px;
  width: 92%;
  margin: 4vh auto;
  padding: 0;
  max-height: 92vh;
  display: flex;
  gap: 0;
  position: relative;
  border-radius: var(--radius);
  box-shadow:
    0 0 40px rgba(16, 185, 129, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.4);
}

/* Specyficzne style dla modalu literatury */
.literature-box {
  display: block; /* Zmiana z flex na block dla układu pionowego */
  padding: 3rem;
  max-width: 800px;
}

.literature-content h2 {
  color: var(--accent);
  font-family: var(--font-mono);
  border-bottom: 2px solid var(--accent);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
}

/* Celownik HUD — lewy górny róg modalu */
.modal-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 30px;
  height: 30px;
  border-top: 3px solid var(--accent);
  border-left: 3px solid var(--accent);
  z-index: 5;
  pointer-events: none;
}

/* Celownik HUD — prawy górny róg modalu */
.modal-box::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 30px;
  border-top: 3px solid var(--accent);
  border-right: 3px solid var(--accent);
  z-index: 5;
  pointer-events: none;
}

/* Lewa kolumna — zdjęcie */
.modal-left {
  flex: 1;
  display: flex;
  align-items: stretch;
  background: #0a0e12;
  min-height: 300px;
}

#modal-img {
  width: 100%;
  max-height: 84vh;
  object-fit: contain;
  background: #0a0e12;
  display: block;
}

/* Prawa kolumna — tekst */
.modal-right {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 2rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color);
}

#modal-caption {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  color: var(--accent);
  text-transform: uppercase;
  font-weight: bold;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 2px solid var(--accent);
  letter-spacing: 1px;
  line-height: 1.3;
  position: relative;
}

#modal-description {
  color: var(--text-main);
  line-height: 1.7;
  font-size: 0.95rem;
  text-align: left;
  flex: 1;
}

#modal-description p {
  margin-bottom: 0.8rem;
  line-height: 1.5;
  border-bottom: 1px solid rgba(173, 181, 189, 0.1);
  padding-bottom: 0.5rem;
}

#modal-description strong {
  color: var(--accent);
  font-family: var(--font-mono);
  margin-right: 0.5rem;
}

/* Przycisk zamknięcia — styl HUD */
.close-modal {
  position: absolute;
  top: 12px;
  right: 40px;
  color: var(--accent);
  font-size: 2.2rem;
  font-weight: bold;
  cursor: pointer;
  font-family: var(--font-mono);
  z-index: 1001;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  transition: all 0.2s;
  background: transparent;
}

.close-modal:hover {
  color: var(--text-main);
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.1);
}

/* Scrollbar w prawej kolumnie — styl militarny */
.modal-right::-webkit-scrollbar {
  width: 6px;
}

.modal-right::-webkit-scrollbar-track {
  background: transparent;
}

.modal-right::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 0;
}

/* Responsywność - Optymalizacja mobilna */
@media (max-width: 768px) {
  .top-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between; /* Rozkłada elementy równo od krawędzi do krawędzi */
    align-items: center;
    gap: 4px; /* Minimalny odstęp bezpieczeństwa */
    padding: 10px 0;
    margin-bottom: 10px !important; /* Zmniejszenie odstępu pod paskiem */
    padding-bottom: 10px !important; /* Zmniejszenie wewnętrznego odstępu paska */
    border-bottom: none !important;
  }

  .top-bar-actions {
    display: flex;
    gap: 4px; /* Zmniejszony odstęp między przyciskami akcji */
  }

  /* Usunięcie zbędnych marginesów, które wypychają elementy */
  .lang-switch {
    margin: 0;
  }

  /* Opcjonalne: Sprawienie, by przyciski zajmowały tylko tyle miejsca, ile potrzebują */
  .badge,
  #theme-toggle,
  .fab-help,
  .lang-switch button {
    padding: 8px 6px; /* <-- 12px to wysokość (góra/dół), 6px to szerokość (boki) */
    flex-shrink: 1;
  }

  /* 2. Wyśrodkowanie nagłówka i zmiana akcentu na górny */
  .hero {
    border-left: none;
    border-top: 4px solid var(--accent);
    padding-left: 0;
    padding-top: 1rem;
    text-align: center;
  }

  /* 3. Przyciski kategorii na pełną szerokość */
  .filter-nav {
    flex-direction: column;
    gap: 0.5rem;
  }

  .filter-btn {
    width: 100%;
  }

  /* 4. Istniejące poprawki modalu (HUD) */
  .modal-box {
    flex-direction: column;
    overflow-y: auto;
    max-height: 95vh;
    clip-path: none;
  }

  .modal-left {
    min-height: 200px;
  }

  #modal-img {
    max-height: 40vh;
    object-fit: cover; /* Zapobiega zgniataniu obrazu */
  }

  .modal-right {
    overflow-y: visible;
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
  }

  .close-modal {
    right: 10px;
    top: 10px;
    background: rgba(10, 14, 18, 0.95) !important; /* Ciemne, stałe tło */
    border: 1px solid var(--accent) !important; /* Wyraźna ramka */
    border-radius: var(--radius); /* Spójne zaokrąglenie */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6); /* Mocny cień odcinający od tła */
  }
}
.modal-details-grid {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-main);
}

.modal-details-grid section {
  margin-bottom: 20px;
}

.modal-details-grid h3 {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.modal-details-grid p {
  line-height: 1.5;
  white-space: pre-wrap;
}

.modal-details-grid ul {
  list-style: none;
  padding-left: 0;
}

.modal-details-grid li {
  margin-bottom: 6px;
  position: relative;
  padding-left: 14px;
  line-height: 1.4;
}

.modal-details-grid li::before {
  content: "■";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.6rem;
  top: 5px;
}
.literature-scroll {
  max-height: 55vh;
  overflow-y: auto;
  text-align: left;
  font-size: 0.8rem;
  padding-right: 10px;
}

.literature-scroll details {
  margin-bottom: 0.5rem;
  background: var(--surface);
  padding: 0.5rem;
  border-radius: var(--radius);
}

.literature-scroll summary {
  font-weight: bold;
  cursor: pointer;
  color: var(--accent);
}

.literature-scroll ul {
  margin-top: 0.5rem;
  padding-left: 1.5rem;
  word-break: break-all;
}

.literature-scroll li {
  margin-bottom: 0.25rem;
}
.literature-access-info {
  margin-top: 1.5rem;
  padding-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border-color);
}
.literature-scroll a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

.literature-scroll a:hover {
  text-decoration: underline;
  opacity: 0.8;
}

.literature-access-info {
  margin-top: 1.5rem;
  padding-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border-color);
}
.main-footer {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border-top: 2px solid var(--accent);
  padding: 1rem 0.5rem 0.5rem; /* Znacznie mniejszy padding */
  margin-top: 2rem;
  color: var(--text-main);
  text-align: center;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem; /* Zredukowany odstęp między logo a tekstem */
}
/* 1. Kontener bez żadnych filtrów */
.footer-logos {
  display: inline-flex;
  justify-content: center;
  background: transparent;
  padding: 0;
}

.footer-logo {
  height: 70px;
  width: auto;
  display: block;
  transition: filter 0.3s ease;
}

/* [data-theme="dark"] .footer-logo {
    filter: invert(1);
} */

.footer-project-desc {
  font-size: 0.75rem; /* Mniejszy opis */
  color: var(--text-muted);
  line-height: 1.3;
  margin: 0;
}

.footer-bottom {
  margin-top: 0.75rem; /* Bliżej tekstu głównego */
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.7rem; /* Zmniejszona czcionka praw autorskich */
  color: var(--text-muted);
}
