/* =========================================================================
   F01 TOKENS — colours, fonts, spacing. Every other feature uses only these
   variables (no colour codes anywhere else). Prefix: --ap-
   Palettes: zelena (default) · plava · smeda — chosen by <html data-ap-palette>.
   Contrast checked (WCAG AA = 4.5): text/background 10.5–15.2, links 5.8–8.0,
   muted text 5.8–7.6, white on brand 6.5–8.5 — see FEATURES.md.
   Rule: colours, font families, font sizes, spacing and radii come from here. Small component
   dimensions (icon size, border width, breakpoints, transition times) stay in the feature's own CSS.
   ========================================================================= */

/* ---- 1. shared by all palettes ---- */
:root {
	--ap-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
	--ap-font-head: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;

	/* --ap-scale: the reader's text size (1 = normal). Set ONLY by feature 08 (the A− / A+ buttons); every TEXT size below follows it.
	   The header's own sizes (menu, logo name) do not follow it, so the header never breaks. */
	--ap-scale: 1;
	--ap-text-size: calc(19px * var(--ap-scale));            /* body text, never below 18px at normal size */
	--ap-line-height: 1.6;
	--ap-h1: calc(40px * var(--ap-scale));  --ap-h2: calc(30px * var(--ap-scale));  --ap-h3: calc(22px * var(--ap-scale));
	--ap-small: calc(16px * var(--ap-scale));
	/* type scale (other features use these, not loose pixel sizes) */
	--ap-fs-xs: calc(14.5px * var(--ap-scale));  --ap-fs-s: calc(16px * var(--ap-scale));  --ap-fs-m: calc(17px * var(--ap-scale));
	--ap-fs-l: calc(19px * var(--ap-scale));  --ap-fs-xl: calc(22px * var(--ap-scale));  --ap-fs-2xl: calc(30px * var(--ap-scale));
	--ap-fs-menu: 16.5px;  --ap-fs-menu-fit1: 15.5px;  --ap-fs-menu-fit2: 14.5px;   /* header menu squeezes on narrower screens */

	--ap-side: clamp(16px, 2.5vw, 48px);   /* side margin of overview pages */
	--ap-gap: 32px;                         /* space between page sections */
	--ap-gap-sm: 16px;
	/* spacing scale: padding, margin and gaps use these */
	--ap-sp-1: 4px;  --ap-sp-2: 8px;  --ap-sp-3: 12px;  --ap-sp-4: 16px;  --ap-sp-5: 24px;  --ap-sp-6: 32px;  --ap-sp-7: 48px;
	--ap-touch: 44px;                        /* smallest tap target */
	--ap-radius: 14px;
	--ap-radius-sm: 10px;
	--ap-radius-pill: 999px;
	--ap-reading: 70ch;                     /* reading column of an article */

	--ap-hdr-top: 88px;   /* full header: top row (logo, name, links) */
	--ap-hdr-nav: 60px;   /* the thin line: menu row */

	--ap-white: #ffffff;
	--ap-card: #ffffff;
	--ap-ink-dark: #111827;

	/* warning scale — same in all palettes */
	--ap-warn-y: #ffd400;  --ap-warn-y-ink: #111827;
	--ap-warn-o: #c2410c;  --ap-warn-o-ink: #ffffff;
	--ap-warn-r: #b42318;  --ap-warn-r-ink: #ffffff;

	/* prices: up / down / flat */
	--ap-up: #166534;  --ap-down: #b42318;  --ap-flat: #4b5563;

	/* farm-type colours (white text on them, contrast >= 5) */
	--ap-s-ratarstvo: #b45309;
	--ap-s-vinogradarstvo: #6b21a8;
	--ap-s-povrcarstvo: #15803d;
	--ap-s-stocarstvo: #0f766e;
	--ap-s-pcelarstvo: #8a5a00;
	--ap-s-svi: #4b5563;

	/* shadows (the only place with transparent colours) */
	--ap-shadow-card: 0 1px 3px rgba(16, 24, 40, .1), 0 1px 2px rgba(16, 24, 40, .06);
	--ap-shadow-pop: 0 12px 28px rgba(0, 0, 0, .2);
	--ap-shadow-bar: 0 2px 10px rgba(0, 0, 0, .22);
	--ap-line-on-dark: rgba(255, 255, 255, .28);
}
/* phones: smaller header rows (class set by the header feature, F03) */
html.ap-m { --ap-hdr-top: 72px; --ap-hdr-nav: 56px; }
@media (max-width: 899px) { :root { --ap-h1: calc(30px * var(--ap-scale)); --ap-h2: calc(26px * var(--ap-scale)); --ap-gap: 24px; } }

/* ---- 2. palettes ---- */
/* ZELENA (default; also applies when the attribute is missing) */
:root, :root[data-ap-palette="zelena"] {
	--ap-brand: #1f6b3a;   --ap-brand-dark: #164f2b;   --ap-on-brand: #ffffff;
	--ap-bg: #f2f6f1;      --ap-tint: #e4eee6;         --ap-line: #d5e0d7;
	--ap-text: #1e2939;    --ap-muted: #4b5563;
	--ap-link: #0057b8;    --ap-link-hover: #003d82;
	--ap-btn: #1f6b3a;     --ap-btn-hover: #164f2b;    --ap-btn-ink: #ffffff;
	--ap-focus: #0057b8;
}
:root[data-ap-palette="plava"] {
	--ap-brand: #1b4f8f;   --ap-brand-dark: #123a6b;   --ap-on-brand: #ffffff;
	--ap-bg: #eef3f9;      --ap-tint: #dde8f4;         --ap-line: #cfdceb;
	--ap-text: #1b2733;    --ap-muted: #475569;
	--ap-link: #0b4f9c;    --ap-link-hover: #083a75;
	--ap-btn: #1b4f8f;     --ap-btn-hover: #123a6b;    --ap-btn-ink: #ffffff;
	--ap-focus: #9a3412;
}
:root[data-ap-palette="smeda"] {
	--ap-brand: #6b4423;   --ap-brand-dark: #4a2f17;   --ap-on-brand: #ffffff;
	--ap-bg: #f6f0e6;      --ap-tint: #eadfcf;         --ap-line: #e0d3bf;
	--ap-text: #3b3630;    --ap-muted: #5b5249;
	--ap-link: #8a3a0c;    --ap-link-hover: #612807;
	--ap-btn: #6b4423;     --ap-btn-hover: #4a2f17;    --ap-btn-ink: #ffffff;
	--ap-focus: #0b5cad;
}

/* ---- 3. make GeneratePress follow the tokens (GeneratePress is not edited, only overridden) ---- */
:root {
	--contrast: var(--ap-text);
	--contrast-2: var(--ap-muted);
	--contrast-3: var(--ap-line);
	--base: var(--ap-tint);
	--base-2: var(--ap-bg);
	--base-3: var(--ap-card);
	--accent: var(--ap-link);
}
body {
	background-color: var(--ap-bg);
	color: var(--ap-text);
	font-family: var(--ap-font);
	font-size: var(--ap-text-size);
	line-height: var(--ap-line-height);
}
button, input, select, textarea { font-family: var(--ap-font); }
a { color: var(--ap-link); text-underline-offset: 3px; }
a:hover, a:focus, a:active { color: var(--ap-link-hover); }
h1, h2, h3, h4 { font-family: var(--ap-font-head); font-weight: 700; line-height: 1.25; color: var(--ap-text); }
h1 { font-size: var(--ap-h1); }
h2 { font-size: var(--ap-h2); }
h3 { font-size: var(--ap-h3); }
h4 { font-size: inherit; }
:focus-visible { outline: 3px solid var(--ap-focus); outline-offset: 2px; }
