/* Reset i wspolne przeliczanie rozmiarow */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Fonty uzywane w naglowkach i mocniejszych akcentach */
@font-face {
  font-family: 'TimesBD';
  src: url('timesbd.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: 'TimesBI';
  src: url('timesbi.ttf') format('truetype');
  font-weight: bold;
  font-style: italic;
}

/* Kolory i glowne zmienne dla calej strony hasla */
:root {
  --paper: #f4e6bf;
  --paper-soft: rgba(255, 248, 227, 0.9);
  --ink: #342217;
  --accent: #6f3b11;
  --accent-soft: #9f6230;
  --line: rgba(111, 59, 17, 0.25);
  --shadow: 0 18px 40px rgba(54, 28, 11, 0.18);
}

/* Tlo strony i podstawowe elementy tekstowe */
html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Georgia', 'Times New Roman', serif;
  background-image: url('Tło.webp');
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: center;
  color: var(--ink);
}

a {
  text-decoration: none;
  color: inherit;
}

h1,
h2,
p {
  margin: 0;
}

/* Linki umieszczone w polach tresci, np. w pochodzeniu i znaczeniu */
#pochodzenie a,
#znaczenie a,
.source a {
  color: blue !important;
  text-decoration: underline !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}

#pochodzenie a {
  display: inline !important;
  white-space: nowrap;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

/* Zewnetrzna ramka calego hasla Stronga */
.container {
  width: min(760px, calc(100% - 24px));
  margin: 24px auto;
  border: 10px double var(--accent);
  background:
    linear-gradient(180deg, rgba(255, 251, 239, 0.78), rgba(244, 230, 191, 0.96)),
    var(--paper);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}

.container::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(111, 59, 17, 0.18);
  pointer-events: none;
}

/* Stopka pod glowna ramka strony, dodawana na koncu przez JS */
.page-footer {
  width: min(760px, calc(100% - 24px));
  margin: auto auto 24px;
  padding: 10px 12px 0;
  text-align: center;
  color: #5d493d;
  font-size: 0.95rem;
}

/* Naglowek z linkiem do strony glownej */
.header {
  background:
    linear-gradient(180deg, rgba(255, 250, 235, 0.92), rgba(233, 206, 149, 0.82));
  border-bottom: 4px double var(--accent);
  padding: 16px 18px 12px;
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  position: relative;
  z-index: 1;
}

.header a {
  font-family: 'TimesBD', 'Times New Roman', 'Georgia', 'Garamond', serif;
  text-decoration: underline;
  color: #234b73;
  white-space: nowrap;
  display: inline-block;
  font-size: clamp(1rem, 5vw, 2rem);
  text-underline-offset: 4px;
}

.greek-header {
  font-family: 'Cardo', serif;
  letter-spacing: 1px;
  font-size: 32px;
  text-transform: uppercase;
  color: #4a3b2c;
}

/* Pasek pod naglowkiem z numerem Stronga i podpisem slownika */
.subheader {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: rgba(255, 249, 232, 0.85);
  border-bottom: 1px solid rgba(111, 59, 17, 0.25);
  padding: 12px 18px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  margin: 0;
  position: relative;
  z-index: 1;
}

.subheader div {
  max-width: 100%;
  overflow-x: hidden;
}

.strong-dictionary-note {
  display: block;
  margin-top: 10px;
  font-size: 0.8rem;
  line-height: 1.35;
}

.link-stronga {
  color: #234b73;
  text-decoration: underline;
  font-style: italic;
  font-weight: bold;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  display: inline;
}

/* Obszar glowny strony */
.content {
  padding: 24px;
  font-size: 16px;
  position: relative;
  z-index: 1;
}

/* Wspolne etykiety i pola danych */
.section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label {
  font-family: 'TimesBD', 'Times New Roman', serif;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.value {
  background: var(--paper-soft);
  padding: 10px 14px;
  border: 1px solid var(--line);
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.value-rounded {
  border-radius: 14px;
  border: 1px solid rgba(111, 59, 17, 0.35);
}

.value-block {
  flex-direction: column;
  align-items: flex-start;
  white-space: normal;
  line-height: 1.75;
}

.plain-text-block {
  white-space: pre-line;
}

#pochodzenie,
#znaczenie {
  display: block !important;
  line-height: 1.5;
}

.italic {
  font-style: italic;
}

.bold {
  font-family: 'TimesBD', 'Times New Roman', serif;
  font-size: 1rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 18px 0 8px;
}

.definition {
  margin: 18px 0;
}

.source {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: #5d493d;
}

/* Przycisk glosnika przy transliteracji */
button {
  margin-left: 12px;
  cursor: pointer;
  background: linear-gradient(180deg, #f3cf83, #d79a36);
  border: 1px solid rgba(111, 59, 17, 0.45);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(111, 59, 17, 0.18);
}

button:hover {
  background: linear-gradient(180deg, #f6da9d, #e1a847);
}

/* Glowna karta z forma grecka i boczny panel z metadanymi */
.entry-hero {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-main,
.hero-side {
  background: rgba(255, 248, 227, 0.72);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  position: relative;
}

.hero-main::after,
.hero-side::after,
.definition .value::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(111, 59, 17, 0.12);
  border-radius: 12px;
  pointer-events: none;
}

.entry-kicker {
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: 8px;
}

/* Kontener z sama forma grecka */
.entry-wordline {
  margin-bottom: 12px;
}

.entry-word {
  display: block;
  width: 100%;
  font-family: 'TimesBD', 'Times New Roman', serif;
  font-size: clamp(1.15rem, 3.2vw, 2.4rem);
  line-height: 1;
  color: #2c1c11;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.entry-transliteration {
  font-size: 1.18rem;
  margin-bottom: 14px;
}

.entry-transliteration strong {
  font-family: 'TimesBD', 'Times New Roman', serif;
  letter-spacing: 0.04em;
}

.hero-side .section + .section {
  margin-top: 14px;
}

.definition .value {
  position: relative;
  padding: 18px 18px 14px 24px;
}

/* Informacja nad blokiem LXX o autorach opracowania */
.occurrence-note {
  margin: 18px 0 10px;
  padding: 12px 16px;
  border: 1px solid rgba(111, 59, 17, 0.18);
  border-radius: 10px;
  background: rgba(255, 248, 227, 0.58);
  color: #5e3513;
  font-size: 0.94rem;
  line-height: 1.5;
}

.occurrence-note strong {
  display: block;
  margin-bottom: 2px;
  font-family: 'TimesBD', 'Times New Roman', serif;
  font-size: 1rem;
}

/* Pasek naglowka dla sekcji wystapien i kontrolek wyszukiwania */
.occurrence-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 8px;
}

.occurrence-heading-row .bold {
  margin: 0;
}

.occurrence-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 360px;
}

.occurrence-book-select {
  min-width: 190px;
  max-width: 46%;
  padding: 7px 12px;
  border: 1px solid rgba(111, 59, 17, 0.3);
  border-radius: 999px;
  background: #fff7df;
  color: #3a2415;
  font-family: 'TimesBD', 'Times New Roman', serif;
  font-size: 0.95rem;
}

.occurrence-book-select:disabled {
  opacity: 0.65;
}

.occurrence-search {
  min-width: 150px;
  max-width: 220px;
  padding: 7px 12px;
  border: 1px solid rgba(111, 59, 17, 0.3);
  border-radius: 999px;
  background: #fffdf6;
  color: #3a2415;
  font-family: 'Times New Roman', serif;
  font-size: 0.95rem;
}

.occurrence-search::placeholder {
  color: rgba(58, 36, 21, 0.62);
}

/* Glowne okna z wystapieniami LXX i NT */
.occurrence-list {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  max-height: min(64vh, 680px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px !important;
  background: rgba(255, 253, 246, 0.96);
  line-height: 1.35;
}

/* Stan po przebudowie listy przez JavaScript */
.occurrence-list.is-grouped {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 14px;
}

/* Blok pojedynczej ksiegi generowany przez JS */
.occurrence-group {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(111, 59, 17, 0.22);
  border-radius: 10px;
  background: rgba(255, 248, 227, 0.72);
  padding: 12px;
  scroll-margin-top: 14px;
}

.occurrence-group-title {
  margin: 0 0 8px;
  color: #6f3b11;
  font-family: 'TimesBD', 'Times New Roman', serif;
  font-size: 1.08rem;
}

/* Blok rozdzialu i kontener wersetow w ramach ksiegi */
.occurrence-chapter {
  padding: 8px 0 10px;
  border-top: 1px solid rgba(111, 59, 17, 0.14);
}

.occurrence-group-title + .occurrence-chapter {
  border-top: 0;
  padding-top: 0;
}

.occurrence-chapter-title {
  margin: 0 0 7px;
  color: #7b4a1c;
  font-family: 'TimesBD', 'Times New Roman', serif;
  font-size: 0.92rem;
}

.occurrence-verses {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  gap: 6px;
}

/* Pojedynczy werset jako "chip" */
.occurrence-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.15rem;
  min-height: 2.15rem;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid rgba(111, 59, 17, 0.2);
  border-radius: 999px;
  background: #fff7df;
  color: #2f2016;
  font-family: 'TimesBD', 'Times New Roman', serif;
  font-size: 0.98rem;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

/* Klasy stanowe zakladane i zdejmowane przez JS */
.occurrence-group.is-hidden,
.occurrence-chapter.is-hidden,
.occurrence-chip.is-hidden {
  display: none;
}

.occurrence-group.is-targeted {
  outline: 2px solid rgba(111, 59, 17, 0.32);
  background: rgba(255, 244, 205, 0.9);
}

.occurrence-group.is-selected {
  border-color: rgba(111, 59, 17, 0.56);
  box-shadow: inset 5px 0 0 rgba(111, 59, 17, 0.42), 0 8px 18px rgba(54, 28, 11, 0.12);
  background: rgba(255, 244, 205, 0.95);
}

/* Zachowanie na waskich ekranach */
@media screen and (max-width: 600px) {
  .container {
    margin: 10px auto;
  }

  .header {
    font-size: clamp(1rem, 5vw, 2rem);
    white-space: normal;
    text-align: center;
  }

  .header a {
    font-size: clamp(1rem, 5vw, 2rem);
  }

  .content {
    padding: 18px 16px;
  }

  .subheader {
    padding: 10px 14px;
  }

  .entry-hero {
    grid-template-columns: 1fr;
  }

  .occurrence-heading-row {
    align-items: stretch;
    flex-direction: column;
  }

  .occurrence-controls {
    align-items: stretch;
    flex-direction: column;
    min-width: 0;
  }

  .occurrence-book-select,
  .occurrence-search {
    max-width: 100%;
    width: 100%;
  }
}
