/* Arhiva · Općina Velika Kladuša
   Svijet: općinska pisarnica — papir akata, protokol, broj akta.
   Jedini "bogat" element je registar objava po mjesecima. */
:root {
  --bg: #f7f4ee;
  --card: #fdfbf7;
  --raised: #efe9df;
  --ink: #1f1b16;
  --ink-2: #5e554a;
  --muted: #7b7266;
  --line: rgba(31, 27, 22, .09);
  --line-2: rgba(31, 27, 22, .16);
  /* Službene boje iz grba */
  --grb-plava: #00aeef;
  --grb-zelena: #00a651;
  --grb-zlatna: #d2ab67;
  --accent: #126339;        /* tamna zelena iz grba, za tekst i linkove (7:1) */
  --accent-fill: #00a651;   /* zelena iz grba, za površine bez teksta */
  --accent-soft: #e2f1e7;
  --mark: #f0dfbd;          /* zlatna iz grba, posvijetljena */
  --bar: #cfc6b6;
  --bar-2: #b9ae9b;
  --serif: "Newsreader", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --w: 1200px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/22px var(--sans); }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 2px; }
.num, .count, time { font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
.flag { height: 6px; background: linear-gradient(var(--grb-plava) 0 3px, var(--grb-zelena) 3px 6px); }
.top {
  max-width: var(--w); margin: 0 auto; height: 64px; padding: 0 32px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 500; }
.brand-mark { width: 28px; height: 28px; object-fit: contain; }
.brand-sub { color: var(--muted); font-weight: 400; padding-left: 8px; border-left: 1px solid var(--line-2); margin-left: 4px; }
.current-site { color: var(--muted); text-decoration: none; transition: color .15s var(--ease); }
.current-site:hover { color: var(--ink); }

main { max-width: var(--w); margin: 0 auto; padding: 0 32px; }

/* ---------- intro ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: end; padding: 64px 0 32px; }
h1 { font: 400 56px/1.04 var(--serif); letter-spacing: -.02em; margin: 0; max-width: 760px; text-wrap: balance; }
.sub { color: var(--ink-2); font-size: 18px; line-height: 28px; max-width: 36rem; margin: 16px 0 0; }
.facts { display: flex; gap: 32px; margin: 0; padding-bottom: 4px; }
.facts div { display: flex; flex-direction: column-reverse; gap: 4px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; font: 500 28px/1 var(--sans); font-variant-numeric: tabular-nums; }

/* ---------- search ---------- */
.searchbox {
  display: flex; align-items: center; height: 56px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(31, 27, 22, .05);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 8px 24px rgba(31, 27, 22, .08); }
.searchbox svg { width: 20px; height: 20px; margin-left: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; }
.searchbox input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: 0; font: 400 18px var(--sans); padding: 0 12px; color: var(--ink); }
.searchbox input::placeholder { color: var(--muted); }
.searchbox kbd { margin-right: 16px; font: 500 12px/1 var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 4px 8px; }

.suggest { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.suggest button { font: inherit; color: var(--ink-2); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; transition: color .15s var(--ease); }
.suggest button:hover { color: var(--accent); text-decoration-color: currentColor; }

/* ---------- register (jedini bogat element) ---------- */
.register { margin: 40px 0 0; padding: 20px 24px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.register figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-size: 14px; font-weight: 500; margin-bottom: 16px; }
.reg-info { font: 400 13px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.reg-info b { color: var(--ink); font-weight: 500; }
.reg-chart {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px;
  height: 152px; overflow-x: auto; scrollbar-width: none;
  background: repeating-linear-gradient(to top, transparent 0 31px, var(--line) 31px 32px) 0 0 / 100% 128px no-repeat;
}
.reg-chart::-webkit-scrollbar { display: none; }
.yr { display: grid; grid-template-rows: 128px 24px; min-width: 40px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; border-radius: 4px; }
.yr .months { display: flex; align-items: flex-end; gap: 1px; height: 128px; }
.yr .m { flex: 1; min-height: 1px; background: var(--bar); border-radius: 1px 1px 0 0; transition: background .15s var(--ease); }
.yr .m.z { background: var(--line-2); height: 1px !important; }
.yr .lbl { font: 400 12px/24px var(--mono); color: var(--muted); text-align: left; border-top: 1px solid var(--line-2); padding-top: 4px; line-height: 16px; transition: color .15s var(--ease); }
.yr:hover .m:not(.z) { background: var(--bar-2); }
.yr:hover .lbl { color: var(--ink); }
.yr.on .m:not(.z) { background: var(--accent-fill); }
.yr.on .lbl { color: var(--accent); border-top-color: var(--accent-fill); border-top-width: 2px; padding-top: 3px; font-weight: 500; }
.reg-chart.has-sel .yr:not(.on) .m:not(.z) { background: #ddd5c7; }
.reg-chart.has-sel .yr:not(.on):hover .m:not(.z) { background: var(--bar-2); }

/* ---------- layout ---------- */
.layout > * { min-width: 0; }
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 48px; margin-top: 40px; align-items: start; }
.facets { position: sticky; top: 24px; }
.facets h2 { font: 500 13px var(--sans); color: var(--muted); margin: 0 0 8px; }
.types { display: flex; flex-direction: column; gap: 2px; margin-bottom: 24px; }
.type {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  font: 400 14px/20px var(--sans); color: var(--ink); text-align: left;
  transition: background-color .15s var(--ease);
}
.type small { font: 400 12px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.type .share { grid-column: 1 / -1; height: 2px; background: var(--line); border-radius: 1px; overflow: hidden; }
.type .share i { display: block; height: 100%; background: var(--bar-2); border-radius: 1px; transition: width .3s var(--ease); }
.type:hover { background: var(--raised); }
.type.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(18, 99, 57, .18); color: var(--accent); font-weight: 500; }
.type.on small { color: var(--accent); }
.type.on .share i { background: var(--accent-fill); }
.type:disabled { opacity: .4; cursor: default; background: none; }

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; color: var(--ink-2); padding: 0 10px; }
.toggle input { appearance: none; flex: none; width: 32px; height: 20px; border-radius: 10px; background: var(--line-2); position: relative; cursor: pointer; margin: 0; transition: background-color .15s var(--ease); }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s var(--ease); }
.toggle input:checked { background: var(--accent-fill); }
.toggle input:checked::after { transform: translateX(12px); }

.toolbar { display: flex; align-items: center; gap: 16px; height: 40px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.count { color: var(--muted); font: 400 13px var(--mono); }
.count b { color: var(--ink); font-weight: 500; }
.active-filters { display: flex; gap: 8px; margin-right: auto; }
.active-filters button { font: 400 12px var(--mono); background: var(--raised); color: var(--ink-2); border: 0; border-radius: 6px; padding: 4px 8px; cursor: pointer; transition: background-color .15s var(--ease); }
.active-filters button:hover { background: var(--line-2); }
select { font: 400 14px var(--sans); color: var(--ink); background: transparent; border: 0; padding: 4px 20px 4px 8px; border-radius: 6px; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%237b7266' stroke-width='1.5'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 4px center; }
select:hover { background-color: var(--raised); }

/* ---------- results ---------- */
.results { list-style: none; margin: 0; padding: 0; }
.results.enter .hit { animation: rise .4s var(--ease) both; }
.hit { border-bottom: 1px solid var(--line); }
.hit a { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 20px; padding: 20px 12px; margin: 0 -12px; text-decoration: none; border-radius: 12px; transition: background-color .15s var(--ease); }
.hit a:hover { background: var(--card); }
.hit a:hover h3 { color: var(--accent); }
.sheet { width: 56px; height: 76px; border-radius: 2px; background: #fff center top / cover no-repeat; box-shadow: 0 0 0 1px var(--line-2), 0 2px 4px rgba(31, 27, 22, .08); }
.sheet.blank { background: var(--raised); box-shadow: none; display: grid; place-items: center; }
.sheet.blank svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.hit .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font: 400 12px/16px var(--mono); color: var(--muted); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.hit .meta .t { color: var(--ink-2); font-family: var(--sans); font-size: 13px; }
.ref { color: var(--ink-2); }
.hit h3 { font: 500 17px/24px var(--sans); margin: 0 0 4px; transition: color .15s var(--ease); text-wrap: pretty; }
.hit p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 21px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hit .src { color: var(--accent); font-weight: 500; }
.hit .files { margin-top: 8px; font: 400 12px var(--mono); color: var(--muted); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.empty { padding: 64px 0; color: var(--muted); }
.empty strong { display: block; font: 400 28px/1.2 var(--serif); color: var(--ink); margin-bottom: 8px; }
.more { padding: 32px 0 8px; }
.more button { font: 500 14px var(--sans); height: 40px; padding: 0 20px; background: var(--card); color: var(--ink); border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; transition: background-color .15s var(--ease), transform .12s var(--ease); }
.more button:hover { background: var(--raised); }
.more button:active { transform: scale(.98); }
.skeleton { height: 117px; border-bottom: 1px solid var(--line); }
.skeleton::before { content: ""; display: block; margin-top: 20px; width: 56px; height: 76px; border-radius: 2px; background: var(--raised); }

/* ---------- document ---------- */
.doc { padding: 32px 0 48px; }
.back { font: 400 14px var(--sans); color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; transition: color .15s var(--ease); }
.back:hover { color: var(--ink); }
.doc header { margin: 32px 0 40px; max-width: 820px; }
.doc .meta { display: flex; gap: 4px 16px; flex-wrap: wrap; font: 400 13px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.doc .meta .t { font-family: var(--sans); color: var(--ink-2); }
.doc h1 { font-size: 44px; line-height: 1.1; margin-top: 16px; }
.doc .cats { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.doc .cats a { font-size: 13px; text-decoration: none; background: var(--raised); border-radius: 6px; padding: 2px 8px; color: var(--ink-2); transition: background-color .15s var(--ease); }
.doc .cats a:hover { background: var(--line-2); }
.doc-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 64px; align-items: start; }
.prose { font-size: 17px; line-height: 28px; max-width: 720px; overflow-wrap: anywhere; }
.prose p { margin: 0 0 16px; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
.prose h2, .prose h3, .prose h4 { font-family: var(--serif); font-weight: 500; line-height: 1.25; margin: 32px 0 8px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.prose td, .prose th { border: 1px solid var(--line-2); padding: 8px 12px; }
.prose iframe[data-embed="video"] { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 12px; }
.prose a { color: var(--accent); }
.feature { width: 100%; max-height: 420px; object-fit: cover; border-radius: 16px; margin-bottom: 32px; }

.pdf-embed { margin: 24px 0; border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden; background: var(--card); }
.pdf-embed iframe { display: block; width: 100%; height: 80vh; border: 0; background: var(--raised); }
.pdf-embed .bar { display: flex; align-items: center; gap: 16px; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.pdf-embed .bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.pdf-embed .bar a { font-size: 13px; color: var(--ink-2); text-decoration: none; white-space: nowrap; transition: color .15s var(--ease); }
.pdf-embed .bar a:hover { color: var(--accent); }
.pdf-card { display: grid; grid-template-columns: 56px 1fr; gap: 16px; align-items: center; padding: 12px; text-decoration: none; }
.pdf-card b { display: block; font-weight: 500; font-size: 15px; line-height: 22px; }
.pdf-card small { font: 400 12px var(--mono); color: var(--muted); }

.aside { position: sticky; top: 24px; }
.aside h3 { font: 500 13px var(--sans); color: var(--muted); margin: 0 0 8px; }
.aside ul { list-style: none; margin: 0 0 32px; padding: 0; }
.aside li a { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; padding: 8px; margin: 0 -8px; border-radius: 10px; text-decoration: none; font-size: 14px; line-height: 20px; transition: background-color .15s var(--ease); }
.aside li a:hover { background: var(--card); }
.aside .sheet { width: 40px; height: 54px; }
.aside li small { display: block; font: 400 12px var(--mono); color: var(--muted); margin-top: 2px; }
.aside .ref-box { font: 400 13px/20px var(--mono); color: var(--ink-2); padding: 12px 16px; border: 1px solid var(--line-2); border-left: 3px solid var(--grb-zlatna); border-radius: 10px; margin-bottom: 24px; }
.aside .ref-box span { display: block; font: 400 12px var(--sans); color: var(--muted); }
.notice { font-size: 13px; line-height: 20px; color: var(--muted); margin: 0; }
.notfound { padding: 64px 0; }
.notfound h1 { font-size: 44px; }

.foot { max-width: var(--w); margin: 80px auto 0; padding: 32px 32px 48px; border-top: 1px solid var(--line); display: flex; gap: 16px; align-items: flex-start; color: var(--muted); font-size: 13px; line-height: 20px; }
.foot p { max-width: 640px; margin: 0; }
.foot img { flex: none; width: 32px; height: 32px; object-fit: contain; }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .top { padding: 0 20px; height: 56px; }
  .current-site { display: none; }
  main { padding: 0 20px; }
  .intro { grid-template-columns: 1fr; gap: 24px; padding: 32px 0 24px; }
  h1 { font-size: 36px; }
  .sub { font-size: 16px; line-height: 24px; margin-top: 12px; }
  .facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 24px; }
  .facts dd { font-size: 20px; white-space: nowrap; }
  .facts dt { font-size: 12px; line-height: 16px; }
  .reg-info.hint { display: none; }
  .searchbox { height: 52px; }
  .searchbox input { font-size: 17px; }
  .searchbox kbd { display: none; }
  .register { margin-top: 24px; padding: 16px 16px 12px; border-radius: 14px; }
  .reg-chart { grid-auto-columns: 40px; gap: 4px; height: 128px; background-size: 100% 104px; }
  .yr { grid-template-rows: 104px 24px; }
  .yr .months { height: 104px; }
  .layout { grid-template-columns: 1fr; gap: 16px; margin-top: 24px; }
  .facets { position: static; }
  .facets h2 { display: none; }
  .types { flex-direction: row; overflow-x: auto; scrollbar-width: none; margin: 0 -20px 12px; padding: 0 20px; gap: 8px; }
  .types::-webkit-scrollbar { display: none; }
  .type { width: auto; flex: none; grid-template-columns: auto auto; height: 36px; padding: 0 12px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line-2); }
  .type .share { display: none; }
  .type.on { background: var(--accent); color: #fff; box-shadow: none; }
  .type.on small { color: rgba(255, 255, 255, .75); }
  .toggle { padding: 0; }
  .hit a { grid-template-columns: 44px minmax(0, 1fr); gap: 16px; padding: 16px 8px; margin: 0 -8px; }
  .sheet { width: 44px; height: 60px; }
  .hit h3 { font-size: 16px; line-height: 22px; }
  .doc h1 { font-size: 32px; }
  .doc-body { grid-template-columns: 1fr; gap: 32px; }
  .aside { position: static; }
  .prose { font-size: 16px; line-height: 26px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
