/* ==========================================================================
   SITE FOOTER (CVI §9)
   --------------------------------------------------------------------------
   Mobile-first. The composition changes shape four times: a single column
   below 768px, two columns to 1024, a logo-anchored four-column row to 1280,
   then the full 12-column grid at the CVI's design width.

   Typography is not redeclared here. The markup applies the existing utilities
   (.type-h5, .type-body-inter, .type-small, .type-warning) and font properties
   inherit to their descendants, so only link colour — which base/global.css
   sets on every <a> — needs restating.

   The grid is declared from --grid-columns / --grid-gap rather than by applying
   the .grid-12 utility, because three of the four breakpoints would otherwise
   have to override it.
   ========================================================================== */

.site-footer {
	background-color: var(--color-surface-mid);
	border-top: 1px solid var(--color-border-footer);
	padding-top: var(--space-lg);
	padding-bottom: var(--space-lg);
}

/* --------------------------------------------------------------------------
   TOP GRID
   -------------------------------------------------------------------------- */

.site-footer__grid {
	display: grid;
	grid-template-columns: 1fr;
	row-gap: var(--space-lg);
}

/* Every column shares the same internal rhythm: 24px from heading to content
   (CVI §9), 8px between the items inside it. */
.site-footer__brand,
.site-footer__col {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-md);
	min-width: 0;
}

.site-footer__heading {
	margin: 0;
}

/* --------------------------------------------------------------------------
   BRAND
   -------------------------------------------------------------------------- */

/* Intrinsic size is 262x146. max-width keeps it inside a 360px viewport once
   the page gutters are taken off. */
.site-footer__logo {
	width: 262px;
	max-width: 100%;
	height: auto;
}

.site-footer__social {
	display: flex;
	align-items: center;
	gap: 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* 40px ring, 1px, in rose, with the mark itself in primary red — all four
   measured off the UI Final footer, where the ring reads #E4BEB8 and the mark
   #A20007 exactly. The mark was previously drawn in the body brown, which is
   the one value the frame does not use here. */
.site-footer__social-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 1px solid var(--color-rose);
	border-radius: var(--radius-pill);
	color: var(--color-primary);
	text-decoration: none;
	transition:
		color var(--transition-base),
		border-color var(--transition-base),
		transform var(--transition-base);
}

/* Resting is already primary, so hover deepens rather than reddens — the same
   move the rest of the red-family hovers make. focus-visible takes the colour
   change too, so a keyboard lands on the same feedback a pointer gets; the ring
   itself comes from the global :focus-visible rule (CVI §6.2). */
.site-footer__social-link:hover,
.site-footer__social-link:focus-visible {
	color: var(--color-primary-dark);
	border-color: var(--color-primary-dark);
}

.site-footer__social-link:active {
	transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {

	.site-footer__social-link:active {
		transform: none;
	}
}

/* --------------------------------------------------------------------------
   MENU COLUMNS
   -------------------------------------------------------------------------- */

.site-footer__menu {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Only colour and decoration: size, family and line-height come from the
   .type-body-inter utility on the parent list. */
.site-footer__menu a {
	display: block;
	color: var(--color-text);
	text-decoration: none;
	transition: color var(--transition-base);
}

.site-footer__menu a:hover,
.site-footer__menu .current-menu-item > a {
	color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   CONTACT
   -------------------------------------------------------------------------- */

.site-footer__contact-details {
	display: flex;
	flex-direction: column;
	gap: var(--space-xs);
	width: 100%;
	/* <address> is italic by default. */
	font-style: normal;
}

.site-footer__contact-details p {
	margin: 0;
}

.site-footer__contact-details a {
	color: var(--color-text);
	text-decoration: none;
	transition: color var(--transition-base);
}

.site-footer__contact-details a:hover {
	color: var(--color-primary);
}

/* Divider above the legally required alcohol warning. */
.site-footer__warning {
	width: 100%;
	padding-top: 17px;
	border-top: 1px solid var(--color-border);
}

.site-footer__warning p {
	margin: 0;
}

/* --------------------------------------------------------------------------
   BOTTOM BAR

   A 1fr / auto / 1fr grid rather than flex space-between: the two equal outer
   tracks put the agency mark at the true centre of the container, not merely
   in whatever space is left over. Each child is placed explicitly so that
   centring survives the legal menu being unassigned — with flex, a missing
   third item would silently shift the mark off centre.
   -------------------------------------------------------------------------- */

.site-footer__bottom {
	display: grid;
	grid-template-columns: 1fr;
	align-items: center;
	gap: var(--space-sm);
	margin-top: var(--space-lg);
	padding-top: var(--space-sm);
	border-top: 1px solid var(--color-border);
}

.site-footer__copyright {
	grid-column: 1;
	grid-row: 1;
	margin: 0;
	justify-self: start;
}

.site-footer__legal {
	grid-column: 1;
	grid-row: 2;
	justify-self: start;
}

.site-footer__credit {
	grid-column: 1;
	grid-row: 3;
	justify-self: start;
}

.site-footer__legal-menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-xs) var(--space-md);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer__legal-menu a {
	color: var(--color-text);
	text-decoration: none;
	white-space: nowrap;
	transition: color var(--transition-base);
}

.site-footer__legal-menu a:hover,
.site-footer__legal-menu .current-menu-item > a {
	color: var(--color-primary);
}

/* Marketing Sharks mark. Masked rather than placed as an <img> so its colour
   comes from a token instead of being baked into the asset — the source file
   is a white/reversed variant that would be invisible on this surface. Its
   true aspect is 466:134, so 115px wide is 33px tall. */
.site-footer__credit {
	width: 115px;
	height: 33px;
	background-color: var(--color-ink);
	opacity: 0.2;
	-webkit-mask: url("../../images/marketing-sharks.svg") center / contain no-repeat;
	mask: url("../../images/marketing-sharks.svg") center / contain no-repeat;
}

/* --------------------------------------------------------------------------
   PHONE (<768) — grouped, not merely stacked

   One long column put 9 links, the contact block and the legal row one under
   another at 1179px, with 24px link rows, 20px phone/email rows and 15px legal
   rows to tap. The content is small, so it is regrouped rather than hidden:
   accordions would add a tap in front of every link for no saving worth it.

   - The two link menus share a row. Their longest label (Eripakkumised) is
     ~120px against a ~151px column at 375, so neither wraps.
   - Brand, menus and contact are separated by the footer's hairline, so each
     group reads as one thing.
   - Every link, the phone, the e-mail and the legal links are 44px tall to the
     touch, while the visible spacing stays close to what it was.
   - The legal links lead the bottom area as a proper row, with the copyright
     and the agency mark after them.

   Scoped below 768 so the reviewed tablet and desktop compositions are
   untouched.
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {

	/* No logo on phones (client, 25.11.2026): the header already carries the
	   lockup, and here it cost ~200px of height. The footer's top padding drops
	   with it to 24, so the social row sits 24 above and 24 below — the same
	   rhythm as the groups under it — instead of under the 48px meant for the
	   logo. From 768 up (tablet and desktop) the logo and padding stay; an
	   iPad mini in portrait (744) is below 768 and gets this phone footer. */
	.site-footer {
		padding-top: var(--space-md);
	}

	.site-footer__logo {
		display: none;
	}

	.site-footer__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: var(--space-md);
		row-gap: 0;
	}

	.site-footer__brand,
	.site-footer__contact {
		grid-column: 1 / -1;
	}

	/* The rule under the brand block runs the full width. Drawn on the two menu
	   columns instead, it broke at their 24px gutter into two short dashes. */
	.site-footer__brand {
		padding-bottom: var(--space-md);
		border-bottom: 1px solid var(--color-border);
	}

	/* Heading to first link: 8px plus the 10px of the link row's own padding,
	   where 24px on top of a 44px row would open a gap wider than the group. */
	.site-footer__col {
		gap: var(--space-xs);
		padding-block: var(--space-md);
	}

	/* A lone menu (the other one unassigned) takes the full row. */
	.site-footer__col--products:last-child,
	.site-footer__col--products:has(+ .site-footer__contact) {
		grid-column: 1 / -1;
	}

	.site-footer__contact {
		gap: var(--space-xs);
		padding-top: var(--space-md);
		border-top: 1px solid var(--color-border);
	}

	.site-footer__warning {
		margin-top: var(--space-sm);
	}

	.site-footer__menu {
		gap: 0;
	}

	.site-footer__menu a,
	.site-footer__contact-details a,
	.site-footer__legal-menu a {
		display: flex;
		align-items: center;
		min-height: 44px;
	}

	.site-footer__contact-details {
		gap: 0;
	}

	/* The address is not a control; it keeps its text height but sits on the
	   same 44px pitch as the two links under it, so the three lines are even. */
	.site-footer__contact-details p:first-child {
		display: flex;
		align-items: center;
		min-height: 44px;
	}

	/* The frame's 40px ring stays 40px; the hit area around it is 44. */
	.site-footer__social-link {
		position: relative;
	}

	.site-footer__social-link::after {
		content: '';
		position: absolute;
		inset: -3px;
		border-radius: var(--radius-pill);
	}

	.site-footer__bottom {
		gap: var(--space-xs);
		margin-top: var(--space-md);
		padding-top: var(--space-xs);
	}

	.site-footer__legal {
		grid-row: 1;
	}

	.site-footer__copyright {
		grid-row: 2;
	}

	.site-footer__credit {
		grid-row: 3;
		margin-top: var(--space-xs);
	}

	.site-footer__legal-menu {
		column-gap: var(--space-md);
		row-gap: 0;
	}
}

/* --------------------------------------------------------------------------
   TABLET (>=768) — two columns
   -------------------------------------------------------------------------- */

@media (min-width: 768px) {

	.site-footer__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: var(--space-2xl);
		row-gap: var(--space-2xl);
	}

	.site-footer__bottom {
		grid-template-columns: 1fr auto 1fr;
		gap: var(--space-md);
	}

	.site-footer__copyright {
		grid-row: 1;
	}

	.site-footer__credit {
		grid-column: 2;
		grid-row: 1;
		justify-self: center;
	}

	.site-footer__legal {
		grid-column: 3;
		grid-row: 1;
		justify-self: end;
	}

	/* Three legal labels cannot fit one line at 768. When they wrap, the
	   overflow line hugs the right edge rather than stranding itself under the
	   first item. */
	.site-footer__legal-menu {
		justify-content: flex-end;
	}
}

/* --------------------------------------------------------------------------
   SMALL DESKTOP (>=1024) — four columns anchored to the logo

   The 12-column grid cannot be used yet: at 1024 the container is 896px wide
   and eleven --grid-gap (80px) gutters would consume 880px of it. Instead the
   brand column takes the logo's intrinsic width and the remaining three share
   what is left.
   -------------------------------------------------------------------------- */

@media (min-width: 1024px) {

	.site-footer__grid {
		grid-template-columns: 1.4fr 1fr 1fr 1.4fr;
		column-gap: var(--space-lg);
		row-gap: var(--space-lg);
	}

	/* Placed explicitly rather than auto-flowed. A fixed first track would be
	   claimed by whichever column happens to come first, so with no logo asset
	   the products menu would inherit the brand column's width. */
	.site-footer__brand {
		grid-column: 1;
	}

	.site-footer__col--products {
		grid-column: 2;
	}

	.site-footer__col--company {
		grid-column: 3;
	}

	.site-footer__contact {
		grid-column: 4;
	}
}

/* --------------------------------------------------------------------------
   DESKTOP (>=1280) — the footer's own four tracks, not the 12-column grid

   Measured off the Finalized Footer frame at 1440, the menu columns start at
   432.8, 717.3 and 993.6. Only the last of those falls on the CVI 12-column
   grid (column 9 = 992); 432.8 and 717.3 sit between columns, so the footer
   menus are not built on that grid in the design and cannot be expressed with
   it. Placing them on columns 4 and 7 put them at 412 and 760 — 21px left and
   43px right of the design, and the pitch uneven at 348/232 where the design
   is 284.5/276.3.

   Solving the frame's own proportions at the CVI's 80px gutter gives tracks of
   288.8, 204.5, 196.3 and 382.4 — that is 1.44 : 1 : 1 : 1.91. Declared below
   as 1.45fr 1fr 1fr 1.9fr, which lands the three columns within 2.4px of the
   design and keeps working whatever the menus are named, since nothing here is
   tied to an item or a fixed width.

   The column placements come from the >=1024 block above and still apply.
   -------------------------------------------------------------------------- */

@media (min-width: 1280px) {

	.site-footer {
		padding-top: 81px;
		/* 40, not the 48 the smaller breakpoints use. Measured off the frame:
		   the rule below puts the divider at 347.4 and the footer ends at 438.1,
		   which leaves 90.7 for the lower row against the 98 that a 48px bottom
		   padding produces. */
		padding-bottom: 40px;
	}

	/* The divider sits 347.4 from the footer top in the frame and was landing at
	   336. Everything above it already matched — the warning's first line starts
	   at 255.7 in the design and 256 here — so the missing 11px is the space
	   between the menu grid and the divider, not the content above it. */
	.site-footer__bottom {
		margin-top: 59px;
	}

	.site-footer__grid {
		grid-template-columns: 1.45fr 1fr 1fr 1.9fr;
		column-gap: var(--space-lg);
	}
}

/* --------------------------------------------------------------------------
   LARGE DESKTOP (>=1440) — the CVI's design width, where the full §4 grid
   gutter applies and the logo sits at its intrinsic 262px.
   -------------------------------------------------------------------------- */

@media (min-width: 1440px) {

	.site-footer__grid {
		column-gap: var(--grid-gap);
	}
}

/* --------------------------------------------------------------------------
   COOKIE-PREFERENCES BUTTON ON PHONES AND TABLETS (final QA 01.11, V05)

   The privacy plugin's floating button sits fixed at the bottom-left corner,
   where on a phone it covered prices, chips and the cart's total. Below 1024px
   it now waits for the footer: header.js watches the footer and marks the
   root while any of it is on screen, and only then is the button shown — in
   the free space at the end of the page, on every page, including short ones
   where the footer is in view from the start. Hidden means visibility:hidden,
   so the button is not focusable or clickable while it is away, and nothing
   moves when it returns. The rule only applies once the watcher is running
   (has-footer-watch): without it the button simply stays as the plugin draws
   it. Desktop is unchanged; the plugin is untouched.

   Touch tablets in landscape (iPad 1024–1366: no hover, coarse pointer) get the
   same rule: at 1024x768 the button sat on the hero's "Avasta valikut" (final
   QA 01.11, V30). A desktop with a mouse matches neither query.
   -------------------------------------------------------------------------- */

@media (max-width: 1023px), (hover: none) and (pointer: coarse) {

	html.has-footer-watch:not(.is-footer-in-view) .sharks-cookie-floating-wrap {
		visibility: hidden;
		opacity: 0;
		pointer-events: none;
	}

	html.has-footer-watch .sharks-cookie-floating-wrap {
		transition:
			opacity var(--transition-base),
			visibility var(--transition-base);
	}
}
