/* ============================================================
   BIBLIOTEKA PF SOMBOR — Zajednički stilovi
   ============================================================ */

/* Varijable */
:root {
  --navy:       #0a2140;
  --navy-mid:   #0f2d55;
  --navy-light: #1a4070;
  --blue-bg:    #eef2f7;
  --blue-bg2:   #dce6f0;
  --gold:       #b8912a;
  --gold-light: #d4a843;
  --gold-text:  #8a6a1a; /* tamnija zlatna — dovoljan kontrast za tekst na svetlim pozadinama */
  --border:     #6a90b8;
  --border-light: #b8cde0;
  --text-dark:  #0a2140;
  --text-mid:   #2a4a6a;
  --shadow:     rgba(10,33,64,0.15);

  /* Tipografska skala */
  --fs-label: 1.05rem;   /* sitni uppercase natpisi sekcija */
  --fs-body:  1.26rem;   /* osnovni tekst */
}

/* Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--blue-bg);
  color: var(--text-dark);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: var(--fs-body);
  line-height: 1.8;
}

/* Vidljiv fokus za navigaciju tastaturom */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

/* Ornament bar */
.ornament-bar {
  background: linear-gradient(90deg, var(--navy), var(--navy-light), var(--navy));
  height: 5px;
}

/* ── NAV ── */
nav {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 2px 16px rgba(10,33,64,0.4);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 72px;
}
.nav-logo {
  color: var(--gold-light);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  font-family: 'IM Fell English', serif;
}
.nav-logo img { height: 38px; width: auto; display: block; }
.nav-logo-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
  margin-top: 2px;
}
.nav-logo-text span { font-size: 0.62rem; letter-spacing: 0.05em; }
.nav-links { display: flex; gap: 2.5rem; list-style: none; align-items: center; }
.nav-links a {
  color: #ffffff;
  text-decoration: none;
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 300;
  transition: color 0.2s;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0; right: 0;
  height: 1px;
  background: var(--gold-light);
  transform: scaleX(0);
  transition: transform 0.25s;
}
.nav-links a:hover { color: var(--gold-light); }
.nav-links a:hover::after { transform: scaleX(1); }

.lang-switch {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--gold);
  color: var(--gold-light) !important;
  font-size: 0.85rem !important;
  letter-spacing: 0.08em;
  border-radius: 2px;
  transition: background 0.2s, color 0.2s !important;
}
.lang-switch:hover { background: var(--gold); color: var(--navy) !important; }
.lang-switch::after { display: none !important; }
.lang-active { background: var(--gold); color: var(--navy) !important; cursor: default; }

/* ── DROPDOWN ── */
.has-dropdown { position: relative; }
.nav-dropdown { display: none; position: absolute; top: 100%; left: 0; background: var(--navy); border-top: 2px solid var(--gold); min-width: 210px; box-shadow: 0 8px 24px rgba(10,33,64,0.4); z-index: 200; list-style: none; padding: 0; }
.has-dropdown:hover .nav-dropdown { display: block; }
@media (min-width: 901px) {
  /* Otvaranje padajućeg menija i tastaturom (Tab) */
  .has-dropdown:focus-within .nav-dropdown { display: block; }
}
.nav-dropdown li a { display: block; padding: 0.65rem 1.3rem; font-size: 0.88rem; letter-spacing: 0.08em; border-bottom: 1px solid rgba(212,168,67,0.15); white-space: nowrap; position: relative; }
.nav-dropdown li:last-child a { border-bottom: none; }
.nav-dropdown a::after { display: none !important; }

/* ── HAMBURGER ── */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 300;
}
.nav-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--gold-light);
  transition: transform 0.3s, opacity 0.3s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── PAGE HERO (podstranice) ── */
.page-hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 55%, var(--navy-light) 100%);
  padding: 5rem 2rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(212,168,67,0.07) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}
.corner { position: absolute; width: 60px; height: 60px; }
.corner.tl { top: 2rem; left: 2rem; border-top: 2px solid var(--gold); border-left: 2px solid var(--gold); }
.corner.br { bottom: 2rem; right: 2rem; border-bottom: 2px solid var(--gold); border-right: 2px solid var(--gold); }

.page-hero .hero-label {
  font-size: var(--fs-label);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 0.8rem;
  font-style: italic;
  font-weight: 300;
  opacity: 0; animation: fadeUp 1s 0.3s forwards;
}
.page-hero h1 {
  font-family: 'IM Fell English', serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: #ffffff;
  max-width: 820px;
  margin: 0 auto 1.2rem;
  line-height: 1.2;
  opacity: 0; animation: fadeUp 1s 0.5s forwards;
}
.page-hero .hero-sub {
  color: #b8cde0;
  font-size: 1.1rem;
  font-style: italic;
  max-width: 600px;
  margin: 0 auto;
  opacity: 0; animation: fadeUp 1s 0.7s forwards;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3.5rem;
  margin-top: 2.5rem;
  opacity: 0; animation: fadeUp 1s 0.9s forwards;
}
.stat { text-align: center; animation: stampThud 0.18s ease-out both; }
.stat-number {
  font-family: 'IM Fell English', serif; font-size: 2rem; color: var(--gold-light);
  display: inline-block; position: relative; padding-bottom: 0.2em;
  opacity: 0;
  animation: stampIn 0.9s cubic-bezier(.22,1,.36,1) forwards;
}
.stat-number::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--gold); transform: scaleX(0); transform-origin: center;
  animation: lineGrow 0.5s ease-out forwards;
}
/* Pečat pada (stampIn), stranica oseti udar (stampThud), pa se povuče linija */
.stat:nth-child(1)                       { animation-delay: 1.25s; }
.stat:nth-child(1) .stat-number          { animation-delay: 0.9s; }
.stat:nth-child(1) .stat-number::after   { animation-delay: 1.35s; }
.stat:nth-child(2)                       { animation-delay: 1.55s; }
.stat:nth-child(2) .stat-number          { animation-delay: 1.2s; }
.stat:nth-child(2) .stat-number::after   { animation-delay: 1.65s; }
.stat:nth-child(3)                       { animation-delay: 1.85s; }
.stat:nth-child(3) .stat-number          { animation-delay: 1.5s; }
.stat:nth-child(3) .stat-number::after   { animation-delay: 1.95s; }
.stat:nth-child(4)                       { animation-delay: 2.15s; }
.stat:nth-child(4) .stat-number          { animation-delay: 1.8s; }
.stat:nth-child(4) .stat-number::after   { animation-delay: 2.25s; }
.stat-label { font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: #8fb8d4; }

@keyframes stampIn {
  0%   { opacity: 0; transform: scale(5) rotate(6deg);    filter: blur(12px); }
  35%  { opacity: 0.4; transform: scale(2.2) rotate(3deg); filter: blur(5px); }
  60%  { opacity: 1; transform: scale(0.92) rotate(-2.5deg); filter: blur(0); }
  78%  { opacity: 1; transform: scale(1.06) rotate(-0.5deg); }
  100% { opacity: 0.93; transform: scale(1) rotate(-1.5deg); filter: blur(0); }
}
@keyframes stampThud {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(4px); }
}
@keyframes lineGrow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ── ZAJEDNIČKI ELEMENTI SEKCIJA ── */
.section-label {
  font-size: var(--fs-label);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin-bottom: 0.4rem;
}

/* Kartica-link (cela kartica je <a>) */
a.info-card { text-decoration: none; color: inherit; display: block; }
.card-cta {
  margin-top: 0.8rem;
  font-size: 0.92rem;
  color: var(--gold-text);
  letter-spacing: 0.05em;
}

/* Zlatno dugme */
.btn-gold {
  display: inline-block;
  background: var(--navy);
  color: white;
  font-family: 'IM Fell English', serif;
  font-size: 1.05rem;
  padding: 0.85rem 2.2rem;
  text-decoration: none;
  border: 1px solid var(--gold);
  letter-spacing: 0.05em;
  transition: background 0.2s;
}
.btn-gold:hover { background: var(--navy-light); }
.section-title {
  font-family: 'IM Fell English', serif;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  color: var(--navy);
  margin-bottom: 0.5rem;
}
.section-rule {
  width: 0;
  height: 2px;
  background: var(--gold);
  margin-bottom: 2rem;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1) 0.2s;
}
.section-rule.rule-on { width: 60px; }

/* ── LIGHTBOX ── */
.lb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5,14,26,0.93);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 1.5rem;
}
.lb-overlay.active { display: flex; }
.lb-img-wrap { max-width: 90vw; max-height: 82vh; display: flex; align-items: center; justify-content: center; }
.lb-img-wrap img {
  max-width: 100%; max-height: 82vh; object-fit: contain;
  box-shadow: 0 8px 48px rgba(0,0,0,0.7);
  border: 1px solid rgba(184,145,42,0.3);
}
.lb-caption {
  color: #c8dff0; font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem; font-style: italic;
  text-align: center; margin-top: 1rem;
  max-width: 640px; letter-spacing: 0.03em;
}
.lb-close {
  position: fixed; top: 1.2rem; right: 1.5rem;
  color: var(--gold-light); font-size: 2.2rem;
  cursor: pointer; background: none; border: none;
  line-height: 1; transition: color 0.2s; font-family: serif;
}
.lb-close:hover { color: white; }
.lb-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  background: rgba(10,33,64,0.7); border: 1px solid rgba(184,145,42,0.4);
  color: var(--gold-light); font-size: 1.8rem;
  width: 48px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s, color 0.2s; user-select: none;
}
.lb-nav:hover { background: rgba(184,145,42,0.2); color: white; }
.lb-prev { left: 0.5rem; }
.lb-next { right: 0.5rem; }

/* ── SCROLL REVEAL ── */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.revealed { opacity: 1; transform: translateY(0); }

/* ── ANIMACIJE ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── FOOTER ── */
footer {
  background: #050e1a;
  color: #7a9ab8;
  text-align: center;
  padding: 2rem;
  font-size: 0.85rem;
  border-top: 2px solid var(--navy-light);
}
footer a { color: var(--gold); text-decoration: none; }
footer a:hover { color: var(--gold-light); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  body { font-size: 17px; }
  .nav-inner { padding: 0 1rem; position: relative; }
  .nav-toggle { display: flex !important; }
  .nav-links {
    display: none !important;
    flex-direction: column;
    position: absolute;
    top: 72px;
    left: 0; right: 0;
    background: var(--navy);
    border-top: 2px solid var(--gold);
    padding: 0.5rem 0 1rem;
    gap: 0;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(10,33,64,0.5);
    max-height: calc(100vh - 72px);
    overflow-y: auto;
  }
  .nav-links.open { display: flex !important; }
  .nav-links li { width: 100%; }
  .nav-links > li > a {
    display: block;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(212,168,67,0.1);
  }
  .nav-links a::after { display: none; }
  .has-dropdown:hover .nav-dropdown { display: none; }
  .has-dropdown.open .nav-dropdown {
    display: block;
    position: static;
    box-shadow: none;
    border-top: none;
    border-left: 3px solid var(--gold);
    margin-left: 1.5rem;
    min-width: unset;
  }
  .nav-dropdown li a { font-size: 0.9rem; padding: 0.6rem 1rem; }
  .corner { display: none; }
  .hero-stats { gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
  .lb-nav { width: 36px; height: 52px; font-size: 1.4rem; }
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .page-hero .hero-label,
  .page-hero h1,
  .page-hero .hero-sub,
  .hero-stats,
  .stat,
  .stat-number {
    animation: none !important;
    opacity: 1 !important;
  }
  .stat-number {
    transform: none !important;
  }
  .stat-number::after {
    animation: none !important;
    transform: scaleX(1) !important;
  }
  .reveal {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .section-rule {
    transition: none !important;
    width: 60px !important;
  }
}
