@import url("https://fonts.googleapis.com/css?family=Inter:400,500,700&subset=cyrillic&display=swap");

:root {
  --accent: #c26c04;
  --accent-light: #f59c2e;
  --brown: #977251;
  --text: #666666;
  --bg: #eacda3;
  --card-shadow: 5px 5px 20px 1px #ececec;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", Arial, sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg) url("../images/ozadje2.webp") top center no-repeat;
  background-size: 100% auto;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-light);
}

.site-wrapper {
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  /* opaque so header/page-title/main/footer's own backgrounds don't blend with the body's */
  background: #fff;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.08);
}

/* Header */
.site-header {
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 36px;
}
.logo {
  height: 60px;
  display: flex;
  align-items: center;
}
.logo img {
  height: 100%;
  width: auto;
}
.main-nav {
  display: flex;
}

/* Site search: pinned to the far right of the header regardless of nav width. */
.site-search {
  display: flex;
  align-items: center;
  margin-left: auto;
  background: #f5f5f5;
  border-radius: 20px;
  padding: 4px 4px 4px 14px;
}
.site-search input {
  border: none;
  background: none;
  outline: none;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  color: var(--text);
  width: 160px;
}
.site-search input::placeholder {
  color: #999;
}
.site-search button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
.site-search button:hover {
  background: var(--accent-light);
}
.menu-tree {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.menu-tree a {
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #616161;
  text-decoration: none;
}
.menu-tree a:hover {
  color: var(--accent);
}
.menu-item {
  position: relative;
}
/* .submenu-level1 is position:fixed (see below), so it no longer cares that .menu-item is
   positioned - it escapes all the way to the viewport regardless of ancestors. This bridges the
   gap between the <li>'s own (short, vertically-centered) box and where the fixed dropdown
   actually starts (right under the full header bar): invisible, same width as the <li>, just
   tall enough to reach the header's bottom edge (~32px - the item's own row is vertically
   centered in the 84px header, see .submenu-level1's comment below), so the mouse never crosses
   unhovered space on its way down into the dropdown, without overshooting far past the header
   into whatever's on the page underneath it. */
.menu-item.has-children::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 34px;
}
/* Top-level items only: Font Awesome angle-down caret (see .menu-caret <i> in helpers.php),
   rotated 180deg into an angle-up while its dropdown is open. */
.menu-caret {
  margin-left: 6px;
  font-size: 12px;
  transition: transform 0.15s ease;
}
.menu-tree > .menu-item.has-children:hover > a > .menu-caret {
  transform: rotate(180deg);
}
.submenu {
  list-style: none;
  margin: 0;
  padding: 0;
}
/* Old-people-friendly sizing: bigger text + taller rows give a larger tap/click target than the
   text box alone would suggest. */
.submenu a {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  white-space: normal;
  padding: 4px 0;
  display: block;
}

/* Level-1 dropdown: mega-menu, full-width to match .site-wrapper and dropped below the whole
   header bar - not a narrow box pinned under the triggering <li>. position:fixed (not absolute)
   so it's anchored to the viewport, not to .menu-item or .site-header - ancestor positioning
   (.menu-item is position:relative again, for the hover bridge above) can't drag it back to a
   per-item box. top:84px matches .site-header's own fixed height (60px logo + 12px*2 padding) -
   update this if that height ever changes. left:50%/transform/width replicate .site-wrapper's own
   max-width:1400px + margin:0 auto centering, since that's the "site wrapper" this should match.
   No height cap - a capped max-height forced CSS multicol to spill overflowing items into extra
   columns past a fixed width instead of growing the existing columns taller, silently clipping
   whole groups of subcategories off-screen. Unconstrained height makes column-fill:balance (the
   default) lay out exactly column-count columns, each exactly as tall as it needs to be - nothing
   is ever dropped, worst case the dropdown just extends below the viewport and the page scrolls
   to it. */
.submenu-level1 {
  display: none;
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1400px, 100vw);
  background: #fff0db;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
  padding: 24px 32px;
  column-gap: 40px;
  z-index: 60;
}
/* Column counts per top-level menu, lifted straight from menu.html's dropdown divs (widths
   dropped now that the box is full-width, not a fixed pixel box per menu). */
.menu-filatelija > .submenu-level1 {
  column-count: 4;
}
.menu-numizmatika > .submenu-level1 {
  column-count: 4;
}
.menu-slovenika > .submenu-level1 {
  column-count: 2;
  /* Fewer than 3 columns: full 1400px width leaves a big empty gap, so halve it. */
  width: min(700px, 100vw);
}
/* Slovenika has exactly 2 groups - pin each to its own column instead of letting the
   multi-column balancer split/mix them (unlike Filatelija/Numizmatika, left alone below). */
.menu-slovenika > .submenu-level1 > .menu-item {
  break-inside: avoid-column;
}
.menu-item.has-children:hover > .submenu-level1 {
  display: block;
}
.submenu-level1 > .menu-item {
  /* not break-inside:avoid-column here - a group + all its children must be free to split across
     columns, otherwise a top-level dropdown with few groups (e.g. Slovenika's 2) can never fill
     more columns than it has groups, no matter what column-count says. */
  margin-bottom: 20px;
}
.submenu-level1 > .menu-item > a {
  font-weight: 700;
  font-size: 23px;
  color: var(--accent);
  margin-bottom: 6px;
}

/* Level-2: always shown alongside its group header, no separate hover needed. */
.submenu-level2 {
  margin: 0;
}
.submenu-level2 li {
  break-inside: avoid-column;
}
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: #616161;
}

/* Hero / page title */
.page-title {
  background:
    linear-gradient(
      90deg,
      rgba(151, 114, 81, 0.75) 0%,
      rgba(234, 205, 163, 0.75) 49%,
      rgba(246, 137, 56, 0.75) 100%
    ),
    url("../images/sliders/slider4.webp") center / cover no-repeat;
  padding: 75px 0;
}
.page-title-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 44px;
}
.page-title h2 {
  font-size: 29px;
  font-weight: bold;
  text-shadow: 2px 2px #1c1c1c;
  color: #fff;
  margin: 0;
}
.page-title h3 {
  font-family: Arial, sans-serif;
  font-size: 20px;
  font-weight: bold;
  text-shadow: 2px 2px #1c1c1c;
  color: #fff;
  margin: 20px 0 0;
}

/* Main */
.site-main {
  flex: 1;
  background: #fff;
}
.content-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 44px 33px;
}

/* Article grid (listing) */
.listing-layout {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}
.listing-main {
  flex: 1;
  min-width: 0;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 992px) {
  .article-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .article-grid {
    grid-template-columns: 1fr;
  }
}

/* Year filter sidebar */
.year-filter {
  flex: 0 0;
  position: sticky;
  top: 84px;
  background: #faf7f2;
  border-radius: 4px;
  padding: 16px;
}
.year-filter h3 {
  margin: 0 0 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--brown);
}
.year-filter ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.year-filter a {
  display: block;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 14px;
  color: var(--text);
}
.year-filter a:hover {
  background: #f0e6d6;
  color: var(--accent);
}
.year-filter a.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
@media (max-width: 768px) {
  .listing-layout {
    flex-direction: column;
  }
  .year-filter {
    flex: 1 1 auto;
    width: 100%;
    position: static;
  }
}

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 36px;
}
.pagination-link {
  display: inline-block;
  min-width: 40px;
  padding: 8px 12px;
  text-align: center;
  background: #fff;
  box-shadow: var(--card-shadow);
  border-radius: 4px;
  color: var(--text);
}
.pagination-link:hover {
  color: var(--accent);
}
.pagination-link.is-current {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.pagination-ellipsis {
  display: inline-block;
  min-width: 40px;
  padding: 8px 4px;
  text-align: center;
  color: var(--text);
}

.contact-note {
  text-align: center;
  margin-top: 36px;
  color: var(--text);
}

.article-card {
  background: #fff;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.article-card-media {
  display: block;
  position: relative;
  overflow: hidden;
  background: #f4f4f4;
  container-type: inline-size;
}

.article-card-media-placeholder-ratio {
  /* No-image cards only - has-image cards get their aspect-ratio inline (index.php, from the
     first slide's known size) instead of this fixed fallback. */
  aspect-ratio: 16 / 10;
}

/* height:auto (not a fixed box) so landscape/square images show at natural size; max-height caps
   only portrait images (which scale taller than wide at 100% width) at the card's own width
   (100cqw), object-fit:contain letterboxing them instead of overflowing tall. */
.article-card-media img {
  width: 100%;
  height: auto;
  max-height: 100cqw;
  object-fit: contain;
  object-position: center;
  margin: 0 auto;
  display: block;
}
/* Multiple images per card: stacked and slid left/right (translateX, set by script.js) on an
   auto-cycling timer - not a cross-fade. */
.card-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transition: transform 0.6s ease;
}
.article-card-media-placeholder {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    #f4ede3,
    #f4ede3 10px,
    #efe3d2 10px,
    #efe3d2 20px
  );
}
.article-card-body {
  padding: 16px;
  font-size: 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.article-card-title {
  font-size: 17px;
  font-weight: bold;
  margin: 0 0 8px;
  line-height: 1.4;
}
.article-card-title a {
  color: #333;
}
.article-card-title a:hover {
  color: var(--accent);
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.category-badge {
  display: inline-block;
  background: #f5f5f5;
  color: #888;
  font-size: 13px;
  padding: 3px 9px;
  border-radius: 3px;
  font-weight: 700;
}
.article-date,
.article-hits {
  font-size: 14px;
  color: #999;
}

.tag-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-list li a {
  display: inline-block;
  background: #f9f0e5;
  color: var(--accent);
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 16px;
}
.tag-list li a:hover {
  background: var(--accent);
  color: #fff;
}

.fields-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  font-size: 14px;
}
.fields-list li {
  padding: 2px 0;
  border-bottom: 1px dashed #eee;
}
.field-label {
  color: #999;
}
.field-value {
  color: #444;
  font-weight: 500;
}

.article-intro {
  font-size: 15px;
  line-height: 1.5;
  flex: 1;
  margin: 0 0 12px;
}

.readmore {
  align-self: flex-start;
  background: #f9f0e5;
  border-radius: 25px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.readmore:hover {
  background: var(--accent);
  color: #fff;
}

/* Article details page */
.article-details {
  max-width: 1400px;
}
.back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 600;
}

.gallery {
  position: relative;
  margin-bottom: 24px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  background: #f4f4f4;
  container-type: inline-size;
}
.gallery-missing {
  border: 2px solid #d92626;
  border-radius: 0;
}
/* Swiper theming for the article detail gallery - nav arrows/pagination recolored to match the
   site accent instead of Swiper's default blue; sizing/position otherwise left to Swiper itself. */
.gallery.swiper {
  --swiper-theme-color: var(--accent);
  --swiper-navigation-size: 18px;
}
/* height:auto (not a fixed box) so landscape/square images show at natural size; max-height caps
   only portrait images (which scale taller than wide at 100% width) at the gallery's own width
   (100cqw), object-fit:contain letterboxing them instead of overflowing tall. */
.gallery .swiper-slide img {
  width: 100%;
  height: auto;
  max-height: 100cqw;
  object-fit: contain;
  object-position: center;
  margin: 0 auto;
  display: block;
}
.gallery .swiper-button-prev,
.gallery .swiper-button-next {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 50%;
  color: #fff;
  transition: background 0.2s ease;
  padding: 10px;
}

.gallery .swiper-button-next {
  padding-right: 8px;
}

.gallery .swiper-button-prev {
  padding-left: 8px;
}

.gallery .swiper-button-prev:hover,
.gallery .swiper-button-next:hover {
  background: var(--accent);
}
.gallery .swiper-pagination-bullet {
  background: rgba(255, 255, 255, 0.6);
  opacity: 1;
}
.gallery .swiper-pagination-bullet-active {
  background: #fff;
}

.article-header h1 {
  font-size: 28px;
  font-weight: bold;
  margin: 0 0 10px;
  color: #333;
}
.article-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.fields-list-detail {
  background: #faf7f2;
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 15px;
}

.missing-notice {
  color: #d92626;
  font-weight: 600;
  margin-top: 8px;
}

.article-fulltext {
  font-size: 18px;
  line-height: 1.7;
  margin-top: 20px;
}

/* Footer */
.site-footer {
  background: var(--brown);
  color: #f0f0eb;
  padding: 24px 44px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}
.site-footer a {
  color: #f0f0eb;
}
.site-footer a:hover {
  color: var(--accent-light);
}

/* Mobile nav drawer: separate from the desktop .main-nav/.menu-tree hover mega-menu above (which
   this hides outright below the breakpoint) - own markup (render_mobile_menu_items() in
   helpers.php), own accordion behaviour (script.js toggles `.open` per <li>, no CSS :hover
   involved since touch has no hover). Off-canvas base styles live outside the media query (harmless
   pre-768px since the only trigger, #navToggle, is hidden there) so there's one definition of
   "closed"/"open", not a duplicate per breakpoint. */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 70;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.mobile-nav-overlay.open {
  display: block;
  opacity: 1;
}
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(85vw, 340px);
  background: #fff;
  z-index: 80;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
  padding: 16px 20px 32px;
}
.mobile-nav-drawer.open {
  transform: translateX(0);
}
.mobile-nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.mobile-nav-drawer-title {
  font-weight: 700;
  font-size: 18px;
  color: #333;
}
.mobile-nav-close {
  background: none;
  border: none;
  font-size: 30px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
}
.mobile-nav-close:hover {
  color: var(--accent);
}
.mobile-nav-search {
  width: 100%;
  margin: 0 0 20px;
}
.mobile-nav-search input {
  flex: 1;
  min-width: 0;
}
body.mobile-nav-open {
  overflow: hidden;
}

.mobile-menu-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mobile-menu-item {
  border-bottom: 1px solid #f0f0f0;
}
.mobile-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mobile-menu-row a {
  flex: 1;
  padding: 12px 0;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #444;
}
.mobile-submenu .mobile-submenu a {
  font-weight: 500;
}
.mobile-menu-toggle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
}
.mobile-menu-toggle i {
  transition: transform 0.2s ease;
}
.mobile-menu-item.open > .mobile-menu-row > .mobile-menu-toggle i {
  transform: rotate(180deg);
}
.mobile-submenu {
  list-style: none;
  margin: 0;
  padding: 0 0 8px 14px;
  display: none;
}
.mobile-menu-item.open > .mobile-submenu {
  display: block;
}

@media (max-width: 768px) {
  .main-nav {
    display: none;
  }
  .header-inner {
    justify-content: space-between;
  }
  .header-inner > .site-search {
    display: none;
  }
  .nav-toggle {
    display: flex;
  }
}
