/* =========================================================
   TANDARA — BRANCH PAGE

   Zajednički izgled svih glavnih rodoslovnih grana.

   OVA DATOTEKA SADRŽI:
   - glavni sadržaj grane
   - karticu grane
   - naslove
   - tekst
   - obiteljske šifre
   - prikaz privatnosti
   - lokot za zaštićene obiteljske podatke
   - modalni dijalog za zaštićene obiteljske podatke
   - fotografije osoba
   - zajednički photo lightbox
   - donji okvir interaktivnog dijagrama
   - donji okvir napomene
   - zajedničke poveznice grane

   OVA DATOTEKA NE SADRŽI:
   - site shell
   - početno stablo
   - hotspotove
   - logiku dijagrama
   - tražilicu
   - print
   - autorizaciju privatnog arhiva
   - posebne zakrpe za pojedine grane
   ========================================================= */


/* =========================================================
   OSNOVNE VRIJEDNOSTI
   ========================================================= */

:root {
  --branch-page-background: #e7c191;
  --branch-card-background: #f5e6c8;
  --branch-text: #3f3327;
  --branch-heading: #49341f;
  --branch-accent: #8b642f;
  --branch-accent-light: #c9a46d;
  --branch-border: rgba(91, 65, 35, 0.28);
  --branch-code-background: rgba(255, 255, 255, 0.28);
  --branch-link: #69451f;
  --branch-max-width: 1050px;
  --branch-font: Georgia, "Times New Roman", serif;

  --branch-photo-height: 75px;
  --branch-photo-gap: 35px;
  --branch-photo-caption: #67533e;
  --branch-lightbox-background: rgba(22, 16, 10, 0.94);

  --branch-dialog-background: #fffaf0;
  --branch-dialog-border: #9b7745;
  --branch-dialog-heading: #6b3d1f;
  --branch-dialog-button: #6b4b25;
  --branch-dialog-warning: #9b3428;
  --branch-dialog-warning-background: #fff0ec;
  --branch-dialog-focus: #d4af37;
  --branch-dialog-backdrop: rgba(25, 18, 11, 0.72);
}


/* =========================================================
   GLAVNI SADRŽAJ
   ========================================================= */

.branch-content {
  box-sizing: border-box;
  min-width: 0;
  min-height: 100vh;
  padding: 34px 30px 50px;
  background: var(--branch-page-background);
  color: var(--branch-text);
  font-family: var(--branch-font);
}

.branch-content *,
.branch-content *::before,
.branch-content *::after {
  box-sizing: border-box;
}


/* =========================================================
   KARTICA GRANE
   ========================================================= */

.branch-card {
  width: min(100%, var(--branch-max-width));
  margin: 0 auto;
  padding: 34px 42px 44px;
  background: var(--branch-card-background);
  border: 1px solid var(--branch-border);
  border-radius: 14px;
  box-shadow: 0 5px 18px rgba(60, 42, 24, 0.16);
}


/* =========================================================
   GLAVNI NASLOV
   ========================================================= */

.branch-card > h1 {
  margin: 0 0 28px;
  color: var(--branch-heading);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 700;
  line-height: 1.18;
  text-align: center;
}


/* =========================================================
   ZAŠTIĆENI OBITELJSKI PODACI
   GUMB S LOKOTOM ISPOD GLAVNOG NASLOVA
   ========================================================= */

.protected-access-notice {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: -12px 0 24px;
  text-align: center;
}

.protected-family-data-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  background: var(--branch-dialog-background);
  border: 1px solid var(--branch-dialog-border);
  border-radius: 999px;
  color: var(--branch-dialog-heading);
  box-shadow: 0 2px 8px rgba(55, 45, 25, 0.12);
  font: 700 15px/1.25 var(--branch-font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.protected-family-data-trigger:hover {
  background: #fff4dd;
  border-color: var(--branch-accent);
  color: var(--branch-dialog-warning);
}

.protected-family-data-trigger:focus-visible {
  outline: 3px solid var(--branch-dialog-focus);
  outline-offset: 3px;
}

.protected-family-data-trigger__lock {
  display: inline-block;
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1;
}


/* =========================================================
   ZAŠTIĆENI OBITELJSKI PODACI
   MODALNI DIJALOG

   Dijalog i njegov sadržaj stvara branch-page-engine.js.
   CSS ovdje određuje samo izgled.
   ========================================================= */

body.branch-protected-dialog-open {
  overflow: hidden;
}

.protected-access-dialog {
  width: min(820px, calc(100% - 32px));
  max-width: 820px;
  max-height: 90vh;
  margin: auto;
  padding: 0;
  background: var(--branch-dialog-background);
  border: 2px solid var(--branch-dialog-border);
  border-radius: 16px;
  color: #342719;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  font-family: var(--branch-font);
}

.protected-access-dialog::backdrop {
  background: var(--branch-dialog-backdrop);
  backdrop-filter: blur(3px);
}

.protected-access-dialog__panel {
  position: relative;
  box-sizing: border-box;
  max-height: 90vh;
  padding: 30px 34px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.protected-access-dialog__close-icon {
  position: absolute;
  top: 12px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  background: var(--branch-dialog-background);
  border: 1px solid var(--branch-dialog-border);
  border-radius: 50%;
  color: #5f421f;
  font: 700 30px/1 Arial, sans-serif;
  cursor: pointer;
}

.protected-access-dialog__close-icon:hover {
  background: #fff4dd;
}

.protected-access-dialog__close-icon:focus-visible {
  outline: 3px solid var(--branch-dialog-focus);
  outline-offset: 2px;
}

.protected-access-dialog__heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  padding-right: 46px;
}

.protected-access-dialog__lock {
  flex: 0 0 auto;
  font-size: 30px;
  line-height: 1;
}

.protected-access-dialog__heading h2 {
  margin: 0;
  color: var(--branch-dialog-heading);
  font-size: clamp(25px, 4vw, 34px);
  font-weight: 700;
  line-height: 1.2;
}

.protected-access-dialog__content {
  color: #342719;
  font-size: 17px;
  line-height: 1.62;
}

.protected-access-dialog__content p {
  margin: 0 0 16px;
}

.protected-access-dialog__content p:last-child {
  margin-bottom: 0;
}

.protected-access-dialog__content ul {
  margin: 0 0 18px;
  padding-left: 26px;
}

.protected-access-dialog__content li {
  margin: 0 0 7px;
}

.protected-access-dialog__content strong {
  color: #352719;
  font-weight: 700;
}

.protected-access-dialog__warning {
  margin: 18px 0;
  padding: 14px 16px;
  background: var(--branch-dialog-warning-background);
  border-left: 5px solid var(--branch-dialog-warning);
  border-radius: 8px;
}

.protected-access-dialog__warning strong {
  color: #6f241d;
}

.protected-access-dialog__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid rgba(107, 61, 31, 0.25);
}

.protected-access-dialog__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 20px;
  border: 1px solid var(--branch-dialog-button);
  border-radius: 999px;
  font: 700 16px/1.25 var(--branch-font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.protected-access-dialog__button--secondary {
  background: var(--branch-dialog-background);
  color: var(--branch-dialog-button);
}

.protected-access-dialog__button--secondary:hover {
  background: #fff4dd;
}

.protected-access-dialog__button--primary {
  background: var(--branch-dialog-button);
  color: #ffffff;
}

.protected-access-dialog__button--primary:visited {
  color: #ffffff;
}

.protected-access-dialog__button--primary:hover {
  background: #4f381c;
  color: #ffffff;
}

.protected-access-dialog__button:focus-visible {
  outline: 3px solid var(--branch-dialog-focus);
  outline-offset: 2px;
}

.protected-access-dialog a {
  color: var(--branch-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.protected-access-dialog a:hover {
  color: #3f2813;
  text-decoration-thickness: 2px;
}

.protected-access-dialog a:focus-visible {
  outline: 3px solid var(--branch-dialog-focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.protected-access-dialog a.protected-access-dialog__button {
  text-decoration: none;
}

.protected-access-dialog a.protected-access-dialog__button--primary {
  color: #ffffff;
}


/* =========================================================
   POČETNA OSOBA GRANE
   ========================================================= */

.branch-root-title {
  margin: 0 0 24px;
  padding: 14px 18px;
  background: rgba(201, 164, 109, 0.19);
  border-left: 5px solid var(--branch-accent);
  border-radius: 6px;
  color: var(--branch-heading);
  font-size: clamp(21px, 2.3vw, 29px);
  font-weight: 700;
  line-height: 1.3;
}


/* =========================================================
   TEKST GRANE
   ========================================================= */

.branch-text-block {
  font-size: 18px;
  line-height: 1.72;
}

.branch-text-block p {
  margin: 0 0 20px;
}

.branch-text-block strong {
  color: #352719;
  font-weight: 700;
}


/* =========================================================
   NASLOVI OSOBA I PODGRANA
   ========================================================= */

.branch-text-block h2,
.branch-text-block h3,
.branch-text-block h4 {
  color: var(--branch-heading);
  font-weight: 700;
}

.branch-text-block h2 {
  margin: 32px 0 14px;
  font-size: 25px;
  line-height: 1.3;
}

.branch-text-block h3 {
  margin: 30px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--branch-border);
  font-size: 22px;
  line-height: 1.35;
}

.branch-text-block h4 {
  margin: 25px 0 10px;
  font-size: 19px;
  line-height: 1.4;
}


/* =========================================================
   OBITELJSKE ŠIFRE

   Separator nije dio HTML sadržaja.
   Svaki sljedeći član dobiva tanku
   vertikalnu crtu preko CSS-a.

   Razmak:
   - 0.75em prije crte
   - 0.75em poslije crte
   ========================================================= */

.family-code-list {
  padding: 13px 15px;
  background: var(--branch-code-background);
  border: 1px solid var(--branch-border);
  border-radius: 7px;
  font-size: 16px;
  line-height: 1.6;
}

.family-code-list > strong:first-child {
  color: var(--branch-heading);
}

.family-code-list > span {
  display: inline;
  white-space: normal;
}

.family-code-list > span + span {
  margin-left: 0.75em;
  padding-left: 0.75em;
  border-left: 1px solid var(--branch-accent-light);
}

.family-code-list span strong {
  color: var(--branch-accent);
  font-weight: 700;
}


/* =========================================================
   PRIVATNOST
   ========================================================= */

.public-privacy-note {
  margin: 0 0 20px;
}


/* =========================================================
   GENERIČKE POVEZNICE
   ========================================================= */

.branch-card a {
  color: var(--branch-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.branch-card a:hover,
.branch-card a:focus-visible {
  color: #3f2813;
  text-decoration-thickness: 2px;
}

.branch-card a:focus-visible {
  outline: 2px solid var(--branch-accent-light);
  outline-offset: 3px;
  border-radius: 3px;
}


/* =========================================================
   GORNJE ZAJEDNIČKE POVEZNICE
   ========================================================= */

#common-branch-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 0;
  margin: 0 0 24px;
}

#common-branch-tools:empty {
  display: none;
}

#common-branch-tools a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 13px;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid var(--branch-border);
  border-radius: 6px;
  color: var(--branch-link);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}

#common-branch-tools a:hover,
#common-branch-tools a:focus-visible {
  background: rgba(201, 164, 109, 0.28);
  border-color: var(--branch-accent-light);
}


/* =========================================================
   GENERIČKE SLIKE GRANE
   ========================================================= */

.branch-main-image,
.branch-person-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 24px auto 0;
  border: 0;
  border-radius: 8px;
}

.branch-person-image {
  width: auto;
}


/* =========================================================
   GENERIČKE FIGURE I OPISI SLIKA
   ========================================================= */

.branch-card figure {
  margin: 26px auto;
  text-align: center;
}

.branch-card figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}

.branch-card figcaption {
  margin-top: 8px;
  color: var(--branch-photo-caption);
  font-size: 14px;
  font-style: italic;
  line-height: 1.4;
  text-align: center;
}


/* =========================================================
   FOTOGRAFIJE OSOBA — STANDARD ZA SVE GRANE

   - visina: 75 px
   - proporcionalna širina
   - početak s lijeve strane
   - jedan red
   - razmak 35 px
   - opis ispod fotografije
   ========================================================= */

.person-photo-gallery {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: var(--branch-photo-gap);
  width: 100%;
  max-width: 100%;
  margin: 18px 0 24px;
  padding: 0 0 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.branch-card .person-photo-gallery figure,
.branch-card figure.person-photo {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  width: max-content;
  max-width: none;
  margin: 0;
  text-align: left;
}

.person-photo a {
  display: block;
  width: max-content;
  max-width: none;
  line-height: 0;
  cursor: zoom-in;
  text-decoration: none;
}

.person-photo a:hover,
.person-photo a:focus-visible {
  text-decoration: none;
}

.branch-card .person-photo img {
  display: block;
  width: auto !important;
  height: var(--branch-photo-height) !important;
  max-width: none;
  max-height: var(--branch-photo-height);
  margin: 0;
  border-radius: 6px;
  object-fit: contain;
}

.branch-card .person-photo figcaption {
  display: block;
  width: 100%;
  margin: 6px 0 0;
  color: var(--branch-photo-caption);
  font-size: 13px;
  font-style: italic;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
}


/* =========================================================
   LIGHTBOX — PUNA / MAKSIMALNA VELIČINA
   ========================================================= */

body.branch-photo-lightbox-open {
  overflow: hidden;
}

.branch-photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--branch-lightbox-background);
}

.branch-photo-lightbox.is-open {
  display: flex;
}

.branch-photo-lightbox__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
}

.branch-photo-lightbox__image {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 110px);
  margin: 0;
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.48);
}

.branch-photo-lightbox__caption {
  max-width: min(900px, calc(100vw - 48px));
  margin: 10px 0 0;
  color: #ffffff;
  font-size: 15px;
  font-style: normal;
  line-height: 1.4;
  text-align: center;
}

.branch-photo-lightbox__close {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 1;
  width: 46px;
  height: 46px;
  padding: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  color: #ffffff;
  font: 400 36px/40px Arial, sans-serif;
  text-align: center;
  cursor: pointer;
}

.branch-photo-lightbox__close:hover,
.branch-photo-lightbox__close:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}


/* =========================================================
   DONJI OKVIR — INTERAKTIVNI DIJAGRAM
   ========================================================= */

.branch-diagram-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin: 30px 0 0;
  padding: 20px 22px;
  background: rgba(255, 255, 255, 0.30);
  border: 1px solid var(--branch-border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(60, 42, 24, 0.10);
}

.branch-diagram-link h2 {
  margin: 0 0 7px;
  color: var(--branch-heading);
  font-size: 21px;
  line-height: 1.3;
}

.branch-diagram-link p {
  margin: 0;
  color: var(--branch-text);
  font-size: 16px;
  line-height: 1.55;
}

.branch-diagram-link__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 17px;
  background: var(--branch-accent);
  border: 1px solid var(--branch-accent);
  border-radius: 7px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.branch-card .branch-diagram-link__button {
  color: #ffffff;
  text-decoration: none;
}

.branch-card .branch-diagram-link__button:hover,
.branch-card .branch-diagram-link__button:focus-visible {
  background: #6f4d24;
  border-color: #6f4d24;
  color: #ffffff;
  text-decoration: none;
}


/* =========================================================
   DONJI OKVIR — NAPOMENA
   ========================================================= */

.tree-note {
  margin: 18px 0 0;
  padding: 18px 20px;
  background: rgba(201, 164, 109, 0.18);
  border: 1px solid var(--branch-border);
  border-left: 5px solid var(--branch-accent);
  border-radius: 9px;
}

.tree-note h3 {
  margin: 0 0 10px;
  color: var(--branch-heading);
  font-size: 20px;
  line-height: 1.3;
}

.tree-note p {
  margin: 0 0 10px;
  color: var(--branch-text);
  font-size: 16px;
  line-height: 1.58;
}

.tree-note p:last-child {
  margin-bottom: 0;
}

.tree-note strong {
  color: #352719;
  font-weight: 700;
}


/* =========================================================
   GENERIČKA ZAVRŠNA NAPOMENA
   ========================================================= */

.branch-note {
  margin: 24px 0;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.25);
  border-left: 4px solid var(--branch-accent-light);
  border-radius: 5px;
  font-size: 16px;
  line-height: 1.55;
}


/* =========================================================
   FOOTER GRANE
   ========================================================= */

#common-branch-footer {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--branch-border);
}

#common-branch-footer:empty {
  display: none;
}

#common-branch-footer p {
  color: #67533e;
  line-height: 1.5;
}


/* =========================================================
   PODACI I ŠIFRE
   ========================================================= */

[data-person-code],
[data-family-code],
[data-parent-code],
[data-parent-of],
[data-spouse-of] {
  scroll-margin-top: 20px;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

  .branch-content {
    padding: 26px 20px 40px;
  }

  .branch-card {
    padding: 28px 28px 36px;
  }

  .branch-text-block {
    font-size: 17px;
  }

}


/* =========================================================
   MOBITEL
   ========================================================= */

@media (max-width: 600px) {

  .branch-content {
    padding: 16px 10px 28px;
  }

  .branch-card {
    padding: 22px 16px 28px;
    border-radius: 9px;
  }

  .branch-card > h1 {
    margin-bottom: 22px;
  }

  .protected-access-notice {
    margin: -8px 0 20px;
  }

  .protected-family-data-trigger {
    width: 100%;
    max-width: 360px;
    padding: 10px 14px;
    font-size: 14px;
  }

  .protected-access-dialog {
    width: calc(100% - 18px);
    max-height: 94vh;
    border-radius: 12px;
  }

  .protected-access-dialog__panel {
    max-height: 94vh;
    padding: 24px 18px 20px;
  }

  .protected-access-dialog__close-icon {
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    font-size: 27px;
  }

  .protected-access-dialog__heading {
    align-items: flex-start;
    gap: 9px;
    padding-right: 38px;
  }

  .protected-access-dialog__lock {
    font-size: 25px;
  }

  .protected-access-dialog__heading h2 {
    font-size: 24px;
  }

  .protected-access-dialog__content {
    font-size: 16px;
    line-height: 1.55;
  }

  .protected-access-dialog__content ul {
    padding-left: 22px;
  }

  .protected-access-dialog__actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .protected-access-dialog__button {
    width: 100%;
  }

  .branch-root-title {
    padding: 11px 13px;
    border-left-width: 4px;
  }

  .branch-text-block {
    font-size: 16px;
    line-height: 1.65;
  }

  .branch-text-block p {
    margin-bottom: 17px;
  }

  .branch-text-block h3 {
    margin-top: 25px;
    font-size: 20px;
  }

  .family-code-list {
    padding: 11px 12px;
    font-size: 15px;
  }

  #common-branch-tools {
    align-items: stretch;
    flex-direction: column;
  }

  #common-branch-tools a {
    width: 100%;
  }

  .branch-diagram-link {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 17px 16px;
  }

  .branch-diagram-link__button {
    width: 100%;
  }

  .tree-note {
    padding: 16px 15px;
  }

  .person-photo-gallery {
    margin-bottom: 20px;
  }

  .branch-photo-lightbox {
    padding: 16px;
  }

  .branch-photo-lightbox__image {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 100px);
  }

  .branch-photo-lightbox__caption {
    max-width: calc(100vw - 32px);
    font-size: 14px;
  }

  .branch-photo-lightbox__close {
    top: 10px;
    right: 10px;
    width: 42px;
    height: 42px;
    font-size: 32px;
    line-height: 36px;
  }

}
