/* Reset, tipografija i layout ljuske */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100dvh;
  width: 100%;
  overflow-x: clip;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Suptilan grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, h4 {
  margin: 0;
  letter-spacing: var(--tracking-tight);
  line-height: 1.15;
}

p { margin: 0; }

a { color: inherit; }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

input,
select,
textarea {
  font-size: 16px; /* iOS: bez zumiranja */
}

button { cursor: pointer; }

svg { flex-shrink: 0; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- App ljuska ---------- */

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

.shell {
  display: flex;
  min-height: 100dvh;
}

.shell > * { min-width: 0; }

.main {
  flex: 1;
  min-width: 0;
  padding: calc(env(safe-area-inset-top) + var(--gutter)) var(--gutter)
    calc(env(safe-area-inset-bottom) + var(--nav-h) + 22px + 28px);
}

.main-inner {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}

.sidebar { display: none; }

@media (min-width: 1024px) {
  .main {
    padding: calc(env(safe-area-inset-top) + 32px) 32px calc(env(safe-area-inset-bottom) + 32px);
  }

  .sidebar { display: flex; }
}

/* Mreža kartica: 1 → 2 kolone */
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
