/* ==========================================================================
   base.css - Digitalna Agencija Beograd
   Modern reset + base element styles + layout utilities + prose.
   Depends on tokens.css. Dark navy theme.
   ========================================================================== */

/* ---- Modern reset (Comeau-derived, trimmed) ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  min-height: 100vh;
  overflow-x: hidden; /* safety net against accidental horizontal scroll; tables use their own .table-wrap */
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
ul, ol { list-style: none; padding: 0; }

/* ---- Headings ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-heading);
  letter-spacing: var(--tracking-heading);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  text-wrap: balance;
}
h1 { font-size: var(--text-4xl); font-weight: var(--weight-bold); line-height: var(--leading-none); }
h2 { font-size: var(--text-3xl); line-height: var(--leading-tight); }
h3 { font-size: var(--text-2xl); line-height: var(--leading-snug); }
h4 { font-size: var(--text-xl); line-height: var(--leading-snug); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--color-text-muted); }

/* ---- Links ---- */
a { color: var(--color-link); text-decoration: none; text-underline-offset: 0.18em; transition: color var(--dur-fast) var(--ease-state); }
a:hover { color: var(--color-link-hover); text-decoration: underline; }

/* ---- Focus (green ring, focus-visible only) ---- */
:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-focus);
}
/* Fallback for browsers without :focus-visible support */
:focus:not(:focus-visible) { outline: none; }

/* ---- Selection ---- */
::selection { background: var(--green-400); color: var(--ink-on-green); }

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: var(--z-max);
  background: var(--green-400);
  color: var(--ink-on-green);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  transition: top var(--dur-fast) var(--ease-state);
}
.skip-link:focus { top: var(--space-4); text-decoration: none; }

/* ---- Screen-reader-only ---- */
.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;
}

/* ==========================================================================
   Layout utilities (small set - NOT a framework)
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--prose { max-width: var(--container-prose); }
.container--narrow { max-width: 920px; }

.section { padding-block: var(--section-py); }
.section--tight { padding-block: clamp(2rem, 4vw, 3.5rem); }
.section--surface { background: var(--color-surface); }
.section--deep { background: var(--navy-deep); }

/* stack: vertical rhythm */
.stack > * + * { margin-top: var(--flow, var(--space-4)); }
.stack--sm { --flow: var(--space-2); }
.stack--lg { --flow: var(--space-6); }

/* grid helpers */
.grid { display: grid; gap: var(--space-6); }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
.grid--4 { grid-template-columns: 1fr; }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }

@media (min-width: 640px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.cluster--center { justify-content: center; }
.flow-center { text-align: center; }
.flow-center .container { display: block; }

/* section header block (eyebrow + title + lead) */
.section-head { max-width: 46rem; margin-bottom: var(--space-10); }
.section-head--center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-accent);
  margin-bottom: var(--space-3);
}
.lead { font-size: var(--text-lg); line-height: var(--leading-normal); color: var(--color-text-strong); }
.muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }

/* ==========================================================================
   Prose (article body - measure 66ch)
   ========================================================================== */
.prose { max-width: var(--container-prose); color: var(--color-text); font-size: var(--text-base); line-height: var(--leading-body); }
.prose > * + * { margin-top: var(--space-5); }
.prose h2 { margin-top: var(--space-12); font-size: var(--text-2xl); }
.prose h3 { margin-top: var(--space-8); font-size: var(--text-xl); }
.prose h2 + p, .prose h3 + p { margin-top: var(--space-4); }
.prose a { text-decoration: underline; }
.prose ul, .prose ol { padding-left: var(--space-6); }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: var(--space-2); }
.prose li::marker { color: var(--color-accent); }
.prose strong { color: var(--color-text-strong); font-weight: var(--weight-semibold); }
.prose blockquote {
  border-left: 3px solid var(--green-400);
  padding: var(--space-2) 0 var(--space-2) var(--space-5);
  color: var(--color-text-strong);
  font-size: var(--text-lg);
  font-style: normal;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--navy-surface2);
  color: var(--text-100);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
}
.prose figure { margin-block: var(--space-8); }
.prose figure img { border-radius: var(--radius-lg); }
.prose figcaption { margin-top: var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted); text-align: center; }

/* ==========================================================================
   Reveal-on-scroll (progressive enhancement; JS adds .is-visible)
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity var(--dur-slow) var(--ease-entrance), transform var(--dur-slow) var(--ease-entrance); }
.reveal.is-visible { opacity: 1; transform: none; }
/* No-JS + reduced-motion safety: always show */
.no-js .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Print stylesheet
   ========================================================================== */
@media print {
  body { background: #fff; color: #091D42; }
  .site-header, .site-footer, .cookie-banner, .btn, .mobile-nav, .skip-link { display: none !important; }
  a { color: #091D42; text-decoration: underline; }
  h1, h2, h3, h4 { color: #091D42; }
  .container { max-width: 100%; }
  .card, .section--surface { border: 1px solid #ccc; background: #fff; }
}
