@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);
}
@media (max-width: 768px) {
  .site-search {
    margin-left: 0;
    order: 3;
    flex: 1 1 100%;
    margin-top: 10px;
  }
  .header-inner {
    flex-wrap: wrap;
  }
}
.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;
}
/* 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;
}
.submenu a {
  font-size: 14px;
  font-weight: 500;
  white-space: normal;
  padding: 3px 0;
  display: block;
}

/* Level-1 dropdown: mega-menu matching menu.html's per-top-level width/column-count
   (see .menu-filatelija/.menu-numizmatika/.menu-slovenika below). Capped height with a
   vertical scrollbar as fallback if a column still overflows it. */
.submenu-level1 {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff0db;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
  padding: 20px 28px;
  max-width: calc(100vw - 48px);
  max-height: 70vh;
  column-gap: 32px;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 60;
}
/* Column counts/widths lifted straight from menu.html's dropdown divs. */
.menu-filatelija > .submenu-level1 {
  width: 980px;
  column-count: 4;
}
.menu-numizmatika > .submenu-level1 {
  width: 600px;
  column-count: 2;
}
.menu-slovenika > .submenu-level1 {
  width: 600px;
  column-count: 2;
}
/* 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: 18px;
}
.submenu-level1 > .menu-item > a {
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 4px;
}

/* 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 180px;
  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);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.article-card-media {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f4f4f4;
}
.article-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  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;
  inset: 0;
  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: 13px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.article-card-title {
  font-size: 14px;
  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: 11px;
  padding: 3px 9px;
  border-radius: 3px;
  font-weight: 700;
}
.article-date,
.article-hits {
  font-size: 12px;
  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: 11px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 12px;
  pointer-events: none;
}

.fields-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  font-size: 12px;
}
.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: 13px;
  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: 12px;
  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: 13px;
  font-weight: 600;
}

.gallery {
  position: relative;
  margin-bottom: 24px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  background: #f4f4f4;
}
.gallery-track {
  position: relative;
  aspect-ratio: 16 / 9;
}
.gallery-slide {
  position: absolute;
  inset: 0;
  transition: transform 0.4s ease;
}
.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.gallery-prev,
.gallery-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}
.gallery-prev {
  left: 12px;
}
.gallery-next {
  right: 12px;
}
.gallery-prev:hover,
.gallery-next:hover {
  background: var(--accent);
}
.gallery-dots {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
}
.gallery-dot.active {
  background: #fff;
}

.article-header h1 {
  font-size: 22px;
  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: 13px;
}

.article-fulltext {
  font-size: 15px;
  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);
}

@media (max-width: 768px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 12px 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
  }
  .main-nav.open {
    display: flex;
  }
  .menu-tree {
    flex-direction: column;
    gap: 4px;
  }
  .submenu {
    display: block;
    position: static;
    box-shadow: none;
    padding: 0 0 0 14px;
    max-height: none;
    overflow: visible;
    width: auto;
    max-width: none;
    column-width: auto;
    column-count: 1;
  }
  .menu-filatelija > .submenu-level1,
  .menu-numizmatika > .submenu-level1,
  .menu-slovenika > .submenu-level1 {
    width: auto;
    max-width: none;
    column-count: 1;
  }
  .nav-toggle {
    display: flex;
  }
}
