/* =============================================================
   AI Konsultant — „datasheet“ dizajn
   Sajt kao tehnička dokumentacija komponente AIK-1: naslovni blok,
   numerisana poglavlja, pin dijagram, tabele sa punim okvirom,
   grafici tipičnih karakteristika. Jedan font (Archivo, varijabilna
   širina i debljina), jedan signalni akcenat (međunarodna narandžasta).
   ============================================================= */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-stretch: 62% 100%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-sr.woff2") format("woff2");
  font-weight: 300 900;
  font-stretch: 62% 100%;
  font-display: swap;
  unicode-range: U+0106-0107, U+010C-010D, U+0110-0111, U+0160-0161, U+017D-017E;
}

:root {
  --sheet: #fbfaf6;
  --sheet-2: #eeede6;
  --ink: #111110;
  --ink-2: #3a3935;
  --muted: #6b6962;
  --rule: #d3d0c5;
  --accent: #ff4f00;      /* samo za površine — tekst na njoj je --on-accent */
  --accent-ink: #b83a00;  /* narandžasti tekst na papiru, ≥ 4,5:1 */
  --on-accent: #111110;
  --chip: #1b1b19;
  --chip-mark: #8d8a80;
  --metal: #a9a69c;
  --code-fg: #ecebe4;

  /* grafici — validirano (dataviz validator) na #fbfaf6 */
  --c-local: #e4531a;
  --c-api: #2a78d6;
  --c-o1: #8f2c04;
  --c-o2: #e4531a;
  --c-o3: #f09159;
  --grid: #e3e1d9;
  --axis: #b9b6ab;

  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --wide: 1240px;
  --measure: 70ch;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sheet: #121211;
    --sheet-2: #1d1d1b;
    --ink: #efede6;
    --ink-2: #c8c5bb;
    --muted: #97948a;
    --rule: #35342f;
    --accent: #ff5a14;
    --accent-ink: #ff7d45;
    --on-accent: #121211;
    --chip: #0a0a09;
    --chip-mark: #7b786f;
    --metal: #77746b;
    --code-fg: #e6e3da;
    /* validirano na #121211 */
    --c-local: #e65c22;
    --c-api: #3987e5;
    --c-o1: #ffb187;
    --c-o2: #e65c22;
    --c-o3: #9c3a0d;
    --grid: #262624;
    --axis: #45443f;
  }
}

/* Tamni „instrument“ panel (kalkulator) — isti tokeni kao tamni režim */
.inverse {
  --sheet: #151514;
  --sheet-2: #20201e;
  --ink: #efede6;
  --ink-2: #c8c5bb;
  --muted: #9a978d;
  --rule: #3a3934;
  --accent-ink: #ff7d45;
  --c-local: #e65c22;
  --c-api: #3987e5;
  --grid: #2a2a27;
  --axis: #4a4943;
  color-scheme: dark;
  background: var(--sheet);
  color: var(--ink-2);
}

/* ---------- Osnova ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--sheet);
  color: var(--ink-2);
  font: 400 17px/1.6 var(--sans);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 900px) { body { font-size: 17.5px; } }
img, svg { display: block; max-width: 100%; }
p { margin: 0 0 1em; }
strong, b { color: var(--ink); font-weight: 700; }
address { font-style: normal; }
small { font-size: 0.85em; }

h1, h2, h3 {
  margin: 0 0 0.5em;
  font-family: var(--sans);
  font-stretch: 75%;
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: clamp(2.2rem, 4.6vw, 3.85rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.55rem, 2.7vw, 2.2rem); }
h3 { font-size: 1.3rem; font-weight: 750; line-height: 1.15; }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a:hover { background: var(--accent); color: var(--on-accent); text-decoration-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }

.wrap { max-width: var(--wide); margin-inline: auto; padding-inline: clamp(16px, 3.5vw, 40px); }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--ink); color: var(--sheet); padding: 0.5em 1em; }

.kicker {
  margin: 0 0 0.9rem;
  font: 600 12.5px/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.lede { font-size: clamp(1.08rem, 1.5vw, 1.22rem); line-height: 1.55; max-width: 60ch; color: var(--ink-2); }
.mono { font-family: var(--mono); }

/* ---------- Dugmad: „taster“ sa tvrdom senkom ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 1.2rem;
  font: 750 0.95rem/1.1 var(--sans);
  font-stretch: 87.5%;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); text-decoration: none; }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.btn-p, .btn-p:hover { background: var(--accent); color: var(--on-accent); }
.btn-g, .btn-g:hover { background: var(--sheet); color: var(--ink); }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 1.6rem; }

/* ---------- Zaglavlje dokumenta (naslovni blok) ---------- */
.doc-head { border-bottom: 3px solid var(--ink); }
.doc-head-in { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 0.7rem; color: var(--ink); text-decoration: none; }
.brand:hover { background: none; color: var(--ink); }
.brand .mark { width: 40px; height: 40px; flex: none; }
.brand b { display: block; font-stretch: 75%; font-weight: 850; font-size: 1.4rem; line-height: 1; letter-spacing: 0.03em; text-transform: uppercase; }
.brand small { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); }

.tblock { display: flex; margin: 0; border: 1.5px solid var(--ink); font-size: 13px; line-height: 1.3; }
.tblock div { padding: 4px 11px 5px; border-left: 1px solid var(--ink); }
.tblock div:first-child { border-left: 0; }
.tblock dt { font: 600 9.5px/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.tblock dd { margin: 0; font: 600 13px/1.4 var(--mono); color: var(--ink); white-space: nowrap; }
.tblock .tb-pn dd { font: 850 1.12rem/1.2 var(--sans); font-stretch: 75%; letter-spacing: 0.02em; }
@media (max-width: 1000px) { .tblock .tb-title { display: none; } }
@media (max-width: 640px) { .tblock div:not(.tb-pn) { display: none; } .brand small { display: none; } }

/* ---------- Navigacija (lepljiva traka) ---------- */
.mast { position: sticky; top: 0; z-index: 40; background: var(--sheet); border-bottom: 1.5px solid var(--ink); }
.mast-in { display: flex; align-items: stretch; min-height: 50px; }
.mast-in > a, .menu > summary {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0 1.05rem;
  font: 680 14.5px/1 var(--sans);
  font-stretch: 87.5%;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-right: 1px solid var(--rule);
  cursor: pointer;
}
.mast-in > :first-child > summary, .mast-in > a:first-child { padding-left: 0; }
.mast-in > a:hover, .menu > summary:hover { background: var(--sheet-2); color: var(--ink); }
.mast-in > a[aria-current], .menu > summary.is-current { box-shadow: inset 0 -4px 0 var(--accent); }
.mast-sp { flex: 1; border-right: 1px solid var(--rule); }
.mast-in > .nav-cta { border-right: 0; background: var(--accent); color: var(--on-accent); font-weight: 800; padding-inline: 1.2rem; }
.mast-in > .nav-cta:hover, .mast-in > .nav-cta[aria-current] { background: var(--ink); color: var(--sheet); box-shadow: none; }
@media (max-width: 600px) {
  .mast-sp { display: none; }
  .mast-in > a, .menu > summary { padding: 0 0.55rem; font-size: 12.5px; letter-spacing: 0.02em; }
  .mast-in > .nav-cta { margin-left: auto; padding-inline: 0.7rem; }
}

.menu { position: relative; display: flex; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; width: 0.4em; height: 0.4em; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.menu[open] > summary { background: var(--ink); color: var(--sheet); }
.menu[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.menu ul {
  position: absolute; top: 100%; left: 0; z-index: 50;
  min-width: min(360px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  margin: 0; padding: 0; list-style: none;
  background: var(--sheet); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
}
.menu li + li { border-top: 1px solid var(--rule); }
.menu li a { display: grid; grid-template-columns: 4.8rem 1fr; gap: 0 0.6rem; padding: 0.65rem 0.9rem; color: var(--ink); text-decoration: none; line-height: 1.3; font-weight: 650; }
.menu li a .code { grid-row: span 2; font: 600 12.5px/1.6 var(--mono); color: var(--muted); }
.menu li a small { font-weight: 400; color: var(--muted); font-size: 13px; }
.menu li a:hover, .menu li a[aria-current] { background: var(--accent); color: var(--on-accent); }
.menu li a:hover .code, .menu li a:hover small, .menu li a[aria-current] .code, .menu li a[aria-current] small { color: inherit; }

/* ---------- Brojevi poglavlja ---------- */
main { counter-reset: sec fig tbl; }
.sh, .prose > h2, .after > section > h2 { display: flex; align-items: center; gap: 0.55rem; }
.sh::before, .prose > h2::before, .after > section > h2::before {
  counter-increment: sec;
  content: counter(sec);
  flex: none;
  display: inline-grid; place-items: center;
  min-width: 1.5em; height: 1.5em; padding: 0 0.25em;
  background: var(--ink); color: var(--sheet);
  font: 800 0.58em/1 var(--sans); font-stretch: 75%;
}

/* ---------- Naslovna (prednja strana datasheet-a) ---------- */
.pn-xl {
  display: flex; align-items: flex-start; gap: 0.06em;
  margin: 0 0 1.1rem;
  font: 900 clamp(4.4rem, 13vw, 10.5rem)/0.78 var(--sans);
  font-stretch: 62%;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.pn-xl::before { content: ""; flex: none; width: 0.13em; height: 0.13em; margin-top: 0.01em; border-radius: 50%; background: var(--accent); }
.page-head .pn-xl { font-size: clamp(3.4rem, 8.5vw, 6.6rem); margin-bottom: 0.9rem; }

.front { border-bottom: 1.5px solid var(--ink); }
.front-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: clamp(2rem, 4vw, 4rem); align-items: center; padding-block: clamp(2rem, 5vw, 3.25rem); }
.front h1 { max-width: 19ch; }
@media (max-width: 960px) { .front-grid { grid-template-columns: 1fr; } }

.fp3-row { border-bottom: 1.5px solid var(--ink); }
.fp3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fp3 > section { padding: 1.6rem 1.6rem 1.9rem; border-left: 1px solid var(--rule); }
.fp3 > section:first-child { padding-left: 0; border-left: 0; }
.fp3 > section:last-child { padding-right: 0; }
.fp3 h2 { font-size: 1.5rem; }
.fp3 p { font-size: 16px; }
@media (max-width: 960px) {
  .fp3 { grid-template-columns: 1fr; }
  .fp3 > section, .fp3 > section:first-child { padding-inline: 0; border-left: 0; }
  .fp3 > section + section { border-top: 1px solid var(--rule); }
}
.feat { margin: 0; padding-left: 1.1rem; list-style: square; font-size: 16px; }
.feat li { margin-bottom: 0.45rem; }
.feat li::marker { color: var(--accent); font-size: 1.1em; }

/* ---------- Pin dijagram ---------- */
.pinout { margin: 0; }
.pinout svg { width: 100%; height: auto; font-family: var(--sans); }
.pin-pkg { fill: var(--chip); stroke: var(--ink); stroke-width: 2; }
.pin-mark { fill: var(--chip-mark); font-stretch: 62%; font-weight: 900; }
.pin-sub { fill: var(--chip-mark); font: 600 13px var(--mono); letter-spacing: 0.08em; }
.pin-leg { fill: var(--metal); }
.pin-num { fill: var(--chip-mark); font: 600 13px var(--mono); }
.pin-wire { stroke: var(--ink); stroke-width: 1.5; }
.tag rect { stroke: var(--ink); stroke-width: 1.5; }
.tag text { font-size: 16px; font-weight: 760; font-stretch: 75%; letter-spacing: 0.04em; }
.tag.svc rect { fill: var(--accent); }
.tag.svc text { fill: var(--on-accent); }
.tag.res rect { fill: var(--ink); }
.tag.res text { fill: var(--sheet); }
.tag.pwr rect { fill: var(--sheet); }
.tag.pwr text { fill: var(--ink); }
a.pin { cursor: pointer; text-decoration: none; }
a.pin:hover, a.pin:focus { background: none; outline: none; }
a.pin:hover .tag rect, a.pin:focus-visible .tag rect { fill: var(--ink); }
a.pin:hover .tag text, a.pin:focus-visible .tag text { fill: var(--accent); }
a.pin:hover .pin-leg, a.pin:focus-visible .pin-leg { fill: var(--accent); }
.pin-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; margin: 0.6rem 0 0; padding: 0; list-style: none; font-size: 13.5px; color: var(--ink-2); }
.pin-legend i { display: inline-block; width: 15px; height: 11px; margin-right: 0.4rem; vertical-align: -1px; border: 1.5px solid var(--ink); }
.pin-legend .svc i { background: var(--accent); }
.pin-legend .res i { background: var(--ink); }
.pin-legend .pwr i { background: var(--sheet); }

/* ---------- Sekcije ---------- */
.sec { padding-block: clamp(2rem, 4vw, 3rem); }
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 0.75rem 3.5rem; align-items: end; margin-bottom: 1.9rem; padding-top: 1rem; border-top: 3px solid var(--ink); }
.sec-head h2 { margin: 0; }
.sec-head p { margin: 0; }
@media (max-width: 860px) { .sec-head { grid-template-columns: 1fr; } }

/* Usluge kao tabela za naručivanje */
.order-box { border: 2px solid var(--ink); }
.order { margin: 0; padding: 0; list-style: none; }
.order-h, .order a { display: grid; grid-template-columns: 6.2rem minmax(0, 1fr) minmax(0, 1.55fr) minmax(0, 0.75fr) 2rem; gap: 0 1.25rem; align-items: baseline; padding: 0.95rem 1.1rem; }
.order-h { background: var(--sheet-2); border-bottom: 2px solid var(--ink); font: 600 11px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.order li + li { border-top: 1px solid var(--rule); }
.order a { color: var(--ink-2); text-decoration: none; }
.order a:hover { background: var(--accent); color: var(--on-accent); }
.order a:hover .code, .order a:hover h3, .order a:hover .terms, .order a:hover .out { color: var(--on-accent); }
.order .code { font: 600 14px/1.4 var(--mono); color: var(--ink); }
.order h3 { margin: 0; font-size: 1.35rem; }
.order p { margin: 0; font-size: 15.5px; line-height: 1.5; }
.order .terms { display: block; margin-top: 0.3rem; font: 12.5px/1.5 var(--mono); color: var(--muted); }
.order .out { font-size: 14px; font-weight: 650; color: var(--ink); line-height: 1.35; }
.order .arr { justify-self: end; font-size: 1.35rem; color: var(--ink); }
.front .order a { grid-template-columns: 5.6rem minmax(0, 1fr); }
@media (max-width: 860px) {
  .order-h { display: none; }
  .order a { grid-template-columns: 4.6rem minmax(0, 1fr); gap: 0.35rem 0.9rem; }
  .order p, .order .out { grid-column: 2; }
  .order .arr { display: none; }
}

/* Proces kao funkcionalni blok dijagram */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2.4rem; margin: 0; padding: 0; list-style: none; counter-reset: st; }
.steps li { counter-increment: st; position: relative; display: flex; flex-direction: column; background: var(--sheet); border: 2px solid var(--ink); }
.steps li::before { content: "Blok " counter(st, decimal-leading-zero); padding: 0.4rem 0.8rem; background: var(--ink); color: var(--sheet); font: 600 11.5px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
html:lang(en) .steps li::before { content: "Block " counter(st, decimal-leading-zero); }
.steps li:not(:last-child)::after { content: "→"; position: absolute; top: 50%; right: -2.05rem; transform: translateY(-50%); font: 700 1.6rem/1 var(--sans); color: var(--ink); }
.steps h3 { margin: 0.85rem 0.9rem 0.15rem; font-size: 1.25rem; }
.steps .dur { margin: 0 0.9rem 0.6rem; font: 12.5px/1.4 var(--mono); color: var(--accent-ink); }
.steps p { margin: 0 0.9rem 0.85rem; font-size: 15px; line-height: 1.5; }
.steps .out { margin: auto 0 0; padding: 0.6rem 0.9rem; border-top: 1.5px solid var(--ink); background: var(--sheet-2); font-size: 14px; color: var(--ink); }
@media (max-width: 1000px) {
  .steps { grid-template-columns: 1fr 1fr; }
  .steps li:nth-child(2)::after { content: none; }
}
@media (max-width: 600px) {
  .steps { grid-template-columns: 1fr; gap: 2.2rem; }
  .steps li:not(:last-child)::after { content: "↓"; top: auto; right: auto; bottom: -1.95rem; left: 50%; transform: translateX(-50%); }
  .steps li:nth-child(2)::after { content: "↓"; }
}

/* Napomene za primenu (AN-xx) */
.pains { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5px; background: var(--ink); border: 2px solid var(--ink); counter-reset: an; }
.pain { counter-increment: an; padding: 1.2rem 1.25rem 1.35rem; background: var(--sheet); }
.pain::before { content: "AN-" counter(an, decimal-leading-zero); display: block; margin-bottom: 0.55rem; font: 600 12px var(--mono); letter-spacing: 0.08em; color: var(--accent-ink); }
.pains.plain .pain::before { content: none; }
.pain-q { margin-bottom: 0.6rem; font: 760 1.22rem/1.22 var(--sans); font-stretch: 75%; color: var(--ink); }
.pain p:last-child { margin: 0; font-size: 15px; line-height: 1.55; }
@media (max-width: 1000px) { .pains { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .pains { grid-template-columns: 1fr; } }

/* ---------- Tabele ---------- */
.tbl { margin: 1.75rem 0 2rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl::before { counter-increment: tbl; content: "Tabela " counter(tbl); display: block; margin-bottom: 0.4rem; font: 600 11.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
html:lang(en) .tbl::before { content: "Table " counter(tbl); }
.fig-data .tbl::before { content: none; counter-increment: none; }
table { width: 100%; border-collapse: collapse; border: 2px solid var(--ink); font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums; }
th, td { padding: 0.55rem 0.75rem; text-align: left; vertical-align: top; border: 1px solid var(--rule); }
thead th { background: var(--sheet-2); border-bottom: 2px solid var(--ink); font: 700 11.5px/1.35 var(--sans); font-stretch: 87.5%; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); white-space: nowrap; }
tbody th { font-weight: 650; color: var(--ink); }
tbody tr:hover > * { background: var(--sheet-2); }
caption { caption-side: bottom; padding-top: 0.55rem; text-align: left; font-size: 13px; color: var(--muted); }
.tbl-wide table { min-width: 680px; }
.pill { display: inline-block; padding: 0 0.5rem; border: 1.5px solid var(--ink); font: 600 11.5px/1.6 var(--mono); text-transform: uppercase; white-space: nowrap; }
.pill.hi { background: var(--accent); color: var(--on-accent); }

/* ---------- Slike i grafici ---------- */
.fig { margin: 2rem 0 2.25rem; min-width: 0; }
.fig > figcaption { margin-top: 0.7rem; padding-top: 0.55rem; border-top: 1px solid var(--rule); font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.fig > figcaption::before { counter-increment: fig; content: "Slika " counter(fig) ". "; font-weight: 750; color: var(--ink); }
html:lang(en) .fig > figcaption::before { content: "Figure " counter(fig) ". "; }
.fig-data { margin-top: 0.6rem; font-size: 14px; }
.fig-data > summary { cursor: pointer; width: fit-content; font: 600 12.5px var(--mono); color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.fig-data .tbl { margin: 0.75rem 0 0; }

.chart { position: relative; width: 100%; aspect-ratio: var(--ar, 16 / 9); min-height: 250px; max-height: 430px; }
.chart svg { width: 100%; height: 100%; overflow: visible; font: 12px var(--sans); font-variant-numeric: tabular-nums; }
.chart svg:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); }
.chart .ttl { fill: var(--muted); font: 600 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.chart .lbl { fill: var(--ink-2); font-weight: 600; }
.chart .val { fill: var(--ink); font-weight: 700; }
.chart .ref { stroke: var(--ink-2); stroke-width: 1; opacity: 0.45; }
.chart .ref-l { fill: var(--muted); font-size: 11.5px; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--sheet); stroke-width: 2; }
.chart .xh { stroke: var(--ink-2); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .row.dim .bar { opacity: 0.35; }
.chart .nojs { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 1rem; border: 1px dashed var(--rule); font-size: 14px; color: var(--muted); text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; margin-bottom: 0.5rem; font-size: 13.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 18px; height: 3px; margin-right: 0.45rem; vertical-align: middle; border-radius: 2px; }
.tip { position: absolute; z-index: 5; min-width: 9.5rem; padding: 0.45rem 0.65rem 0.5rem; background: var(--sheet); border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font-size: 13px; line-height: 1.4; pointer-events: none; }
.tip .h { margin-bottom: 0.2rem; font: 600 11.5px var(--mono); color: var(--muted); }
.tip .r { display: flex; align-items: center; gap: 0.45rem; }
.tip .r i { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.tip .r b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tip .r span { color: var(--muted); }

/* Blok dijagram (HTML, preliva se na mobilnom) */
.flow { padding: 1.4rem 1.1rem 1.1rem; border: 2px dashed var(--ink); position: relative; }
.flow-t { position: absolute; top: -0.8em; left: 1rem; padding: 0.1rem 0.5rem; background: var(--ink); color: var(--sheet); font: 600 11.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.lane + .lane { margin-top: 1.4rem; }
.lane-t { margin: 0 0 0.5rem; font: 600 12px var(--mono); letter-spacing: 0.06em; color: var(--accent-ink); text-transform: uppercase; }
.flow-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.6rem; margin: 0; padding: 0; list-style: none; }
.flow-row li { position: relative; padding: 0.6rem 0.7rem; border: 1.5px solid var(--ink); background: var(--sheet); font-weight: 700; font-stretch: 87.5%; font-size: 15px; line-height: 1.25; color: var(--ink); }
.flow-row li small { display: block; margin-top: 0.2rem; font: 400 12.5px/1.35 var(--mono); color: var(--muted); }
.flow-row li.hl { background: var(--accent); color: var(--on-accent); }
.flow-row li.hl small { color: var(--on-accent); }
.flow-row li:not(:last-child)::after { content: "→"; position: absolute; top: 50%; right: -1.35rem; transform: translateY(-50%); font: 700 1.2rem/1 var(--sans); color: var(--ink); }
@media (max-width: 700px) {
  .flow-row { grid-template-columns: 1fr; gap: 1.3rem; }
  .flow-row li:not(:last-child)::after { content: "↓"; top: auto; right: auto; bottom: -1.3rem; left: 1rem; transform: none; }
}

/* ---------- Unutrašnje strane ---------- */
.page-head { padding-block: 1.1rem clamp(1.75rem, 4vw, 2.75rem); border-bottom: 1.5px solid var(--ink); }
.crumbs { margin-bottom: clamp(1.25rem, 3vw, 2rem); font: 12.5px/1.4 var(--mono); color: var(--muted); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.crumbs li + li::before { content: "›"; margin-right: 0.4rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration-color: var(--rule); }
.page-head h1 { max-width: 24ch; }
.page-head .lede { margin-top: 1rem; }
.byline { display: flex; flex-wrap: wrap; gap: 0.2rem 1.25rem; margin-top: 1.1rem; font: 13px/1.5 var(--mono); color: var(--muted); }
.byline b { color: var(--ink-2); }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(2rem, 4vw, 4rem); padding-block: clamp(2rem, 4vw, 3rem); }
.toc { position: sticky; top: 66px; align-self: start; border: 2px solid var(--ink); background: var(--sheet); }
.toc > p { margin: 0; padding: 0.45rem 0.8rem; background: var(--ink); color: var(--sheet); font: 600 11.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.toc ol { margin: 0; padding: 0.35rem 0; list-style: none; counter-reset: t; }
.toc li { counter-increment: t; }
.toc a { display: grid; grid-template-columns: 1.7rem 1fr; padding: 0.32rem 0.8rem; font-size: 14.5px; line-height: 1.3; color: var(--ink-2); text-decoration: none; }
.toc a::before { content: counter(t); font: 600 12.5px/1.5 var(--mono); color: var(--muted); }
.toc a:hover, .toc a[aria-current] { background: var(--accent); color: var(--on-accent); }
.toc a:hover::before, .toc a[aria-current]::before { color: inherit; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc ol { columns: 2; column-gap: 0; }
}
@media (max-width: 480px) { .toc ol { columns: 1; } }

.prose { min-width: 0; }
.prose > :not(.tbl):not(.fig) { max-width: var(--measure); }
.prose > h2 { margin-top: 2.6rem; padding-top: 0.85rem; border-top: 3px solid var(--ink); }
.prose > .answer + h2 { margin-top: 0; }
.prose h3 { margin-top: 1.75rem; }
.prose ul, .prose ol { margin: 0 0 1.25em; padding-left: 1.25rem; }
.prose ul { list-style: square; }
.prose li { margin-bottom: 0.5em; }
.prose li::marker { color: var(--accent); font-weight: 700; }

.answer { position: relative; margin: 0.6rem 0 2.6rem; padding: 1.45rem 1.4rem 1.2rem; background: var(--sheet); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); font-size: 1.05rem; color: var(--ink); }
.answer p { margin: 0; }
.answer .lbl { position: absolute; top: -0.85em; left: 1rem; padding: 0.15rem 0.55rem; background: var(--accent); color: var(--on-accent); border: 1.5px solid var(--ink); font: 700 11.5px/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.note { margin: 1.5rem 0; padding: 0.85rem 1.1rem 0.9rem; border-left: 6px solid var(--accent); background: var(--sheet-2); font-size: 15.5px; }
.note::before { content: "Napomena"; display: block; margin-bottom: 0.2rem; font: 700 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink); }
.note p:last-child { margin: 0; }

pre { margin: 1.25rem 0 1.75rem; padding: 1.1rem 1.25rem; overflow-x: auto; background: var(--chip); color: var(--code-fg); border-left: 6px solid var(--accent); font: 13.5px/1.65 var(--mono); tab-size: 2; }
code { padding: 0.08em 0.35em; background: var(--sheet-2); font: 0.88em var(--mono); }
pre code { padding: 0; background: none; font-size: inherit; }
pre .c { color: #9a968a; }

.after { padding-bottom: clamp(3rem, 6vw, 4.5rem); }
.after > * + * { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.after > section > h2 { padding-top: 0.85rem; border-top: 3px solid var(--ink); font-size: clamp(1.4rem, 2.4vw, 1.8rem); }

/* ---------- Pitanja ---------- */
.faq { max-width: 940px; border: 2px solid var(--ink); counter-reset: q; }
.faq details { counter-increment: q; }
.faq details + details { border-top: 1px solid var(--rule); }
.faq summary { display: grid; grid-template-columns: 3rem minmax(0, 1fr) 1.5rem; align-items: baseline; padding: 0.95rem 1rem; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "P" counter(q); font: 600 13px var(--mono); color: var(--accent-ink); }
html:lang(en) .faq summary::before { content: "Q" counter(q); }
.faq summary::after { content: "+"; justify-self: end; font: 500 1.4rem/1 var(--mono); color: var(--ink); }
.faq details[open] summary { background: var(--sheet-2); }
.faq details[open] summary::after { content: "\2212"; }
.faq summary h3 { margin: 0; font-size: 1.16rem; line-height: 1.25; }
.faq summary:hover h3 { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.faq .a { max-width: 78ch; padding: 0.75rem 1.25rem 1.15rem 4rem; }
.faq .a p:last-child { margin: 0; }
@media (max-width: 600px) { .faq summary { grid-template-columns: 2.4rem minmax(0, 1fr) 1.5rem; } .faq .a { padding-left: 1rem; } }

/* ---------- Povezana dokumentacija ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }
.cards a { display: flex; flex-direction: column; padding: 1rem 1.1rem 1.15rem; background: var(--sheet); border: 2px solid var(--ink); color: var(--ink-2); text-decoration: none; transition: transform 0.1s, box-shadow 0.1s; }
.cards a:hover { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--accent); background: var(--sheet); color: var(--ink-2); }
.cards .k { font: 600 12px/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink); }
.cards b { display: block; margin: 0.5rem 0 0.4rem; font: 800 1.25rem/1.15 var(--sans); font-stretch: 75%; color: var(--ink); }
.cards span:last-child { font-size: 15px; line-height: 1.5; }
@media (max-width: 860px) { .cards { grid-template-columns: 1fr; } }

/* ---------- Poziv na akciju ---------- */
.cta { display: grid; grid-template-columns: minmax(0, 1.6fr) auto; gap: 1.5rem 3rem; align-items: center; padding: clamp(1.75rem, 4vw, 2.75rem); background: var(--accent); color: var(--on-accent); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.cta h2 { margin-bottom: 0.4rem; color: var(--on-accent); font-size: clamp(1.6rem, 3vw, 2.35rem); }
.cta h2::before { content: none !important; }
.cta p { margin: 0; color: var(--on-accent); }
.cta a:not(.btn) { color: var(--on-accent); text-decoration-color: var(--on-accent); }
.cta .btn, .cta .btn:hover { background: var(--ink); color: var(--sheet); border-color: var(--ink); box-shadow: 4px 4px 0 var(--sheet); }
.cta .btn:hover { box-shadow: 2px 2px 0 var(--sheet); }
@media (max-width: 760px) { .cta { grid-template-columns: 1fr; } }

/* ---------- Spisak dokumenata (Znanje) ---------- */
.posts { margin: 0; padding: 0; list-style: none; border: 2px solid var(--ink); }
.posts li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 0.5rem 1.75rem; padding: 1.35rem 1.25rem; }
.posts li + li { border-top: 1px solid var(--rule); }
.posts .meta { margin: 0; font: 12.5px/1.6 var(--mono); color: var(--muted); }
.posts .meta b { display: block; font-size: 15px; color: var(--ink); }
.posts h2 { margin-bottom: 0.35rem; font-size: clamp(1.3rem, 2.3vw, 1.6rem); }
.posts h2 a { text-decoration: none; }
.posts h2 a:hover { text-decoration: underline; text-decoration-color: var(--accent); background: none; color: var(--ink); }
.posts p { margin: 0; }
@media (max-width: 640px) { .posts li { grid-template-columns: 1fr; } }

/* ---------- Kratak pregled (EN naslovna) ---------- */
.brief { margin: 0; border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); background: var(--sheet); }
.brief > p { margin: 0; padding: 0.45rem 0.9rem; background: var(--ink); color: var(--sheet); font: 600 11.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.brief dl { margin: 0; }
.brief div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.75rem; padding: 0.75rem 0.9rem; }
.brief div + div { border-top: 1px solid var(--rule); }
.brief dt { font: 600 11.5px/1.5 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.brief dd { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--ink); }

/* ---------- Kalkulator ---------- */
.calc { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); background: var(--sheet); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.calc fieldset { min-width: 0; margin: 0; padding: 0 0 0.5rem; border: 0; }
.calc legend { float: left; width: 100%; padding: 0.5rem 1rem; background: var(--ink); color: var(--sheet); font: 600 11.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.f { clear: both; display: grid; grid-template-columns: minmax(0, 1fr) 8.5rem; gap: 0.75rem; align-items: center; padding: 0.5rem 1rem; border-bottom: 1px solid var(--rule); }
.f label { font-size: 15px; line-height: 1.3; color: var(--ink); }
.f label small { display: block; font-size: 12.5px; color: var(--muted); }
.f input { width: 100%; padding: 0.42rem 0.6rem; background: var(--sheet-2); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 0; font: 600 16px/1.3 var(--mono); text-align: right; }
.f input:focus { outline: 3px solid var(--accent); outline-offset: 0; }
.f input[aria-invalid="true"] { background: var(--accent); color: var(--on-accent); }
.presets { clear: both; display: flex; flex-wrap: wrap; gap: 0.45rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--rule); }
.presets button { padding: 0.4rem 0.7rem; background: var(--sheet); color: var(--ink); border: 1.5px solid var(--ink); font: 700 12.5px/1.2 var(--sans); font-stretch: 87.5%; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; }
.presets button:hover { background: var(--sheet-2); }
.presets button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.calc-out { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem 1.3rem 1.4rem; border-left: 2px solid var(--ink); }
.calc-out .kicker { margin: 0; color: var(--accent-ink); }
.verdict { margin: 0; font: 800 1.55rem/1.15 var(--sans); font-stretch: 75%; color: var(--ink); text-wrap: balance; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 0; background: var(--rule); border: 1px solid var(--rule); }
.kpis div { padding: 0.65rem 0.75rem; background: var(--sheet); }
.kpis dt { font: 600 10.5px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.kpis dd { margin: 0.15rem 0 0; font: 800 1.45rem/1.15 var(--sans); font-stretch: 75%; color: var(--ink); }
.kpis .k-api dd::before, .kpis .k-loc dd::before { content: ""; display: inline-block; width: 12px; height: 3px; margin-right: 0.4rem; vertical-align: middle; border-radius: 2px; }
.kpis .k-api dd::before { background: var(--c-api); }
.kpis .k-loc dd::before { background: var(--c-local); }
.calc-out .chart { --ar: 16 / 10; min-height: 220px; }
.calc-note { margin: 0; font-size: 14.5px; line-height: 1.55; }
.calc-out .cta-row { margin-top: 0.25rem; }
.calc-out .btn { padding: 0.75rem 1rem; font-size: 0.88rem; }
.calc-out .btn-g { background: var(--sheet); color: var(--ink); border-color: var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.calc-out .btn-p { box-shadow: 4px 4px 0 var(--ink); }
.copied { margin: 0; font-size: 13.5px; color: var(--muted); word-break: break-all; }
.calc > * { min-width: 0; }
@media (max-width: 980px) {
  .calc { grid-template-columns: minmax(0, 1fr); }
  .calc-out { border-left: 0; border-top: 2px solid var(--ink); }
}
@media (max-width: 460px) {
  .f { grid-template-columns: minmax(0, 1fr) 6.8rem; }
  .kpis { grid-template-columns: 1fr 1fr; }
}

/* ---------- Kontakt ---------- */
.contact { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); padding-block: clamp(2rem, 4vw, 3rem) clamp(3rem, 6vw, 4.5rem); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.25rem; align-content: start; padding: 1.4rem; border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.form .full { grid-column: 1 / -1; }
.form label { display: block; margin-bottom: 0.35rem; font: 600 11.5px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.form label small { color: var(--muted); text-transform: none; letter-spacing: 0; }
.form input, .form select, .form textarea { width: 100%; padding: 0.7rem 0.8rem; background: var(--sheet-2); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 0; font: 16px/1.4 var(--sans); }
.form textarea { min-height: 180px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 3px solid var(--accent); outline-offset: 0; }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin: 0; font-size: 15px; }
.form-note { margin: 0; font-size: 13.5px; color: var(--muted); }
.side > * + * { margin-top: 1.5rem; }
.side h2 { font-size: 1.35rem; }
.side ol { margin: 0; padding-left: 1.3rem; }
.side li { margin-bottom: 0.5rem; }
.side li::marker { color: var(--accent-ink); font-weight: 700; }
.side .box { padding: 1.1rem 1.25rem; border: 2px solid var(--ink); }
@media (max-width: 860px) { .contact { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .form { grid-template-columns: 1fr; padding: 1rem; } }

/* ---------- Podnožje: istorija revizija + obaveštenje ---------- */
.foot { margin-top: 0; padding-block: clamp(2.5rem, 5vw, 3.5rem) 1.5rem; border-top: 3px solid var(--ink); font-size: 15px; }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 2rem; }
.foot-id p { max-width: 40ch; margin: 1rem 0; }
.foot-h { margin-bottom: 0.7rem; font: 600 11.5px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.foot ul { margin: 0; padding: 0; list-style: none; }
.foot li { margin-bottom: 0.45rem; }
.foot nav a { color: var(--ink-2); text-decoration-color: var(--rule); }
.foot nav a:hover { color: var(--on-accent); }
.foot .code { font: 600 12px var(--mono); color: var(--muted); margin-right: 0.35rem; }
.foot-doc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 2rem; margin-top: 2.25rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.rev { font-size: 13px; border-width: 1.5px; }
.rev th, .rev td { padding: 0.35rem 0.6rem; }
.foot-doc p { margin: 0; font-size: 13.5px; color: var(--muted); }
.foot-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; margin-top: 1.75rem; padding-top: 1rem; border-top: 1.5px solid var(--ink); font: 12.5px/1.5 var(--mono); color: var(--muted); }
.foot-base a { color: var(--muted); }
@media (max-width: 860px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-id { grid-column: 1 / -1; }
  .foot-doc { grid-template-columns: 1fr; }
}

/* ---------- Pokret i štampa ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn, .cards a { transition: none; }
}
@media print {
  .mast, .toc, .cta, .calc-out .cta-row, .fig-data, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .layout { display: block; }
  a { text-decoration: none; }
}
