/* ============================================================
   Škola — zajednički stil
   Izgled: "knjiga sa naljepnicama" — papir, debele konture,
   tvrde sjene, boje iz udžbenika (zelena, plava, koral, sunce)
   ============================================================ */

@font-face {
  font-family: "Baloo 2";
  src: url("../fonts/Baloo2.ttf") format("truetype");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("../fonts/Nunito.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --papir: #fdf6e7;
  --papir-2: #fff;
  --tinta: #2a2340;
  --tinta-meka: #5b5375;
  --zelena: #1f9d61;
  --zelena-t: #0f6b40;
  --zelena-s: #d7f3e3;
  --plava: #2f80ed;
  --plava-s: #d9e9ff;
  --koral: #f2655a;
  --koral-s: #ffe0dc;
  --sunce: #ffc23d;
  --sunce-s: #fff1c9;
  --lila: #a77be0;
  --lila-s: #efe4ff;
  --ruza: #f48fb1;

  --rub: 3px solid var(--tinta);
  --sjena: 4px 4px 0 var(--tinta);
  --sjena-v: 7px 7px 0 var(--tinta);
  --r: 22px;
  --r-m: 14px;

  --font-naslov: "Baloo 2", ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --font-tekst: "Nunito", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --font-arapski: "Traditional Arabic", "Geeza Pro", "Noto Naskh Arabic", "Arial", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-tekst);
  font-size: clamp(17px, 1.1vw + 12px, 20px);
  line-height: 1.5;
  color: var(--tinta);
  background-color: var(--papir);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='84'%3E%3Cg fill='none' stroke='%231f9d61' stroke-opacity='.11' stroke-width='2'%3E%3Crect x='27' y='27' width='30' height='30'/%3E%3Crect x='27' y='27' width='30' height='30' transform='rotate(45 42 42)'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(circle at 15% 0%, #fff4d6 0, transparent 45%),
    radial-gradient(circle at 100% 100%, #e3f4ea 0, transparent 40%);
  background-attachment: fixed;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-naslov); line-height: 1.1; margin: 0 0 .4em; letter-spacing: .01em; }
h1 { font-size: clamp(2rem, 4vw + 1rem, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 2vw + 1rem, 2.3rem); font-weight: 800; }
h3 { font-size: clamp(1.2rem, 1vw + 1rem, 1.6rem); font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img, svg { max-width: 100%; }

.omot { width: min(1180px, 100% - 32px); margin-inline: auto; }
.omot-usko { width: min(860px, 100% - 32px); margin-inline: auto; }

/* ---------- Gornja traka ---------- */
.traka {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--papir) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: var(--rub);
}
.traka-unutra {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding-block: 8px;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-naslov); font-weight: 800; font-size: 1.45rem;
  text-decoration: none; white-space: nowrap;
}
.logo-znak {
  display: grid; place-items: center;
  width: 42px; height: 42px; border: var(--rub); border-radius: 12px;
  background: var(--sunce); box-shadow: 3px 3px 0 var(--tinta);
  transform: rotate(-6deg); font-size: 1.3rem;
}
.mrvice {
  display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center;
  font-weight: 700; font-size: .92rem; color: var(--tinta-meka);
  min-width: 0;
}
.mrvice a { text-decoration: none; padding: 2px 8px; border-radius: 999px; }
.mrvice a:hover { background: var(--sunce-s); color: var(--tinta); }
.mrvice span[aria-hidden] { opacity: .5; }
.zvjezdice-brojac {
  margin-left: auto; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 14px; border: var(--rub); border-radius: 999px;
  background: var(--sunce-s); box-shadow: 3px 3px 0 var(--tinta);
  font-family: var(--font-naslov); font-weight: 800; font-size: 1.15rem;
}
.zvjezdice-brojac .z { font-size: 1.2rem; }
.zvjezdice-brojac.skok { animation: skok .6s ease; }

@media (max-width: 640px) {
  .logo-tekst { display: none; }
  .mrvice { font-size: .82rem; }
}

/* ---------- Dugmad ---------- */
.dugme {
  --boja: var(--sunce);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 22px;
  border: var(--rub); border-radius: 999px;
  background: var(--boja); color: var(--tinta);
  box-shadow: var(--sjena);
  font-family: var(--font-naslov); font-weight: 800; font-size: 1.1rem;
  text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  touch-action: manipulation; user-select: none;
}
.dugme:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--tinta); }
.dugme:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--tinta); }
.dugme:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: var(--sjena); }
.dugme.zelena { --boja: var(--zelena); color: #fff; }
.dugme.plava { --boja: var(--plava); color: #fff; }
.dugme.koral { --boja: var(--koral); color: #fff; }
.dugme.bijela { --boja: #fff; }
.dugme.lila { --boja: var(--lila); color: #fff; }
.dugme.malo { min-height: 42px; padding: 6px 16px; font-size: 1rem; }

:focus-visible { outline: 4px solid var(--plava); outline-offset: 3px; }

/* dugme za čitanje naglas — vidljivo samo kad uređaj ima odgovarajući glas (bs ili en) */
.govori {
  display: none;
  width: 44px; height: 44px; flex-shrink: 0;
  align-items: center; justify-content: center;
  border: var(--rub); border-radius: 50%;
  background: #fff; box-shadow: 3px 3px 0 var(--tinta);
  font-size: 1.15rem; cursor: pointer;
}
.ima-glas-bs .govori-bs, .ima-glas-en .govori-en, .govori.ima-snimak { display: inline-flex; }
.govori:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--tinta); }

/* ---------- Kartice / naljepnice ---------- */
.naljepnica {
  position: relative;
  background: var(--papir-2);
  border: var(--rub); border-radius: var(--r);
  box-shadow: var(--sjena);
  padding: clamp(18px, 2.4vw, 30px);
}

.mreza {
  display: grid; gap: clamp(16px, 2vw, 26px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

.plocica {
  --boja: var(--sunce-s);
  --akcent: var(--sunce);
  position: relative; display: flex; flex-direction: column; gap: 8px;
  min-height: 190px; padding: 22px;
  background: var(--boja);
  border: var(--rub); border-radius: var(--r);
  box-shadow: var(--sjena);
  text-decoration: none;
  transition: transform .18s cubic-bezier(.3,1.6,.5,1), box-shadow .18s ease;
}
.plocica:nth-child(3n+1) { transform: rotate(-1.2deg); }
.plocica:nth-child(3n+2) { transform: rotate(.9deg); }
.plocica:nth-child(3n) { transform: rotate(-.4deg); }
.plocica:hover { transform: rotate(0) translate(-3px, -4px) scale(1.02); box-shadow: var(--sjena-v); }
.plocica:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--tinta); }
.plocica .ikona {
  display: grid; place-items: center;
  width: 64px; height: 64px; font-size: 2rem;
  background: var(--akcent); border: var(--rub); border-radius: 18px;
  box-shadow: 3px 3px 0 var(--tinta);
}
.plocica h3 { margin: 6px 0 0; }
.plocica p { margin: 0; color: var(--tinta-meka); font-weight: 600; font-size: .95rem; }
.plocica .zv { margin-top: auto; font-size: 1.15rem; letter-spacing: 2px; }
.plocica.zelena { --boja: var(--zelena-s); --akcent: #7fd6a6; }
.plocica.plava { --boja: var(--plava-s); --akcent: #8fbaf7; }
.plocica.koral { --boja: var(--koral-s); --akcent: #f9a49c; }
.plocica.lila { --boja: var(--lila-s); --akcent: #cdb0f2; }
.plocica.zakljucano { opacity: .6; pointer-events: none; filter: grayscale(.4); }
.oznaka {
  position: absolute; top: -14px; right: 16px;
  padding: 2px 12px; border: var(--rub); border-radius: 999px;
  background: var(--koral); color: #fff;
  font-family: var(--font-naslov); font-weight: 800; font-size: .9rem;
  transform: rotate(4deg);
}

/* ---------- Naslovni dio ---------- */
.uvod { padding-block: clamp(28px, 5vw, 60px) clamp(20px, 3vw, 36px); }
.uvod .nadnaslov {
  display: inline-block; margin-bottom: 12px;
  padding: 4px 14px; border: var(--rub); border-radius: 999px;
  background: #fff; font-weight: 800; font-size: .95rem;
  transform: rotate(-2deg);
}
.uvod p.podnaslov { font-size: 1.15em; font-weight: 600; color: var(--tinta-meka); max-width: 56ch; }
.istakni {
  background: linear-gradient(transparent 58%, var(--sunce) 58% 90%, transparent 90%);
  padding-inline: 4px;
}
.sekcija { padding-block: 10px 50px; }
.sekcija-naslov { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.sekcija-naslov .traka-boja {
  padding: 6px 18px; border: var(--rub); border-radius: 12px;
  background: var(--koral); color: #fff; box-shadow: 3px 3px 0 var(--tinta);
  font-family: var(--font-naslov); font-weight: 800; font-size: 1.15rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.sekcija-naslov .traka-boja.zelena { background: var(--zelena); }
.sekcija-naslov .traka-boja.plava { background: var(--plava); }
.sekcija-naslov .traka-boja.lila { background: var(--lila); }

/* ulazne animacije */
.ulaz > * { animation: ulaz .55s cubic-bezier(.2,1.3,.4,1) both; }
.ulaz > *:nth-child(1) { animation-delay: .03s; }
.ulaz > *:nth-child(2) { animation-delay: .09s; }
.ulaz > *:nth-child(3) { animation-delay: .15s; }
.ulaz > *:nth-child(4) { animation-delay: .21s; }
.ulaz > *:nth-child(5) { animation-delay: .27s; }
.ulaz > *:nth-child(6) { animation-delay: .33s; }
.ulaz > *:nth-child(7) { animation-delay: .39s; }
.ulaz > *:nth-child(8) { animation-delay: .45s; }
.ulaz > *:nth-child(9) { animation-delay: .51s; }
.ulaz > *:nth-child(n+10) { animation-delay: .57s; }

@keyframes ulaz { from { opacity: 0; translate: 0 26px; scale: .96; } }
@keyframes skok { 0%,100% { transform: scale(1); } 40% { transform: scale(1.25) rotate(-6deg); } }
@keyframes tresi { 0%,100% { translate: 0; } 20% { translate: -9px; } 40% { translate: 8px; } 60% { translate: -6px; } 80% { translate: 4px; } }
@keyframes iskoci { 0% { scale: .4; opacity: 0; } 70% { scale: 1.08; } 100% { scale: 1; opacity: 1; } }
@keyframes lebdi { 0%,100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.tresi { animation: tresi .45s ease; }
.iskoci { animation: iskoci .45s cubic-bezier(.2,1.4,.4,1) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Poruka (toast) ---------- */
.poruka {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  translate: -50% 0; z-index: 200;
  max-width: calc(100% - 32px);
  padding: 12px 22px; border: var(--rub); border-radius: 18px;
  background: #fff; box-shadow: var(--sjena);
  font-family: var(--font-naslov); font-weight: 800; font-size: 1.2rem; text-align: center;
  animation: iskoci .35s cubic-bezier(.2,1.4,.4,1) both;
}
.poruka.dobro { background: var(--zelena-s); }
.poruka.lose { background: var(--koral-s); }

/* ---------- Konfete ---------- */
.konfete { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.konfeta {
  position: absolute; top: -20px; width: 12px; height: 16px; border-radius: 3px;
  animation: padaj linear forwards;
}
@keyframes padaj { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Završni ekran ---------- */
.kraj {
  text-align: center; padding: clamp(24px, 4vw, 48px);
}
.kraj .velike-zvijezde { font-size: clamp(3rem, 8vw, 5rem); letter-spacing: 8px; margin-block: 10px; }
.kraj .velike-zvijezde span { display: inline-block; animation: iskoci .5s cubic-bezier(.2,1.4,.4,1) both; }
.kraj .velike-zvijezde span:nth-child(2) { animation-delay: .2s; }
.kraj .velike-zvijezde span:nth-child(3) { animation-delay: .4s; }
.kraj .velike-zvijezde .prazna { filter: grayscale(1); opacity: .3; }
.dugmad { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 18px; }

/* ---------- Podnožje ---------- */
.podnozje {
  margin-top: 40px; padding-block: 26px;
  border-top: var(--rub); text-align: center;
  font-weight: 700; color: var(--tinta-meka); font-size: .9rem;
}

.skriveno { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media print {
  body { background: #fff; font-size: 12pt; }
  .traka, .podnozje, .ne-printaj, .govori, .dugme { display: none !important; }
  .naljepnica, .plocica { box-shadow: none; }
}
