/* Stylesheet for the GUP 2025 reader (zagreb.lol/gup/2025). Mobile-first: the base rules lay out a
   single column with a slide-in table of contents, bottom-sheet popovers and touch-sized targets;
   min-width media queries add the tablet header and the two-column desktop layout with a sticky
   sidebar. Palette and type follow the zagreb.lol landing page (paper/ink/accent, Spectral + Bricolage). */

:root {
  --paper: #f6f1e6;
  --paper-2: #efe7d3;
  --card: #fffdf7;
  --ink: #161412;
  --ink-2: #3d3833;
  --muted: #6f675d;
  --line: rgba(22, 20, 18, 0.14);
  --line-strong: rgba(22, 20, 18, 0.3);
  --accent: #ff5a36;
  --accent-dark: #b83010;
  --acid: #c9ff41;
  --acid-soft: rgba(201, 255, 65, 0.45);
  --zone: #1f6f5a;
  --map: #2a6f9e;
  --shadow: 0 14px 40px rgba(22, 20, 18, 0.16);
  --top-h: 54px;
  --tap: 40px;
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --grot: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  overflow-wrap: break-word;
}
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.85em; background: rgba(22, 20, 18, 0.06); padding: 0.1em 0.35em; border-radius: 4px; }
strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--acid); color: var(--ink); padding: 6px 10px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246, 241, 230, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; gap: 8px; height: var(--top-h); padding: 0 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--grot); font-weight: 800; font-size: 1.05rem; text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(255, 90, 54, 0.18); }
.crumbs { display: none; font-family: var(--grot); font-size: 0.86rem; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { text-decoration: none; }
.crumbs .sep { margin: 0 6px; opacity: 0.6; }
.crumbs .cur { color: var(--ink); font-weight: 600; }
.pos { flex: 1 1 auto; min-width: 0; font-family: var(--grot); font-size: 0.76rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.pos a { text-decoration: none; }
.pos .pos-sep { margin: 0 6px; color: var(--muted); }
.pos .pos-cl { font-family: var(--mono); font-size: 0.74rem; background: var(--paper-2); padding: 2px 6px; border-radius: 6px; }
.search { position: relative; flex: 0 0 auto; }
.search input {
  width: var(--tap); height: var(--tap); padding: 0 0 0 34px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f675d' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 11px center / 16px no-repeat;
  font: inherit; font-size: 16px; color: transparent; transition: width 0.15s;
}
.search input::placeholder { color: transparent; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; width: min(280px, calc(100vw - 140px)); padding-right: 10px; color: var(--ink); }
.search input:focus::placeholder { color: var(--muted); }
.results {
  position: absolute; right: -8px; top: calc(var(--tap) + 6px); width: calc(100vw - 8px); max-height: 66vh; overflow: auto;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 50;
}
.results .r { display: block; padding: 10px; border-radius: 8px; text-decoration: none; }
.results .r.sel { background: var(--paper-2); }
.results .r-cite { font-family: var(--mono); font-size: 0.78rem; color: var(--accent-dark); }
.results .r-path { font-family: var(--grot); font-size: 0.74rem; color: var(--muted); margin-left: 8px; }
.results .r-text { display: block; font-size: 0.9rem; line-height: 1.4; color: var(--ink-2); margin-top: 2px; }
.results mark { background: var(--acid-soft); color: inherit; padding: 0 1px; }
.results .r-empty, .results .r-hint { padding: 10px; font-family: var(--grot); font-size: 0.85rem; color: var(--muted); }
.toc-toggle { font: inherit; font-family: var(--grot); font-weight: 700; font-size: 0.88rem; height: var(--tap); padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); cursor: pointer; flex: 0 0 auto; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); min-height: calc(100vh - var(--top-h)); }
.doc { width: 100%; max-width: 78ch; padding: 18px 14px 56px; justify-self: center; }
.doc.home { max-width: 1100px; }

/* ---------- table of contents: a drawer on small screens ---------- */
.toc {
  position: fixed; left: 0; top: var(--top-h); z-index: 45;
  width: min(340px, 88vw); height: calc(100vh - var(--top-h)); overflow-y: auto; -webkit-overflow-scrolling: touch;
  transform: translateX(-102%); transition: transform 0.22s ease;
  border-right: 1px solid var(--line); background: var(--paper-2); padding: 16px 14px 48px;
  font-family: var(--grot); font-size: 0.9rem; line-height: 1.35;
}
.toc.open { transform: none; box-shadow: var(--shadow); }
.backdrop { position: fixed; inset: 0; top: var(--top-h); background: rgba(22, 20, 18, 0.35); z-index: 44; }
.backdrop[hidden] { display: none; }
.toc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.toc-head a { font-weight: 700; text-decoration: none; color: var(--accent-dark); padding: 6px 0; }
.toc-close { width: var(--tap); height: var(--tap); font-size: 1.5rem; line-height: 1; border: 0; background: none; cursor: pointer; color: var(--muted); }
.ruler { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.ruler a { display: inline-flex; align-items: center; min-height: 34px; font-family: var(--mono); font-size: 0.8rem; padding: 0 10px; border-radius: 8px; text-decoration: none; background: rgba(255, 255, 255, 0.55); border: 1px solid var(--line); }
.ruler a.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.toc-tree ol { list-style: none; margin: 0; padding: 0; }
.toc-tree ol ol { padding-left: 12px; border-left: 1px solid var(--line); margin-left: 5px; }
.toc-tree li { margin: 2px 0; }
.toc-tree a { display: block; padding: 7px 8px; border-radius: 6px; text-decoration: none; color: var(--ink-2); }
.toc-tree a.active { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.toc-tree .n { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); margin-right: 4px; }
.toc-tree li.zone > a .n { color: var(--zone); font-weight: 500; }
.toc-tree li.in-clanak > a { color: var(--muted); font-size: 0.82rem; }
.toc-tree .chip, .toc-home .chip, .zone-list .chip { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); margin-left: 6px; white-space: nowrap; }

/* ---------- document ---------- */
.poglavlje { font-family: var(--grot); font-weight: 800; font-size: 1.65rem; line-height: 1.1; letter-spacing: -0.02em; margin: 0.2em 0 0.3em; }
.poglavlje .num { color: var(--accent); margin-right: 0.15em; }
.range-line { font-family: var(--grot); color: var(--muted); margin: 0 0 1.4rem; font-size: 0.95rem; }
.sec { font-family: var(--grot); line-height: 1.2; letter-spacing: -0.01em; scroll-margin-top: calc(var(--top-h) + 14px); }
.sec .num { font-family: var(--mono); font-weight: 500; color: var(--muted); font-size: 0.78em; margin-right: 0.35em; letter-spacing: 0; }
.sec .range { font-family: var(--mono); font-weight: 400; font-size: 0.65em; color: var(--muted); margin-left: 0.6em; white-space: nowrap; }
h2.sec { font-size: 1.32rem; font-weight: 800; margin: 2.6rem 0 0.7rem; padding-top: 1rem; border-top: 2px solid var(--ink); }
h3.sec { font-size: 1.18rem; font-weight: 700; margin: 2.2rem 0 0.6rem; }
h4.sec { font-size: 1.05rem; font-weight: 700; margin: 1.8rem 0 0.5rem; }
h5.sec, h6.sec { font-size: 0.98rem; font-weight: 700; margin: 1.5rem 0 0.4rem; }
.sec.zone { display: flex; align-items: baseline; gap: 0.5em; margin: 2.4rem 0 0.4rem; padding-left: 12px; border-left: 4px solid var(--zone); font-size: 1.1rem; }
.sec.zone .num { color: var(--zone); font-weight: 600; font-size: 0.9em; background: rgba(31, 111, 90, 0.12); padding: 1px 7px; border-radius: 6px; }
.sec.in-clanak { color: var(--ink-2); }
.sec.caption { display: inline; font-size: 1em; margin: 0; }
p.caption { margin: 0 0 0.3em; }

.clanak { margin: 1.4rem 0 0; scroll-margin-top: calc(var(--top-h) + 10px); }
.clanak-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 1.6rem 0 0.5rem; padding-top: 0.6rem; border-top: 1px solid var(--line); }
.clanak-num { font-family: var(--grot); font-weight: 800; font-size: 1.15rem; text-decoration: none; letter-spacing: -0.01em; padding: 4px 0; }
.clanak-lead { font-family: var(--grot); font-size: 0.92rem; color: var(--muted); }
.clanak-lead-link { flex: 1 1 12em; min-width: 0; text-decoration: none; }
.perma { margin-left: auto; font-family: var(--grot); text-decoration: none; color: var(--muted); opacity: 0.6; padding: 4px 8px; }

ol.stavci, ol.tocke, ol.podtocke { list-style: none; margin: 0; padding: 0; }
li.stavak, li.tocka { display: grid; grid-template-columns: 1.9em minmax(0, 1fr); column-gap: 0.25em; scroll-margin-top: calc(var(--top-h) + 10px); }
li.stavak { margin: 0.55em 0; }
li.tocka { margin: 0.25em 0; }
ol.tocke { margin-top: 0.3em; }
li .num { font-family: var(--mono); font-size: 0.78em; color: var(--muted); text-align: right; padding: 0.25em 0.1em 0 0; cursor: copy; user-select: none; }
.li-body { min-width: 0; }
.li-body > p { margin: 0 0 0.35em; }
.li-body > p:last-child { margin-bottom: 0; }
p.stavak { margin: 0.6em 0; scroll-margin-top: calc(var(--top-h) + 10px); }
p.brisan { color: var(--muted); font-style: italic; }

/* target highlight */
:target > .li-body, p.stavak:target, .sec:target, .clanak:target > .clanak-head {
  animation: flash 2.4s ease-out 1;
  background: linear-gradient(90deg, var(--acid-soft), transparent 92%);
  border-radius: 6px;
}
li:target > .li-body { box-shadow: -6px 0 0 var(--acid-soft), 6px 0 0 var(--acid-soft); }
@keyframes flash { 0% { background-color: var(--acid); } 100% { background-color: transparent; } }

/* links in the text */
a.ref { color: var(--accent-dark); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; text-decoration-color: rgba(184, 48, 16, 0.5); }
a.ref-up { color: var(--zone); text-decoration-color: rgba(31, 111, 90, 0.5); }
a.ref-s { color: var(--ink-2); }
a.pojam { color: inherit; text-decoration: underline dotted rgba(22, 20, 18, 0.5); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.grafika { border-bottom: 1px dashed rgba(42, 111, 158, 0.55); color: var(--map); }

.table-wrap { overflow-x: auto; margin: 0.6em 0 1em; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.92em; }
th, td { border: 1px solid var(--line-strong); padding: 6px 10px; text-align: left; vertical-align: top; }
th { font-family: var(--grot); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; background: var(--paper-2); }

.pager { display: flex; flex-direction: column; gap: 14px; margin: 3rem 0 1rem; padding-top: 1.2rem; border-top: 2px solid var(--ink); font-family: var(--grot); }
.pager a { text-decoration: none; font-weight: 700; padding: 6px 0; }
.pager .dir { display: block; font-weight: 400; font-size: 0.78rem; color: var(--muted); margin-bottom: 2px; }
.context-link { font-family: var(--grot); margin: 1.5rem 0; }
.context-link a { text-decoration: none; color: var(--accent-dark); font-weight: 700; }
.backlinks { margin-top: 2.5rem; padding: 16px 18px; background: var(--paper-2); border-radius: 12px; font-family: var(--grot); }
.backlinks h2 { font-size: 1rem; margin: 0 0 8px; }
.backlinks .count { font-family: var(--mono); font-weight: 400; color: var(--muted); margin-left: 6px; }
.backlinks ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.backlinks li a { display: inline-block; font-family: var(--mono); font-size: 0.8rem; background: var(--card); border: 1px solid var(--line); padding: 6px 10px; border-radius: 8px; text-decoration: none; }
.doc-clanak .clanak-head { border-top: 0; margin-top: 0.4rem; }
.doc-clanak .clanak-num { font-size: 1.5rem; }

/* ---------- glossary ---------- */
.abc { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 1.5rem; font-family: var(--mono); }
.abc a { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-size: 0.9rem; }
.slovo { font-family: var(--grot); font-weight: 800; font-size: 1.6rem; color: var(--accent); margin: 2rem 0 0.4rem; border-bottom: 2px solid var(--ink); scroll-margin-top: calc(var(--top-h) + 14px); }
dl.pojmovi dt { font-family: var(--grot); font-weight: 700; font-size: 1.05rem; margin-top: 1.2rem; scroll-margin-top: calc(var(--top-h) + 14px); }
dl.pojmovi dt a { text-decoration: none; }
dl.pojmovi dt .pod { font-weight: 400; font-size: 0.78rem; color: var(--muted); margin-left: 8px; }
dl.pojmovi dt:target { background: var(--acid-soft); border-radius: 6px; padding: 0 6px; margin-left: -6px; }
dl.pojmovi dd { margin: 0.3rem 0 0; }
dl.pojmovi dd > p { margin: 0 0 0.4em; }
.def-cite { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); text-decoration: none; }

/* ---------- popover: a bottom sheet on small screens ---------- */
.pop {
  position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 60; max-height: 60vh; overflow: auto;
  padding: 14px 44px 12px 16px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow);
  font-size: 0.95rem; line-height: 1.5;
}
.pop[hidden] { display: none; }
.pop .pop-kicker { font-family: var(--mono); font-size: 0.72rem; color: var(--accent-dark); margin-bottom: 4px; }
.pop h4 { font-family: var(--grot); margin: 0 0 4px; font-size: 1rem; }
.pop .pop-body p { margin: 0 0 0.4em; }
.pop .pop-body ol { padding-left: 1.3em; margin: 0.2em 0; }
.pop .pop-open { display: inline-block; margin-top: 8px; padding: 6px 0; font-family: var(--grot); font-size: 0.85rem; font-weight: 700; color: var(--accent-dark); text-decoration: none; }
.pop .pop-close { position: absolute; right: 4px; top: 4px; width: var(--tap); height: var(--tap); border: 0; background: none; font-size: 1.5rem; line-height: 1; color: var(--muted); cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--ink); color: var(--paper); font-family: var(--grot); font-size: 0.88rem; padding: 8px 14px; border-radius: 10px; z-index: 70; box-shadow: var(--shadow); }
.toast[hidden] { display: none; }

/* ---------- home ---------- */
.hero { padding: 16px 0 8px; max-width: 820px; overflow-wrap: anywhere; }
.kicker { font-family: var(--mono); font-size: 0.74rem; color: var(--accent-dark); letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 8px; }
.hero h1 { font-family: var(--grot); font-weight: 800; font-size: clamp(2rem, 8vw, 3.4rem); line-height: 1.02; letter-spacing: -0.03em; margin: 0 0 14px; }
.lede { font-size: 1.05rem; color: var(--ink-2); margin: 0 0 18px; }
.hero-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.hero-links a { display: inline-flex; align-items: center; min-height: var(--tap); font-family: var(--grot); font-weight: 700; font-size: 0.9rem; text-decoration: none; padding: 0 16px; border-radius: 999px; background: var(--ink); color: var(--paper); }
.home-sec { margin-top: 2.8rem; scroll-margin-top: calc(var(--top-h) + 14px); }
.home-sec > h2 { font-family: var(--grot); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; margin: 0 0 0.6rem; padding-top: 1rem; border-top: 2px solid var(--ink); }
.sec-lede { color: var(--ink-2); margin: 0 0 1rem; }
.toc-home { font-family: var(--grot); font-size: 0.95rem; }
.toc-home h3.part { break-after: avoid; column-span: all; font-size: 1.05rem; margin: 1.2rem 0 0.4rem; }
.toc-home h3.part .n { color: var(--accent); font-family: var(--mono); font-size: 0.85em; }
.toc-home ol { list-style: none; margin: 0; padding: 0; }
.toc-home ol ol { padding-left: 14px; border-left: 1px solid var(--line); margin-left: 4px; }
.toc-home li { margin: 0; break-inside: avoid; }
.toc-home > ol > li { margin: 4px 0 10px; }
.toc-home > ol > li > a { font-weight: 700; font-size: 1rem; }
.toc-home a { display: block; padding: 5px 4px; text-decoration: none; color: var(--ink-2); }
.toc-home .n { font-family: var(--mono); font-size: 0.78em; color: var(--muted); margin-right: 3px; }
.toc-home li.zone > a .n { color: var(--zone); }
.zones { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; font-family: var(--grot); }
.zone-col h3 { font-size: 1rem; margin: 0 0 8px; }
.zone-col h3 a { text-decoration: none; }
.zone-list { list-style: none; margin: 0; padding: 0; }
.zone-list li { margin: 6px 0; }
.zone-list a { display: block; padding: 9px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); text-decoration: none; font-size: 0.9rem; line-height: 1.3; }
.zone-list .n { font-family: var(--mono); color: var(--zone); font-weight: 500; font-size: 0.82em; margin-right: 4px; }
.clanci-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-cl { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 36px; font-family: var(--mono); font-size: 0.85rem; padding: 0 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); text-decoration: none; }
.chip-cl.brisan { color: var(--muted); background: transparent; text-decoration: line-through; }
.pojam-cloud { line-height: 2.3; }
.pojam-cloud a { text-decoration: none; margin-right: 14px; border-bottom: 1.5px dotted rgba(22, 20, 18, 0.5); }
.about p { color: var(--ink-2); }

.foot { border-top: 1px solid var(--line); padding: 24px 14px 40px; font-family: var(--grot); font-size: 0.82rem; color: var(--muted); max-width: 80ch; }
.foot a { color: var(--ink-2); display: inline-block; padding: 4px 0; }

/* ---------- hover affordances only where a pointer can hover ---------- */
@media (hover: hover) {
  .crumbs a:hover, .pos a:hover, .clanak-num:hover, .pager a:hover, .def-cite:hover, .toc-head a:hover { color: var(--accent-dark); }
  .crumbs a:hover { text-decoration: underline; }
  .clanak-lead-link:hover .clanak-lead { color: var(--accent-dark); text-decoration: underline; }
  .results .r:hover { background: var(--paper-2); }
  .ruler a:hover, .abc a:hover, .chip-cl:hover, .backlinks li a:hover { border-color: var(--accent); color: var(--accent-dark); }
  .toc-tree a:hover { background: rgba(255, 255, 255, 0.6); color: var(--ink); }
  .toc-home a:hover, dl.pojmovi dt a:hover, .zone-col h3 a:hover { color: var(--accent-dark); }
  .toc-home a:hover { text-decoration: underline; }
  .zone-list a:hover { border-color: var(--zone); }
  li .num:hover { color: var(--accent-dark); }
  a.ref:hover { text-decoration-color: currentColor; background: rgba(255, 90, 54, 0.08); }
  a.pojam:hover, .pojam-cloud a:hover { background: var(--acid-soft); text-decoration-style: solid; }
  .perma { opacity: 0.45; }
  .clanak-head:hover .perma, .perma:focus { opacity: 1; color: var(--accent-dark); }
}


/* ---------- outbound links: "Karta i izvori" strips, chips, UPU register chips, map references ---------- */
.anchor { display: block; height: 0; scroll-margin-top: calc(var(--top-h) + 14px); }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0.35rem 0 0.9rem; font-family: var(--grot); }
.links-k { font-size: 0.78rem; color: var(--muted); margin-right: 2px; }
.chip-link { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); text-decoration: none; font-size: 0.82rem; line-height: 1.2; color: var(--ink); }
.chip-link .src { font-family: var(--mono); font-size: 0.66rem; color: var(--muted); border-left: 1px solid var(--line); padding-left: 6px; }
.chip-link.src-zl-urbana-pravila, .chip-link.src-zl-prosirenja, .chip-link.src-zl-izgradjenost, .chip-link.src-zl-maksimalni, .chip-link.src-zl-parkiralista, .chip-link.src-internal { border-color: rgba(31, 111, 90, 0.5); }
.chip-link.src-ago-mapviewer, .chip-link.src-ago-upu { border-color: rgba(42, 111, 158, 0.5); }
.sec.zone + .links { margin-left: 16px; }
.clanak-head + .links { margin-top: 0; }
.li-body > .links { margin: 0.2rem 0 0.5rem; }
dl.pojmovi dd .links { margin: 0.4rem 0 0; }
.upu-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0.15rem 0 0.45rem; font-family: var(--grot); }
.upu-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 6px; font-size: 0.74rem; text-decoration: none; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); }
.upu-chip.st-ok { border-color: rgba(31, 111, 90, 0.55); color: var(--zone); background: rgba(31, 111, 90, 0.08); }
.upu-chip.st-pending { border-color: rgba(184, 48, 16, 0.4); color: var(--accent-dark); background: rgba(255, 90, 54, 0.07); }
.upu-chip.st-off { text-decoration: line-through; color: var(--muted); }
.upu-chip.map { color: var(--map); border-color: rgba(42, 111, 158, 0.5); }
a.grafika { color: var(--map); text-decoration: none; border-bottom: 1px dashed rgba(42, 111, 158, 0.6); }
.zone-list li { display: flex; align-items: stretch; gap: 6px; }
.zone-list li > a:first-child { flex: 1 1 auto; }
.zone-map { display: inline-flex; align-items: center; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(31, 111, 90, 0.4); text-decoration: none; font-family: var(--mono); font-size: 0.72rem; color: var(--zone); background: var(--card); white-space: nowrap; }
.sheets { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.sheet { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.sheet h3 { font-family: var(--grot); font-size: 0.98rem; margin: 0 0 8px; }
.sheet p { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.foot-docs a { display: inline-block; padding: 4px 0; }
.upu-filter { margin: 0 0 0.8rem; }
.upu-filter input { width: 100%; max-width: 480px; height: var(--tap); padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; font-size: 16px; background: var(--card); }
.upu-table { font-size: 0.9em; font-family: var(--grot); }
.upu-table td, .upu-table th { padding: 8px 10px; }
.upu-table tr:target td { background: var(--acid-soft); }
.upu-table tr[hidden] { display: none; }
.muted { color: var(--muted); font-weight: 400; }
.doc-upu { max-width: 96ch; }
.pop .pop-opts { margin: 0; padding: 0; list-style: none; }
.pop .pop-opts li { margin: 6px 0; }
.pop .pop-opts a { text-decoration: none; color: var(--accent-dark); font-family: var(--grot); font-weight: 700; font-size: 0.9rem; }
.pop .pop-opts .note { display: block; font-size: 0.78rem; color: var(--muted); font-family: var(--grot); }
.pop .pop-links { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
@media (hover: hover) {
  .chip-link:hover { border-color: var(--accent); color: var(--accent-dark); }
  .upu-chip:hover { border-color: var(--accent); }
  a.grafika:hover { background: rgba(42, 111, 158, 0.1); }
  .zone-map:hover { border-color: var(--accent); color: var(--accent-dark); }
}

/* ---------- tablet and up: wider header, anchored popovers, row pager ---------- */
@media (min-width: 721px) {
  :root { --top-h: 58px; }
  body { font-size: 17px; line-height: 1.62; }
  .top-inner { gap: 14px; padding: 0 20px; }
  .crumbs { display: block; }
  .pos { font-size: 0.84rem; }
  .pos .pos-cl { font-size: 0.8rem; padding: 2px 7px; }
  .search input { width: 220px; height: 36px; padding: 0 12px 0 34px; font-size: 0.92rem; color: var(--ink); background-position: 10px center; }
  .search input::placeholder { color: var(--muted); }
  .search input:focus { width: 220px; }
  .results { right: 0; top: 42px; width: min(560px, calc(100vw - 32px)); }
  .toc-toggle { height: 36px; font-size: 0.85rem; padding: 0 12px; }
  .doc { padding: 24px 28px 64px; }
  .poglavlje { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
  h2.sec { font-size: 1.55rem; margin: 3rem 0 0.8rem; padding-top: 1.2rem; }
  h3.sec { font-size: 1.28rem; margin: 2.4rem 0 0.6rem; }
  h4.sec { font-size: 1.08rem; margin: 2rem 0 0.5rem; }
  .sec.zone { font-size: 1.15rem; padding-left: 14px; margin: 2.6rem 0 0.4rem; }
  li.stavak, li.tocka { grid-template-columns: 2.4em minmax(0, 1fr); column-gap: 0.35em; }
  ol.tocke li.tocka { grid-template-columns: 2.2em minmax(0, 1fr); }
  ol.podtocke li.tocka { grid-template-columns: 2em minmax(0, 1fr); }
  li .num { font-size: 0.82em; padding-top: 0.2em; }
  li:target > .li-body { box-shadow: -8px 0 0 var(--acid-soft), 8px 0 0 var(--acid-soft); }
  .pager { flex-direction: row; justify-content: space-between; gap: 16px; margin-top: 4rem; }
  .pager a { max-width: 48%; padding: 0; }
  .pager .next { text-align: right; }
  .doc-clanak .clanak-num { font-size: 1.7rem; }
  .hero { padding-top: 24px; }
  .hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
  .lede { font-size: 1.12rem; }
  .home-sec { margin-top: 3.2rem; }
  .home-sec > h2 { font-size: 1.6rem; }
  .toc-home { font-size: 0.92rem; }
  .toc-home a { padding: 2px 0; }
  .zones { gap: 24px; }
  .foot { padding: 24px 24px 40px; }
  .pop {
    position: absolute; left: auto; right: auto; bottom: auto; width: min(440px, calc(100vw - 24px)); max-height: none;
    padding: 12px 14px 10px; border-radius: 12px; font-size: 0.92rem;
  }
  .pop .pop-body { max-height: 40vh; overflow: auto; }
  .pop .pop-close { display: none; }
}

/* ---------- desktop: two columns with a sticky sidebar ---------- */
@media (min-width: 1081px) {
  .layout { grid-template-columns: 304px minmax(0, 1fr); }
  .layout-single { grid-template-columns: minmax(0, 1fr); }
  .doc { padding: 28px 48px 80px; justify-self: start; }
  .layout-single .doc { justify-self: center; padding-left: 24px; padding-right: 24px; }
  .toc {
    position: sticky; top: var(--top-h); width: auto; transform: none; transition: none; box-shadow: none;
    padding: 18px 16px 40px; font-size: 0.86rem;
  }
  .toc.open { box-shadow: none; }
  .backdrop { display: none; }
  .toc-toggle, .toc-close { display: none; }
  .ruler { gap: 4px; }
  .ruler a { min-height: 26px; font-size: 0.74rem; padding: 0 6px; border-radius: 6px; }
  .toc-tree a { padding: 3px 6px; }
  .toc-tree li.in-clanak > a { font-size: 0.8rem; }
  .toc-home { columns: 2; column-gap: 40px; }
}

@media print {
  .top, .toc, .pager, .perma, .context-link, .backlinks, .foot, .backdrop, .pop, .toast { display: none !important; }
  .layout { display: block; }
  .doc { max-width: none; padding: 0; }
  a { text-decoration: none; color: inherit; }
}
