/* ============================================
   TRAILbuddy · Base styles
   Reset, typografia, body pozadie.
   ============================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Obrázky nikdy nesmú byť širšie ako ich kontajner */
img, video, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

html {
  font-size: 100%; /* rem base — inherits browser default 16px */
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  background: var(--earth);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== TOPOGRAFICKÉ POZADIE =====
   Dve vrstvy — gradient glow + vrstevnice.
   Pevné, neroluje s obsahom. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(255, 90, 31, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(90, 107, 58, 0.12) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='600' viewBox='0 0 600 600'><g fill='none' stroke='%23f4ede0' stroke-width='0.5' opacity='0.06'><path d='M0,300 Q150,200 300,280 T600,250'/><path d='M0,320 Q150,230 300,310 T600,290'/><path d='M0,340 Q150,260 300,340 T600,330'/><path d='M0,360 Q150,290 300,370 T600,370'/><path d='M0,380 Q150,320 300,400 T600,410'/><path d='M0,280 Q150,170 300,250 T600,210'/><path d='M0,260 Q150,140 300,220 T600,170'/><path d='M0,240 Q150,110 300,190 T600,130'/></g></svg>");
  background-size: 800px 800px;
  pointer-events: none;
  z-index: 0;
}

/* Filmové zrnko cez celú appku */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-grain);
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ===== TYPOGRAFIA ===== */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p  { line-height: var(--lh-normal); }

a {
  color: var(--signal);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--signal-2); }

strong, b { font-weight: 700; color: var(--bone); }

/* Mono pre kódové a technické texty */
code, .mono {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}

/* ===== ACCESSIBILITY ===== */
:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Utility: skryť bez straty accessibility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Utility: hide elementu */
.hidden { display: none !important; }

/* ===== SCROLLBAR (webkit only, iné browsery default) ===== */
::-webkit-scrollbar        { width: 10px; height: 10px; }
::-webkit-scrollbar-track  { background: var(--earth-2); }
::-webkit-scrollbar-thumb  { background: var(--earth-4); border-radius: var(--r-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--bone-ghost); }

/* ===== ROOT APP CONTAINER ===== */
.app {
  position: relative;
  z-index: var(--z-base);
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  /* minmax(0,1fr): explicitná kolóna zabraňuje nafúknutiu grid tracku nad šírku kontajnera.
     Bez tohto auto-sizing kolóna expanduje na intrinsic content width (507px bug). */
  grid-template-columns: minmax(0, 1fr);
  /* overflow-x:hidden tu NIE je — urobilo by z .app scroll container a rozbilo by
     position:sticky na .app-header. Viewport overflow riadi body. */
}
