/*
 * Vinarija Divjačko — "Etiketa" design system.
 * Every wine owns a colour; the interface borrows it. Paper, ink and cellar red stay quiet.
 * Mobile first. Breakpoints: 40rem, 60rem, 70rem (desktop navigation).
 */

/* 1. Fonts: self-hosted, OFL licensed (see assets/fonts). Croatian č ć đ š ž live in the latin-ext files. */
@font-face {
	font-family: "Gloock";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/gloock-latin-ext-400-normal.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Gloock";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/gloock-latin-400-normal.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Hanken Grotesk";
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url("../fonts/hanken-grotesk-latin-ext-wght-normal.woff2") format("woff2-variations");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Hanken Grotesk";
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url("../fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2-variations");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Metric-matched fallbacks keep layout shift small while the web fonts arrive. */
@font-face {
	font-family: "Gloock Fallback";
	src: local("Georgia");
	size-adjust: 96%;
	ascent-override: 98%;
	descent-override: 26%;
	line-gap-override: 0%;
}
@font-face {
	font-family: "Hanken Fallback";
	src: local("Arial");
	size-adjust: 103%;
	ascent-override: 93%;
	descent-override: 25%;
	line-gap-override: 0%;
}

/* 2. Tokens. */
:root {
	--paper: #eef0e8;
	--paper-deep: #e0e4d4;
	--ink: #26121d;
	--red: #7a1f33;
	--muted: #5a4750;
	--line: rgb(38 18 29 / 0.22);

	/* The six labels. Each is paired with the ink that passes AA on it. */
	--w-grasevina: #b8b04a;
	--w-chardonnay: #e2b23f;
	--w-pinot: #d6cf9b;
	--w-muskat: #e8922a;
	--w-rose: #e3837f;
	--w-zweigelt: #4a1c3e;

	/* Active wine; overridden per wine below. */
	--wine: var(--red);
	--wine-ink: var(--paper);

	--font-display: "Gloock", "Gloock Fallback", Georgia, serif;
	--font-body: "Hanken Grotesk", "Hanken Fallback", Arial, sans-serif;

	--text-small: 0.9375rem;
	--text-body: clamp(1.0625rem, 1.02rem + 0.2vw, 1.1875rem);
	--text-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
	--h3: clamp(1.5rem, 1.35rem + 0.6vw, 2rem);
	--h2: clamp(2.25rem, 1.5rem + 3.4vw, 4.5rem);
	--h1: clamp(3rem, 1.6rem + 6.4vw, 8.5rem);

	--gutter: clamp(1.25rem, 5vw, 3rem);
	--container-width: 80rem;
	--space-1: 0.5rem;
	--space-2: 1rem;
	--space-3: 1.5rem;
	--space-4: 2.5rem;
	--space-5: clamp(3rem, 6vw, 5rem);
	--space-6: clamp(4rem, 9vw, 8rem);
	--header-height: 4.25rem;
	--ease: cubic-bezier(0.22, 1, 0.36, 1);
	--focus: var(--ink);
}

/* Per-wine colour. Links only ever point at wines, so the slug match is safe. */
.wine-item__link[href*="grasevina"], .home-wine__link[href*="grasevina"], body[data-wine="grasevina"] { --wine: var(--w-grasevina); --wine-ink: var(--ink); }
.wine-item__link[href*="chardonnay"], .home-wine__link[href*="chardonnay"], body[data-wine="chardonnay"] { --wine: var(--w-chardonnay); --wine-ink: var(--ink); }
.wine-item__link[href*="pinot"], .home-wine__link[href*="pinot"], body[data-wine="pinot"] { --wine: var(--w-pinot); --wine-ink: var(--ink); }
.wine-item__link[href*="muskat"], .wine-item__link[href*="muscat"], .home-wine__link[href*="muskat"], .home-wine__link[href*="muscat"], body[data-wine="muskat"] { --wine: var(--w-muskat); --wine-ink: var(--ink); }
.wine-item__link[href*="rose"], .home-wine__link[href*="rose"], body[data-wine="rose"] { --wine: var(--w-rose); --wine-ink: var(--ink); }
.wine-item__link[href*="zweigelt"], .home-wine__link[href*="zweigelt"], body[data-wine="zweigelt"] { --wine: var(--w-zweigelt); --wine-ink: var(--paper); }

/* 3. Reset and base. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-height) + 1rem); }
body {
	margin: 0;
	color: var(--ink);
	background: var(--paper);
	font-family: var(--font-body);
	font-size: var(--text-body);
	font-weight: 400;
	line-height: 1.65;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	overflow-x: clip;
}
img, picture, svg { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
h1, h2, h3, h4 {
	margin: 0 0 var(--space-2);
	font-family: var(--font-display);
	font-weight: 400;
	line-height: 1.05;
	letter-spacing: -0.012em;
	text-wrap: balance;
}
h1 { font-size: var(--h1); }
h2 { font-size: var(--h2); }
h3 { font-size: var(--h3); line-height: 1.15; }
p, ul, ol, dl { margin: 0 0 var(--space-3); }
ul, ol { padding-inline-start: 1.25rem; }
a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 0.16em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
::selection { background: var(--wine); color: var(--wine-ink); }
main:focus { outline: none; }
hr { border: 0; border-block-start: 1px solid var(--line); }

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
textarea,
select {
	max-width: 100%;
	padding: 0.8rem 1rem;
	color: var(--ink);
	font: inherit;
	background: #fff;
	border: 2px solid var(--ink);
	border-radius: 0;
}
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

/* 4. Layout primitives. */
.container,
#divjacko-main:not([class]) {
	width: min(calc(100% - var(--gutter) * 2), var(--container-width));
	margin-inline: auto;
}
/* Unclassed fallback main (404, search, generic index): give it room and a readable rhythm. */
#divjacko-main:not([class]) { padding-block: var(--space-5) var(--space-6); }
#divjacko-main:not([class]) > h1 { margin-block-end: var(--space-4); color: var(--red); }
#divjacko-main:not([class]) .search-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-start; }
#divjacko-main:not([class]) .search-form label { flex: 1 1 16rem; max-width: 28rem; }
#divjacko-main:not([class]) .search-field { width: 100%; min-height: 3.25rem; }
#divjacko-main:not([class]) article { padding-block: var(--space-3); border-block-start: 3px solid var(--ink); }
.section { padding-block: var(--space-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.prose { max-width: 62ch; overflow-wrap: anywhere; }
.prose :is(h2, h3, h4) { margin-block-start: 1.5em; }
.prose > :first-child { margin-block-start: 0; }
.prose > :last-child { margin-block-end: 0; }
.prose a { text-decoration-thickness: 0.12em; }
.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
	clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
	position: fixed; z-index: 100; inset-block-start: 0.75rem; inset-inline-start: 0.75rem;
	padding: 0.75rem 1.25rem; color: var(--paper); background: var(--ink);
	font-weight: 700; transform: translateY(-200%);
}
.skip-link:focus { transform: none; outline: 3px solid var(--paper); outline-offset: 2px; }

/* 5. Buttons and links: a stamped label whose offset collapses when pressed. */
.button,
input[type="submit"],
button[type="submit"] {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 3.25rem; padding: 0.75rem 1.75rem;
	color: var(--paper); background: var(--red);
	border: 2px solid var(--ink); border-radius: 0;
	box-shadow: 0.3rem 0.3rem 0 var(--ink);
	font: inherit; font-size: 1.0625rem; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer;
	transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background-color 0.18s;
}
.button:hover, input[type="submit"]:hover, button[type="submit"]:hover { transform: translate(0.15rem, 0.15rem); box-shadow: 0.15rem 0.15rem 0 var(--ink); text-decoration: none; }
.button:active, input[type="submit"]:active, button[type="submit"]:active { transform: translate(0.3rem, 0.3rem); box-shadow: 0 0 0 var(--ink); }
.button--secondary { color: var(--ink); background: var(--paper); }

.home-text-link,
.wine-text-link {
	display: inline-flex; align-items: center; min-height: 2.75rem;
	font-weight: 700; text-decoration: underline; text-decoration-thickness: 0.12em; text-underline-offset: 0.25em;
}

/* 6. Header. */
.site-header {
	position: sticky; z-index: 50; inset-block-start: 0;
	background: var(--paper);
	border-block-end: 1px solid transparent;
	transition: border-color 0.25s;
}
.site-header.is-scrolled { border-color: var(--line); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-height); gap: var(--space-2); }
.site-brand {
	display: inline-flex; flex-direction: column; justify-content: center; min-height: 2.75rem;
	color: var(--red); text-decoration: none; line-height: 1;
}
.site-brand__descriptor { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.01em; color: var(--ink); }
.site-brand__name { font-family: var(--font-display); font-size: 1.75rem; letter-spacing: -0.01em; }
.menu-toggle {
	display: inline-flex; align-items: center; justify-content: flex-end; min-width: 2.75rem; min-height: 2.75rem; padding: 0.25rem 0 0.25rem 1rem;
	color: var(--ink); background: none; border: 0; font: inherit; font-weight: 700; cursor: pointer;
}
.menu-toggle[hidden] { display: none; }
/* Icon only: the label stays in the DOM as the button's accessible name. */
.menu-toggle__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.menu-toggle__icon { position: relative; display: block; width: 1.75rem; height: 0.875rem; }
.menu-toggle__icon span { position: absolute; inset-inline: 0; height: 3px; background: currentColor; transition: transform 0.3s var(--ease), top 0.3s var(--ease); }
.menu-toggle__icon span:first-child { top: 0; }
.menu-toggle__icon span:last-child { top: calc(100% - 3px); }
.menu-toggle[aria-expanded="true"] .menu-toggle__icon span:first-child { top: calc(50% - 1.5px); transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__icon span:last-child { top: calc(50% - 1.5px); transform: rotate(-45deg); }

/* Mobile menu is a panel hanging under the bar, so the bar (and the logo) never moves and the page is not pushed. */
.header-navigation {
	position: absolute; inset-inline: 0; inset-block-start: 100%;
	max-height: calc(100dvh - var(--header-height)); overflow-y: auto;
	padding: var(--space-2) var(--gutter) var(--space-4);
	background: var(--paper); border-block-end: 3px solid var(--ink);
}
.header-navigation[hidden] { display: none; }
.header-navigation:not([hidden]) { animation: nav-in 0.3s var(--ease); }
@keyframes nav-in { from { opacity: 0; transform: translateY(-0.5rem); } }
.primary-menu { display: grid; margin: 0; padding: 0; list-style: none; }
.primary-menu a {
	display: flex; align-items: center; min-height: 3.5rem;
	font-family: var(--font-display); font-size: 2rem; line-height: 1; text-decoration: none;
	border-block-end: 1px solid var(--line);
}
.primary-menu a:hover { color: var(--red); }
.primary-menu a[aria-current="page"], .primary-menu .current-menu-item > a { color: var(--red); }
.language-switcher { margin-block-start: var(--space-3); }
.language-switcher__list { display: flex; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.language-switcher a {
	display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.75rem;
	font-size: var(--text-small); font-weight: 700; text-decoration: none; border: 2px solid transparent;
}
.language-switcher a:hover { border-color: var(--ink); }
.language-switcher a[aria-current="true"] { color: var(--paper); background: var(--ink); }

@media (min-width: 70rem) {
	.header-navigation, .header-navigation[hidden] { position: static; display: flex; align-items: center; gap: var(--space-4); max-height: none; overflow: visible; padding: 0; background: none; border: 0; animation: none; }
	.primary-menu { display: flex; gap: 0.25rem; }
	.primary-menu a { position: relative; min-height: 2.75rem; padding-inline: 1rem; font-family: var(--font-body); font-size: 1.0625rem; font-weight: 600; border: 0; }
	.primary-menu a::after {
		content: ""; position: absolute; inset-inline: 1rem; inset-block-end: 0.3rem; height: 3px; background: var(--red);
		transform: scaleX(0); transform-origin: left; transition: transform 0.3s var(--ease);
	}
	.primary-menu a:hover::after, .primary-menu a[aria-current="page"]::after, .primary-menu .current-menu-item > a::after { transform: scaleX(1); }
	.language-switcher { margin: 0; }
}

/* 7. Optional contact call to action. */
.contact-cta { color: var(--paper); background: var(--red); padding-block: var(--space-5); }
.contact-cta__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-5); --focus: var(--paper); }
.contact-cta h2 { max-width: 18ch; margin: 0; }
.contact-cta .button { box-shadow: 0.3rem 0.3rem 0 var(--ink); }

/* 8. Footer: ink, the six-colour label stripe. */
.site-footer { position: relative; color: var(--paper); background: var(--ink); padding-block: var(--space-5) var(--space-2); --focus: var(--paper); overflow: hidden; }
.site-footer::before {
	content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 0.625rem;
	background: linear-gradient(90deg,
		var(--w-grasevina) 0 16.66%, var(--w-chardonnay) 16.66% 33.33%, var(--w-pinot) 33.33% 50%,
		var(--w-muskat) 50% 66.66%, var(--w-rose) 66.66% 83.33%, var(--w-zweigelt) 83.33% 100%);
}
.site-footer__top { display: grid; gap: var(--space-4); }
.site-footer__identity { margin: 0; font-family: var(--font-display); font-size: var(--h3); }
.site-footer__identity a { color: inherit; text-decoration: none; }
.site-footer__identity a:hover { color: var(--w-chardonnay); }
.footer-menu { display: grid; margin: 0; padding: 0; list-style: none; }
.footer-menu a, .footer-contact a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.footer-contact h2 { margin-block-end: var(--space-1); font-family: var(--font-body); font-size: 1rem; font-weight: 700; letter-spacing: 0; }
.footer-contact address { display: grid; justify-items: start; font-style: normal; }
.footer-contact address p { margin: 0; }
.footer-contact > a { margin-block-start: 0.25rem; font-weight: 700; }
.site-footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-1) var(--space-3); margin-block-start: var(--space-4); padding-block-start: var(--space-2); border-block-start: 1px solid rgb(238 240 232 / 0.25); font-size: var(--text-small); }
.site-footer__bottom p { margin: 0; }
.back-to-top { display: inline-flex; align-items: center; min-height: 2.75rem; font-weight: 700; }

@media (min-width: 40rem) {
	.footer-menu { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 0 var(--space-3); }
	.footer-menu a { white-space: nowrap; }
	.site-footer__top { grid-template-columns: 1fr 1fr; }
	.site-footer__identity, .footer-navigation { grid-column: 1; }
	.footer-contact { grid-column: 2; grid-row: 1 / span 2; }
}

/* 9. Reduced motion: remove movement, keep state changes instant. */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important; scroll-behavior: auto !important;
	}
}
