*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { background: var(--bg); color: var(--text); font-family: var(--font-body);
  font-size: var(--fs-body); line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--primary); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: var(--content); margin: 0 auto; padding: 0 var(--gutter); }
.icon { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.skip { position: absolute; left: var(--s-4); top: -60px; background: var(--primary); color: var(--primary-ink);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); z-index: 100; font-weight: 600; text-decoration: none; }
.skip:focus { top: var(--s-4); }

/* Oznaka praznog mjesta */
.todo { background: var(--accent-soft); color: var(--accent); border: 1px dashed var(--accent);
  border-radius: 6px; padding: 0 6px; font-weight: 600; font-size: .92em; white-space: nowrap; }
.label { font-size: var(--fs-label); line-height: 1.4; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 700; color: var(--primary); }

/* Gumbi */
.btn { display: inline-flex; align-items: center; gap: var(--s-2); height: 48px; padding: 0 var(--s-5);
  border-radius: var(--r-pill); font: 600 var(--fs-body) var(--font-body); text-decoration: none;
  border: 1px solid transparent; cursor: pointer; transition: background .15s, color .15s; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-light { background: #fff; color: #1E2422; }
.btn-light:hover { background: #EDE7DC; }
.btn-ghost-light { color: #fff; border-color: rgba(255,255,255,.45); background: transparent; }
.btn-ghost-light:hover { background: rgba(255,255,255,.12); }

/* Navigacija */
.nav { position: fixed; inset: 0 0 auto 0; z-index: 50; transition: background .2s, border-color .2s;
  border-bottom: 1px solid transparent; }
.nav .wrap { display: flex; align-items: center; gap: var(--s-5); height: 72px; }
.brand { display: flex; align-items: center; gap: var(--s-3); color: #fff; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  border: 1.5px solid currentColor; font-family: var(--font-display); font-size: 20px; }
.brand b { font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 1.1; display: block; }
.brand small { font-size: 12px; opacity: .8; }
.nav-links { display: flex; gap: var(--s-5); margin-left: auto; list-style: none; padding: 0; }
.nav-links a { color: #fff; text-decoration: none; font-weight: 600; font-size: var(--fs-small); opacity: .9; }
.nav-links a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 6px; }
.nav .btn { height: 40px; padding: 0 var(--s-4); font-size: var(--fs-small); }
.nav.scrolled { background: var(--bg); border-color: var(--line); }
.nav.scrolled .brand, .nav.scrolled .nav-links a { color: var(--text); }
.nav.scrolled .btn-light { background: var(--primary); color: var(--primary-ink); }
@media (max-width: 860px) { .nav-links { display: none; } .nav .btn { margin-left: auto; } }

/* Hero */
.hero { position: relative; min-height: min(92vh, 820px); display: flex; align-items: flex-end;
  color: #fff; background: var(--hero-fallback); overflow: hidden; }
.hero-photo { position: absolute; inset: 0; display: grid; place-items: center;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 2px, transparent 2px 22px),
    radial-gradient(120% 90% at 70% 10%, #4A6B60 0%, #2B3A35 55%, #1A2421 100%); }
.hero-photo .ph-note { position: absolute; top: 96px; right: var(--gutter); }
.hero::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(14,22,19,0) 35%, rgba(14,22,19,.72) 100%); }
.hero .wrap { position: relative; z-index: 1; padding-bottom: var(--s-9); padding-top: 140px; }
.hero .label { color: rgba(255,255,255,.85); }
.hero h1 { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-display); line-height: 1.02;
  letter-spacing: -.01em; margin: var(--s-4) 0 var(--s-5); max-width: 14ch; }
.hero p { font-size: var(--fs-body-lg); max-width: 46ch; color: rgba(255,255,255,.88); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }

/* Mjesto za fotografiju */
.ph { background: var(--placeholder); color: var(--placeholder-ink); display: grid; place-items: center;
  text-align: center; border-radius: var(--r-lg); padding: var(--s-5);
  background-image: repeating-linear-gradient(135deg, rgba(0,0,0,.03) 0 2px, transparent 2px 18px); }
.ph-note { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-small); font-weight: 600;
  background: rgba(0,0,0,.35); color: #fff; padding: 6px 12px; border-radius: var(--r-pill); }
.ph .ph-inner { display: grid; gap: var(--s-2); justify-items: center; font-size: var(--fs-small); font-weight: 600; }
.ph .icon { width: 28px; height: 28px; }

/* Činjenice */
.facts { background: var(--surface); border-bottom: 1px solid var(--line); }
.facts dl { display: grid; grid-template-columns: repeat(4, 1fr); }

.facts dl > div { padding: var(--s-6) var(--s-5); border-left: 1px solid var(--line); }
.facts dl > div:first-child { border-left: 0; padding-left: 0; }
.facts dt { font-size: var(--fs-label); letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.facts dd { font-size: 18px; font-weight: 600; margin-top: var(--s-1); font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .facts dl { grid-template-columns: 1fr 1fr; }
  .facts dl > div { border-left: 0; padding: var(--s-5) 0; border-top: 1px solid var(--line); }
  .facts dl > div:nth-child(-n+2) { border-top: 0; }
  .facts dl > div:nth-child(even) { padding-left: var(--s-4); border-left: 1px solid var(--line); }
}

/* Sekcije */
section.block { padding: var(--section) 0; }
.sec-head { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6); align-items: end; margin-bottom: var(--s-7); }
.sec-head h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-h1); line-height: 1.1; margin-top: var(--s-3); }
.sec-head p { color: var(--text-muted); max-width: 52ch; }
@media (max-width: 860px) { .sec-head { grid-template-columns: 1fr; gap: var(--s-3); } }

/* Hitni */
.emergency { display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--s-5); }
.em-national { background: var(--accent-soft); border-radius: var(--r-lg); padding: var(--s-6); }
.em-big { display: flex; align-items: center; justify-content: space-between; text-decoration: none;
  color: var(--accent); padding-bottom: var(--s-5); border-bottom: 1px solid rgba(181,72,47,.25); margin-bottom: var(--s-3); }
.em-big span { font-weight: 600; color: var(--text); }
.em-big b { font-family: var(--font-display); font-weight: 600; font-size: 64px; line-height: 1; }
.em-list { list-style: none; padding: 0; }
.em-list a { display: flex; justify-content: space-between; align-items: center; gap: var(--s-4);
  padding: var(--s-3) 0; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.em-national .em-list a { border-color: rgba(181,72,47,.18); }
.em-list li:last-child a { border-bottom: 0; }
.em-list b { font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.em-list a:hover b { color: var(--primary); }
.em-building { background: var(--surface); border-radius: var(--r-lg); padding: var(--s-6); box-shadow: var(--shadow-1); border: 1px solid var(--line); }
.em-building h3, .em-national h3 { font-size: var(--fs-h3); margin-bottom: var(--s-4); }
.em-hint { font-size: var(--fs-small); color: var(--text-muted); margin-top: var(--s-4); }
@media (max-width: 860px) { .emergency { grid-template-columns: 1fr; } .em-big b { font-size: 52px; } }

/* Kontakti */
.contacts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: var(--s-6); }
.card .role { font-size: var(--fs-small); color: var(--text-muted); }
.card h3 { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-h2); line-height: 1.2; margin: var(--s-2) 0 var(--s-5); }
.rows { list-style: none; padding: 0; }
.rows li { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3) 0; border-top: 1px solid var(--line); }
.rows .icon { color: var(--primary); }
.rows a { color: var(--text); text-decoration: none; }
.rows a:hover { color: var(--primary); text-decoration: underline; }
@media (max-width: 860px) { .contacts { grid-template-columns: 1fr; } }

/* Galerija */
.gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 240px 240px; gap: var(--s-4); }
.gallery .ph:first-child { grid-row: span 2; }
.gallery .ph:nth-child(4) { grid-column: span 2; }
@media (max-width: 860px) {
  .gallery { grid-template-columns: 1fr 1fr; grid-template-rows: 220px 160px 160px; }
  .gallery .ph:first-child { grid-column: span 2; grid-row: auto; }
  .gallery .ph:nth-child(4) { grid-column: span 2; }
}

/* Za stanare */
.residents { background: var(--primary); color: var(--primary-ink); border-radius: var(--r-lg); padding: var(--s-8);
  display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--s-7); }
.residents .label { color: inherit; opacity: .8; }
.residents h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-h1); line-height: 1.1; margin: var(--s-3) 0 var(--s-4); }
.residents p { opacity: .88; max-width: 46ch; }
.residents .btn { margin-top: var(--s-6); background: var(--primary-ink); color: var(--primary); }
.residents .btn:hover { opacity: .92; }
.features { list-style: none; padding: 0; display: grid; gap: var(--s-4); align-content: center; }
.features li { display: flex; gap: var(--s-4); align-items: flex-start; }
.features .fi { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255,255,255,.12); flex-shrink: 0; }
.features b { display: block; }
.features span { opacity: .82; font-size: var(--fs-small); }
.steps { counter-reset: s; list-style: none; padding: 0; margin-top: var(--s-5); display: grid; gap: var(--s-2); font-size: var(--fs-small); }
.steps li { counter-increment: s; display: flex; gap: var(--s-3); align-items: center; opacity: .92; }
.steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid currentColor; font-weight: 700; font-size: 12px; flex-shrink: 0; }
@media (max-width: 860px) { .residents { grid-template-columns: 1fr; padding: var(--s-6) var(--s-5); gap: var(--s-6); } }

/* Podnožje */
footer { background: var(--surface-2); margin-top: var(--section); padding: var(--s-7) 0; font-size: var(--fs-small); color: var(--text-muted); }
footer .wrap { display: flex; flex-wrap: wrap; gap: var(--s-5); align-items: center; justify-content: space-between; }
footer b { color: var(--text); font-family: var(--font-display); font-weight: 500; font-size: 18px; }
.foot-links { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; text-align: right; }
.foot-links a { color: var(--text-muted); }
.foot-links a:hover { color: var(--text); }
.foot-autor { font-size: 12px; opacity: .75; }
.app-main + .podnozje { margin-top: 0; padding: var(--s-6) 0; }
@media (max-width: 640px) { .foot-links { align-items: flex-start; text-align: left; } }
.theme-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; background: var(--surface); }
.theme-toggle button { border: 0; background: transparent; color: var(--text-muted); font: 600 13px var(--font-body);
  padding: 6px 12px; border-radius: var(--r-pill); cursor: pointer; }
.theme-toggle button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }

/* Ulazak sekcija */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .4s ease, transform .4s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* Popravci nakon provjere */
.nav nav { margin-left: auto; }
.nav-links { margin-left: 0; }
.hero :focus-visible, .nav:not(.scrolled) :focus-visible, .residents :focus-visible { outline-color: #fff; }
@media (max-width: 420px) { .brand small { display: none; } }

.em-locked { display: flex; flex-direction: column; gap: var(--s-4); }
.em-locked h3 { margin-bottom: 0; }
.em-lead { display: flex; gap: var(--s-3); color: var(--text-muted); }
.em-lead .icon { color: var(--primary); margin-top: 3px; }
.em-list small { color: var(--text-muted); font-size: var(--fs-small); }
.em-locked .btn { align-self: flex-start; margin-top: auto; }

/* Hero s uspravnom fotografijom */
.hero { align-items: center; min-height: auto; }
.hero::after { display: none; }
.hero-bg { position: absolute; inset: 0;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.03) 0 2px, transparent 2px 22px),
    radial-gradient(110% 90% at 80% 20%, #4A6B60 0%, #2B3A35 55%, #1A2421 100%); }
.hero .wrap.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--s-8); align-items: center;
  padding-top: 132px; padding-bottom: var(--s-9); }
.hero-figure { margin: 0; justify-self: end; width: min(100%, 400px); position: relative; }
.hero-figure img { width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.hero-figure::before { content: ""; position: absolute; inset: -14px 14px 14px -14px; border: 1px solid rgba(255,255,255,.25);
  border-radius: calc(var(--r-lg) + 6px); z-index: -1; }
@media (max-width: 860px) {
  .hero .wrap.hero-grid { grid-template-columns: 1fr; gap: var(--s-7); padding-top: 104px; padding-bottom: var(--s-8); }
  .hero-figure { justify-self: start; width: min(100%, 340px); }
}

/* Fotografija u galeriji */
.g-photo { margin: 0; border-radius: var(--r-lg); overflow: hidden; background: var(--placeholder); }
.g-photo picture, .g-photo img { width: 100%; height: 100%; }
.g-photo img { object-fit: cover; }
.gallery .g-photo:first-child { grid-row: span 2; }
@media (max-width: 860px) { .gallery .g-photo:first-child { grid-column: span 2; grid-row: auto; } }
.hero-figure { isolation: isolate; }
@media (max-width: 860px) { .hero-figure::before { inset: -10px 10px 10px -10px; } .hero-figure { margin-left: 10px; } }

/* Prijava problema */
.report { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
.report-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); }
.report-city { border-top: 4px solid var(--primary); }
.report-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.logo-slot { height: 56px; min-width: 150px; max-width: 200px; display: grid; place-items: center; border-radius: var(--r-sm);
  border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: var(--fs-small); }
.logo-slot img { max-height: 56px; width: auto; }
.report-tag { font-size: var(--fs-label); letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  color: var(--primary); background: var(--primary-soft); padding: 4px 10px; border-radius: var(--r-pill); white-space: nowrap; }
.report-card h3 { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-h2); line-height: 1.2; }
.report-what { color: var(--text-muted); }
.report-card .btn { align-self: flex-start; }
.report-card .em-list b.small { font-size: var(--fs-small); font-weight: 600; }
.report-note { display: flex; gap: var(--s-3); font-size: var(--fs-small); color: var(--text-muted); margin-top: auto; }
.report-note .icon { color: var(--primary); width: 18px; height: 18px; margin-top: 2px; }
@media (max-width: 860px) { .report { grid-template-columns: 1fr; } .report-card { padding: var(--s-5); } }
.logo-slot.has-logo { background: #fff; border: 1px solid var(--line); padding: 8px 14px; height: 72px; min-width: 0; }
.logo-slot.has-logo img { height: 54px; max-height: none; width: auto; }

/* Samo tamni izgled: duboka zelena za istaknute površine */
.residents { background: radial-gradient(120% 120% at 85% 0%, #3E6157 0%, var(--deep) 60%); color: var(--deep-ink); border: 1px solid #355a50; }
.residents .btn { background: #fff; color: #1E2422; }
.residents .btn:hover { background: #EDE7DC; opacity: 1; }

/* Podloga naslovnice: Varaždin iz zraka */
.hero-bg { background:
    linear-gradient(90deg, rgba(16,26,23,.88) 0%, rgba(16,26,23,.55) 45%, rgba(16,26,23,.18) 100%),
    url('../img/hero-varazdin.jpg') center 40% / cover no-repeat;
  background:
    linear-gradient(90deg, rgba(16,26,23,.88) 0%, rgba(16,26,23,.55) 45%, rgba(16,26,23,.18) 100%),
    image-set(url('../img/hero-varazdin.webp') type('image/webp'), url('../img/hero-varazdin.jpg') type('image/jpeg')) center 40% / cover no-repeat; }
@media (max-width: 860px) {
  .hero-bg { background:
      linear-gradient(180deg, rgba(16,26,23,.80) 0%, rgba(16,26,23,.70) 60%, rgba(16,26,23,.85) 100%),
      url('../img/hero-varazdin.jpg') 45% center / cover no-repeat; }
}
.residents { background:
    linear-gradient(120deg, rgba(20,38,33,.94) 0%, rgba(26,48,42,.80) 60%, rgba(26,48,42,.55) 100%),
    url('../img/hero-varazdin.jpg') center 60% / cover no-repeat; }
body:has(> .app-main) { min-height: 100vh; display: flex; flex-direction: column; }
body:has(> .app-main) > .app-main { flex: 1 0 auto; }

/* Javni izbornik na mobitelu: gumb Prijava uvijek ostaje na ekranu */
@media (max-width: 860px) {
  .nav nav { display: none; }
  .nav .wrap { gap: var(--s-3); }
  .nav .brand { min-width: 0; flex: 1 1 auto; }
  .nav .brand > span:last-child { min-width: 0; overflow: hidden; }
  .nav .brand b, .nav .brand small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav .brand-mark { flex-shrink: 0; }
  .nav .btn { flex-shrink: 0; }
}
@media (max-width: 380px) { .nav .btn { padding: 0 12px; } .nav .btn .icon { display: none; } }
@media (max-width: 640px) {
  .contacts { grid-template-columns: minmax(0, 1fr); }
  .contacts .card { padding: var(--s-5); min-width: 0; }
}
.rows li > :not(svg) { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 860px) { .nav .brand b { white-space: normal; overflow: visible; line-height: 1.05; } }
@media (max-width: 420px) { .nav .brand b { font-size: 18px; } }
